commit b5bba5e3761fbb0abb0052e4d441abb20fc6b554 Author: zsxfly <1543588107@qq.com> Date: Mon Apr 15 09:23:32 2024 +0800 初始化仓库,提交zhongkong工程源码 zsxfly20240415 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..32f4aaf --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/.vscode/ +output/ diff --git a/Release Notes SDK.docx b/Release Notes SDK.docx new file mode 100644 index 0000000..ed55b71 Binary files /dev/null and b/Release Notes SDK.docx differ diff --git a/ble/api/att.h b/ble/api/att.h new file mode 100644 index 0000000..df34503 --- /dev/null +++ b/ble/api/att.h @@ -0,0 +1,1213 @@ +/** + **************************************************************************************** + * + * @file att.h + * + * @brief Attribute Protocol Header file. + * + **************************************************************************************** + */ + +#ifndef ATT_H_ +#define ATT_H_ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Macro used to LSB first 16-bits UUID +#define ATT_UUID16(uuid) (uuid) + +/// Invalid attribute handle +#define ATT_INVALID_HDL 0x0000 +/// Invalid attribute index(per profile) +#define ATT_INVALID_IDX 0xFF + +/// Range of attribute handle +#define ATT_1ST_REQ_START_HDL 0x0001 +#define ATT_1ST_REQ_END_HDL 0xFFFF + +/// Maximum possible attribute handle +#define ATT_MAX_ATTR_HDL 0xFFFF + +/// Offset of value in signed PDU +#define ATT_SIGNED_PDU_VAL_OFFSET 0x03 + +/// Attribute Features +#define ATT_SERVER_CONFIG 0x0001 +#define ATT_SERVICE_DISC 0x0002 +#define ATT_RELATIONSHIP_DISC 0x0004 +#define ATT_CHAR_DISC 0x0008 +#define ATT_CHAR_DESC_DISC 0x0010 +#define ATT_RD_CHAR_VALUE 0x0020 +#define ATT_WR_CHAR_VALUE 0x0040 +#define ATT_NOTIF_CHAR_VALUE 0x0080 +#define ATT_IND_CHAR_VALUE 0x0100 +#define ATT_RD_CHAR_DESC 0x0200 +#define ATT_WR_CHAR_DESC 0x0400 + +/// Length, number, offset defines +#define ATT_SVC_VALUE_MAX_LEN 0x0030 +#define ATT_CHAR_NAME_MAX_LEN 0x0030 +#define ATT_UUID16_LEN 0x0002 +#define ATT_UUID32_LEN 0x0004 +#define ATT_UUID128_LEN 0x0010 + +/// offset - l2cap header and ATT code +#define ATT_PDU_DATA_OFFSET 0x05 + +/// Characteristic Properties Bit +#define ATT_CHAR_PROP_BCAST 0x01 +#define ATT_CHAR_PROP_RD 0x02 +#define ATT_CHAR_PROP_WR_NO_RESP 0x04 +#define ATT_CHAR_PROP_WR 0x08 +#define ATT_CHAR_PROP_NTF 0x10 +#define ATT_CHAR_PROP_IND 0x20 +#define ATT_CHAR_PROP_AUTH 0x40 +#define ATT_CHAR_PROP_EXT_PROP 0x80 +/// Invalid Attribute Handle +#define ATT_INVALID_SEARCH_HANDLE 0x0000 +#define ATT_INVALID_HANDLE 0x0000 +/// Read Information Request +#define ATT_UUID_FILTER_0 0x00 +#define ATT_UUID_FILTER_2 0x02 +#define ATT_UUID_FILTER_16 0x10 +/// Read Information Response +#define ATT_FORMAT_LEN 0x0001 +#define ATT_FORMAT_16BIT_UUID 0x01 +#define ATT_FORMAT_128BIT_UUID 0x02 +/// For No fix length PDU +#define ATT_HANDLE_LEN 0x0002 +#define ATT_EACHLEN_LEN 0x0001 +#define ATT_PROP_LEN 0x0001 +#define ATT_CODE_LEN 0x0001 +#define ATT_CODE_AND_DATA_LEN 0x0002 +#define ATT_CODE_AND_HDL_LEN 0x0003 +#define ATT_CODE_AND_HDL_LEN_AND_OFFSET 0x0005 +#define ATT_SIGNATURE_LEN 0x0C + +/// extended characteristics +#define ATT_EXT_RELIABLE_WRITE 0x0001 +#define ATT_EXT_WRITABLE_AUX 0x0002 +#define ATT_EXT_RFU 0xFFFC + +/// PDU size for error response +#define ATT_ERROR_RESP_LEN 0x05 + +/// Offset of value in signed PDU +#define ATT_SIGNED_PDU_VAL_OFFSET 0x03 + + +#define ATT_BT_UUID_128 {0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80, \ + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + + +/* Attribute Specification Defines */ + +/// Common 16-bit Universal Unique Identifier +enum att_uuid16 { + ATT_INVALID_UUID = ATT_UUID16(0x0000), + + /*----------------- SERVICES ---------------------*/ + /// Generic Access Profile + ATT_SVC_GENERIC_ACCESS = ATT_UUID16(0x1800), + /// Attribute Profile + ATT_SVC_GENERIC_ATTRIBUTE = ATT_UUID16(0x1801), + /// Immediate alert Service + ATT_SVC_IMMEDIATE_ALERT = ATT_UUID16(0x1802), + /// Link Loss Service + ATT_SVC_LINK_LOSS = ATT_UUID16(0x1803), + /// Tx Power Service + ATT_SVC_TX_POWER = ATT_UUID16(0x1804), + /// Current Time Service Service + ATT_SVC_CURRENT_TIME = ATT_UUID16(0x1805), + /// Reference Time Update Service + ATT_SVC_REF_TIME_UPDATE = ATT_UUID16(0x1806), + /// Next DST Change Service + ATT_SVC_NEXT_DST_CHANGE = ATT_UUID16(0x1807), + /// Glucose Service + ATT_SVC_GLUCOSE = ATT_UUID16(0x1808), + /// Health Thermometer Service + ATT_SVC_HEALTH_THERMOM = ATT_UUID16(0x1809), + /// Device Information Service + ATT_SVC_DEVICE_INFO = ATT_UUID16(0x180A), + /// Heart Rate Service + ATT_SVC_HEART_RATE = ATT_UUID16(0x180D), + /// Phone Alert Status Service + ATT_SVC_PHONE_ALERT_STATUS = ATT_UUID16(0x180E), + /// Battery Service + ATT_SVC_BATTERY_SERVICE = ATT_UUID16(0x180F), + /// Blood Pressure Service + ATT_SVC_BLOOD_PRESSURE = ATT_UUID16(0x1810), + /// Alert Notification Service + ATT_SVC_ALERT_NTF = ATT_UUID16(0x1811), + /// HID Service + ATT_SVC_HID = ATT_UUID16(0x1812), + /// Scan Parameters Service + ATT_SVC_SCAN_PARAMETERS = ATT_UUID16(0x1813), + /// Running Speed and Cadence Service + ATT_SVC_RUNNING_SPEED_CADENCE = ATT_UUID16(0x1814), + /// Cycling Speed and Cadence Service + ATT_SVC_CYCLING_SPEED_CADENCE = ATT_UUID16(0x1816), + /// Cycling Power Service + ATT_SVC_CYCLING_POWER = ATT_UUID16(0x1818), + /// Location and Navigation Service + ATT_SVC_LOCATION_AND_NAVIGATION = ATT_UUID16(0x1819), + /// Environmental Sensing Service + ATT_SVC_ENVIRONMENTAL_SENSING = ATT_UUID16(0x181A), + /// Body Composition Service + ATT_SVC_BODY_COMPOSITION = ATT_UUID16(0x181B), + /// User Data Service + ATT_SVC_USER_DATA = ATT_UUID16(0x181C), + /// Weight Scale Service + ATT_SVC_WEIGHT_SCALE = ATT_UUID16(0x181D), + /// Bond Management Service + ATT_SVC_BOND_MANAGEMENT = ATT_UUID16(0x181E), + /// Continuous Glucose Monitoring Service + ATT_SVC_CONTINUOUS_GLUCOSE_MONITORING = ATT_UUID16(0x181F), + /// Internet Protocol Support Service + ATT_SVC_IP_SUPPORT = ATT_UUID16(0x1820), + /// Indoor Positioning Service + ATT_SVC_INDOOR_POSITIONING = ATT_UUID16(0x1821), + /// Pulse Oximeter Service + ATT_SVC_PULSE_OXIMETER = ATT_UUID16(0x1822), + /// HTTP Proxy Service + ATT_SVC_HTTP_PROXY = ATT_UUID16(0x1823), + /// Transport Discovery Service + ATT_SVC_TRANSPORT_DISCOVERY = ATT_UUID16(0x1824), + /// Object Transfer Service + ATT_SVC_OBJECT_TRANSFER = ATT_UUID16(0x1825), + /// Mesh Provisioning Service + ATT_SVC_MESH_PROVISIONING = ATT_UUID16(0x1827), + /// Mesh Proxy Service + ATT_SVC_MESH_PROXY = ATT_UUID16(0x1828), + + /*------------------- UNITS ---------------------*/ + /// No defined unit + ATT_UNIT_UNITLESS = ATT_UUID16(0x2700), + /// Length Unit - Metre + ATT_UNIT_METRE = ATT_UUID16(0x2701), + /// Mass unit - Kilogram + ATT_UNIT_KG = ATT_UUID16(0x2702), + /// Time unit - second + ATT_UNIT_SECOND = ATT_UUID16(0x2703), + /// Electric current unit - Ampere + ATT_UNIT_AMPERE = ATT_UUID16(0x2704), + /// Thermodynamic Temperature unit - Kelvin + ATT_UNIT_KELVIN = ATT_UUID16(0x2705), + /// Amount of substance unit - mole + ATT_UNIT_MOLE = ATT_UUID16(0x2706), + /// Luminous intensity unit - candela + ATT_UNIT_CANDELA = ATT_UUID16(0x2707), + /// Area unit - square metres + ATT_UNIT_SQ_METRE = ATT_UUID16(0x2710), + /// Colume unit - cubic metres + ATT_UNIT_CUBIC_METRE = ATT_UUID16(0x2710), + /// Velocity unit - metres per second + ATT_UNIT_METRE_PER_SECOND = ATT_UUID16(0x2711), + /// Acceleration unit - metres per second squared + ATT_UNIT_METRES_PER_SEC_SQ = ATT_UUID16(0x2712), + /// Wavenumber unit - reciprocal metre + ATT_UNIT_RECIPROCAL_METRE = ATT_UUID16(0x2713), + /// Density unit - kilogram per cubic metre + ATT_UNIT_DENS_KG_PER_CUBIC_METRE = ATT_UUID16(0x2714), + /// Surface density unit - kilogram per square metre + ATT_UNIT_KG_PER_SQ_METRE = ATT_UUID16(0x2715), + /// Specific volume unit - cubic metre per kilogram + ATT_UNIT_CUBIC_METRE_PER_KG = ATT_UUID16(0x2716), + /// Current density unit - ampere per square metre + ATT_UNIT_AMPERE_PER_SQ_METRE = ATT_UUID16(0x2717), + /// Magnetic field strength unit - Ampere per metre + ATT_UNIT_AMPERE_PER_METRE = ATT_UUID16(0x2718), + /// Amount concentration unit - mole per cubic metre + ATT_UNIT_MOLE_PER_CUBIC_METRE = ATT_UUID16(0x2719), + /// Mass Concentration unit - kilogram per cubic metre + ATT_UNIT_MASS_KG_PER_CUBIC_METRE = ATT_UUID16(0x271A), + /// Luminance unit - candela per square metre + ATT_UNIT_CANDELA_PER_SQ_METRE = ATT_UUID16(0x271B), + /// Refractive index unit + ATT_UNIT_REFRACTIVE_INDEX = ATT_UUID16(0x271C), + /// Relative permeability unit + ATT_UNIT_RELATIVE_PERMEABILITY = ATT_UUID16(0x271D), + /// Plane angle unit - radian + ATT_UNIT_RADIAN = ATT_UUID16(0x2720), + /// Solid angle unit - steradian + ATT_UNIT_STERADIAN = ATT_UUID16(0x2721), + /// Frequency unit - Hertz + ATT_UNIT_HERTZ = ATT_UUID16(0x2722), + /// Force unit - Newton + ATT_UNIT_NEWTON = ATT_UUID16(0x2723), + /// Pressure unit - Pascal + ATT_UNIT_PASCAL = ATT_UUID16(0x2724), + /// Energy unit - Joule + ATT_UNIT_JOULE = ATT_UUID16(0x2725), + /// Power unit - Watt + ATT_UNIT_WATT = ATT_UUID16(0x2726), + /// electric Charge unit - Coulomb + ATT_UNIT_COULOMB = ATT_UUID16(0x2727), + /// Electric potential difference - Volt + ATT_UNIT_VOLT = ATT_UUID16(0x2728), + /// Capacitance unit - Farad + ATT_UNIT_FARAD = ATT_UUID16(0x2729), + /// electric resistance unit - Ohm + ATT_UNIT_OHM = ATT_UUID16(0x272A), + /// Electric conductance - Siemens + ATT_UNIT_SIEMENS = ATT_UUID16(0x272B), + /// Magnetic flux unit - Weber + ATT_UNIT_WEBER = ATT_UUID16(0x272C), + /// Magnetic flux density unit - Tesla + ATT_UNIT_TESLA = ATT_UUID16(0x272D), + /// Inductance unit - Henry + ATT_UNIT_HENRY = ATT_UUID16(0x272E), + /// Temperature unit - degree Celsius + ATT_UNIT_CELSIUS = ATT_UUID16(0x272F), + /// Luminous flux unit - lumen + ATT_UNIT_LUMEN = ATT_UUID16(0x2730), + /// Illuminance unit - lux + ATT_UNIT_LUX = ATT_UUID16(0x2731), + /// Activity referred to a radionuclide unit - becquerel + ATT_UNIT_BECQUEREL = ATT_UUID16(0x2732), + /// Absorbed dose unit - Gray + ATT_UNIT_GRAY = ATT_UUID16(0x2733), + /// Dose equivalent unit - Sievert + ATT_UNIT_SIEVERT = ATT_UUID16(0x2734), + /// Catalytic activity unit - Katal + ATT_UNIT_KATAL = ATT_UUID16(0x2735), + /// Synamic viscosity unit - Pascal second + ATT_UNIT_PASCAL_SECOND = ATT_UUID16(0x2740), + /// Moment of force unit - Newton metre + ATT_UNIT_NEWTON_METRE = ATT_UUID16(0x2741), + /// surface tension unit - Newton per metre + ATT_UNIT_NEWTON_PER_METRE = ATT_UUID16(0x2742), + /// Angular velocity unit - radian per second + ATT_UNIT_RADIAN_PER_SECOND = ATT_UUID16(0x2743), + /// Angular acceleration unit - radian per second squared + ATT_UNIT_RADIAN_PER_SECOND_SQ = ATT_UUID16(0x2744), + /// Heat flux density unit - Watt per square metre + ATT_UNIT_WATT_PER_SQ_METRE = ATT_UUID16(0x2745), + /// HEat capacity unit - Joule per Kelvin + ATT_UNIT_JOULE_PER_KELVIN = ATT_UUID16(0x2746), + /// Specific heat capacity unit - Joule per kilogram kelvin + ATT_UNIT_JOULE_PER_KG_KELVIN = ATT_UUID16(0x2747), + /// Specific Energy unit - Joule per kilogram + ATT_UNIT_JOULE_PER_KG = ATT_UUID16(0x2748), + /// Thermal conductivity - Watt per metre Kelvin + ATT_UNIT_WATT_PER_METRE_KELVIN = ATT_UUID16(0x2749), + /// Energy Density unit - joule per cubic metre + ATT_UNIT_JOULE_PER_CUBIC_METRE = ATT_UUID16(0x274A), + /// Electric field strength unit - volt per metre + ATT_UNIT_VOLT_PER_METRE = ATT_UUID16(0x274B), + /// Electric charge density unit - coulomb per cubic metre + ATT_UNIT_COULOMB_PER_CUBIC_METRE = ATT_UUID16(0x274C), + /// Surface charge density unit - coulomb per square metre + ATT_UNIT_SURF_COULOMB_PER_SQ_METRE = ATT_UUID16(0x274D), + /// Electric flux density unit - coulomb per square metre + ATT_UNIT_FLUX_COULOMB_PER_SQ_METRE = ATT_UUID16(0x274E), + /// Permittivity unit - farad per metre + ATT_UNIT_FARAD_PER_METRE = ATT_UUID16(0x274F), + /// Permeability unit - henry per metre + ATT_UNIT_HENRY_PER_METRE = ATT_UUID16(0x2750), + /// Molar energy unit - joule per mole + ATT_UNIT_JOULE_PER_MOLE = ATT_UUID16(0x2751), + /// Molar entropy unit - joule per mole kelvin + ATT_UNIT_JOULE_PER_MOLE_KELVIN = ATT_UUID16(0x2752), + /// Exposure unit - coulomb per kilogram + ATT_UNIT_COULOMB_PER_KG = ATT_UUID16(0x2753), + /// Absorbed dose rate unit - gray per second + ATT_UNIT_GRAY_PER_SECOND = ATT_UUID16(0x2754), + /// Radiant intensity unit - watt per steradian + ATT_UNIT_WATT_PER_STERADIAN = ATT_UUID16(0x2755), + /// Radiance unit - watt per square meter steradian + ATT_UNIT_WATT_PER_SQ_METRE_STERADIAN = ATT_UUID16(0x2756), + /// Catalytic activity concentration unit - katal per cubic metre + ATT_UNIT_KATAL_PER_CUBIC_METRE = ATT_UUID16(0x2757), + /// Time unit - minute + ATT_UNIT_MINUTE = ATT_UUID16(0x2760), + /// Time unit - hour + ATT_UNIT_HOUR = ATT_UUID16(0x2761), + /// Time unit - day + ATT_UNIT_DAY = ATT_UUID16(0x2762), + /// Plane angle unit - degree + ATT_UNIT_ANGLE_DEGREE = ATT_UUID16(0x2763), + /// Plane angle unit - minute + ATT_UNIT_ANGLE_MINUTE = ATT_UUID16(0x2764), + /// Plane angle unit - second + ATT_UNIT_ANGLE_SECOND = ATT_UUID16(0x2765), + /// Area unit - hectare + ATT_UNIT_HECTARE = ATT_UUID16(0x2766), + /// Volume unit - litre + ATT_UNIT_LITRE = ATT_UUID16(0x2767), + /// Mass unit - tonne + ATT_UNIT_TONNE = ATT_UUID16(0x2768), + /// Pressure unit - bar + ATT_UNIT_BAR = ATT_UUID16(0x2780), + /// Pressure unit - millimetre of mercury + ATT_UNIT_MM_MERCURY = ATT_UUID16(0x2781), + /// Length unit - angstrom + ATT_UNIT_ANGSTROM = ATT_UUID16(0x2782), + /// Length unit - nautical mile + ATT_UNIT_NAUTICAL_MILE = ATT_UUID16(0x2783), + /// Area unit - barn + ATT_UNIT_BARN = ATT_UUID16(0x2784), + /// Velocity unit - knot + ATT_UNIT_KNOT = ATT_UUID16(0x2785), + /// Logarithmic radio quantity unit - neper + ATT_UNIT_NEPER = ATT_UUID16(0x2786), + /// Logarithmic radio quantity unit - bel + ATT_UNIT_BEL = ATT_UUID16(0x2787), + /// Length unit - yard + ATT_UNIT_YARD = ATT_UUID16(0x27A0), + /// Length unit - parsec + ATT_UNIT_PARSEC = ATT_UUID16(0x27A1), + /// length unit - inch + ATT_UNIT_INCH = ATT_UUID16(0x27A2), + /// length unit - foot + ATT_UNIT_FOOT = ATT_UUID16(0x27A3), + /// length unit - mile + ATT_UNIT_MILE = ATT_UUID16(0x27A4), + /// pressure unit - pound-force per square inch + ATT_UNIT_POUND_FORCE_PER_SQ_INCH = ATT_UUID16(0x27A5), + /// velocity unit - kilometre per hour + ATT_UNIT_KM_PER_HOUR = ATT_UUID16(0x27A6), + /// velocity unit - mile per hour + ATT_UNIT_MILE_PER_HOUR = ATT_UUID16(0x27A7), + /// angular velocity unit - revolution per minute + ATT_UNIT_REVOLUTION_PER_MINUTE = ATT_UUID16(0x27A8), + /// energy unit - gram calorie + ATT_UNIT_GRAM_CALORIE = ATT_UUID16(0x27A9), + /// energy unit - kilogram calorie + ATT_UNIT_KG_CALORIE = ATT_UUID16(0x27AA), + /// energy unit - kilowatt hour + ATT_UNIT_KILOWATT_HOUR = ATT_UUID16(0x27AB), + /// thermodynamic temperature unit - degree Fahrenheit + ATT_UNIT_FAHRENHEIT = ATT_UUID16(0x27AC), + /// percentage + ATT_UNIT_PERCENTAGE = ATT_UUID16(0x27AD), + /// per mille + ATT_UNIT_PER_MILLE = ATT_UUID16(0x27AE), + /// period unit - beats per minute) + ATT_UNIT_BEATS_PER_MINUTE = ATT_UUID16(0x27AF), + /// electric charge unit - ampere hours + ATT_UNIT_AMPERE_HOURS = ATT_UUID16(0x27B0), + /// mass density unit - milligram per decilitre + ATT_UNIT_MILLIGRAM_PER_DECILITRE = ATT_UUID16(0x27B1), + /// mass density unit - millimole per litre + ATT_UNIT_MILLIMOLE_PER_LITRE = ATT_UUID16(0x27B2), + /// time unit - year + ATT_UNIT_YEAR = ATT_UUID16(0x27B3), + //// time unit - month + ATT_UNIT_MONTH = ATT_UUID16(0x27B4), + + /*---------------- DECLARATIONS -----------------*/ + /// Primary service Declaration + ATT_DECL_PRIMARY_SERVICE = ATT_UUID16(0x2800), + /// Secondary service Declaration + ATT_DECL_SECONDARY_SERVICE = ATT_UUID16(0x2801), + /// Include Declaration + ATT_DECL_INCLUDE = ATT_UUID16(0x2802), + /// Characteristic Declaration + ATT_DECL_CHARACTERISTIC = ATT_UUID16(0x2803), + + /*----------------- DESCRIPTORS -----------------*/ + /// Characteristic extended properties + ATT_DESC_CHAR_EXT_PROPERTIES = ATT_UUID16(0x2900), + /// Characteristic user description + ATT_DESC_CHAR_USER_DESCRIPTION = ATT_UUID16(0x2901), + /// Client characteristic configuration + ATT_DESC_CLIENT_CHAR_CFG = ATT_UUID16(0x2902), + /// Server characteristic configuration + ATT_DESC_SERVER_CHAR_CFG = ATT_UUID16(0x2903), + /// Characteristic Presentation Format + ATT_DESC_CHAR_PRES_FORMAT = ATT_UUID16(0x2904), + /// Characteristic Aggregate Format + ATT_DESC_CHAR_AGGREGATE_FORMAT = ATT_UUID16(0x2905), + /// Valid Range + ATT_DESC_VALID_RANGE = ATT_UUID16(0x2906), + /// External Report Reference + ATT_DESC_EXT_REPORT_REF = ATT_UUID16(0x2907), + /// Report Reference + ATT_DESC_REPORT_REF = ATT_UUID16(0x2908), + /// Environmental Sensing Configuration + ATT_DESC_ES_CONFIGURATION = ATT_UUID16(0x290B), + /// Environmental Sensing Measurement + ATT_DESC_ES_MEASUREMENT = ATT_UUID16(0x290C), + /// Environmental Sensing Trigger Setting + ATT_DESC_ES_TRIGGER_SETTING = ATT_UUID16(0x290D), + + /*--------------- CHARACTERISTICS ---------------*/ + /// Device name + ATT_CHAR_DEVICE_NAME = ATT_UUID16(0x2A00), + /// Appearance + ATT_CHAR_APPEARANCE = ATT_UUID16(0x2A01), + /// Privacy flag + ATT_CHAR_PRIVACY_FLAG = ATT_UUID16(0x2A02), + /// Reconnection address + ATT_CHAR_RECONNECTION_ADDR = ATT_UUID16(0x2A03), + /// Peripheral preferred connection parameters + ATT_CHAR_PERIPH_PREF_CON_PARAM = ATT_UUID16(0x2A04), + /// Service handles changed + ATT_CHAR_SERVICE_CHANGED = ATT_UUID16(0x2A05), + /// Alert Level characteristic + ATT_CHAR_ALERT_LEVEL = ATT_UUID16(0x2A06), + /// Tx Power Level + ATT_CHAR_TX_POWER_LEVEL = ATT_UUID16(0x2A07), + /// Date Time + ATT_CHAR_DATE_TIME = ATT_UUID16(0x2A08), + /// Day of Week + ATT_CHAR_DAY_WEEK = ATT_UUID16(0x2A09), + /// Day Date Time + ATT_CHAR_DAY_DATE_TIME = ATT_UUID16(0x2A0A), + /// Exact time 256 + ATT_CHAR_EXACT_TIME_256 = ATT_UUID16(0x2A0C), + /// DST Offset + ATT_CHAR_DST_OFFSET = ATT_UUID16(0x2A0D), + /// Time zone + ATT_CHAR_TIME_ZONE = ATT_UUID16(0x2A0E), + /// Local time Information + ATT_CHAR_LOCAL_TIME_INFO = ATT_UUID16(0x2A0F), + /// Time with DST + ATT_CHAR_TIME_WITH_DST = ATT_UUID16(0x2A11), + /// Time Accuracy + ATT_CHAR_TIME_ACCURACY = ATT_UUID16(0x2A12), + /// Time Source + ATT_CHAR_TIME_SOURCE = ATT_UUID16(0x2A13), + /// Reference Time Information + ATT_CHAR_REFERENCE_TIME_INFO = ATT_UUID16(0x2A14), + /// Time Update Control Point + ATT_CHAR_TIME_UPDATE_CTRL_POINT = ATT_UUID16(0x2A16), + /// Time Update State + ATT_CHAR_TIME_UPDATE_STATE = ATT_UUID16(0x2A17), + /// Glucose Measurement + ATT_CHAR_GLUCOSE_MEAS = ATT_UUID16(0x2A18), + /// Battery Level + ATT_CHAR_BATTERY_LEVEL = ATT_UUID16(0x2A19), + /// Battery Power Status + ATT_CHAR_BATTERY_POWER_STATE = ATT_UUID16(0x2A1A), + /// Battery Level State + ATT_CHAR_BATTERY_LEVEL_STATE = ATT_UUID16(0x2A1B), + /// Temperature Measurement + ATT_CHAR_TEMPERATURE_MEAS = ATT_UUID16(0x2A1C), + /// Temperature Type + ATT_CHAR_TEMPERATURE_TYPE = ATT_UUID16(0x2A1D), + /// Intermediate Temperature + ATT_CHAR_INTERMED_TEMPERATURE = ATT_UUID16(0x2A1E), + /// Measurement Interval + ATT_CHAR_MEAS_INTERVAL = ATT_UUID16(0x2A21), + /// Boot Keyboard Input Report + ATT_CHAR_BOOT_KB_IN_REPORT = ATT_UUID16(0x2A22), + /// System ID + ATT_CHAR_SYS_ID = ATT_UUID16(0x2A23), + /// Model Number String + ATT_CHAR_MODEL_NB = ATT_UUID16(0x2A24), + /// Serial Number String + ATT_CHAR_SERIAL_NB = ATT_UUID16(0x2A25), + /// Firmware Revision String + ATT_CHAR_FW_REV = ATT_UUID16(0x2A26), + /// Hardware revision String + ATT_CHAR_HW_REV = ATT_UUID16(0x2A27), + /// Software Revision String + ATT_CHAR_SW_REV = ATT_UUID16(0x2A28), + /// Manufacturer Name String + ATT_CHAR_MANUF_NAME = ATT_UUID16(0x2A29), + /// IEEE Regulatory Certification Data List + ATT_CHAR_IEEE_CERTIF = ATT_UUID16(0x2A2A), + /// CT Time + ATT_CHAR_CT_TIME = ATT_UUID16(0x2A2B), + /// Magnetic Declination + ATT_CHAR_MAGN_DECLINE = ATT_UUID16(0x2A2C), + /// Scan Refresh + ATT_CHAR_SCAN_REFRESH = ATT_UUID16(0x2A31), + /// Boot Keyboard Output Report + ATT_CHAR_BOOT_KB_OUT_REPORT = ATT_UUID16(0x2A32), + /// Boot Mouse Input Report + ATT_CHAR_BOOT_MOUSE_IN_REPORT = ATT_UUID16(0x2A33), + /// Glucose Measurement Context + ATT_CHAR_GLUCOSE_MEAS_CTX = ATT_UUID16(0x2A34), + /// Blood Pressure Measurement + ATT_CHAR_BLOOD_PRESSURE_MEAS = ATT_UUID16(0x2A35), + /// Intermediate Cuff Pressure + ATT_CHAR_INTERMEDIATE_CUFF_PRESSURE = ATT_UUID16(0x2A36), + /// Heart Rate Measurement + ATT_CHAR_HEART_RATE_MEAS = ATT_UUID16(0x2A37), + /// Body Sensor Location + ATT_CHAR_BODY_SENSOR_LOCATION = ATT_UUID16(0x2A38), + /// Heart Rate Control Point + ATT_CHAR_HEART_RATE_CTRL_POINT = ATT_UUID16(0x2A39), + /// Alert Status + ATT_CHAR_ALERT_STATUS = ATT_UUID16(0x2A3F), + /// Ringer Control Point + ATT_CHAR_RINGER_CTRL_POINT = ATT_UUID16(0x2A40), + /// Ringer Setting + ATT_CHAR_RINGER_SETTING = ATT_UUID16(0x2A41), + /// Alert Category ID Bit Mask + ATT_CHAR_ALERT_CAT_ID_BIT_MASK = ATT_UUID16(0x2A42), + /// Alert Category ID + ATT_CHAR_ALERT_CAT_ID = ATT_UUID16(0x2A43), + /// Alert Notification Control Point + ATT_CHAR_ALERT_NTF_CTRL_PT = ATT_UUID16(0x2A44), + /// Unread Alert Status + ATT_CHAR_UNREAD_ALERT_STATUS = ATT_UUID16(0x2A45), + /// New Alert + ATT_CHAR_NEW_ALERT = ATT_UUID16(0x2A46), + /// Supported New Alert Category + ATT_CHAR_SUP_NEW_ALERT_CAT = ATT_UUID16(0x2A47), + /// Supported Unread Alert Category + ATT_CHAR_SUP_UNREAD_ALERT_CAT = ATT_UUID16(0x2A48), + /// Blood Pressure Feature + ATT_CHAR_BLOOD_PRESSURE_FEATURE = ATT_UUID16(0x2A49), + /// HID Information + ATT_CHAR_HID_INFO = ATT_UUID16(0x2A4A), + /// Report Map + ATT_CHAR_REPORT_MAP = ATT_UUID16(0x2A4B), + /// HID Control Point + ATT_CHAR_HID_CTRL_PT = ATT_UUID16(0x2A4C), + /// Report + ATT_CHAR_REPORT = ATT_UUID16(0x2A4D), + /// Protocol Mode + ATT_CHAR_PROTOCOL_MODE = ATT_UUID16(0x2A4E), + /// Scan Interval Window + ATT_CHAR_SCAN_INTV_WD = ATT_UUID16(0x2A4F), + /// PnP ID + ATT_CHAR_PNP_ID = ATT_UUID16(0x2A50), + /// Glucose Feature + ATT_CHAR_GLUCOSE_FEATURE = ATT_UUID16(0x2A51), + /// Record access control point + ATT_CHAR_REC_ACCESS_CTRL_PT = ATT_UUID16(0x2A52), + /// RSC Measurement + ATT_CHAR_RSC_MEAS = ATT_UUID16(0x2A53), + /// RSC Feature + ATT_CHAR_RSC_FEAT = ATT_UUID16(0x2A54), + /// SC Control Point + ATT_CHAR_SC_CTRL_PT = ATT_UUID16(0x2A55), + /// CSC Measurement + ATT_CHAR_CSC_MEAS = ATT_UUID16(0x2A5B), + /// CSC Feature + ATT_CHAR_CSC_FEAT = ATT_UUID16(0x2A5C), + /// Sensor Location + ATT_CHAR_SENSOR_LOC = ATT_UUID16(0x2A5D), + /// PLX Spot-Check Measurement + ATT_CHAR_PLX_SPOT_CHECK_MEASUREMENT_LOC = ATT_UUID16(0x2A5E), + /// PLX Continuous Measurement + ATT_CHAR_PLX_CONTINUOUS_MEASUREMENT_LOC = ATT_UUID16(0x2A5F), + /// PLX Features + ATT_CHAR_PLX_FEATURES_LOC = ATT_UUID16(0x2A60), + /// CP Measurement + ATT_CHAR_CP_MEAS = ATT_UUID16(0x2A63), + /// CP Vector + ATT_CHAR_CP_VECTOR = ATT_UUID16(0x2A64), + /// CP Feature + ATT_CHAR_CP_FEAT = ATT_UUID16(0x2A65), + /// CP Control Point + ATT_CHAR_CP_CTRL_PT = ATT_UUID16(0x2A66), + /// Location and Speed + ATT_CHAR_LOC_SPEED = ATT_UUID16(0x2A67), + /// Navigation + ATT_CHAR_NAVIGATION = ATT_UUID16(0x2A68), + /// Position Quality + ATT_CHAR_POS_QUALITY = ATT_UUID16(0x2A69), + /// LN Feature + ATT_CHAR_LN_FEAT = ATT_UUID16(0x2A6A), + /// LN Control Point + ATT_CHAR_LN_CTRL_PT = ATT_UUID16(0x2A6B), + /// Elevation + ATT_CHAR_ELEVATION = ATT_UUID16(0x2A6C), + /// Pressure + ATT_CHAR_PRESSURE = ATT_UUID16(0x2A6D), + /// Temperature + ATT_CHAR_TEMPERATURE = ATT_UUID16(0x2A6E), + /// Humidity + ATT_CHAR_HUMIDITY = ATT_UUID16(0x2A6F), + /// True Wind Speed + ATT_CHAR_TRUE_WIND_SPEED = ATT_UUID16(0x2A70), + /// True Wind Direction + ATT_CHAR_TRUE_WIND_DIR = ATT_UUID16(0x2A71), + /// Apparent Wind Speed + ATT_CHAR_APRNT_WIND_SPEED = ATT_UUID16(0x2A72), + /// Apparent Wind Direction + ATT_CHAR_APRNT_WIND_DIRECTION = ATT_UUID16(0x2A73), + /// Gust Factor + ATT_CHAR_GUST_FACTOR = ATT_UUID16(0x2A74), + /// Pollen Concentration + ATT_CHAR_POLLEN_CONC = ATT_UUID16(0x2A75), + /// UV Index + ATT_CHAR_UV_INDEX = ATT_UUID16(0x2A76), + /// Irradiance + ATT_CHAR_IRRADIANCE = ATT_UUID16(0x2A77), + /// Rainfall + ATT_CHAR_RAINFALL = ATT_UUID16(0x2A78), + /// Wind Chill + ATT_CHAR_WIND_CHILL = ATT_UUID16(0x2A79), + /// Heat Index + ATT_CHAR_HEAT_INDEX = ATT_UUID16(0x2A7A), + /// Dew Point + ATT_CHAR_DEW_POINT = ATT_UUID16(0x2A7B), + /// Descriptor Value Changed + ATT_CHAR_DESCRIPTOR_VALUE_CHANGED = ATT_UUID16(0x2A7D), + /// Aerobic Heart Rate Lower Limit + ATT_CHAR_AEROBIC_HEART_RATE_LOWER_LIMIT = ATT_UUID16(0x2A7E), + /// Aerobic Threshhold + ATT_CHAR_AEROBIC_THRESHHOLD = ATT_UUID16(0x2A7F), + /// Age + ATT_CHAR_AGE = ATT_UUID16(0x2A80), + /// Anaerobic Heart Rate Lower Limit + ATT_CHAR_ANAEROBIC_HEART_RATE_LOWER_LIMIT = ATT_UUID16(0x2A81), + /// Anaerobic Heart Rate Upper Limit + ATT_CHAR_ANAEROBIC_HEART_RATE_UPPER_LIMIT = ATT_UUID16(0x2A82), + /// Anaerobic Threshhold + ATT_CHAR_ANAEROBIC_THRESHHOLD = ATT_UUID16(0x2A83), + /// Aerobic Heart Rate Upper Limit + ATT_CHAR_AEROBIC_HEART_RATE_UPPER_LIMIT = ATT_UUID16(0x2A84), + /// Date Of Birth + ATT_CHAR_DATE_OF_BIRTH = ATT_UUID16(0x2A85), + /// Date Of Threshold Assessment + ATT_CHAR_DATE_OF_THRESHOLD_ASSESSMENT = ATT_UUID16(0x2A86), + /// Email Address + ATT_CHAR_EMAIL_ADDRESS = ATT_UUID16(0x2A87), + /// Fat Burn Heart Rate Lower Limit + ATT_CHAR_FAT_BURN_HEART_RATE_LOWER_LIMIT = ATT_UUID16(0x2A88), + /// Fat Burn Heart Rate Upper Limit + ATT_CHAR_FAT_BURN_HEART_RATE_UPPER_LIMIT = ATT_UUID16(0x2A89), + /// First Name + ATT_CHAR_FIRST_NAME = ATT_UUID16(0x2A8A), + /// Five Zone Heart Rate Limits + ATT_CHAR_FIVE_ZONE_HEART_RATE_LIMITS = ATT_UUID16(0x2A8B), + /// Gender + ATT_CHAR_GENDER = ATT_UUID16(0x2A8C), + /// Max Heart Rate + ATT_CHAR_MAX_HEART_RATE = ATT_UUID16(0x2A8D), + /// Height + ATT_CHAR_HEIGHT = ATT_UUID16(0x2A8E), + /// Hip Circumference + ATT_CHAR_HIP_CIRCUMFERENCE = ATT_UUID16(0x2A8F), + /// Last Name + ATT_CHAR_LAST_NAME = ATT_UUID16(0x2A90), + /// Maximum Recommended Heart Rate + ATT_CHAR_MAXIMUM_RECOMMENDED_HEART_RATE = ATT_UUID16(0x2A91), + /// Resting Heart Rate + ATT_CHAR_RESTING_HEART_RATE = ATT_UUID16(0x2A92), + /// Sport Type For Aerobic And Anaerobic Thresholds + ATT_CHAR_SPORT_TYPE_FOR_AEROBIC_AND_ANAEROBIC_THRESHOLDS = ATT_UUID16(0x2A93), + /// Three Zone Heart Rate Limits + ATT_CHAR_THREE_ZONE_HEART_RATE_LIMITS = ATT_UUID16(0x2A94), + /// Two Zone Heart Rate Limit + ATT_CHAR_TWO_ZONE_HEART_RATE_LIMIT = ATT_UUID16(0x2A95), + /// Vo2 Max + ATT_CHAR_VO2_MAX = ATT_UUID16(0x2A96), + /// Waist Circumference + ATT_CHAR_WAIST_CIRCUMFERENCE = ATT_UUID16(0x2A97), + /// Weight + ATT_CHAR_WEIGHT = ATT_UUID16(0x2A98), + /// Database Change Increment + ATT_CHAR_DATABASE_CHANGE_INCREMENT = ATT_UUID16(0x2A99), + /// User Index + ATT_CHAR_USER_INDEX = ATT_UUID16(0x2A9A), + /// Body Composition Feature + ATT_CHAR_BODY_COMPOSITION_FEATURE = ATT_UUID16(0x2A9B), + /// Body Composition Measurement + ATT_CHAR_BODY_COMPOSITION_MEASUREMENT = ATT_UUID16(0x2A9C), + /// Weight Measurement + ATT_CHAR_WEIGHT_MEASUREMENT = ATT_UUID16(0x2A9D), + /// Weight Scale Feature + ATT_CHAR_WEIGHT_SCALE_FEATURE = ATT_UUID16(0x2A9E), + /// User Control Point + ATT_CHAR_USER_CONTROL_POINT = ATT_UUID16(0x2A9F), + /// Flux Density - 2D + ATT_CHAR_MAGN_FLUX_2D = ATT_UUID16(0x2AA0), + /// Magnetic Flux Density - 3D + ATT_CHAR_MAGN_FLUX_3D = ATT_UUID16(0x2AA1), + /// Language string + ATT_CHAR_LANGUAGE = ATT_UUID16(0x2AA2), + /// Barometric Pressure Trend + ATT_CHAR_BAR_PRES_TREND = ATT_UUID16(0x2AA3), + /// Central Address Resolution Support + ATT_CHAR_CTL_ADDR_RESOL_SUPP = ATT_UUID16(0x2AA6), + /// CGM Measurement + ATT_CHAR_CGM_MEASUREMENT = ATT_UUID16(0x2AA7), + /// CGM Features + ATT_CHAR_CGM_FEATURES = ATT_UUID16(0x2AA8), + /// CGM Status + ATT_CHAR_CGM_STATUS = ATT_UUID16(0x2AA9), + /// CGM Session Start + ATT_CHAR_CGM_SESSION_START = ATT_UUID16(0x2AAA), + /// CGM Session Run + ATT_CHAR_CGM_SESSION_RUN = ATT_UUID16(0x2AAB), + /// CGM Specific Ops Control Point + ATT_CHAR_CGM_SPECIFIC_OPS_CTRL_PT = ATT_UUID16(0x2AAC), + /// Resolvable Private Address only + ATT_CHAR_RSLV_PRIV_ADDR_ONLY = ATT_UUID16(0x2AC9), + /// Mesh Provisioning Data In + ATT_CHAR_MESH_PROV_DATA_IN = ATT_UUID16(0x2ADB), + /// Mesh Provisioning Data Out + ATT_CHAR_MESH_PROV_DATA_OUT = ATT_UUID16(0x2ADC), + /// Mesh Proxy Data In + ATT_CHAR_MESH_PROXY_DATA_IN = ATT_UUID16(0x2ADD), + /// Mesh Proxy Data Out + ATT_CHAR_MESH_PROXY_DATA_OUT = ATT_UUID16(0x2ADE), + /// Client Supported Features + ATT_CHAR_CLI_SUP_FEAT = ATT_UUID16(0x2B29), + /// Database Hash + ATT_CHAR_DB_HASH = ATT_UUID16(0x2B2A), +}; + +/// Format for Characteristic Presentation +enum att_format_pres { + /// unsigned 1-bit: true or false + ATT_FORMAT_BOOL = 0x01, + /// unsigned 2-bit integer + ATT_FORMAT_2BIT, + /// unsigned 4-bit integer + ATT_FORMAT_NIBBLE, + /// unsigned 8-bit integer + ATT_FORMAT_UINT8, + /// unsigned 12-bit integer + ATT_FORMAT_UINT12, + /// unsigned 16-bit integer + ATT_FORMAT_UINT16, + /// unsigned 24-bit integer + ATT_FORMAT_UINT24, + /// unsigned 32-bit integer + ATT_FORMAT_UINT32, + /// unsigned 48-bit integer + ATT_FORMAT_UINT48, + /// unsigned 64-bit integer + ATT_FORMAT_UINT64, + /// unsigned 128-bit integer + ATT_FORMAT_UINT128, + /// signed 8-bit integer + ATT_FORMAT_SINT8, + /// signed 12-bit integer + ATT_FORMAT_SINT12, + /// signed 16-bit integer + ATT_FORMAT_SINT16, + /// signed 24-bit integer + ATT_FORMAT_SINT24, + /// signed 32-bit integer + ATT_FORMAT_SINT32, + /// signed 48-bit integer + ATT_FORMAT_SINT48, + /// signed 64-bit integer + ATT_FORMAT_SINT64, + /// signed 128-bit integer + ATT_FORMAT_SINT128, + /// IEEE-754 32-bit floating point + ATT_FORMAT_FLOAT32, + /// IEEE-754 64-bit floating point + ATT_FORMAT_FLOAT64, + /// IEEE-11073 16-bit SFLOAT + ATT_FORMAT_SFLOAT, + /// IEEE-11073 32-bit FLOAT + ATT_FORMAT_FLOAT, + /// IEEE-20601 format + ATT_FORMAT_DUINT16, + /// UTF-8 string + ATT_FORMAT_UTF8S, + /// UTF-16 string + ATT_FORMAT_UTF16S, + /// Opaque structure + ATT_FORMAT_STRUCT, + /// Last format + ATT_FORMAT_LAST +}; + +/// Client Characteristic Configuration Codes +enum att_ccc_val +{ + /// Stop notification/indication + ATT_CCC_STOP_NTFIND = 0x0000, + /// Start notification + ATT_CCC_START_NTF = 0x0001, + /// Start indication + ATT_CCC_START_IND = 0x0002, +}; + + +/* + * Type Definition + **************************************************************************************** + */ + +/// Attribute length type +typedef uint16_t att_size_t; + + +/// UUID - 128-bit type +struct att_uuid_128 +{ + /// 128-bit UUID + uint8_t uuid[ATT_UUID128_LEN]; +}; + +/// UUID - 32-bit type +struct att_uuid_32 +{ + /// 32-bit UUID + uint8_t uuid[ATT_UUID32_LEN]; +}; + + +/// Characteristic Value Descriptor +struct att_char_desc +{ + /// properties + uint8_t prop; + /// attribute handle + uint8_t attr_hdl[ATT_HANDLE_LEN]; + /// attribute type + uint8_t attr_type[ATT_UUID16_LEN]; +}; + +/// Characteristic Value Descriptor +struct att_char128_desc +{ + /// properties + uint8_t prop; + /// attribute handle + uint8_t attr_hdl[ATT_HANDLE_LEN]; + /// attribute type + uint8_t attr_type[ATT_UUID128_LEN]; +}; + +/// Service Value Descriptor - 16-bit +typedef uint16_t att_svc_desc_t; + +/// include service entry element +struct att_incl_desc +{ + /// start handle value of included service + uint16_t start_hdl; + /// end handle value of included service + uint16_t end_hdl; + /// attribute value UUID + uint16_t uuid; +}; + +/// include service entry element +struct att_incl128_desc +{ + /// start handle value of included service + uint16_t start_hdl; + /// end handle value of included service + uint16_t end_hdl; +}; + + +// -------------------------- PDU HANDLER Definition -------------------------- + +/// used to know if PDU handler has been found +#define ATT_PDU_HANDLER_NOT_FOUND (0xff) + +/// Format of a pdu handler function +typedef int (*att_func_t)(uint8_t conidx, void *pdu); + +/// Element of a pdu handler table. +struct att_pdu_handler +{ + /// PDU identifier of the message + uint8_t pdu_id; + /// Pointer to the handler function for the pdu above. + att_func_t handler; +}; + + +// -------------------------- Database declaration ----------------------------- + +/// macro to define an attribute property +/// @param prop Property @see enum att_info_mask (RD, WC, WR, NTF, IND, WS, B, EXT) +#define PROP(prop) (ATT_PROP_##prop##_BIT) + +/// macro to define information option bit +/// @param opt Option @see enum svc_info_mask or @see enum att_ext_info_mask +#define OPT(opt) (opt##_BIT) + +/// macro to set attribute security level on a specific permission +/// @param lvl Security level @see enum sec_lvl +/// @param perm Permission @see enum att_info_mask (only RP, WP, NP, IP authorized) +#define ATT_SEC(perm, lvl) (((SEC_##lvl) << (ATT_PERM_##perm##_LSB)) & (ATT_PERM_##perm##_MASK)) + +/// macro to set attribute UUID type +/// @param type UUID type (16, 32, 128) +#define ATT_UUID(type) (((UUID_##type) << (ATT_UUID_TYPE_LSB)) & (ATT_UUID_TYPE_MASK)) + +/// macro to set service security level +/// @param lvl Security level @see enum sec_lvl +#define SVC_SEC(lvl) (((SEC_##lvl) << (SVC_AUTH_LSB)) & (SVC_AUTH_MASK)) + +/// macro to set service UUID type +/// @param type UUID type (16, 32, 128) +#define SVC_UUID(type) (((UUID_##type) << (SVC_UUID_TYPE_LSB)) & (SVC_UUID_TYPE_MASK)) + + +/// UUID Type +enum uuid_type +{ + /// 16-bit UUID value + UUID_16 = 0x00, + /// 32-bit UUID value + UUID_32 = 0x01, + /// 128-bit UUID value + UUID_128 = 0x02, + /// Invalid UUID Type + UUID_INVALID = 0x03, +}; + +/// security level +enum sec_level +{ + /// No Authentication, unencrypted link + SEC_NO_AUTH = 0x00, + /// Access Requires Unauthenticated link + SEC_UNAUTH = 0x01, + /// Access Requires Authenticated link + SEC_AUTH = 0x02, + /// Access Requires Secure Connection link + SEC_SECURE_CON = 0x03, +}; + +/** + * Attribute information Bit Field + * + * 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 + * +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ + * |EXT | WS |IND |NTF | WR | WC | RD | B | NP | IP | WP | RP | + * +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ + * <---------------- PROP ---------------> <---------------- PERM ---------------> + * + * Bit [0-7] : Attribute Permissions (@see enum sec_level) + * Bit [8-15] : Attribute Properties + */ +enum att_info_mask +{ + /// Permissions + ATT_PERM_ALL_MASK = 0x00FF, + ATT_PERM_ALL_LSB = 0, + /// Read Permission Mask + ATT_PERM_RP_MASK = 0x0003, + ATT_PERM_RP_LSB = 0, + /// Write Permission Mask + ATT_PERM_WP_MASK = 0x000C, + ATT_PERM_WP_LSB = 2, + /// Indication Access Mask + ATT_PERM_IP_MASK = 0x0030, + ATT_PERM_IP_LSB = 4, + /// Notification Access Mask + ATT_PERM_NP_MASK = 0x00C0, + ATT_PERM_NP_LSB = 6, + + /// Properties + ATT_PROP_ALL_MASK = 0xFF00, + ATT_PROP_ALL_LSB = 8, + /// Broadcast descriptor present + ATT_PROP_BC_BIT = 0x0100, + ATT_PROP_BC_POS = 8, + /// Read Access Mask + ATT_PROP_RD_BIT = 0x0200, + ATT_PROP_RD_POS = 9, + /// Write Command Enabled attribute Mask + ATT_PROP_WC_BIT = 0x0400, + ATT_PROP_WC_POS = 10, + /// Write Request Enabled attribute Mask + ATT_PROP_WR_BIT = 0x0800, + ATT_PROP_WR_POS = 11, + /// Notification Access Mask + ATT_PROP_NTF_BIT = 0x1000, + ATT_PROP_NTF_POS = 12, + /// Indication Access Mask + ATT_PROP_IND_BIT = 0x2000, + ATT_PROP_IND_POS = 13, + /// Write Signed Enabled attribute Mask + ATT_PROP_WS_BIT = 0x4000, + ATT_PROP_WS_POS = 14, + /// Extended properties descriptor present + ATT_PROP_EXT_BIT = 0x8000, + ATT_PROP_EXT_POS = 15, +}; + +/** + * Attribute extended information Bit Field + * + * 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 + * +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ + * | IN |UUID_TYPE|EKS | MAX_LEN | + * +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ + */ +enum att_ext_info_mask +{ + /// Maximum Attribute Value Length + ATT_MAX_LEN_MASK = 0x0FFF, + ATT_MAX_LEN_LSB = 0, + /// If set, Check Encryption key size + ATT_EKS_BIT = 0x1000, + ATT_EKS_POS = 12, + /// Type of attribute UUID (@see enum uuid_type) + ATT_UUID_TYPE_MASK = 0x6000, + ATT_UUID_TYPE_LSB = 13, + /// If set, Value present in Database + ATT_INDB_BIT = 0x8000, + ATT_INDB_POS = 15, +}; + +/** + * Service information Bit Field + * + * F E D C B A 9 8 7 6 5 4 3 2 1 0 + * +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ + * | RFU | STATE_EVT |SEC |UUID_TYPE|DIS | AUTH |EKS |HIDE| + * +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ + */ +enum svc_info_mask +{ + /// If set, Hide Service visibility + SVC_HIDE_BIT = 0x01, + SVC_HIDE_POS = 0, + /// If set, Encryption key Size must be 16 bytes + SVC_EKS_BIT = 0x02, + SVC_EKS_POS = 1, + /// Service Permission authentication (@see enum sec_lvl) + SVC_AUTH_MASK = 0x0C, + SVC_AUTH_LSB = 2, + /// If set, Disable the service + SVC_DIS_BIT = 0x10, + SVC_DIS_POS = 4, + /// Type of service UUID (@see enum uuid_type) + SVC_UUID_TYPE_MASK = 0x60, + SVC_UUID_TYPE_LSB = 5, + /// Service type (0 = Primary Service, 1 = Secondary Service) + SVC_SECONDARY_BIT = 0x80, + SVC_SECONDARY_POS = 7, + /// Service state event - add from v1.4 + SVC_EVT_INIT_BIT = 0x0100, + SVC_EVT_INIT_POS = 8, + SVC_EVT_CREATE_BIT = 0x0200, + SVC_EVT_CREATE_POS = 9, + SVC_EVT_CLEANUP_BIT = 0x0400, + SVC_EVT_CLEANUP_POS = 10, + SVC_EVT_DESTROY_BIT = 0x0800, + SVC_EVT_DESTROY_POS = 11, +}; + +enum att_prop_bfs +{ + PROP_BC = ATT_PROP_BC_BIT, + PROP_RD = ATT_PROP_RD_BIT, + PROP_WC = ATT_PROP_WC_BIT, + PROP_WR = ATT_PROP_WR_BIT, + PROP_NTF = ATT_PROP_NTF_BIT, + PROP_IND = ATT_PROP_IND_BIT, + PROP_WS = ATT_PROP_WS_BIT, + PROP_EXT = ATT_PROP_EXT_BIT, +}; + +enum att_val_pres +{ + VAL_IN = ATT_INDB_BIT, + VAL_RI = 0, //PERM(RI, ENABLE), +}; + +/// Attribute element information +#define ATT_ELMT(idx, uuid16, _perm, _info) [idx - 1] = { {.uuid=uuid16}, .perm=_perm, .info=_info } +#define ATT_ELMT128(idx, p_uuid, _perm, _info) [idx - 1] = { {.uuid128=p_uuid}, .perm=_perm, .info=(ATT_UUID(128) | (_info)) } + +#define ATT_ELMT_DECL_INCLUDE(idx) ATT_ELMT(idx, ATT_DECL_INCLUDE, PROP_RD, 0) +#define ATT_ELMT_DECL_CHAR(idx) ATT_ELMT(idx, ATT_DECL_CHARACTERISTIC, PROP_RD, 0) +#define ATT_ELMT_DECL_CHAR_EXT(idx) ATT_ELMT(idx, ATT_DECL_CHARACTERISTIC, PROP_RD | PROP_EXT, 0) +#define ATT_ELMT_DESC_CHAR_EXT_PROPS(idx) ATT_ELMT(idx, ATT_DESC_CHAR_EXT_PROPERTIES, PROP_RD, sizeof(uint16_t)) +#define ATT_ELMT_DESC_CLI_CHAR_CFG(idx) ATT_ELMT(idx, ATT_DESC_CLIENT_CHAR_CFG, PROP_RD | PROP_WR, sizeof(uint16_t)) +#define ATT_ELMT_DESC_SRV_CHAR_CFG(idx) ATT_ELMT(idx, ATT_DESC_SERVER_CHAR_CFG, PROP_RD | PROP_WR, sizeof(uint16_t)) +#define ATT_ELMT_DESC_REPORT_REF(idx) ATT_ELMT(idx, ATT_DESC_REPORT_REF, PROP_RD, sizeof(uint16_t)) + +/// Attribute element max length @see enum att_ext_info_mask +#define ATT_MAX_LEN_GET(idx, _atts) ((_atts[idx-1].info & ATT_MAX_LEN_MASK) >> ATT_MAX_LEN_LSB) + +typedef struct att_decl +{ + /// Attribute UUID (LSB First) + union { + uint16_t uuid; + uint32_t uuid32; + const uint8_t *uuid128; + }; + /// Attribute information (@see enum att_info_mask) + uint16_t perm;//info; + /// Attribute extended information (@see enum att_ext_info_mask) + uint16_t info;//ext_info; +} att_decl_t; + +typedef struct svc_decl +{ + /// Service UUID (LSB First) + union { + uint16_t uuid; + uint32_t uuid32; + const uint8_t *uuid128; + }; + /// Service attributes + const att_decl_t *atts; + /// Number of attributes - extend to 16bits from v1.4 + uint16_t nb_att; + /// Service information (@see enum svc_info_mask)- extend to 16bits + uint16_t info; +} svc_decl_t; + +struct attm_write_req_ind +{ + /// Data length to be written + uint16_t length; + /// offset at which the data has to be written + uint16_t offset; + /// Data to be written in attribute database + uint8_t *value; +}; + +enum atts_opcode +{ + ATTS_READ_REQ, + ATTS_WRITE_REQ, + ATTS_INFO_REQ, + ATTS_CMP_EVT, +}; + +struct atts_write_ind +{ + /// Write code(WC, WR, WS, prepWR) + uint8_t wrcode; + /// More packet (only true in prepWR) + uint8_t more; + /// Data length to be written + uint16_t length; + /// Data to be written in attribute database + uint8_t *value; +}; + +struct atts_prep_write_ind +{ + struct atts_write_ind data; + /// offset at which the data has to be written + uint16_t offset; + /// Total data length to be written + uint16_t total_len; +}; + +struct atts_cmp_evt +{ + /// atts event type(GATT_NOTIFY - 0x12, GATT_INDICATE - 0x13) + uint8_t operation; + /// Status of the request + uint8_t status; + /// operation sequence number - provided when operation is started + uint16_t seq_num; +}; + +typedef void (*svc_func_t)(uint8_t conidx, uint8_t op_code, uint16_t handle, const void *param); + +uint8_t attmdb_svc_create(uint16_t *shdl, uint8_t *cfg_flag, const struct svc_decl *svc_desc, svc_func_t svc_func); + +#endif // ATT_H_ diff --git a/ble/api/att.h~RFea659d8.TMP b/ble/api/att.h~RFea659d8.TMP new file mode 100644 index 0000000..64c3e2d --- /dev/null +++ b/ble/api/att.h~RFea659d8.TMP @@ -0,0 +1,1213 @@ +/** + **************************************************************************************** + * + * @file att.h + * + * @brief Attribute Protocol Header file. + * + **************************************************************************************** + */ + +#ifndef ATT_H_ +#define ATT_H_ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Macro used to LSB first 16-bits UUID +#define ATT_UUID16(uuid) (uuid) + +/// Invalid attribute handle +#define ATT_INVALID_HDL 0x0000 +/// Invalid attribute index(per profile) +#define ATT_INVALID_IDX 0xFF + +/// Range of attribute handle +#define ATT_1ST_REQ_START_HDL 0x0001 +#define ATT_1ST_REQ_END_HDL 0xFFFF + +/// Maximum possible attribute handle +#define ATT_MAX_ATTR_HDL 0xFFFF + +/// Offset of value in signed PDU +#define ATT_SIGNED_PDU_VAL_OFFSET 0x03 + +/// Attribute Features +#define ATT_SERVER_CONFIG 0x0001 +#define ATT_SERVICE_DISC 0x0002 +#define ATT_RELATIONSHIP_DISC 0x0004 +#define ATT_CHAR_DISC 0x0008 +#define ATT_CHAR_DESC_DISC 0x0010 +#define ATT_RD_CHAR_VALUE 0x0020 +#define ATT_WR_CHAR_VALUE 0x0040 +#define ATT_NOTIF_CHAR_VALUE 0x0080 +#define ATT_IND_CHAR_VALUE 0x0100 +#define ATT_RD_CHAR_DESC 0x0200 +#define ATT_WR_CHAR_DESC 0x0400 + +/// Length, number, offset defines +#define ATT_SVC_VALUE_MAX_LEN 0x0030 +#define ATT_CHAR_NAME_MAX_LEN 0x0030 +#define ATT_UUID16_LEN 0x0002 +#define ATT_UUID32_LEN 0x0004 +#define ATT_UUID128_LEN 0x0010 + +/// offset - l2cap header and ATT code +#define ATT_PDU_DATA_OFFSET 0x05 + +/// Characteristic Properties Bit +#define ATT_CHAR_PROP_BCAST 0x01 +#define ATT_CHAR_PROP_RD 0x02 +#define ATT_CHAR_PROP_WR_NO_RESP 0x04 +#define ATT_CHAR_PROP_WR 0x08 +#define ATT_CHAR_PROP_NTF 0x10 +#define ATT_CHAR_PROP_IND 0x20 +#define ATT_CHAR_PROP_AUTH 0x40 +#define ATT_CHAR_PROP_EXT_PROP 0x80 +/// Invalid Attribute Handle +#define ATT_INVALID_SEARCH_HANDLE 0x0000 +#define ATT_INVALID_HANDLE 0x0000 +/// Read Information Request +#define ATT_UUID_FILTER_0 0x00 +#define ATT_UUID_FILTER_2 0x02 +#define ATT_UUID_FILTER_16 0x10 +/// Read Information Response +#define ATT_FORMAT_LEN 0x0001 +#define ATT_FORMAT_16BIT_UUID 0x01 +#define ATT_FORMAT_128BIT_UUID 0x02 +/// For No fix length PDU +#define ATT_HANDLE_LEN 0x0002 +#define ATT_EACHLEN_LEN 0x0001 +#define ATT_PROP_LEN 0x0001 +#define ATT_CODE_LEN 0x0001 +#define ATT_CODE_AND_DATA_LEN 0x0002 +#define ATT_CODE_AND_HDL_LEN 0x0003 +#define ATT_CODE_AND_HDL_LEN_AND_OFFSET 0x0005 +#define ATT_SIGNATURE_LEN 0x0C + +/// extended characteristics +#define ATT_EXT_RELIABLE_WRITE 0x0001 +#define ATT_EXT_WRITABLE_AUX 0x0002 +#define ATT_EXT_RFU 0xFFFC + +/// PDU size for error response +#define ATT_ERROR_RESP_LEN 0x05 + +/// Offset of value in signed PDU +#define ATT_SIGNED_PDU_VAL_OFFSET 0x03 + + +#define ATT_BT_UUID_128 {0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80, \ + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + + +/* Attribute Specification Defines */ + +/// Common 16-bit Universal Unique Identifier +enum att_uuid16 { + ATT_INVALID_UUID = ATT_UUID16(0x0000), + + /*----------------- SERVICES ---------------------*/ + /// Generic Access Profile + ATT_SVC_GENERIC_ACCESS = ATT_UUID16(0x1800), + /// Attribute Profile + ATT_SVC_GENERIC_ATTRIBUTE = ATT_UUID16(0x1801), + /// Immediate alert Service + ATT_SVC_IMMEDIATE_ALERT = ATT_UUID16(0x1802), + /// Link Loss Service + ATT_SVC_LINK_LOSS = ATT_UUID16(0x1803), + /// Tx Power Service + ATT_SVC_TX_POWER = ATT_UUID16(0x1804), + /// Current Time Service Service + ATT_SVC_CURRENT_TIME = ATT_UUID16(0x1805), + /// Reference Time Update Service + ATT_SVC_REF_TIME_UPDATE = ATT_UUID16(0x1806), + /// Next DST Change Service + ATT_SVC_NEXT_DST_CHANGE = ATT_UUID16(0x1807), + /// Glucose Service + ATT_SVC_GLUCOSE = ATT_UUID16(0x1808), + /// Health Thermometer Service + ATT_SVC_HEALTH_THERMOM = ATT_UUID16(0x1809), + /// Device Information Service + ATT_SVC_DEVICE_INFO = ATT_UUID16(0x180A), + /// Heart Rate Service + ATT_SVC_HEART_RATE = ATT_UUID16(0x180D), + /// Phone Alert Status Service + ATT_SVC_PHONE_ALERT_STATUS = ATT_UUID16(0x180E), + /// Battery Service + ATT_SVC_BATTERY_SERVICE = ATT_UUID16(0x180F), + /// Blood Pressure Service + ATT_SVC_BLOOD_PRESSURE = ATT_UUID16(0x1810), + /// Alert Notification Service + ATT_SVC_ALERT_NTF = ATT_UUID16(0x1811), + /// HID Service + ATT_SVC_HID = ATT_UUID16(0x1812), + /// Scan Parameters Service + ATT_SVC_SCAN_PARAMETERS = ATT_UUID16(0x1813), + /// Running Speed and Cadence Service + ATT_SVC_RUNNING_SPEED_CADENCE = ATT_UUID16(0x1814), + /// Cycling Speed and Cadence Service + ATT_SVC_CYCLING_SPEED_CADENCE = ATT_UUID16(0x1816), + /// Cycling Power Service + ATT_SVC_CYCLING_POWER = ATT_UUID16(0x1818), + /// Location and Navigation Service + ATT_SVC_LOCATION_AND_NAVIGATION = ATT_UUID16(0x1819), + /// Environmental Sensing Service + ATT_SVC_ENVIRONMENTAL_SENSING = ATT_UUID16(0x181A), + /// Body Composition Service + ATT_SVC_BODY_COMPOSITION = ATT_UUID16(0x181B), + /// User Data Service + ATT_SVC_USER_DATA = ATT_UUID16(0x181C), + /// Weight Scale Service + ATT_SVC_WEIGHT_SCALE = ATT_UUID16(0x181D), + /// Bond Management Service + ATT_SVC_BOND_MANAGEMENT = ATT_UUID16(0x181E), + /// Continuous Glucose Monitoring Service + ATT_SVC_CONTINUOUS_GLUCOSE_MONITORING = ATT_UUID16(0x181F), + /// Internet Protocol Support Service + ATT_SVC_IP_SUPPORT = ATT_UUID16(0x1820), + /// Indoor Positioning Service + ATT_SVC_INDOOR_POSITIONING = ATT_UUID16(0x1821), + /// Pulse Oximeter Service + ATT_SVC_PULSE_OXIMETER = ATT_UUID16(0x1822), + /// HTTP Proxy Service + ATT_SVC_HTTP_PROXY = ATT_UUID16(0x1823), + /// Transport Discovery Service + ATT_SVC_TRANSPORT_DISCOVERY = ATT_UUID16(0x1824), + /// Object Transfer Service + ATT_SVC_OBJECT_TRANSFER = ATT_UUID16(0x1825), + /// Mesh Provisioning Service + ATT_SVC_MESH_PROVISIONING = ATT_UUID16(0x1827), + /// Mesh Proxy Service + ATT_SVC_MESH_PROXY = ATT_UUID16(0x1828), + + /*------------------- UNITS ---------------------*/ + /// No defined unit + ATT_UNIT_UNITLESS = ATT_UUID16(0x2700), + /// Length Unit - Metre + ATT_UNIT_METRE = ATT_UUID16(0x2701), + /// Mass unit - Kilogram + ATT_UNIT_KG = ATT_UUID16(0x2702), + /// Time unit - second + ATT_UNIT_SECOND = ATT_UUID16(0x2703), + /// Electric current unit - Ampere + ATT_UNIT_AMPERE = ATT_UUID16(0x2704), + /// Thermodynamic Temperature unit - Kelvin + ATT_UNIT_KELVIN = ATT_UUID16(0x2705), + /// Amount of substance unit - mole + ATT_UNIT_MOLE = ATT_UUID16(0x2706), + /// Luminous intensity unit - candela + ATT_UNIT_CANDELA = ATT_UUID16(0x2707), + /// Area unit - square metres + ATT_UNIT_SQ_METRE = ATT_UUID16(0x2710), + /// Colume unit - cubic metres + ATT_UNIT_CUBIC_METRE = ATT_UUID16(0x2710), + /// Velocity unit - metres per second + ATT_UNIT_METRE_PER_SECOND = ATT_UUID16(0x2711), + /// Acceleration unit - metres per second squared + ATT_UNIT_METRES_PER_SEC_SQ = ATT_UUID16(0x2712), + /// Wavenumber unit - reciprocal metre + ATT_UNIT_RECIPROCAL_METRE = ATT_UUID16(0x2713), + /// Density unit - kilogram per cubic metre + ATT_UNIT_DENS_KG_PER_CUBIC_METRE = ATT_UUID16(0x2714), + /// Surface density unit - kilogram per square metre + ATT_UNIT_KG_PER_SQ_METRE = ATT_UUID16(0x2715), + /// Specific volume unit - cubic metre per kilogram + ATT_UNIT_CUBIC_METRE_PER_KG = ATT_UUID16(0x2716), + /// Current density unit - ampere per square metre + ATT_UNIT_AMPERE_PER_SQ_METRE = ATT_UUID16(0x2717), + /// Magnetic field strength unit - Ampere per metre + ATT_UNIT_AMPERE_PER_METRE = ATT_UUID16(0x2718), + /// Amount concentration unit - mole per cubic metre + ATT_UNIT_MOLE_PER_CUBIC_METRE = ATT_UUID16(0x2719), + /// Mass Concentration unit - kilogram per cubic metre + ATT_UNIT_MASS_KG_PER_CUBIC_METRE = ATT_UUID16(0x271A), + /// Luminance unit - candela per square metre + ATT_UNIT_CANDELA_PER_SQ_METRE = ATT_UUID16(0x271B), + /// Refractive index unit + ATT_UNIT_REFRACTIVE_INDEX = ATT_UUID16(0x271C), + /// Relative permeability unit + ATT_UNIT_RELATIVE_PERMEABILITY = ATT_UUID16(0x271D), + /// Plane angle unit - radian + ATT_UNIT_RADIAN = ATT_UUID16(0x2720), + /// Solid angle unit - steradian + ATT_UNIT_STERADIAN = ATT_UUID16(0x2721), + /// Frequency unit - Hertz + ATT_UNIT_HERTZ = ATT_UUID16(0x2722), + /// Force unit - Newton + ATT_UNIT_NEWTON = ATT_UUID16(0x2723), + /// Pressure unit - Pascal + ATT_UNIT_PASCAL = ATT_UUID16(0x2724), + /// Energy unit - Joule + ATT_UNIT_JOULE = ATT_UUID16(0x2725), + /// Power unit - Watt + ATT_UNIT_WATT = ATT_UUID16(0x2726), + /// electric Charge unit - Coulomb + ATT_UNIT_COULOMB = ATT_UUID16(0x2727), + /// Electric potential difference - Volt + ATT_UNIT_VOLT = ATT_UUID16(0x2728), + /// Capacitance unit - Farad + ATT_UNIT_FARAD = ATT_UUID16(0x2729), + /// electric resistance unit - Ohm + ATT_UNIT_OHM = ATT_UUID16(0x272A), + /// Electric conductance - Siemens + ATT_UNIT_SIEMENS = ATT_UUID16(0x272B), + /// Magnetic flux unit - Weber + ATT_UNIT_WEBER = ATT_UUID16(0x272C), + /// Magnetic flux density unit - Tesla + ATT_UNIT_TESLA = ATT_UUID16(0x272D), + /// Inductance unit - Henry + ATT_UNIT_HENRY = ATT_UUID16(0x272E), + /// Temperature unit - degree Celsius + ATT_UNIT_CELSIUS = ATT_UUID16(0x272F), + /// Luminous flux unit - lumen + ATT_UNIT_LUMEN = ATT_UUID16(0x2730), + /// Illuminance unit - lux + ATT_UNIT_LUX = ATT_UUID16(0x2731), + /// Activity referred to a radionuclide unit - becquerel + ATT_UNIT_BECQUEREL = ATT_UUID16(0x2732), + /// Absorbed dose unit - Gray + ATT_UNIT_GRAY = ATT_UUID16(0x2733), + /// Dose equivalent unit - Sievert + ATT_UNIT_SIEVERT = ATT_UUID16(0x2734), + /// Catalytic activity unit - Katal + ATT_UNIT_KATAL = ATT_UUID16(0x2735), + /// Synamic viscosity unit - Pascal second + ATT_UNIT_PASCAL_SECOND = ATT_UUID16(0x2740), + /// Moment of force unit - Newton metre + ATT_UNIT_NEWTON_METRE = ATT_UUID16(0x2741), + /// surface tension unit - Newton per metre + ATT_UNIT_NEWTON_PER_METRE = ATT_UUID16(0x2742), + /// Angular velocity unit - radian per second + ATT_UNIT_RADIAN_PER_SECOND = ATT_UUID16(0x2743), + /// Angular acceleration unit - radian per second squared + ATT_UNIT_RADIAN_PER_SECOND_SQ = ATT_UUID16(0x2744), + /// Heat flux density unit - Watt per square metre + ATT_UNIT_WATT_PER_SQ_METRE = ATT_UUID16(0x2745), + /// HEat capacity unit - Joule per Kelvin + ATT_UNIT_JOULE_PER_KELVIN = ATT_UUID16(0x2746), + /// Specific heat capacity unit - Joule per kilogram kelvin + ATT_UNIT_JOULE_PER_KG_KELVIN = ATT_UUID16(0x2747), + /// Specific Energy unit - Joule per kilogram + ATT_UNIT_JOULE_PER_KG = ATT_UUID16(0x2748), + /// Thermal conductivity - Watt per metre Kelvin + ATT_UNIT_WATT_PER_METRE_KELVIN = ATT_UUID16(0x2749), + /// Energy Density unit - joule per cubic metre + ATT_UNIT_JOULE_PER_CUBIC_METRE = ATT_UUID16(0x274A), + /// Electric field strength unit - volt per metre + ATT_UNIT_VOLT_PER_METRE = ATT_UUID16(0x274B), + /// Electric charge density unit - coulomb per cubic metre + ATT_UNIT_COULOMB_PER_CUBIC_METRE = ATT_UUID16(0x274C), + /// Surface charge density unit - coulomb per square metre + ATT_UNIT_SURF_COULOMB_PER_SQ_METRE = ATT_UUID16(0x274D), + /// Electric flux density unit - coulomb per square metre + ATT_UNIT_FLUX_COULOMB_PER_SQ_METRE = ATT_UUID16(0x274E), + /// Permittivity unit - farad per metre + ATT_UNIT_FARAD_PER_METRE = ATT_UUID16(0x274F), + /// Permeability unit - henry per metre + ATT_UNIT_HENRY_PER_METRE = ATT_UUID16(0x2750), + /// Molar energy unit - joule per mole + ATT_UNIT_JOULE_PER_MOLE = ATT_UUID16(0x2751), + /// Molar entropy unit - joule per mole kelvin + ATT_UNIT_JOULE_PER_MOLE_KELVIN = ATT_UUID16(0x2752), + /// Exposure unit - coulomb per kilogram + ATT_UNIT_COULOMB_PER_KG = ATT_UUID16(0x2753), + /// Absorbed dose rate unit - gray per second + ATT_UNIT_GRAY_PER_SECOND = ATT_UUID16(0x2754), + /// Radiant intensity unit - watt per steradian + ATT_UNIT_WATT_PER_STERADIAN = ATT_UUID16(0x2755), + /// Radiance unit - watt per square meter steradian + ATT_UNIT_WATT_PER_SQ_METRE_STERADIAN = ATT_UUID16(0x2756), + /// Catalytic activity concentration unit - katal per cubic metre + ATT_UNIT_KATAL_PER_CUBIC_METRE = ATT_UUID16(0x2757), + /// Time unit - minute + ATT_UNIT_MINUTE = ATT_UUID16(0x2760), + /// Time unit - hour + ATT_UNIT_HOUR = ATT_UUID16(0x2761), + /// Time unit - day + ATT_UNIT_DAY = ATT_UUID16(0x2762), + /// Plane angle unit - degree + ATT_UNIT_ANGLE_DEGREE = ATT_UUID16(0x2763), + /// Plane angle unit - minute + ATT_UNIT_ANGLE_MINUTE = ATT_UUID16(0x2764), + /// Plane angle unit - second + ATT_UNIT_ANGLE_SECOND = ATT_UUID16(0x2765), + /// Area unit - hectare + ATT_UNIT_HECTARE = ATT_UUID16(0x2766), + /// Volume unit - litre + ATT_UNIT_LITRE = ATT_UUID16(0x2767), + /// Mass unit - tonne + ATT_UNIT_TONNE = ATT_UUID16(0x2768), + /// Pressure unit - bar + ATT_UNIT_BAR = ATT_UUID16(0x2780), + /// Pressure unit - millimetre of mercury + ATT_UNIT_MM_MERCURY = ATT_UUID16(0x2781), + /// Length unit - angstrom + ATT_UNIT_ANGSTROM = ATT_UUID16(0x2782), + /// Length unit - nautical mile + ATT_UNIT_NAUTICAL_MILE = ATT_UUID16(0x2783), + /// Area unit - barn + ATT_UNIT_BARN = ATT_UUID16(0x2784), + /// Velocity unit - knot + ATT_UNIT_KNOT = ATT_UUID16(0x2785), + /// Logarithmic radio quantity unit - neper + ATT_UNIT_NEPER = ATT_UUID16(0x2786), + /// Logarithmic radio quantity unit - bel + ATT_UNIT_BEL = ATT_UUID16(0x2787), + /// Length unit - yard + ATT_UNIT_YARD = ATT_UUID16(0x27A0), + /// Length unit - parsec + ATT_UNIT_PARSEC = ATT_UUID16(0x27A1), + /// length unit - inch + ATT_UNIT_INCH = ATT_UUID16(0x27A2), + /// length unit - foot + ATT_UNIT_FOOT = ATT_UUID16(0x27A3), + /// length unit - mile + ATT_UNIT_MILE = ATT_UUID16(0x27A4), + /// pressure unit - pound-force per square inch + ATT_UNIT_POUND_FORCE_PER_SQ_INCH = ATT_UUID16(0x27A5), + /// velocity unit - kilometre per hour + ATT_UNIT_KM_PER_HOUR = ATT_UUID16(0x27A6), + /// velocity unit - mile per hour + ATT_UNIT_MILE_PER_HOUR = ATT_UUID16(0x27A7), + /// angular velocity unit - revolution per minute + ATT_UNIT_REVOLUTION_PER_MINUTE = ATT_UUID16(0x27A8), + /// energy unit - gram calorie + ATT_UNIT_GRAM_CALORIE = ATT_UUID16(0x27A9), + /// energy unit - kilogram calorie + ATT_UNIT_KG_CALORIE = ATT_UUID16(0x27AA), + /// energy unit - kilowatt hour + ATT_UNIT_KILOWATT_HOUR = ATT_UUID16(0x27AB), + /// thermodynamic temperature unit - degree Fahrenheit + ATT_UNIT_FAHRENHEIT = ATT_UUID16(0x27AC), + /// percentage + ATT_UNIT_PERCENTAGE = ATT_UUID16(0x27AD), + /// per mille + ATT_UNIT_PER_MILLE = ATT_UUID16(0x27AE), + /// period unit - beats per minute) + ATT_UNIT_BEATS_PER_MINUTE = ATT_UUID16(0x27AF), + /// electric charge unit - ampere hours + ATT_UNIT_AMPERE_HOURS = ATT_UUID16(0x27B0), + /// mass density unit - milligram per decilitre + ATT_UNIT_MILLIGRAM_PER_DECILITRE = ATT_UUID16(0x27B1), + /// mass density unit - millimole per litre + ATT_UNIT_MILLIMOLE_PER_LITRE = ATT_UUID16(0x27B2), + /// time unit - year + ATT_UNIT_YEAR = ATT_UUID16(0x27B3), + //// time unit - month + ATT_UNIT_MONTH = ATT_UUID16(0x27B4), + + /*---------------- DECLARATIONS -----------------*/ + /// Primary service Declaration + ATT_DECL_PRIMARY_SERVICE = ATT_UUID16(0x2800), + /// Secondary service Declaration + ATT_DECL_SECONDARY_SERVICE = ATT_UUID16(0x2801), + /// Include Declaration + ATT_DECL_INCLUDE = ATT_UUID16(0x2802), + /// Characteristic Declaration + ATT_DECL_CHARACTERISTIC = ATT_UUID16(0x2803), + + /*----------------- DESCRIPTORS -----------------*/ + /// Characteristic extended properties + ATT_DESC_CHAR_EXT_PROPERTIES = ATT_UUID16(0x2900), + /// Characteristic user description + ATT_DESC_CHAR_USER_DESCRIPTION = ATT_UUID16(0x2901), + /// Client characteristic configuration + ATT_DESC_CLIENT_CHAR_CFG = ATT_UUID16(0x2902), + /// Server characteristic configuration + ATT_DESC_SERVER_CHAR_CFG = ATT_UUID16(0x2903), + /// Characteristic Presentation Format + ATT_DESC_CHAR_PRES_FORMAT = ATT_UUID16(0x2904), + /// Characteristic Aggregate Format + ATT_DESC_CHAR_AGGREGATE_FORMAT = ATT_UUID16(0x2905), + /// Valid Range + ATT_DESC_VALID_RANGE = ATT_UUID16(0x2906), + /// External Report Reference + ATT_DESC_EXT_REPORT_REF = ATT_UUID16(0x2907), + /// Report Reference + ATT_DESC_REPORT_REF = ATT_UUID16(0x2908), + /// Environmental Sensing Configuration + ATT_DESC_ES_CONFIGURATION = ATT_UUID16(0x290B), + /// Environmental Sensing Measurement + ATT_DESC_ES_MEASUREMENT = ATT_UUID16(0x290C), + /// Environmental Sensing Trigger Setting + ATT_DESC_ES_TRIGGER_SETTING = ATT_UUID16(0x290D), + + /*--------------- CHARACTERISTICS ---------------*/ + /// Device name + ATT_CHAR_DEVICE_NAME = ATT_UUID16(0x2A00), + /// Appearance + ATT_CHAR_APPEARANCE = ATT_UUID16(0x2A01), + /// Privacy flag + ATT_CHAR_PRIVACY_FLAG = ATT_UUID16(0x2A02), + /// Reconnection address + ATT_CHAR_RECONNECTION_ADDR = ATT_UUID16(0x2A03), + /// Peripheral preferred connection parameters + ATT_CHAR_PERIPH_PREF_CON_PARAM = ATT_UUID16(0x2A04), + /// Service handles changed + ATT_CHAR_SERVICE_CHANGED = ATT_UUID16(0x2A05), + /// Alert Level characteristic + ATT_CHAR_ALERT_LEVEL = ATT_UUID16(0x2A06), + /// Tx Power Level + ATT_CHAR_TX_POWER_LEVEL = ATT_UUID16(0x2A07), + /// Date Time + ATT_CHAR_DATE_TIME = ATT_UUID16(0x2A08), + /// Day of Week + ATT_CHAR_DAY_WEEK = ATT_UUID16(0x2A09), + /// Day Date Time + ATT_CHAR_DAY_DATE_TIME = ATT_UUID16(0x2A0A), + /// Exact time 256 + ATT_CHAR_EXACT_TIME_256 = ATT_UUID16(0x2A0C), + /// DST Offset + ATT_CHAR_DST_OFFSET = ATT_UUID16(0x2A0D), + /// Time zone + ATT_CHAR_TIME_ZONE = ATT_UUID16(0x2A0E), + /// Local time Information + ATT_CHAR_LOCAL_TIME_INFO = ATT_UUID16(0x2A0F), + /// Time with DST + ATT_CHAR_TIME_WITH_DST = ATT_UUID16(0x2A11), + /// Time Accuracy + ATT_CHAR_TIME_ACCURACY = ATT_UUID16(0x2A12), + /// Time Source + ATT_CHAR_TIME_SOURCE = ATT_UUID16(0x2A13), + /// Reference Time Information + ATT_CHAR_REFERENCE_TIME_INFO = ATT_UUID16(0x2A14), + /// Time Update Control Point + ATT_CHAR_TIME_UPDATE_CTRL_POINT = ATT_UUID16(0x2A16), + /// Time Update State + ATT_CHAR_TIME_UPDATE_STATE = ATT_UUID16(0x2A17), + /// Glucose Measurement + ATT_CHAR_GLUCOSE_MEAS = ATT_UUID16(0x2A18), + /// Battery Level + ATT_CHAR_BATTERY_LEVEL = ATT_UUID16(0x2A19), + /// Battery Power Status + ATT_CHAR_BATTERY_POWER_STATE = ATT_UUID16(0x2A1A), + /// Battery Level State + ATT_CHAR_BATTERY_LEVEL_STATE = ATT_UUID16(0x2A1B), + /// Temperature Measurement + ATT_CHAR_TEMPERATURE_MEAS = ATT_UUID16(0x2A1C), + /// Temperature Type + ATT_CHAR_TEMPERATURE_TYPE = ATT_UUID16(0x2A1D), + /// Intermediate Temperature + ATT_CHAR_INTERMED_TEMPERATURE = ATT_UUID16(0x2A1E), + /// Measurement Interval + ATT_CHAR_MEAS_INTERVAL = ATT_UUID16(0x2A21), + /// Boot Keyboard Input Report + ATT_CHAR_BOOT_KB_IN_REPORT = ATT_UUID16(0x2A22), + /// System ID + ATT_CHAR_SYS_ID = ATT_UUID16(0x2A23), + /// Model Number String + ATT_CHAR_MODEL_NB = ATT_UUID16(0x2A24), + /// Serial Number String + ATT_CHAR_SERIAL_NB = ATT_UUID16(0x2A25), + /// Firmware Revision String + ATT_CHAR_FW_REV = ATT_UUID16(0x2A26), + /// Hardware revision String + ATT_CHAR_HW_REV = ATT_UUID16(0x2A27), + /// Software Revision String + ATT_CHAR_SW_REV = ATT_UUID16(0x2A28), + /// Manufacturer Name String + ATT_CHAR_MANUF_NAME = ATT_UUID16(0x2A29), + /// IEEE Regulatory Certification Data List + ATT_CHAR_IEEE_CERTIF = ATT_UUID16(0x2A2A), + /// CT Time + ATT_CHAR_CT_TIME = ATT_UUID16(0x2A2B), + /// Magnetic Declination + ATT_CHAR_MAGN_DECLINE = ATT_UUID16(0x2A2C), + /// Scan Refresh + ATT_CHAR_SCAN_REFRESH = ATT_UUID16(0x2A31), + /// Boot Keyboard Output Report + ATT_CHAR_BOOT_KB_OUT_REPORT = ATT_UUID16(0x2A32), + /// Boot Mouse Input Report + ATT_CHAR_BOOT_MOUSE_IN_REPORT = ATT_UUID16(0x2A33), + /// Glucose Measurement Context + ATT_CHAR_GLUCOSE_MEAS_CTX = ATT_UUID16(0x2A34), + /// Blood Pressure Measurement + ATT_CHAR_BLOOD_PRESSURE_MEAS = ATT_UUID16(0x2A35), + /// Intermediate Cuff Pressure + ATT_CHAR_INTERMEDIATE_CUFF_PRESSURE = ATT_UUID16(0x2A36), + /// Heart Rate Measurement + ATT_CHAR_HEART_RATE_MEAS = ATT_UUID16(0x2A37), + /// Body Sensor Location + ATT_CHAR_BODY_SENSOR_LOCATION = ATT_UUID16(0x2A38), + /// Heart Rate Control Point + ATT_CHAR_HEART_RATE_CTRL_POINT = ATT_UUID16(0x2A39), + /// Alert Status + ATT_CHAR_ALERT_STATUS = ATT_UUID16(0x2A3F), + /// Ringer Control Point + ATT_CHAR_RINGER_CTRL_POINT = ATT_UUID16(0x2A40), + /// Ringer Setting + ATT_CHAR_RINGER_SETTING = ATT_UUID16(0x2A41), + /// Alert Category ID Bit Mask + ATT_CHAR_ALERT_CAT_ID_BIT_MASK = ATT_UUID16(0x2A42), + /// Alert Category ID + ATT_CHAR_ALERT_CAT_ID = ATT_UUID16(0x2A43), + /// Alert Notification Control Point + ATT_CHAR_ALERT_NTF_CTRL_PT = ATT_UUID16(0x2A44), + /// Unread Alert Status + ATT_CHAR_UNREAD_ALERT_STATUS = ATT_UUID16(0x2A45), + /// New Alert + ATT_CHAR_NEW_ALERT = ATT_UUID16(0x2A46), + /// Supported New Alert Category + ATT_CHAR_SUP_NEW_ALERT_CAT = ATT_UUID16(0x2A47), + /// Supported Unread Alert Category + ATT_CHAR_SUP_UNREAD_ALERT_CAT = ATT_UUID16(0x2A48), + /// Blood Pressure Feature + ATT_CHAR_BLOOD_PRESSURE_FEATURE = ATT_UUID16(0x2A49), + /// HID Information + ATT_CHAR_HID_INFO = ATT_UUID16(0x2A4A), + /// Report Map + ATT_CHAR_REPORT_MAP = ATT_UUID16(0x2A4B), + /// HID Control Point + ATT_CHAR_HID_CTRL_PT = ATT_UUID16(0x2A4C), + /// Report + ATT_CHAR_REPORT = ATT_UUID16(0x2A4D), + /// Protocol Mode + ATT_CHAR_PROTOCOL_MODE = ATT_UUID16(0x2A4E), + /// Scan Interval Window + ATT_CHAR_SCAN_INTV_WD = ATT_UUID16(0x2A4F), + /// PnP ID + ATT_CHAR_PNP_ID = ATT_UUID16(0x2A50), + /// Glucose Feature + ATT_CHAR_GLUCOSE_FEATURE = ATT_UUID16(0x2A51), + /// Record access control point + ATT_CHAR_REC_ACCESS_CTRL_PT = ATT_UUID16(0x2A52), + /// RSC Measurement + ATT_CHAR_RSC_MEAS = ATT_UUID16(0x2A53), + /// RSC Feature + ATT_CHAR_RSC_FEAT = ATT_UUID16(0x2A54), + /// SC Control Point + ATT_CHAR_SC_CTRL_PT = ATT_UUID16(0x2A55), + /// CSC Measurement + ATT_CHAR_CSC_MEAS = ATT_UUID16(0x2A5B), + /// CSC Feature + ATT_CHAR_CSC_FEAT = ATT_UUID16(0x2A5C), + /// Sensor Location + ATT_CHAR_SENSOR_LOC = ATT_UUID16(0x2A5D), + /// PLX Spot-Check Measurement + ATT_CHAR_PLX_SPOT_CHECK_MEASUREMENT_LOC = ATT_UUID16(0x2A5E), + /// PLX Continuous Measurement + ATT_CHAR_PLX_CONTINUOUS_MEASUREMENT_LOC = ATT_UUID16(0x2A5F), + /// PLX Features + ATT_CHAR_PLX_FEATURES_LOC = ATT_UUID16(0x2A60), + /// CP Measurement + ATT_CHAR_CP_MEAS = ATT_UUID16(0x2A63), + /// CP Vector + ATT_CHAR_CP_VECTOR = ATT_UUID16(0x2A64), + /// CP Feature + ATT_CHAR_CP_FEAT = ATT_UUID16(0x2A65), + /// CP Control Point + ATT_CHAR_CP_CTRL_PT = ATT_UUID16(0x2A66), + /// Location and Speed + ATT_CHAR_LOC_SPEED = ATT_UUID16(0x2A67), + /// Navigation + ATT_CHAR_NAVIGATION = ATT_UUID16(0x2A68), + /// Position Quality + ATT_CHAR_POS_QUALITY = ATT_UUID16(0x2A69), + /// LN Feature + ATT_CHAR_LN_FEAT = ATT_UUID16(0x2A6A), + /// LN Control Point + ATT_CHAR_LN_CTRL_PT = ATT_UUID16(0x2A6B), + /// Elevation + ATT_CHAR_ELEVATION = ATT_UUID16(0x2A6C), + /// Pressure + ATT_CHAR_PRESSURE = ATT_UUID16(0x2A6D), + /// Temperature + ATT_CHAR_TEMPERATURE = ATT_UUID16(0x2A6E), + /// Humidity + ATT_CHAR_HUMIDITY = ATT_UUID16(0x2A6F), + /// True Wind Speed + ATT_CHAR_TRUE_WIND_SPEED = ATT_UUID16(0x2A70), + /// True Wind Direction + ATT_CHAR_TRUE_WIND_DIR = ATT_UUID16(0x2A71), + /// Apparent Wind Speed + ATT_CHAR_APRNT_WIND_SPEED = ATT_UUID16(0x2A72), + /// Apparent Wind Direction + ATT_CHAR_APRNT_WIND_DIRECTION = ATT_UUID16(0x2A73), + /// Gust Factor + ATT_CHAR_GUST_FACTOR = ATT_UUID16(0x2A74), + /// Pollen Concentration + ATT_CHAR_POLLEN_CONC = ATT_UUID16(0x2A75), + /// UV Index + ATT_CHAR_UV_INDEX = ATT_UUID16(0x2A76), + /// Irradiance + ATT_CHAR_IRRADIANCE = ATT_UUID16(0x2A77), + /// Rainfall + ATT_CHAR_RAINFALL = ATT_UUID16(0x2A78), + /// Wind Chill + ATT_CHAR_WIND_CHILL = ATT_UUID16(0x2A79), + /// Heat Index + ATT_CHAR_HEAT_INDEX = ATT_UUID16(0x2A7A), + /// Dew Point + ATT_CHAR_DEW_POINT = ATT_UUID16(0x2A7B), + /// Descriptor Value Changed + ATT_CHAR_DESCRIPTOR_VALUE_CHANGED = ATT_UUID16(0x2A7D), + /// Aerobic Heart Rate Lower Limit + ATT_CHAR_AEROBIC_HEART_RATE_LOWER_LIMIT = ATT_UUID16(0x2A7E), + /// Aerobic Threshhold + ATT_CHAR_AEROBIC_THRESHHOLD = ATT_UUID16(0x2A7F), + /// Age + ATT_CHAR_AGE = ATT_UUID16(0x2A80), + /// Anaerobic Heart Rate Lower Limit + ATT_CHAR_ANAEROBIC_HEART_RATE_LOWER_LIMIT = ATT_UUID16(0x2A81), + /// Anaerobic Heart Rate Upper Limit + ATT_CHAR_ANAEROBIC_HEART_RATE_UPPER_LIMIT = ATT_UUID16(0x2A82), + /// Anaerobic Threshhold + ATT_CHAR_ANAEROBIC_THRESHHOLD = ATT_UUID16(0x2A83), + /// Aerobic Heart Rate Upper Limit + ATT_CHAR_AEROBIC_HEART_RATE_UPPER_LIMIT = ATT_UUID16(0x2A84), + /// Date Of Birth + ATT_CHAR_DATE_OF_BIRTH = ATT_UUID16(0x2A85), + /// Date Of Threshold Assessment + ATT_CHAR_DATE_OF_THRESHOLD_ASSESSMENT = ATT_UUID16(0x2A86), + /// Email Address + ATT_CHAR_EMAIL_ADDRESS = ATT_UUID16(0x2A87), + /// Fat Burn Heart Rate Lower Limit + ATT_CHAR_FAT_BURN_HEART_RATE_LOWER_LIMIT = ATT_UUID16(0x2A88), + /// Fat Burn Heart Rate Upper Limit + ATT_CHAR_FAT_BURN_HEART_RATE_UPPER_LIMIT = ATT_UUID16(0x2A89), + /// First Name + ATT_CHAR_FIRST_NAME = ATT_UUID16(0x2A8A), + /// Five Zone Heart Rate Limits + ATT_CHAR_FIVE_ZONE_HEART_RATE_LIMITS = ATT_UUID16(0x2A8B), + /// Gender + ATT_CHAR_GENDER = ATT_UUID16(0x2A8C), + /// Max Heart Rate + ATT_CHAR_MAX_HEART_RATE = ATT_UUID16(0x2A8D), + /// Height + ATT_CHAR_HEIGHT = ATT_UUID16(0x2A8E), + /// Hip Circumference + ATT_CHAR_HIP_CIRCUMFERENCE = ATT_UUID16(0x2A8F), + /// Last Name + ATT_CHAR_LAST_NAME = ATT_UUID16(0x2A90), + /// Maximum Recommended Heart Rate + ATT_CHAR_MAXIMUM_RECOMMENDED_HEART_RATE = ATT_UUID16(0x2A91), + /// Resting Heart Rate + ATT_CHAR_RESTING_HEART_RATE = ATT_UUID16(0x2A92), + /// Sport Type For Aerobic And Anaerobic Thresholds + ATT_CHAR_SPORT_TYPE_FOR_AEROBIC_AND_ANAEROBIC_THRESHOLDS = ATT_UUID16(0x2A93), + /// Three Zone Heart Rate Limits + ATT_CHAR_THREE_ZONE_HEART_RATE_LIMITS = ATT_UUID16(0x2A94), + /// Two Zone Heart Rate Limit + ATT_CHAR_TWO_ZONE_HEART_RATE_LIMIT = ATT_UUID16(0x2A95), + /// Vo2 Max + ATT_CHAR_VO2_MAX = ATT_UUID16(0x2A96), + /// Waist Circumference + ATT_CHAR_WAIST_CIRCUMFERENCE = ATT_UUID16(0x2A97), + /// Weight + ATT_CHAR_WEIGHT = ATT_UUID16(0x2A98), + /// Database Change Increment + ATT_CHAR_DATABASE_CHANGE_INCREMENT = ATT_UUID16(0x2A99), + /// User Index + ATT_CHAR_USER_INDEX = ATT_UUID16(0x2A9A), + /// Body Composition Feature + ATT_CHAR_BODY_COMPOSITION_FEATURE = ATT_UUID16(0x2A9B), + /// Body Composition Measurement + ATT_CHAR_BODY_COMPOSITION_MEASUREMENT = ATT_UUID16(0x2A9C), + /// Weight Measurement + ATT_CHAR_WEIGHT_MEASUREMENT = ATT_UUID16(0x2A9D), + /// Weight Scale Feature + ATT_CHAR_WEIGHT_SCALE_FEATURE = ATT_UUID16(0x2A9E), + /// User Control Point + ATT_CHAR_USER_CONTROL_POINT = ATT_UUID16(0x2A9F), + /// Flux Density - 2D + ATT_CHAR_MAGN_FLUX_2D = ATT_UUID16(0x2AA0), + /// Magnetic Flux Density - 3D + ATT_CHAR_MAGN_FLUX_3D = ATT_UUID16(0x2AA1), + /// Language string + ATT_CHAR_LANGUAGE = ATT_UUID16(0x2AA2), + /// Barometric Pressure Trend + ATT_CHAR_BAR_PRES_TREND = ATT_UUID16(0x2AA3), + /// Central Address Resolution Support + ATT_CHAR_CTL_ADDR_RESOL_SUPP = ATT_UUID16(0x2AA6), + /// CGM Measurement + ATT_CHAR_CGM_MEASUREMENT = ATT_UUID16(0x2AA7), + /// CGM Features + ATT_CHAR_CGM_FEATURES = ATT_UUID16(0x2AA8), + /// CGM Status + ATT_CHAR_CGM_STATUS = ATT_UUID16(0x2AA9), + /// CGM Session Start + ATT_CHAR_CGM_SESSION_START = ATT_UUID16(0x2AAA), + /// CGM Session Run + ATT_CHAR_CGM_SESSION_RUN = ATT_UUID16(0x2AAB), + /// CGM Specific Ops Control Point + ATT_CHAR_CGM_SPECIFIC_OPS_CTRL_PT = ATT_UUID16(0x2AAC), + /// Resolvable Private Address only + ATT_CHAR_RSLV_PRIV_ADDR_ONLY = ATT_UUID16(0x2AC9), + /// Mesh Provisioning Data In + ATT_CHAR_MESH_PROV_DATA_IN = ATT_UUID16(0x2ADB), + /// Mesh Provisioning Data Out + ATT_CHAR_MESH_PROV_DATA_OUT = ATT_UUID16(0x2ADC), + /// Mesh Proxy Data In + ATT_CHAR_MESH_PROXY_DATA_IN = ATT_UUID16(0x2ADD), + /// Mesh Proxy Data Out + ATT_CHAR_MESH_PROXY_DATA_OUT = ATT_UUID16(0x2ADE), + /// Client Supported Features + ATT_CHAR_CLI_SUP_FEAT = ATT_UUID16(0x2B29), + /// Database Hash + ATT_CHAR_DB_HASH = ATT_UUID16(0x2B2A), +}; + +/// Format for Characteristic Presentation +enum att_format_pres { + /// unsigned 1-bit: true or false + ATT_FORMAT_BOOL = 0x01, + /// unsigned 2-bit integer + ATT_FORMAT_2BIT, + /// unsigned 4-bit integer + ATT_FORMAT_NIBBLE, + /// unsigned 8-bit integer + ATT_FORMAT_UINT8, + /// unsigned 12-bit integer + ATT_FORMAT_UINT12, + /// unsigned 16-bit integer + ATT_FORMAT_UINT16, + /// unsigned 24-bit integer + ATT_FORMAT_UINT24, + /// unsigned 32-bit integer + ATT_FORMAT_UINT32, + /// unsigned 48-bit integer + ATT_FORMAT_UINT48, + /// unsigned 64-bit integer + ATT_FORMAT_UINT64, + /// unsigned 128-bit integer + ATT_FORMAT_UINT128, + /// signed 8-bit integer + ATT_FORMAT_SINT8, + /// signed 12-bit integer + ATT_FORMAT_SINT12, + /// signed 16-bit integer + ATT_FORMAT_SINT16, + /// signed 24-bit integer + ATT_FORMAT_SINT24, + /// signed 32-bit integer + ATT_FORMAT_SINT32, + /// signed 48-bit integer + ATT_FORMAT_SINT48, + /// signed 64-bit integer + ATT_FORMAT_SINT64, + /// signed 128-bit integer + ATT_FORMAT_SINT128, + /// IEEE-754 32-bit floating point + ATT_FORMAT_FLOAT32, + /// IEEE-754 64-bit floating point + ATT_FORMAT_FLOAT64, + /// IEEE-11073 16-bit SFLOAT + ATT_FORMAT_SFLOAT, + /// IEEE-11073 32-bit FLOAT + ATT_FORMAT_FLOAT, + /// IEEE-20601 format + ATT_FORMAT_DUINT16, + /// UTF-8 string + ATT_FORMAT_UTF8S, + /// UTF-16 string + ATT_FORMAT_UTF16S, + /// Opaque structure + ATT_FORMAT_STRUCT, + /// Last format + ATT_FORMAT_LAST +}; + +/// Client Characteristic Configuration Codes +enum att_ccc_val +{ + /// Stop notification/indication + ATT_CCC_STOP_NTFIND = 0x0000, + /// Start notification + ATT_CCC_START_NTF = 0x0001, + /// Start indication + ATT_CCC_START_IND = 0x0002, +}; + + +/* + * Type Definition + **************************************************************************************** + */ + +/// Attribute length type +typedef uint16_t att_size_t; + + +/// UUID - 128-bit type +struct att_uuid_128 +{ + /// 128-bit UUID + uint8_t uuid[ATT_UUID128_LEN]; +}; + +/// UUID - 32-bit type +struct att_uuid_32 +{ + /// 32-bit UUID + uint8_t uuid[ATT_UUID32_LEN]; +}; + + +/// Characteristic Value Descriptor +struct att_char_desc +{ + /// properties + uint8_t prop; + /// attribute handle + uint8_t attr_hdl[ATT_HANDLE_LEN]; + /// attribute type + uint8_t attr_type[ATT_UUID16_LEN]; +}; + +/// Characteristic Value Descriptor +struct att_char128_desc +{ + /// properties + uint8_t prop; + /// attribute handle + uint8_t attr_hdl[ATT_HANDLE_LEN]; + /// attribute type + uint8_t attr_type[ATT_UUID128_LEN]; +}; + +/// Service Value Descriptor - 16-bit +typedef uint16_t att_svc_desc_t; + +/// include service entry element +struct att_incl_desc +{ + /// start handle value of included service + uint16_t start_hdl; + /// end handle value of included service + uint16_t end_hdl; + /// attribute value UUID + uint16_t uuid; +}; + +/// include service entry element +struct att_incl128_desc +{ + /// start handle value of included service + uint16_t start_hdl; + /// end handle value of included service + uint16_t end_hdl; +}; + + +// -------------------------- PDU HANDLER Definition -------------------------- + +/// used to know if PDU handler has been found +#define ATT_PDU_HANDLER_NOT_FOUND (0xff) + +/// Format of a pdu handler function +typedef int (*att_func_t)(uint8_t conidx, void *pdu); + +/// Element of a pdu handler table. +struct att_pdu_handler +{ + /// PDU identifier of the message + uint8_t pdu_id; + /// Pointer to the handler function for the pdu above. + att_func_t handler; +}; + + +// -------------------------- Database declaration ----------------------------- + +/// macro to define an attribute property +/// @param prop Property @see enum att_info_mask (RD, WC, WR, NTF, IND, WS, B, EXT) +#define PROP(prop) (ATT_PROP_##prop##_BIT) + +/// macro to define information option bit +/// @param opt Option @see enum svc_info_mask or @see enum att_ext_info_mask +#define OPT(opt) (opt##_BIT) + +/// macro to set attribute security level on a specific permission +/// @param lvl Security level @see enum sec_lvl +/// @param perm Permission @see enum att_info_mask (only RP, WP, NP, IP authorized) +#define ATT_SEC(perm, lvl) (((SEC_##lvl) << (ATT_PERM_##perm##_LSB)) & (ATT_PERM_##perm##_MASK)) + +/// macro to set attribute UUID type +/// @param type UUID type (16, 32, 128) +#define ATT_UUID(type) (((UUID_##type) << (ATT_UUID_TYPE_LSB)) & (ATT_UUID_TYPE_MASK)) + +/// macro to set service security level +/// @param lvl Security level @see enum sec_lvl +#define SVC_SEC(lvl) (((SEC_##lvl) << (SVC_AUTH_LSB)) & (SVC_AUTH_MASK)) + +/// macro to set service UUID type +/// @param type UUID type (16, 32, 128) +#define SVC_UUID(type) (((UUID_##type) << (SVC_UUID_TYPE_LSB)) & (SVC_UUID_TYPE_MASK)) + + +/// UUID Type +enum uuid_type +{ + /// 16-bit UUID value + UUID_16 = 0x00, + /// 32-bit UUID value + UUID_32 = 0x01, + /// 128-bit UUID value + UUID_128 = 0x02, + /// Invalid UUID Type + UUID_INVALID = 0x03, +}; + +/// security level +enum sec_level +{ + /// No Authentication, unencrypted link + SEC_NO_AUTH = 0x00, + /// Access Requires Unauthenticated link + SEC_UNAUTH = 0x01, + /// Access Requires Authenticated link + SEC_AUTH = 0x02, + /// Access Requires Secure Connection link + SEC_SECURE_CON = 0x03, +}; + +/** + * Attribute information Bit Field + * + * 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 + * +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ + * |EXT | WS |IND |NTF | WR | WC | RD | B | NP | IP | WP | RP | + * +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ + * <---------------- PROP ---------------> <---------------- PERM ---------------> + * + * Bit [0-7] : Attribute Permissions (@see enum sec_level) + * Bit [8-15] : Attribute Properties + */ +enum att_info_mask +{ + /// Permissions + ATT_PERM_ALL_MASK = 0x00FF, + ATT_PERM_ALL_LSB = 0, + /// Read Permission Mask + ATT_PERM_RP_MASK = 0x0003, + ATT_PERM_RP_LSB = 0, + /// Write Permission Mask + ATT_PERM_WP_MASK = 0x000C, + ATT_PERM_WP_LSB = 2, + /// Indication Access Mask + ATT_PERM_IP_MASK = 0x0030, + ATT_PERM_IP_LSB = 4, + /// Notification Access Mask + ATT_PERM_NP_MASK = 0x00C0, + ATT_PERM_NP_LSB = 6, + + /// Properties + ATT_PROP_ALL_MASK = 0xFF00, + ATT_PROP_ALL_LSB = 8, + /// Broadcast descriptor present + ATT_PROP_BC_BIT = 0x0100, + ATT_PROP_BC_POS = 8, + /// Read Access Mask + ATT_PROP_RD_BIT = 0x0200, + ATT_PROP_RD_POS = 9, + /// Write Command Enabled attribute Mask + ATT_PROP_WC_BIT = 0x0400, + ATT_PROP_WC_POS = 10, + /// Write Request Enabled attribute Mask + ATT_PROP_WR_BIT = 0x0800, + ATT_PROP_WR_POS = 11, + /// Notification Access Mask + ATT_PROP_NTF_BIT = 0x1000, + ATT_PROP_NTF_POS = 12, + /// Indication Access Mask + ATT_PROP_IND_BIT = 0x2000, + ATT_PROP_IND_POS = 13, + /// Write Signed Enabled attribute Mask + ATT_PROP_WS_BIT = 0x4000, + ATT_PROP_WS_POS = 14, + /// Extended properties descriptor present + ATT_PROP_EXT_BIT = 0x8000, + ATT_PROP_EXT_POS = 15, +}; + +/** + * Attribute extended information Bit Field + * + * 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 + * +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ + * | IN |UUID_TYPE|EKS | MAX_LEN | + * +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ + */ +enum att_ext_info_mask +{ + /// Maximum Attribute Value Length + ATT_MAX_LEN_MASK = 0x0FFF, + ATT_MAX_LEN_LSB = 0, + /// If set, Check Encryption key size + ATT_EKS_BIT = 0x1000, + ATT_EKS_POS = 12, + /// Type of attribute UUID (@see enum uuid_type) + ATT_UUID_TYPE_MASK = 0x6000, + ATT_UUID_TYPE_LSB = 13, + /// If set, Value present in Database + ATT_INDB_BIT = 0x8000, + ATT_INDB_POS = 15, +}; + +/** + * Service information Bit Field + * + * F E D C B A 9 8 7 6 5 4 3 2 1 0 + * +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ + * | RFU | STATE_EVT |SEC |UUID_TYPE|DIS | AUTH |EKS |HIDE| + * +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ + */ +enum svc_info_mask +{ + /// If set, Hide Service visibility + SVC_HIDE_BIT = 0x01, + SVC_HIDE_POS = 0, + /// If set, Encryption key Size must be 16 bytes + SVC_EKS_BIT = 0x02, + SVC_EKS_POS = 1, + /// Service Permission authentication (@see enum sec_lvl) + SVC_AUTH_MASK = 0x0C, + SVC_AUTH_LSB = 2, + /// If set, Disable the service + SVC_DIS_BIT = 0x10, + SVC_DIS_POS = 4, + /// Type of service UUID (@see enum uuid_type) + SVC_UUID_TYPE_MASK = 0x60, + SVC_UUID_TYPE_LSB = 5, + /// Service type (0 = Primary Service, 1 = Secondary Service) + SVC_SECONDARY_BIT = 0x80, + SVC_SECONDARY_POS = 7, + /// Service state event - add from v1.4 + SVC_EVT_INIT_BIT = 0x0100, + SVC_EVT_INIT_POS = 8, + SVC_EVT_CREATE_BIT = 0x0200, + SVC_EVT_CREATE_POS = 9, + SVC_EVT_CLEANUP_BIT = 0x0400, + SVC_EVT_CLEANUP_POS = 10, + SVC_EVT_DESTROY_BIT = 0x0800, + SVC_EVT_DESTROY_POS = 11, +}; + +enum att_prop_bfs +{ + PROP_BC = ATT_PROP_BC_BIT, + PROP_RD = ATT_PROP_RD_BIT, + PROP_WC = ATT_PROP_WC_BIT, + PROP_WR = ATT_PROP_WR_BIT, + PROP_NTF = ATT_PROP_NTF_BIT, + PROP_IND = ATT_PROP_IND_BIT, + PROP_WS = ATT_PROP_WS_BIT, + PROP_EXT = ATT_PROP_EXT_BIT, +}; + +enum att_val_pres +{ + VAL_IN = ATT_INDB_BIT, + VAL_RI = 0, //PERM(RI, ENABLE), +}; + +/// Attribute element information +#define ATT_ELMT(idx, uuid16, _perm, _info) [idx - 1] = { .uuid=uuid16, .perm=_perm, .info=_info } +#define ATT_ELMT128(idx, p_uuid, _perm, _info) [idx - 1] = { .uuid128=p_uuid, .perm=_perm, .info=(ATT_UUID(128) | (_info)) } + +#define ATT_ELMT_DECL_INCLUDE(idx) ATT_ELMT(idx, ATT_DECL_INCLUDE, PROP_RD, 0) +#define ATT_ELMT_DECL_CHAR(idx) ATT_ELMT(idx, ATT_DECL_CHARACTERISTIC, PROP_RD, 0) +#define ATT_ELMT_DECL_CHAR_EXT(idx) ATT_ELMT(idx, ATT_DECL_CHARACTERISTIC, PROP_RD | PROP_EXT, 0) +#define ATT_ELMT_DESC_CHAR_EXT_PROPS(idx) ATT_ELMT(idx, ATT_DESC_CHAR_EXT_PROPERTIES, PROP_RD, sizeof(uint16_t)) +#define ATT_ELMT_DESC_CLI_CHAR_CFG(idx) ATT_ELMT(idx, ATT_DESC_CLIENT_CHAR_CFG, PROP_RD | PROP_WR, sizeof(uint16_t)) +#define ATT_ELMT_DESC_SRV_CHAR_CFG(idx) ATT_ELMT(idx, ATT_DESC_SERVER_CHAR_CFG, PROP_RD | PROP_WR, sizeof(uint16_t)) +#define ATT_ELMT_DESC_REPORT_REF(idx) ATT_ELMT(idx, ATT_DESC_REPORT_REF, PROP_RD, sizeof(uint16_t)) + +/// Attribute element max length @see enum att_ext_info_mask +#define ATT_MAX_LEN_GET(idx, _atts) ((_atts[idx-1].info & ATT_MAX_LEN_MASK) >> ATT_MAX_LEN_LSB) + +typedef struct att_decl +{ + /// Attribute UUID (LSB First) + union { + uint16_t uuid; + uint32_t uuid32; + const uint8_t *uuid128; + }; + /// Attribute information (@see enum att_info_mask) + uint16_t perm;//info; + /// Attribute extended information (@see enum att_ext_info_mask) + uint16_t info;//ext_info; +} att_decl_t; + +typedef struct svc_decl +{ + /// Service UUID (LSB First) + union { + uint16_t uuid; + uint32_t uuid32; + const uint8_t *uuid128; + }; + /// Service attributes + const att_decl_t *atts; + /// Number of attributes - extend to 16bits from v1.4 + uint16_t nb_att; + /// Service information (@see enum svc_info_mask)- extend to 16bits + uint16_t info; +} svc_decl_t; + +struct attm_write_req_ind +{ + /// Data length to be written + uint16_t length; + /// offset at which the data has to be written + uint16_t offset; + /// Data to be written in attribute database + uint8_t *value; +}; + +enum atts_opcode +{ + ATTS_READ_REQ, + ATTS_WRITE_REQ, + ATTS_INFO_REQ, + ATTS_CMP_EVT, +}; + +struct atts_write_ind +{ + /// Write code(WC, WR, WS, prepWR) + uint8_t wrcode; + /// More packet (only true in prepWR) + uint8_t more; + /// Data length to be written + uint16_t length; + /// Data to be written in attribute database + uint8_t *value; +}; + +struct atts_prep_write_ind +{ + struct atts_write_ind data; + /// offset at which the data has to be written + uint16_t offset; + /// Total data length to be written + uint16_t total_len; +}; + +struct atts_cmp_evt +{ + /// atts event type(GATT_NOTIFY - 0x12, GATT_INDICATE - 0x13) + uint8_t operation; + /// Status of the request + uint8_t status; + /// operation sequence number - provided when operation is started + uint16_t seq_num; +}; + +typedef void (*svc_func_t)(uint8_t conidx, uint8_t op_code, uint16_t handle, const void *param); + +uint8_t attmdb_svc_create(uint16_t *shdl, uint8_t *cfg_flag, const struct svc_decl *svc_desc, svc_func_t svc_func); + +#endif // ATT_H_ diff --git a/ble/api/attm_api.h b/ble/api/attm_api.h new file mode 100644 index 0000000..11a26e4 --- /dev/null +++ b/ble/api/attm_api.h @@ -0,0 +1,592 @@ +/** + **************************************************************************************** + * + * @file attm_api.h + * + * @brief Attribute Manager API functions. + * + **************************************************************************************** + */ + +#ifndef ATTM_API_H_ +#define ATTM_API_H_ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include +#include +#include "att.h" +#include "task.h" + + +/* + * MACRO DEFINES + **************************************************************************************** + */ + +/// update attribute permission on specific handle +#define ATTM_UPDATE_PERM(handle, access, right) \ + attm_att_update_perm(handle, (PERM_MASK_ ## access), PERM(access, right)) + +#define ATTM_UPDATE_PERM_VAL(handle, access, val) \ + attm_att_update_perm(handle, (PERM_MASK_ ## access), ((val) << (PERM_POS_ ## access))) + +// --------------------------- Database permissions ----------------------------- + +/// Macro used to retrieve access permission rights +#define PERM_GET(perm, access)\ + (((perm) & (PERM_MASK_ ## access)) >> (PERM_POS_ ## access)) + +/// Macro used to set a permission value +#define PERM_SET(perm, access, value)\ + perm = ((perm & ~(PERM_MASK_ ## access)) | ((value << (PERM_POS_ ## access)) & (PERM_MASK_ ## access))) + +/// Macro used to retrieve permission value from access and rights on attribute. +#define PERM(access, right) \ + (((PERM_RIGHT_ ## right) << (PERM_POS_ ## access)) & (PERM_MASK_ ## access)) + +/// Macro used know if permission is set or not. +#define PERM_IS_SET(perm, access, right) \ + (((perm) & (((PERM_RIGHT_ ## right) << (PERM_POS_ ## access))) \ + & (PERM_MASK_ ## access)) == PERM(access, right)) + +/// Macro used to create permission value +#define PERM_VAL(access, perm) \ + ((((perm) << (PERM_POS_ ## access))) & (PERM_MASK_ ## access)) + + +/// Retrieve attribute security level from attribute right and service right +#define ATT_GET_SEC_LVL(att_right, svc_right) \ + co_max(((att_right) & PERM_RIGHT_AUTH), ((svc_right) & PERM_RIGHT_AUTH)); + +/// Retrieve UUID LEN from UUID Length Permission +#define ATT_UUID_LEN(uuid_len_perm) ((uuid_len_perm == 0) ? ATT_UUID16_LEN : \ + ((uuid_len_perm == 1) ? ATT_UUID32_LEN : \ + ((uuid_len_perm == 2) ? ATT_UUID128_LEN : 0))) + +/// Initialization of attribute element +#define ATT_ELEMT_INIT {{NULL}, false} + +/** + * 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 + * +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ + * |EXT | WS | I | N | WR | WC | RD | B | NP | IP | WP | RP | + * +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ + * + * Bit [0-1] : Read Permission (0 = NO_AUTH, 1 = UNAUTH, 2 = AUTH, 3 = SEC_CON) + * Bit [2-3] : Write Permission (0 = NO_AUTH, 1 = UNAUTH, 2 = AUTH, 3 = SEC_CON) + * Bit [4-5] : Indication Permission (0 = NO_AUTH, 1 = UNAUTH, 2 = AUTH, 3 = SEC_CON) + * Bit [6-7] : Notification Permission (0 = NO_AUTH, 1 = UNAUTH, 2 = AUTH, 3 = SEC_CON) + * + * Bit [8] : Extended properties present (only relevant for a characteristic value) + * Bit [9] : Broadcast permission (only relevant for a characteristic value) + * Bit [10] : Write Command accepted + * Bit [11] : Write Signed accepted + * Bit [12] : Write Request accepted + * Bit [13] : Encryption key Size must be 16 bytes + */ +enum attm_perm_mask +{ + /// retrieve all permission info + PERM_MASK_ALL = 0x0000, + /// Read Permission Mask + PERM_MASK_RP = 0x0003, + PERM_POS_RP = 0, + /// Write Permission Mask + PERM_MASK_WP = 0x000C, + PERM_POS_WP = 2, + /// Indication Access Mask + PERM_MASK_IP = 0x0030, + PERM_POS_IP = 4, + /// Notification Access Mask + PERM_MASK_NP = 0x00C0, + PERM_POS_NP = 6, + /// Broadcast descriptor present + PERM_MASK_BROADCAST = 0x0100, + PERM_POS_BROADCAST = 8, + /// Read Access Mask + PERM_MASK_RD = 0x0200, + PERM_POS_RD = 9, + /// Write Command Enabled attribute Mask + PERM_MASK_WRITE_COMMAND = 0x0400, + PERM_POS_WRITE_COMMAND = 10, + /// Write Request Enabled attribute Mask + PERM_MASK_WRITE_REQ = 0x0800, + PERM_POS_WRITE_REQ = 11, + /// Notification Access Mask + PERM_MASK_NTF = 0x1000, + PERM_POS_NTF = 12, + /// Indication Access Mask + PERM_MASK_IND = 0x2000, + PERM_POS_IND = 13, + /// Write Signed Enabled attribute Mask + PERM_MASK_WRITE_SIGNED = 0x4000, + PERM_POS_WRITE_SIGNED = 14, + /// Extended properties descriptor present + PERM_MASK_EXT = 0x8000, + PERM_POS_EXT = 15, + + /// Properties + PERM_MASK_PROP = 0xFF00, + PERM_POS_PROP = 8, +}; + +/** + * Value permission bit field + * + * 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 + * +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ + * | RI |UUID_LEN |EKS | MAX_LEN (RI = 1) / Value Offset (RI = 0) | + * +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ + * + * Bit [0-11] : Maximum Attribute Length or Value Offset pointer + * Bit [12] : Encryption key Size must be 16 bytes + * Bit [14-13]: UUID Length (0 = 16 bits, 1 = 32 bits, 2 = 128 bits, 3 = RFU) + * Bit [15] : Trigger Read Indication (0 = Value present in Database, 1 = Value not present in Database) + */ +enum attm_value_perm_mask +{ + /// Maximum Attribute Length + PERM_MASK_MAX_LEN = 0x0FFF, + PERM_POS_MAX_LEN = 0, + /// Attribute value Offset + PERM_MASK_VAL_OFFSET = 0x0FFF, + PERM_POS_VAL_OFFSET = 0, + /// Check Encryption key size Mask + PERM_MASK_EKS = 0x1000, + PERM_POS_EKS = 12, + /// UUID Length + PERM_MASK_UUID_LEN = 0x6000, + PERM_POS_UUID_LEN = 13, + /// Read trigger Indication + PERM_MASK_RI = 0x8000, + PERM_POS_RI = 15, +}; + + +/** + * Service permissions + * + * 7 6 5 4 3 2 1 0 + * +----+----+----+----+----+----+----+----+ + * |SEC |UUID_LEN |DIS | AUTH |EKS | MI | + * +----+----+----+----+----+----+----+----+ + * + * Bit [0] : Task that manage service is multi-instantiated (Connection index is conveyed) + * Bit [1] : Encryption key Size must be 16 bytes + * Bit [2-3]: Service Permission (0 = NO_AUTH, 1 = UNAUTH, 2 = AUTH, 3 = Secure Connect) + * Bit [4] : Disable the service + * Bit [5-6]: UUID Length (0 = 16 bits, 1 = 32 bits, 2 = 128 bits, 3 = RFU) + * Bit [7] : Secondary Service (0 = Primary Service, 1 = Secondary Service) + */ +enum attm_svc_perm_mask +{ + /// Task that manage service is multi-instantiated + PERM_MASK_SVC_MI = 0x01, + PERM_POS_SVC_MI = 0, + /// Check Encryption key size for service Access + PERM_MASK_SVC_EKS = 0x02, + PERM_POS_SVC_EKS = 1, + /// Service Permission authentication + PERM_MASK_SVC_AUTH = 0x0C, + PERM_POS_SVC_AUTH = 2, + /// Disable the service + PERM_MASK_SVC_DIS = 0x10, + PERM_POS_SVC_DIS = 4, + /// Service UUID Length + PERM_MASK_SVC_UUID_LEN = 0x60, + PERM_POS_SVC_UUID_LEN = 5, + /// Service type Secondary + PERM_MASK_SVC_SECONDARY = 0x80, + PERM_POS_SVC_SECONDARY = 7, +}; + +/// Attribute & Service access mode +enum +{ + /// Disable access + PERM_RIGHT_DISABLE = 0, + /// Enable access + PERM_RIGHT_ENABLE = 1, +}; + +/// Attribute & Service access rights +enum +{ + /// No Authentication + PERM_RIGHT_NO_AUTH = 0, + /// Access Requires Unauthenticated link + PERM_RIGHT_UNAUTH = 1, + /// Access Requires Authenticated link + PERM_RIGHT_AUTH = 2, + /// Access Requires Secure Connection link + PERM_RIGHT_SEC_CON = 3, +}; + +/// Attribute & Service UUID Length +enum +{ + /// 16 bits UUID + PERM_UUID_16 = 0, + PERM_RIGHT_UUID_16 = 0, + /// 32 bits UUID + PERM_UUID_32 = 1, + PERM_RIGHT_UUID_32 = 1, + /// 128 bits UUID + PERM_UUID_128 = 2, + PERM_RIGHT_UUID_128 = 2, + /// Invalid + PERM_UUID_RFU = 3, +}; + +/// execute flags +enum +{ + /// Cancel All the Reliable Writes + ATT_CANCEL_ALL_PREPARED_WRITES = 0x00, + /// Write All the Reliable Writes + ATT_EXECUTE_ALL_PREPARED_WRITES +}; + +/* + * DATA STRUCTURES + **************************************************************************************** + */ + +/// 16bits UUID service description +struct attm_desc +{ + /// 16 bits UUID LSB First + uint16_t uuid; + /// Attribute Permissions (@see enum attm_perm_mask) + uint16_t perm; + /// Attribute Extended Permissions (@see enum attm_value_perm_mask) + uint16_t ext_perm; + /// Attribute Max Size + /// note: for characteristic declaration contains handle offset + /// note: for included service, contains target service handle + uint16_t max_size; +}; + + +/// 128bits UUID service description +struct attm_desc_128 +{ + /// 128 bits UUID LSB First + uint8_t uuid[ATT_UUID128_LEN]; + /// Attribute Permissions (@see enum attm_perm_mask) + uint16_t perm; + /// Attribute Extended Permissions (@see enum attm_value_perm_mask) + uint16_t ext_perm; + /// Attribute Max Size + /// note: for characteristic declaration contains handle offset + /// note: for included service, contains target service handle + uint16_t max_size; +}; + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Function use to ease service database creation. + * Use @see attmdb_add_service function of attmdb module to create service database, + * then use @see attmdb_add_attribute function of attmdb module to create attributes + * according to database description array given in parameter. + * + * @note: database description array shall be const to reduce memory consumption (only ROM) + * @note: It supports only 16 bits UUIDs + * + * @note: If shdl = 0, it return handle using first available handle (shdl is + * modified); else it verifies if start handle given can be used to allocates handle range. + * + * @param[in|out] shdl Service start handle. + * @param[in] uuid Service UUID + * @param[in|out] cfg_flag Configuration Flag, each bit matches with an attribute of + * att_db (Max: 32 attributes); if the bit is set to 1, the + * attribute will be added in the service. + * @param[in] max_nb_att Number of attributes in the service + * @param[in|out] att_tbl Array which will be fulfilled with the difference between + * each characteristic handle and the service start handle. + * This array is useful if several characteristics are optional + * within the service, can be set to NULL if not needed. + * @param[in] dest_id Task ID linked to the service. This task will be notified + * each time the service content is modified by a peer device. + * @param[in|out] att_db Table containing all attributes information + * @param[in] svc_perm Service permission (@see enum attm_svc_perm_mask) + * + * @return Command status code: + * - @ref LE_SUCCESS: If database creation succeeds. + * - @ref ATT_ERR_INVALID_HANDLE: If start_hdl given in parameter + nb of attribute override + * some existing services handles. + * - @ref ATT_ERR_INSUFF_RESOURCE: There is not enough memory to allocate service buffer. + * or of new attribute cannot be added because all expected + * attributes already added or buffer overflow detected during + * allocation + **************************************************************************************** + */ +uint8_t attm_svc_create_db(uint16_t *shdl, uint16_t uuid, uint8_t *cfg_flag, uint8_t max_nb_att, + uint8_t *att_tbl, task_id_t dest_id, + const struct attm_desc *att_db, uint8_t svc_perm); + +/** + **************************************************************************************** + * @brief Function use to ease service database creation. + * Use @see attmdb_add_service function of attmdb module to create service database, + * then use @see attmdb_add_attribute function of attmdb module to create attributes + * according to database description array given in parameter. + * + * @note: database description array shall be const to reduce memory consumption (only ROM) + * @note: It supports 128, 32 and 16 bits UUIDs + * + * @note: If shdl = 0, it return handle using first available handle (shdl is + * modified); else it verifies if start handle given can be used to allocates handle range. + * + * @param[in|out] shdl Service start handle. + * @param[in] uuid Service UUID + * @param[in|out] cfg_flag Configuration Flag, each bit matches with an attribute of + * att_db (Max: 32 attributes); if the bit is set to 1, the + * attribute will be added in the service. + * @param[in] max_nb_att Number of attributes in the service + * @param[in|out] att_tbl Array which will be fulfilled with the difference between + * each characteristic handle and the service start handle. + * This array is useful if several characteristics are optional + * within the service, can be set to NULL if not needed. + * @param[in] dest_id Task ID linked to the service. This task will be notified + * each time the service content is modified by a peer device. + * @param[in|out] att_db Table containing all attributes information + * @param[in] svc_perm Service permission (@see enum attm_svc_perm_mask) + * + * @return Command status code: + * - @ref LE_SUCCESS: If database creation succeeds. + * - @ref ATT_ERR_INVALID_HANDLE: If start_hdl given in parameter + nb of attribute override + * some existing services handles. + * - @ref ATT_ERR_INSUFF_RESOURCE: There is not enough memory to allocate service buffer. + * or of new attribute cannot be added because all expected + * attributes already added or buffer overflow detected during + * allocation + **************************************************************************************** + */ +uint8_t attm_svc_create_db_128(uint16_t *shdl, const uint8_t* uuid, uint8_t *cfg_flag, uint8_t max_nb_att, + uint8_t *att_tbl, task_id_t dest_id, + const struct attm_desc_128 *att_db, uint8_t svc_perm); + + +/** + **************************************************************************************** + * @brief Function use to verify if several services can be allocated on a contiguous + * handle range. If this command succeed, it means that service allocation will succeed. + * + * If start_hdl = 0, it return handle using first available handle (start_hdl is + * modified); else it verifies if start handle given can be used to allocates handle range. + * + * @param[in|out] start_hdl Service start handle. + * @param[in] nb_att Number of handle to allocate (containing service handles) + * + * @return Command status code: + * - @ref LE_SUCCESS: If service allocation succeeds. + * - @ref ATT_ERR_INVALID_HANDLE: If start_hdl given in parameter or UUIDs value invalid + **************************************************************************************** + */ +uint8_t attm_reserve_handle_range(uint16_t* start_hdl, uint8_t nb_att); + +/** + **************************************************************************************** + * @brief Update attribute value + * + * Updating attribute value do not trigger any notification or indication, this shall be + * handled by GATT task. + * + * @param[in] handle Attribute handle. + * @param[in] length Size of new attribute value + * @param[in] offset Data offset of in the payload to set + * @param[in] value Attribute value payload + * + * @return Command status code: + * - @ref LE_SUCCESS: If attribute value update succeeds + * - @ref ATT_ERR_INVALID_HANDLE: If handle doesn't exist in database + * - @ref ATT_ERR_REQUEST_NOT_SUPPORTED: If attribute data not present in database or + * cannot be modified + * - @ref ATT_ERR_INVALID_ATTRIBUTE_VAL_LEN: If new value length exceeds maximum attribute + * value length. + * + **************************************************************************************** + */ +uint8_t attm_att_set_value(uint16_t handle, att_size_t length, att_size_t offset, uint8_t* value); + +/** + **************************************************************************************** + * @brief Retrieve attribute value + + * + * @param[in] handle Attribute handle. + * @param[out] length Size of attribute value + * @param[out] value Pointer to attribute value payload + * + * @return Command status code: + * - @ref LE_SUCCESS: If request succeeds + * - @ref ATT_ERR_INVALID_HANDLE: If handle doesn't exist in database + * - @ref ATT_ERR_REQUEST_NOT_SUPPORTED: If attribute data not present in database + **************************************************************************************** + */ +uint8_t attm_get_value(uint16_t handle, att_size_t* length, uint8_t** value); + +/** + **************************************************************************************** + * @brief Update attribute permission + * + * @param[in] handle Attribute handle. + * - @ref ATT_ERR_REQUEST_NOT_SUPPORTED: If attribute data not present in database + * @param[in] perm New attribute permission + * @param[in] ext_perm New attribute extended permission + * + * @return Command status code: + * - @ref LE_SUCCESS: If request succeeds + * - @ref ATT_ERR_INVALID_HANDLE: If handle doesn't exist in database + * - @ref ATT_ERR_REQUEST_NOT_SUPPORTED: If attribute permission is fixed + **************************************************************************************** + */ +uint8_t attm_att_set_perm(uint16_t handle, uint16_t perm, uint16_t ext_perm); + +/** + **************************************************************************************** + * @brief Reset some permissions bit in the Handle passed as parameter. + * + * @param[in] handle Attribute handle. + * @param[in] access_mask Access mask of permission to update + * @param[in] perm New value of the permission to update + * + * + * @return Command status code: + * - @ref LE_SUCCESS: If request succeeds + * - @ref ATT_ERR_INVALID_HANDLE: If handle doesn't exist in database + * - @ref ATT_ERR_REQUEST_NOT_SUPPORTED: If attribute permission is fixed + **************************************************************************************** + */ +uint8_t attm_att_update_perm(uint16_t handle, uint16_t access_mask, uint16_t perm); + +/** + **************************************************************************************** + * @brief Update attribute service permission + * + * @param[in] handle Attribute handle. + * @param[in] perm New attribute permission + * + * @return Command status code: + * - @ref LE_SUCCESS: If request succeeds + * - @ref ATT_ERR_INVALID_HANDLE: If handle doesn't exist in database + **************************************************************************************** + */ +uint8_t attm_svc_set_perm(uint16_t handle, uint8_t perm); + +/** + **************************************************************************************** + * @brief Retrieve attribute service permission + * + * @param[in] handle Attribute handle. + * @param[out] perm Permission value to return + * + * @return Command status code: + * - @ref LE_SUCCESS: If request succeeds + * - @ref ATT_ERR_INVALID_HANDLE: If handle doesn't exist in database + **************************************************************************************** + */ +uint8_t attm_svc_get_perm(uint16_t handle, uint8_t* perm); + +/** + **************************************************************************************** + * @brief Control visibility of a service from peer device. service present in database + * but cannot be access by a peer device. + * + * @param[in] handle Service handle. + * @param[in] hide True to hide the service, False to restore visibility + * + * @return Command status code: + * - @ref LE_SUCCESS: If service allocation succeeds. + * - @ref ATT_ERR_INVALID_HANDLE: If start_hdl given in parameter or UUIDs value invalid + **************************************************************************************** + */ +uint8_t attmdb_svc_visibility_set(uint16_t handle, bool hide); + +/** + **************************************************************************************** + * @brief Clear database + * + * For debug purpose only, this function clear the database and unalloc all services + * within database. + * + * This function shall be used only for qualification and tests in order to manually + * change database without modifying software. + **************************************************************************************** + */ +void attmdb_destroy(void); + +/** + **************************************************************************************** + * @brief Compare if two UUIDs matches + * + * @param[in] uuid_a UUID A value + * @param[in] uuid_a_len UUID A length + * @param[in] uuid_b UUID B value + * @param[in] uuid_b_len UUID B length + * + * @return true if UUIDs matches, false otherwise + **************************************************************************************** + */ +bool attm_uuid_comp(uint8_t *uuid_a, uint8_t uuid_a_len, uint8_t *uuid_b, uint8_t uuid_b_len); + +/** + **************************************************************************************** + * @brief Check if two UUIDs matches (2nd UUID is a 16 bits UUID with LSB First) + * + * @param[in] uuid_a UUID A value + * @param[in] uuid_a_len UUID A length + * @param[in] uuid_b UUID B 16 bit value + * + * @return true if UUIDs matches, false otherwise + **************************************************************************************** + */ +bool attm_uuid16_comp(uint8_t *uuid_a, uint8_t uuid_a_len, uint16_t uuid_b); + +/** + **************************************************************************************** + * @brief Convert UUID value to 128 bit UUID + * + * @param[out] uuid128 converted 32-bit Bluetooth UUID to 128-bit UUID + * @param[in] uuid UUID to convert to 128-bit UUID + * @param[in] uuid_len UUID length + * + **************************************************************************************** + */ +void attm_convert_to128(uint8_t *uuid128, uint8_t *uuid, uint8_t uuid_len); + +/** + **************************************************************************************** + * @brief Check if it's a Bluetooth 16-bits UUID for 128-bit input + * + * @param[in] uuid 128-bit UUID + * + * @return true if uuid is a Bluetooth 16-bit UUID, false else. + **************************************************************************************** + */ +bool attm_is_bt16_uuid(uint8_t *uuid); + +/** + **************************************************************************************** + * @brief Check if it's a Bluetooth 32 bits UUID for 128-bit input + * + * @param[in] uuid 128-bit UUID + * + * @return true if uuid is a Bluetooth 32-bits UUID, false else. + **************************************************************************************** + */ +bool attm_is_bt32_uuid(uint8_t *uuid); + + +#endif // ATTM_API_H_ diff --git a/ble/api/bledef.h b/ble/api/bledef.h new file mode 100644 index 0000000..8137c8a --- /dev/null +++ b/ble/api/bledef.h @@ -0,0 +1,238 @@ +/** + **************************************************************************************** + * + * @file bledef.h + * + * @brief Interface functions of ble stack + * + **************************************************************************************** + */ + +#ifndef _BLEDEF_H_ +#define _BLEDEF_H_ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include +#include + +#include "blelib.h" +#include "ke_api.h" +#include "gapm_api.h" +#include "gapc_api.h" +#include "gatt_api.h" +#include "prf_api.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Status of ble +enum ble_status +{ + /// ble in active + BLE_IN_ACTIVE = 0, + /// ble in idle, sys can be put in sleep + BLE_IN_IDLE = 1, + /// ble in sleeping, core can deep sleep soon + BLE_IN_SLEEP = 2, + /// ble in deep sleep, discard status + BLE_IN_DEEPSL = BLE_IN_SLEEP, + /// ble in wakeup, correction ongoing. + BLE_IN_WAKEUP = 4, +}; + +/// Default LP Cycles of ble_sleep(), unit in 31.25us +#define BLE_SLP_TWOSC (64) // 2ms +#define BLE_SLP_DURMAX (0x7D00) // 1s + +/// Judge BLE Lib valid or not, if need +#define BLE_LIB_IS_RIGHT() (ble_exch_size() <= BLE_EXCH_SIZE) + + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Configure Heap of Ble Stack + * + **************************************************************************************** + */ +void ble_heap(heap_cfg_t *cfg); + +/** + **************************************************************************************** + * @brief Initializes Ble Stack. + * + **************************************************************************************** + */ +void ble_init(void); + +/** + **************************************************************************************** + * @brief Initializes RF & Modem. + * + **************************************************************************************** + */ +void rfmdm_init(void); + +/** + **************************************************************************************** + * @brief Set RF Tx PA Level. + * + * @param[in] pa_target PA Level(0x00 ~ 0x0F). Default(0x0F). + **************************************************************************************** + */ +void rf_pa_set(uint8_t pa_target); + +/** + **************************************************************************************** + * @brief Reset link layer and the host + * + * @return Message GAPM_CMP_EVT(operation GAPM_RESET) + **************************************************************************************** + */ +void ble_reset(void); + +/** + **************************************************************************************** + * @brief Init Task of Application, interval call gapm_reset() to start. + * + **************************************************************************************** + */ +void ble_app(void); + +/** + **************************************************************************************** + * @brief Schedule all pending events. + * + **************************************************************************************** + */ +void ble_schedule(void); + +#if (BLE_LITELIB) +/** + **************************************************************************************** + * @brief Resume BLE quickly to continue run. + * + **************************************************************************************** + */ +void ble_resume(void); +#endif //(BLE_LITELIB) + +/** + **************************************************************************************** + * @brief Wakeup BLE from sleep state. + * + * @return LP Cycles of sleeped time when wakeup enabled, 0 means not in sleep state. + **************************************************************************************** + */ +uint32_t ble_wakeup(void); + +/** + **************************************************************************************** + * @brief BLE try to enter sleep mode. + * + * @param[in] twosc LP Cycles of oscillator stabilization when exit sleep state. + * @param[in] dur_max LP Cycles of max deepsltime, 0 means result of ble_slpdur_get() used. + * + * @return ble status (@see enum ble_status) + **************************************************************************************** + */ +uint8_t ble_sleep(uint16_t twosc, uint32_t dur_max); + +/** + **************************************************************************************** + * @brief Get BLE current time. + * + * @return half-slot time(unit in 312.5us) + **************************************************************************************** + */ +uint32_t ble_time_get(void); + +/** + **************************************************************************************** + * @brief Get max sleep time when BLE is idle state. + * + * @return LP Cycles of sleep time(unit in 31.25us), 0 means prevent sleep + **************************************************************************************** + */ +uint32_t ble_slpdur_get(void); + +/** + **************************************************************************************** + * @brief Get ble6*.lib version. + * + * @return Version Info Struct: + * Byte0 Maximum Actvs - (ACT_MAX<<4) | CON_MAX, eg. 0x43=4ACT3CON + * Byte1 Support Feats - b[4]: Mesh, b[3:0]: Peri|Central|Broadcast|Observer + * Byte2 Build Version - eg. 0 + * Byte3 Major Version - eg. 0x13=v1.3 + **************************************************************************************** + */ +uint32_t ble_lib_vers(void); + +/** + **************************************************************************************** + * @brief Get memory size of Exchange with BLE HW. + * + * @return size in bytes, aligned 4 + **************************************************************************************** + */ +uint32_t ble_exch_size(void); + +/** + **************************************************************************************** + * @brief Config SLAVE_ROLE ACL More Data(MD) + * + * @param[in] en set 1 to allow receiving the ACK in the same event, 0 to disable(default). + * + **************************************************************************************** + */ +void ble_txmd_set(uint8_t en); + +/** + **************************************************************************************** + * @brief Config LPCLK(RC32K) Drift + * + * @param[in] ppm the drift of RC32K, defalut 500ppm. + * + **************************************************************************************** + */ +void ble_drift_set(uint16_t ppm); + +/** + **************************************************************************************** + * @brief Set Sync Word for BLE-2.4G Protocol. + * + * @param[in] syncw Sync Word + **************************************************************************************** + */ +void ble_2G4_set(uint16_t sync_l, uint16_t sync_h); + +/** + **************************************************************************************** + * @brief Set Slave applied latency or not. + * + * @param[in] applied True applied or False no applied. + **************************************************************************************** + */ +void ble_latency_applied(bool applied); + +/** + **************************************************************************************** + * @brief Set channel selection algorithm #2 is supported or not. + * + * @param[in] en set 1 to allow channel selection algorithm #2 is supported, 0 to disable(default). + **************************************************************************************** + */ +void ble_txchsel2_set(uint8_t en); +#endif // _BLEDEF_H_ diff --git a/ble/api/blelib.h b/ble/api/blelib.h new file mode 100644 index 0000000..c094fa3 --- /dev/null +++ b/ble/api/blelib.h @@ -0,0 +1,92 @@ +/** + **************************************************************************************** + * + * @file blelib.h + * + * @brief BLE Lib Definitions. + * + **************************************************************************************** + */ + +#ifndef _BLELIB_H_ +#define _BLELIB_H_ + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// struct *_env_tag *_env +#define __VAR_ENV __attribute__((section("le_env_mem_area"), zero_init)) + +/// define the BLE Task handler attribute for this compiler +#define __TASKFN __attribute__((section("le_task_hdl_func"))) + +/// Lite Mode(ble6_lite.lib) or Multi Mode(ble6.lib) +#if (BLE_LITELIB) + +/// Maximum number of simultaneous conntions - only 1 slave role, support ultra low power +#define BLE_CONNECTION_MAX (1) +/// Maximum number of simultaneous activities(only 1 Advertising and 1 Connection) +#define BLE_ACTIVITY_MAX (2) + +/// Memory usage for BLE HW Exchange - at Retention Memory Area +#define BLE_EXCH_BASE (0x20008000) +#define BLE_EXCH_SIZE (0x0BAC) +#define BLE_EXCH_END (BLE_EXCH_BASE + BLE_EXCH_SIZE) + +/// Lite Heap usage for BLE Stack(MEM_ENV + MEM_MSG) - at Retention Memory Area +#define BLE_HEAP_BASE (BLE_EXCH_END) +#define BLE_HEAP_ENV_SIZE (0x600) +#define BLE_HEAP_MSG_SIZE (0x600) +#define BLE_HEAP_SIZE (BLE_HEAP_ENV_SIZE + BLE_HEAP_MSG_SIZE) +#define BLE_HEAP_END (BLE_HEAP_BASE + BLE_HEAP_SIZE) + +/// Memory Area for *ble6*.lib (+RW +ZI) - at Retention Memory Area +#define BLE_RWZI_BASE (BLE_HEAP_END) +#define BLE_RWZI_END (0x2000A000) +#define BLE_RWZI_SIZE (BLE_RWZI_END - BLE_RWZI_BASE) + +#else //!(BLE_LITELIB) +#if (BLE_LARGELIB) +///Maximum number of simultaneous conntions +#define BLE_CONNECTION_MAX (6) +/// Maximum number of simultaneous activities(Advertising, Scanning, Initiating, Connection) +#define BLE_ACTIVITY_MAX (8) + +/// Memory usage for BLE HW Exchange - at Retention Memory Area +#define BLE_EXCH_BASE (0x20008000) +#define BLE_EXCH_SIZE (0x1590) + +#else //(BLE_DFLTLIB) +///Maximum number of simultaneous conntions +#define BLE_CONNECTION_MAX (3) +/// Maximum number of simultaneous activities(Advertising, Scanning, Initiating, Connection) +#define BLE_ACTIVITY_MAX (4) + +/// Memory usage for BLE HW Exchange - at Retention Memory Area +#define BLE_EXCH_BASE (0x20008000) +#define BLE_EXCH_SIZE (0x0FD8) +#endif //(BLE_DFLTLIB) +#define BLE_EXCH_END (BLE_EXCH_BASE + BLE_EXCH_SIZE) + +/// Multi Heap usage for BLE Stack(MEM_ENV + MEM_MSG) - exceed Retention Memory +#if !(BLE_HEAP_BASE) +#define BLE_HEAP_BASE (0x20004E00) +#endif //(BLE_HEAP_BASE) +#if !(BLE_HEAP_ENV_SIZE) +#define BLE_HEAP_ENV_SIZE (0xC00) +#endif //(BLE_HEAP_ENV_SIZE) +#if !(BLE_HEAP_MSG_SIZE) +#define BLE_HEAP_MSG_SIZE (0x2000) +#endif //(BLE_HEAP_ENV_SIZE) +#define BLE_HEAP_SIZE (BLE_HEAP_ENV_SIZE + BLE_HEAP_MSG_SIZE) + +/// Memory Area for *ble6*.lib (+RW +ZI) - at Retention Memory Area +#define BLE_RWZI_BASE (BLE_EXCH_END) +#define BLE_RWZI_END (0x2000A000) +#define BLE_RWZI_SIZE (BLE_RWZI_END - BLE_RWZI_BASE) + +#endif //(BLE_LITELIB) + +#endif /* _BLELIB_H_ */ diff --git a/ble/api/fcc.h b/ble/api/fcc.h new file mode 100644 index 0000000..d003515 --- /dev/null +++ b/ble/api/fcc.h @@ -0,0 +1,23 @@ +#ifndef B6X_FCC_H_ +#define B6X_FCC_H_ + +#include + +void fcc_init(void); + +void fcc_stop(void); + +/// freq_idx:0 ~ 39(2402 ~ 2480) +/// Tx +void fcc_tx_mod(uint8_t freq_idx); + +/// Rx +void fcc_rx_mod(uint8_t freq_idx); + +/// Txز(Ƶ) +void fcc_tx_carr(uint8_t freq_idx); + +/// Rxز(Ƶ) +void fcc_rx_carr(uint8_t freq_idx); + +#endif // B6X_FCC_H_ diff --git a/ble/api/gap.h b/ble/api/gap.h new file mode 100644 index 0000000..ad6af29 --- /dev/null +++ b/ble/api/gap.h @@ -0,0 +1,740 @@ +/** + **************************************************************************************** + * + * @file gap.h + * + * @brief Generic Access Profile Header file. + * + **************************************************************************************** + */ + +#ifndef GAP_H_ +#define GAP_H_ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Minimal authorized MTU value (defined by Bluetooth SIG) +#define GAP_MIN_LE_MTU (23) +/// Minimal authorized MTU value if secure connection is supported +#define GAP_MIN_LE_MTU_SEC_CON (65) +/// Maximum MTU (defined in BLE Lib) +#define GAP_MAX_LE_MTU (512) + +/// BD address length +#define GAP_BD_ADDR_LEN (6) +/// LE Channel map length +#define GAP_LE_CHNL_MAP_LEN (0x05) +/// LE Feature Flags Length +#define GAP_LE_FEATS_LEN (0x08) +/// ADV Data and Scan Response length +#define GAP_ADV_DATA_LEN (0x1F) +#define GAP_SCAN_RSP_DATA_LEN (0x1F) +/// Random number length +#define GAP_RAND_NB_LEN (0x08) +/// Key length +#define GAP_KEY_LEN (16) +/// P256 Key Len +#define GAP_P256_KEY_LEN (0x20) + + +///***** AD Type Flag - Bit set *******/ +/// Limited discovery flag - AD Flag +#define GAP_LE_LIM_DISCOVERABLE_FLG 0x01 +/// General discovery flag - AD Flag +#define GAP_LE_GEN_DISCOVERABLE_FLG 0x02 +/// Legacy BT not supported - AD Flag +#define GAP_BR_EDR_NOT_SUPPORTED 0x04 +/// Dual mode for controller supported (BR/EDR/LE) - AD Flag +#define GAP_SIMUL_BR_EDR_LE_CONTROLLER 0x08 +/// Dual mode for host supported (BR/EDR/LE) - AD Flag +#define GAP_SIMUL_BR_EDR_LE_HOST 0x10 + +/*********** GAP Miscellaneous Defines *************/ +/// Invalid connection index +#define GAP_INVALID_CONIDX 0xFF + +/// Invalid connection handle +#define GAP_INVALID_CONHDL 0xFFFF + +/// Connection interval min (N*1.250ms) +#define GAP_CONN_INTERVAL_MIN 6 //(7.5ms) +/// Connection interval Max (N*1.250ms) +#define GAP_CONN_INTERVAL_MAX 3200 //(4 sec) +/// Connection latency min (N*cnx evt) +#define GAP_CONN_LATENCY_MIN 0 //(0x00) +/// Connection latency Max (N*cnx evt +#define GAP_CONN_LATENCY_MAX 499 //(0x1F3) +/// Supervision TO min (N*10ms) +#define GAP_CONN_SUP_TO_MIN 10 //(100ms) +/// Supervision TO Max (N*10ms) +#define GAP_CONN_SUP_TO_MAX 3200 //(32 sec) + + +/// Length of resolvable random address prand part +#define GAP_ADDR_PRAND_LEN (3) +/// Length of resolvable random address hash part +#define GAP_ADDR_HASH_LEN (3) + + +/// HCI 7.8.33 LE Set Data Length Command +/// Preferred minimum number of payload octets +#define LE_MIN_OCTETS (27) +/// Preferred minimum number of microseconds +#define LE_MIN_TIME (328) +/// Preferred minimum number of microseconds LL:4.5.10 +#define LE_MIN_TIME_CODED (2704) +/// Preferred maximum number of payload octets +#define LE_MAX_OCTETS (251) +/// Preferred maximum number of microseconds +#define LE_MAX_TIME (2120) +/// Preferred maximum number of microseconds LL:4.5.10 +#define LE_MAX_TIME_CODED (17040) + +/* + * DEFINES - Optional for BLE application usage + **************************************************************************************** + */ + +/// Central idle timer +/// TGAP(conn_pause_central) +/// recommended value: 1 s: (100 for ke timer) +#define GAP_TMR_CONN_PAUSE_CT 0x0064 + +/// Minimum time upon connection establishment before the peripheral +/// starts a connection update procedure: TGAP(conn_pause_peripheral) +/// recommended value: 5 s: (500 for ke timer) +#define GAP_TMR_CONN_PAUSE_PH 0x01F4 + +/// Minimum time to perform scanning when user initiated +/// TGAP(scan_fast_period) +/// recommended value: 30.72 s: (3072 for ke timer) +#define GAP_TMR_SCAN_FAST_PERIOD 0x0C00 + +/// Minimum time to perform advertising when user initiated +/// TGAP(adv_fast_period) +/// recommended value: 30 s: (3000 for ke timer) +#define GAP_TMR_ADV_FAST_PERIOD 0x0BB8 + +/// Scan interval used during Link Layer Scanning State when +/// performing the Limited Discovery procedure +/// TGAP(lim_disc_scan_int) +/// recommended value: 11.25ms; (18 decimal) +#define GAP_LIM_DISC_SCAN_INT 0x0012 + +/// Scan interval in any discovery or connection establishment +/// procedure when user initiated: TGAP(scan_fast_interval) +/// recommended value: 30 to 60 ms; N * 0.625 +#define GAP_SCAN_FAST_INTV 0x0030 + +/// Scan window in any discovery or connection establishment +/// procedure when user initiated: TGAP(scan_fast_window) +/// recommended value: 30 ms; N * 0.625 +#define GAP_SCAN_FAST_WIND 0x0030 + +/// Scan interval in any discovery or connection establishment +/// procedure when background scanning: TGAP(scan_slow_interval1) +/// recommended value: 1.28 s : 0x00CD (205); N * 0.625 +#define GAP_SCAN_SLOW_INTV1 0x00CD + +/// Scan interval in any discovery or connection establishment +/// procedure when background scanning: TGAP(scan_slow_interval2) +/// recommended value: 2.56 s : 0x019A (410); N * 0.625 +#define GAP_SCAN_SLOW_INTV2 0x019A + +/// Scan window in any discovery or connection establishment +/// procedure when background scanning: TGAP(scan_slow_window1) +/// recommended value: 11.25 ms : 0x0012 (18); N * 0.625 +#define GAP_SCAN_SLOW_WIND1 0x0012 + +/// Scan window in any discovery or connection establishment +/// procedure when background scanning: TGAP(scan_slow_window2) +/// recommended value: 22.5 ms : 0x0024 (36); N * 0.625 +#define GAP_SCAN_SLOW_WIND2 0x0024 + +/// Minimum to maximum advertisement interval in any discoverable +/// or connectable mode when user initiated: TGAP(adv_fast_interval1) +/// recommended value: 30 to 60 ms; N * 0.625 +#define GAP_ADV_FAST_INTV1 0x0030 + +/// Minimum to maximum advertisement interval in any discoverable +/// or connectable mode when user initiated: TGAP(adv_fast_interval2) +/// recommended value: 100 to 150 ms; N * 0.625 +#define GAP_ADV_FAST_INTV2 0x0064 + +/// Minimum to maximum advertisement interval in any discoverable or +/// connectable mode when background advertising: TGAP(adv_slow_interval) +/// recommended value: 1 to 1.2 s : 0x00B0 (176); N * 0.625 +#define GAP_ADV_SLOW_INTV 0x00B0 + +/// Minimum to maximum connection interval upon any connection +/// establishment: TGAP(initial_conn_interval) +/// recommended value: 30 to 50 ms ; N * 1.25 ms +#define GAP_INIT_CONN_MIN_INTV 0x0018 +#define GAP_INIT_CONN_MAX_INTV 0x0028 + +/// Scan Defines +#define GAP_INQ_SCAN_INTV 0x0012 +#define GAP_INQ_SCAN_WIND 0x0012 + +/// Connection supervision timeout +/// recommended value: 20s +#define GAP_CONN_SUPERV_TIMEOUT 0x07D0 + +/// Minimum connection event +/// default value: 0x0000 +#define GAP_CONN_MIN_CE 0x0000 + +/// Maximum connection event +/// default value: 0xFFFF +#define GAP_CONN_MAX_CE 0xFFFF + +/// Connection latency +/// default value: 0x0000 +#define GAP_CONN_LATENCY 0x0000 + +/// Maximum time to remain advertising when in the Limited +/// Discover able mode: TGAP(lim_adv_timeout) +/// required value: 180s: (18000 for ke timer) +#define GAP_TMR_LIM_ADV_TIMEOUT 0x4650 + +/// Minimum time to perform scanning when performing +/// the General Discovery procedure: TGAP(gen_disc_scan_min) +/// recommended value: 10.24s: (1024 for ke timer) +#define GAP_TMR_GEN_DISC_SCAN 0x0400 + +/// Minimum time to perform scanning when performing the +/// Limited Discovery procedure: TGAP(lim_disc_scan_min) +/// recommended value: 10.24s: (1024 for ke timer) +#define GAP_TMR_LIM_DISC_SCAN 0x0400 + +/// Minimum time interval between private address change +/// TGAP(private_addr_int) +/// recommended value: 15 minutes +/// Minimum value 150s +#define GAP_TMR_PRIV_ADDR_MIN (150) +/// Maximum time interval between private address change +/// 0xA1B8 (approximately 11.5 hours) +#define GAP_TMR_PRIV_ADDR_MAX (0xA1B8) + + +/// Timer used in connection parameter update procedure +/// TGAP(conn_param_timeout) +/// recommended value: 30 s: (3000 for ke timer) +#define GAP_TMR_CONN_PARAM_TIMEOUT 0x0BB8 + +/// Timer used in LE credit based connection procedure +/// TGAP(lecb_conn_timeout) +/// recommended value: 30 s: (3000 for ke timer) +#define GAP_TMR_LECB_CONN_TIMEOUT 0x0BB8 + +/// Timer used in LE credit based disconnection procedure +/// TGAP(lecb_disconn_timeout) +/// recommended value: 30 s: (3000 for ke timer) +#define GAP_TMR_LECB_DISCONN_TIMEOUT 0x0BB8 + +/// GAP Appearance or Icon Characteristic - 2 octets +/// - @url https://specificationrefs.bluetooth.com/assigned-values/Appearance%20Values.pdf +#define GAP_APPEARANCE_UNKNOWN 0x0000 //!< Unknown +#define GAP_APPEARANCE_GENERIC_PHONE 0x0040 //!< Generic Phone +#define GAP_APPEARANCE_GENERIC_COMPUTER 0x0080 //!< Generic Computer +#define GAP_APPEARANCE_GENERIC_WATCH 0x00C0 //!< Generic Watch +#define GAP_APPEARANCE_WATCH_SPORTS 0x00C1 //!< Watch: Sports Watch +#define GAP_APPEARANCE_GENERIC_CLOCK 0x0100 //!< Generic Clock +#define GAP_APPEARANCE_GENERIC_DISPLAY 0x0140 //!< Generic Display +#define GAP_APPEARANCE_GENERIC_RC 0x0180 //!< Generic Remote Control +#define GAP_APPEARANCE_GENERIC_EYE_GALSSES 0x01C0 //!< Generic Eye-glasses +#define GAP_APPEARANCE_GENERIC_TAG 0x0200 //!< Generic Tag +#define GAP_APPEARANCE_GENERIC_KEYRING 0x0240 //!< Generic Keyring +#define GAP_APPEARANCE_GENERIC_MEDIA_PLAYER 0x0280 //!< Generic Media Player +#define GAP_APPEARANCE_GENERIC_BARCODE_SCANNER 0x02C0 //!< Generic Barcode Scanner +#define GAP_APPEARANCE_GENERIC_THERMOMETER 0x0300 //!< Generic Thermometer +#define GAP_APPEARANCE_GENERIC_THERMO_EAR 0x0301 //!< Thermometer: Ear +#define GAP_APPEARANCE_GENERIC_HR_SENSOR 0x0340 //!< Generic Heart rate Sensor +#define GAP_APPEARANCE_GENERIC_HRS_BELT 0x0341 //!< Heart Rate Sensor: Heart Rate Belt +#define GAP_APPEARANCE_GENERIC_BLOOD_PRESSURE 0x0380 //!< Generic Blood Pressure +#define GAP_APPEARANCE_GENERIC_BP_ARM 0x0381 //!< Blood Pressure: Arm +#define GAP_APPEARANCE_GENERIC_BP_WRIST 0x0382 //!< Blood Pressure: Wrist +#define GAP_APPEARANCE_GENERIC_HID 0x03C0 //!< Generic Human Interface Device (HID) +#define GAP_APPEARANCE_HID_KEYBOARD 0x03C1 //!< HID Keyboard +#define GAP_APPEARANCE_HID_MOUSE 0x03C2 //!< HID Mouse +#define GAP_APPEARANCE_HID_JOYSTIC 0x03C3 //!< HID Joystick +#define GAP_APPEARANCE_HID_GAMEPAD 0x03C4 //!< HID Gamepad +#define GAP_APPEARANCE_HID_DIGITIZER_TYABLET 0x03C5 //!< HID Digitizer Tablet +#define GAP_APPEARANCE_HID_DIGITAL_CARDREADER 0x03C6 //!< HID Card Reader +#define GAP_APPEARANCE_HID_DIGITAL_PEN 0x03C7 //!< HID Digital Pen +#define GAP_APPEARANCE_HID_BARCODE_SCANNER 0x03C8 //!< HID Barcode Scanner + +/// GAP Peripheral Preferred Connection Parameter - 8 octets +#define GAP_PPCP_CONN_INTV_MAX 0x0064 +#define GAP_PPCP_CONN_INTV_MIN 0x00C8 +#define GAP_PPCP_SLAVE_LATENCY 0x0000 +#define GAP_PPCP_STO_MULT 0x07D0 + + +/* + * Enumerations + **************************************************************************************** + */ + +/// GAP Advertising Flags +enum gap_ad_type +{ + /// Flag + GAP_AD_TYPE_FLAGS = 0x01, + /// Use of more than 16 bits UUID + GAP_AD_TYPE_MORE_16_BIT_UUID = 0x02, + /// Complete list of 16 bit UUID + GAP_AD_TYPE_COMPLETE_LIST_16_BIT_UUID = 0x03, + /// Use of more than 32 bit UUD + GAP_AD_TYPE_MORE_32_BIT_UUID = 0x04, + /// Complete list of 32 bit UUID + GAP_AD_TYPE_COMPLETE_LIST_32_BIT_UUID = 0x05, + /// Use of more than 128 bit UUID + GAP_AD_TYPE_MORE_128_BIT_UUID = 0x06, + /// Complete list of 128 bit UUID + GAP_AD_TYPE_COMPLETE_LIST_128_BIT_UUID = 0x07, + /// Shortened device name + GAP_AD_TYPE_SHORTENED_NAME = 0x08, + /// Complete device name + GAP_AD_TYPE_COMPLETE_NAME = 0x09, + /// Transmit power + GAP_AD_TYPE_TRANSMIT_POWER = 0x0A, + /// Class of device + GAP_AD_TYPE_CLASS_OF_DEVICE = 0x0D, + /// Simple Pairing Hash C + GAP_AD_TYPE_SP_HASH_C = 0x0E, + /// Simple Pairing Randomizer + GAP_AD_TYPE_SP_RANDOMIZER_R = 0x0F, + /// Temporary key value + GAP_AD_TYPE_TK_VALUE = 0x10, + /// Out of Band Flag + GAP_AD_TYPE_OOB_FLAGS = 0x11, + /// Slave connection interval range + GAP_AD_TYPE_SLAVE_CONN_INT_RANGE = 0x12, + /// Require 16 bit service UUID + GAP_AD_TYPE_RQRD_16_BIT_SVC_UUID = 0x14, + /// Require 32 bit service UUID + GAP_AD_TYPE_RQRD_32_BIT_SVC_UUID = 0x1F, + /// Require 128 bit service UUID + GAP_AD_TYPE_RQRD_128_BIT_SVC_UUID = 0x15, + /// Service data 16-bit UUID + GAP_AD_TYPE_SERVICE_16_BIT_DATA = 0x16, + /// Service data 32-bit UUID + GAP_AD_TYPE_SERVICE_32_BIT_DATA = 0x20, + /// Service data 128-bit UUID + GAP_AD_TYPE_SERVICE_128_BIT_DATA = 0x21, + /// Public Target Address + GAP_AD_TYPE_PUB_TGT_ADDR = 0x17, + /// Random Target Address + GAP_AD_TYPE_RAND_TGT_ADDR = 0x18, + /// Appearance + GAP_AD_TYPE_APPEARANCE = 0x19, + /// Advertising Interval + GAP_AD_TYPE_ADV_INTV = 0x1A, + /// LE Bluetooth Device Address + GAP_AD_TYPE_LE_BT_ADDR = 0x1B, + /// LE Role + GAP_AD_TYPE_LE_ROLE = 0x1C, + /// Simple Pairing Hash C-256 + GAP_AD_TYPE_SPAIR_HASH = 0x1D, + /// Simple Pairing Randomizer R-256 + GAP_AD_TYPE_SPAIR_RAND = 0x1E, + /// 3D Information Data + GAP_AD_TYPE_3D_INFO = 0x3D, + + /// Manufacturer specific data + GAP_AD_TYPE_MANU_SPECIFIC_DATA = 0xFF, +}; + +/// Constant defining the role +enum conn_role +{ + /// Master role + ROLE_MASTER, + /// Slave role + ROLE_SLAVE, +}; + +/// BD address type +enum addr_type +{ + /// Public BD address + ADDR_PUBLIC = 0x00, + /// Random BD Address + ADDR_RAND, + /// Controller generates Resolvable Private Address based on the + /// local IRK from resolving list. If resolving list contains no matching + /// entry, use public address. + ADDR_RPA_OR_PUBLIC, + /// Controller generates Resolvable Private Address based on the + /// local IRK from resolving list. If resolving list contains no matching + /// entry, use random address. + ADDR_RPA_OR_RAND, + /// mask used to determine Address type in the air + ADDR_MASK = 0x01, + /// mask used to determine if an address is an RPA + ADDR_RPA_MASK = 0x02, + /// Random device address (controller unable to resolve) + ADDR_RAND_UNRESOLVED = 0xFE, + /// No address provided (anonymous advertisement) + ADDR_NONE = 0xFF, +}; + +/// Random Address type +enum gap_rnd_addr_type +{ + /// Static random address - 11 (MSB->LSB) + GAP_STATIC_ADDR = 0xC0, + /// Private non resolvable address - 01 (MSB->LSB) + GAP_NON_RSLV_ADDR = 0x00, + /// Private resolvable address - 01 (MSB->LSB) + GAP_RSLV_ADDR = 0x40, +}; + +/// Boolean value set +enum +{ + /// Disable + GAP_DISABLE = 0x00, + /// Enable + GAP_ENABLE +}; + + +/// GAP Attribute database handles +/// Generic Access Profile Service +enum +{ + GAP_IDX_PRIM_SVC, + GAP_IDX_CHAR_DEVNAME, + GAP_IDX_DEVNAME, + GAP_IDX_CHAR_ICON, + GAP_IDX_ICON, + GAP_IDX_CHAR_SLAVE_PREF_PARAM, + GAP_IDX_SLAVE_PREF_PARAM, + GAP_IDX_CHAR_CNT_ADDR_RESOL, + GAP_IDX_CNT_ADDR_RESOL, + GAP_IDX_CHAR_RSLV_PRIV_ADDR_ONLY, + GAP_IDX_RSLV_PRIV_ADDR_ONLY, + GAP_IDX_NUMBER +}; + + +/****************** GAP Role **********************/ +enum gap_role +{ + /// No role set yet + GAP_ROLE_NONE = 0x00, + + /// Observer role + GAP_ROLE_OBSERVER = 0x01, + + /// Broadcaster role + GAP_ROLE_BROADCASTER = 0x02, + + /// Master/Central role + GAP_ROLE_CENTRAL = (0x04 | GAP_ROLE_OBSERVER), + + /// Peripheral/Slave role + GAP_ROLE_PERIPHERAL = (0x08 | GAP_ROLE_BROADCASTER), + + /// Device has all role, both peripheral and central + GAP_ROLE_ALL = (GAP_ROLE_CENTRAL | GAP_ROLE_PERIPHERAL), +}; + +/// IO Capability Values +enum gap_io_cap +{ + /// Display Only + GAP_IO_CAP_DISPLAY_ONLY = 0x00, + /// Display Yes No + GAP_IO_CAP_DISPLAY_YES_NO, + /// Keyboard Only + GAP_IO_CAP_KB_ONLY, + /// No Input No Output + GAP_IO_CAP_NO_INPUT_NO_OUTPUT, + /// Keyboard Display + GAP_IO_CAP_KB_DISPLAY, + GAP_IO_CAP_LAST +}; + +/// TK Type +enum gap_tk_type +{ + /// TK get from out of band method + GAP_TK_OOB = 0x00, + /// TK generated and shall be displayed by local device + GAP_TK_DISPLAY, + /// TK shall be entered by user using device keyboard + GAP_TK_KEY_ENTRY +}; + +/// OOB Data Present Flag Values +enum gap_oob +{ + /// OOB Data not present + GAP_OOB_AUTH_DATA_NOT_PRESENT = 0x00, + /// OOB data present + GAP_OOB_AUTH_DATA_PRESENT, + GAP_OOB_AUTH_DATA_LAST +}; + +/// Authentication mask +enum gap_auth_mask +{ + /// No Flag set + GAP_AUTH_NONE = 0, + /// Bond authentication + GAP_AUTH_BOND = (1 << 0), + /// Man In the middle protection + GAP_AUTH_MITM = (1 << 2), + /// Secure Connection + GAP_AUTH_SEC_CON = (1 << 3), + /// Key Notification + GAP_AUTH_KEY_NOTIF = (1 << 4) +}; + +/// Security Link Level +enum gap_lk_sec_lvl +{ + /// No authentication + GAP_LK_NO_AUTH = 0, + /// Unauthenticated link + GAP_LK_UNAUTH, + /// Authenticated link + GAP_LK_AUTH, + /// Secure Connection link + GAP_LK_SEC_CON, +}; + +/// Authentication Requirements +enum gap_auth +{ + /// No MITM No Bonding + GAP_AUTH_REQ_NO_MITM_NO_BOND = (GAP_AUTH_NONE), + /// No MITM Bonding + GAP_AUTH_REQ_NO_MITM_BOND = (GAP_AUTH_BOND), + /// MITM No Bonding + GAP_AUTH_REQ_MITM_NO_BOND = (GAP_AUTH_MITM), + /// MITM and Bonding + GAP_AUTH_REQ_MITM_BOND = (GAP_AUTH_MITM | GAP_AUTH_BOND), + /// SEC_CON and No Bonding + GAP_AUTH_REQ_SEC_CON_NO_BOND = (GAP_AUTH_SEC_CON), + /// SEC_CON and Bonding + GAP_AUTH_REQ_SEC_CON_BOND = (GAP_AUTH_SEC_CON | GAP_AUTH_BOND), + + GAP_AUTH_REQ_LAST, + + /// Mask of authentication features without reserved flag + GAP_AUTH_REQ_MASK = 0x1F, +}; + +/// Key Distribution Flags +enum gap_kdist +{ + /// No Keys to distribute + GAP_KDIST_NONE = 0x00, + /// Encryption key in distribution + GAP_KDIST_ENCKEY = (1 << 0), + /// IRK (ID key)in distribution + GAP_KDIST_IDKEY = (1 << 1), + /// CSRK(Signature key) in distribution + GAP_KDIST_SIGNKEY= (1 << 2), + /// LTK in distribution + GAP_KDIST_LINKKEY= (1 << 3), + + GAP_KDIST_LAST = (1 << 4) +}; + +/// Security Defines +enum gap_sec_req +{ + /// No security (no authentication and encryption) + GAP_NO_SEC = 0x00, + /// Unauthenticated pairing with encryption + GAP_SEC1_NOAUTH_PAIR_ENC, + /// Authenticated pairing with encryption + GAP_SEC1_AUTH_PAIR_ENC, + /// Unauthenticated pairing with data signing + GAP_SEC2_NOAUTH_DATA_SGN, + /// Authentication pairing with data signing + GAP_SEC2_AUTH_DATA_SGN, + /// Secure Connection pairing with encryption + GAP_SEC1_SEC_CON_PAIR_ENC, +}; + +/// Bit field use to select the preferred TX or RX LE PHY. 0 means no preferences +enum gap_phy +{ + /// No preferred PHY + GAP_PHY_ANY = 0x00, + /// LE 1M PHY preferred for an active link + GAP_PHY_LE_1MBPS = (1 << 0), + /// LE 2M PHY preferred for an active link + GAP_PHY_LE_2MBPS = (1 << 1), + /// LE Coded PHY preferred for an active link + GAP_PHY_LE_CODED = (1 << 2), +}; + +/// Option for PHY configuration +enum gap_phy_option +{ + /// No preference for rate used when transmitting on the LE Coded PHY + GAP_PHY_OPT_LE_CODED_ALL_RATES = 0, + /// S=2, 500kbps rate preferred when transmitting on the LE Coded PHY + GAP_PHY_OPT_LE_CODED_500K_RATE = 1, + /// S=8, 125kbps when transmitting on the LE Coded PHY + GAP_PHY_OPT_LE_CODED_125K_RATE = 2, +}; + +/// Enumeration of TX/RX PHY used for Test Mode +enum gap_test_phy +{ + /// LE 1M PHY (TX or RX) + GAP_TEST_PHY_1MBPS = 1, + /// LE 2M PHY (TX or RX) + GAP_TEST_PHY_2MBPS = 2, + /// LE Coded PHY (RX Only) + GAP_TEST_PHY_CODED = 3, + /// LE Coded PHY with S=8 data coding (TX Only) + GAP_TEST_PHY_125KBPS = 3, + /// LE Coded PHY with S=2 data coding (TX Only) + GAP_TEST_PHY_500KBPS = 4, +}; + +/// Modulation index +enum gap_modulation_idx +{ + /// Assume transmitter will have a standard modulation index + GAP_MODULATION_STANDARD, + /// Assume transmitter will have a stable modulation index + GAP_MODULATION_STABLE, +}; + +/// Packet Payload type for test mode +enum gap_pkt_pld_type +{ + /// PRBS9 sequence "11111111100000111101..." (in transmission order) + GAP_PKT_PLD_PRBS9, + /// Repeated "11110000" (in transmission order) + GAP_PKT_PLD_REPEATED_11110000, + /// Repeated "10101010" (in transmission order) + GAP_PKT_PLD_REPEATED_10101010, + /// PRBS15 sequence + GAP_PKT_PLD_PRBS15, + /// Repeated "11111111" (in transmission order) sequence + GAP_PKT_PLD_REPEATED_11111111, + /// Repeated "00000000" (in transmission order) sequence + GAP_PKT_PLD_REPEATED_00000000, + /// Repeated "00001111" (in transmission order) sequence + GAP_PKT_PLD_REPEATED_00001111, + /// Repeated "01010101" (in transmission order) sequence + GAP_PKT_PLD_REPEATED_01010101, +}; + + +/*************** GAP Structures ********************/ + +/// Device name +/*@TRACE*/ +struct gap_dev_name +{ + /// name length + uint16_t length; + /// name value + uint8_t value[]; +}; + +/// Slave preferred connection parameters +/*@TRACE*/ +struct gap_slv_pref +{ + /// Connection interval minimum + uint16_t con_intv_min; + /// Connection interval maximum + uint16_t con_intv_max; + /// Slave latency + uint16_t slave_latency; + /// Connection supervision timeout multiplier + uint16_t conn_timeout; +}; + +/// BD Address structure +/*@TRACE*/ +typedef struct +{ + /// 6-byte array address value + uint8_t addr[GAP_BD_ADDR_LEN]; +} bd_addr_t; + +/// Channel map structure +/*@TRACE*/ +typedef struct +{ + /// 5-byte channel map array + uint8_t map[GAP_LE_CHNL_MAP_LEN]; +} le_chnl_map_t; + + +/// Random number structure +/*@TRACE*/ +typedef struct +{ + /// 8-byte array for random number + uint8_t nb[GAP_RAND_NB_LEN]; +} rand_nb_t; + +/// P256 Public key data format +typedef struct +{ + /// X Coordinate of the key + uint8_t x[GAP_P256_KEY_LEN]; + /// X Coordinate of the key + uint8_t y[GAP_P256_KEY_LEN]; +} public_key_t; + +/// Address information about a device address +/*@TRACE*/ +struct gap_bdaddr +{ + /// BD Address of device + bd_addr_t addr; + /// Address type of the device 0=public/1=private random + uint8_t addr_type; +}; + +/// Resolving list device information +/*@TRACE*/ +struct gap_ral_dev_info +{ + /// Device identity + struct gap_bdaddr addr; + /// Privacy Mode + uint8_t priv_mode; + /// Peer IRK + uint8_t peer_irk[GAP_KEY_LEN]; + /// Local IRK + uint8_t local_irk[GAP_KEY_LEN]; +}; + +/// Generic Security key structure +/*@TRACE*/ +struct gap_sec_key +{ + /// Key value MSB -> LSB + uint8_t key[GAP_KEY_LEN]; +}; + + +#endif // GAP_H_ diff --git a/ble/api/gapc.h b/ble/api/gapc.h new file mode 100644 index 0000000..4562d95 --- /dev/null +++ b/ble/api/gapc.h @@ -0,0 +1,1127 @@ +/** + **************************************************************************************** + * + * @file gapc.h + * + * @brief Generic Access Profile Controller Messages. + * + **************************************************************************************** + */ + +#ifndef _GAPC_H_ +#define _GAPC_H_ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include +#include +#include "le_err.h" +#include "task.h" +#include "gap.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Macro for Instance of GAPC TASK +#define GAPC(idx) TASK_ID(GAPC, idx) + +/// GAP Controller Task messages +/*@TRACE*/ +enum gapc_msg_id +{ + /* Default event */ + /// Command Complete event + GAPC_CMP_EVT = MSG_ID(GAPC, 0x00), + + /* Connection state information */ + /// Indicate that a connect_req has been send + GAPC_CONNECTION_REQ_IND = MSG_ID(GAPC, 0x01), + /// Connection has been established, update from v1.3 + GAPC_CONNECTION_IND = MSG_ID(GAPC, 0x02), + + /// Indicate that a link has been disconnected + GAPC_DISCONNECT_IND = MSG_ID(GAPC, 0x03), + + /* Link management command */ + /// Request disconnection of current link command. + GAPC_DISCONNECT_CMD = MSG_ID(GAPC, 0x04), + /// Set specific link data configuration(rename from _CFM). + GAPC_CONNECTION_CFG = MSG_ID(GAPC, 0x21), + + /* Peer device info */ + /// Retrieve information command + GAPC_GET_INFO_CMD = MSG_ID(GAPC, 0x05), + /// Peer device attribute DB info such as Device Name, Appearance or Slave Preferred Parameters + GAPC_PEER_ATT_INFO_IND = MSG_ID(GAPC, 0x06), + /// Indication of peer version info + GAPC_PEER_VERSION_IND = MSG_ID(GAPC, 0x07), + /// Indication of peer features info + GAPC_PEER_FEATURES_IND = MSG_ID(GAPC, 0x08), + /// Indication of ongoing connection RSSI + GAPC_CON_RSSI_IND = MSG_ID(GAPC, 0x09), + + /* Device Name Management */ + /// Peer device request local device info such as name, appearance or slave preferred parameters + GAPC_GET_DEV_INFO_REQ_IND = MSG_ID(GAPC, 0x0A), + /// Send requested info to peer device + GAPC_GET_DEV_INFO_CFM = MSG_ID(GAPC, 0x0B), + /// Peer device request to modify local device info such as name or appearance + GAPC_SET_DEV_INFO_REQ_IND = MSG_ID(GAPC, 0x0C), + /// Local device accept or reject device info modification + GAPC_SET_DEV_INFO_CFM = MSG_ID(GAPC, 0x0D), + + /* Connection parameters update */ + /// Perform update of connection parameters command + GAPC_PARAM_UPDATE_CMD = MSG_ID(GAPC, 0x0E), + /// Request of updating connection parameters indication + GAPC_PARAM_UPDATE_REQ_IND = MSG_ID(GAPC, 0x0F), + /// Master confirm or not that parameters proposed by slave are accepted or not + GAPC_PARAM_UPDATE_CFM = MSG_ID(GAPC, 0x10), + /// Connection parameters updated indication + GAPC_PARAM_UPDATED_IND = MSG_ID(GAPC, 0x11), + + GAPC_SMP_CMD = MSG_ID(GAPC, 0x12), + /// Start Bonding command procedure + GAPC_BOND_CMD = GAPC_SMP_CMD, //MSG_ID(GAPC, 0x12), + /// Start Encryption command procedure + GAPC_ENCRYPT_CMD = GAPC_SMP_CMD, //MSG_ID(GAPC, 0x16), + /// Start Security Request command procedure + GAPC_SECURITY_CMD = GAPC_SMP_CMD, //MSG_ID(GAPC, 0x1A), + /// Signature procedure + GAPC_SIGN_CMD = GAPC_SMP_CMD, //MSG_ID(GAPC, 0xF0), + + /* Bonding procedure */ + /// Bonding requested by peer device indication message. + GAPC_BOND_REQ_IND = MSG_ID(GAPC, 0x13), + /// Confirm requested bond information. + GAPC_BOND_CFM = MSG_ID(GAPC, 0x14), + /// Bonding information indication message + GAPC_BOND_IND = MSG_ID(GAPC, 0x15), + + /* Encryption procedure */ + /// Encryption requested by peer device indication message. + GAPC_ENCRYPT_REQ_IND = MSG_ID(GAPC, 0x17), + /// Confirm requested Encryption information. + GAPC_ENCRYPT_CFM = MSG_ID(GAPC, 0x18), + /// Encryption information indication message + GAPC_ENCRYPT_IND = MSG_ID(GAPC, 0x19), + + /* Security request procedure */ + /// Security requested by peer device indication message + GAPC_SECURITY_IND = MSG_ID(GAPC, 0x1B), + + /* Signature procedure */ + /// Indicate the current sign counters to the application + GAPC_SIGN_COUNTER_IND = MSG_ID(GAPC, 0x1C), + + /* Device information */ + /// Indication of ongoing connection Channel Map + GAPC_CON_CHANNEL_MAP_IND = MSG_ID(GAPC, 0x1D), + + /* LE Ping */ + /// Update LE Ping timeout value + GAPC_SET_LE_PING_TO_CMD = MSG_ID(GAPC, 0x28), + /// LE Ping timeout indication + GAPC_LE_PING_TO_VAL_IND = MSG_ID(GAPC, 0x29), + /// LE Ping timeout expires indication + GAPC_LE_PING_TO_IND = MSG_ID(GAPC, 0x2A), + + /* LE Data Length extension*/ + /// LE Set Data Length Command + GAPC_SET_LE_PKT_SIZE_CMD = MSG_ID(GAPC, 0x2B), + /// LE Set Data Length Indication + GAPC_LE_PKT_SIZE_IND = MSG_ID(GAPC, 0x2C), + + /* Secure Connections */ + /// Request to inform the remote device when keys have been entered or erased + GAPC_KEY_PRESS_NOTIFICATION_CMD = MSG_ID(GAPC, 0x2D), + /// Indication that a KeyPress has been performed on the peer device. + GAPC_KEY_PRESS_NOTIFICATION_IND = MSG_ID(GAPC, 0x2E), + + /* PHY Management */ + /// Set the PHY configuration for current active link + GAPC_SET_PHY_CMD = MSG_ID(GAPC, 0x2F), + /// Active link PHY configuration. Triggered when configuration is read or during an update. + GAPC_LE_PHY_IND = MSG_ID(GAPC, 0x30), + + /* Channel Selection Algorithm */ + /// Indication of currently used channel selection algorithm + /// @see struct gapc_chan_sel_algo_ind + GAPC_CHAN_SEL_ALGO_IND = MSG_ID(GAPC, 0x31), + + /* Preferred Slave Latency */ + /// Set the preferred slave latency (for slave only, with controller) + GAPC_SET_PREF_SLAVE_LATENCY_CMD = MSG_ID(GAPC, 0x32), +}; + + +/// request operation type - application interface +/*@TRACE*/ +enum gapc_operation +{ + /* Operation Flags */ + /* No Operation (if nothing has been requested) */ + /* ************************************************ */ + /// No operation + GAPC_NO_OP = 0x00, + + /* Connection management */ + /// Disconnect link + GAPC_DISCONNECT = 0x01, + + /* Connection information */ + /// Retrieve name of peer device. + GAPC_GET_PEER_NAME = 0x02, + /// Retrieve peer device version info. + GAPC_GET_PEER_VERSION = 0x03, + /// Retrieve peer device features. + GAPC_GET_PEER_FEATURES = 0x04, + /// Get Peer device appearance + GAPC_GET_PEER_APPEARANCE = 0x05, + /// Get Peer device Slaved Preferred Parameters + GAPC_GET_PEER_SLV_PREF_PARAMS = 0x06, + /// Retrieve connection RSSI. + GAPC_GET_CON_RSSI = 0x07, + /// Retrieve Connection Channel MAP. + GAPC_GET_CON_CHANNEL_MAP = 0x08, + + /* Connection parameters update */ + /// Perform update of connection parameters. + GAPC_UPDATE_PARAMS = 0x09, + + /* Security procedures */ + /// Start bonding procedure. + GAPC_BOND = 0x0A, + /// Start encryption procedure. + GAPC_ENCRYPT = 0x0B, + /// Start security request procedure + GAPC_SECURITY_REQ = 0x0C, + + /* LE Ping*/ + /// get timer timeout value + GAPC_GET_LE_PING_TO = 0x12, + /// set timer timeout value + GAPC_SET_LE_PING_TO = 0x13, + + /* LE Data Length extension*/ + /// LE Set Data Length + GAPC_SET_LE_PKT_SIZE = 0x14, + + /* Central Address resolution supported*/ + GAPC_GET_ADDR_RESOL_SUPP = 0x15, + + /* Secure Connections */ + /// Request to inform the remote device when keys have been entered or erased + GAPC_KEY_PRESS_NOTIFICATION = 0x16, + + /* PHY Management */ + /// Set the PHY configuration for current active link + GAPC_SET_PHY = 0x17, + /// Retrieve PHY configuration of active link + GAPC_GET_PHY = 0x18, + + /* Channel Selection Algorithm */ + /// Retrieve Channel Selection Algorithm + GAPC_GET_CHAN_SEL_ALGO = 0x19, + + /* Preferred slave latency */ + /// Set the preferred slave latency (for slave only, with controller) + GAPC_SET_PREF_SLAVE_LATENCY = 0x1A, +}; + +/// Bond event type. +/*@TRACE*/ +enum gapc_bond +{ + /// Bond Pairing request + GAPC_PAIRING_REQ, + /// Respond to Pairing request + GAPC_PAIRING_RSP, + + /// Pairing Finished information + GAPC_PAIRING_SUCCEED, + /// Pairing Failed information + GAPC_PAIRING_FAILED, + + /// Used to retrieve pairing Temporary Key + GAPC_TK_EXCH, + /// Used for Identity Resolving Key exchange + GAPC_IRK_EXCH, + /// Used for Connection Signature Resolving Key exchange + GAPC_CSRK_EXCH, + /// Used for Long Term Key exchange + GAPC_LTK_EXCH, + + /// Bond Pairing request issue, Repeated attempt + GAPC_REPEATED_ATTEMPT, + + /// Out of Band - exchange of confirm and rand. + GAPC_OOB_EXCH, + + /// Numeric Comparison - Exchange of Numeric Value - + GAPC_NC_EXCH +}; + +/// List of device info that should be provided by application +/*@TRACE*/ +enum gapc_dev_info +{ + /// Device Name + GAPC_DEV_NAME, + /// Device Appearance Icon + GAPC_DEV_APPEARANCE, + /// Device Slave preferred parameters + GAPC_DEV_SLV_PREF_PARAMS, + /// Device Central address resolution + GAPC_DEV_CTL_ADDR_RESOL, + /// maximum device info parameter + GAPC_DEV_INFO_MAX, +}; + +/// List of features available on a device +enum gapc_features_list +{ + /// LE encryption + GAPC_ENCRYPT_FEAT_MASK = (1 << 0), + /// Connection Parameters Request Procedure + GAPC_CONN_PARAM_REQ_FEAT_MASK = (1 << 1), + /// Extended Reject Indication + GAPC_EXT_REJECT_IND_FEAT_MASK = (1 << 2), + /// Slave-initiated Features Exchange + GAPC_SLAVE_FEAT_EXCH_FEAT_MASK = (1 << 3), + /// LE ping + GAPC_LE_PING_FEAT_MASK = (1 << 4) +}; + +/// Option for PHY configuration +enum gapc_phy_option +{ + /// No preference for rate used when transmitting on the LE Coded PHY + GAPC_PHY_OPT_LE_CODED_ALL_RATES = (1 << 0), + /// 500kbps rate preferred when transmitting on the LE Coded PHY + GAPC_PHY_OPT_LE_CODED_500K_RATE = (1 << 1), + /// 125kbps when transmitting on the LE Coded PHY + GAPC_PHY_OPT_LE_CODED_125K_RATE = (1 << 2), +}; + +/// Keypress Notification types +enum gapc_key_ntf_type +{ + /// Passkey entry started + GAPC_KEY_NTF_ENTRY_STARTED = 0x00, + /// Passkey digit entered + GAPC_KEY_NTF_DIGIT_ENTERED, + /// Passkey digit erased + GAPC_KEY_NTF_DIGIT_ERASED, + /// Passkey cleared + GAPC_KEY_NTF_CLEARED, + /// Passkey entry completed + GAPC_KEY_NTF_ENTRY_COMPLETED +}; + +/// Client bond information +enum gapc_cli_info +{ + /// Service changed indication enabled + GAPC_SVC_CHANGED_IND_EN_BIT = (1 << 0), + GAPC_SVC_CHANGED_IND_EN_POS = 0, + /// Database updated since last connection + GAPC_DB_UPDATED_BIT = (1 << 1), + GAPC_DB_UPDATED_POS = 1, +}; + +/// Client supported features +enum gapc_cli_feat +{ + /// Robust Cache feature enabled + GAPC_ROBUST_CACHE_EN_BIT = (1 << 0), + GAPC_ROBUST_CACHE_EN_POS = 0, +}; + +/// Link security status. This status represents the authentication/authorization/bonding levels of the connection +enum gapc_lk_sec_req +{ + /// Link is bonded + GAPC_LK_BONDED, + /// Link is Encrypted + GAPC_LK_ENCRYPTED, + /// Link LTK Exchanged during pairing + GAPC_LK_LTK_PRESENT, +}; + +/// Information source. +enum gapc_smp_addr_src +{ + /// Local info. + GAPC_SMP_INFO_LOCAL, + /// Peer info. + GAPC_SMP_INFO_PEER, + /// Maximum info source. + GAPC_SMP_INFO_MAX +}; +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Operation command structure in order to keep requested operation. +struct gapc_operation_cmd +{ + /// GAP request type + uint8_t operation; +}; + + +/// Command complete event data structure +/*@TRACE*/ +struct gapc_cmp_evt +{ + /// GAP request type + uint8_t operation; + /// Status of the request + uint8_t status; +}; + +/// Indicate that an unknown message has been received +/*@TRACE*/ +struct gapc_unknown_msg_ind +{ + /// Unknown message id + msg_id_t unknown_msg_id; +}; + +/// Indicate that a connection has been established +/*@TRACE*/ +struct gapc_connection_req_ind +{ + /// Connection handle + uint16_t conhdl; + /// Connection interval + uint16_t con_interval; + /// Connection latency + uint16_t con_latency; + /// Link supervision timeout + uint16_t sup_to; + /// Clock accuracy + uint8_t clk_accuracy; + /// Peer address type + uint8_t peer_addr_type; + /// Peer BT address + bd_addr_t peer_addr; + /// Role of device in connection (0 = Master / 1 = Slave) + uint8_t role; +}; + +struct gapc_connection_ind +{ + /// Connection handle + uint16_t conhdl; + /// Role of device in connection (0 = Master / 1 = Slave) + uint8_t role; +}; + +/// Set specific link data configuration. +/*@TRACE*/ +struct gapc_connection_cfg +{ + /// Local CSRK value + struct gap_sec_key lcsrk; + /// Local signature counter value + uint32_t lsign_counter; + /// Remote CSRK value + struct gap_sec_key rcsrk; + /// Remote signature counter value + uint32_t rsign_counter; + /// Authentication (@see enum gap_auth) + uint8_t auth; + /// Client bond data information (@see enum gapc_cli_info) + uint8_t cli_info; + /// LTK exchanged during pairing. + bool ltk_present; + /// Client supported features (@see enum gapc_cli_feat) + uint8_t cli_feat; + /// Peer GATT Service Start handle + uint16_t gatt_start_handle; + /// Peer GATT Service End Handle + uint16_t gatt_end_handle; + /// Peer Service Change value handle + uint16_t svc_chg_handle; +}; + +/// Request disconnection of current link command. +/*@TRACE*/ +struct gapc_disconnect_cmd +{ + /// GAP request type: + /// - GAPC_DISCONNECT: Disconnect link. + uint8_t operation; + + /// Reason of disconnection + uint8_t reason; +}; + + +/// Indicate that a link has been disconnected +/*@TRACE*/ +struct gapc_disconnect_ind +{ + /// Connection handle + uint16_t conhdl; + /// Reason of disconnection + uint8_t reason; +}; + + +/// Retrieve information command +/*@TRACE*/ +struct gapc_get_info_cmd +{ + /// GAP request type: + /// - GAPC_GET_PEER_NAME: Retrieve name of peer device. + /// - GAPC_GET_PEER_VERSION: Retrieve peer device version info. + /// - GAPC_GET_PEER_FEATURES: Retrieve peer device features. + /// - GAPC_GET_CON_RSSI: Retrieve connection RSSI. + /// - GAPC_GET_CON_CHANNEL_MAP: Retrieve Connection Channel MAP. + /// - GAPC_GET_PEER_APPEARANCE: Get Peer device appearance + /// - GAPC_GET_PEER_SLV_PREF_PARAMS: Get Peer device Slaved Preferred Parameters + /// - GAPC_GET_ADDR_RESOL_SUPP: Address Resolution Supported + /// - GAPC_GET_LE_PING_TIMEOUT: Retrieve LE Ping Timeout Value + uint8_t operation; +}; + +/// device information data +/*@TRACE + @trc_ref gapc_dev_info*/ +union gapc_dev_info_val +{ + /// Device name + //@trc_union parent.req == GAPC_DEV_NAME + struct gap_dev_name name; + /// Appearance Icon + //@trc_union parent.req == GAPC_DEV_APPEARANCE + uint16_t appearance; + /// Slave preferred parameters + //@trc_union parent.req == GAPC_DEV_SLV_PREF_PARAMS + struct gap_slv_pref slv_pref_params; + /// Central address resolution + //@trc_union parent.req == GAPC_DEV_CTL_ADDR_RESOL + uint8_t ctl_addr_resol; +}; + +/// Peer device attribute DB info such as Device Name, Appearance or Slave Preferred Parameters +/*@TRACE*/ +struct gapc_peer_att_info_ind +{ + /// Requested information + /// - GAPC_DEV_NAME: Device Name + /// - GAPC_DEV_APPEARANCE: Device Appearance Icon + /// - GAPC_DEV_SLV_PREF_PARAMS: Device Slave preferred parameters + /// - GAPC_GET_ADDR_RESOL_SUPP: Address resolution supported + uint8_t req; + /// Attribute handle + uint16_t handle; + + /// device information data + union gapc_dev_info_val info; +}; + +/// Indication of peer version info +/*@TRACE*/ +struct gapc_peer_version_ind +{ + /// Manufacturer name + uint16_t compid; + /// LMP subversion + uint16_t lmp_subvers; + /// LMP version + uint8_t lmp_vers; +}; + +/// Indication of peer features info +/*@TRACE*/ +struct gapc_peer_features_ind +{ + /// 8-byte array for LE features + uint8_t features[GAP_LE_FEATS_LEN]; +}; + +/// Indication of ongoing connection RSSI +/*@TRACE*/ +struct gapc_con_rssi_ind +{ + /// RSSI value + int8_t rssi; +}; + +/// Indication of ongoing connection Channel Map +/*@TRACE*/ +struct gapc_con_channel_map_ind +{ + /// channel map value + le_chnl_map_t ch_map; +}; + +/// Sign counter value changed due to packet signing or signature verification. +struct gapc_sign_counter_updated_ind +{ + /// New Local signature counter value + uint32_t lsign_counter; + /// New Remote signature counter value + uint32_t rsign_counter; +}; + +/// Indication of LE Ping +/*@TRACE*/ +struct gapc_le_ping_to_val_ind +{ + /// Authenticated payload timeout + uint16_t timeout; +}; + + +/// Peer device request local device info such as name, appearance or slave preferred parameters +/*@TRACE*/ +struct gapc_get_dev_info_req_ind +{ + /// Requested information + /// - GAPC_DEV_NAME: Device Name + /// - GAPC_DEV_APPEARANCE: Device Appearance Icon + /// - GAPC_DEV_SLV_PREF_PARAMS: Device Slave preferred parameters + uint8_t req; +}; + + +/// Send requested info to peer device +/*@TRACE*/ +struct gapc_get_dev_info_cfm +{ + /// Requested information + /// - GAPC_DEV_NAME: Device Name + /// - GAPC_DEV_APPEARANCE: Device Appearance Icon + /// - GAPC_DEV_SLV_PREF_PARAMS: Device Slave preferred parameters + uint8_t req; + + /// Peer device information data + union gapc_dev_info_val info; +}; + +/// device information data +/*@TRACE + @trc_ref gapc_dev_info*/ +union gapc_set_dev_info +{ + /// Device name + //@trc_union parent.req == GAPC_DEV_NAME + struct gap_dev_name name; + /// Appearance Icon + //@trc_union parent.req == GAPC_DEV_APPEARANCE + uint16_t appearance; +}; + +/// Peer device request to modify local device info such as name or appearance +/*@TRACE*/ +struct gapc_set_dev_info_req_ind +{ + /// Requested information + /// - GAPC_DEV_NAME: Device Name + /// - GAPC_DEV_APPEARANCE: Device Appearance Icon + uint8_t req; + + /// device information data + union gapc_set_dev_info info; +}; + +/// Local device accept or reject device info modification +/*@TRACE*/ +struct gapc_set_dev_info_cfm +{ + /// Requested information + /// - GAPC_DEV_NAME: Device Name + /// - GAPC_DEV_APPEARANCE: Device Appearance Icon + uint8_t req; + + /// Status code used to know if requested has been accepted or not + uint8_t status; +}; + +/// Connection Parameter used to update connection parameters +struct gapc_conn_param +{ + /// Connection interval minimum + uint16_t intv_min; + /// Connection interval maximum + uint16_t intv_max; + /// Latency + uint16_t latency; + /// Supervision timeout + uint16_t time_out; +}; + +/// Perform update of connection parameters command +/*@TRACE*/ +struct gapc_param_update_cmd +{ + /// GAP request type: + /// - GAPC_UPDATE_PARAMS: Perform update of connection parameters. + uint8_t operation; + /// Internal parameter used to manage internally l2cap packet identifier for signaling + uint8_t pkt_id; + /// Connection interval minimum + uint16_t intv_min; + /// Connection interval maximum + uint16_t intv_max; + /// Latency + uint16_t latency; + /// Supervision timeout + uint16_t time_out; + /// Minimum Connection Event Duration + uint16_t ce_len_min; + /// Maximum Connection Event Duration + uint16_t ce_len_max; +}; + +/// Request of updating connection parameters indication +/*@TRACE*/ +struct gapc_param_update_req_ind +{ + /// Connection interval minimum + uint16_t intv_min; + /// Connection interval maximum + uint16_t intv_max; + /// Latency + uint16_t latency; + /// Supervision timeout + uint16_t time_out; +}; + +/// Connection parameters updated indication +/*@TRACE*/ +struct gapc_param_updated_ind +{ + /// Connection interval value + uint16_t con_interval; + /// Connection latency value + uint16_t con_latency; + /// Supervision timeout + uint16_t sup_to; +}; + +/// Master confirm or not that parameters proposed by slave are accepted or not +/*@TRACE*/ +struct gapc_param_update_cfm +{ + /// True to accept slave connection parameters, False else. + bool accept; + /// Minimum Connection Event Duration + uint16_t ce_len_min; + /// Maximum Connection Event Duration + uint16_t ce_len_max; +}; + +/// Parameters of the @ref GAPC_SET_PREF_SLAVE_LATENCY_CMD message +/*@TRACE*/ +struct gapc_set_pref_slave_latency_cmd +{ + /// GAP request type: + /// - GAPC_SET_PREF_SLAVE_LATENCY_CMD : Set preferred slave latency + uint8_t operation; + /// Preferred latency that the controller should use on a connection (in number of connection events) + uint16_t latency; +}; + +/// Pairing parameters +/*@TRACE*/ +struct gapc_pairing +{ + /// IO capabilities (@see gap_io_cap) + uint8_t iocap; + /// OOB information (@see gap_oob) + uint8_t oob; + /// Authentication (@see gap_auth) + /// Note in BT 4.1 the Auth Field is extended to include 'Key Notification' and + /// and 'Secure Connections'. + uint8_t auth; + /// Encryption key size (7 to 16) + uint8_t key_size; + /// Initiator key distribution (@see gap_kdist) + uint8_t ikey_dist; + /// Responder key distribution (@see gap_kdist) + uint8_t rkey_dist; + + /// Device security requirements (minimum security level). (@see gap_sec_req) + uint8_t sec_req; +}; + +/// Long Term Key information +/*@TRACE*/ +struct gapc_ltk +{ + /// Long Term Key + struct gap_sec_key ltk; + /// Encryption Diversifier + uint16_t ediv; + /// Random Number + rand_nb_t randnb; + /// Encryption key size (7 to 16) + uint8_t key_size; + /// Extend Info + uint8_t ext_info; +}; +/// Out of Band Information +/*@TRACE*/ +struct gapc_oob +{ + /// Confirm Value + uint8_t conf[GAP_KEY_LEN]; + /// Random Number + uint8_t rand[GAP_KEY_LEN]; +}; + +/*@TRACE*/ +struct gapc_nc +{ + uint8_t value[4]; +}; + +/// Identity Resolving Key information +/*@TRACE*/ +struct gapc_irk +{ + /// Identity Resolving Key + struct gap_sec_key irk; + /// Device BD Identity Address + struct gap_bdaddr addr; +}; + + +/// Start Bonding command procedure +/*@TRACE*/ +struct gapc_bond_cmd +{ + /// GAP request type: + /// - GAPC_BOND: Start bonding procedure. + uint8_t operation; + /// Pairing information + struct gapc_pairing pairing; +}; + +/// Bond procedure requested information data +/*@TRACE + @trc_ref gapc_bond*/ +union gapc_bond_req_data +{ + /// Authentication level (@see gap_auth) (if request = GAPC_PAIRING_REQ) + //@trc_union parent.request == GAPC_PAIRING_REQ + uint8_t auth_req; + /// LTK Key Size (if request = GAPC_LTK_EXCH) + //@trc_union parent.request == GAPC_LTK_EXCH + uint8_t key_size; + /// Device IO used to get TK: (if request = GAPC_TK_EXCH) + /// - GAP_TK_OOB: TK get from out of band method + /// - GAP_TK_DISPLAY: TK generated and shall be displayed by local device + /// - GAP_TK_KEY_ENTRY: TK shall be entered by user using device keyboard + //@trc_union parent.request == GAPC_TK_EXCH + uint8_t tk_type; + + /// Addition OOB Data for the OOB Conf and Rand values + //@trc_union parent.request == GAPC_OOB_EXCH + struct gapc_oob oob_data; + /// Numeric Comparison Data + //@trc_union parent.request == GAPC_NC_EXCH + struct gapc_nc nc_data; +}; + +/// Bonding requested by peer device indication message. +/*@TRACE*/ +struct gapc_bond_req_ind +{ + /// Bond request type (@see gapc_bond) + uint8_t request; + + /// Bond procedure requested information data + union gapc_bond_req_data data; +}; + +/*@TRACE + @trc_ref gapc_bond +*/ +union gapc_bond_cfm_data +{ + /// Pairing Features (request = GAPC_PAIRING_RSP) + //@trc_union parent.request == GAPC_PAIRING_RSP + struct gapc_pairing pairing_feat; + /// LTK (request = GAPC_LTK_EXCH) + //@trc_union parent.request == GAPC_LTK_EXCH + struct gapc_ltk ltk; + /// CSRK (request = GAPC_CSRK_EXCH) + //@trc_union parent.request == GAPC_CSRK_EXCH + struct gap_sec_key csrk; + /// TK (request = GAPC_TK_EXCH) + //@trc_union parent.request == GAPC_TK_EXCH + struct gap_sec_key tk; + /// IRK (request = GAPC_IRK_EXCH) + //@trc_union parent.request == GAPC_IRK_EXCH + struct gapc_irk irk; + /// OOB Confirm and Random from the peer (request = GAPC_OOB_EXCH) + //@trc_union parent.request == GAPC_OOB_EXCH + struct gapc_oob oob; +}; + +/// Confirm requested bond information. +/*@TRACE*/ +struct gapc_bond_cfm +{ + /// Bond request type (@see gapc_bond) + uint8_t request; + /// Request accepted + uint8_t accept; + + /// Bond procedure information data + union gapc_bond_cfm_data data; +}; + +/** + * Authentication information + */ +/*@TRACE*/ +struct gapc_bond_auth +{ + /// Authentication information (@see gap_auth) + uint8_t info; + + /// LTK exchanged during pairing. + bool ltk_present; +}; + +/// Bond procedure information data +/*@TRACE + @trc_ref gapc_bond*/ +union gapc_bond_data +{ + /// Authentication information (@see gap_auth) + /// (if info = GAPC_PAIRING_SUCCEED) + //@trc_union parent.info == GAPC_PAIRING_SUCCEED + struct gapc_bond_auth auth; + /// Pairing failed reason (if info = GAPC_PAIRING_FAILED) + //@trc_union parent.info == GAPC_PAIRING_FAILED + uint8_t reason; + /// Long Term Key information (if info = GAPC_LTK_EXCH) + //@trc_union parent.info == GAPC_LTK_EXCH + struct gapc_ltk ltk; + /// Identity Resolving Key information (if info = GAPC_IRK_EXCH) + //@trc_union parent.info == GAPC_IRK_EXCH + struct gapc_irk irk; + /// Connection Signature Resolving Key information (if info = GAPC_CSRK_EXCH) + //@trc_union parent.info == GAPC_CSRK_EXCH + struct gap_sec_key csrk; +}; + +/// Bonding information indication message +/*@TRACE*/ +struct gapc_bond_ind +{ + /// Bond information type (@see gapc_bond) + uint8_t info; + + /// Bond procedure information data + union gapc_bond_data data; +}; + +/// Start Encryption command procedure +/*@TRACE*/ +struct gapc_encrypt_cmd +{ + /// GAP request type: + /// - GAPC_ENCRYPT: Start encryption procedure. + uint8_t operation; + /// Long Term Key information + struct gapc_ltk ltk; +}; + +/// Encryption requested by peer device indication message. +/*@TRACE*/ +struct gapc_encrypt_req_ind +{ + /// Encryption Diversifier + uint16_t ediv; + /// Random Number + rand_nb_t rand_nb; +}; + +/// Confirm requested Encryption information. +/*@TRACE*/ +struct gapc_encrypt_cfm +{ + /// Indicate if a LTK has been found for the peer device + uint8_t found; + /// Long Term Key + struct gap_sec_key ltk; + /// LTK Key Size + uint8_t key_size; +}; + +/// Encryption information indication message +/*@TRACE*/ +struct gapc_encrypt_ind +{ + /// Authentication level (@see gap_auth) + uint8_t auth; +}; + +/// Start Security Request command procedure +/*@TRACE*/ +struct gapc_security_cmd +{ + /// GAP request type: + /// - GAPC_SECURITY_REQ: Start security request procedure + uint8_t operation; + /// Authentication level (@see gap_auth) + uint8_t auth; +}; +/// Security requested by peer device indication message +/*@TRACE*/ +struct gapc_security_ind +{ + /// Authentication level (@see gap_auth) + uint8_t auth; +}; + +/// Parameters of the @ref GAPC_SIGN_COUNTER_IND message +/*@TRACE*/ +struct gapc_sign_counter_ind +{ + /// Local SignCounter value + uint32_t local_sign_counter; + /// Peer SignCounter value + uint32_t peer_sign_counter; +}; + + +/// Parameters of the @ref GAPC_SET_LE_PING_TO_CMD message +/*@TRACE*/ +struct gapc_set_le_ping_to_cmd +{ + /// GAP request type: + /// - GAPC_SET_LE_PING_TO : Set the LE Ping timeout value + uint8_t operation; + /// Authenticated payload timeout + uint16_t timeout; +}; + +/// Parameters of the @ref GAPC_SET_LE_PKT_SIZE_CMD message +/*@TRACE*/ +struct gapc_set_le_pkt_size_cmd +{ + /// GAP request type: + /// - GAPC_SET_LE_PKT_SIZE : Set the LE Data length value + uint8_t operation; + /// Preferred maximum number of payload octets that the local Controller should include + /// in a single Link Layer Data Channel PDU. + uint16_t tx_octets; + /// Preferred maximum number of microseconds that the local Controller should use to transmit + /// a single Link Layer Data Channel PDU + uint16_t tx_time; +}; + +/// Parameters of the @ref GAPC_LE_PKT_SIZE_IND message +/*@TRACE*/ +struct gapc_le_pkt_size_ind +{ + /// The maximum number of payload octets in TX + uint16_t max_tx_octets; + /// The maximum time that the local Controller will take to TX + uint16_t max_tx_time; + /// The maximum number of payload octets in RX + uint16_t max_rx_octets; + /// The maximum time that the local Controller will take to RX + uint16_t max_rx_time; +}; + +/// Parameters of the @ref GAPC_KEY_PRESS_NOTIFICATION_CMD message +/*@TRACE*/ +struct gapc_key_press_notif_cmd +{ + /// GAP request type: + /// - GAPC_KEY_PRESS_NOTIFICATION_CMD : Inform the remote device when keys have been entered or erased + uint8_t operation; + /// notification type + uint8_t notification_type; +}; + +/// Parameters of the @ref GAPC_KEY_PRESS_NOTIFICATION_IND message +/*@TRACE*/ +struct gapc_key_press_notif_ind +{ + /// notification type + uint8_t notification_type; +}; + +/// Set the PHY configuration for current active link +/*@TRACE*/ +struct gapc_set_phy_cmd +{ + /// GAP request type: + /// - GAPC_SET_PHY : Set the PHY configuration for current active link + uint8_t operation; + /// Supported LE PHY for data transmission (@see enum gap_phy) + uint8_t tx_phy; + /// Supported LE PHY for data reception (@see enum gap_phy) + uint8_t rx_phy; + /// PHY options (@see enum gap_phy_option) + uint8_t phy_opt; +}; + +/// Active link PHY configuration. Triggered when configuration is read or during an update. +/*@TRACE*/ +struct gapc_le_phy_ind +{ + /// LE PHY for data transmission (@see enum gap_phy) + uint8_t tx_phy; + /// LE PHY for data reception (@see enum gap_phy) + uint8_t rx_phy; +}; + +/// Parameters of the @ref GAPC_SIGN_CMD message +/*@TRACE*/ +struct gapc_sign_cmd +{ + /// GAP request type: + /// - GAPC_SIGN_PACKET: Sign an attribute packet + /// - GAPC_SIGN_CHECK: Verify signature or an attribute packet + uint8_t operation; + /// Data PDU length (Bytes) + uint16_t byte_len; + /// Data PDU + SignCounter if generation, Data PDU + SignCounter + MAC if verification + uint8_t msg[]; +}; + +/// Parameters of the @ref GAPC_SIGN_IND message +/*@TRACE*/ +struct gapc_sign_ind +{ + /// GAP request type: + /// - GAPC_SIGN_PACKET: Sign an attribute packet + /// - GAPC_SIGN_CHECK: Verify signature or an attribute packet + uint8_t operation; + /// Data PDU length (Bytes) + uint16_t byte_len; + /// Data PDU + SignCounter + MAC + uint8_t signed_msg[]; +}; + +/// Parameters of the @ref GAPC_CHAN_SEL_ALGO_IND +/*@TRACE*/ +struct gapc_chan_sel_algo_ind +{ + /// Used channel selection algorithm + uint8_t chan_sel_algo; +}; + + +#endif /* _GAPC_H_ */ diff --git a/ble/api/gapc_api.h b/ble/api/gapc_api.h new file mode 100644 index 0000000..b312da5 --- /dev/null +++ b/ble/api/gapc_api.h @@ -0,0 +1,388 @@ +/** + **************************************************************************************** + * + * @file gapc_api.h + * + * @brief Generic Access Profile Controller API functions. + * + **************************************************************************************** + */ + +#ifndef GAPC_API_H_ +#define GAPC_API_H_ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include +#include "gapc.h" + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Response GAPC_CONNECTION_REQ_IND with specific link data configuration. + * + * @param[in] conidx Connection index + * @param[in] auth Authentication(@see gap_auth) + **************************************************************************************** + */ +void gapc_connect_rsp(uint8_t conidx, uint8_t auth); + +/** + **************************************************************************************** + * @brief Response GAPC_PARAM_UPDATE_REQ_IND(Master confirm or not). + * + * @param[in] conidx Connection index + * @param[in] accept True or False to accept slave connection parameters + * @param[in] ce_min Minimum Connection Event Duration + * @param[in] ce_max Maximum Connection Event Duration + **************************************************************************************** + */ +void gapc_param_update_rsp(uint8_t conidx, bool accept, uint16_t ce_min, uint16_t ce_max); + +/** + **************************************************************************************** + * @brief Set the PHY configuration for current active link. + * + * @param[in] conidx Connection index + * @param[in] tx_phy PHY for data transmission(@see enum gap_phy) + * @param[in] rx_phy PHY for data reception(@see enum gap_phy) + * @param[in] phy_opt PHY options(@see enum gapc_phy_option) + * + *@return Message GAPC_LE_PHY_IND + **************************************************************************************** + */ +void gapc_update_phy(uint8_t conidx, uint8_t tx_phy, uint8_t rx_phy, uint8_t phy_opt); + +/** + **************************************************************************************** + * @brief Set the BLE Data Length Extension for current active link. + * + * @param[in] conidx Connection index + * @param[in] tx_octets Length of data transmission(@see LE_MAX_OCTETS) + * @param[in] tx_time Time of data transmission(@see LE_MAX_TIME) + * + *@return Message GAPC_LE_PKT_SIZE_IND + **************************************************************************************** + */ +void gapc_update_dle(uint8_t conidx, uint16_t tx_octets, uint16_t tx_time); + +/** + **************************************************************************************** + * @brief Perform update of connection parameters command. + * + * @param[in] conidx Connection index + * @param[in] param Connection parameters + * + *@return Message GAPC_PARAM_UPDATED_IND + **************************************************************************************** + */ +void gapc_update_param(uint8_t conidx, struct gapc_conn_param const* param); + +/** + **************************************************************************************** + * @brief Request disconnection of current link command. + * + * @param[in] conidx Connection index + * @param[in] reason Reason of disconnection + * + *@return Message GAPC_DISCONNECT_IND + **************************************************************************************** + */ +void gapc_disconnect(uint8_t conidx); + + +/** + **************************************************************************************** + * @brief Send gapc_get_info_cmd, Retrieve Connection information + * + * @param[in] conidx Connection index + * @param[in] info Connection information (@see gapc_operation) + **************************************************************************************** + */ +void gapc_get_info(uint8_t conidx, uint8_t info); + +/** + **************************************************************************************** + * @brief Retrieve connection index from connection handle. + * + * @param[in] conhdl Connection handle + * + * @return Return found connection index, GAP_INVALID_CONIDX if not found. + **************************************************************************************** + */ +uint8_t gapc_get_conidx(uint16_t conhdl); + +/** + **************************************************************************************** + * @brief Retrieve connection handle from connection index. + * + * @param[in] conidx Connection index + * + * @return Return found connection handle, GAP_INVALID_CONHDL if not found. + **************************************************************************************** + */ +uint16_t gapc_get_conhdl(uint8_t conidx); + +/** + **************************************************************************************** + * @brief Retrieve connection role from connection index. + * + * @param[in] conidx Connection index + * + * @return Return found connection role + **************************************************************************************** + */ +uint8_t gapc_get_role(uint8_t conidx); + +/** + **************************************************************************************** + * @brief Retrieve link authentication level + * + * @param[in] conidx Connection index + * @return Link authentication level + **************************************************************************************** + */ +uint8_t gapc_auth_get(uint8_t conidx); + +/** + **************************************************************************************** + * @brief Set resolvable address used for connection establishment as local address. + * + * @brief conidx Connection index + * @brief p_addr Pointer to the resolvable address used by either advertising activity or + * resolvable activity. + **************************************************************************************** + */ +void gapc_set_local_addr(uint8_t conidx, uint8_t *p_addr); + +/** + **************************************************************************************** + * @brief Retrieve connection address information on current link. + * + * @param[in] conidx Connection index + * @param[in] src information source(@see gapc_smp_addr_src) + * + * @return Return found connection address + **************************************************************************************** + */ +struct gap_bdaddr* gapc_get_bdaddr(uint8_t conidx, uint8_t src); + +/** + **************************************************************************************** + * @brief Get destination task id for asynchronous event, meaning events that are not + * linked to an operation. + * Note the provided connection index shall be valid (gapc_env[conidx] is not NULL) + * + * @param[in] conidx Connection Index + * + * @return ID of the destination task. + **************************************************************************************** + */ +task_id_t gapc_get_dest_task(uint8_t conidx); + +/** + **************************************************************************************** + * @brief Check if current link support security requirements. + * + * @param[in] conidx Connection index + * @param[in] sec_req Link security requirement to test + * + * @return True if link requirement is supported, False else. + **************************************************************************************** + */ +bool gapc_is_sec_set(uint8_t conidx, uint8_t sec_req); + +/** + **************************************************************************************** + * @brief Retrieve Link Security level + * + * @param[in] conidx Connection index + * + * @return Link Security level. + **************************************************************************************** + */ +uint8_t gapc_lk_sec_lvl_get(uint8_t conidx); + +/** + **************************************************************************************** + * @brief Retrieve the encryption key size of the connection + * + * @param[in] conidx Connection index + * + * @return encryption key size (size is 7 - 16 byte range) + * + **************************************************************************************** + */ +uint8_t gapc_enc_keysize_get(uint8_t conidx); + +/** + **************************************************************************************** + * @brief Get Service Change Client Configuration + * + * @param[in] conidx Connection index + * + * @return Service Change Client Configuration + **************************************************************************************** + */ +bool gapc_svc_chg_ccc_get(uint8_t conidx); + +/** + **************************************************************************************** + * @brief Set Service Change Client Configuration + * + * @param[in] conidx Connection index + * @param[in] enable True if CCC is enabled, False else + * + **************************************************************************************** + */ +void gapc_svc_chg_ccc_set(uint8_t conidx, bool enable); + +/** + **************************************************************************************** + * @brief Send bond request(Master Role). + * + * @param[in] conidx Connection index + * @param[in] feat Pairing Feature(@see gapc_pairing) + **************************************************************************************** + */ +void gapc_smp_bond_req(uint8_t conidx, struct gapc_pairing const* feat); + +/** + **************************************************************************************** + * @brief Send encrypt request(Master Role). + * + * @param[in] conidx Connection index + * @param[in] ltk Long term key(@see gapc_ltk) + **************************************************************************************** + */ +void gapc_smp_encrypt_req(uint8_t conidx, struct gapc_ltk const* ltk); + +/** + **************************************************************************************** + * @brief Send security request. + * + * @param[in] conidx Connection index + * @param[in] auth Authentication req(@see gap_auth) + **************************************************************************************** + */ +void gapc_smp_security_req(uint8_t conidx, uint8_t auth); + +/** + **************************************************************************************** + * @brief Send Keypress Notification. + * + * @param[in] conidx Connection index + * @param[in] keyntf Keypress type req(@see gapc_key_ntf_type) + **************************************************************************************** + */ +void gapc_key_press_notify(uint8_t conidx, uint8_t keyntf); + +/** + **************************************************************************************** + * @brief Respond to peer pairing information request(GAPC_PAIRING_REQ) + * + * @param[in] conidx Connection Index + * @param[in] feat Pairing feature information, NULL means pairing rejected + * + * @return status of pairing + **************************************************************************************** + */ +uint8_t gapc_smp_pairing_rsp(uint8_t conidx, struct gapc_pairing *feat); + +/** + **************************************************************************************** + * @brief Handles LTK exchange part of pairing(GAPC_BOND_REQ_IND) + * + * @param[in] conidx Connection Index + * @param[in] ltk The Long Term Key transmitted by application + * + * @return status of pairing + **************************************************************************************** + */ +uint8_t gapc_smp_pairing_ltk_exch(uint8_t conidx, struct gapc_ltk* ltk); + +/** + **************************************************************************************** + * @brief Handles IRK exchange part of pairing(GAPC_BOND_REQ_IND) + * + * @param[in] conidx Connection Index + * @param[in] irk The Identity Resolving Key transmitted by application + * @param[in] identity Device identity address + * + * @return status of pairing + **************************************************************************************** + */ +uint8_t gapc_smp_pairing_irk_exch(uint8_t conidx, struct gap_sec_key* irk, struct gap_bdaddr *identity); + +/** + **************************************************************************************** + * @brief Handles CSRK exchange part of pairing(GAPC_BOND_REQ_IND) + * + * @param[in] conidx Connection Index + * @param[in] csrk The Connection signature resolving key transmitted by application + * + * @return status of pairing + **************************************************************************************** + */ +uint8_t gapc_smp_pairing_csrk_exch(uint8_t conidx, struct gap_sec_key *csrk); + +/** + **************************************************************************************** + * @brief Handles TK exchange part of pairing(GAPC_BOND_REQ_IND) + * + * @param[in] conidx Connection Index + * @param[in] accept True if pairing is accepted, False else + * @param[in] tk The Temporary Key transmitted by application + * + * @return status of pairing + **************************************************************************************** + */ +uint8_t gapc_smp_pairing_tk_exch(uint8_t conidx, bool accept, struct gap_sec_key *tk); + +#if (SEC_CON_ENB) +/** + **************************************************************************************** + * @brief Handles OOB exchange part of pairing(GAPC_BOND_REQ_IND) + * + * @param[in] conidx Connection Index + * @param[in] accept Accept or Reject the OOB (reject if OOB reception not available on the device) + * @param[in] csrk The OOB Confirm and OOB Rand from the peer + * + * @return status of pairing + **************************************************************************************** + */ +uint8_t gapc_smp_pairing_oob_exch(uint8_t conidx, bool accept, struct gapc_oob *oob); + +/** + **************************************************************************************** + * @brief Handles Numeric Value Acceptance as part of pairing(GAPC_BOND_REQ_IND) + * + * @param[in] conidx Connection Index + * @param[in] accept Accept or Reject the numeric comparison + * + * @return status of pairing + **************************************************************************************** + */ +uint8_t gapc_smp_pairing_nc_exch(uint8_t conidx, uint8_t accept); +#endif //(SEC_CON_ENB) + +/** + **************************************************************************************** + * @brief Slave respond to peer device encryption request(GAPC_ENCRYPT_REQ_IND) + * + * @param[in] conidx Connection Index + * @param[in] key_size Encryption key size(7~16) + * @param[in] ltk 16-bytes LTK(Accept) or NULL(Reject) to start encryption + **************************************************************************************** + */ +uint8_t gapc_smp_encrypt_cfm(uint8_t conidx, uint8_t key_size, struct gap_sec_key *ltk); + +#endif // GAPC_API_H_ diff --git a/ble/api/gapm.h b/ble/api/gapm.h new file mode 100644 index 0000000..25e488a --- /dev/null +++ b/ble/api/gapm.h @@ -0,0 +1,1769 @@ +/** + **************************************************************************************** + * + * @file gapm.h + * + * @brief Generic Access Profile Manager Messages. + * + **************************************************************************************** + */ + +#ifndef _GAPM_H_ +#define _GAPM_H_ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include +#include +#include "le_err.h" +#include "task.h" +#include "gap.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +/// GAP Manager Message Interface +/*@TRACE*/ +enum gapm_msg_id +{ + /* Default event */ + /// Command Complete event + GAPM_CMP_EVT = MSG_ID(GAPM, 0x00), + + /* Default commands */ + /// Reset link layer and the host command + GAPM_RESET_CMD = MSG_ID(GAPM, 0x02), + + /* Device Configuration */ + /// Set device configuration command + GAPM_SET_DEV_CONFIG_CMD = MSG_ID(GAPM, 0x04), + /// Set device channel map + GAPM_SET_CHANNEL_MAP_CMD = MSG_ID(GAPM, 0x05), + + /* Local device information */ + /// Get local device info command + GAPM_GET_DEV_INFO_CMD = MSG_ID(GAPM, 0x06), + /// Local device version indication event + GAPM_DEV_VERSION_IND = MSG_ID(GAPM, 0x07), + /// Local device BD Address indication event + GAPM_DEV_BDADDR_IND = MSG_ID(GAPM, 0x08), + /// Advertising channel Tx power level + GAPM_DEV_ADV_TX_POWER_IND = MSG_ID(GAPM, 0x09), + + /// Name of peer device indication + GAPM_PEER_NAME_IND = MSG_ID(GAPM, 0x12), + + /* Security / Encryption Toolbox */ + /// Resolve address command + GAPM_RESOLV_ADDR_CMD = MSG_ID(GAPM, 0x14), + /// Indicate that resolvable random address has been solved + GAPM_ADDR_SOLVED_IND = MSG_ID(GAPM, 0x15), + /// Generate a random address. + GAPM_GEN_RAND_ADDR_CMD = MSG_ID(GAPM, 0x16), + /// Use the AES-128 block in the controller + GAPM_USE_ENC_BLOCK_CMD = MSG_ID(GAPM, 0x17), + /// AES-128 block result indication + GAPM_USE_ENC_BLOCK_IND = MSG_ID(GAPM, 0x18), + /// Generate a 8-byte random number + GAPM_GEN_RAND_NB_CMD = MSG_ID(GAPM, 0x19), + /// Random Number Indication + GAPM_GEN_RAND_NB_IND = MSG_ID(GAPM, 0x1A), + + /* Profile Management */ + /// Create new task for specific profile + GAPM_PROFILE_TASK_ADD_CMD = MSG_ID(GAPM, 0x1B), + /// Inform that profile task has been added. + GAPM_PROFILE_ADDED_IND = MSG_ID(GAPM, 0x1C), + + /// Indicate that a message has been received on an unknown task + GAPM_UNKNOWN_TASK_IND = MSG_ID(GAPM, 0x1D), + + /* Data Length Extension */ + /// Suggested Default Data Length indication + GAPM_SUGG_DFLT_DATA_LEN_IND = MSG_ID(GAPM, 0x1E), + /// Maximum Data Length indication + GAPM_MAX_DATA_LEN_IND = MSG_ID(GAPM, 0x1F), + + /* Resolving list for controller-based privacy*/ + /// Resolving address list address indication + GAPM_RAL_ADDR_IND = MSG_ID(GAPM, 0x22), + + /* Set new IRK */ + /// Modify current IRK + GAPM_SET_IRK_CMD = MSG_ID(GAPM, 0x23), + + /* LE Protocol/Service Multiplexer Management */ + /// Register a LE Protocol/Service Multiplexer command + GAPM_LEPSM_REGISTER_CMD = MSG_ID(GAPM, 0x24), + /// Unregister a LE Protocol/Service Multiplexer command + GAPM_LEPSM_UNREGISTER_CMD = MSG_ID(GAPM, 0x25), + + /* LE Test Mode */ + /// Control of the test mode command + GAPM_LE_TEST_MODE_CTRL_CMD = MSG_ID(GAPM, 0x26), + /// Indicate end of test mode + GAPM_LE_TEST_END_IND = MSG_ID(GAPM, 0x27), + + /// Provide statistic information about ISO exchange + GAPM_ISO_STAT_IND = MSG_ID(GAPM, 0x28), + + /* Secure Connections */ + /// Request to provide DH Key + GAPM_GEN_DH_KEY_CMD = MSG_ID(GAPM, 0x29), + /// Indicates the DH Key computation is complete and available + GAPM_GEN_DH_KEY_IND = MSG_ID(GAPM, 0x2A), + /// Retrieve Public Key + GAPM_GET_PUB_KEY_CMD = MSG_ID(GAPM, 0x2B), + /// Indicates the Public Key Pair value + GAPM_PUB_KEY_IND = MSG_ID(GAPM, 0x2C), + + /* List Management Operations */ + /// Get local or peer address + /// @see struct gapm_get_ral_addr_cmd + GAPM_GET_RAL_ADDR_CMD = MSG_ID(GAPM, 0x90), + /// Set content of either white list or resolving list or periodic advertiser list + /// @see struct gapm_list_set_wl_cmd + /// @see struct gapm_list_set_ral_cmd + /// @see struct gapm_list_set_pal_cmd + GAPM_LIST_SET_CMD = MSG_ID(GAPM, 0x91), + /// Indicate size of list indicated in GAPM_GET_DEV_CONFIG_CMD message + /// @see struct gapm_list_size_ind + GAPM_LIST_SIZE_IND = MSG_ID(GAPM, 0x92), + + /* Extended Air Operations */ + /// Create an advertising, a scanning, an initiating or a periodic synchronization activity + /// @see struct gapm_activity_create_cmd + /// @see struct gapm_activity_create_adv_cmd + GAPM_ACTIVITY_CREATE_CMD = MSG_ID(GAPM, 0xA0), + /// Start a previously created activity + /// @see struct gapm_activity_start_cmd + GAPM_ACTIVITY_START_CMD = MSG_ID(GAPM, 0xA1), + /// Stop either a given activity or all existing activities + /// @see struct gapm_activity_stop_cmd + GAPM_ACTIVITY_STOP_CMD = MSG_ID(GAPM, 0xA2), + /// Delete either a given activity or all existing activities + /// @see struct gapm_activity_delete_cmd + GAPM_ACTIVITY_DELETE_CMD = MSG_ID(GAPM, 0xA3), + /// Indicate that an activity has well been created + /// @see struct gapm_activity_create_ind + GAPM_ACTIVITY_CREATED_IND = MSG_ID(GAPM, 0xA4), + /// Indicate that an activity has been stopped and can be restarted + /// @see struct gapm_activity_stopped_ind + GAPM_ACTIVITY_STOPPED_IND = MSG_ID(GAPM, 0xA5), + /// Set either advertising data or scan response data or periodic advertising data + /// @see struct gapm_set_adv_data_cmd + GAPM_SET_ADV_DATA_CMD = MSG_ID(GAPM, 0xA6), + /// Indicate reception of an advertising report (periodic or not), a scan response report + /// @see struct gapm_ext_adv_report_ind + GAPM_EXT_ADV_REPORT_IND = MSG_ID(GAPM, 0xA7), + /// Indicate reception of a scan request + /// @see struct gapm_scan_request_ind + GAPM_SCAN_REQUEST_IND = MSG_ID(GAPM, 0xA8), + /// Indicate that synchronization has been successfully established with a periodic advertiser + /// @see struct gapm_sync_established_ind + GAPM_SYNC_ESTABLISHED_IND = MSG_ID(GAPM, 0xA9), + /// Indicate maximum advertising data length supported by controller + /// @see struct gapm_max_adv_data_len_ind + GAPM_MAX_ADV_DATA_LEN_IND = MSG_ID(GAPM, 0xAA), + /// Indicate number of available advertising sets + /// @see struct gapm_nb_adv_sets_ind + GAPM_NB_ADV_SETS_IND = MSG_ID(GAPM, 0xAB), + /// Indicate the transmit powers supported by the controller + /// @see struct gapm_dev_tx_power_ind + GAPM_DEV_TX_PWR_IND = MSG_ID(GAPM, 0xAC), + /// Indicate the RF path compensation values + /// @see struct gapm_dev_rf_path_comp_ind + GAPM_DEV_RF_PATH_COMP_IND = MSG_ID(GAPM, 0xAD), +}; + + +/// GAP Manager operation type - application interface +/*@TRACE*/ +enum gapm_operation +{ + /* No Operation (if nothing has been requested) */ + /* ************************************************ */ + /// No operation. + GAPM_NO_OP = 0x00, + + /* Default operations */ + /* ************************************************ */ + /// Reset BLE subsystem: LL and HL. + GAPM_RESET = 0x01, + + /* Configuration operations */ + /* ************************************************ */ + /// Set device configuration + GAPM_SET_DEV_CONFIG = 0x03, + /// Set device channel map + GAPM_SET_CHANNEL_MAP = 0x04, + + /* Retrieve device information */ + /* ************************************************ */ + /// Get Local device version + GAPM_GET_DEV_VERSION = 0x05, + /// Get Local device BD Address + GAPM_GET_DEV_BDADDR = 0x06, + /// Get device advertising power level + GAPM_GET_DEV_ADV_TX_POWER = 0x07, + /// Get White List Size. + GAPM_GET_WLIST_SIZE = 0x08, + + /* Security / Encryption Toolbox */ + /* ************************************************ */ + /// Resolve device address + GAPM_RESOLV_ADDR = 0x17, + /// Generate a random address + GAPM_GEN_RAND_ADDR = 0x18, + /// Use the controller's AES-128 block + GAPM_USE_ENC_BLOCK = 0x19, + /// Generate a 8-byte random number + GAPM_GEN_RAND_NB = 0x1A, + + /* Profile Management */ + /* ************************************************ */ + /// Create new task for specific profile + GAPM_PROFILE_TASK_ADD = 0x1B, + + /* DEBUG */ + /* ************************************************ */ + /// Get memory usage + GAPM_DBG_GET_MEM_INFO = 0x1C, + /// Perform a platform reset + GAPM_PLF_RESET = 0x1D, + + /* Data Length Extension */ + /* ************************************************ */ + /// Set Suggested Default LE Data Length + GAPM_SET_SUGGESTED_DFLT_LE_DATA_LEN = 0x1E, + /// Get Suggested Default LE Data Length + GAPM_GET_SUGGESTED_DFLT_LE_DATA_LEN = 0x1F, + /// Get Maximum LE Data Length + GAPM_GET_MAX_LE_DATA_LEN = 0x20, + + /* Operation on Resolving List */ + /* ************************************************ */ + /// Get resolving address list size + GAPM_GET_RAL_SIZE = 0x21, + /// Get resolving local address + GAPM_GET_RAL_LOC_ADDR = 0x22, + /// Get resolving peer address + GAPM_GET_RAL_PEER_ADDR = 0x23, + + /* Change current IRK */ + /* ************************************************ */ + /// Set IRK + GAPM_SET_IRK = 0x28, + + /* LE Protocol/Service Multiplexer management */ + /* ************************************************ */ + /// Register a LE Protocol/Service Multiplexer + GAPM_LEPSM_REG = 0x29, + /// Unregister a LE Protocol/Service Multiplexer + GAPM_LEPSM_UNREG = 0x2A, + + /* LE Direct Test Mode */ + /* ************************************************ */ + /// Stop the test mode + GAPM_LE_TEST_STOP = 0x2B, + /// Start RX Test Mode + GAPM_LE_TEST_RX_START = 0x2C, + /// Start TX Test Mode + GAPM_LE_TEST_TX_START = 0x2D, + + /* Secure Connection */ + /* ************************************************ */ + /// Generate DH_Key + GAPM_GEN_DH_KEY = 0x2E, + /// Retrieve Public Key + GAPM_GET_PUB_KEY = 0x2F, + + /* List Management */ + /* ************************************************ */ + /// Set content of white list + GAPM_SET_WL = 0x90, + /// Set content of resolving list + GAPM_SET_RAL = 0x91, + /// Set content of periodic advertiser list + GAPM_SET_PAL = 0x92, + /// Get periodic advertiser list size + GAPM_GET_PAL_SIZE = 0x95, + + /* Air Operations */ + /* ************************************************ */ + /// Create advertising activity + GAPM_CREATE_ADV_ACTIVITY = 0xA0, + /// Create scanning activity + GAPM_CREATE_SCAN_ACTIVITY = 0xA1, + /// Create initiating activity + GAPM_CREATE_INIT_ACTIVITY = 0xA2, + /// Create periodic synchronization activity + GAPM_CREATE_PERIOD_SYNC_ACTIVITY = 0xA3, + /// Start an activity + GAPM_START_ACTIVITY = 0xA4, + /// Stop an activity + GAPM_STOP_ACTIVITY = 0xA5, + /// Stop all activities + GAPM_STOP_ALL_ACTIVITIES = 0xA6, + /// Delete an activity + GAPM_DELETE_ACTIVITY = 0xA7, + /// Delete all activities + GAPM_DELETE_ALL_ACTIVITIES = 0xA8, + /// Set advertising data + GAPM_SET_ADV_DATA = 0xA9, + /// Set scan response data + GAPM_SET_SCAN_RSP_DATA = 0xAA, + /// Set periodic advertising data + GAPM_SET_PERIOD_ADV_DATA = 0xAB, + /// Get number of available advertising sets + GAPM_GET_NB_ADV_SETS = 0xAC, + /// Get maximum advertising data length supported by the controller + GAPM_GET_MAX_LE_ADV_DATA_LEN = 0xAD, + /// Get minimum and maximum transmit powers supported by the controller + GAPM_GET_DEV_TX_PWR = 0xAE, + /// Get the RF Path Compensation values used in the TX Power Level and RSSI calculation + GAPM_GET_DEV_RF_PATH_COMP = 0xAF, +}; + +/// Own BD address source of the device +enum gapm_own_addr +{ + /// Public or Private Static Address according to device address configuration + GAPM_STATIC_ADDR, + /// Generated resolvable private random address + GAPM_GEN_RSLV_ADDR, + /// Generated non-resolvable private random address + GAPM_GEN_NON_RSLV_ADDR, +}; + +/// Pairing mode authorized on the device +/// 7 6 5 4 3 2 1 0 +/// +----+----+----+----+----+----+----+----+ +/// |KGEN| RFU | SCP| LP | +/// +----+----+----+----+----+----+----+----+ +enum gapm_pairing_mode +{ + /// No pairing authorized + GAPM_PAIRING_DISABLE = 0, + /// Legacy pairing Authorized + GAPM_PAIRING_LEGACY = (1 << 0), + /// Secure Connection pairing Authorized + GAPM_PAIRING_SEC_CON = (1 << 1), + + + /// Force re-generation of P256 private and public keys + GAPM_PAIRING_FORCE_P256_KEY_GEN = (1<<7), +}; + +/// Security level +/// 7 6 5 4 3 2 1 0 +/// +---+---+---+---+---+---+---+---+ +/// |MI | RFU |EKS|SEC_LVL| +/// +---+---+---+---+---+---+---+---+ +/// bit[0-1]: Security level requirement (0=NO_AUTH, 1=UNAUTH, 2=AUTH, 3=SEC_CON) +/// bit[2] : Encryption Key Size length must have 16 bytes +/// bit[7] : Multi-instantiated task +enum gapm_le_psm_sec_mask +{ + /// bit[0-1]: Security level requirement (0=NO_AUTH, 1=UNAUTH, 2=AUTH, 3=SEC_CON) + /// bit[2] : Encryption Key Size length must have 16 bytes + GAPM_LE_PSM_SEC_LVL_MASK = 0x07, + /// bit[7] : Multi-instantiated task + GAPM_LE_PSM_MI_TASK_MASK = 0x80, +}; + +/// Type of activities that can be created +/*@TRACE*/ +enum gapm_actv_type +{ + /// Advertising activity + GAPM_ACTV_TYPE_ADV = 0, + /// Scanning activity + GAPM_ACTV_TYPE_SCAN, + /// Initiating activity + GAPM_ACTV_TYPE_INIT, + /// Periodic synchronization activity + GAPM_ACTV_TYPE_PER_SYNC, +}; + +/// Type of advertising that can be created +enum gapm_adv_type +{ + /// Legacy advertising + GAPM_ADV_TYPE_LEGACY = 0, + /// Extended advertising + GAPM_ADV_TYPE_EXTENDED, + /// Periodic advertising + GAPM_ADV_TYPE_PERIODIC, +}; + +/// Advertising report type +enum gapm_adv_report_type +{ + /// Extended advertising report + GAPM_REPORT_TYPE_ADV_EXT = 0, + /// Legacy advertising report + GAPM_REPORT_TYPE_ADV_LEG, + /// Extended scan response report + GAPM_REPORT_TYPE_SCAN_RSP_EXT, + /// Legacy scan response report + GAPM_REPORT_TYPE_SCAN_RSP_LEG, + /// Periodic advertising report + GAPM_REPORT_TYPE_PER_ADV, +}; + +/// Advertising properties bit field bit positions +enum gapm_adv_prop_pos +{ + /// Indicate that advertising is connectable, reception of CONNECT_REQ or AUX_CONNECT_REQ + /// PDUs is accepted. Not applicable for periodic advertising. + GAPM_ADV_PROP_CONNECTABLE_POS = 0, + /// Indicate that advertising is scannable, reception of SCAN_REQ or AUX_SCAN_REQ PDUs is + /// accepted + GAPM_ADV_PROP_SCANNABLE_POS = 1, + /// Indicate that advertising targets a specific device. Only apply in following cases: + /// - Legacy advertising: if connectable + /// - Extended advertising: connectable or (non connectable and non discoverable) + GAPM_ADV_PROP_DIRECTED_POS = 2, + /// Indicate that High Duty Cycle has to be used for advertising on primary channel + /// Apply only if created advertising is not an extended advertising + GAPM_ADV_PROP_HDC_POS = 3, + /// Bit 4 is reserved + GAPM_ADV_PROP_RESERVED_4_POS = 4, + /// Enable anonymous mode. Device address won't appear in send PDUs + /// Valid only if created advertising is an extended advertising + GAPM_ADV_PROP_ANONYMOUS_POS = 5, + /// Include TX Power in the extended header of the advertising PDU. + /// Valid only if created advertising is not a legacy advertising + GAPM_ADV_PROP_TX_PWR_POS = 6, + /// Include TX Power in the periodic advertising PDU. + /// Valid only if created advertising is a periodic advertising + GAPM_ADV_PROP_PER_TX_PWR_POS = 7, + /// Indicate if application must be informed about received scan requests PDUs + GAPM_ADV_PROP_SCAN_REQ_NTF_EN_POS = 8, +}; + +/// Advertising properties bit field bit value +enum gapm_adv_prop +{ + /// Indicate that advertising is connectable, reception of CONNECT_REQ or AUX_CONNECT_REQ + /// PDUs is accepted. Not applicable for periodic advertising. + GAPM_ADV_PROP_CONNECTABLE_BIT = (1 << GAPM_ADV_PROP_CONNECTABLE_POS), + /// Indicate that advertising is scannable, reception of SCAN_REQ or AUX_SCAN_REQ PDUs is + /// accepted + GAPM_ADV_PROP_SCANNABLE_BIT = (1 << GAPM_ADV_PROP_SCANNABLE_POS), + /// Indicate that advertising targets a specific device. Only apply in following cases: + /// - Legacy advertising: if connectable + /// - Extended advertising: connectable or (non connectable and non discoverable) + GAPM_ADV_PROP_DIRECTED_BIT = (1 << GAPM_ADV_PROP_DIRECTED_POS), + /// Indicate that High Duty Cycle has to be used for advertising on primary channel + /// Apply only if created advertising is not an extended advertising + GAPM_ADV_PROP_HDC_BIT = (1 << GAPM_ADV_PROP_HDC_POS), + /// Bit 4 is reserved + GAPM_ADV_PROP_RESERVED_4_BIT = (1 << GAPM_ADV_PROP_RESERVED_4_POS), + /// Enable anonymous mode. Device address won't appear in send PDUs + /// Valid only if created advertising is an extended advertising + GAPM_ADV_PROP_ANONYMOUS_BIT = (1 << GAPM_ADV_PROP_ANONYMOUS_POS), + /// Include TX Power in the extended header of the advertising PDU. + /// Valid only if created advertising is not a legacy advertising + GAPM_ADV_PROP_TX_PWR_BIT = (1 << GAPM_ADV_PROP_TX_PWR_POS), + /// Include TX Power in the periodic advertising PDU. + /// Valid only if created advertising is a periodic advertising + GAPM_ADV_PROP_PER_TX_PWR_BIT = (1 << GAPM_ADV_PROP_PER_TX_PWR_POS), + /// Indicate if application must be informed about received scan requests PDUs + GAPM_ADV_PROP_SCAN_REQ_NTF_EN_BIT = (1 << GAPM_ADV_PROP_SCAN_REQ_NTF_EN_POS), +}; + +/// Advertising filter policy +enum gapm_adv_filter_policy +{ + /// Allow both scan and connection requests from anyone + GAPM_ADV_ALLOW_SCAN_ANY_CON_ANY = 0x00, + /// Allow both scan req from White List devices only and connection req from anyone + GAPM_ADV_ALLOW_SCAN_WLST_CON_ANY, + /// Allow both scan req from anyone and connection req from White List devices only + GAPM_ADV_ALLOW_SCAN_ANY_CON_WLST, + /// Allow scan and connection requests from White List devices only + GAPM_ADV_ALLOW_SCAN_WLST_CON_WLST, +}; + +/// Advertising discovery mode +enum gapm_adv_disc_mode +{ + /// Mode in non-discoverable + GAPM_ADV_MODE_NON_DISC = 0, + /// Mode in general discoverable + GAPM_ADV_MODE_GEN_DISC, + /// Mode in limited discoverable + GAPM_ADV_MODE_LIM_DISC, + /// Broadcast mode without presence of AD_TYPE_FLAG in advertising data + GAPM_ADV_MODE_BEACON, + GAPM_ADV_MODE_MAX, +}; + +/// Scanning Types +enum gapm_scan_type +{ + /// General discovery + GAPM_SCAN_TYPE_GEN_DISC = 0, + /// Limited discovery + GAPM_SCAN_TYPE_LIM_DISC, + /// Observer + GAPM_SCAN_TYPE_OBSERVER, + /// Selective observer + GAPM_SCAN_TYPE_SEL_OBSERVER, + /// Connectable discovery + GAPM_SCAN_TYPE_CONN_DISC, + /// Selective connectable discovery + GAPM_SCAN_TYPE_SEL_CONN_DISC, +}; + +/// Scanning properties bit field bit value +enum gapm_scan_prop +{ + /// Scan advertisement on the LE 1M PHY + GAPM_SCAN_PROP_PHY_1M_BIT = (1 << 0), + /// Scan advertisement on the LE Coded PHY + GAPM_SCAN_PROP_PHY_CODED_BIT = (1 << 1), + /// Active scan on LE 1M PHY (Scan Request PDUs may be sent) + GAPM_SCAN_PROP_ACTIVE_1M_BIT = (1 << 2), + /// Active scan on LE Coded PHY (Scan Request PDUs may be sent) + GAPM_SCAN_PROP_ACTIVE_CODED_BIT = (1 << 3), + /// Accept directed advertising packets if we use a RPA and target address cannot be solved by the + /// controller + GAPM_SCAN_PROP_ACCEPT_RPA_BIT = (1 << 4), + /// Filter truncated advertising or scan response reports + GAPM_SCAN_PROP_FILT_TRUNC_BIT = (1 << 5), +}; + +/// Initiating Types +enum gapm_init_type +{ + /// Direct connection establishment, establish a connection with an indicated device + GAPM_INIT_TYPE_DIRECT_CONN_EST = 0, + /// Automatic connection establishment, establish a connection with all devices whose address is + /// present in the white list + GAPM_INIT_TYPE_AUTO_CONN_EST, + /// Name discovery, Establish a connection with an indicated device in order to read content of its + /// Device Name characteristic. Connection is closed once this operation is stopped. + GAPM_INIT_TYPE_NAME_DISC, +}; + +/// Initiating Properties +enum gapm_init_prop +{ + /// Scan connectable advertisements on the LE 1M PHY. Connection parameters for the LE 1M PHY are provided + GAPM_INIT_PROP_1M_BIT = (1 << 0), + /// Connection parameters for the LE 2M PHY are provided + GAPM_INIT_PROP_2M_BIT = (1 << 1), + /// Scan connectable advertisements on the LE Coded PHY. Connection parameters for the LE Coded PHY are provided + GAPM_INIT_PROP_CODED_BIT = (1 << 2), +}; + +/// Advertising report information +enum gapm_adv_report_info +{ + /// Report Type + GAPM_REPORT_INFO_REPORT_TYPE_MASK = 0x07, + /// Report is complete + GAPM_REPORT_INFO_COMPLETE_BIT = (1 << 3), + /// Connectable advertising + GAPM_REPORT_INFO_CONN_ADV_BIT = (1 << 4), + /// Scannable advertising + GAPM_REPORT_INFO_SCAN_ADV_BIT = (1 << 5), + /// Directed advertising + GAPM_REPORT_INFO_DIR_ADV_BIT = (1 << 6), +}; + +/// Filtering policy for duplicated packets +enum gapm_dup_filter_pol +{ + /// Disable filtering of duplicated packets + GAPM_DUP_FILT_DIS = 0, + /// Enable filtering of duplicated packets + GAPM_DUP_FILT_EN, + /// Enable filtering of duplicated packets, reset for each scan period + GAPM_DUP_FILT_EN_PERIOD, +}; + +/// Periodic synchronization types +enum gapm_per_sync_type +{ + /// Do not use periodic advertiser list for synchronization. Use advertiser information provided + /// in the GAPM_ACTIVITY_START_CMD. + GAPM_PER_SYNC_TYPE_GENERAL = 0, + /// Use periodic advertiser list for synchronization + GAPM_PER_SYNC_TYPE_SELECTIVE, +}; + +/// PHY Type +enum gapm_phy_type +{ + /// LE 1M + GAPM_PHY_TYPE_LE_1M = 0, + /// LE 2M + GAPM_PHY_TYPE_LE_2M, + /// LE Coded + GAPM_PHY_TYPE_LE_CODED, +}; + +/// ------------------------------------------------------------------------------------- +/// Masks for advertising properties +/// ------------------------------------------------------------------------------------- + +/// Advertising properties configurations for legacy advertising +enum gapm_leg_adv_prop +{ + /// Non connectable non scannable advertising + GAPM_ADV_PROP_NON_CONN_NON_SCAN_MASK = 0x0000, + /// Broadcast non scannable advertising - Discovery mode must be Non Discoverable + GAPM_ADV_PROP_BROADCAST_NON_SCAN_MASK = GAPM_ADV_PROP_NON_CONN_NON_SCAN_MASK, + /// Non connectable scannable advertising + GAPM_ADV_PROP_NON_CONN_SCAN_MASK = GAPM_ADV_PROP_SCANNABLE_BIT, + /// Broadcast non scannable advertising - Discovery mode must be Non Discoverable + GAPM_ADV_PROP_BROADCAST_SCAN_MASK = GAPM_ADV_PROP_NON_CONN_SCAN_MASK, + /// Undirected connectable advertising + GAPM_ADV_PROP_UNDIR_CONN_MASK = GAPM_ADV_PROP_CONNECTABLE_BIT | GAPM_ADV_PROP_SCANNABLE_BIT, + /// Directed connectable advertising + GAPM_ADV_PROP_DIR_CONN_MASK = GAPM_ADV_PROP_DIRECTED_BIT | GAPM_ADV_PROP_CONNECTABLE_BIT, + /// Directed connectable with Low Duty Cycle + GAPM_ADV_PROP_DIR_CONN_LDC_MASK = GAPM_ADV_PROP_DIR_CONN_MASK, + /// Directed connectable with High Duty Cycle + GAPM_ADV_PROP_DIR_CONN_HDC_MASK = GAPM_ADV_PROP_DIR_CONN_MASK | GAPM_ADV_PROP_HDC_BIT, +}; + +/// Advertising properties configurations for extended advertising +enum gapm_ext_adv_prop +{ + /// Non connectable non scannable extended advertising + GAPM_EXT_ADV_PROP_NON_CONN_NON_SCAN_MASK = 0x0000, + /// Non connectable scannable extended advertising + GAPM_EXT_ADV_PROP_NON_CONN_SCAN_MASK = GAPM_ADV_PROP_SCANNABLE_BIT, + /// Non connectable scannable directed extended advertising + GAPM_EXT_ADV_PROP_NON_CONN_SCAN_DIR_MASK = GAPM_ADV_PROP_SCANNABLE_BIT | GAPM_ADV_PROP_DIRECTED_BIT, + /// Non connectable anonymous directed extended advertising + GAPM_EXT_ADV_PROP_ANONYM_DIR_MASK = GAPM_ADV_PROP_ANONYMOUS_BIT | GAPM_ADV_PROP_DIRECTED_BIT, + /// Undirected connectable extended advertising + GAPM_EXT_ADV_PROP_UNDIR_CONN_MASK = GAPM_ADV_PROP_CONNECTABLE_BIT, + /// Directed connectable extended advertising + GAPM_EXT_ADV_PROP_DIR_CONN_MASK = GAPM_ADV_PROP_CONNECTABLE_BIT | GAPM_ADV_PROP_DIRECTED_BIT, +}; + +/// Advertising properties configurations for periodic advertising +enum gapm_per_adv_prop +{ + /// Undirected periodic advertising + GAPM_PER_ADV_PROP_UNDIR_MASK = 0x0000, + /// Directed periodic advertising + GAPM_PER_ADV_PROP_DIR_MASK = GAPM_ADV_PROP_DIRECTED_BIT, +}; + +/// Clock accuracy values +enum gapm_clk_acc +{ + /// 500 ppm + GAPM_CLK_ACC_500 = 0, + /// 250 ppm + GAPM_CLK_ACC_250, + /// 150 ppm + GAPM_CLK_ACC_150, + /// 100 ppm + GAPM_CLK_ACC_100, + /// 75 ppm + GAPM_CLK_ACC_75, + /// 50 ppm + GAPM_CLK_ACC_50, + /// 30 ppm + GAPM_CLK_ACC_30, + /// 20 ppm + GAPM_CLK_ACC_20, +}; + +/// Privacy configuration +enum gapm_priv_cfg +{ + /// Indicate if identity address is a public (0) or static private random (1) address + GAPM_PRIV_CFG_PRIV_ADDR_BIT = (1 << 0), + /// Reserved + GAPM_PRIV_CFG_RSVD = (1 << 1), + /// Indicate if controller privacy is enabled + GAPM_PRIV_CFG_PRIV_EN_BIT = (1 << 2), +}; + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Configuration for advertising on primary channel +/*@TRACE*/ +struct gapm_adv_prim_cfg +{ + /// Minimum advertising interval (in unit of 625us). Must be greater than 20ms + uint32_t adv_intv_min; + /// Maximum advertising interval (in unit of 625us). Must be greater than 20ms + uint32_t adv_intv_max; + /// Bit field indicating the channel mapping + uint8_t chnl_map; + /// Indicate on which PHY primary advertising has to be performed (@see enum gapm_phy_type) + /// Note that LE 2M PHY is not allowed and that legacy advertising only support LE 1M PHY + uint8_t phy; +}; + +/// Configuration for advertising on secondary channel +struct gapm_adv_second_cfg +{ + /// Maximum number of advertising events the controller can skip before sending the + /// AUX_ADV_IND packets. 0 means that AUX_ADV_IND PDUs shall be sent prior each + /// advertising events + uint8_t max_skip; + /// Indicate on which PHY secondary advertising has to be performed (@see enum gapm_phy_type) + uint8_t phy; + /// Advertising SID + uint8_t adv_sid; +}; + +/// Configuration for periodic advertising +struct gapm_adv_period_cfg +{ + /// Minimum advertising interval (in unit of 1.25ms). Must be greater than 20ms + uint16_t adv_intv_min; + /// Maximum advertising interval (in unit of 1.25ms). Must be greater than 20ms + uint16_t adv_intv_max; +}; + +/// Advertising parameters for advertising creation +struct gapm_adv_create_param +{ + /// Advertising type (@see enum gapm_adv_type) + uint8_t type; + /// Discovery mode (@see enum gapm_adv_disc_mode) + uint8_t disc_mode; + /// Bit field value provided advertising properties (@see enum gapm_adv_prop for bit signification) + uint16_t prop; + /// Maximum power level at which the advertising packets have to be transmitted + /// (between -127 and 126 dBm) + int8_t max_tx_pwr; + /// Advertising filtering policy (@see enum gapm_adv_filter_policy) + uint8_t filter_pol; + /// Peer address configuration (only used in case of directed advertising) + struct gap_bdaddr peer_addr; + /// Configuration for primary advertising + struct gapm_adv_prim_cfg prim_cfg; + /// Configuration for secondary advertising (valid only if advertising type is + /// GAPM_ADV_TYPE_EXTENDED or GAPM_ADV_TYPE_PERIODIC) + struct gapm_adv_second_cfg second_cfg; + /// Configuration for periodic advertising (valid only if advertising type os + /// GAPM_ADV_TYPE_PERIODIC) + struct gapm_adv_period_cfg period_cfg; +}; + +/// Additional advertising parameters +/*@TRACE*/ +struct gapm_adv_param +{ + /// Advertising duration (in unit of 10ms). 0 means that advertising continues + /// until the host disable it + uint16_t duration; + /// Maximum number of extended advertising events the controller shall attempt to send prior to + /// terminating the extending advertising + /// Valid only if extended advertising + uint8_t max_adv_evt; +}; + +/// Scan Window operation parameters +/*@TRACE*/ +struct gapm_scan_wd_op_param +{ + /// Scan interval + uint16_t scan_intv; + /// Scan window + uint16_t scan_wd; +}; + +/// Scanning parameters +/*@TRACE*/ +struct gapm_scan_param +{ + /// Type of scanning to be started (@see enum gapm_scan_type) + uint8_t type; + /// Properties for the scan procedure (@see enum gapm_scan_prop for bit signification) + uint8_t prop; + /// Duplicate packet filtering policy + uint8_t dup_filt_pol; + /// Reserved for future use + uint8_t rsvd; + /// Scan window opening parameters for LE 1M PHY + struct gapm_scan_wd_op_param scan_param_1m; + /// Scan window opening parameters for LE Coded PHY + struct gapm_scan_wd_op_param scan_param_coded; + /// Scan duration (in unit of 10ms). 0 means that the controller will scan continuously until + /// reception of a stop command from the application + uint16_t duration; + /// Scan period (in unit of 1.28s). Time interval betweem two consequent starts of a scan duration + /// by the controller. 0 means that the scan procedure is not periodic + uint16_t period; +}; + +/// Connection parameters +/*@TRACE*/ +struct gapm_conn_param +{ + /// Minimum value for the connection interval (in unit of 1.25ms). Shall be less than or equal to + /// conn_intv_max value. Allowed range is 7.5ms to 4s. + uint16_t conn_intv_min; + /// Maximum value for the connection interval (in unit of 1.25ms). Shall be greater than or equal to + /// conn_intv_min value. Allowed range is 7.5ms to 4s. + uint16_t conn_intv_max; + /// Slave latency. Number of events that can be missed by a connected slave device + uint16_t conn_latency; + /// Link supervision timeout (in unit of 10ms). Allowed range is 100ms to 32s + uint16_t supervision_to; + /// Recommended minimum duration of connection events (in unit of 625us) + uint16_t ce_len_min; + /// Recommended maximum duration of connection events (in unit of 625us) + uint16_t ce_len_max; +}; + +/// Initiating parameters +/*@TRACE*/ +struct gapm_init_param +{ + /// Initiating type (@see enum gapm_init_type) + uint8_t type; + /// Properties for the initiating procedure (@see enum gapm_init_prop for bit signification) + uint8_t prop; + /// Timeout for automatic connection establishment (in unit of 10ms). Cancel the procedure if not all + /// indicated devices have been connected when the timeout occurs. 0 means there is no timeout + uint16_t conn_to; + /// Scan window opening parameters for LE 1M PHY + struct gapm_scan_wd_op_param scan_param_1m; + /// Scan window opening parameters for LE Coded PHY + struct gapm_scan_wd_op_param scan_param_coded; + /// Connection parameters for LE 1M PHY + struct gapm_conn_param conn_param_1m; + /// Connection parameters for LE 2M PHY + struct gapm_conn_param conn_param_2m; + /// Connection parameters for LE Coded PHY + struct gapm_conn_param conn_param_coded; + /// Address of peer device in case white list is not used for connection + struct gap_bdaddr peer_addr; +}; + +/// Periodic advertising information +/*@TRACE*/ +struct gapm_period_adv_addr_cfg +{ + /// Advertiser address information + struct gap_bdaddr addr; + /// Advertising SID + uint8_t adv_sid; +}; + +/// Periodic synchronization parameters +/*@TRACE*/ +struct gapm_per_sync_param +{ + /// Number of periodic advertising that can be skipped after a successful receive. Maximum authorized + /// value is 499 + uint16_t skip; + /// Synchronization timeout for the periodic advertising (in unit of 10ms between 100ms and 163.84s) + uint16_t sync_to; + /// Periodic synchronization type (@see enum gapm_per_sync_type) + uint8_t type; + /// Reserved for future use + uint8_t rsvd; + /// Address of advertiser with which synchronization has to be established (used only if use_pal is false) + struct gapm_period_adv_addr_cfg adv_addr; +}; + +/// Operation command structure in order to keep requested operation. +struct gapm_operation_cmd +{ + /// GAP request type + uint8_t operation; +}; + +/// Command complete event data structure +/*@TRACE*/ +struct gapm_cmp_evt +{ + /// GAP requested operation + uint8_t operation; + /// Status of the request + uint8_t status; +}; + +/// Reset link layer and the host command +/*@TRACE*/ +struct gapm_reset_cmd +{ + /// GAPM requested operation: + /// - GAPM_RESET: Reset BLE subsystem: LL and HL. + uint8_t operation; +}; + +/// Set new IRK +/*@TRACE*/ +struct gapm_set_irk_cmd +{ + /// GAPM requested operation: + /// - GAPM_SET_IRK: Set device configuration + uint8_t operation; + /// Device IRK used for resolvable random BD address generation (LSB first) + struct gap_sec_key irk; +}; + +/// Set device channel map +/*@TRACE*/ +struct gapm_set_channel_map_cmd +{ + /// GAPM requested operation: + /// - GAPM_SET_CHANNEL_MAP: Set device channel map. + uint8_t operation; + /// Channel map + le_chnl_map_t chmap; +}; + +/// Get local device info command +/*@TRACE*/ +struct gapm_get_dev_info_cmd +{ + /// GAPM requested operation: + /// - GAPM_GET_DEV_VERSION: Get Local device version + /// - GAPM_GET_DEV_BDADDR: Get Local device BD Address + /// - GAPM_GET_DEV_ADV_TX_POWER: Get device advertising power level + /// - GAPM_DBG_GET_MEM_INFO: Get memory usage (debug only) + uint8_t operation; +}; + +/// Local device version indication event +/*@TRACE*/ +struct gapm_dev_version_ind +{ + /// HCI version + uint8_t hci_ver; + /// LMP version + uint8_t lmp_ver; + /// Host version + uint8_t host_ver; + /// HCI revision + uint16_t hci_subver; + /// LMP subversion + uint16_t lmp_subver; + /// Host revision + uint16_t host_subver; + /// Manufacturer name + uint16_t manuf_name; +}; + +/// Local device BD Address indication event +/*@TRACE*/ +struct gapm_dev_bdaddr_ind +{ + /// Local device address information + struct gap_bdaddr addr; + /// Activity index + uint8_t actv_idx; +}; + +/// Advertising channel Tx power level indication event +/*@TRACE*/ +struct gapm_dev_adv_tx_power_ind +{ + /// Advertising channel Tx power level + int8_t power_lvl; +}; + +/// Resolving Address indication event +/*@TRACE*/ +struct gapm_ral_addr_ind +{ + /// Peer or local read operation + uint8_t operation; + /// Resolving List address + struct gap_bdaddr addr; +}; + +/// Resolve Address command +/*@TRACE*/ +struct gapm_resolv_addr_cmd +{ + /// GAPM requested operation: + /// - GAPM_RESOLV_ADDR: Resolve device address + uint8_t operation; + /// Number of provided IRK (sahlle be > 0) + uint8_t nb_key; + /// Resolvable random address to solve + bd_addr_t addr; + /// Array of IRK used for address resolution (MSB -> LSB) + struct gap_sec_key irk[]; +}; + +/// Indicate that resolvable random address has been solved +/*@TRACE*/ +struct gapm_addr_solved_ind +{ + /// Resolvable random address solved + bd_addr_t addr; + /// IRK that correctly solved the random address + struct gap_sec_key irk; +}; + +/// Name of peer device indication +/*@TRACE*/ +struct gapm_peer_name_ind +{ + /// peer device bd address + bd_addr_t addr; + /// peer device address type + uint8_t addr_type; + /// peer device name length + uint8_t name_len; + /// peer device name + uint8_t name[]; +}; + +/// Generate a random address. +/*@TRACE*/ +struct gapm_gen_rand_addr_cmd +{ + /// GAPM requested operation: + /// - GAPM_GEN_RAND_ADDR: Generate a random address + uint8_t operation; + /// Dummy parameter used to store the prand part of the address + uint8_t prand[GAP_ADDR_PRAND_LEN]; + /// Random address type @see gap_rnd_addr_type + /// - GAP_STATIC_ADDR: Static random address + /// - GAP_NON_RSLV_ADDR: Private non resolvable address + /// - GAP_RSLV_ADDR: Private resolvable address + uint8_t rnd_type; +}; + +/// Parameters of the @ref GAPM_USE_ENC_BLOCK_CMD message +/*@TRACE*/ +struct gapm_use_enc_block_cmd +{ + /// Command Operation Code (shall be GAPM_USE_ENC_BLOCK) + uint8_t operation; + /// Operand 1 + uint8_t operand_1[GAP_KEY_LEN]; + /// Operand 2 + uint8_t operand_2[GAP_KEY_LEN]; +}; + +/// Parameters of the @ref GAPM_USE_ENC_BLOCK_IND message +/*@TRACE*/ +struct gapm_use_enc_block_ind +{ + /// Result (16 bytes) + uint8_t result[GAP_KEY_LEN]; +}; + +/// Parameters of the @ref GAPM_GEN_DH_KEY_CMD message +/*@TRACE*/ +struct gapm_gen_dh_key_cmd +{ + /// Command Operation Code (shall be GAPM_GEN_DH_KEY) + uint8_t operation; + /// X coordinate + uint8_t operand_1[GAP_P256_KEY_LEN]; + /// Y coordinate + uint8_t operand_2[GAP_P256_KEY_LEN]; +}; + +/// Parameters of the @ref GAPM_GEN_DH_KEY_IND message +/*@TRACE*/ +struct gapm_gen_dh_key_ind +{ + /// Result (32 bytes) + uint8_t result[GAP_P256_KEY_LEN]; +}; + +/// Parameters of the @ref GAPM_GET_PUB_KEY_CMD message +/*@TRACE*/ +struct gapm_get_pub_key_cmd +{ + /// Command Operation Code (shall be GAPM_GET_PUB_KEY) + uint8_t operation; + /// 1 to renew, 0 to read current value + uint8_t renew; +}; + +/// Parameters of the @ref GAPM_PUB_KEY_IND message +/*@TRACE*/ +struct gapm_pub_key_ind +{ + /// X coordinate + uint8_t pub_key_x[GAP_P256_KEY_LEN]; + /// Y coordinate + uint8_t pub_key_y[GAP_P256_KEY_LEN]; +}; + +/// Parameters of the @ref GAPM_GEN_RAND_NB_CMD message +/*@TRACE*/ +struct gapm_gen_rand_nb_cmd +{ + /// Command Operation Code (shall be GAPM_GEN_RAND_NB) + uint8_t operation; +}; + +/// Parameters of the @ref GAPM_GEN_RAND_NB_IND message +/*@TRACE*/ +struct gapm_gen_rand_nb_ind +{ + /// Generation Random Number (8 bytes) + rand_nb_t randnb; +}; + +/// Create new task for specific profile +/*@TRACE*/ +struct gapm_profile_task_add_cmd +{ + /// GAPM requested operation: + /// - GAPM_PROFILE_TASK_ADD: Add new profile task + uint8_t operation; + /// Security Level : + /// 7 6 5 4 3 2 1 0 + /// +----+----+----+----+----+----+----+----+ + /// | Reserved |DIS | AUTH |EKS | MI | + /// +----+----+----+----+----+----+----+----+ + /// + /// - MI: 1 - Application task is a Multi-Instantiated task, 0 - Mono-Instantiated + /// Only applies for service - Ignored by collectors: + /// - EKS: Service needs a 16 bytes encryption key + /// - AUTH: 0 - Disable, 1 - Enable, 2 - Unauth, 3 - Auth + /// - DIS: Disable the service + uint8_t sec_lvl; + /// Profile task identifier + uint16_t prf_task_id; + /// Application task number + uint16_t app_task; + /// Service start handle + /// Only applies for services - Ignored by collectors + /// 0: dynamically allocated in Attribute database + uint16_t start_hdl; + /// 32 bits value that contains value to initialize profile (database parameters, etc...) + uint32_t param[]; +}; + +/// Inform that profile task has been added. +/*@TRACE*/ +struct gapm_profile_added_ind +{ + /// Profile task identifier + uint16_t prf_task_id; + /// Profile task number allocated + uint16_t prf_task_nb; + /// Service start handle + /// Only applies for services - Ignored by collectors + uint16_t start_hdl; +}; + +/// Indicate that a message has been received on an unknown task +/*@TRACE*/ +struct gapm_unknown_task_ind +{ + /// Message identifier + uint16_t msg_id; + /// Task identifier + uint16_t task_id; +}; + +/// Indicates suggested default data length +/*@TRACE*/ +struct gapm_sugg_dflt_data_len_ind +{ + /// Host's suggested value for the Controller's maximum transmitted number of payload octets + uint16_t suggted_max_tx_octets; + /// Host's suggested value for the Controller's maximum packet transmission time + uint16_t suggted_max_tx_time; +}; + +/// Indicates maximum data length +/*@TRACE*/ +struct gapm_max_data_len_ind +{ + /// Maximum number of payload octets that the local Controller supports for transmission + uint16_t suppted_max_tx_octets; + /// Maximum time, in microseconds, that the local Controller supports for transmission + uint16_t suppted_max_tx_time; + /// Maximum number of payload octets that the local Controller supports for reception + uint16_t suppted_max_rx_octets; + /// Maximum time, in microseconds, that the local Controller supports for reception + uint16_t suppted_max_rx_time; +}; + +/// Register a LE Protocol/Service Multiplexer command +/*@TRACE*/ +struct gapm_lepsm_register_cmd +{ + /// GAPM requested operation: + /// - GAPM_LEPSM_REG: Register a LE Protocol/Service Multiplexer + uint8_t operation; + /// LE Protocol/Service Multiplexer + uint16_t le_psm; + /// Application task number + uint16_t app_task; + /// Security level + /// 7 6 5 4 3 2 1 0 + /// +---+---+---+---+---+---+---+---+ + /// |MI | RFU |EKS|SEC_LVL| + /// +---+---+---+---+---+---+---+---+ + /// bit[0-1]: Security level requirement (0=NO_AUTH, 1=UNAUTH, 2=AUTH, 3=SEC_CON) + /// bit[2] : Encryption Key Size length must have 16 bytes + /// bit[7] : Does the application task is multi-instantiated or not + uint8_t sec_lvl; +}; + +/// Unregister a LE Protocol/Service Multiplexer command +/*@TRACE*/ +struct gapm_lepsm_unregister_cmd +{ + /// GAPM requested operation: + /// - GAPM_LEPSM_UNREG: Unregister a LE Protocol/Service Multiplexer + uint8_t operation; + /// LE Protocol/Service Multiplexer + uint16_t le_psm; +}; + +/// Control LE Test Mode command +struct gapm_le_test_mode_ctrl_cmd +{ + /// GAPM requested operation: + /// - GAPM_LE_TEST_STOP: Unregister a LE Protocol/Service Multiplexer + /// - GAPM_LE_TEST_RX_START: Start RX Test Mode + /// - GAPM_LE_TEST_TX_START: Start TX Test Mode + uint8_t operation; + /// Tx or Rx Channel (Range 0x00 to 0x27) + uint8_t channel; + /// Length in bytes of payload data in each packet (only valid for TX mode, range 0x00-0xFF) + uint8_t tx_data_length; + /// Packet Payload type (only valid for TX mode @see enum gap_pkt_pld_type) + uint8_t tx_pkt_payload; + /// Test PHY rate (@see enum gap_test_phy) + uint8_t phy; + /// Modulation Index (only valid for RX mode @see enum gap_modulation_idx) + uint8_t modulation_idx; +}; + +/// Indicate end of test mode event +struct gapm_le_test_end_ind +{ + /// Number of received packets + uint16_t nb_packet_received; +}; + +/// Provide statistic information about ISO exchange +struct gapm_iso_stat_ind +{ + /// ISO Handle of the isochronous channel (Range 0x0000-0x0EFF) + uint16_t iso_hdl; + + /// Statistics - Number of transmission attempts + uint32_t nb_tx; + /// Statistics - Number of transmission attempts that succeed + uint32_t nb_tx_ok; + /// Statistics - Number of Not granted packet packets + uint32_t nb_tx_not_granted; + + /// Statistics - Number of reception attempt + uint32_t nb_rx; + /// Statistics - Number of reception attempts that succeed + uint32_t nb_rx_ok; + /// Statistics - Number of Not granted packet packets + uint32_t nb_rx_not_granted; + /// Statistics - Number of wrongly received packet (invalid data) + uint32_t nb_rx_data_err; + /// Statistics - Number of CRC Errors + uint32_t nb_rx_crc_err; + /// Statistics - Number of SYNC Errors + uint32_t nb_rx_sync_err; + /// Statistics - Number of received empty packets + uint32_t nb_rx_empty; +}; + +/// Create an advertising, a scanning, an initiating, a periodic synchonization activity command (common) +/*@TRACE*/ +struct gapm_activity_create_cmd +{ + /// GAPM request operation: + /// - GAPM_CREATE_ADV_ACTIVITY: Create advertising activity + /// - GAPM_CREATE_SCAN_ACTIVITY: Create scanning activity + /// - GAPM_CREATE_INIT_ACTIVITY: Create initiating activity + /// - GAPM_CREATE_PERIOD_SYNC_ACTIVITY: Create periodic synchronization activity + uint8_t operation; + /// Own address type (@see enum gapm_own_addr) + uint8_t own_addr_type; +}; + +/// Create an advertising activity command +struct gapm_activity_create_adv_cmd +{ + /// GAPM request operation: + /// - GAPM_CREATE_ADV_ACTIVITY: Create advertising activity + uint8_t operation; + /// Own address type (@see enum gapm_own_addr) + uint8_t own_addr_type; + /// Advertising parameters (optional, shall be present only if operation is GAPM_CREATE_ADV_ACTIVITY) + /// For prop parameter, @see enum gapm_leg_adv_prop, @see enum gapm_ext_adv_prop and @see enum gapm_per_adv_prop for help + struct gapm_adv_create_param adv_param; +}; + +/// Activity parameters +/*@TRACE + @trc_ref gapm_actv_type + */ +union gapm_u_param +{ + /// Additional advertising parameters (for advertising activity) + //@trc_union @activity_map[$parent.actv_idx] == GAPM_ACTV_TYPE_ADV + struct gapm_adv_param adv_add_param; + /// Scan parameters (for scanning activity) + //@trc_union @activity_map[$parent.actv_idx] == GAPM_ACTV_TYPE_SCAN + struct gapm_scan_param scan_param; + /// Initiating parameters (for initiating activity) + //@trc_union @activity_map[$parent.actv_idx] == GAPM_ACTV_TYPE_INIT + struct gapm_init_param init_param; + /// Periodic synchronization parameters (for periodic synchronization activity) + //@trc_union @activity_map[$parent.actv_idx] == GAPM_ACTV_TYPE_PER_SYNC + struct gapm_per_sync_param per_sync_param; +}; + +/// Start a given activity command +/*@TRACE*/ +struct gapm_activity_start_cmd +{ + /// GAPM request operation: + /// - GAPM_START_ACTIVITY: Start a given activity + uint8_t operation; + /// Activity identifier + uint8_t actv_idx; + /// Activity parameters + union gapm_u_param u_param; +}; + +/// Stop one or all activity(ies) command +/*@TRACE*/ +struct gapm_activity_stop_cmd +{ + /// GAPM request operation: + /// - GAPM_STOP_ACTIVITY: Stop a given activity + /// - GAPM_STOP_ALL_ACTIVITIES: Stop all existing activities + uint8_t operation; + /// Activity identifier - used only if operation is GAPM_STOP_ACTIVITY + uint8_t actv_idx; +}; + +/// Delete one or all activity(ies) command +/*@TRACE*/ +struct gapm_activity_delete_cmd +{ + /// GAPM request operation: + /// - GAPM_DELETE_ACTIVITY: Delete a given activity + /// - GAPM_DELETE_ALL_ACTIVITIES: Delete all existing activities + uint8_t operation; + /// Activity identifier - used only if operation is GAPM_STOP_ACTIVITY + uint8_t actv_idx; +}; + +/// Indicate creation of an activity +/*@TRACE + @trc_exec activity_map[$actv_idx] = $actv_type + activity_map = {}*/ +struct gapm_activity_created_ind +{ + /// Activity identifier + uint8_t actv_idx; + /// Activity type (@see enum gapm_actv_type) + uint8_t actv_type; + /// Selected TX power for advertising activity + int8_t tx_pwr; +}; + +/// Indicate that an activity has been stopped +/*@TRACE*/ +struct gapm_activity_stopped_ind +{ + /// Activity identifier + uint8_t actv_idx; + /// Activity type (@see enum gapm_actv_type) + uint8_t actv_type; + /// Activity stop reason + uint8_t reason; + /// In case of periodic advertising, indicate if periodic advertising has been stopped + uint8_t per_adv_stop; +}; + +/// Set advertising, scan response or periodic advertising data command +/*@TRACE*/ +struct gapm_set_adv_data_cmd +{ + /// GAPM request operation: + /// - GAPM_SET_ADV_DATA: Set advertising data + /// - GAPM_SET_SCAN_RSP_DATA: Set scan response data + /// - GAPM_SET_PERIOD_ADV_DATA: Set periodic advertising data + uint8_t operation; + /// Activity identifier + uint8_t actv_idx; + /// Data length + uint16_t length; + /// Data + uint8_t data[]; +}; + +/// Indicate reception of scan request +/*@TRACE*/ +struct gapm_scan_request_ind +{ + /// Activity identifier + uint8_t actv_idx; + /// Transmitter device address + struct gap_bdaddr trans_addr; +}; + +/// Indicate reception of advertising, scan response or periodic advertising data +/*@TRACE*/ +struct gapm_ext_adv_report_ind +{ + /// Activity identifier + uint8_t actv_idx; + /// Bit field providing information about the received report (@see enum gapm_adv_report_info) + uint8_t info; + /// Transmitter device address + struct gap_bdaddr trans_addr; + /// Target address (in case of a directed advertising report) + struct gap_bdaddr target_addr; + /// TX power (in dBm) + int8_t tx_pwr; + /// RSSI (between -127 and +20 dBm) + int8_t rssi; + /// Primary PHY on which advertising report has been received + uint8_t phy_prim; + + #if (BLE_EXT_ADV) + /// Secondary PHY on which advertising report has been received + uint8_t phy_second; + /// Advertising SID + /// Valid only for periodic advertising report + uint8_t adv_sid; + /// Periodic advertising interval (in unit of 1.25ms, min is 7.5ms) + /// Valid only for periodic advertising report + uint16_t period_adv_intv; + #endif // (BLE_EXT_ADV) + /// Report length + uint16_t length; + /// Report + uint8_t data[]; +}; + +/// Indicate that synchronization has been established with a periodic advertiser +/*@TRACE*/ +struct gapm_sync_established_ind +{ + /// Activity identifier + uint8_t actv_idx; + /// PHY on which synchronization has been established (@see gap_phy_type) + uint8_t phy; + /// Periodic advertising interval (in unit of 1.25ms, min is 7.5ms) + uint16_t intv; + /// Advertising SID + uint8_t adv_sid; + /// Advertiser clock accuracy (@see enum gapm_clk_acc) + uint8_t clk_acc; + /// Advertiser address + struct gap_bdaddr addr; +}; + +/// Read local or peer address +/*@TRACE*/ +struct gapm_get_ral_addr_cmd +{ + /// GAPM request operation: + /// - GAPM_GET_RAL_LOC_ADDR: Set white list content + /// - GAPM_GET_RAL_PEER_ADDR: Set resolving list content + uint8_t operation; + /// Peer device identity + struct gap_bdaddr peer_identity; +}; + +/// Set content of either white list or resolving list or periodic advertiser list command (common part) +struct gapm_list_set_cmd +{ + /// GAPM request operation: + /// - GAPM_SET_WHITE_LIST: Set white list content + /// - GAPM_SET_RAL: Set resolving list content + /// - GAPM_SET_PAL: Set periodic advertiser list content + uint8_t operation; + /// Number of entries to be added in the list. 0 means that list content has to be cleared + uint8_t size; +}; + +/// Set content of white list +/*@TRACE*/ +struct gapm_list_set_wl_cmd +{ + /// GAPM request operation: + /// - GAPM_SET_WHITE_LIST: Set white list content + uint8_t operation; + /// Number of entries to be added in the list. 0 means that list content has to be cleared + uint8_t size; + /// List of entries to be added in the list + struct gap_bdaddr wl_info[]; +}; + +/// Set content of resolving list command +/*@TRACE*/ +struct gapm_list_set_ral_cmd +{ + /// GAPM request operation: + /// - GAPM_SET_RAL: Set resolving list content + uint8_t operation; + /// Number of entries to be added in the list. 0 means that list content has to be cleared + uint8_t size; + /// List of entries to be added in the list + struct gap_ral_dev_info ral_info[]; +}; + +/// Set content of periodic advertiser list command +/*@TRACE*/ +struct gapm_list_set_pal_cmd +{ + /// GAPM request operation: + /// - GAPM_SET_PAL: Set periodic advertiser list content + uint8_t operation; + /// Number of entries to be added in the list. 0 means that list content has to be cleared + uint8_t size; + /// List of entries to be added in the list + struct gapm_period_adv_addr_cfg pal_info[]; +}; + +/*@TRACE + @trc_ref gapm_operation + gapm_list_set_cmd = gapm_u_list_set +*/ +union gapm_u_list_set +{ + uint8_t operation; + + //@trc_union operation == GAPM_SET_WL + struct gapm_list_set_wl_cmd list_set_wl_cmd; + //@trc_union operation == GAPM_SET_RAL + struct gapm_list_set_ral_cmd list_set_ral_cmd; + //@trc_union operation == GAPM_SET_PAL + struct gapm_list_set_pal_cmd list_set_pal_cmd; +}; + +/// List Size indication event +/*@TRACE*/ +struct gapm_list_size_ind +{ + /// Operation code, indicate list for which size has been read + /// - GAPM_SET_WHITE_LIST + /// - GAPM_SET_RAL + /// - GAPM_SET_PAL + uint8_t operation; + /// List size + uint8_t size; +}; + +/// Maximum advertising data length indication event +/*@TRACE*/ +struct gapm_max_adv_data_len_ind +{ + /// Maximum advertising data length supported by controller + uint16_t length; +}; + +/// Number of available advertising sets indication event +/*@TRACE*/ +struct gapm_nb_adv_sets_ind +{ + /// Number of available advertising sets + uint8_t nb_adv_sets; +}; + +/// Indicate the transmit powers supported by the controller +/*@TRACE*/ +struct gapm_dev_tx_pwr_ind +{ + /// Minimum TX power + int8_t min_tx_pwr; + /// Maximum TX power + int8_t max_tx_pwr; +}; + +/// Indicate the RF path compensation values +/*@TRACE*/ +struct gapm_dev_rf_path_comp_ind +{ + /// RF TX path compensation + uint16_t tx_path_comp; + /// RF RX path compensation + uint16_t rx_path_comp; +}; + +/// Request to renew all currently used random private addresses (non-resolvable or resolvable) +/// For internal use only +/*@TRACE*/ +struct gapm_addr_renew_cmd +{ + /// GAPM request operation: + /// - GAPM_RENEW_ADDR: Renew random private addresses + uint8_t operation; + /// Activity index, used by GAPM ADDR state machine in order to remind for which activity + /// a new address has been generated + uint8_t actv_idx; + /// Index of first created initiating/scanning for which address has been renewed, + /// any initiating/scanning met after shall use the same address if it uses a random + /// address + uint8_t init_scan_actv_idx; +}; + +/* + * DEFINES + **************************************************************************************** + */ + +/// Maximum number of advertising reports from different advertisers that can be reassembled in parallel +#define GAPM_REPORT_NB_MAX (5) + +/* + * STRUCTURE DEFINITION + **************************************************************************************** + */ + +/// Contain a received fragment of advertising or scan response report +struct gapm_report_elem +{ + /// List Header + list_hdr_t list_hdr; + /// Data length + uint8_t data_len; + /// Data + uint8_t data[]; +}; + +/// Contain a list of fragments received for an advertising or scan response report sent +/// by a given advertiser +struct gapm_report_list +{ + // List of received reports (@see struct gapm_report_elem) + list_t report_list; + // Advertiser address + struct gap_bdaddr adv_addr; + // Received length + uint16_t length; +}; + +/// GAP Manager activity structure (common part for advertising, scanning, +/// initiating and periodic synchronization activities) +struct gapm_actv_tag +{ + /// Function to be called for activity start + uint8_t (*cb_actv_start)(struct gapm_actv_tag *, struct gapm_activity_start_cmd *); + /// Function to be called for activity stop + void (*cb_actv_stop)(struct gapm_actv_tag *); + /// Function to be called for activity delete + void (*cb_actv_delete)(struct gapm_actv_tag *); + + /// Identifier + uint8_t idx; + /// Type (@see enum gapm_actv_type) + uint8_t type; + /// Subtype - meaning depends on activity type + /// - Advertising activity: @see enum gap_adv_subtype + /// - Scanning activity: @see enum gap_scan_subtype + /// - Initiating activity: @see enum gap_init_subtype + /// - Periodic Synchronization activity: @see enum gap_period_sync_subtype + uint8_t subtype; + /// State (@see enum gapm_actv_state) + uint8_t state; + /// Information bit field, meaning depends on activity type + uint8_t info; + /// Own address type + uint8_t own_addr_type; + /// Next expected HCI event opcode + uint16_t next_exp_opcode; + /// Task ID of task that has requested creation of the activity + task_id_t requester; + /// BD Address used by the activity (can be different if controller privacy is used and + /// application chose to use a resolvable private address) + bd_addr_t addr; +}; + +/// GAP Manager activity structure for advertising activity +struct gapm_actv_adv_tag +{ + /// Common activity parameters + struct gapm_actv_tag common; + /// Data offset for the set advertising data procedure + uint16_t data_offset; + /// Advertising mode (@see enum gapm_adv_disc_mode) + uint8_t mode; + /// Stored status + uint8_t kept_status; + /// Selected TX power + uint8_t tx_pwr; +}; + +/// GAP Manager activity structure for scanning activity +struct gapm_actv_scan_tag +{ + /// Common activity parameters + struct gapm_actv_tag common; + /// Lists containing fragments for GAPM_REPORT_NB_MAX reports that can be received in parallel + struct gapm_report_list report_lists[GAPM_REPORT_NB_MAX]; + /// Scan filtering Array + struct gap_bdaddr *p_scan_filter; +}; + +/// GAP Manager activity structure for initiating activity +struct gapm_actv_init_tag +{ + /// Common activity parameters + struct gapm_actv_tag common; + /// Initiating parameters + struct gapm_init_param init_param; + /// Number of connection to be established for automatic connection + /// -> Number of devices in the white list when GAPM_ACTIVITY_START_CMD is received + uint8_t nb_auto_conn; + /// Stored status + uint8_t kept_status; +}; + +/// GAP Manager activity structure for periodic synchronization activity +struct gapm_actv_per_sync_tag +{ + /// Common activity parameters + struct gapm_actv_tag common; + // List of received reports fragment (@see struct gapm_report_elem) + list_t report_list; + // Received length + uint16_t length; + /// Synchronization Handle + uint16_t sync_hdl; +}; + +/// GAP Manager device configuration +struct gapm_dev_config +{ + /// Device Role: Central, Peripheral (@see gap_role) + uint8_t gap_role; + /// Pairing mode authorized (@see enum gapm_pairing_mode) + uint8_t pairing; + /// Preferred LE PHY for data (@see enum gap_phy) + uint8_t pref_phy; + /// LE Data Length Extension (enable or not) + //bool le_dle; + /// Maximal MTU acceptable for device (23~512) + uint16_t max_mtu; +}; + +#endif /* _GAPM_H_ */ diff --git a/ble/api/gapm_api.h b/ble/api/gapm_api.h new file mode 100644 index 0000000..39788bb --- /dev/null +++ b/ble/api/gapm_api.h @@ -0,0 +1,275 @@ +/** + **************************************************************************************** + * + * @file gapm_api.h + * + * @brief Generic Access Profile Manager API functions. + * + **************************************************************************************** + */ + +#ifndef GAPM_API_H_ +#define GAPM_API_H_ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include +#include +#include "gapm.h" + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Reset link layer and the host + * + * @return Message GAPM_CMP_EVT(operation GAPM_RESET) + **************************************************************************************** + */ +void gapm_reset(void); + +/** + **************************************************************************************** + * @brief Initial device configuration + * + * @param[in] cfg Configure + * + * @return Message GAPM_CMP_EVT(operation GAPM_SET_DEV_CONFIG) + **************************************************************************************** + */ +void gapm_set_dev(const struct gapm_dev_config *cfg, const bd_addr_t *bdaddr, const uint8_t *irk); + +/** + **************************************************************************************** + * @brief Generate a 8-byte random number + * + * @return Message GAPM_CMP_EVT(operation GAPM_GEN_RAND_NB) + **************************************************************************************** + */ +void gapm_gen_rand(void); + +/** + **************************************************************************************** + * @brief Modify current IRK + * + * @return Message GAPM_CMP_EVT(operation GAPM_SET_IRK) + **************************************************************************************** + */ +void gapm_set_irk(uint8_t *irk); + +/** + **************************************************************************************** + * @brief Create activity. + * + * @param[in] actv_type Activity type(@see gapm_actv_type) + * @param[in] addr_type Own addr type(@see gapm_own_addr) + * + * @return Message GAPM_CMP_EVT(operation GAPM_CREATE_XXX_ACTIVITY) and GAPM_ACTIVITY_CREATED_IND + **************************************************************************************** + */ +void gapm_create_activity(uint8_t actv_type, uint8_t addr_type); + +/** + **************************************************************************************** + * @brief Start activity. + * + * @param[in] actv_idx Activity index + * @param[in] addr_type Own addr type(@see gapm_own_addr) + * + * @return Message GAPM_CMP_EVT(operation GAPM_START_ACTIVITY) + **************************************************************************************** + */ +void gapm_start_activity(uint8_t actv_idx, uint16_t param_len, const void* param); + +/** + **************************************************************************************** + * @brief Stop activity. + * + * @param[in] actv_idx Activity index + * + * @return Message GAPM_CMP_EVT(operation GAPM_STOP_ACTIVITY) and GAPM_ACTIVITY_STOPPED_IND + **************************************************************************************** + */ +void gapm_stop_activity(uint8_t actv_idx); + +/** + **************************************************************************************** + * @brief Delete activity. + * + * @param[in] actv_idx Activity index + * + * @return Message GAPM_CMP_EVT(operation GAPM_DELETE_ACTIVITY) + **************************************************************************************** + */ +void gapm_delete_activity(uint8_t actv_idx); + +/** + **************************************************************************************** + * @brief Create advertising activity. + * + * @param[in] addr_type Own addr type(@see gapm_own_addr) + * @param[in] adv_param Advertising parameters + * + * @return Message GAPM_CMP_EVT(operation GAPM_CREATE_ADV_ACTIVITY) and GAPM_ACTIVITY_CREATED_IND + **************************************************************************************** + */ +void gapm_create_advertising(uint8_t addr_type, const struct gapm_adv_create_param *adv_param); + +/** + **************************************************************************************** + * @brief Start advertising activity. + * + * @param[in] adv_idx Activity index + * @param[in] duration Advertising duration, 0 for always on + * + * @return Message GAPM_CMP_EVT(operation GAPM_START_ACTIVITY) + **************************************************************************************** + */ +void gapm_start_advertising(uint8_t adv_idx, uint16_t duration); + +/// Macro of Stop advertising +#define gapm_stop_advertising(adv_idx) gapm_stop_activity(adv_idx) + +/// Macro of Delete advertising +#define gapm_delete_advertising(adv_idx) gapm_delete_activity(adv_idx) + +/** + **************************************************************************************** + * @brief Fill advertising data. + * + * @param[in] adv_idx Activity index + * @param[in] op_typ Data operation(GAPM_SET_ADV_DATA or GAPM_SET_SCAN_RSP_DATA) + * + * @return Message GAPM_CMP_EVT(operation GAPM_SET_ADV_DATA or GAPM_SET_SCAN_RSP_DATA) + **************************************************************************************** + */ +void gapm_set_adv_data(uint8_t adv_idx, uint8_t op_typ, uint16_t len, const uint8_t *data); + +/** + **************************************************************************************** + * @brief Retrieve local public address. + * + * @return Return local public address + **************************************************************************************** + */ +bd_addr_t* gapm_get_bdaddr(void); + +/** + **************************************************************************************** + * @brief Retrieve the device address type (@see enum gapm_addr_type) + * + * @return address type + **************************************************************************************** + */ +uint8_t gapm_get_address_type(void); + +/** + **************************************************************************************** + * @brief Returns the local Public Key + * + * @return pointer to the local Public Key + **************************************************************************************** + */ +public_key_t* gapm_get_local_public_key(void); + +/** + **************************************************************************************** + * @brief Retrieve if Legacy pairing is supported on local device + * + * @return True if legacy pairing is supported + **************************************************************************************** + */ +bool gapm_is_legacy_pairing_supp(void); + +/** + **************************************************************************************** + * @brief Retrieve if Secure Connection pairing is supported on local device + * + * @return True if Secure Connection pairing is supported + **************************************************************************************** + */ +bool gapm_is_sec_con_pairing_supp(void); + +/** + **************************************************************************************** + * @brief Set the pairing mode is supported on local device + * + * @param[in] mode Pairing supported (@see gapm_pairing_mode) + **************************************************************************************** + */ +void gapm_set_pairing_supp(uint8_t mode); + +/** + **************************************************************************************** + * @brief Return the maximal MTU value + * + * @return Maximal MTU value + **************************************************************************************** + */ +uint16_t gapm_get_max_mtu(void); + +/** + **************************************************************************************** + * @brief Set the maximal MTU value + * + * @param[in] mtu Max MTU value (Minimum is 23) + **************************************************************************************** + */ +void gapm_set_max_mtu(uint16_t mtu); + +/** + **************************************************************************************** + * @brief Return the maximal MPS value + * + * @return Maximal MPS value + **************************************************************************************** + */ +uint16_t gapm_get_max_mps(void); + +/** + **************************************************************************************** + * @brief Set the maximal MPS value + * + * @param[in] mps Max MPS value (Minimum is 23) + **************************************************************************************** + */ +void gapm_set_max_mps(uint16_t mps); + +/** + **************************************************************************************** + * @brief Get if preferred connection parameters present in GAP ATT database + * + * @return True if referred connection parameters present in GAP ATT database, False else + **************************************************************************************** + */ +bool gapm_is_pref_con_param_pres(void); + +/** + **************************************************************************************** + * @brief retrieve gap attribute handle from attribute index. + * + * @param[in] att_idx Attribute index + * + * @return Attribute handle + **************************************************************************************** + */ +uint16_t gapm_get_att_handle(uint8_t att_idx); + +/** + **************************************************************************************** + * @brief Check If Service changed feature is enabled or not + * + * @return true if enabled, false else. + **************************************************************************************** + */ +bool gapm_svc_chg_en(void); + + +#endif // GAPM_API_H_ diff --git a/ble/api/gatt.h b/ble/api/gatt.h new file mode 100644 index 0000000..ad123df --- /dev/null +++ b/ble/api/gatt.h @@ -0,0 +1,850 @@ +/** + **************************************************************************************** + * + * @file gatt.h + * + * @brief Generic Attribute Profile Messages. + * + **************************************************************************************** + */ + +#ifndef _GATT_H_ +#define _GATT_H_ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include +#include +#include "le_err.h" +#include "task.h" +#include "att.h" +#include "gap.h" + +/* + * DEFINES + **************************************************************************************** + */ + +/// Macro for Instance of GATT TASK +#define GATT(idx) TASK_ID(GATT, idx) + +/// GATT Task messages +/*@TRACE*/ +enum gatt_msg_id +{ + /* Default event */ + /// Command Complete event + GATT_CMP_EVT = MSG_ID(GATT, 0x00), + + /* ATTRIBUTE CLIENT */ + GATT_CLIENT_CMD = MSG_ID(GATT, 0x01), + /// Server configuration request + GATT_EXC_MTU_CMD = GATT_CLIENT_CMD, //MSG_ID(GATT, 0x01), + /*Discover All Services */ + /*Discover Services by Service UUID*/ + /*Find Included Services*/ + /*Discover Characteristics by UUID*/ + /*Discover All Characteristics of a Service*/ + /*Discover All Characteristic Descriptors*/ + /// Discovery command + GATT_DISC_CMD = GATT_CLIENT_CMD, //MSG_ID(GATT, 0x03), + /*Read Value*/ + /*Read Using UUID*/ + /*Read Long Value*/ + /*Read Multiple Values*/ + /// Read command + GATT_READ_CMD = GATT_CLIENT_CMD, //MSG_ID(GATT, 0x08), + /*Write without response*/ + /*Write without response with Authentication*/ + /*Write Characteristic Value*/ + /*Signed Write Characteristic Value*/ + /*Write Long Characteristic Value*/ + /*Characteristic Value Reliable Write*/ + /*Write Characteristic Descriptors*/ + /*Write Long Characteristic Descriptors*/ + /*Characteristic Value Reliable Write*/ + /// Write command request + GATT_WRITE_CMD = GATT_CLIENT_CMD, //MSG_ID(GATT, 0x0A), + /* Cancel / Execute pending write operations */ + /// Execute write characteristic request + GATT_EXECUTE_WRITE_CMD = GATT_CLIENT_CMD, //MSG_ID(GATT, 0x0B), + + /// Indicate that the ATT MTU has been updated (negotiated) + GATT_MTU_CHANGED_IND = MSG_ID(GATT, 0x02), + + /* GATT -> HL: Events to Upper layer */ + /*Discover All Services*/ + /// Discovery services indication + GATT_DISC_SVC_IND = MSG_ID(GATT, 0x04), + /*Find Included Services*/ + /// Discover included services indication + GATT_DISC_SVC_INCL_IND = MSG_ID(GATT, 0x05), + /*Discover All Characteristics of a Service*/ + /// Discover characteristic indication + GATT_DISC_CHAR_IND = MSG_ID(GATT, 0x06), + /*Discover All Characteristic Descriptors*/ + /// Discovery characteristic descriptor indication + GATT_DISC_CHAR_DESC_IND = MSG_ID(GATT, 0x07), + + /// Read response + GATT_READ_IND = MSG_ID(GATT, 0x09), + + /* Reception of an indication or notification from peer device. */ + /// peer device triggers an event (notification) + GATT_EVENT_IND = MSG_ID(GATT, 0x0C), + /// peer device triggers an event that requires a confirmation (indication) + GATT_EVENT_REQ_IND = MSG_ID(GATT, 0x0D), + /// Confirm reception of event (trigger a confirmation message) + GATT_EVENT_CFM = MSG_ID(GATT, 0x0E), + + /// Registration to peer device events (Indication/Notification). + GATT_REG_TO_PEER_EVT_CMD = MSG_ID(GATT, 0x0F), + + /* -------------------------- ATTRIBUTE SERVER ------------------------------- */ + /*Notify Characteristic*/ + /*Indicate Characteristic*/ + /// send an event to peer device + GATT_SEND_EVT_CMD = MSG_ID(GATT, 0x10), + GATT_SERVER_CFM = MSG_ID(GATT, 0x11), + /// REad command confirmation from upper layers. + GATT_READ_CFM = GATT_SERVER_CFM, //MSG_ID(GATT, 0x14), + /// Write command confirmation from upper layers. + GATT_WRITE_CFM = GATT_SERVER_CFM, //= MSG_ID(GATT, 0x16), + /// Attribute info from upper layer confirmation + GATT_ATT_INFO_CFM = GATT_SERVER_CFM, //= MSG_ID(GATT, 0x18), + + /* Indicate that read operation is requested. */ + /// Read command indicated to upper layers. + GATT_READ_REQ_IND = MSG_ID(GATT, 0x13), + + /* Indicate that write operation is requested. */ + /// Write command indicated to upper layers. + GATT_WRITE_REQ_IND = MSG_ID(GATT, 0x15), + + /* Indicate that write operation is requested. */ + /// Request Attribute info to upper layer - could be trigger during prepare write + GATT_ATT_INFO_REQ_IND = MSG_ID(GATT, 0x17), + + /* ----------------------- SERVICE DISCOVERY PROCEDURE ---------------------- */ + /// Service Discovery command + GATT_SDP_SVC_DISC_CMD = MSG_ID(GATT, 0x19), + /// Service Discovery indicate that a service has been found. + GATT_SDP_SVC_IND = MSG_ID(GATT, 0x1A), + + /* -------------------------- TRANSACTION ERROR EVENT ------------------------ */ + /// Transaction Timeout Error Event no more transaction will be accepted + GATT_TRANSACTION_TO_ERROR_IND = MSG_ID(GATT, 0x1B), + /// Indication to the task that sends the unknown message + GATT_UNKNOWN_MSG_IND = MSG_ID(GATT, 0x1C), + + /* --------------------------------- ROBUST CACHE --------------------------------- */ + /// Command used to read peer database hash + GATT_READ_DB_HASH_CMD = MSG_ID(GATT, 0x20), + /// Provide value of the peer database hash + GATT_DB_HASH_IND = MSG_ID(GATT, 0x21), + /// Command used to enable Robust database caching + /// (Register to service changed, Set client supported features and read database hash) + GATT_ROBUST_DB_CACHE_EN_CMD = MSG_ID(GATT, 0x22), + /// Informs that peer database updated and need to be refreshed + /// This also means that no more indication/notification will be received till database hash isn't read + GATT_DB_CACHE_OUT_OF_SYNC_IND = MSG_ID(GATT, 0x23), + /// Informs that peer device database updated using service changed indication + GATT_SVC_CHG_REQ_IND = MSG_ID(GATT, 0x24), + /// Message used to confirm that database updated is understood by application + GATT_SVC_CHG_CFM = MSG_ID(GATT, 0x25), + + /* ----------------------------------- GATT INFO ---------------------------------- */ + /// Provide information about GATT for current connection that can be reuse on another connection + GATT_CON_INFO_IND = MSG_ID(GATT, 0x28), +}; + + +/// request operation type - application interface +/*@TRACE*/ +enum gatt_operation +{ + /* Attribute Client Flags */ + /* No Operation (if nothing has been requested) */ + /* ************************************************ */ + /// No operation + GATT_NO_OP = 0x00, + + /* Operation flags for MTU Exchange */ + /* ************************************************ */ + /// Perform MTU exchange + GATT_MTU_EXCH = 0x01, + + /* Operation flags for discovery operation */ + /* ************************************************ */ + /// Discover all services + GATT_DISC_ALL_SVC = 0x02, + /// Discover services by UUID + GATT_DISC_BY_UUID_SVC = 0x03, + /// Discover included services + GATT_DISC_INCLUDED_SVC = 0x04, + /// Discover all characteristics + GATT_DISC_ALL_CHAR = 0x05, + /// Discover characteristic by UUID + GATT_DISC_BY_UUID_CHAR = 0x06, + /// Discover characteristic descriptor + GATT_DISC_DESC_CHAR = 0x07, + + /* Operation flags for reading attributes */ + /* ************************************************ */ + /// Read attribute + GATT_READ = 0x08, + /// Read long attribute + GATT_READ_LONG = 0x09, + /// Read attribute by UUID + GATT_READ_BY_UUID = 0x0A, + /// Read multiple attribute + GATT_READ_MULTIPLE = 0x0B, + + /* Operation flags for writing/modifying attributes */ + /* ************************************************ */ + /// Write attribute + GATT_WRITE = 0x0C, + /// Write no response + GATT_WRITE_NO_RESPONSE = 0x0D, + /// Write signed + GATT_WRITE_SIGNED = 0x0E, + /// Execute write + GATT_EXEC_WRITE = 0x0F, + + /* Operation flags for registering to peer device */ + /* ************************************************ */ + /// Register to peer device events + GATT_REGISTER = 0x10, + /// Unregister from peer device events + GATT_UNREGISTER = 0x11, + + /* Operation flags for sending events to peer device*/ + /* ************************************************ */ + /// Send an attribute notification + GATT_NOTIFY = 0x12, + /// Send an attribute indication + GATT_INDICATE = 0x13, + /// Send a service changed indication + GATT_SVC_CHANGED = 0x14, + + /* Service Discovery Procedure */ + /* ************************************************ */ + /// Search specific service + GATT_SDP_DISC_SVC = 0x15, + /// Search for all services + GATT_SDP_DISC_SVC_ALL = 0x16, + /// Cancel Service Discovery Procedure + GATT_SDP_DISC_CANCEL = 0x17, + + /* Robust Cache */ + /* ************************************************ */ + /// Read peer database hash + GATT_READ_DB_HASH = 0x20, + /// Enable Robust database cache feature + GATT_ROBUST_DB_CACHE_EN = 0x21, + + GATT_READ_RSP = 0x40, + GATT_WRITE_RSP = 0x41, + GATT_ATT_INFO_RSP = 0x42, +}; + +/// Service Discovery Attribute type +/*@TRACE*/ +enum gatt_sdp_att_type +{ + /// No Attribute Information + GATT_SDP_NONE, + /// Included Service Information + GATT_SDP_INC_SVC, + /// Characteristic Declaration + GATT_SDP_ATT_CHAR, + /// Attribute Value + GATT_SDP_ATT_VAL, + /// Attribute Descriptor + GATT_SDP_ATT_DESC, +}; + +/// Command complete event data structure +struct gatt_op_cmd +{ + /// GATT request type + uint8_t operation; + /// operation sequence number + uint16_t seq_num; +}; + +/// Command complete event data structure +/*@TRACE*/ +struct gatt_cmp_evt +{ + /// GATT request type + uint8_t operation; + /// Status of the request + uint8_t status; + /// operation sequence number - provided when operation is started + uint16_t seq_num; +}; + + +/// Service Discovery Command Structure +/*@TRACE*/ +struct gatt_exc_mtu_cmd +{ + /// GATT request type + uint8_t operation; + /// operation sequence number + uint16_t seq_num; +}; + +/// Indicate that the ATT MTU has been updated (negotiated) +/*@TRACE*/ +struct gatt_mtu_changed_ind +{ + /// Exchanged MTU value + uint16_t mtu; + /// operation sequence number + uint16_t seq_num; +}; + +/// Service Discovery Command Structure +/*@TRACE*/ +struct gatt_disc_cmd +{ + /// GATT request type + uint8_t operation; + /// UUID length + uint8_t uuid_len; + /// operation sequence number + uint16_t seq_num; + /// start handle range + uint16_t start_hdl; + /// start handle range + uint16_t end_hdl; + /// UUID + uint8_t uuid[]; +}; + + +/// Discover Service indication Structure +/*@TRACE*/ +struct gatt_disc_svc_ind +{ + /// start handle + uint16_t start_hdl; + /// end handle + uint16_t end_hdl; + /// UUID length + uint8_t uuid_len; + /// service UUID + uint8_t uuid[]; +}; + +/// Discover Service indication Structure +/*@TRACE*/ +struct gatt_disc_svc_incl_ind +{ + /// element handle + uint16_t attr_hdl; + /// start handle + uint16_t start_hdl; + /// end handle + uint16_t end_hdl; + /// UUID length + uint8_t uuid_len; + /// included service UUID + uint8_t uuid[]; +}; + +/// Discovery All Characteristic indication Structure +/*@TRACE*/ +struct gatt_disc_char_ind +{ + /// database element handle + uint16_t attr_hdl; + /// pointer attribute handle to UUID + uint16_t pointer_hdl; + /// properties + uint8_t prop; + /// UUID length + uint8_t uuid_len; + /// characteristic UUID + uint8_t uuid[]; +}; + +/// Discovery Characteristic Descriptor indication Structure +/*@TRACE*/ +struct gatt_disc_char_desc_ind +{ + /// database element handle + uint16_t attr_hdl; + /// UUID length + uint8_t uuid_len; + /// Descriptor UUID + uint8_t uuid[]; +}; + + +/// Simple Read (GATT_READ or GATT_READ_LONG) +/*@TRACE + gatt_read = gatt_read_simple + gatt_read_long = gatt_read_simple*/ +struct gatt_read_simple +{ + /// attribute handle + uint16_t handle; + /// start offset in data payload + uint16_t offset; + /// Length of data to read (0 = read all) + uint16_t length; +}; + +/// Read by UUID: search UUID and read it's characteristic value (GATT_READ_BY_UUID) +/// Note: it doesn't perform an automatic read long. +/*@TRACE*/ +struct gatt_read_by_uuid +{ + /// Start handle + uint16_t start_hdl; + /// End handle + uint16_t end_hdl; + /// Size of UUID + uint8_t uuid_len; + /// UUID value + uint8_t uuid[]; +}; + +/// Read Multiple short characteristic (GATT_READ_MULTIPLE) +/*@TRACE*/ +struct gatt_read_multiple +{ + /// attribute handle + uint16_t handle; + /// Known Handle length (shall be != 0) + uint16_t len; +}; + +/// request union according to read type +/*@TRACE + @trc_ref gatt_operation + */ +union gatt_read_req +{ + /// Simple Read (GATT_READ or GATT_READ_LONG) + //@trc_union parent.operation == GATT_READ or parent.operation == GATT_READ_LONG + struct gatt_read_simple simple; + /// Read by UUID (GATT_READ_BY_UUID) + //@trc_union parent.operation == GATT_READ_BY_UUID + struct gatt_read_by_uuid by_uuid; + /// Read Multiple short characteristic (GATT_READ_MULTIPLE) + //@trc_union parent.operation == GATT_READ_MULTIPLE + struct gatt_read_multiple multiple[1]; +}; + +/// Read command (Simple, Long, Multiple, or by UUID) +/*@TRACE*/ +struct gatt_read_cmd +{ + /// request type + uint8_t operation; + /// number of read (only used for multiple read) + uint8_t nb; + /// operation sequence number + uint16_t seq_num; + /// request union according to read type + union gatt_read_req req; +}; + +/// Attribute value read indication +/*@TRACE*/ +struct gatt_read_ind +{ + /// Attribute handle + uint16_t handle; + /// Read offset + uint16_t offset; + /// Read length + uint16_t length; + /// Handle value + uint8_t value[]; +}; + +/// Write peer attribute value command +/*@TRACE*/ +struct gatt_write_cmd +{ + /// Request type + uint8_t operation; + /// Perform automatic execution + /// (if false, an ATT Prepare Write will be used this shall be use for reliable write) + bool auto_execute; + /// operation sequence number + uint16_t seq_num; + /// Attribute handle + uint16_t handle; + /// Write offset + uint16_t offset; + /// Write length + uint16_t length; + /// Internal write cursor shall be initialized to 0 + uint16_t cursor; + /// Value to write + uint8_t value[]; +}; + +/// Write peer attribute value command +/*@TRACE*/ +struct gatt_execute_write_cmd +{ + /// Request type + uint8_t operation; + + /// [True = perform/False cancel] pending write operations + bool execute; + /// operation sequence number + uint16_t seq_num; +}; +/// peer device triggers an event (notification) +/*@TRACE*/ +struct gatt_event_ind +{ + /// Event Type + uint8_t type; + /// Data length + uint16_t length; + /// Attribute handle + uint16_t handle; + /// Event Value + uint8_t value[]; +}; + +/// peer device triggers an event that requires a confirmation (indication) +/*@TRACE*/ +struct gatt_event_req_ind +{ + /// Event Type + uint8_t type; + /// Data length + uint16_t length; + /// Attribute handle + uint16_t handle; + /// Event Value + uint8_t value[]; +}; + +/// Confirm reception of event (trigger a confirmation message) +/*@TRACE*/ +struct gatt_event_cfm +{ + /// Attribute handle + uint16_t handle; +}; + +/// Register to peer device events command +/*@TRACE*/ +struct gatt_reg_to_peer_evt_cmd +{ + /// Request type + uint8_t operation; + /// operation sequence number + uint16_t seq_num; + /// attribute start handle + uint16_t start_hdl; + /// attribute end handle + uint16_t end_hdl; +}; + +/// Send an event to peer device +/*@TRACE*/ +struct gatt_send_evt_cmd +{ + /// Request type (notification / indication) + uint8_t operation; + /// operation sequence number + uint16_t seq_num; + /// characteristic handle + uint16_t handle; + /// length of packet to send + uint16_t length; + /// data value + uint8_t value[]; +}; + +/// Inform that attribute value is requested by lower layers. +/*@TRACE*/ +struct gatt_read_req_ind +{ + /// Handle of the attribute that has to be read + uint16_t handle; +}; + +/// Confirm Read Request requested by GATT to profile +/*@TRACE*/ +struct gatt_read_cfm +{ + /// Response type + uint8_t operation; + /// Status of read command execution by upper layers + uint8_t status; + /// Handle of the attribute read + uint16_t handle; + /// Data length read + uint16_t length; + /// attribute data value + uint8_t value[]; +}; + +/// Inform that a modification of database has been requested by peer device. +/*@TRACE*/ +struct gatt_write_req_ind +{ + /// Handle of the attribute that has to be written + uint16_t handle; + /// offset at which the data has to be written + uint16_t offset; + /// Data length to be written + uint16_t length; + /// Data to be written in attribute database + uint8_t value[]; +}; + +/// Confirm modification of database from upper layer when requested by peer device. +/*@TRACE*/ +struct gatt_write_cfm +{ + /// Response type + uint8_t operation; + /// Status of write command execution by upper layers + uint8_t status; + /// Handle of the attribute written + uint16_t handle; +}; + +/// Parameters for @ref GATT_SEND_SVC_CHANGED_CMD message +/*@TRACE*/ +struct gatt_send_svc_changed_cmd +{ + /// Request Type + uint8_t operation; + /// operation sequence number + uint16_t seq_num; + /// Start of Affected Attribute Handle Range + uint16_t svc_shdl; + /// End of Affected Attribute Handle Range + uint16_t svc_ehdl; +}; + +/// Parameters for @ref GATT_SVC_CHANGED_CFG_IND and @ref GATT_SVC_CHANGED message +/*@TRACE*/ +struct gatt_svc_changed_cfg +{ + /** + * Current value of the Client Characteristic Configuration descriptor for the Service + * Changed characteristic + */ + uint16_t ind_cfg; +}; + + +/// Request Attribute info to upper layer - could be trigger during prepare write +/*@TRACE*/ +struct gatt_att_info_req_ind +{ + /// Handle of the attribute for which info are requested + uint16_t handle; +}; + +/// Attribute info from upper layer confirmation +/*@TRACE*/ +struct gatt_att_info_cfm +{ + /// Response type + uint8_t operation; + /// use to know if it's possible to modify the attribute + /// can contains authorization or application error code. + uint8_t status; + /// Handle of the attribute + uint16_t handle; + /// Current length of the attribute + uint16_t length; +}; + + +/// Service Discovery command +/*@TRACE*/ +struct gatt_sdp_svc_disc_cmd +{ + /// GATT Request Type + /// - GATT_SDP_DISC_SVC Search specific service + /// - GATT_SDP_DISC_SVC_ALL Search for all services + /// - GATT_SDP_DISC_CANCEL Cancel Service Discovery Procedure + uint8_t operation; + /// Service UUID Length + uint8_t uuid_len; + /// operation sequence number + uint16_t seq_num; + /// Search start handle + uint16_t start_hdl; + /// Search end handle + uint16_t end_hdl; + /// Service UUID + uint8_t uuid[ATT_UUID128_LEN]; +}; + + +/// Information about included service +/*@TRACE*/ +struct gatt_sdp_include_svc +{ + /// Attribute Type + /// - GATT_SDP_INC_SVC: Included Service Information + uint8_t att_type; + /// Included service UUID Length + uint8_t uuid_len; + /// Included Service UUID + uint8_t uuid[ATT_UUID128_LEN]; + /// Included service Start Handle + uint16_t start_hdl; + /// Included service End Handle + uint16_t end_hdl; +}; + +/// Information about attribute characteristic +/*@TRACE*/ +struct gatt_sdp_att_char +{ + /// Attribute Type + /// - GATT_SDP_ATT_CHAR: Characteristic Declaration + uint8_t att_type; + /// Value property + uint8_t prop; + /// Value Handle + uint16_t handle; +}; + +/// Information about attribute +/*@TRACE*/ +struct gatt_sdp_att +{ + /// Attribute Type + /// - GATT_SDP_ATT_VAL: Attribute Value + /// - GATT_SDP_ATT_DESC: Attribute Descriptor + uint8_t att_type; + /// Attribute UUID Length + uint8_t uuid_len; + /// Attribute UUID + uint8_t uuid[ATT_UUID128_LEN]; +}; + +/// Attribute information +/*@TRACE + @trc_ref gatt_sdp_att_type + */ +union gatt_sdp_att_info +{ + /// Attribute Type + uint8_t att_type; + /// Information about attribute characteristic + //@trc_union att_type == GATT_SDP_ATT_CHAR + struct gatt_sdp_att_char att_char; + /// Information about included service + //@trc_union att_type == GATT_SDP_INC_SVC + struct gatt_sdp_include_svc inc_svc; + /// Information about attribute + //@trc_union att_type == GATT_SDP_ATT_VAL or att_type == GATT_SDP_ATT_DESC + struct gatt_sdp_att att; +}; + + +/// Service Discovery indicate that a service has been found. +/*@TRACE + @trc_arr info $end_hdl - $start_hdl + */ +struct gatt_sdp_svc_ind +{ + /// Service UUID Length + uint8_t uuid_len; + /// Service UUID + uint8_t uuid[ATT_UUID128_LEN]; + /// Service start handle + uint16_t start_hdl; + /// Service end handle + uint16_t end_hdl; + /// attribute information present in the service + /// (length = end_hdl - start_hdl) + union gatt_sdp_att_info info[]; +}; + +/// Indicate that an unknown message has been received +/*@TRACE*/ +struct gatt_unknown_msg_ind +{ + /// Unknown message id + msg_id_t unknown_msg_id; +}; + +/// Command used to enable Robust database caching +/// (Register to service changed, Set client supported features and read database hash) +/*@TRACE*/ +struct gatt_robust_db_cache_en_cmd +{ + /// GATT Request Type + /// - GATT_ROBUST_DB_CACHE_EN Enable Robust database caching + uint8_t operation; + /// operation sequence number + uint16_t seq_num; +}; + +/// Command used to read peer database hash +/*@TRACE*/ +struct gatt_read_db_hash_cmd +{ + /// GATT Request Type + /// - GATT_READ_DB_HASH Read peer database hash + uint8_t operation; + /// operation sequence number + uint16_t seq_num; +}; + +/// Provide value of the peer database hash +/*@TRACE*/ +struct gatt_db_hash_ind +{ + /// Database Hash + uint8_t hash[GAP_KEY_LEN]; +}; + +/// Informs that peer device database updated using service changed indication +/*@TRACE + @trc_arr info $end_hdl - $start_hdl + */ +struct gatt_svc_chg_req_ind +{ + /// Start handle + uint16_t start_handle; + /// End Handle + uint16_t end_handle; +}; + +/// Provide information about GATT for current connection that can be reuse on another connection +/*@TRACE*/ +struct gatt_con_info_ind +{ + // GATT Client Side + /// Peer GATT Service Start handle + uint16_t gatt_start_handle; + /// Peer GATT Service End Handle + uint16_t gatt_end_handle; + /// Peer Service Change value handle + uint16_t svc_chg_handle; + + // GATT Service Side + /// Client bond data information (@see enum gapc_cli_info) + uint8_t cli_info; + /// Client supported features (@see enum gapc_cli_feat) + uint8_t cli_feat; +}; + +#endif // _GATT_H_ diff --git a/ble/api/gatt_api.h b/ble/api/gatt_api.h new file mode 100644 index 0000000..dd0d79d --- /dev/null +++ b/ble/api/gatt_api.h @@ -0,0 +1,238 @@ +/** + **************************************************************************************** + * + * @file gatt_api.h + * + * @brief GATT API functions. + * + **************************************************************************************** + */ + +#ifndef GATT_API_H_ +#define GATT_API_H_ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include +#include "gatt.h" + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Gets the negotiated MTU. + * + * @param[in] conidx connection index + * + * @return MTU negotiated + **************************************************************************************** + */ +uint16_t gatt_get_mtu(uint8_t conidx); + +/** + **************************************************************************************** + * @brief Exchange MTU Command. + * + * @param[in] idx connection index + * @param[in] mtu Max MTU value (Minimum is 23) + * + * @return state in GATT_MTU_CHANGED_IND + **************************************************************************************** + */ +void gatt_exmtu(uint8_t conidx, uint16_t mtu); + +/** + **************************************************************************************** + * @brief Change service. + * + * @param[in] idx connection index + * @param[in] shdl Start handle + * @param[in] ehdl End handle + * @return state in GATT_SVC_CHANGED_CFG_IND + **************************************************************************************** + */ +void gatt_svc_chg(uint8_t conidx, uint16_t shdl, uint16_t ehdl); + +/** + **************************************************************************************** + * @brief Discovery command. + * + * @param[in] idx connection index + * @param[in] operation Operation flags @see GATT_OPERATION about discovery operation + * @param[in] shdl Start handle + * @param[in] ehdl End handle + * @param[in] ulen UUID length + * @param[in] uuid Pointer to the uuid data + * @return Info in GATT_DISC_SVC_IND,GATT_DISC_SVC_INCL_IND,GATT_DISC_CHAR_IND or GATT_DISC_CHAR_DESC_IND + **************************************************************************************** + */ +void gatt_disc(uint8_t conidx, uint8_t operation, uint16_t shdl, uint16_t ehdl, uint8_t ulen, const uint8_t *uuid); + +/** + **************************************************************************************** + * @brief Write command request. + * + * @param[in] idx Connection index + * @param[in] operation Operation flags @see GATT_OPERATION about Operation flags for writing/modifying attributes + * @param[in] handle Handle to Write + * @param[in] value Pointer to the value data + * @param[in] length Value length + * @return state in GATT_WRITE_REQ_IND + **************************************************************************************** + */ +void gatt_write(uint8_t conidx, uint8_t operation, uint16_t handle, uint8_t* value, uint16_t length); + +/** + **************************************************************************************** + * @brief Prepare write command request. + * + * @param[in] idx Connection index + * @param[in] handle Handle to write + * @param[in] value Pointer to the value data + * @param[in] length Value length + * @param[in] offset Write offset @see gatt_write_cmd + * @return state in GATT_ATT_INFO_REQ_IND + **************************************************************************************** + */ +void gatt_pre_write(uint8_t conidx, uint16_t handle, uint8_t* value, uint16_t length, uint16_t offset); + +/** + **************************************************************************************** + * @brief Execute write characteristic request. + * + * @param[in] idx Connection index + * @param[in] execute Cancel(0) / Execute(1) pending write operations + * @return state in GATT_WRITE_REQ_IND + **************************************************************************************** + */ +void gatt_exe_write(uint8_t conidx, bool execute); + +/** + **************************************************************************************** + * @brief Read command. + * + * @param[in] idx Connection index + * @param[in] handle Handle to read + * @param[in] length Data length + * @return state in GATT_READ_IND + **************************************************************************************** + */ +void gatt_read(uint8_t conidx, uint16_t handle, uint16_t length); + +/** + **************************************************************************************** + * @brief Read command. + * + * @param[in] idx Connection index + * @param[in] handle Handle to read + * @param[in] length Data length + * @param[in] offset Read offset @see gatt_read_simple + * @return state in GATT_READ_IND + **************************************************************************************** + */ +void gatt_read_long(uint8_t conidx, uint16_t handle, uint16_t length, uint16_t offset); + +/** + **************************************************************************************** + * @brief Read Using UUID. + * + * @param[in] idx Connection index + * @param[in] ulen UUID length + * @param[in] uuid Pointer to the uuid data + * @param[in] shdl Start handle + * @param[in] ehdl End handle + * @return state in GATT_READ_IND + **************************************************************************************** + */ +void gatt_read_by_uuid(uint8_t conidx, uint8_t ulen, uint8_t *uuid, uint16_t shdl, uint16_t ehdl); + +/** + **************************************************************************************** + * @brief Read Multiple Values. + * + * @param[in] idx Connection index + * @param[in] nb number of read @see gatt_read_cmd + * @param[in] handles Pointer to the handles data @see gatt_read_multiple + * @return state in GATT_READ_IND + **************************************************************************************** + */ +void gatt_read_by_multiple(uint8_t conidx, uint8_t nb, uint8_t* handles); + +/** + **************************************************************************************** + * @brief Write Confirm. + * + * @param[in] idx Connection index + * @param[in] status confirm status to peer. @see att_err + * @param[in] handle Handle to write confirm. + **************************************************************************************** + */ +void gatt_write_cfm(uint8_t conidx, uint8_t status, uint16_t handle); + +/** + **************************************************************************************** + * @brief Read Confirm. + * + * @param[in] idx Connection index + * @param[in] status confirm status to peer. @see att_err + * @param[in] handle Handle to read confirm. + * @param[in] length Data length + * @param[in] data Pointer the confirm data to peer. + **************************************************************************************** + */ +void gatt_read_cfm(uint8_t conidx, uint8_t status, uint16_t handle, uint16_t length, const uint8_t *data); + +/** + **************************************************************************************** + * @brief Info Confirm. + * + * @param[in] idx Connection index + * @param[in] status confirm status to peer. @see att_err + * @param[in] handle Handle to info confirm. + * @param[in] length Data length + **************************************************************************************** + */ +void gatt_info_cfm(uint8_t conidx, uint8_t status, uint16_t handle, uint16_t length); + +/** + **************************************************************************************** + * @brief Send notification to peer. + * + * @param[in] conidx Connection Index + * @param[in] handle Handle to NOTIFY. + * @param[in] length Data length + * @param[in] data Pointer the data to peer. + **************************************************************************************** + */ +void gatt_ntf_send(uint8_t conidx, uint16_t handle, uint16_t length, const uint8_t *data); + +/** + **************************************************************************************** + * @brief Send indication to peer. + * + * @param[in] conidx Connection Index + * @param[in] handle Handle to INDICATE. + * @param[in] length Data length + * @param[in] data Pointer the data to peer. + **************************************************************************************** + */ +void gatt_ind_send(uint8_t conidx, uint16_t handle, uint16_t length, const uint8_t *data); + +/** + **************************************************************************************** + * @brief Event Confirm. + * + * @param[in] idx Connection index + * @param[in] handle Handle to event confirm. + **************************************************************************************** + */ +void gatt_evt_cfm(uint8_t conidx, uint16_t handle); + + +#endif // GATT_API_H_ diff --git a/ble/api/ke_api.h b/ble/api/ke_api.h new file mode 100644 index 0000000..a383853 --- /dev/null +++ b/ble/api/ke_api.h @@ -0,0 +1,414 @@ +/** + **************************************************************************************** + * + * @file ke_api.h + * + * @brief kernel management API functions. + * + **************************************************************************************** + */ + +#ifndef KE_API_H_ +#define KE_API_H_ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include +#include +#include "task.h" +#include "list.h" + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// heap memory types. +enum mem_type +{ + /// Heap for environment allocated + MEM_ENV, + /// Heap for messages allocated + MEM_MSG, + + MEM_TYPE_MAX +}; + +typedef struct ke_heap_cfg +{ + uint32_t base[MEM_TYPE_MAX]; + uint16_t size[MEM_TYPE_MAX]; +} heap_cfg_t; + + +/* + * FUNCTION DECLARATIONS: Task API + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Create a task. + * + * @param[in] task_type Task type. + * @param[in] p_desc Pointer to task descriptor. + * + * @return Task status + **************************************************************************************** + */ +uint8_t ke_task_create(uint8_t task_type, task_func_t p_desc); + +/** + **************************************************************************************** + * @brief Delete a task. + * + * @param[in] task_type Task type. + * + * @return Task status + **************************************************************************************** + */ +uint8_t ke_task_delete(uint8_t task_type); + +/** + **************************************************************************************** + * @brief Retrieve the state of a task. + * + * @param[in] task Task id. + * + * @return Current state of the task + **************************************************************************************** + */ +state_t ke_state_get(task_id_t task); + +/** + **************************************************************************************** + * @brief Set the state of a task(try to activate saved messages queue). + * + * @param[in] task Task id + * @param[in] state New State + **************************************************************************************** + */ +void ke_state_set(task_id_t task, state_t state); + + +/* + * FUNCTION DECLARATIONS: Message API + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Convert a parameter pointer to a message pointer + * + * @param[in] param_ptr Pointer to the parameter member of a message + * + * @return The pointer to the message + **************************************************************************************** + */ +__INLINE__ struct msg_elem * ke_param2msg(const void *param_ptr) +{ + return (struct msg_elem*) (((uint8_t*)param_ptr) - offsetof(struct msg_elem, param)); +} + +/** + **************************************************************************************** + * @brief Convert a message pointer to a parameter pointer + * + * @param[in] msg Pointer to the message. + * + * @return The pointer to the param member + **************************************************************************************** + */ +__INLINE__ void * ke_msg2param(struct msg_elem const *msg) +{ + return (void*) (((uint8_t*) msg) + offsetof(struct msg_elem, param)); +} + +/** + **************************************************************************************** + * @brief Macro wrapper to ke_msg_alloc() and cast the returned pointer to struct. + * + * @param[in] msgid Message id + * @param[in] dest_id Destination Task id + * @param[in] src_id Source Task id + * @param[in] param_str parameter structure + * + * @return Pointer to the parameter member. + **************************************************************************************** + */ +#define KE_MSG_ALLOC(msgid, dest_id, src_id, param_str) \ + (struct param_str*) ke_msg_alloc(msgid, dest_id, src_id, sizeof(struct param_str)) + +/** + **************************************************************************************** + * @brief Macro wrapper to ke_msg_alloc() with a variable length data[] located at the end. + * + * @param[in] msgid Message id + * @param[in] dest_id Destination Task id + * @param[in] src_id Source Task id + * @param[in] param_str parameter structure + * @param[in] length length for the data + * + * @return Pointer to the parameter member. + **************************************************************************************** + */ +#define KE_MSG_ALLOC_DYN(msgid, dest_id, src_id, param_str, length) \ + (struct param_str*)ke_msg_alloc(msgid, dest_id, src_id, (sizeof(struct param_str) + (length))); + +/** + **************************************************************************************** + * @brief Allocate memory for a message + * + * This primitive allocates memory for a message that has to be sent. The memory + * is allocated dynamically on the heap and the length of the variable parameter + * structure has to be provided in order to allocate the correct size. + * + * The memory allocated will be automatically freed by the kernel, after the + * pointer has been sent to ke_msg_send(). If the message is not sent, it must + * be freed explicitly with ke_msg_free(). + * + * Allocation failure is considered critical and should not happen. + * + * @param[in] msgid Message id + * @param[in] dest_id Destination Task id + * @param[in] src_id Source Task id + * @param[in] param_len Size of the message parameters to be allocated + * + * @return Pointer to the parameter member of the message. If the parameter + * structure is empty, the pointer will point to the end of the message. + **************************************************************************************** + */ +void *ke_msg_alloc(msg_id_t msgid, task_id_t dest_id, task_id_t src_id, uint16_t param_len); + +/** + **************************************************************************************** + * @brief Send a message previously allocated with ke_msg_alloc() functions. + * + * The kernel will take care of freeing the message memory. + * Once the function have been called, it is not possible to access its data + * anymore as the kernel may have copied the message and freed the original + * memory. + * + * @param[in] param_ptr Pointer to the parameter member of the message + **************************************************************************************** + */ +void ke_msg_send(const void *param_ptr); + +/** + **************************************************************************************** + * @brief Send a message that has a zero length parameter member. + * + * @param[in] msgid Message id + * @param[in] dest_id Destination Task id + * @param[in] src_id Source Task id + **************************************************************************************** + */ +void ke_msg_send_basic(msg_id_t msgid, task_id_t dest_id, task_id_t src_id); + +/** + **************************************************************************************** + * @brief Forward a message to another task by changing its tasks IDs. + * + * @param[in] param_ptr Pointer to the parameter member of the message + * @param[in] dest_id New destination task of the message. + * @param[in] src_id New source task of the message. + **************************************************************************************** + */ +void ke_msg_forward(const void *param_ptr, task_id_t dest_id, task_id_t src_id); + +/** + **************************************************************************************** + * @brief Forward a message to another task by changing its message ID and tasks IDs. + * + * @param[in] param_ptr Pointer to the parameter member of the message. + * @param[in] msgid New ID of the message. + * @param[in] dest_id New destination task of the message. + * @param[in] src_id New source task of the message. + **************************************************************************************** + */ +void ke_msg_forward_new_id(const void *param_ptr, msg_id_t msgid, task_id_t dest_id, task_id_t src_id); + +/** + **************************************************************************************** + * @brief Marco wrapper to ke_msg_free() with the appropriate msg pointer as parameter. + * + * @param[in] param_ptr parameter structure pointer + **************************************************************************************** + */ +#define KE_MSG_FREE(param_ptr) ke_msg_free(ke_param2msg((param_ptr))) + +/** + **************************************************************************************** + * @brief Free allocated message + * + * @param[in] msg Pointer to the message(not the parameter member!) + **************************************************************************************** + */ +void ke_msg_free(struct msg_elem const *msg); + +/** + **************************************************************************************** + * @brief Retrieve destination task id of a message + * + * @param[in] param_ptr Pointer to the parameter member of the message. + * + * @return message destination task + **************************************************************************************** + */ +msg_id_t ke_msg_dest_id_get(const void *param_ptr); + +/** + **************************************************************************************** + * @brief Retrieve source task id of a message + * + * @param[in] param_ptr Pointer to the parameter member of the message. + * + * @return message source task + **************************************************************************************** + */ +msg_id_t ke_msg_src_id_get(const void *param_ptr); + +/** + **************************************************************************************** + * @brief Used to know if message is present in kernel queue or not. + * + * @param[in] param_ptr Pointer to the parameter member of the message. + * + * @return True if message is present in Kernel Queue, False else. + **************************************************************************************** + */ +bool ke_msg_in_queue(const void *param_ptr); + + +/* + * FUNCTION DECLARATIONS: Heap API + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Allocation of a size block of memory. + * + * @param[in] size Size of the memory area that need to be allocated. + * @param[in] type Type of memory block(@see mem_type) + * + * @return A pointer to the allocated memory area, or NULL if no memory is available. + **************************************************************************************** + */ +void *ke_malloc(uint32_t size, uint8_t type); + +/** + **************************************************************************************** + * @brief Check if it's possible to allocate a block of memory with a specific size. + * + * @param[in] size Size of the memory area that need to be allocated. + * @param[in] type Type of memory block(@see mem_type) + * + * @return True if memory block can be allocated, False else. + **************************************************************************************** + */ +bool ke_check_malloc(uint32_t size, uint8_t type); + +/** + **************************************************************************************** + * @brief Freeing of a block of memory. + * + * @param[in] mem_ptr Pointer to the memory area that need to be freed. + **************************************************************************************** + */ +void ke_free(void *mem_ptr); + +/** + **************************************************************************************** + * @brief Check if current heap is empty or not + * + * @param[in] type Type of memory heap block(@see mem_type) + * + * @return true if heap not used, false else. + **************************************************************************************** + */ +bool ke_mem_is_empty(uint8_t type); + +/** + **************************************************************************************** + * @brief Check if current pointer is free or not + * + * @param[in] mem_ptr pointer to a memory block + * + * @return true if already free, false else. + **************************************************************************************** + */ +bool ke_is_free(void* mem_ptr); + + +/* + * FUNCTION DECLARATIONS: Timer API + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Retrieve kernel time. + * + * @return time value (unit 10 ms) + **************************************************************************************** + */ +uint32_t ke_time(void); + +/** + **************************************************************************************** + * @brief Set a timer. + * + * The function first cancel the timer if it is already existing, then + * it creates a new one. The timer can be one-shot or periodic, i.e. it + * will be automatically set again after each trigger. + * + * When the timer expires, a message is sent to the task provided as + * argument, with the timer id as message id. + * + * @param[in] timer_id Timer id (message id type). + * @param[in] task Task id which will be notified + * @param[in] delay Delay in time units(10ms). + **************************************************************************************** + */ +void ke_timer_set(msg_id_t timer_id, task_id_t task, uint32_t delay); + +/** + **************************************************************************************** + * @brief Remove an registered timer. + * + * This function search for the timer identified by its id and its task id. + * If found it is stopped and freed, otherwise an error message is returned. + * + * @param[in] timer_id Timer id. + * @param[in] task Task id. + **************************************************************************************** + */ +void ke_timer_clear(msg_id_t timer_id, task_id_t task); + +/** + **************************************************************************************** + * @brief Checks if a requested timer is active(in the timer queue). + * + * @param[in] timer_id Timer id. + * @param[in] task Task id. + **************************************************************************************** + */ +bool ke_timer_active(msg_id_t timer_id, task_id_t task); + +/** + **************************************************************************************** + * @brief Adjust all timers to align to a new SCLK after a system clock adjust. + * + * @param[in] delay Delay in time units(10ms). + **************************************************************************************** + */ +void ke_timer_adjust_all(uint32_t delay); + + +#endif // KE_API_H_ + diff --git a/ble/api/l2cc.h b/ble/api/l2cc.h new file mode 100644 index 0000000..4615edf --- /dev/null +++ b/ble/api/l2cc.h @@ -0,0 +1,266 @@ +/** + **************************************************************************************** + * + * @file l2cc.h + * + * @brief L2CAP Controller Messages. + * + **************************************************************************************** + */ + +#ifndef L2CC_H_ +#define L2CC_H_ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "task.h" +#include + + +/* + * MESSAGES + **************************************************************************************** + */ + +/// Message of the L2CC task +/*@TRACE*/ +enum l2cc_msg_id +{ + /// L2CAP Operation completed event + L2CC_CMP_EVT = MSG_ID(L2CC, 0x04), + + /* ************* LE Credit Based Connection ************* */ + /// LE credit based connection request + L2CC_LECB_CONNECT_CMD = MSG_ID(L2CC, 0x05), + /// LE credit based connection request indication + L2CC_LECB_CONNECT_REQ_IND = MSG_ID(L2CC, 0x06), + /// LE credit based connection request confirmation + L2CC_LECB_CONNECT_CFM = MSG_ID(L2CC, 0x07), + /// LE credit based connection indication + L2CC_LECB_CONNECT_IND = MSG_ID(L2CC, 0x08), + /// LE credit based disconnect request + L2CC_LECB_DISCONNECT_CMD = MSG_ID(L2CC, 0x09), + /// LE credit based disconnect indication + L2CC_LECB_DISCONNECT_IND = MSG_ID(L2CC, 0x0A), + /// LE credit based credit addition + L2CC_LECB_ADD_CMD = MSG_ID(L2CC, 0x0B), + /// LE credit based credit addition indication + L2CC_LECB_ADD_IND = MSG_ID(L2CC, 0x0C), + + /// Send data over LE Credit Based Connection + L2CC_LECB_SDU_SEND_CMD = MSG_ID(L2CC, 0x0D), + /// Received data from LE Credit Based connection. + L2CC_LECB_SDU_RECV_IND = MSG_ID(L2CC, 0x0E), + /// Indication to the task that sends the unknown message + L2CC_UNKNOWN_MSG_IND = MSG_ID(L2CC, 0x0F), //!< L2CC_UNKNOWN_MSG_IND +}; + +/// request operation type - application interface +enum l2cc_op +{ + /* Operation Flags */ + /* No Operation (if nothing has been requested) */ + /* ************************************************ */ + /// No operation + L2CC_NO_OP = 0x00, + + /* LE Credit Based */ + /* ************************************************ */ + /// LE credit based connection request + L2CC_LECB_CONNECT, + /// LE credit based disconnection request + L2CC_LECB_DISCONNECT, + /// LE credit addition request + L2CC_LECB_CREDIT_ADD, + /// Send SDU + L2CC_LECB_SDU_SEND, +}; + +/// Default L2Cap SDU definition +/*@TRACE*/ +struct l2cc_sdu +{ + /// Channel Identifier + uint16_t cid; + /// Number of credit used + uint16_t credit; + /// SDU Data length + uint16_t length; + /// data + uint8_t data[]; +}; + +/// Operation completed event +/*@TRACE*/ +struct l2cc_cmp_evt +{ + /// L2CC request type (@see enum l2cc_op) + uint8_t operation; + /// Status of request. + uint8_t status; + /// Channel ID + uint16_t cid; + /// Number of peer credit used - only relevant for LECB + uint16_t credit; +}; + +/// LE credit based connection request +/*@TRACE*/ +struct l2cc_lecb_connect_cmd +{ + /// L2CC request type: + /// - L2CC_LECB_CONNECT: LE credit connection + uint8_t operation; + /// parameter used for internal usage + uint8_t pkt_id; + /// LE Protocol/Service Multiplexer + uint16_t le_psm; + /// Local Channel identifier (0: automatically allocate a free channel) + uint16_t local_cid; + /// Credit allocated for the LE Credit Based Connection + /// Shall be at least: floor(((SDU + 2) + (MPS - 1)) / MPS) + 1 + /// To be sure that 1 SDU can be fully received without requesting credits to application + uint16_t local_credit; + /// Maximum SDU size - Shall not exceed device MTU + uint16_t local_mtu; + /// Maximum Packet size - Shall not exceed device MPS + uint16_t local_mps; +}; + +/// LE credit based connection request indication +/*@TRACE*/ +struct l2cc_lecb_connect_req_ind +{ + /// LE Protocol/Service Multiplexer + uint16_t le_psm; + /// Peer Channel identifier + uint16_t peer_cid; + /// Maximum SDU size + uint16_t peer_mtu; + /// Maximum Packet size + uint16_t peer_mps; +}; + +/// LE credit based connection request confirmation +/*@TRACE*/ +struct l2cc_lecb_connect_cfm +{ + /// Peer Channel identifier + uint16_t peer_cid; + /// True to accept the incoming connection, False else + bool accept; + /// Local Channel identifier (0: automatically allocate a free channel) + uint16_t local_cid; + /// Credit allocated for the LE Credit Based Connection + /// Shall be at least: floor(((SDU + 2) + (MPS - 1)) / MPS) + 1 + /// To be sure that 1 SDU can be fully received without requesting credits to application + uint16_t local_credit; + /// Maximum SDU size - Shall not exceed device MTU + uint16_t local_mtu; + /// Maximum Packet size - Shall not exceed device MPS + uint16_t local_mps; +}; + +/// LE credit based connection indication +/*@TRACE*/ +struct l2cc_lecb_connect_ind +{ + /// Status + uint8_t status; + /// LE Protocol/Service Multiplexer + uint16_t le_psm; + /// Local Channel identifier + uint16_t local_cid; + /// Destination Credit for the LE Credit Based Connection + uint16_t peer_credit; + /// Maximum SDU size + uint16_t peer_mtu; + /// Maximum Packet size + uint16_t peer_mps; +}; + +/// LE credit based disconnect request +/*@TRACE*/ +struct l2cc_lecb_disconnect_cmd +{ + /// L2CC request type: + /// - L2CC_LECB_DISCONNECT: LE credit disconnection + uint8_t operation; + /// parameter used for internal usage + uint8_t pkt_id; + /// Local Channel identifier + uint16_t local_cid; +}; + +/// LE credit based disconnect indication +/*@TRACE*/ +struct l2cc_lecb_disconnect_ind +{ + /// Local Channel identifier + uint16_t local_cid; + /// Reason + uint8_t reason; +}; + +/// LE credit based credit addition +/*@TRACE*/ +struct l2cc_lecb_add_cmd +{ + /// L2CC request type: + /// - L2CC_LECB_CREDIT_ADD: LE credit addition + uint8_t operation; + /// parameter used for internal usage + uint8_t pkt_id; + /// Local Channel identifier + uint16_t local_cid; + /// Credit added locally for channel identifier + uint16_t credit; +}; + +/// LE credit based credit addition indication +/*@TRACE*/ +struct l2cc_lecb_add_ind +{ + /// Local Channel identifier + uint16_t local_cid; + /// Destination added credit (relative value) + uint16_t peer_added_credit; +}; + +/// Send data over an LE Credit Based Connection +/*@TRACE*/ +struct l2cc_lecb_sdu_send_cmd +{ + /// L2CC request type (@see enum l2cc_op): + /// - L2CC_LECB_SDU_SEND: Send a SDU + uint8_t operation; + /// offset value information - for internal use only + uint16_t offset; + /// SDU information + struct l2cc_sdu sdu; +}; + +/// Inform that a data packet has been received from a LE Credit Based connection. +/*@TRACE*/ +struct l2cc_lecb_sdu_recv_ind +{ + /// Status information + uint8_t status; + /// offset value information + uint16_t offset; + /// SDU information + struct l2cc_sdu sdu; +}; + +/// Indicate that an unknown message has been received +/*@TRACE*/ +struct l2cc_unknown_msg_ind +{ + /// Unknown message id + msg_id_t unknown_msg_id; +}; + +#endif // _L2CC_H_ diff --git a/ble/api/le_err.h b/ble/api/le_err.h new file mode 100644 index 0000000..e5ad728 --- /dev/null +++ b/ble/api/le_err.h @@ -0,0 +1,418 @@ +/** + **************************************************************************************** + * + * @file le_err.h + * + * @brief BLE Layers error codes. + * + **************************************************************************************** + */ + +#ifndef LE_ERR_H_ +#define LE_ERR_H_ + +/// No error, success +#define LE_SUCCESS 0x00 + +/// Error code from HCI TO HL Range - from 0x90 to 0xD5 +#define LE_ERR_HCI2HL(err) (((err) != 0) ? ((err) + 0x90) : (0)) + +/// Error code from HL TO HCI Range - from 0x90 to 0xD5 +#define LE_ERR_HL2HCI(err) (((err) > 0x90) ? ((err) - 0x90) : (0)) + + +/// GAP Specific Error Codes +enum gap_err +{ + /// No error + GAP_ERR_NO_ERROR = 0x00, + + /// Invalid parameters set + GAP_ERR_INVALID_PARAM = 0x40, + /// Problem with protocol exchange, get unexpected response + GAP_ERR_PROTOCOL_PROBLEM = 0x41, + /// Request not supported by software configuration + GAP_ERR_NOT_SUPPORTED = 0x42, + /// Request not allowed in current state. + GAP_ERR_COMMAND_DISALLOWED = 0x43, + /// Requested operation canceled. + GAP_ERR_CANCELED = 0x44, + /// Requested operation timeout. + GAP_ERR_TIMEOUT = 0x45, + /// Link connection lost during operation. + GAP_ERR_DISCONNECTED = 0x46, + /// Search algorithm finished, but no result found + GAP_ERR_NOT_FOUND = 0x47, + /// Request rejected by peer device + GAP_ERR_REJECTED = 0x48, + /// Problem with privacy configuration + GAP_ERR_PRIVACY_CFG_PB = 0x49, + /// Duplicate or invalid advertising data + GAP_ERR_ADV_DATA_INVALID = 0x4A, + /// Insufficient resources + GAP_ERR_INSUFF_RESOURCES = 0x4B, + /// Unexpected Error + GAP_ERR_UNEXPECTED = 0x4C, + /// Feature mismatch + GAP_ERR_MISMATCH = 0x4D, +}; + +/// ATT Specific Error Codes +enum att_err +{ + /// No error + ATT_ERR_NO_ERROR = 0x00, + + /// 0x01: Handle is invalid + ATT_ERR_INVALID_HANDLE = 0x01, + /// 0x02: Read permission disabled + ATT_ERR_READ_NOT_PERMITTED = 0x02, + /// 0x03: Write permission disabled + ATT_ERR_WRITE_NOT_PERMITTED = 0x03, + /// 0x04: Incorrect PDU + ATT_ERR_INVALID_PDU = 0x04, + /// 0x05: Authentication privilege not enough + ATT_ERR_INSUFF_AUTHEN = 0x05, + /// 0x06: Request not supported or not understood + ATT_ERR_REQUEST_NOT_SUPPORTED = 0x06, + /// 0x07: Incorrect offset value + ATT_ERR_INVALID_OFFSET = 0x07, + /// 0x08: Authorization privilege not enough + ATT_ERR_INSUFF_AUTHOR = 0x08, + /// 0x09: Capacity queue for reliable write reached + ATT_ERR_PREPARE_QUEUE_FULL = 0x09, + /// 0x0A: Attribute requested not existing + ATT_ERR_ATTRIBUTE_NOT_FOUND = 0x0A, + /// 0x0B: Attribute requested not long + ATT_ERR_ATTRIBUTE_NOT_LONG = 0x0B, + /// 0x0C: Encryption size not sufficient + ATT_ERR_INSUFF_ENC_KEY_SIZE = 0x0C, + /// 0x0D: Invalid length of the attribute value + ATT_ERR_INVALID_ATTRIBUTE_VAL_LEN = 0x0D, + /// 0x0E: Operation not fit to condition + ATT_ERR_UNLIKELY_ERR = 0x0E, + /// 0x0F: Attribute requires encryption before operation + ATT_ERR_INSUFF_ENC = 0x0F, + /// 0x10: Attribute grouping not supported + ATT_ERR_UNSUPP_GRP_TYPE = 0x10, + /// 0x11: Resources not sufficient to complete the request + ATT_ERR_INSUFF_RESOURCE = 0x11, + /// 0x80: Application error (also used in PRF Errors) + ATT_ERR_APP_ERROR = 0x80, +}; + +/// L2C Specific Error Codes +enum l2c_err +{ + /// No error + L2C_ERR_NO_ERROR = 0x00, + + /// Message cannot be sent because connection lost. (disconnected) + L2C_ERR_CONNECTION_LOST = 0x30, + /// Invalid PDU length exceed MTU + L2C_ERR_INVALID_MTU_EXCEED = 0x31, + /// Invalid PDU length exceed MPS + L2C_ERR_INVALID_MPS_EXCEED = 0x32, + /// Invalid Channel ID + L2C_ERR_INVALID_CID = 0x33, + /// Invalid PDU + L2C_ERR_INVALID_PDU = 0x34, + /// Connection refused - no resources available + L2C_ERR_NO_RES_AVAIL = 0x35, + /// Connection refused - insufficient authentication + L2C_ERR_INSUFF_AUTHEN = 0x36, + /// Connection refused - insufficient authorization + L2C_ERR_INSUFF_AUTHOR = 0x37, + /// Connection refused - insufficient encryption key size + L2C_ERR_INSUFF_ENC_KEY_SIZE = 0x38, + /// Connection Refused - insufficient encryption + L2C_ERR_INSUFF_ENC = 0x39, + /// Connection refused - LE_PSM not supported + L2C_ERR_LEPSM_NOT_SUPP = 0x3A, + /// No more credit + L2C_ERR_INSUFF_CREDIT = 0x3B, + /// Command not understood by peer device + L2C_ERR_NOT_UNDERSTOOD = 0x3C, + /// Credit error, invalid number of credit received + L2C_ERR_CREDIT_ERROR = 0x3D, + /// Channel identifier already allocated + L2C_ERR_CID_ALREADY_ALLOC = 0x3E, + /// Unknown PDU + L2C_ERR_UNKNOWN_PDU = 0x3F, +}; + +/// GATT Specific Error Codes +enum gatt_err +{ + /// No error + GATT_ERR_NO_ERROR = 0x00, + + /// Problem with ATTC protocol response + GATT_ERR_INVALID_ATT_LEN = 0x50, + /// Error in service search + GATT_ERR_INVALID_TYPE_IN_SVC_SEARCH = 0x51, + /// Invalid write data + GATT_ERR_WRITE = 0x52, + /// Signed write error + GATT_ERR_SIGNED_WRITE = 0x53, + /// No attribute client defined + GATT_ERR_ATTRIBUTE_CLIENT_MISSING = 0x54, + /// No attribute server defined + GATT_ERR_ATTRIBUTE_SERVER_MISSING = 0x55, + /// Permission set in service/attribute are invalid + GATT_ERR_INVALID_PERM = 0x56, +}; + +/// SMP Specific Error Codes +enum smp_err +{ + /// No error + SMP_ERR_NO_ERROR = 0x00, + + // Local device SMP Protocol Errors + /// The user input of pass key failed, for example, the user canceled the operation. + SMP_ERR_LOC_PASSKEY_ENTRY_FAILED = 0x61, + /// The OOB Data is not available. + SMP_ERR_LOC_OOB_NOT_AVAILABLE = 0x62, + /// The pairing procedure cannot be performed as authentication requirements cannot be met + /// due to IO capabilities of one or both devices. + SMP_ERR_LOC_AUTH_REQ = 0x63, + /// The confirm value does not match the calculated confirm value. + SMP_ERR_LOC_CONF_VAL_FAILED = 0x64, + /// Pairing is not supported by the device. + SMP_ERR_LOC_PAIRING_NOT_SUPP = 0x65, + /// The resultant encryption key size is insufficient for the security requirements of + /// this device. + SMP_ERR_LOC_ENC_KEY_SIZE = 0x66, + /// The SMP command received is not supported on this device. + SMP_ERR_LOC_CMD_NOT_SUPPORTED = 0x67, + /// Pairing failed due to an unspecified reason. + SMP_ERR_LOC_UNSPECIFIED_REASON = 0x68, + /// Pairing or Authentication procedure is disallowed because too little time has elapsed + /// since last pairing request or security request. + SMP_ERR_LOC_REPEATED_ATTEMPTS = 0x69, + /// The command length is invalid or a parameter is outside of the specified range. + SMP_ERR_LOC_INVALID_PARAM = 0x6A, + /// Indicates to the remote device that the DHKey Check value received doesn't + /// match the one calculated by the local device. + SMP_ERR_LOC_DHKEY_CHECK_FAILED = 0x6B, + /// Indicates that the confirm values in the numeric comparison protocol do not match. + SMP_ERR_LOC_NUMERIC_COMPARISON_FAILED = 0x6C, + + // Remote peer SMP Protocol Errors + /// The user input of passkey failed, for example, the user canceled the operation. + SMP_ERR_REM_PASSKEY_ENTRY_FAILED = 0x71, + /// The OOB Data is not available. + SMP_ERR_REM_OOB_NOT_AVAILABLE = 0x72, + /// The pairing procedure cannot be performed as authentication requirements cannot be + /// met due to IO capabilities of one or both devices. + SMP_ERR_REM_AUTH_REQ = 0x73, + /// The confirm value does not match the calculated confirm value. + SMP_ERR_REM_CONF_VAL_FAILED = 0x74, + /// Pairing is not supported by the device. + SMP_ERR_REM_PAIRING_NOT_SUPP = 0x75, + /// The resultant encryption key size is insufficient for the security requirements of + /// this device. + SMP_ERR_REM_ENC_KEY_SIZE = 0x76, + /// The SMP command received is not supported on this device. + SMP_ERR_REM_CMD_NOT_SUPPORTED = 0x77, + /// Pairing failed due to an unspecified reason. + SMP_ERR_REM_UNSPECIFIED_REASON = 0x78, + /// Pairing or Authentication procedure is disallowed because too little time has elapsed + /// since last pairing request or security request. + SMP_ERR_REM_REPEATED_ATTEMPTS = 0x79, + /// The command length is invalid or a parameter is outside of the specified range. + SMP_ERR_REM_INVALID_PARAM = 0x7A, + /// Indicates to the remote device that the DHKey Check value received doesn't + /// match the one calculated by the local device. + SMP_ERR_REM_DHKEY_CHECK_FAILED = 0x7B, + /// Indicates that the confirm values in the numeric comparison protocol do not match. + SMP_ERR_REM_NUMERIC_COMPARISON_FAILED = 0x7C, + + // SMP Errors triggered by local device + /// The provided resolvable address has not been resolved. + SMP_ERR_ADDR_RESOLV_FAIL = 0xD0, + /// The Signature Verification Failed + SMP_ERR_SIGN_VERIF_FAIL = 0xD1, + /// The encryption procedure failed because the slave device didn't find the LTK + /// needed to start an encryption session. + SMP_ERR_ENC_KEY_MISSING = 0xD2, + /// The encryption procedure failed because the slave device doesn't support the + /// encryption feature. + SMP_ERR_ENC_NOT_SUPPORTED = 0xD3, + /// A timeout has occurred during the start encryption session. + SMP_ERR_ENC_TIMEOUT = 0xD4, +}; + +/// Profiles Specific Error Codes +enum prf_err +{ + /// No error + PRF_ERR_NO_ERROR = 0x00, + + /// Application Error + PRF_ERR_APP_ERROR = 0x80, + /// Invalid parameter in request + PRF_ERR_INVALID_PARAM = 0x81, + /// Inexistent handle for sending a read/write characteristic request + PRF_ERR_INEXISTENT_HDL = 0x82, + /// Discovery stopped due to missing attribute according to specification + PRF_ERR_STOP_DISC_CHAR_MISSING = 0x83, + /// Too many SVC instances found -> protocol violation + PRF_ERR_MULTIPLE_SVC = 0x84, + /// Discovery stopped due to found attribute with incorrect properties + PRF_ERR_STOP_DISC_WRONG_CHAR_PROP = 0x85, + /// Too many Char. instances found-> protocol violation + PRF_ERR_MULTIPLE_CHAR = 0x86, + /// Attribute write not allowed + PRF_ERR_NOT_WRITABLE = 0x87, + /// Attribute read not allowed + PRF_ERR_NOT_READABLE = 0x88, + /// Request not allowed + PRF_ERR_REQ_DISALLOWED = 0x89, + /// Notification Not Enabled + PRF_ERR_NTF_DISABLED = 0x8A, + /// Indication Not Enabled + PRF_ERR_IND_DISABLED = 0x8B, + /// Feature not supported by profile + PRF_ERR_FEATURE_NOT_SUPPORTED = 0x8C, + /// Read value has an unexpected length + PRF_ERR_UNEXPECTED_LEN = 0x8D, + /// Disconnection occurs + PRF_ERR_DISCONNECTED = 0x8E, + /// Procedure Timeout + PRF_ERR_PROC_TIMEOUT = 0x8F, + /// Client characteristic configuration improperly configured + PRF_CCCD_IMPR_CONFIGURED = 0xFD, + /// Procedure already in progress + PRF_PROC_IN_PROGRESS = 0xFE, + /// Out of Range + PRF_OUT_OF_RANGE = 0xFF, +}; + +/// LL Conveyed Error Codes +enum ll_err +{ + /// No error + LL_ERR_NO_ERROR = 0x00, + + /// Unknown HCI Command + LL_ERR_UNKNOWN_HCI_COMMAND = 0x91, + /// Unknown Connection Identifier + LL_ERR_UNKNOWN_CONNECTION_ID = 0x92, + /// Hardware Failure + LL_ERR_HARDWARE_FAILURE = 0x93, + /// BT Page Timeout + LL_ERR_PAGE_TIMEOUT = 0x94, + /// Authentication failure + LL_ERR_AUTH_FAILURE = 0x95, + /// Pin code missing + LL_ERR_PIN_MISSING = 0x96, + /// Memory capacity exceed + LL_ERR_MEMORY_CAPA_EXCEED = 0x97, + /// Connection Timeout + LL_ERR_CON_TIMEOUT = 0x98, + /// Connection limit Exceed + LL_ERR_CON_LIMIT_EXCEED = 0x99, + /// Synchronous Connection limit exceed + LL_ERR_SYNC_CON_LIMIT_DEV_EXCEED = 0x9A, + /// ACL Connection exits + LL_ERR_ACL_CON_EXISTS = 0x9B, + /// Command Disallowed + LL_ERR_COMMAND_DISALLOWED = 0x9C, + /// Connection rejected due to limited resources + LL_ERR_CONN_REJ_LIMITED_RESOURCES = 0x9D, + /// Connection rejected due to security reason + LL_ERR_CONN_REJ_SECURITY_REASONS = 0x9E, + /// Connection rejected due to unacceptable BD Addr + LL_ERR_CONN_REJ_UNACCEPTABLE_BDADDR = 0x9F, + /// Connection rejected due to Accept connection timeout + LL_ERR_CONN_ACCEPT_TIMEOUT_EXCEED = 0xA0, + /// Not Supported + LL_ERR_UNSUPPORTED = 0xA1, + /// invalid parameters + LL_ERR_INVALID_HCI_PARAM = 0xA2, + /// Remote user terminate connection + LL_ERR_REMOTE_USER_TERM_CON = 0xA3, + /// Remote device terminate connection due to low resources + LL_ERR_REMOTE_DEV_TERM_LOW_RESOURCES = 0xA4, + /// Remote device terminate connection due to power off + LL_ERR_REMOTE_DEV_POWER_OFF = 0xA5, + /// Connection terminated by local host + LL_ERR_CON_TERM_BY_LOCAL_HOST = 0xA6, + /// Repeated attempts + LL_ERR_REPEATED_ATTEMPTS = 0xA7, + /// Pairing not Allowed + LL_ERR_PAIRING_NOT_ALLOWED = 0xA8, + /// Unknown PDU Error + LL_ERR_UNKNOWN_LMP_PDU = 0xA9, + /// Unsupported remote feature + LL_ERR_UNSUPPORTED_REMOTE_FEATURE = 0xAA, + /// Sco Offset rejected + LL_ERR_SCO_OFFSET_REJECTED = 0xAB, + /// SCO Interval Rejected + LL_ERR_SCO_INTERVAL_REJECTED = 0xAC, + /// SCO air mode Rejected + LL_ERR_SCO_AIR_MODE_REJECTED = 0xAD, + /// Invalid LMP parameters + LL_ERR_INVALID_LMP_PARAM = 0xAE, + /// Unspecified error + LL_ERR_UNSPECIFIED_ERROR = 0xAF, + /// Unsupported LMP Parameter value + LL_ERR_UNSUPPORTED_LMP_PARAM_VALUE = 0xB0, + /// Role Change Not allowed + LL_ERR_ROLE_CHANGE_NOT_ALLOWED = 0xB1, + /// LMP Response timeout + LL_ERR_LMP_RSP_TIMEOUT = 0xB2, + /// LMP Collision + LL_ERR_LMP_COLLISION = 0xB3, + /// LMP Pdu not allowed + LL_ERR_LMP_PDU_NOT_ALLOWED = 0xB4, + /// Encryption mode not accepted + LL_ERR_ENC_MODE_NOT_ACCEPT = 0xB5, + /// Link Key Cannot be changed + LL_ERR_LINK_KEY_CANT_CHANGE = 0xB6, + /// Quality of Service not supported + LL_ERR_QOS_NOT_SUPPORTED = 0xB7, + /// Error, instant passed + LL_ERR_INSTANT_PASSED = 0xB8, + /// Pairing with unit key not supported + LL_ERR_PAIRING_WITH_UNIT_KEY_NOT_SUP = 0xB9, + /// Transaction collision + LL_ERR_DIFF_TRANSACTION_COLLISION = 0xBA, + /// Unacceptable parameters + LL_ERR_QOS_UNACCEPTABLE_PARAM = 0xBC, + /// Quality of Service rejected + LL_ERR_QOS_REJECTED = 0xBD, + /// Channel class not supported + LL_ERR_CHANNEL_CLASS_NOT_SUP = 0xBE, + /// Insufficient security + LL_ERR_INSUFFICIENT_SECURITY = 0xBF, + /// Parameters out of mandatory range + LL_ERR_PARAM_OUT_OF_MAND_RANGE = 0xC0, + /// Role switch pending + LL_ERR_ROLE_SWITCH_PEND = 0xC2, + /// Reserved slot violation + LL_ERR_RESERVED_SLOT_VIOLATION = 0xC4, + /// Role Switch fail + LL_ERR_ROLE_SWITCH_FAIL = 0xC5, + /// Error, EIR too large + LL_ERR_EIR_TOO_LARGE = 0xC6, + /// Simple pairing not supported by host + LL_ERR_SP_NOT_SUPPORTED_HOST = 0xC7, + /// Host pairing is busy + LL_ERR_HOST_BUSY_PAIRING = 0xC8, + /// Controller is busy + LL_ERR_CONTROLLER_BUSY = 0xCA, + /// Unacceptable connection initialization + LL_ERR_UNACCEPTABLE_CONN_INT = 0xCB, + /// Direct Advertising Timeout + LL_ERR_DIRECT_ADV_TO = 0xCC, + /// Connection Terminated due to a MIC failure + LL_ERR_TERMINATED_MIC_FAILURE = 0xCD, + /// Connection failed to be established + LL_ERR_CONN_FAILED_TO_BE_EST = 0xCE, +}; + + +#endif // LE_ERR_H_ diff --git a/ble/api/list.h b/ble/api/list.h new file mode 100644 index 0000000..16cc0e2 --- /dev/null +++ b/ble/api/list.h @@ -0,0 +1,258 @@ +/** + **************************************************************************************** + * + * @file list.h + * + * @brief List definitions + * + **************************************************************************************** + */ + +#ifndef _LIST_H_ +#define _LIST_H_ + +/* + * INCLUDE FILES + **************************************************************************************** + */ +#include +#include +#include + +#ifndef __INLINE__ +#define __INLINE__ __forceinline static +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +/// structure of a list element header +typedef struct list_hdr +{ + /// Pointer to next list_hdr + struct list_hdr *next; +} list_hdr_t; + +/// structure of a list +typedef struct list +{ + /// pointer to first element of the list + struct list_hdr *first; + /// pointer to the last element + struct list_hdr *last; +} list_t; + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ +/** + **************************************************************************************** + * @brief Initialize a list to defaults values. + * + * @param list Pointer to the list structure. + **************************************************************************************** + */ +void list_init(list_t *list); + +/** + **************************************************************************************** + * @brief Construct a list of free elements representing a pool + * + * @param list Pointer to the list structure + * @param pool Pointer to the pool to be initialized + * @param elmt_size Size of one element of the pool + * @param elmt_cnt Nb of elements available in the pool + **************************************************************************************** + */ +void list_pool_init(list_t *list, void *pool, size_t elmt_size, uint32_t elmt_cnt); + +/** + **************************************************************************************** + * @brief Add an element as last on the list. + * + * @param list Pointer to the list structure + * @param list_hdr Pointer to the header to add at the end of the list + * + **************************************************************************************** + */ +void list_push_back(list_t *list, list_hdr_t *list_hdr); + +/** + **************************************************************************************** + * @brief Append a sequence of elements at the end of a list. + * + * Note: the elements to append shall be linked together + * + * @param list Pointer to the list structure + * @param first_hdr Pointer to the first element to append + * @param last_hdr Pointer to the last element to append + **************************************************************************************** + */ +void list_push_back_sublist(list_t *list, list_hdr_t *first_hdr, list_hdr_t *last_hdr); + +/** + **************************************************************************************** + * @brief Add an element as first on the list. + * + * @param list Pointer to the list structure + * @param list_hdr Pointer to the header to add at the beginning of the list + **************************************************************************************** + */ +void list_push_front(list_t *list, list_hdr_t *list_hdr); + +/** + **************************************************************************************** + * @brief Extract the first element of the list. + * @param list Pointer to the list structure + * @return The pointer to the element extracted, and NULL if the list is empty. + **************************************************************************************** + */ +list_hdr_t *list_pop_front(list_t *list); + +/** + **************************************************************************************** + * @brief Search for a given element in the list, and extract it if found. + * + * @param list Pointer to the list structure + * @param list_hdr Element to extract + * + * @return true if the element is found in the list, false otherwise + **************************************************************************************** + */ +bool list_extract(list_t *list, list_hdr_t *list_hdr); + +/** + **************************************************************************************** + * @brief Extract an element when the previous element is known + * + * Note: the element to remove shall follow immediately the reference within the list + * + * @param list Pointer to the list structure + * @param elt_ref_hdr Pointer to the referenced element (NULL if element to extract is the first in the list) + * @param elt_to_rem_hdr Pointer to the element to be extracted + **************************************************************************************** + */ +void list_extract_after(list_t *list, list_hdr_t *elt_ref_hdr, list_hdr_t *elt_to_rem_hdr); + +/** + **************************************************************************************** + * @brief Extract a sub-list when the previous element is known + * + * Note: the elements to remove shall be linked together and follow immediately the reference element + * + * @param[in] list Pointer to the list structure + * @param[in] ref_hdr Pointer to the referenced element (NULL if first element to extract is first in the list) + * @param[in] last_hdr Pointer to the last element to extract () + **************************************************************************************** + */ +void list_extract_sublist(list_t *list, list_hdr_t *ref_hdr, list_hdr_t *last_hdr); + +/** + **************************************************************************************** + * @brief Searched a given element in the list. + * + * @param list Pointer to the list structure + * @param list_hdr Pointer to the searched element + * + * @return true if the element is found in the list, false otherwise + **************************************************************************************** + */ +bool list_find(list_t *list, list_hdr_t *list_hdr); + +/** + **************************************************************************************** + * @brief Merge two lists in a single one. + * + * This function appends the list pointed by list2 to the list pointed by list1. Once the + * merge is done, it empties list2. + * + * @param list1 Pointer to the destination list + * @param list2 Pointer to the list to append to list1 + **************************************************************************************** + */ +void list_merge(list_t *list1, list_t *list2); + +/** + **************************************************************************************** + * @brief Insert a given element in the list before the referenced element. + * + * @param list Pointer to the list structure + * @param elt_ref_hdr Pointer to the referenced element + * @param elt_to_add_hdr Pointer to the element to be inserted + * + * @return true if the element is found in the list, false otherwise + **************************************************************************************** + */ +void list_insert_before(list_t *list, list_hdr_t *elt_ref_hdr, list_hdr_t *elt_to_add_hdr); + +/** + **************************************************************************************** + * @brief Insert a given element in the list after the referenced element. + * + * @param list Pointer to the list structure + * @param elt_ref_hdr Pointer to the referenced element + * @param elt_to_add_hdr Pointer to the element to be inserted + * + * @return true if the element is found in the list, false otherwise + **************************************************************************************** + */ +void list_insert_after(list_t *list, list_hdr_t *elt_ref_hdr, list_hdr_t *elt_to_add_hdr); + +/** + **************************************************************************************** + * @brief Count number of elements present in the list + * + * @param list Pointer to the list structure + * + * @return Number of elements present in the list + **************************************************************************************** + */ +uint16_t list_size(list_t *list); + +/** + **************************************************************************************** + * @brief Test if the list is empty. + * @param list Pointer to the list structure. + * @return true if the list is empty, false else otherwise. + **************************************************************************************** + */ +__INLINE__ bool list_is_empty(const list_t *const list) +{ + return (list->first == NULL); +} + +/** + **************************************************************************************** + * @brief Pick the first element from the list without removing it. + * + * @param list Pointer to the list structure. + * + * @return First element address. Returns NULL pointer if the list is empty. + **************************************************************************************** + */ +__INLINE__ list_hdr_t *list_pick(const list_t *const list) +{ + return(list->first); +} + +/** + **************************************************************************************** + * @brief Return following element of a list element. + * + * @param list_hdr Pointer to the list element. + * + * @return The pointer to the next element. + **************************************************************************************** + */ +__INLINE__ list_hdr_t *list_next(const list_hdr_t *const list_hdr) +{ + return(list_hdr->next); +} + + +#endif // _LIST_H_ diff --git a/ble/api/task.h b/ble/api/task.h new file mode 100644 index 0000000..272d266 --- /dev/null +++ b/ble/api/task.h @@ -0,0 +1,220 @@ +/** + **************************************************************************************** + * + * @file task.h + * + * @brief Task Definitions + * + **************************************************************************************** + */ + +#ifndef _TASK_H_ +#define _TASK_H_ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include +#include +#include "list.h" +#include "utils.h" +#include "blelib.h" + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// Type ID: 0~255(Group) +typedef uint8_t tid_t; + +/// State +typedef uint8_t state_t; + + +/** + * Task Identifier bit field + * + * 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 + * +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ + * | Instance Index | Task Type(Group ID) | + * +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ + * + * Bit [0-7] : task type (Group ID, @see enum TASK_TYPE) + * Bit [8-15]: instance index(single or multi-instantiated task) + */ +typedef uint16_t task_id_t; + +/// Builds task identifier from 'task' and 'index'. +#define TASK_BUILD(task, index) ((uint16_t)(((index) << 8) | (task))) + +/// Builds task identifier from 'type'(TASK_xxxx) and 'index'. +#define TASK_ID(type, index) ((uint16_t)(((index) << 8) | (TASK_ ## type))) + +/// Retrieves task type from 'task_id'. +#define TASK_TYPE(task_id) ((task_id) & 0xFF) + +/// Retrieves task index number from 'task_id'. +#define TASK_IDX(task_id) (((task_id) >> 8) & 0xFF) + +/// Invalid task +#define TASK_INVALID (0xFFFF) + + +/** + * Message Identifier bit field + * + * 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 + * +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ + * | Msg Type(Task Base) | Msg Index(Offset) | + * +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ + * + * Bit [0-7] : message index(no more than 255 messages per task) + * Bit [8-15]: message type (no more than 255 tasks support) + */ +typedef uint16_t msg_id_t; + +/// Build message identifier from 'type_id' and 'index'. +#define MSG_BUILD(tid, index) ((uint16_t)((tid) << 8) | (index)) + +/// Build message identifier from 'type'(TID_xxxx) and 'index'. +#define MSG_ID(type, index) ((uint16_t)((TID_ ## type) << 8) | (index)) + +/// Retrieves message type from 'msg_id'. +#define MSG_TYPE(msg_id) (((uint16_t)msg_id) >> 8) + +/// Retrieves message index from 'msg_id'. +#define MSG_IDX(msg_id) ((msg_id) & 0xFF) + +/// Default Message(to handle several message type in same handler). +#define MSG_DEFAULT (0xFFFF) + +/// Message to get Task State Pointer +#define MSG_TASK_STATE (0x0000) + +/// Format of task dispatch function type +typedef void* (*task_func_t)(msg_id_t msgid, uint8_t task_idx); + +/// Format of message handler function type +typedef int (*msg_func_t)(msg_id_t msgid, const void *param, \ + task_id_t dest_id, task_id_t src_id); + +/// Macro for message handler function definition +#define MSG_HANDLER(msg_name, param_struct) \ + static int msg_name##_handler(msg_id_t msgid, param_struct const *param, \ + task_id_t dest_id, task_id_t src_id) + +/// Macro for message handlers table definition +#define MSG_HANDLER_TAB(task) const struct msg_handler task##_msg_handler_tab[] = + + +/// Status returned by Message Handler +enum msg_status +{ + MSG_STATUS_FREE = 0, ///< consumed, msg and ext are freed by the kernel + MSG_STATUS_NO_FREE = 1, ///< consumed, nothing is freed by the kernel + MSG_STATUS_SAVED = 2, ///< not consumed, will be pushed in the saved queue +}; + +/// Status returned by task API functions +enum task_status +{ + TASK_OK = 0, + TASK_FAIL = 1, + TASK_ERR_UNKNOWN = 2, + TASK_ERR_EXCEEDED = 3, + TASK_ERR_EXISTS = 4, +}; + +/// Element of a message handler table. +struct msg_handler +{ + msg_id_t id; ///< Id of the handled message. + msg_func_t func; ///< Pointer to the handler function. +}; + +/// Message Element. +struct msg_elem +{ + list_hdr_t hdr; ///< List header for chaining + msg_id_t msgid; ///< Message id. + task_id_t dest_id; ///< Destination kernel identifier. + task_id_t src_id; ///< Source kernel identifier. + uint16_t param_len; ///< Parameter embedded struct length. + uint32_t param[]; ///< Parameter embedded struct. Must be word-aligned. +}; + +/// Tasks types definition +enum task_type +{ + /******** Low Layer Tasks ********/ + // Link Layer Controller Task + TASK_LLC = 0x01, + + // HCI Test & Debug Task + TASK_HCI = 0x02, + + /******** App Layer Tasks ********/ + // Application Main Task + TASK_APP = 0x03, + + /******** Host Layer Tasks ********/ + // L2CAP Controller Task + // - handles L2CAP attribute and security block. + TASK_L2CC = 0x04, + + // Generic Attribute Profile Task + // - includes services and characteristic discovery, configuration exchanges + // - and attribute value access operations(reading, writing, notification and indication). + TASK_GATT = 0x05, + + // Generic Access Profile Manager Task + // - manage all non connected stuff, configuring device mode(discoverable, connectable, etc.) + // - and perform required actions(scanning, connection, etc.) + // - and manage GAP Controller state according to corresponding BLE connection states. + TASK_GAPM = 0x06, + + // Generic Access Profile Controller Task + // - perform GAP action related to a BLE connection(pairing, update parameters, disconnect, etc.) + // - GAP controller is multi-instantiated, one task instance per BLE connection. + TASK_GAPC = 0x07, + + // Maximum number of tasks + TASK_MAX, + + // MACRO of Invalid Task + TASK_NONE = 0xFF, +}; + +/// Type ID for identifying Group(Messages and Profiles) +enum type_id +{ + /******** Low Layer Identifiers ********/ + TID_LLC = 1, // LL Controller + TID_LLD = 2, // LL Driver + TID_HCI = 3, // HCI + + /******** Host Layer Identifiers ********/ + TID_L2CC = 4, // L2CAP Controller + TID_GATT = 5, // Generic Attribute Profile + TID_GAPM = 6, // Generic Access Profile Manager + TID_GAPC = 7, // Generic Access Profile Controller + + /******** App Layer Identifiers ********/ + TID_APP = 9, // Application Task + TID_MESH = 10, // Mesh Reserved 10~15 + + /******** PRF Layer Identifiers ********/ + /* User customize */ + + /* End customize */ + + // MACRO of Invalid Identifier + TID_INVALID = 0xFF, +}; + + +#endif //_TASK_H_ diff --git a/ble/api/utils.h b/ble/api/utils.h new file mode 100644 index 0000000..8129e22 --- /dev/null +++ b/ble/api/utils.h @@ -0,0 +1,508 @@ +/** + **************************************************************************************** + * + * @file utils.h + * + * @brief Common Utilities definitions (functions and macros). + * + **************************************************************************************** + */ + +#ifndef _UTILS_H_ +#define _UTILS_H_ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include +#include +#include + +#ifndef __INLINE__ +#define __INLINE__ __forceinline static +#endif + +#ifndef ASSERT_ERR +/// Assertions showing a critical error +#define ASSERT_ERR(cond) + +/// Assertions showing a critical info +#define ASSERT_INFO(cond, param0, param1) + +/// Assertions showing a non-critical problem +#define ASSERT_WARN(cond, param0, param1) + +/// DUMP data array present in the SW. +#define DUMP_DATA(data, length) +#endif + + +/* + * MACRO + **************************************************************************************** + */ + +/// Value with one bit set +#ifndef BIT +#define BIT(pos) (1UL<<(pos)) +#endif + +#define IS_POWER2(n) ((n) && !((n) & (n-1))) + +/// Number of '1' bits in a byte +#define NB_1BITS(byte) popcnt8(byte) +#define ONE_BITS(byte) NB_1BITS(byte) + +/// Get the number of elements within an array +#define ARRAY_LEN(array) (sizeof((array))/sizeof((array)[0])) + +/// maroc to Get a structure from one of its structure field +#define CONTAINER_OF(ptr, type, member) ((type *)((char *)ptr - offsetof(type,member))) + +/// Bit checking +#define CHKF(flag, mask) (((flag)&(mask)) == mask) + +/// Get a field from a value containing several fields +/// @param[in] __r bit field value +/// @param[in] __f field name(_MASK & _LSB) +/// @return the value of the register masked and shifted +#define GETF(__r, __f) (( (__r) & (__f##_MASK) ) >> (__f##_LSB)) + +/// Set a field value into a value containing several fields. +/// @param[in] __r bit field value +/// @param[in] __f field name(_MASK & _LSB) +/// @param[in] __v value to put in field +#define SETF(__r, __f, __v) \ + do { \ + ASSERT_ERR( ( ( ( (__v) << (__f##_LSB) ) & ( ~(__f##_MASK) ) ) ) == 0); \ + __r = (((__r) & ~(__f##_MASK)) | (__v) << (__f##_LSB)); \ + } while (0) + +/// Get a bit field from a value containing several fields +/// @param[in] __r bit field value +/// @param[in] __b bit field name(_BIT & _POS) +/// @return the value of the register masked and shifted +#define GETB(__r, __b) (( (__r) & (__b##_BIT) ) >> (__b##_POS)) + +/// set a bit field value into a value containing several fields. +/// @param[in] __r bit field value +/// @param[in] __b bit field name +/// @param[in] __v value to put in field +#define SETB(__r, __b, __v) \ + do { \ + ASSERT_ERR( ( ( ( (__v) << (__b##_POS) ) & ( ~(__b##_BIT) ) ) ) == 0 ); \ + __r = (((__r) & ~(__b##_BIT)) | (__v) << (__b##_POS)); \ + } while (0) + + +/// Align value on the multiple of 4 equal or nearest higher. +/// @param[in] val Value to align. +#define ALIGN4_HI(_val) (((_val) + 3) & ~3) + +/// Align value on the multiple of 4 equal or nearest lower. +/// * @param[in] _val Value to align. +#define ALIGN4_LO(_val) ((_val) & ~3) + +/// @brief Align value on the multiple of 2 equal or nearest higher. +/// * @param[in] _val Value to align. +#define ALIGN2_HI(_val) (((_val) + 1) & ~1) + +/// @brief Align value on the multiple of 2 equal or nearest lower. +/// * @param[in] _val Value to align. +#define ALIGN2_LO(_val) ((_val) & ~1) + + +/// Perform a modulo(%) operation +/// @param[in] _val Dividend +/// @param[in] _div Divisor +#define MOD(_val, _div) ((_val) % (_div)) + +/// Perform a division and ceil up the result +/// * @param[in] _val Value to divide +/// * @param[in] _div Divide value +#define DIV_CEIL(_val, _div) (((_val) + ((_div) - 1))/ (_div)) + +/// Perform a division and round the result +/// @param[in] _val Value to divide +/// @param[in] _div Divide value +#define DIV_ROUND(_val, _div) (((_val) + ((_div) >> 1))/ (_div)) + +/// Increment value (wrap to 0 if reach max) +/// * @param[in] _val Value to inc +/// * @param[in] _max Max Range +#define VAL_INC(_val, _max) \ + (_val) = (_val) + 1; \ + if ((_val) >= (_max)) (_val) = 0 + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Function to initialize the random seed. + * @param[in] seed The seed number to use to generate the random sequence. + **************************************************************************************** + */ +__INLINE__ void rand_init(uint32_t seed) +{ + srand(seed); +} + +/** + **************************************************************************************** + * @brief Function to get an 8 bit random number. + * @return Random byte value. + **************************************************************************************** + */ +__INLINE__ uint8_t rand_byte(void) +{ + return (uint8_t)(rand() & 0xFF); +} + +/** + **************************************************************************************** + * @brief Function to get an 16 bit random number. + * @return Random half word value. + **************************************************************************************** + */ +__INLINE__ uint16_t rand_hword(void) +{ + return (uint16_t)(rand() & 0xFFFF); +} + +/** + **************************************************************************************** + * @brief Function to get an 32 bit random number. + * @return Random word value. + **************************************************************************************** + */ +__INLINE__ uint32_t rand_word(void) +{ + return (uint32_t)rand(); +} + + +/** + **************************************************************************************** + * @brief Read an aligned 32 bit word. + * @param[in] ptr32 The address of the first byte of the 32 bit word. + * @return The 32 bit value. + **************************************************************************************** + */ +__INLINE__ uint32_t read32(const void *ptr32) +{ + return *((uint32_t*)ptr32); +} + +/** + **************************************************************************************** + * @brief Read an aligned 16 bits word. + * @param[in] ptr16 The address of the first byte of the 16 bits word. + * @return The 16 bits value. + **************************************************************************************** + */ +__INLINE__ uint16_t read16(const void *ptr16) +{ + return *((uint16_t*)ptr16); +} + +/** + **************************************************************************************** + * @brief Write an aligned 32 bits word. + * @param[in] ptr32 The address of the first byte of the 32 bits word. + * @param[in] value The value to write. + **************************************************************************************** + */ +__INLINE__ void write32(const void *ptr32, uint32_t value) +{ + *(uint32_t*)ptr32 = value; +} + +/** + **************************************************************************************** + * @brief Write an aligned 16 bits word. + * @param[in] ptr16 The address of the first byte of the 16 bits word. + * @param[in] value The value to write. + **************************************************************************************** + */ +__INLINE__ void write16(const void *ptr16, uint32_t value) +{ + *(uint16_t*)ptr16 = value; +} + +/** + **************************************************************************************** + * @brief Write a 8 bits word. + * @param[in] ptr8 The address of the first byte of the 8 bits word. + * @param[in] value The value to write. + **************************************************************************************** + */ +__INLINE__ void write8(const void *ptr8, uint32_t value) +{ + *(uint8_t*)ptr8 = value; +} + +/** + **************************************************************************************** + * @brief Read a packed 16 bits word. + * @param[in] ptr16 The address of the first byte of the 16 bits word. + * @return The 16 bits value. + **************************************************************************************** + */ +__INLINE__ uint16_t read16p(const void *ptr16) +{ + uint16_t value = ((uint8_t *)ptr16)[0] | ((uint8_t *)ptr16)[1] << 8; + return value; +} + +/** + **************************************************************************************** + * @brief Write a packed 16 bits word. + * @param[in] ptr16 The address of the first byte of the 16 bits word. + * @param[in] value The value to write. + **************************************************************************************** + */ +__INLINE__ void write16p(const void *ptr16, uint16_t value) +{ + uint8_t *ptr=(uint8_t*)ptr16; + + *ptr++ = value&0xff; + *ptr = (value&0xff00)>>8; +} + +/** + **************************************************************************************** + * @brief Read a packed 24 bits word. + * @param[in] ptr24 The address of the first byte of the 24 bits word. + * @return The 24 bits value. + **************************************************************************************** + */ +__INLINE__ uint32_t read24p(const void *ptr24) +{ + uint16_t addr_l, addr_h; + addr_l = read16p(ptr24); + addr_h = *((uint8_t *)ptr24 + 2) & 0x00FF; + return ((uint32_t)addr_l | (uint32_t)addr_h << 16); +} + +/** + **************************************************************************************** + * @brief Write a packed 24 bits word. + * @param[in] ptr24 The address of the first byte of the 24 bits word. + * @param[in] value The value to write. + **************************************************************************************** + */ +__INLINE__ void write24p(const void *ptr24, uint32_t value) +{ + uint8_t *ptr=(uint8_t*)ptr24; + + *ptr++ = (uint8_t)(value&0xff); + *ptr++ = (uint8_t)((value&0xff00)>>8); + *ptr++ = (uint8_t)((value&0xff0000)>>16); +} + +/** + **************************************************************************************** + * @brief Read a packed 32 bits word. + * @param[in] ptr32 The address of the first byte of the 32 bits word. + * @return The 32 bits value. + **************************************************************************************** + */ +__INLINE__ uint32_t read32p(const void *ptr32) +{ + uint16_t addr_l, addr_h; + addr_l = read16p(ptr32); + addr_h = read16p((uint8_t *)ptr32 + 2); + return ((uint32_t)addr_l | (uint32_t)addr_h << 16); +} + +/** + **************************************************************************************** + * @brief Write a packed 32 bits word. + * @param[in] ptr32 The address of the first byte of the 32 bits word. + * @param[in] value The value to write. + **************************************************************************************** + */ +__INLINE__ void write32p(const void *ptr32, uint32_t value) +{ + uint8_t *ptr=(uint8_t*)ptr32; + + *ptr++ = (uint8_t)(value&0xff); + *ptr++ = (uint8_t)((value&0xff00)>>8); + *ptr++ = (uint8_t)((value&0xff0000)>>16); + *ptr = (uint8_t)((value&0xff000000)>>24); +} + + +/** + **************************************************************************************** + * @brief Count leading zeros. + * @param[in] val Value to count the number of leading zeros on. + * @return Number of leading zeros when value is written as 32 bits. + **************************************************************************************** + */ +#if !(USE_ARM_FUNC) +uint32_t co_clz(uint32_t val); +#else +__INLINE__ uint32_t co_clz(uint32_t val) +{ + #if defined(__arm__) + return __builtin_clz(val); + #elif defined(__GNUC__) + if (val == 0) + { + return 32; + } + return __builtin_clz(val); + #else + uint32_t i; + for (i = 0; i < 32; i++) + { + if (val & BIT(31 - i)) + break; + } + return i; + #endif // defined(__arm__) +} +#endif //(USE_ARM_FUNC) + +/** + **************************************************************************************** + * @brief Count trailing zeros. + * @param[in] val Value to count the number of trailing zeros on. + * @return Number of trailing zeros when value is written as 32 bits. + **************************************************************************************** + */ +#if !(USE_ARM_FUNC) +uint32_t co_ctz(uint32_t val); +#else +__INLINE__ uint32_t co_ctz(uint32_t val) +{ + #if defined(__arm__) + return __builtin_ctz(val); + #elif defined(__GNUC__) + if (val == 0) + { + return 32; + } + return __builtin_ctz(val); + #else + uint32_t i; + for (i = 0; i < 32; i++) + { + if (val & BIT(i)) + break; + } + return i; + #endif // defined(__arm__) +} +#endif //(USE_ARM_FUNC) + +/** + **************************************************************************************** + * @brief Count binary ones. + * @param[in] val Value to count the number of ones in the binary representation. + * @return Number of ones when value is written as 32 bits. + **************************************************************************************** + */ +#if !(USE_ARM_FUNC) +uint8_t co_ones(uint32_t val); +#else +__INLINE__ uint8_t co_ones(uint32_t val) +{ + #if defined(__arm__) || defined(__GNUC__) + return __builtin_popcount(val); + #else + uint32_t i, ones=0; + for (i = 0; i < 32; i++) + { + if (val & BIT(i)) + ones++; + } + return ones; + #endif // defined(__arm__) +} +#endif //(USE_ARM_FUNC) + +/** + **************************************************************************************** + * @brief Count '1' bits in a byte value, repalce NB_1BITS(byte) + * @return Number of '1' bits in a byte + **************************************************************************************** + */ +uint8_t popcnt8(uint8_t byte); + +/** + **************************************************************************************** + * @brief Function to return the smallest of 2 unsigned 32 bits words. + * @return The smallest value. + **************************************************************************************** + */ +__INLINE__ uint32_t co_min(uint32_t a, uint32_t b) +{ + return a < b ? a : b; +} + +/** + **************************************************************************************** + * @brief Function to return the smallest of 2 signed 32 bits words. + * @return The smallest value. + **************************************************************************************** + */ +__INLINE__ int32_t co_min_s(int32_t a, int32_t b) +{ + return a < b ? a : b; +} + +/** + **************************************************************************************** + * @brief Function to return the greatest of 2 unsigned 32 bits words. + * @return The greatest value. + **************************************************************************************** + */ +__INLINE__ uint32_t co_max(uint32_t a, uint32_t b) +{ + return a > b ? a : b; +} + +/** + **************************************************************************************** + * @brief Function to return the absolute value of a signed integer. + * @return The absolute value. + **************************************************************************************** + */ +__INLINE__ int co_abs(int val) +{ + return val < 0 ? val*(-1) : val; +} + +/** + **************************************************************************************** + * @brief Perform a modulo operation + * @return val%div + **************************************************************************************** + */ +__INLINE__ uint32_t co_mod(uint32_t val, uint32_t div) +{ + //ASSERT_ERR(div); + return ((val) % (div)); +} + +/** + **************************************************************************************** + * @brief Function to return the hex char of a 4bit. + * @return The hex char. + **************************************************************************************** + */ +__INLINE__ uint8_t co_hex(uint8_t b4) +{ + return b4 < 10 ? b4 + '0' : b4 - 10 + 'A'; +} + + +#endif // _UTILS_H_ diff --git a/ble/app/app.c b/ble/app/app.c new file mode 100644 index 0000000..d26b42a --- /dev/null +++ b/ble/app/app.c @@ -0,0 +1,584 @@ +/** + **************************************************************************************** + * + * @file app.c + * + * @brief Application entry point - Example + * + * < __weak func as demo, recommend to Override its in 'user porject'/src/myapp.c > + **************************************************************************************** + */ + +#include "app.h" +#include "bledef.h" +#include "drvs.h" +#include "prf_api.h" + +#if (DBG_APP) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFAULT CONFIGURATION + **************************************************************************************** + */ + +#if !defined(BLE_DEV_NAME) + #define BLE_DEV_NAME "myBle6" +#endif + +#if !defined(BLE_ADDR) + #define BLE_ADDR { 0x30, 0x06, 0x23, 0x20, 0x01, 0xD2 } +#endif + +#if !defined(BLE_ROLE) +#if (BLE_NB_SLAVE && BLE_NB_MASTER) + #define BLE_ROLE (GAP_ROLE_CENTRAL | GAP_ROLE_PERIPHERAL) +#elif (BLE_NB_MASTER) + #define BLE_ROLE (GAP_ROLE_CENTRAL) +#else // Only Slave + #define BLE_ROLE (GAP_ROLE_PERIPHERAL) +#endif +#endif + +#if !defined(BLE_PHY) + #define BLE_PHY (GAP_PHY_LE_1MBPS) // | GAP_PHY_LE_2MBPS) +#endif + +#if !defined(BLE_PAIRING) + #define BLE_PAIRING (GAPM_PAIRING_LEGACY) +#endif + +#if !defined(BLE_AUTH) + #define BLE_AUTH (GAP_AUTH_REQ_NO_MITM_NO_BOND) +#endif + +#if !defined(BLE_SECREQ) + #define BLE_SECREQ (GAP_NO_SEC) +#endif + + +/* + * VARIABLES DEFINITIONS + **************************************************************************************** + */ + +/// Application Environment +__VAR_ENV struct app_env_tag app_env; + +/// Ble local address (user customize) +const bd_addr_t ble_dev_addr = { BLE_ADDR }; + +/// GAP device configuration +const struct gapm_dev_config ble_dev_config = +{ + // Device Role: Central, Peripheral (@see gap_role) + .gap_role = BLE_ROLE, + + // Pairing mode authorized (@see enum gapm_pairing_mode) + .pairing = BLE_PAIRING, + + // Preferred LE PHY for data (@see enum gap_phy) + .pref_phy = BLE_PHY, + + // Maximal MTU acceptable for device (23~512) + .max_mtu = BLE_MTU, +}; + +/// GAP debug LTK for testing +#if (BLE_DBG_LTK) +const struct gapc_ltk debugLTK = +{ + /// Long Term Key + .ltk = {{0x88, 0x0D, 0x00, 0x20, 0xAC, 0x32, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00}}, + /// Encryption Diversifier + .ediv = 0xB951, + /// Random Number + .randnb = {{0x02, 0x18, 0xAC, 0x32, 0x00, 0x20, 0x00, 0x00}}, + /// Encryption key size (7 to 16) + .key_size = 16, + /// Extend Info + .ext_info =0, +}; +#endif + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @section Profile Interface + **************************************************************************************** + */ + +// Connection interval unit in 1.25ms +#define SLV_PREF_INTV_MIN (10) +#define SLV_PREF_INTV_MAX (10) +// Slave latency +#define SLV_PREF_LATENCY (0) +// Connection supervision timeout multiplier unit in 10ms +#define SLV_PREF_TIME_OUT (300) + +/** + **************************************************************************************** + * @brief Retrieve Dev Info to Generic Access Profile, User implement for Callback. + * + * @param[in] conidx connection index + * @param[in] req iequest of info type @see enum gapc_dev_info + * @param[in] maxlen buffer length, DEV_NAME_MAX_LEN or size of gapc_conn_param + * @param[out] info pointer of buffer + * + * @return Length of device information, 0 means an error occurs. + **************************************************************************************** + */ +__weak uint16_t gap_svc_get_dev_info(uint8_t conidx, uint8_t req, uint16_t maxlen, uint8_t *info) +{ + if (req == GAPC_DEV_NAME) + { + return app_name_get(DEV_NAME_MAX_LEN, info); + } + else if (req == GAPC_DEV_APPEARANCE) + { + write16(info, app_icon_get()); + return sizeof(uint16_t); + } + #if (GAP_ATT_CFG & 0x40/*PCP_EN*/) + else if (req == GAPC_DEV_SLV_PREF_PARAMS) + { + struct gapc_conn_param *slv_pref = (struct gapc_conn_param *)info; + // Peripheral Preferred Connection Parameters + slv_pref->intv_min = SLV_PREF_INTV_MIN; + slv_pref->intv_max = SLV_PREF_INTV_MAX; + slv_pref->latency = SLV_PREF_LATENCY; + slv_pref->time_out = SLV_PREF_TIME_OUT; + return sizeof(struct gapc_conn_param); + } + #endif + + return 0; +} + +/** + **************************************************************************************** + * @brief Create profiles, maybe User Override! (__weak func) + * Added in order and judged status in each profile-func. + **************************************************************************************** + */ +__weak void app_prf_create(void) +{ + // Generic Access Profile(0x1800) + gap_svc_init(GAP_START_HDL, GAP_ATT_CFG); + + // Generic Attribute Profile(0x1801) + #if (PRF_GATT) + gatt_svc_init(GATT_START_HDL); + #endif + + // Standard Profiles + #if (PRF_DISS) + diss_svc_init(); + #endif + + #if (PRF_BASS) + bass_svc_init(); + #endif + + #if (PRF_HIDS) + hids_prf_init(); + #endif + + #if (PRF_SCPS) + scps_svc_init(); + #endif + + #if (PRF_MESH) + mesh_svc_init(MESH_START_HDL, MESH_SVC_CFG); + #endif + + // Customize Profiles + #if (PRF_SESS) + sess_svc_init(); + #endif + + #if (PRF_OTAS) + otas_svc_init(); + #endif + + #if (PRF_PTSS) + ptss_svc_init(); + #endif +} + + +/** + **************************************************************************************** + * @section App Interface + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief API to Init Application, maybe User Override! (__weak func) + * + * @param[in] rsn reset reason @see enum rst_src_bfs + **************************************************************************************** + */ +__weak void app_init(uint16_t rsn) +{ + // Init BLE and App to startup or Resume BLE to continue if it wakeup from poweroff. + #if (BLE_LITELIB) + if (RSN_IS_BLE_WKUP(rsn)) + { + // Resume BLE (Only supported in LiteLib) + ble_resume(); + rc32k_conf(RCLK_DPLL, 7); + } + else + #endif //(BLE_LITELIB) + { + heap_cfg_t heap; + + // Config Heap, resized with special lib + heap.base[MEM_ENV] = BLE_HEAP_BASE; + heap.size[MEM_ENV] = BLE_HEAP_ENV_SIZE; + heap.base[MEM_MSG] = BLE_HEAP_BASE + BLE_HEAP_ENV_SIZE; + heap.size[MEM_MSG] = BLE_HEAP_MSG_SIZE; + ble_heap(&heap); + + // Init BLE and App + ble_init(); + ble_app(); + + // Init RC32K with Calibration + #if (CFG_SLEEP || RC32K_CALIB_PERIOD) + //rc32k_init(); - replace to watch calib result + rc32k_conf(RCLK_DPLL, 7); + + uint16_t trim = rc32k_calib(); + DEBUG("RC32K Calib(Msb:%d,Lsb:%d)", trim & 0xF, trim >> 4); + + #endif //(CFG_SLEEP || RC32K_CALIB_PERIOD) + } + + // Init RF & Modem + rfmdm_init(); + + NVIC_EnableIRQ(BLE_IRQn); +} + +/** + **************************************************************************************** + * @brief API to Set State of Application, maybe User Override! (__weak func) + * + * @param[in] state new state + **************************************************************************************** + */ +__weak void app_state_set(uint8_t state) +{ + DEBUG("State(old:%d,new:%d)", app_state_get(), state); + + app_env.state = state; + + // Indication, User add more... + +} + +/** + **************************************************************************************** + * @brief API to Get Device Name, maybe User Override! (__weak func) + * + * @param[in] size Length of name Buffer + * @param[out] name Pointer of name buffer + * + * @return Length of device name + **************************************************************************************** + */ +__weak uint8_t app_name_get(uint8_t size, uint8_t *name) +{ + uint8_t len = sizeof(BLE_DEV_NAME) - 1; + + // eg. prefix(BLE_DEV_NAME) + suffix(Addr[0]) + if (size < len + 2) + { + // no enough buffer, short copy + len = size; + memcpy(name, BLE_DEV_NAME, len); + } + else + { + // prefix + suffix + memcpy(name, BLE_DEV_NAME, len); + name[len++] = co_hex(ble_dev_addr.addr[0] >> 4); + name[len++] = co_hex(ble_dev_addr.addr[0] & 0x0F); + } + + return len; +} + + +/** + **************************************************************************************** + * @section FSM Interface + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Finite state machine for Device Configure, maybe User Override! (__weak func) + * + * @param[in] evt configure event @see enum ble_event + **************************************************************************************** + */ +__weak void app_conf_fsm(uint8_t evt) +{ + if (evt == BLE_RESET) + { + memset(&app_env, 0, sizeof(app_env)); + + // Set device config + gapm_set_dev(&ble_dev_config, &ble_dev_addr, NULL); + } + else /*if (evt == BLE_CONFIGURED)*/ + { + #if (CFG_SLEEP) + // Set Sleep duration if need + + #if (RC32K_CALIB_PERIOD) + ke_timer_set(APP_TIMER_RC32K_CORR, TASK_APP, RC32K_CALIB_PERIOD); + #endif //(RC32K_CALIB_PERIOD) + #endif //(CFG_SLEEP) + + app_state_set(APP_IDLE); + + // Create Profiles + app_prf_create(); + + #if (APP_ACTV_EN) + // Create Activities + app_actv_create(); + #endif //(APP_ACTV_EN) + + #if (PRF_MESH) + // Create Mesh Instance + app_mesh_create(); + #endif //(PRF_MESH) + } +} + +/** + **************************************************************************************** + * @brief Finite state machine for connection event, maybe User Override! (__weak func) + * + * @param[in] evt connection event @see enum ble_event + * @param[in] conidx connection index + * @param[in] param param of connection event + **************************************************************************************** + */ +__weak void app_conn_fsm(uint8_t evt, uint8_t conidx, const void* param) +{ + switch (evt) + { + case BLE_CONNECTED: + { + // Connected state, record Index + app_env.curidx = conidx; + app_state_set(APP_CONNECTED); + + #if (BLE_MULTI_CONN) + uint8_t role = gapc_get_role(conidx); + // Set Connection Bit of conidx + app_env.conbits |= (1 << conidx); + app_env.conrole = (app_env.conrole & ~(1 << conidx)) | (role << conidx); + + DEBUG(" multi(cbit:%02X,rbit:%02X,curr:%d)", app_env.conbits, app_env.conrole, app_env.curidx); + + // Restart Advertising for more connections as slave role - update from v1.3 + if ((role == ROLE_SLAVE)&& (ONE_BITS(app_env.conrole) < BLE_NB_SLAVE)) + { + app_adv_action(ACTV_START); + } + #endif //(BLE_MULTI_CONN) + + gapc_connect_rsp(conidx, BLE_AUTH); + // Enable profiles by role + } break; + + case BLE_DISCONNECTED: + { + #if (BLE_MULTI_CONN) + DEBUG(" Befor(cbit:%02X,rbit:%02X,curr:%d)", app_env.conbits, app_env.conrole, app_env.curidx); + // Clr Connection Bit of conidx + app_env.conbits &= ~(1 << conidx); + + if (app_env.conbits == 0) + { + // Go READY when all disconnected + app_state_set(APP_READY); + } + else + { + // Find new index when curr disconnected + if (conidx == app_env.curidx) + { + // Least index of connection or * User customize * + app_env.curidx = co_ctz(app_env.conbits); + } + } + + // Role Operation + if (app_env.conrole & (1 << conidx)) + { + // As slave role, Clr Bit + app_env.conrole &= ~(1 << conidx); + + #if (APP_ACTV_EN && BLE_EN_ADV) + // Restart Advertising + app_adv_action(ACTV_START); + #endif //(APP_ACTV_EN && BLE_EN_ADV) + } + #if (BLE_NB_MASTER) + else + { + struct gapc_disconnect_ind *param = (struct gapc_disconnect_ind *)param; + + // As master role, to do * User customize * + if (param->reason == 8 /*ERR_CON_TIMEOUT*/) + { + + } + } + #endif // BLE_NB_MASTER + DEBUG(" After(cbit:%02X,rbit:%02X,curr:%d)", app_env.conbits, app_env.conrole, app_env.curidx); + #else + { + app_state_set(APP_READY); + + #if (APP_ACTV_EN && BLE_EN_ADV) + // Slave role, Restart Advertising + app_adv_action(ACTV_START); + #endif //(APP_ACTV_EN && BLE_EN_ADV) + } + #endif //(BLE_MULTI_CONN) + } break; + + case BLE_BONDED: + { + // todo, eg. save the generated slave's LTK to flash + app_ltk_save(conidx, NULL); + } break; + + case BLE_ENCRYPTED: + { + // todo + } break; + + default: + break; + } +} + + +/** + **************************************************************************************** + * @section SMP Interface + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief API to Get Pairing Feature, maybe User Override! (__weak func) + * + * @param[out] feat Pointer of pairing buffer to fill + **************************************************************************************** + */ +__weak void app_pairing_get(struct gapc_pairing *feat) +{ + // IO capabilities (@see gap_io_cap) + feat->iocap = GAP_IO_CAP_NO_INPUT_NO_OUTPUT; + // OOB information (@see gap_oob) + feat->oob = GAP_OOB_AUTH_DATA_NOT_PRESENT; + // Authentication (@see gap_auth) + feat->auth = BLE_AUTH; + // Encryption key size (7 to 16) + feat->key_size = GAP_KEY_LEN; + //Initiator key distribution (@see gap_kdist) + feat->ikey_dist = GAP_KDIST_NONE; + //Responder key distribution (@see gap_kdist) + feat->rkey_dist = GAP_KDIST_ENCKEY; + // Device security requirements (@see gap_sec_req) + feat->sec_req = BLE_SECREQ; +} + +/** + **************************************************************************************** + * @brief API to Generate LTK for bonding, maybe User Override! (__weak func) + * + * @param[in] conidx connection index + * @param[in|out] ltk Pointer of ltk buffer + **************************************************************************************** + */ +__weak void app_ltk_gen(uint8_t conidx, struct gapc_ltk *ltk) +{ + // generate key values, User need record it to save later + // ltk->ediv = (uint16_t)rand_word(); + // ltk->key_size = GAP_KEY_LEN; + // ltk->ext_info = 0; + // for (uint8_t i = 0; i < GAP_RAND_NB_LEN; i++) + // { + // ltk->randnb.nb[i] = (uint8_t)rand_word(); + // } + // for (uint8_t i = 0; i < GAP_KEY_LEN; i++) + // { + // ltk->ltk.key[i] = (uint8_t)rand_word(); + // } + + #if (BLE_DBG_LTK) + // (here use debugLTK as testing) + memcpy(ltk, &debugLTK, sizeof(struct gapc_ltk)); + #endif +} + +/** + **************************************************************************************** + * @brief API to Save LTK when bonded, maybe User Override! (__weak func) + * + * @param[in] conidx connection index + * @param[in] ltk Pointer of LTK data + **************************************************************************************** + */ +__weak void app_ltk_save(uint8_t conidx, const struct gapc_ltk *ltk) +{ + // todo, save slave's LTK to flash +} + +/** + **************************************************************************************** + * @brief API to Find LTK when re-encryption, maybe User Override! (__weak func) + * + * @param[in] ediv EDIV value for matching + * @param[in] rand_nb Rand Nb values for matching + * + * @return NULL for not matched, else return Pointer of LTK found. + **************************************************************************************** + */ +__weak const uint8_t *app_ltk_find(uint16_t ediv, const uint8_t *rand_nb) +{ + // Compare ediv and rand_nb (here use debugLTK as testing) + #if (BLE_DBG_LTK) + if ((ediv == debugLTK.ediv) + && (memcmp(rand_nb, debugLTK.randnb.nb, GAP_RAND_NB_LEN) == 0)) + { + return debugLTK.ltk.key; + } + #endif + + // Not found + return NULL; +} diff --git a/ble/app/app.h b/ble/app/app.h new file mode 100644 index 0000000..62c9916 --- /dev/null +++ b/ble/app/app.h @@ -0,0 +1,352 @@ +/** + **************************************************************************************** + * + * @file app.h + * + * @brief Header file - Application Defines + * + **************************************************************************************** + */ + +#ifndef _APP_H_ +#define _APP_H_ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include +#include "string.h" +#include "blelib.h" +#include "ke_api.h" +#include "app_actv.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Number of Roles, Local Device act as Slave or Master +#if !defined(BLE_NB_SLAVE) + #define BLE_NB_SLAVE (1) +#endif + +#if !defined(BLE_NB_MASTER) + #define BLE_NB_MASTER (0) +#endif + +#if (BLE_NB_SLAVE + BLE_NB_MASTER > BLE_CONNECTION_MAX) + #error "Number of roles must not exceed BLE_CONNECTION_MAX" +#endif + +/// Single or Multiple Connections +#if (BLE_NB_SLAVE + BLE_NB_MASTER > 1) + #define BLE_MULTI_CONN (1) +#else + #define BLE_MULTI_CONN (0) +#endif + +/// Enable of Activities(adv/scan/init) @see app_actv.c +#if !defined(BLE_EN_ADV) + #define BLE_EN_ADV (BLE_NB_SLAVE) +#endif + +#if !defined(BLE_EN_SCAN) + #define BLE_EN_SCAN (BLE_NB_MASTER) +#endif + +#if !defined(BLE_EN_INIT) + #define BLE_EN_INIT (BLE_NB_MASTER) +#endif + +#if !defined(APP_ACTV_EN) + #define APP_ACTV_EN (BLE_EN_ADV || BLE_EN_SCAN || BLE_EN_INIT) +#endif + +/// Enable Pairing and Bond, used debugLTK @see app_gapc.c +#if !defined(BLE_EN_SMP) + #define BLE_EN_SMP (1) +#endif + +#if !defined(BLE_DBG_LTK) + #define BLE_DBG_LTK (0) +#endif + +/// Maximal Transmission Unit +#if !defined(BLE_MTU) + #define BLE_MTU (124) +#endif + +/// Maximal length of the Device Name value +#define DEV_NAME_MAX_LEN (20) + +/// Generic Access Service +#if !defined(BLE_DEV_ICON) + #define BLE_DEV_ICON (0x0000) // Unknow appearance +#endif + +/// Period of RC32K Calibration(0 means only calib once when init) +#if !defined(RC32K_CALIB_PERIOD) && (CFG_SLEEP) + #define RC32K_CALIB_PERIOD (15000) // unit in 1ms +#endif + +#if ((RC32K_CALIB_PERIOD > 0) && (RC32K_CALIB_PERIOD < 1000) && (CFG_SLEEP)) + #error "RC32K_CALIB_PERIOD Less than 1000ms" +#endif + +/* + * MACROS + **************************************************************************************** + */ + +/// Macro of Application Handler Functions +#define APP_SUBTASK_HANDLER(sub) int app_##sub##_handler(msg_id_t msgid, const void *param, \ + task_id_t dest_id, task_id_t src_id) + +#define APP_MSG_HANDLER(msg) static void app_##msg##_handler(msg_id_t msgid, struct msg const *param, \ + task_id_t dest_id, task_id_t src_id) + +#define APP_MSG_HANDLER_T(msg) static void app_##msg##_handler(msg_id_t msgid, const void *param, \ + task_id_t dest_id, task_id_t src_id) + +#define APP_MSG_FUNCTION(msg) app_##msg##_handler(msgid, param, dest_id, src_id) + + +/* + * ENUMERATIONS + **************************************************************************************** + */ + +/// APP Task messages +enum app_msg_id +{ + APP_BASE_MSG = MSG_ID(APP, 0), + + /* Add more messages, such as TIMEOUT */ + APP_TIMER_RC32K_CORR, + APP_TIMER_10MINUTES, +}; + +/// States of APP task +enum app_state_type +{ + // Init state + APP_INIT, + // Idle state + APP_IDLE, + // Ready State + APP_READY, + // Connected state + APP_CONNECTED, + APP_PAIRING, + APP_BONDED, + APP_ENCRYPTED, + + // Number of defined states. + APP_STATE_MAX +}; + +/// Event of Ble Finite state machine +enum ble_event +{ + // Configure Events + BLE_RESET, + BLE_CONFIGURED, + + // Connection Events + BLE_CONNECTED, + BLE_DISCONNECTED, + BLE_BONDED, + BLE_ENCRYPTED, +}; + + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Application environment structure +struct app_env_tag +{ + // Application State + state_t state; + + // Curr Connection Index + uint8_t curidx; + + #if (BLE_MULTI_CONN) + // Bits of Connection Index(0:Not Connect, 1:Connected) + uint8_t conbits; + // Bits of Connection Roles(0:Master or None, 1:Slave) + uint8_t conrole; + #endif //(BLE_MULTI_CONN) +}; + + +/* + * VARIABLE DECLARATION + **************************************************************************************** + */ + +/// Application environment +extern struct app_env_tag app_env; + +/// Ble local address (user customize) +extern const bd_addr_t ble_dev_addr; + +/// GAP device configuration +extern const struct gapm_dev_config ble_dev_config; + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief API to Init Application, maybe User Override! (__weak func) + * + * @param[in] rsn reset reason @see enum rst_src_bfs + **************************************************************************************** + */ +void app_init(uint16_t rsn); + +/** + **************************************************************************************** + * @brief API to Create Profiles, maybe User Override! (__weak func) + * Added in order and judged status in each profile-func. + **************************************************************************************** + */ +void app_prf_create(void); + +/** + **************************************************************************************** + * @brief API to Create Mesh Instance, maybe User Override! (__weak func) + * Config Mesh stack and Register models. + **************************************************************************************** + */ +void app_mesh_create(void); + +/** + **************************************************************************************** + * @brief Finite state machine for Device Configure, maybe User Override! (__weak func) + * + * @param[in] evt configure event @see enum ble_event + **************************************************************************************** + */ +void app_conf_fsm(uint8_t evt); + +/** + **************************************************************************************** + * @brief Finite state machine for connection event, maybe User Override! (__weak func) + * + * @param[in] evt connection event @see enum ble_event + * @param[in] conidx connection index + * @param[in] param param of connection event + **************************************************************************************** + */ +void app_conn_fsm(uint8_t evt, uint8_t conidx, const void*param); + +/** + **************************************************************************************** + * @brief API to Set State of Application, maybe User Override! (__weak func) + * + * @param[in] state new state + **************************************************************************************** + */ +void app_state_set(uint8_t state); + +/** + **************************************************************************************** + * @brief Macro API to Get Application State + * + * @return state type - 1 octets + **************************************************************************************** + */ +static __inline state_t app_state_get(void) +{ + return app_env.state; +} + +/** + **************************************************************************************** + * @brief Macro API to Get Device Appearance + * + * @return icon type - 2 octets + **************************************************************************************** + */ +static __inline uint16_t app_icon_get(void) +{ + return BLE_DEV_ICON; +} + +/** + **************************************************************************************** + * @brief API to Get Device Name, maybe User Override! (__weak func) + * + * @param[in] size Length of name Buffer + * @param[out] name Pointer of name buffer + * + * @return Length of device name + **************************************************************************************** + */ +uint8_t app_name_get(uint8_t size, uint8_t *name); + +/** + **************************************************************************************** + * @brief API to Get Pairing Feature, maybe User Override! (__weak func) + * + * @param[out] feat Pointer of pairing buffer to fill + **************************************************************************************** + */ +void app_pairing_get(struct gapc_pairing *feat); + +/** + **************************************************************************************** + * @brief API to Generate LTK for bonding, maybe User Override! (__weak func) + * + * @param[in] conidx connection index + * @param[out] ltk Pointer of LTK buffer to fill + **************************************************************************************** + */ +void app_ltk_gen(uint8_t conidx, struct gapc_ltk *ltk); + +/** + **************************************************************************************** + * @brief API to Save LTK when bonded, maybe User Override! (__weak func) + * + * @param[in] conidx connection index + * @param[in] ltk Pointer of LTK data + **************************************************************************************** + */ +void app_ltk_save(uint8_t conidx, const struct gapc_ltk *ltk); + +/** + **************************************************************************************** + * @brief API to Find LTK when re-encryption, maybe User Override! (__weak func) + * + * @param[in] ediv EDIV value for matching + * @param[in] rand_nb Rand Nb values for matching + * + * @return NULL for not matched, else return Pointer of LTK found. + **************************************************************************************** + */ +const uint8_t *app_ltk_find(uint16_t ediv, const uint8_t *rand_nb); + +/** + **************************************************************************************** + * @brief Dispatch TASK_APP message to sub-handler. + * + * @param[in] msgid Id of the message received. + * @param[in] task_idx Index of the receiving task instance. + * + * @return Handler of the message or NULL. + **************************************************************************************** + */ +void* app_task_dispatch(msg_id_t msgid, uint8_t task_idx); + +#endif // _APP_H_ diff --git a/ble/app/app_actv.c b/ble/app/app_actv.c new file mode 100644 index 0000000..efe788e --- /dev/null +++ b/ble/app/app_actv.c @@ -0,0 +1,950 @@ +/** + **************************************************************************************** + * + * @file app_actv.c + * + * @brief Application Activity(Advertising, Scanning and Initiating) - Example + * + * < If want to modify it, recommend to copy the file to 'user porject'/src > + **************************************************************************************** + */ + +#include "app.h" +#include "gapm_api.h" + +#if (DBG_ACTV) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +#if (APP_ACTV_EN) +/* + * DEFINES + **************************************************************************************** + */ + +/// Index & State of activities - User Customize +struct actv_env_tag +{ + #if (BLE_EN_ADV) + /// Advertising index and state + uint8_t advidx; + uint8_t advsta; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + /// Scanning index and state + uint8_t scanidx; + uint8_t scansta; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + /// Initiating index and state + uint8_t initidx; + uint8_t initsta; + #endif //(BLE_EN_INIT) +}; + +/// Activities environment +struct actv_env_tag actv_env; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @section Advertising Activity - Example for User Customize + * enable via pre-define @see BLE_EN_ADV + **************************************************************************************** + */ +#if (BLE_EN_ADV) + +#undef DEBUG +#if (DBG_ACTV) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// Advertising duration - 0 mean Always ON (in multiple of 10ms) +#if !defined(APP_ADV_DURATION) + #define APP_ADV_DURATION (0) +#endif + +/// Advertising channel map - 37, 38, 39 +#if !defined(APP_ADV_CHMAP) + #define APP_ADV_CHMAP (0x07) +#endif + +/// Advertising minimum interval - (n)*0.625ms +#if !defined(APP_ADV_INT_MIN) + #define APP_ADV_INT_MIN (64) +#endif + +/// Advertising maximum interval - (n)*0.625ms +#if !defined(APP_ADV_INT_MAX) + #define APP_ADV_INT_MAX (160) +#endif + +#if (APP_ADV_INT_MIN > APP_ADV_INT_MAX) + #error "ADV_INT_MIN must not exceed ADV_INT_MAX" +#endif + +/// Fast advertising interval +#define APP_ADV_FAST_INT (32) + +/// Flag of Fixed data +//#define APP_ADV_FIXED_DATA (0) + +#if (APP_ADV_FIXED_DATA) +/** + * ADV Unit: 1B(Len=1+n) 1B(Type) nB(Data), @see gap_ad_type + * -------------------------------------------------------------------------------------- + * x03 - Length + * x03 - Service 16-bit UUIDs List type + * x00\xFF - Custom Serial Profile:0xFF00 + * x03 - Length + * x19 - Appearance type + * x00\x00 - Unknow Device + * x09 - Length + * x09 - Complete Name type + * myBle5.2 - Device Name + * -------------------------------------------------------------------------------------- + */ +#define APP_ADV_DATA "\x03\x03\x00\xFF\x03\x19\x00\x00\x09\x09myBle5.2" +#define APP_ADV_DATA_LEN (sizeof(APP_ADV_DATA)-1) + +/** + * Scan response data (ADV Unit), @see gap_ad_type + * -------------------------------------------------------------------------------------- + * x09 - Length + * xFF - Vendor specific advertising type + * xC5\x09\x48\x59\x2D\x42\x4C\x45 - CompId(0x09C5) + Serial(BLE) + * x09 - Length + * x09 - Complete Name type + * myBle5.2 - Device Name + * -------------------------------------------------------------------------------------- + */ +#define APP_SCNRSP_DATA "\x09\xFF\xC5\x09\x48\x59\x2D\x42\x4C\x45" +#define APP_SCNRSP_DATA_LEN (sizeof(APP_SCNRSP_DATA)-1) +#endif // (APP_ADV_FIXED_DATA) + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +static void app_adv_create(void) +{ + struct gapm_adv_create_param adv_param; + + // Advertising type (@see enum gapm_adv_type) + adv_param.type = GAPM_ADV_TYPE_LEGACY; + // Discovery mode (@see enum gapm_adv_disc_mode) + adv_param.disc_mode = GAPM_ADV_MODE_GEN_DISC; + // Advertising properties (@see enum gapm_adv_prop) + #if (DBG_GAPM) + adv_param.prop = GAPM_ADV_PROP_UNDIR_CONN_MASK | GAPM_ADV_PROP_SCAN_REQ_NTF_EN_BIT; + #else + adv_param.prop = GAPM_ADV_PROP_UNDIR_CONN_MASK; + #endif + // Filtering policy (@see enum gapm_adv_filter_policy) + adv_param.filter_pol = GAPM_ADV_ALLOW_SCAN_ANY_CON_ANY; + // Config primary advertising (@see gapm_adv_prim_cfg) + adv_param.prim_cfg.phy = GAP_PHY_LE_1MBPS; + adv_param.prim_cfg.chnl_map = APP_ADV_CHMAP; + adv_param.prim_cfg.adv_intv_min = APP_ADV_INT_MIN; + adv_param.prim_cfg.adv_intv_max = APP_ADV_INT_MAX; + + DEBUG("create(disc:%d,prop:%d)\r\n", adv_param.disc_mode, adv_param.prop); + + gapm_create_advertising(GAPM_STATIC_ADDR, &adv_param); +} + +static void app_adv_set_adv_data(void) +{ +#if (APP_ADV_FIXED_DATA) + gapm_set_adv_data(actv_env.advidx, GAPM_SET_ADV_DATA, + APP_ADV_DATA_LEN, (const uint8_t *)APP_ADV_DATA); +#else + // Reserve 3Bytes for AD_TYPE_FLAGS + uint8_t adv_data[GAP_ADV_DATA_LEN]; + uint8_t length = 11; + + // Set flags: 3B + adv_data[0] = 0x02; + adv_data[1] = GAP_AD_TYPE_FLAGS; // 0x01 0xFF;// + adv_data[2] = 0x06; + + // Set list of UUIDs: 4B + adv_data[3] = 0x03; + adv_data[4] = GAP_AD_TYPE_COMPLETE_LIST_16_BIT_UUID; // 0x03 + #if (PRF_HIDS) + write16p(&adv_data[5], 0x1812); // HID Service + #else + write16p(&adv_data[5], 0xFF00); // Serial Service + #endif + + // Set appearance: 4B + uint16_t icon = app_icon_get(); + adv_data[7] = 0x03; + adv_data[8] = GAP_AD_TYPE_APPEARANCE; // 0x19 + write16p(&adv_data[9], icon); + + gapm_set_adv_data(actv_env.advidx, GAPM_SET_ADV_DATA, length, adv_data); +#endif +} + +static void app_adv_set_scan_rsp(void) +{ +#if (APP_ADV_FIXED_DATA) + gapm_set_adv_data(actv_env.advidx, GAPM_SET_SCAN_RSP_DATA, + APP_SCNRSP_DATA_LEN, (const uint8_t *)APP_SCNRSP_DATA); +#else + uint8_t length; + uint8_t rsp_data[DEV_NAME_MAX_LEN+2]; + + // Set device name + length = app_name_get(DEV_NAME_MAX_LEN, &rsp_data[2]); + rsp_data[0] = length + 1; + rsp_data[1] = GAP_AD_TYPE_COMPLETE_NAME; // 0x09 + + gapm_set_adv_data(actv_env.advidx, GAPM_SET_SCAN_RSP_DATA, length + 2, rsp_data); +#endif +} + +/** + **************************************************************************************** + * @brief Action/Command of Advertising + * + * @param[in] actv_op Operation of activity + **************************************************************************************** + */ +void app_adv_action(uint8_t actv_op) +{ + switch (actv_op) + { + case ACTV_CREATE: + { + if (actv_env.advsta == ACTV_STATE_OFF) + { + //DEBUG("Creating"); + app_adv_create(); + actv_env.advsta = ACTV_STATE_CREATE; + } + } break; + + case ACTV_START: + { + if (actv_env.advsta == ACTV_STATE_READY) + { + DEBUG("Starting"); + gapm_start_advertising(actv_env.advidx, APP_ADV_DURATION); + actv_env.advsta = ACTV_STATE_START; + } + } break; + + case ACTV_STOP: + { + if (actv_env.advsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_STOP; + } + } break; + + case ACTV_DELETE: + { + if ((actv_env.advsta != ACTV_STATE_OFF) && (actv_env.advsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_OFF; + } + } break; + + case ACTV_RELOAD: + { + if (actv_env.advsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_STOP; + } + + if ((actv_env.advsta != ACTV_STATE_OFF) && (actv_env.advsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_OFF; + } + + app_adv_create(); + actv_env.advsta = ACTV_STATE_CREATE; + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Event Procedure of Advertising + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_adv_event(uint8_t gapm_op, uint8_t status) +{ + DEBUG("Evt(op:0x%X,sta:0x%X)", gapm_op, status); + + switch (gapm_op) + { + case (GAPM_CREATE_ADV_ACTIVITY): + { + app_adv_set_adv_data(); + } break; + + case (GAPM_SET_ADV_DATA): + { + app_adv_set_scan_rsp(); + } break; + + case (GAPM_SET_SCAN_RSP_DATA): + { + actv_env.advsta = ACTV_STATE_READY; + + app_adv_action(ACTV_START); + app_state_set(APP_READY); + } break; + + case (GAPM_STOP_ACTIVITY): + { + if ((actv_env.advsta == ACTV_STATE_START) || (actv_env.advsta == ACTV_STATE_STOP)) + { + actv_env.advsta = ACTV_STATE_READY; + } + } break; + + default: + break; + } +} + +#endif //(BLE_EN_ADV) + + +/** + **************************************************************************************** + * @section Scanning Activity - Example for User Customize + * enable via pre-define @see BLE_EN_SCAN + **************************************************************************************** + */ +#if (BLE_EN_SCAN) + +#undef DEBUG +#if (DBG_ACTV) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +#define SCAN_NUM_MAX (5) + +uint8_t scan_cnt = 0; +struct gap_bdaddr scan_addr_list[SCAN_NUM_MAX]; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +static void app_start_scanning(void) +{ + struct gapm_scan_param scan_param; + + /// Type of scanning to be started (@see enum gapm_scan_type) + scan_param.type = GAPM_SCAN_TYPE_CONN_DISC; + /// Properties for the scan procedure (@see enum gapm_scan_prop) + scan_param.prop = GAPM_SCAN_PROP_PHY_1M_BIT | GAPM_SCAN_PROP_ACTIVE_1M_BIT | GAPM_SCAN_PROP_FILT_TRUNC_BIT; + /// Duplicate packet filtering policy (@see enum gapm_dup_filter_pol) + scan_param.dup_filt_pol = GAPM_DUP_FILT_EN; + /// Scan window opening parameters for LE 1M PHY (in unit of 625us) + scan_param.scan_param_1m.scan_intv = GAP_SCAN_FAST_INTV; + scan_param.scan_param_1m.scan_wd = GAP_SCAN_FAST_WIND; + /// Scan window opening parameters for LE Coded PHY + //scan_param.scan_param_coded.scan_intv = GAP_SCAN_SLOW_INTV1; + //scan_param.scan_param_coded.scan_wd = GAP_SCAN_SLOW_WIND1; + /// Scan duration (in unit of 10ms). 0 means that the controller will scan continuously until + /// reception of a stop command from the application + scan_param.duration = 500;//GAP_TMR_GEN_DISC_SCAN; + /// Scan period (in unit of 1.28s). Time interval betweem two consequent starts of a scan duration + /// by the controller. 0 means that the scan procedure is not periodic + scan_param.period = 0; + + gapm_start_activity(actv_env.scanidx, sizeof(struct gapm_scan_param), &scan_param); +} + +/** + **************************************************************************************** + * @brief Action/Command of Scanning + * + * @param[in] actv_op Operation of activity + **************************************************************************************** + */ +void app_scan_action(uint8_t actv_op) +{ + switch (actv_op) + { + case ACTV_CREATE: + { + if (actv_env.scansta == ACTV_STATE_OFF) + { + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_SCAN, GAPM_STATIC_ADDR); + actv_env.scansta = ACTV_STATE_CREATE; + } + } break; + + case ACTV_START: + { + scan_cnt = 0; + + if (actv_env.scansta == ACTV_STATE_READY) + { + DEBUG("Starting"); + app_start_scanning(); + actv_env.scansta = ACTV_STATE_START; + } + } break; + + case ACTV_STOP: + { + if (actv_env.scansta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_STOP; + } + } break; + + case ACTV_DELETE: + { + if ((actv_env.scansta != ACTV_STATE_OFF) && (actv_env.scansta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_OFF; + } + } break; + + case ACTV_RELOAD: + { + if (actv_env.scansta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_STOP; + } + + if ((actv_env.scansta != ACTV_STATE_OFF) && (actv_env.scansta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_OFF; + } + + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_SCAN, GAPM_STATIC_ADDR); + actv_env.scansta = ACTV_STATE_CREATE; + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Event Procedure of Scanning + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_scan_event(uint8_t gapm_op, uint8_t status) +{ + DEBUG("Evt(op:0x%X,sta:0x%X)", gapm_op, status); + + switch (gapm_op) + { + case GAPM_CREATE_SCAN_ACTIVITY: + { + actv_env.scansta = ACTV_STATE_READY; + } break; + + case GAPM_STOP_ACTIVITY: + { + if ((actv_env.scansta == ACTV_STATE_START) || (actv_env.scansta == ACTV_STATE_STOP)) + { + actv_env.scansta = ACTV_STATE_READY; + } + + DEBUG("-->Filter DevAddr"); + for (uint8_t idx = 0; idx < scan_cnt; idx++) + { + DEBUG("Scan List[%d]-->", idx); + debugHex((uint8_t *)(&scan_addr_list[idx]), sizeof(struct gap_bdaddr)); + } + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Store result of Scanning when filter by app_actv_report_ind + * + * @param[in] paddr gap_bdaddr of peer device + **************************************************************************************** + */ +void app_scan_result(const struct gap_bdaddr* paddr) +{ + for (uint8_t i = 0; i < scan_cnt; i++) + { + if (!memcmp(&scan_addr_list[i], paddr,sizeof(struct gap_bdaddr)))//save addr but diffrent + { + return; + } + } + + if (scan_cnt < SCAN_NUM_MAX) //get null array + { + memcpy(&scan_addr_list[scan_cnt], paddr,sizeof(struct gap_bdaddr)); + scan_cnt++; + } +} + +/** + **************************************************************************************** + * @brief Handles activity report. (@see GAPM_EXT_ADV_REPORT_IND) + * + * @param[in] report Report of Advertising data be scanned + **************************************************************************************** + */ +void app_actv_report_ind(struct gapm_ext_adv_report_ind const* report) +{ + // filter report + if ((report->info & GAPM_REPORT_INFO_REPORT_TYPE_MASK) == GAPM_REPORT_TYPE_ADV_LEG) + { + const uint8_t *p_cursor = report->data; + const uint8_t *p_end_cusor = report->data + report->length; + + while (p_cursor < p_end_cusor) + { + // Extract AD type + uint8_t ad_type = *(p_cursor + 1); + + if (ad_type == GAP_AD_TYPE_APPEARANCE) + { + uint16_t icon = read16p(p_cursor+2); + + // Filter special appearance device + if ((icon == 0x03C1) || (icon == 0x03C5)) // HID Gamepad + { + app_scan_result(&report->trans_addr); + break; + } + } + else if ((ad_type == GAP_AD_TYPE_COMPLETE_LIST_16_BIT_UUID) || (ad_type == GAP_AD_TYPE_MORE_16_BIT_UUID)) + { + uint16_t uuid = read16p(p_cursor+2); + + // Filter special uuid device + if (((uuid == 0x18F0) || (uuid == 0xFF00)))// && (param->trans_addr.addr.addr[0] == 0x04)) + { + app_scan_result(&report->trans_addr); + break; + } + } + else + { + // Filter Rule more... + } + + /* Go to next advertising info */ + p_cursor += (*p_cursor + 1); + } + } +} +#endif //(BLE_EN_SCAN) + + +/** + **************************************************************************************** + * @section Initiating Activity - Example for User Customize + * enable via pre-define @see BLE_EN_INIT + **************************************************************************************** + */ +#if (BLE_EN_INIT) + +#undef DEBUG +#if (DBG_ACTV) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + +#if !defined(APP_INIT_TIMEOUT) +#define APP_INIT_TIMEOUT 100 // timeout unit in 10ms +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +const struct gap_bdaddr dflt_peer = +{ + .addr = {{0x11, 0x22, 0x33, 0xa1, 0x01, 0xd3}}, + .addr_type = ADDR_RAND, +}; + +const struct gapm_conn_param dflt_conn_param = +{ + /// Minimum value for the connection interval (in unit of 1.25ms). Allowed range is 7.5ms to 4s. + .conn_intv_min = 10, + /// Maximum value for the connection interval (in unit of 1.25ms). Allowed range is 7.5ms to 4s. + .conn_intv_max = 10, + /// Slave latency. Number of events that can be missed by a connected slave device + .conn_latency = 0, + /// Link supervision timeout (in unit of 10ms). Allowed range is 100ms to 32s + .supervision_to = 300, + /// Recommended minimum duration of connection events (in unit of 625us) + .ce_len_min = 2, + /// Recommended maximum duration of connection events (in unit of 625us) + .ce_len_max = 4, +}; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Start initiating to peer device + * + * @param[in] paddr gap_bdaddr of peer device + **************************************************************************************** + */ +void app_start_initiating(const struct gap_bdaddr* paddr) +{ + if ((actv_env.initsta == ACTV_STATE_READY) || (actv_env.initsta == ACTV_STATE_STOP)) + { + struct gapm_init_param init_param; + + if (paddr == NULL) + { + paddr = &dflt_peer; + } + + init_param.type = GAPM_INIT_TYPE_DIRECT_CONN_EST; + init_param.prop = GAPM_INIT_PROP_1M_BIT; + init_param.conn_to = APP_INIT_TIMEOUT; // timeout unit in 10ms, update from v1.3 + init_param.scan_param_1m.scan_intv = GAP_SCAN_FAST_INTV; + init_param.scan_param_1m.scan_wd = GAP_SCAN_FAST_WIND; + + memcpy(&init_param.conn_param_1m, &dflt_conn_param, sizeof(struct gapm_conn_param)); + memcpy(&init_param.peer_addr, paddr, sizeof(struct gap_bdaddr)); + + gapm_start_activity(actv_env.initidx, sizeof(struct gapm_init_param), &init_param); + + DEBUG("Starting"); + actv_env.initsta = ACTV_STATE_START; + } +} + +/** + **************************************************************************************** + * @brief Action/Command of Initiating + * + * @param[in] actv_op Operation of activity + **************************************************************************************** + */ +void app_init_action(uint8_t actv_op) +{ + switch (actv_op) + { + case ACTV_CREATE: + { + if (actv_env.initsta == ACTV_STATE_OFF) + { + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_INIT, GAPM_STATIC_ADDR); + actv_env.initsta = ACTV_STATE_CREATE; + } + } break; + + case ACTV_START: + { + app_start_initiating(NULL); + } break; + + case ACTV_STOP: + { + if (actv_env.initsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_STOP; + } + } break; + + case ACTV_DELETE: + { + if ((actv_env.initsta != ACTV_STATE_OFF) && (actv_env.initsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_OFF; + } + } break; + + case ACTV_RELOAD: + { + if (actv_env.initsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_STOP; + } + + if ((actv_env.initsta != ACTV_STATE_OFF) && (actv_env.initsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_OFF; + } + + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_INIT, GAPM_STATIC_ADDR); + actv_env.initsta = ACTV_STATE_CREATE; + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Event Procedure of Initiating + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_init_event(uint8_t gapm_op, uint8_t status) +{ + DEBUG("Evt(op:0x%X,sta:0x%X)", gapm_op, status); + + switch (gapm_op) + { + case GAPM_CREATE_INIT_ACTIVITY: + { + actv_env.initsta = ACTV_STATE_READY; + } break; + + case GAPM_STOP_ACTIVITY: + { + if ((actv_env.initsta == ACTV_STATE_START) || (actv_env.initsta == ACTV_STATE_STOP)) + { + actv_env.initsta = ACTV_STATE_READY; + } + } break; + + default: + break; + } +} + +#endif //(BLE_EN_INIT) + + +/** + **************************************************************************************** + * @brief Create activities when Initialization complete. + **************************************************************************************** + */ +void app_actv_create(void) +{ + memset(&actv_env, 0, sizeof(actv_env)); + #if (BLE_EN_ADV) + app_adv_action(ACTV_CREATE); + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + app_scan_action(ACTV_CREATE); + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + app_init_action(ACTV_CREATE); + #endif //(BLE_EN_INIT) +} + +/** + **************************************************************************************** + * @brief Handles activity command complete event. + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_actv_cmp_evt(uint8_t operation, uint8_t status) +{ + switch (operation) + { + #if (BLE_EN_ADV) + case (GAPM_CREATE_ADV_ACTIVITY): + case (GAPM_SET_ADV_DATA): + case (GAPM_SET_SCAN_RSP_DATA): + { + app_adv_event(operation, status); + } break; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + case GAPM_CREATE_SCAN_ACTIVITY: + { + app_scan_event(operation, status); + } break; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + case GAPM_CREATE_INIT_ACTIVITY: + { + app_init_event(operation, status); + } break; + #endif //(BLE_EN_INIT) + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Handles activity created. (@see GAPM_ACTIVITY_CREATED_IND) + * + * @param[in] actv_type Type of activities(@see enum gapm_actv_type) + * @param[in] actv_idx Index of activities created + **************************************************************************************** + */ +void app_actv_created_ind(uint8_t actv_type, uint8_t actv_idx) +{ + switch (actv_type) + { + #if (BLE_EN_ADV) + case GAPM_ACTV_TYPE_ADV: + { + actv_env.advidx = actv_idx; + } break; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + case GAPM_ACTV_TYPE_SCAN: + { + actv_env.scanidx = actv_idx; + } break; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + case GAPM_ACTV_TYPE_INIT: + { + actv_env.initidx = actv_idx; + } break; + #endif //(BLE_EN_INIT) + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Handles activity stopped. (@see GAPM_ACTIVITY_STOPPED_IND) + * + * @param[in] actv_type Type of activity(@see enum gapm_actv_type) + * @param[in] reason Reason of stopped + **************************************************************************************** + */ +void app_actv_stopped_ind(uint8_t actv_type, uint8_t actv_idx, uint8_t reason) +{ + switch (actv_type) + { + #if (BLE_EN_ADV) + case GAPM_ACTV_TYPE_ADV: + { + // Advertising Stopped by slave connection or duration timeout + app_adv_event(GAPM_STOP_ACTIVITY, reason); + + // Duration timeout, go IDLE - update from v1.3 + if ((reason == GAP_ERR_TIMEOUT) && (app_state_get() == APP_READY)) + { + app_state_set(APP_IDLE); + } + } break; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + case GAPM_ACTV_TYPE_SCAN: + { + app_scan_event(GAPM_STOP_ACTIVITY, reason); + } break; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + case GAPM_ACTV_TYPE_INIT: + { + app_init_event(GAPM_STOP_ACTIVITY, reason); + } break; + #endif //(BLE_EN_INIT) + + default: + break; + } +} + +#endif //(APP_ACTV_EN) diff --git a/ble/app/app_actv.h b/ble/app/app_actv.h new file mode 100644 index 0000000..48ec458 --- /dev/null +++ b/ble/app/app_actv.h @@ -0,0 +1,178 @@ +/** + **************************************************************************************** + * + * @file app_actv.h + * + * @brief Header file - Application Activity(Advertising, Scanning and Initiating). + * + **************************************************************************************** + */ + +#ifndef APP_ACTV_H_ +#define APP_ACTV_H_ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include +#include "string.h" +#include "gapm.h" +#include "gapc.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Operation of Activity +enum actv_op +{ + // Activity create + ACTV_CREATE = 0, + // Activity start + ACTV_START, + // Activity stop + ACTV_STOP, + // Activity delete + ACTV_DELETE, + // Activity reload + ACTV_RELOAD, +}; + +/// States of Activity +enum actv_state +{ + // Activity disable + ACTV_STATE_OFF = 0, + // Activity creating + ACTV_STATE_CREATE, + // Activity created + ACTV_STATE_READY, + // Activity started + ACTV_STATE_START, + // Activity stopping + ACTV_STATE_STOP, +}; + +/// Configure of Activity - Used for PTS-Test +struct actv_conf +{ + // discovery mode (@see gapm_adv_disc_mode) + uint8_t adv_disc; + // adv properties (@see enum gapm_adv_prop) + uint8_t adv_prop; + // bit7~2:data type bit1~0:address type (@see gapm_own_addr) + uint8_t adv_conf; + + // own address type as master role (@see gapm_own_addr) + uint8_t mst_conf; + // /// Scanning Types (@see enum gapm_scan_type) + uint8_t sca_type; +}; + +extern uint8_t scan_cnt; +extern struct gap_bdaddr scan_addr_list[]; + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Create activities when Initialization complete. + **************************************************************************************** + */ +void app_actv_create(void); + +/** + **************************************************************************************** + * @brief Handles activity command complete event. + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_actv_cmp_evt(uint8_t gapm_op, uint8_t status); + +/** + **************************************************************************************** + * @brief Handles activity created. (@see GAPM_ACTIVITY_CREATED_IND) + * + * @param[in] actv_type Type of activity(@see enum gapm_actv_type) + * @param[in] actv_idx Index of activity created + **************************************************************************************** + */ +void app_actv_created_ind(uint8_t actv_type, uint8_t actv_idx); + +/** + **************************************************************************************** + * @brief Handles activity stopped. (@see GAPM_ACTIVITY_STOPPED_IND) + * + * @param[in] actv_type Type of activity(@see enum gapm_actv_type) + * @param[in] reason Reason of stopped + **************************************************************************************** + */ +void app_actv_stopped_ind(uint8_t actv_type, uint8_t actv_idx, uint8_t reason); + +/** + **************************************************************************************** + * @brief Handles activity report. (@see GAPM_EXT_ADV_REPORT_IND) + * + * @param[in] report Report of Advertising data be scanned + **************************************************************************************** + */ +void app_actv_report_ind(struct gapm_ext_adv_report_ind const* report); + + +/** + **************************************************************************************** + * @brief Action/Command of Advertising + * + * @param[in] actv_op Operation of activity + **************************************************************************************** + */ +void app_adv_action(uint8_t actv_op); + +/** + **************************************************************************************** + * @brief Action/Command of Scanning + * + * @param[in] actv_op Operation of activity + **************************************************************************************** + */ +void app_scan_action(uint8_t actv_op); + +/** + **************************************************************************************** + * @brief Store result of Scanning when filter by app_actv_report_ind + * + * @param[in] paddr gap_bdaddr of peer device + **************************************************************************************** + */ +void app_scan_result(const struct gap_bdaddr* paddr); + + +/** + **************************************************************************************** + * @brief Action/Command of Initiating + * + * @param[in] actv_op Operation of activity + **************************************************************************************** + */ +void app_init_action(uint8_t actv_op); + +/** + **************************************************************************************** + * @brief Start initiating to peer device + * + * @param[in] paddr gap_bdaddr of peer device + **************************************************************************************** + */ +void app_start_initiating(const struct gap_bdaddr* paddr); + + +#endif // APP_ACTV_H_ diff --git a/ble/app/app_gapc.c b/ble/app/app_gapc.c new file mode 100644 index 0000000..887beab --- /dev/null +++ b/ble/app/app_gapc.c @@ -0,0 +1,382 @@ +/** + **************************************************************************************** + * + * @file app_gapc.c + * + * @brief App SubTask of GAP Controller Message - Example + * + * < If want to modify it, recommend to copy the file to 'user porject'/src > + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "bledef.h" +#include "app.h" + +#if (DBG_GAPC) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat,len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + + +/* + * MESSAGE HANDLERS + **************************************************************************************** + */ + +APP_MSG_HANDLER(gapc_cmp_evt) +{ + // Command complete, may ignore + DEBUG("CMP_EVT(op:%d,sta:0x%x)", param->operation, param->status); +} + +APP_MSG_HANDLER(gapc_connection_req_ind) +{ + #if (DBG_GAPC) + uint8_t conidx = TASK_IDX(src_id); + #endif + + DEBUG("gapc_connection_req_ind(cid:%d,chdl:%d,conn[intv:%d,late:%d,to:%d],acc:%d,caddr:%d)", conidx, param->conhdl, + param->con_interval, param->con_latency, param->sup_to, param->clk_accuracy, param->peer_addr_type); + debugHex(param->peer_addr.addr, GAP_BD_ADDR_LEN); + + // Indicate Connect_Req_Pkt be send, need wait to sync (try 6 times of conn_event). + // If synced, goto gapc_connection_ind. Otherwise, goto gapc_disconnect_ind(reason=0x3E) + //app_conn_fsm(BLE_CONNECTING, conidx, param); +} + +APP_MSG_HANDLER(gapc_connection_ind) +{ + uint8_t conidx = TASK_IDX(src_id); + + DEBUG("gapc_connection_ind(cid:%d,chdl:%d,role:%d)", conidx, param->conhdl, param->role); + + // Connection established, update from v1.3 + app_conn_fsm(BLE_CONNECTED, conidx, param); +} + +APP_MSG_HANDLER(gapc_disconnect_ind) +{ + uint8_t conidx = TASK_IDX(src_id); + + DEBUG("gapc_disconnect_ind(cid:%d,hdl:%d,reason:0x%X)", conidx, param->conhdl, param->reason); + + app_conn_fsm(BLE_DISCONNECTED, conidx, param); +} + +APP_MSG_HANDLER(gapc_param_update_req_ind) +{ + uint8_t conidx = TASK_IDX(src_id); + + DEBUG("param_update(cid:%d,invM:%d,invI:%d,late:%d,timo:%d)", conidx, + param->intv_max, param->intv_min, param->latency, param->time_out); + + // Connection param accept or reject + gapc_param_update_rsp(conidx, true, 0x2, 0x4); +} + +APP_MSG_HANDLER(gapc_param_updated_ind) +{ + DEBUG("param_updated_ind(cid:%d,intv:%d,late:%d,timo:%d)", TASK_IDX(src_id), + param->con_interval, param->con_latency, param->sup_to); + + // Current param, may update to slaves + +} + +APP_MSG_HANDLER(gapc_le_pkt_size_ind) +{ + DEBUG("le_pkt_size_ind(cid:%d,txB:%d,txT:%d,rxB:%d,rxT:%d)", TASK_IDX(src_id), + param->max_tx_octets, param->max_tx_time, param->max_rx_octets, param->max_rx_time); +} + +#if (BLE_EN_SMP) +APP_MSG_HANDLER(gapc_bond_req_ind) +{ + uint8_t conidx = TASK_IDX(src_id); + + DEBUG("bond_req_ind(req:%d)", param->request); + + switch (param->request) + { + case (GAPC_PAIRING_REQ): + { + struct gapc_pairing feat; + + // Retrieve pairing feature to response + app_pairing_get(&feat); + gapc_smp_pairing_rsp(conidx, &feat); + + DEBUG("PAIRING_REQ(auth:0x%X)", param->data.auth_req); + debugHex((uint8_t *)&feat, sizeof(struct gapc_pairing)); + } break; + + case (GAPC_LTK_EXCH): + { + struct gapc_ltk ltk; + + // Generate all rand values to exchange + app_ltk_gen(conidx, <k); + gapc_smp_pairing_ltk_exch(conidx, <k); + + DEBUG("LTK_EXCH(size:%d)", param->data.key_size); + debugHex((uint8_t *)<k, sizeof(struct gapc_ltk)); + } break; + + case (GAPC_IRK_EXCH): + { + DEBUG("IRK_EXCH"); + + // Load IRK + //memcpy(&(data.irk.irk), gapm_get_irk(), GAP_KEY_LEN); + + // load device address + //memcpy(&(data.irk.addr.addr), gapm_get_bdaddr(), GAP_BD_ADDR_LEN); + //data.irk.addr.addr_type = (data.irk.addr.addr.addr[5] & 0xC0) ? ADDR_RAND : ADDR_PUBLIC; + } break; + + case (GAPC_TK_EXCH): + { + DEBUG("TK_EXCH(type:%d)", param->data.tk_type); + + if (param->data.tk_type == GAP_TK_OOB) + { + DEBUG("TK_OOB>>>"); + return; + } + else if (param->data.tk_type == GAP_TK_DISPLAY) + { + struct gap_sec_key tk; + // Generate a PIN Code- (Between 100000 and 999999) + uint32_t pin_code = (100000 + (rand_word() % 900000)); + // Set the TK value + memset(&tk.key, 0, GAP_KEY_LEN); + write32p(&tk.key, pin_code); + + DEBUG("TK_DISPLAY:%06d", pin_code); + gapc_smp_pairing_tk_exch(conidx, true, &tk); + } + else //if (param->data.tk_type == GAP_TK_KEY_ENTRY) + { + DEBUG("TK_KEY_ENTRY>>>"); + return; + } + } break; + + case (GAPC_CSRK_EXCH): + { + struct gap_sec_key csrk; + DEBUG("CSRK_EXCH"); + memset(&csrk.key, 0, GAP_KEY_LEN); + gapc_smp_pairing_csrk_exch(conidx, &csrk); + } break; + + #if (SEC_CON_ENB) + case (GAPC_OOB_EXCH): + { + DEBUG("OOB_EXCH(conf,rand)>>>"); + debugHex(param->data.oob_data.conf, GAP_KEY_LEN); + debugHex(param->data.oob_data.rand, GAP_KEY_LEN); + + return; + } //break; + + case (GAPC_NC_EXCH): + { + DEBUG("NC_EXCH(%06d)", read32p(param->data.nc_data.value)); + gapc_smp_pairing_nc_exch(conidx, true); + } break; + #endif //(SEC_CON_ENB) + + default: + { + // not happen + } break; + } +} + +APP_MSG_HANDLER(gapc_bond_ind) +{ + uint8_t conidx = TASK_IDX(src_id); + DEBUG("bond_ind(info:%d)", param->info); + + switch (param->info) + { + case (GAPC_PAIRING_SUCCEED): + { + DEBUG("PAIRING_SUCCEED(auth:%X,ltk:%d)", param->data.auth.info, param->data.auth.ltk_present); + // Update the bonding status + app_conn_fsm(BLE_BONDED, conidx, param); + } break; + + case (GAPC_PAIRING_FAILED): + { + DEBUG("PAIRING_FAILED(reason:0x%X)", param->data.reason); + //gapc_smp_security_req(conidx, GAP_AUTH_REQ_NO_MITM_NO_BOND); + } break; + + case (GAPC_REPEATED_ATTEMPT): + { + DEBUG("REPEATED_ATTEMPT"); + gapc_disconnect(conidx); + } break; + + case (GAPC_IRK_EXCH): + { + DEBUG("IRK_EXCH(irk,addr)"); + debugHex(param->data.irk.irk.key, GAP_KEY_LEN); + debugHex(param->data.irk.addr.addr.addr, GAP_BD_ADDR_LEN); + // Store peer identity + } break; + + // In Secure Connections we get BOND_IND with SMPC calculated LTK + case (GAPC_LTK_EXCH) : + { + DEBUG("Bond LTK_EXCH(size:%d)", param->data.ltk.key_size); + debugHex(param->data.ltk.ltk.key, sizeof(struct gapc_ltk)); + + // Store peer LTK + // if ((gapc_auth_get(conidx) & GAP_AUTH_SEC_CON) || (gapc_get_role(conidx) == ROLE_MASTER)) + // { + // app_ltk_save(conidx, ¶m->data.ltk); + // } + } break; + + default: + break; + } +} + +APP_MSG_HANDLER(gapc_encrypt_req_ind) +{ + uint8_t conidx = TASK_IDX(src_id); + + DEBUG("encrypt_req_ind(ediv:0x%X,rand)", param->ediv); + debugHex(param->rand_nb.nb, GAP_RAND_NB_LEN); + + // Check if the provided EDIV and Rand Nb values match with the stored values + struct gap_sec_key *ltk = (struct gap_sec_key *)app_ltk_find(param->ediv, param->rand_nb.nb); + if (ltk != NULL) + { + DEBUG("->Find Same LTK"); + gapc_smp_encrypt_cfm(conidx, GAP_KEY_LEN, ltk); + } + else + { + // bonded with another device, disconnect the link + DEBUG("->Find Diff LTK"); + gapc_smp_encrypt_cfm(conidx, 0, NULL); + //gapc_smp_security_req(conidx, GAP_AUTH_REQ_NO_MITM_BOND); + gapc_disconnect(conidx); + } +} + +APP_MSG_HANDLER(gapc_encrypt_ind) +{ + uint8_t conidx = TASK_IDX(src_id); + DEBUG("encryp_ind(auth:%d)", param->auth); + + // encryption/ re-encryption succeeded + app_conn_fsm(BLE_ENCRYPTED, conidx, param); +} + +APP_MSG_HANDLER(gapc_security_ind) +{ + // slave request security + DEBUG("security_ind(auth:%d)", param->auth); +} +#endif //(BLE_EN_SMP) + +/** + **************************************************************************************** + * @brief SubTask Handler of GAP controller Message. + **************************************************************************************** + */ +APP_SUBTASK_HANDLER(gapc_msg) +{ + switch (msgid) + { + case GAPC_CMP_EVT: + { + APP_MSG_FUNCTION(gapc_cmp_evt); + } break; + + case GAPC_CONNECTION_REQ_IND: + { + APP_MSG_FUNCTION(gapc_connection_req_ind); + } break; + + case GAPC_CONNECTION_IND: + { + // Connection established, update from v1.3 + APP_MSG_FUNCTION(gapc_connection_ind); + } break; + + case GAPC_DISCONNECT_IND: + { + APP_MSG_FUNCTION(gapc_disconnect_ind); + } break; + + case GAPC_PARAM_UPDATE_REQ_IND: + { + APP_MSG_FUNCTION(gapc_param_update_req_ind); + } break; + + case GAPC_PARAM_UPDATED_IND: + { + APP_MSG_FUNCTION(gapc_param_updated_ind); + } break; + + #if (BLE_EN_SMP) + case GAPC_BOND_REQ_IND: + { + APP_MSG_FUNCTION(gapc_bond_req_ind); + } break; + + case GAPC_BOND_IND: + { + APP_MSG_FUNCTION(gapc_bond_ind); + } break; + + case GAPC_ENCRYPT_REQ_IND: + { + APP_MSG_FUNCTION(gapc_encrypt_req_ind); + } break; + + case GAPC_ENCRYPT_IND: + { + APP_MSG_FUNCTION(gapc_encrypt_ind); + } break; + + case GAPC_SECURITY_IND: + { + APP_MSG_FUNCTION(gapc_security_ind); + } break; + #endif //(BLE_EN_SMP) + + case GAPC_LE_PKT_SIZE_IND: + { + APP_MSG_FUNCTION(gapc_le_pkt_size_ind); + } break; + + default: + { + DEBUG("Unknow MsgId:0x%X", msgid); + } break; + } + + return (MSG_STATUS_FREE); +} diff --git a/ble/app/app_gapm.c b/ble/app/app_gapm.c new file mode 100644 index 0000000..ba1cde6 --- /dev/null +++ b/ble/app/app_gapm.c @@ -0,0 +1,146 @@ +/** + **************************************************************************************** + * + * @file app_gapm.c + * + * @brief App SubTask of GAP Manager Message - Example + * + * < If want to modify it, recommend to copy the file to 'user porject'/src > + **************************************************************************************** + */ + +#include +#include "bledef.h" +#include "app.h" + +#if (DBG_GAPM) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * MESSAGE HANDLERS + **************************************************************************************** + */ + +APP_MSG_HANDLER(gapm_cmp_evt) +{ + if (param->operation == GAPM_RESET) + { + DEBUG("Reset(sta:0x%02X)", param->status); + + // Dev Config after reset + app_conf_fsm(BLE_RESET); + } + else if (param->operation == GAPM_SET_DEV_CONFIG) + { + DEBUG("Dev Config(sta:0x%02X)", param->status); + + // Init profiles or activities after config + app_conf_fsm(BLE_CONFIGURED); + } + #if (APP_ACTV_EN) + else if (param->operation >= GAPM_CREATE_ADV_ACTIVITY) + { + DEBUG("Actv Evt(op:0x%02X,sta:0x%02X)", param->operation, param->status); + + app_actv_cmp_evt(param->operation, param->status); + } + #endif //(APP_ACTV_EN) + else + { + DEBUG("Unknow Evt(op:0x%02X,sta:0x%02X)", param->operation, param->status); + } +} + +#if (APP_ACTV_EN) +APP_MSG_HANDLER(gapm_activity_created_ind) +{ + DEBUG("Actv Created(id:%d,typ:%d)", param->actv_idx, param->actv_type); + + app_actv_created_ind(param->actv_type, param->actv_idx); +} + +APP_MSG_HANDLER(gapm_activity_stopped_ind) +{ + DEBUG("Actv Stopped(id:%d,typ:%d,rea:0x%02X)", param->actv_idx, param->actv_type, param->reason); + + app_actv_stopped_ind(param->actv_type, param->actv_idx, param->reason); +} + +#if (BLE_EN_SCAN) +APP_MSG_HANDLER(gapm_ext_adv_report_ind) +{ + DEBUG("Scanned(id:%d,info:0x%02x,Addr{T:%d},Data{L:%d})", param->actv_idx, param->info, + param->trans_addr.addr_type, param->length); + debugHex((uint8_t *)(¶m->trans_addr), sizeof(struct gap_bdaddr)); + debugHex(param->data, param->length); + DEBUG("\r\n"); + + app_actv_report_ind(param); +} +#endif //(BLE_EN_SCAN) +#endif //(APP_ACTV_EN) + +#if (DBG_GAPM) +APP_MSG_HANDLER(gapm_scan_request_ind) +{ + DEBUG("Scan request(id:%d,Addr{T:%d})", param->actv_idx, param->trans_addr.addr_type); + debugHex((uint8_t *)(¶m->trans_addr), sizeof(struct gap_bdaddr)); +} +#endif + + +/** + **************************************************************************************** + * @brief SubTask Handler of GAP manager Message. + **************************************************************************************** + */ + +APP_SUBTASK_HANDLER(gapm_msg) +{ + switch (msgid) + { + case GAPM_CMP_EVT: + { + APP_MSG_FUNCTION(gapm_cmp_evt); + } break; + + #if (APP_ACTV_EN) + case GAPM_ACTIVITY_CREATED_IND: + { + APP_MSG_FUNCTION(gapm_activity_created_ind); + } break; + + case GAPM_ACTIVITY_STOPPED_IND: + { + APP_MSG_FUNCTION(gapm_activity_stopped_ind); + } break; + + #if (BLE_EN_SCAN) + case GAPM_EXT_ADV_REPORT_IND: + { + APP_MSG_FUNCTION(gapm_ext_adv_report_ind); + } break; + #endif //(BLE_EN_SCAN) + + #if (DBG_GAPM) + case GAPM_SCAN_REQUEST_IND: + { + APP_MSG_FUNCTION(gapm_scan_request_ind); + } break; + #endif + #endif //(APP_ACTV_EN) + + default: + { + DEBUG("Unknow MsgId:0x%X", msgid); + } break; + } + + return (MSG_STATUS_FREE); +} diff --git a/ble/app/app_gatt.c b/ble/app/app_gatt.c new file mode 100644 index 0000000..d9ae3c9 --- /dev/null +++ b/ble/app/app_gatt.c @@ -0,0 +1,157 @@ +/** + **************************************************************************************** + * + * @file app_gatt.c + * + * @brief App SubTask of GATT Message - Example + * + * < If want to modify it, recommend to copy the file to 'user porject'/src > + **************************************************************************************** + */ + +#if (GATT_CLI) + +#include "app.h" +#include "gatt.h" +#include "gatt_api.h" + +#if (DBG_GATT) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + + +/* + * MESSAGE HANDLERS + **************************************************************************************** + */ + +APP_MSG_HANDLER(gatt_cmp_evt) +{ + DEBUG("Cmp_evt(op:%d,sta:0x%02x)", param->operation, param->status); +} + +APP_MSG_HANDLER(gatt_mtu_changed_ind) +{ + DEBUG("mtu_chg:%d,seq:%d", param->mtu, param->seq_num); +} + +APP_MSG_HANDLER(gatt_disc_svc_ind) +{ + DEBUG("disc_svc(shdl:0x%X,ehdl:0x%X,ulen:%d)", param->start_hdl, param->end_hdl, param->uuid_len); + debugHex(param->uuid, param->uuid_len); +} + +APP_MSG_HANDLER(gatt_disc_svc_incl_ind) +{ + DEBUG("disc_incl(ahdl:0x%X,shdl:0x%X,ehdl:0x%X,ulen:%d)", param->attr_hdl, param->start_hdl, param->end_hdl, param->uuid_len); + debugHex(param->uuid, param->uuid_len); +} + +APP_MSG_HANDLER(gatt_disc_char_ind) +{ + DEBUG("disc_char(ahdl:0x%X,phdl:0x%X,prop:0x%X,ulen:%d)", param->attr_hdl, param->pointer_hdl, param->prop, param->uuid_len); + debugHex(param->uuid, param->uuid_len); +} + +APP_MSG_HANDLER(gatt_disc_char_desc_ind) +{ + DEBUG("disc_desc(ahdl:0x%X,ulen:%d)", param->attr_hdl, param->uuid_len); + debugHex(param->uuid, param->uuid_len); +} + +APP_MSG_HANDLER(gatt_read_ind) +{ + DEBUG("Read_ind(hdl:0x%02x,oft:%d,len:%d)", param->handle, param->offset, param->length); + debugHex(param->value, param->length); +} + +APP_MSG_HANDLER(gatt_event_ind) +{ + DEBUG("Evt_ind(typ:%d,hdl:0x%02x,len:%d)", param->type, param->handle, param->length); + debugHex(param->value, param->length); +} + +APP_MSG_HANDLER(gatt_event_req_ind) +{ + uint8_t conidx = TASK_IDX(src_id); + + DEBUG("Evt_req_ind(typ:%d,hdl:0x%02x,len:%d)", param->type, param->handle, param->length); + debugHex(param->value, param->length); + + gatt_evt_cfm(conidx, param->handle); +} + +/** + **************************************************************************************** + * @brief SubTask Handler of GATT Message. + **************************************************************************************** + */ +APP_SUBTASK_HANDLER(gatt_msg) +{ + switch (msgid) + { + case GATT_CMP_EVT: + { + APP_MSG_FUNCTION(gatt_cmp_evt); + } break; + + case GATT_MTU_CHANGED_IND: + { + APP_MSG_FUNCTION(gatt_mtu_changed_ind); + } break; + + case GATT_DISC_SVC_IND: + { + APP_MSG_FUNCTION(gatt_disc_svc_ind); + } break; + + case GATT_DISC_SVC_INCL_IND: + { + APP_MSG_FUNCTION(gatt_disc_svc_incl_ind); + } break; + + case GATT_DISC_CHAR_IND: + { + APP_MSG_FUNCTION(gatt_disc_char_ind); + } break; + + case GATT_DISC_CHAR_DESC_IND: + { + APP_MSG_FUNCTION(gatt_disc_char_desc_ind); + } break; + + case GATT_READ_IND: + { + APP_MSG_FUNCTION(gatt_read_ind); + } break; + + case GATT_EVENT_IND: + { + APP_MSG_FUNCTION(gatt_event_ind); + } break; + + case GATT_EVENT_REQ_IND: + { + APP_MSG_FUNCTION(gatt_event_req_ind); + } break; + + default: + { + DEBUG("Unknow MsgId:0x%X", msgid); + } break; + } + + return (MSG_STATUS_FREE); +} + +#endif //(GATT_CLI) diff --git a/ble/app/app_msg.c b/ble/app/app_msg.c new file mode 100644 index 0000000..d5029e7 --- /dev/null +++ b/ble/app/app_msg.c @@ -0,0 +1,110 @@ +/** + **************************************************************************************** + * + * @file app_msg.c + * + * @brief Application Messages Handler - Example + * + * < If want to modify it, recommend to copy the file to 'user porject'/src > + **************************************************************************************** + */ + +#include "app.h" +#include "drvs.h" + +#if (DBG_APP) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * MESSAGE HANDLERS + **************************************************************************************** + */ + +/// SubTask Declaration, User add more... +extern APP_SUBTASK_HANDLER(gapm_msg); +extern APP_SUBTASK_HANDLER(gapc_msg); +extern APP_SUBTASK_HANDLER(gatt_msg); +extern APP_SUBTASK_HANDLER(l2cc_msg); +extern APP_SUBTASK_HANDLER(mesh_msg); + +/** + **************************************************************************************** + * @brief SubTask Handler of Custom or Unknow Message. (__weak func) + **************************************************************************************** + */ +__weak APP_SUBTASK_HANDLER(custom) +{ + #if (RC32K_CALIB_PERIOD) + if (msgid == APP_TIMER_RC32K_CORR) + { + DEBUG("rc32k_calib"); + rc32k_calib(); + ke_timer_set(APP_TIMER_RC32K_CORR, TASK_APP, RC32K_CALIB_PERIOD); + } + else + #endif //(RC32K_CALIB_PERIOD) + { + uint16_t length = ke_param2msg(param)->param_len; + DEBUG("Unknow MsgId:0x%X", msgid); + debugHex((uint8_t *)param, length); + } + + return (MSG_STATUS_FREE); +} + +/** + **************************************************************************************** + * @brief Dispatch TASK_APP message to sub-handler. + * + * @param[in] msgid Id of the message received. + * @param[in] task_idx Index of the receiving task instance. + * + * @return Handler of the message or NULL. + **************************************************************************************** + */ +__TASKFN void* app_task_dispatch(msg_id_t msgid, uint8_t task_idx) +{ + msg_func_t handler = NULL; + + switch (MSG_TYPE(msgid)) + { + case (TID_GAPM): + handler = app_gapm_msg_handler; + break; + + case (TID_GAPC): + handler = app_gapc_msg_handler; + break; + + #if (GATT_CLI) + case (TID_GATT): + handler = app_gatt_msg_handler; + break; + #endif + + #if (L2CC_LECB) + case (TID_L2CC): + handler = app_l2cc_msg_handler; + break; + #endif + + #if (PRF_MESH) + case TID_MESH: + handler = app_mesh_msg_handler; + break; + #endif + + default: + { + handler = app_custom_handler; + } break; + } + + return handler; +} diff --git a/ble/lib/ble6.lib b/ble/lib/ble6.lib new file mode 100644 index 0000000..2d21267 Binary files /dev/null and b/ble/lib/ble6.lib differ diff --git a/ble/lib/ble6_8act_6con.lib b/ble/lib/ble6_8act_6con.lib new file mode 100644 index 0000000..c42c4f9 Binary files /dev/null and b/ble/lib/ble6_8act_6con.lib differ diff --git a/ble/lib/ble6_fw.hex b/ble/lib/ble6_fw.hex new file mode 100644 index 0000000..12c12bc --- /dev/null +++ b/ble/lib/ble6_fw.hex @@ -0,0 +1,3945 @@ +:020000041800E2 +:10D0000008A055AA12082220FF21513101803121A8 +:10D01000090141808180C1807721C9000181972168 +:10D02000C9004181AF21C900818159210901C18114 +:10D03000692109010182DF21C900418202498182FF +:10D040000249C18270470000F80B0000F80E000092 +:10D0500072B6BFF34F8F04490248C860BFF34F8FC9 +:10D06000FEE700000400FA0500ED00E030B5D31C37 +:10D070009C0883000A4D5118A40089085B19890097 +:10D08000091B400040199C6101849869418099699D +:10D09000044808809969002048609969886030BD1B +:10D0A000509000205AA50000C088884201D101207C +:10D0B000704700207047082807D2EFF3108272B63D +:10D0C0008000024B195082F3108870477490002042 +:10D0D0007FB505460E46EFF3108472B602A80DF038 +:10D0E00046FB84F310880298039900900191281A56 +:10D0F000000101210009C906884205D20098A84212 +:10D1000005D10198864202D8012004B070BD0020EC +:10D11000FBE730B5C368826888680125141A2401CA +:10D12000C9682409ED06AC4203D2904203D18B4278 +:10D1300001D8012030BD002030BD0A0C838889B29F +:10D14000934204D1C088884201D101207047002059 +:10D1500070470000072803D2024A8000801841600F +:10D1600070470000949000200CB5002807D00DA156 +:10D1700006C96844203801920091C07F0CBDFF2091 +:10D18000F5300CBD0CB5014606A005C80192009013 +:10D1900000206A46135C8B4203D3401CC0B20728B0 +:10D1A000F8D30CBDFA96644B321E140070B50E46CF +:10D1B0001C46154601210DF063F846608560446108 +:10D1C00070BD70B50C460646014615464F480CF03A +:10D1D00099FF4F4A3561F460137820462946002BA9 +:10D1E00003D1012313700DF070FB70BDF8B51C4620 +:10D1F000069B002A0E46054622460DD00021382007 +:10D20000FFF7D4FF434F0446002D0CD010222046D8 +:10D2100029461830B8470DE000211820FFF7C6FF57 +:10D220003246294610E020463A4B102200211830A1 +:10D230005C33984710222046283031460546B847CF +:10D2400021462A4618312046FFF7BBFFF8BDF0B54E +:10D2500089B00E460746002401AD0DF053FAA10037 +:10D26000641CE4B26850082CF7D33B46012205A9A0 +:10D2700001A80096FFF7BAFF09B0F0BD70B50546EA +:10D280000E4622480CF05BFF04462048002200684E +:10D290001F4900280A7005D001220A700169C06880 +:10D2A0000DF013FB002C13D0002D07D16268002A6B +:10D2B00004D0314620469047002809D0A368002BAF +:10D2C00003D0314628466269984720460DF032F86F +:10D2D00070BD30B55B1E5BB2002B04DBCC5CD55C53 +:10D2E0006C40C454F6E730BD10B50F228418203CC2 +:10D2F000835CE47F5B00E40923438B54521E1206D7 +:10D30000120EF3D100784000087010BDB4900020D8 +:10D31000DC920020190F0000F0B504468BB000200D +:10D320002646203608900F46F07CB17C884212D207 +:10D33000218E0001081AA16910234218394630468F +:10D34000FFF7C7FF32462046E169FFF73AFFF07C5E +:10D35000401CF0746DE0FE2809D2FE20F0744A4BA8 +:10D3600010223946304698470022E16930E0FF2814 +:10D370005DD2FF20F074208E10210CF0E5FDF87BCB +:10D38000CDB2C009099069463846FFF7ADFF09984C +:10D39000002805D06946087887214840694608700A +:10D3A000002D19D1B07C002816D0374B102204A8CC +:10D3B000A169984704A910236A460846FFF789FF28 +:10D3C0003246102304A91046FFF783FFE169324675 +:10D3D0002046FFF7F6FE2CE06846C07B6946C70989 +:10D3E0000846FFF781FF002F05D06946087887219E +:10D3F0004840694608701021491B8C4600200F21C7 +:10D400004F1B04ABA84204D2A1690A5C614609180B +:10D4100007E0A84202D18022DA5503E000220F2162 +:10D42000091A5A54401CC0B21028EBD3C2E701209D +:10D43000089008980BB0F0BD70B582610386044671 +:10D44000C1610F33180925462035A87401200E4B01 +:10D45000E8741022002128465C339847294620466C +:10D46000FFF75AFF70BDF8B51F4614460D46064635 +:10D470003A4606493420069BFFF798FE23462A4683 +:10D480003146FFF7D9FFF8BD190F000019D3001876 +:10D49000F8B5064604462036307E0025002802D026 +:10D4A00001252846F8BD2046224618301023283290 +:10D4B0000746FFF70EFF012030763A462046E16826 +:10D4C000FFF77FFEEDE7FFB581B016460F46054634 +:10D4D0000E493C200B9B0A9AFFF768FE0446324631 +:10D4E0001830102339460646FFF7F3FE1022204677 +:10D4F000074B2830049998470021382001553246BF +:10D5000029462046FFF75DFE05B0F0BD91D4001816 +:10D51000190F0000F3B581B00F46486801994968BA +:10D52000421A140101222409D206944203D9081A8E +:10D530000001000944420198BD688668002C02DCA5 +:10D5400028D1AE4226D20069FA493018451B281E60 +:10D5500004DD681E0CF00EFD201A03E00CF00AFD3D +:10D56000201A401C002801DD0020FEBD3869F14969 +:10D57000281A002804DD401E0CF0FCFC201A03E0F1 +:10D580000CF0F8FC201A401C002801DD0120FEBD33 +:10D590000220FEBD3F69E749E819801B002805DD30 +:10D5A000401E0CF0E7FC0019401C02E00CF0E2FC0D +:10D5B0000019002801DC0520FEBD0198DD49006945 +:10D5C0003018401BC01B002804DD401E0CF0D2FCAC +:10D5D000201A03E00CF0CEFC201A401C002801DDCC +:10D5E0000320FEBD0420FEBDF1B584B0D2480090FA +:10D5F0000027046857E0A08A22688105890E0292FC +:10D60000820B4ED000294CD0002201921646A27DFA +:10D6100003071B0FD2180901049D1039A275890553 +:10D62000890D3F22120190430143A18234E0294633 +:10D630002046FFF76FFF002830D005282AD029693F +:10D64000A8684618BB4930460CF07EFC0146686865 +:10D65000B84B40185943A268711A8A4200D2401C44 +:10D66000060136096660A08A800B022812D3B149F0 +:10D6700020690CF069FCE1680346881B0001012267 +:10D680000009D206904203D9701A000100094042F5 +:10D69000834206DC2E462D68002DC8D10198002853 +:10D6A00017D02746029C002CA5D1009800680028BE +:10D6B0000DD0082105200007016282698A430A43D0 +:10D6C000826101680122D20691431143016005B0D5 +:10D6D000F0BD2246394600980CF056FD9648224689 +:10D6E00031460C380CF09CFDDCE7FEB592480C3856 +:10D6F0000068002826D0C27D41688768891A0E011B +:10D70000360968460DF033F8019D8A48FF3591359A +:10D71000009C854204D340422D18641C2401240936 +:10D72000301B000101210009C906884203D2B4421E +:10D7300003D1AF4201D826462F46394630460DF078 +:10D740003AF8FEBD0021481EF9E7F0B505467A48D3 +:10D7500087B00C38059000200646019000900746DF +:10D760000290EFF31080069072B603A80CF0FFFF52 +:10D77000E97D03987D22401804990001D2006D4B89 +:10D78000000989185B4203E0C918401C0001000928 +:10D79000684A9142F8D26A68131A1C0101232409CD +:10D7A000DB069C4204D282420DD1AA6891420AD97A +:10D7B000AA8A920B1FD06860AA688A4203D2401CD2 +:10D7C000000100096860A88A800B022816D3594915 +:10D7D00028690CF0B9FBEA6869680446501A000130 +:10D7E00001230009DB06984203D9881A00010009C9 +:10D7F0004042844202DD0120029094E04E480C3801 +:10D800008468002C67D10598046864E021462846A6 +:10D81000FFF780FE002860D0052839D0A97DA27DC1 +:10D8200091420FD9444B0C3B9B68A3420AD0002E77 +:10D8300000D126467F1CFFB2009401284DD003285A +:10D840004BD025E0AB8A9B0B17D02169A068461806 +:10D85000384930460CF078FB01466068354B40187B +:10D860005943AA68711A8A4200D2401C000100097B +:10D8700000266860374600960AE09142BBD92E49DF +:10D880000C398968A142B6D1032826D00428B2D128 +:10D89000A88A800B022815D3264928690CF054FB6E +:10D8A0000346E86869688446401A000101220009BD +:10D8B000D206904204D96046081A0001000940428D +:10D8C000834298DC1C480C388068A0429BD0002F13 +:10D8D00000D101942468002C98D10298002822D10C +:10D8E000002E0AD01448009A0C3801990CF059FC0B +:10D8F00031461148009A0CF010FC0198002806D01F +:10D9000001460D482A460C380CF08AFC06E00A480D +:10D9100029460C380CF00CFCFFF7E7FE002E02D075 +:10D920002846FFF761FE069880F31088029807B03A +:10D93000F0BD000071020000C890002070B50446E0 +:10D940000026EFF3108572B600281FD011488268B8 +:10D95000A24202D10021816018E0002916D100689E +:10D96000A04205D10B480CF0EAFBFFF7BEFE0DE02C +:10D97000214608480CF0EDFB002807D10548214658 +:10D980000C300CF0E6FB002800D1022685F310884D +:10D99000304670BDBC900020FFB5394D0646EC7C8A +:10D9A000A87C81B0201A0007000F8C460E2801D3F6 +:10D9B000012000E000200090314AA000803A811848 +:10D9C00077680F64111980310B7061461150012086 +:10D9D000298AA040014329822A492201B088571888 +:10D9E000788070680001000DB88030892721090116 +:10D9F000081AF88024493069884208D92349401818 +:10DA00000CF0A2FA0121C9030143798105E0C103A9 +:10DA10000120C0030818000C78810A981F211F28D4 +:10DA200000D308460002B881F8891F210902884303 +:10DA30000F2109020843F881039870214843FF3001 +:10DA4000513080083881B07D1F211F2800D308463F +:10DA50000099C002890202220843104338809007CF +:10DA60000B4920430860E87C401C0007000FE87465 +:10DA70000848018820221143018005B0F0BD000054 +:10DA80005091002000800020FF7F00007102000004 +:10DA90000001005000900020FFB58FB0064611989D +:10DAA0001F46304363D0012E01D1002F5FD00020EC +:10DAB0000690012E04D011988068002E02D006E056 +:10DAC0007868FAE71099002901D01198C068089089 +:10DAD000012E0AD01198008A0990012E07D01198C2 +:10DAE000C07C002803D0012002E0B889F4E70020C0 +:10DAF00000900CF031FE0001C00F0190D0480021D1 +:10DB00008160D0488079002815D00198002812D172 +:10DB1000CB4804680DE0A5880120294600070CF0D9 +:10DB200013FA681AE188401829460CF023FAE180BC +:10DB30002468002CEFD1C34901988871012E14D0BC +:10DB400011984069019008980D90019800280ED016 +:10DB50000D9800280BD0012E0CD0009800280BD077 +:10DB60000125B7480468059482E03868EAE7012097 +:10DB700013B0F0BDBD68F4E70025F2E7002E04D134 +:10DB80001098002801D0678900E02789A0880290BA +:10DB900000286CD0002F6AD0A1890998814266D0F4 +:10DBA00001990298884200D3084604900D983918CC +:10DBB0000498814201D90320DAE7E08804990CF047 +:10DBC000C3F9CF1907917F1E049901980CF0BCF995 +:10DBD00000294CD1049902980CF0B6F9002946D1DD +:10DBE000284604990CF0B0F90D980A910818401EC7 +:10DBF00003900798814201D3B9421ED9079903982F +:10DC0000884201D3B84218D90A98884202D80398AA +:10DC1000B84212D20498874206D3014638460CF027 +:10DC200093F90A98814208D20499039888421ED336 +:10DC30000CF08AF90798814219D3012E04D0781C80 +:10DC400004990CF081F905E07D48019D84600CE0A9 +:10DC500004980918A942FBD900980D46A84303D19E +:10DC600000988143C80700D06D1C059C00E0246823 +:10DC7000002C02D00198854280D30198854202D3BE +:10DC8000032006903DE0002E3BD11198856111984C +:10DC900046690898019500901198AD19008A039083 +:10DCA0006D1E059C25E0A1890398814220D0A088A3 +:10DCB0000290B04201D3374600E00746394630466D +:10DCC0000CF042F9002913D1394602980CF03CF9C6 +:10DCD00000290DD1E08839460CF036F900E0C91969 +:10DCE00001988142FBD90098081AA84200D2054643 +:10DCF0002468002CD7D1314628460CF025F911981C +:10DD0000C161069834E71FB50446808800902089D9 +:10DD10000190A08969468881E088002202906B46C4 +:10DD200011460120FFF7B8FE032819D14448806846 +:10DD3000002815D0E17B002902D1C27B002A0FD038 +:10DD4000002901D0224600E00246002905D0C37B0D +:10DD5000002B02D0994200D20246908909F0CFFBF5 +:10DD6000214637480CF0CEF91FBD10B501463448A6 +:10DD70000CF0EFF910BDFEB50446406800906061FC +:10DD8000216800980291814242D20025ED432E463F +:10DD900000212B4809E08289238A9A4205D0491C38 +:10DDA0008288C9B2B24200D2164600680028F2D179 +:10DDB000002908D00098B0420FD331460CF0C4F8C7 +:10DDC000704305461DE0A67C002E1AD0314600980F +:10DDD0000CF0BAF83546454313E0074600200190A1 +:10DDE00009E0394630460CF0AFF8002902D1012095 +:10DDF0003D460190BF1E0298B84202D80198002803 +:10DE0000EFD00298A84203D80098A84200D36561D9 +:10DE10000023224601211846FFF73EFE002809D0C4 +:10DE2000E268A168914205D20023224619461846AD +:10DE3000FFF732FEFEBD00220346114601202BE60D +:10DE400064910020D09200201CB541480468002C49 +:10DE50001ED068460CF08BFC01980099E02801D395 +:10DE6000012000E00020401C08180001000900907B +:10DE700060680099401A000101210009C906884222 +:10DE800001D2606801E0009860600CF083FC1CBD6A +:10DE90000020C043F9E7FEB506460025EFF31087E2 +:10DEA00072B668460CF063FC019800997C2801D397 +:10DEB000012000E00020401C08180001000900902B +:10DEC00070680099401A010101200909C0068142C9 +:10DED00001D3009971601E490C6808E0616872689E +:10DEE000891A09010909814203D325462468002CB7 +:10DEF000F4D1002D05D03246294615480CF090F992 +:10DF000005E0314612480CF013F9FFF79DFF87F347 +:10DF10001088FEBD70B50025EFF3108472B60C4E6C +:10DF20003168814208D130460CF009F93068002888 +:10DF300009D0FFF789FF06E0014605480CF009F912 +:10DF4000002800D1022584F31088284670BD000007 +:10DF500070910020F8B53E483C4981800021C943BA +:10DF600001603C48384F46681DE030460CF09BFB92 +:10DF70001F210D1A3748A90009188C68002C0FD0F2 +:10DF800069000818008B34490BF0DEFF201A84B2B8 +:10DF9000022C01D9A41EA4B2A74200D23C46A7B2CB +:10DFA0000120A8408643002EDFD1294A2A499088C3 +:10DFB0004F43B84200D33846908026480068411C41 +:10DFC0000AD011684B1C06D0091A0901012309095E +:10DFD000DB06994200D31060F8BD022801D11D482C +:10DFE0000160B7E710B5022802D11A49C01E0860C7 +:10DFF000FFF7B0FF16480068401C01D10AF0D6FABE +:10E0000010BD30B4032801D004280BD111488C0076 +:10E010002418A2604A0012181383012342688B401F +:10E020001A43426030BC95E7032801D0042809D187 +:10E0300008488B0000221B189A60012342688B401D +:10E040009A43426086E70000FFFF0000E4570000AB +:10E05000D09200207891002071020000F8B50746A8 +:10E06000000214460E460025C01D0CF030FA21783F +:10E0700043233F2818D01F2816D0FA49BA008A58DF +:10E08000B300D158A1420DD00121B140014201D0CD +:10E0900002250EE00125D450C9B22A46384601F0C7 +:10E0A000D1FD06E0012504E00C3C2289384601F050 +:10E0B000E1FD2846F8BD70B50D46044601F0DEFED0 +:10E0C000C0B2294609F02EF900281AD0112809D02B +:10E0D00004DC012806D00C2814D103E0192801D053 +:10E0E0001A280FD1DF4BA200995840318D79AD0627 +:10E0F00008D5487DFD2420404875985880680CF06C +:10E1000098F970BD9030C2B20221204601F0C3FDE3 +:10E1100070BDF7B504020546E61D30460CF0D7F990 +:10E120003F2822D01F2820D01F2130460CF0A4F910 +:10E13000CC4FAE00B95902988881284601F09EFE66 +:10E14000C0B2019907F071FB00280DD09030C3B226 +:10E1500001212846029A01F08DFDB859002803D10B +:10E16000E01D00210CF088F9FEBD43230121284663 +:10E17000029A01F07FFDFEBDF8B50502ED1D0C46CB +:10E1800028460CF0A4F93F2831D020462030017AEF +:10E190002E0ACA0719D0827A304601F0E5FEB14F47 +:10E1A000B5007959206948637959606A886378595C +:10E1B0001022AD4B21461430984778592146102241 +:10E1C0001431A94B2430984704E000221146304610 +:10E1D00001F0CAFE35020824681D0CF078F9A0434E +:10E1E0000146681D0CF048F9304605F042FBF8BDC9 +:10E1F000FFB5150A16460F460A4681B0002128468B +:10E20000FFF72CFF0446012822D13978072922D0B4 +:10E2100004DC032907D004291AD10BE0182928D0DF +:10E22000192915D142E0284601F028FEC0B207F0B6 +:10E23000C0FB05E0284601F021FEC0B208F0A2F9BB +:10E24000002805D09030C2B20021284601F023FDFD +:10E25000204605B0F0BD01233246844804990CF0F5 +:10E26000CFF80646284601F009FEC0B20BF03EFE8C +:10E2700027E0284601F002FEC0B2694609F0ECFC36 +:10E2800007000ED1732002233246000104990CF0DE +:10E29000B7F86946497841706946097801700CF011 +:10E2A000C8F8002F00D09037FAB2CDE76F480123AD +:10E2B0003246283004990CF0A3F80646284601F0AF +:10E2C00015FE307030460CF0B4F80022BCE770B593 +:10E2D00015460C4610460CF0FAF82B0A00253F288C +:10E2E0000BD0E188062908D1000701D5022504E0FA +:10E2F0002278211D184603F015F9284670BD70B527 +:10E30000154610460CF0E3F82C0A3F2812D0554869 +:10E31000A1004058806800280CD00078092809D155 +:10E3200045220221204601F0B6FC2A463B21204628 +:10E33000FFF7EFFE002070BDFFB50546000281B07B +:10E34000C01D0CF0C4F83F2883D0464FAE00B8592A +:10E350008468002C15D02078092812D1284601F0B5 +:10E360008DFDB959029A4031497DC0B2C943890730 +:10E37000C917491C002A0FD0002903D0A11C09F09D +:10E3800039F866E761780022284603F025FDA11CD4 +:10E390002846FFF790FE5CE7002903D0002109F032 +:10E3A00029F804E061780122284603F015FD48228F +:10E3B0000221284601F06FFC4BE7FFB5160A17460D +:10E3C0000C460A4681B002213046FFF747FE05465B +:10E3D00001285ED12078092802D0172859D149E0B8 +:10E3E0002389E2886188A08801F0EAFD002813D023 +:10E3F0001C48B100415808464030427D920702D483 +:10E40000807980061CD40498C0B2072806D0A11CCD +:10E410003046FFF750FE3CE0402236E01348C98901 +:10E4200008233A46801D0BF0EBFF61880180A1882C +:10E430004180E18881802189C1800BF0FAFF28E0CA +:10E440000CF060F90106090E00D101216170A21CD7 +:10E45000304603F0D8FC0548054A3946E9300CF04F +:10E460004FF816E0C0910020190F000009070000C6 +:10E4700030750000304601F001FDC0B2611C09F0AA +:10E48000FEFB002805D09030C2B20221304601F0D8 +:10E4900002FC2846DDE60000F7B5009816460502A6 +:10E4A0000F460024681D0CF012F84322102811D0EA +:10E4B0000099BB008A00F8498958CA58B2421CD05A +:10E4C0000122BA40024201D0022408E0C88DC006F1 +:10E4D00007D5432233463946009803F02FFA2046E9 +:10E4E000FEBDCE500124D6B2681D0BF0F0FF3043C4 +:10E4F0000146681D0BF0C0FFF1E70124EFE7FEB510 +:10E50000100A0C460A4601210090FFF7C5FF029051 +:10E5100001287AD12178204605260C30F602DF4DFD +:10E5200001900B000BF03AFD107109471A713A3A4D +:10E530005365685EA7D9BD71FE716088FF220146F0 +:10E540001739EA32D64C914200D8A0830422022126 +:10E55000009803F0E6FB0146A08B8AE06078022871 +:10E5600015D0102206210832009803F0DAFBA188AA +:10E570004180E1888180C680627821460831074663 +:10E58000042A06D038460830A8473946E1E002227E +:10E59000E8E73846083003F04EFEF6E70822114659 +:10E5A000009803F0BEFB0146A0884880E088888080 +:10E5B000BC4ACA80CDE008221021009803F0B1FBCC +:10E5C0000146A0884880E0888880CE80C1E006228D +:10E5D0000421009803F0A5FB0146A0884880E0884C +:10E5E0008880B6E00098AC49800008588068002810 +:10E5F0000CD0E088002835D006220C21009803F0CA +:10E6000090FB0146E088888032E0C1E0A188E08884 +:10E61000814201D94022B7E0207A102805D0042891 +:10E6200003D0022801D05122AEE0022810D01022DF +:10E630000821921D009803F074FBA1884180E188B5 +:10E640008180227A214609310646042A02D005E05B +:10E650000222EDE7B01D03F0EEFD01E0B01D76E013 +:10E66000314676E004220A21009803F05AFB014665 +:10E67000A08848806DE060780E214200921C0098CE +:10E6800003F04FFB0146002207E090000019530001 +:10E690005B188088521C588092B260789042F4D8FF +:10E6A00057E026462489009803F0D5F9C01E84421D +:10E6B00000D2204687B2381D82B25221009803F062 +:10E6C00030FB0446B08860803A46201D0199A84777 +:10E6D000204608380BF0ADFE5AE06078002809D0DB +:10E6E000009803F0B8F92189C01E884202DBE08857 +:10E6F000002820D06189208981422ED2461A0098B4 +:10E7000003F0A9F9401F864200D2304687B2B81DF7 +:10E7100082B21621009803F004FB0646A0887080A0 +:10E72000E08800E036E061893A464018B0806189AF +:10E730000198091892E7091D8AB21221009803F086 +:10E74000F0FA0646A08870802289301D0199A847FA +:10E7500086E7009805F0A5F91AE06278002A0ED045 +:10E7600002221821009803F0DCFA01466089228910 +:10E77000904201D1012000E000204870E9E7814289 +:10E7800001D1002200E052220121009803F003F998 +:10E790000298FEBD02221821009803F0C2FA014639 +:10E7A0006078EAE710B51046140A0BF090FE1028C6 +:10E7B00002D0204605F06CF9002010BD70B5150A96 +:10E7C0000E460A4600212846FFF766FE0446012849 +:10E7D00016D13148A9004058806A002806D04088E8 +:10E7E000B188884202D1284604F08CF93146284687 +:10E7F00004F01EFA020003D00021284603F0CBF8F3 +:10E80000204670BDF8B515460C46002710460BF0A3 +:10E810005EFE10286CD0280A1F4E850000907359A8 +:10E820008446186A002801D0017D00E0002122788A +:10E83000402A04D0412A0ED0422A59D146E000296C +:10E8400056D0986A002802D00C380BF073FD70592E +:10E850000127846249E0122906D0182910D05229D4 +:10E8600007D0D22923D104E062786188604604F0A1 +:10E870003CFA705920300BF062FC0BF05BFD13E0AA +:10E880006378002B10D062881821604604F01EFACD +:10E89000009804F0FFF9ECE7E8910020190F000060 +:10E8A0009891002003280000009804F0E2FF6078AF +:10E8B00000281DD17059806A002819D040886188CD +:10E8C000884215D1009804F01DF911E016290FD1E6 +:10E8D0006378002B0ED06288604604F0F7F9705917 +:10E8E00020300BF02CFC0BF025FD009804F0C1FF4C +:10E8F0003846F8BDA1880122D20311434182F4E7D2 +:10E90000FFB581B0174610460BF0E1FD3D0A102817 +:10E9100021D02A4EAC003059C08DC00606D42848FC +:10E920003A460059C18927480BF094FD305910220E +:10E93000C18D1143C185152101988901401A02D06A +:10E94000012808D102E04522012101E045220021F1 +:10E95000284603F020F8002005B0F0BD70B515463C +:10E960000E4610460BF0B3FD0024102822D030785C +:10E970002D0A002804D0342812D03F2810D019E0E6 +:10E980003146284604F09BFF0446FF2812D1314649 +:10E99000284605F01FFD0446FF280BD1002409E09E +:10E9A000317A4A0606D43F2806D00423002228469E +:10E9B00004F08CF9204670BD0623F7E7E8910020AB +:10E9C000C09100201B050000F8B51F4614460D46F7 +:10E9D00010460BF07CFD0026240A3F280DD0504A3B +:10E9E0002946A0000C3910580BF08CFB012631464B +:10E9F000204603F067F83046F8BD462239462046E7 +:10EA000003F091F8F7E770B5464D6C8801F023FAF2 +:10EA1000FF2808D06988491C698081004048405817 +:10EA2000017B491E0173002C02D106200BF0F8FD7A +:10EA300070BDF0B587B014460E4610460BF047FD8A +:10EA40003F2840D0200A0590354980000C5800200E +:10EA50000490708869468881308833494018049052 +:10EA60003779012F04D0022F2DD1059803F02FFB09 +:10EA7000207C617C884205D203AA04A9059803F092 +:10EA80004CFB0227A16800291DD08888274AD04264 +:10EA900019D10D466846808904990C3500912346AA +:10EAA00001900E33AA1C0297291D059803F0C8FA9D +:10EAB000002802D1E189002905D10021A160287038 +:10EAC00028460BF0B6FC30880BF08CFA002007B01B +:10EAD000F0BD70B514460D4610460BF0F8FC01462B +:10EAE000200A00243F2911D0EA88291D052A0DD1CA +:10EAF0002A78002A0CD0332A08D04979312A0BD041 +:10EB0000002903D000231A4603F048F9204670BDBF +:10EB100003F097F90446F9E717230122F4E7000010 +:10EB2000F8910020F491002000800020F9FBFFFF05 +:10EB300070B505460C4606200BF0C9FC04280BD026 +:10EB40000122AA40002C02D00243D1B201E090433E +:10EB5000014606200BF090FC70BD70B5524D064684 +:10EB600084002859002807D00C380168491C03D1BB +:10EB70000BF0E0FB0020285100213046FFF7D8FFC2 +:10EB800070BD70B5154604460622022310020BF034 +:10EB900037FC047045700BF04CFC70BD70B5064638 +:10EBA0000D46002406200BF092FC042812D03E4AA9 +:10EBB000B1005358AB420CD00123B340034201D003 +:10EBC000022407E00124555021463046FFF7B0FFEC +:10EBD00000E00124204670BD70B50A460546324962 +:10EBE0008000095800290BD008460C380389DCB294 +:10EBF000062C05D0072C03D008781946FFF7C1FF73 +:10EC0000012D03D128480421203041712846FFF707 +:10EC1000A4FF70BDF8B5244B05461E330C46981C66 +:10EC200001792678C907C90F0322002E0BD18079FC +:10EC30001D4A800080188068467C828A002E02D09F +:10EC400003461633012100912946204601F07FF842 +:10EC50000446FF2804D002F04DFF204602F04FFE8C +:10EC60002046F8BD10B50446FF280DD001F037F856 +:10EC70000021204602F026FF0021204602F091FFED +:10EC80002046012102F0A6FE10BD0020074A0146E1 +:10EC90008B00D358002B01D0401CC0B2491CC9B214 +:10ECA0000329F5D37047000098910020C0910020FF +:10ECB000F8B50020009008781D460C46012807D0C2 +:10ECC00003280BD040221946FFF75BFF0098F8BDE0 +:10ECD0000DF028F9002229460120F5E70020FFF772 +:10ECE0005DFF00900128F1D16078002507073F0FF4 +:10ECF000FFF7CBFF002808D129484068002804D13D +:10ED0000032100F079F9002801D0432543E00020D9 +:10ED1000002801D042253EE0608C1B38E12807D254 +:10ED2000A08CFF214931884202D31E49884201D973 +:10ED3000402530E0E17E1A4EC9073801490F0843EB +:10ED400020363071B8080DD0E08C01221721520214 +:10ED5000904200D31046172800D2084610498883F5 +:10ED600003F00AFD3079A17E8008800008433071ED +:10ED70000B480622211D0C4B1E309847201D05F024 +:10ED8000E4FB20462030017A407A05F09BFBA18C01 +:10ED9000608C05F0A8FB29460020FFF71DFF95E7D2 +:10EDA0009891002048080000190F000070B50C462B +:10EDB00006200BF08CFB04281BD06148006800285B +:10EDC00017D00178192914D10C380189C3200025E6 +:10EDD00010230622C0000BF013FB5A4B06461022EC +:10EDE0002146984730460BF024FB29460020FFF7C8 +:10EDF000F3FE70BDF7B5044686B0154606200BF04D +:10EE000066FB04282BD04E4F3968002927D008789C +:10EE1000182824D1002C02D09034E1B21CE02846FE +:10EE2000484D01260C4600281BD00F460C39C12046 +:10EE3000098908230622C0000BF0E2FA04460322E7 +:10EE4000791CC01CA847032220460799A847A67131 +:10EE500020460BF0EEFA00210020FFF7BDFE09B0BE +:10EE6000F0BD0322601C0799A847E078217980064D +:10EE7000800E0843334BE0701022002101A85C3360 +:10EE800098470322611C01A8A847B8692E4B0122AC +:10EE900001A90096FEF7AAF9E1E770B50C46062035 +:10EEA0000BF015FB04281AD025480068002816D05E +:10EEB00001781A2913D10C3801890025082306226C +:10EEC00022480BF09DFA1F4B064608222146984720 +:10EED00030460BF0AEFA29460020FFF77DFE70BDEC +:10EEE00038B50C460020FFF759FE0546012821D110 +:10EEF0002078182804D0192813D01A281AD11BE01A +:10EF00002079C02808D0002806D0402804D040210D +:10EF10000020FFF761FE0DE000210B48FEF797F996 +:10EF200008E0002100912146094B01221131601CAB +:10EF3000FEF75CF9284638BD00210648EEE70000E0 +:10EF400098910020190F0000F5ED00181A06000036 +:10EF5000ADED00189BEE001830B504460120F84DC9 +:10EF600000218A0052199268002A09D0537B022B93 +:10EF700001D0012B04D1527CA24201D0002030BD2F +:10EF8000491CC9B20429ECD330BD10B5FFF77DFE92 +:10EF9000EB4C002291000919896800290DD0CB7B28 +:10EFA000032B0AD14B7B002B02D0022B03D004E0B1 +:10EFB000097C890601D5401CC0B2521C042AE9DB39 +:10EFC000032801D3012010BD002010BD70B50E46EE +:10EFD0000546002130460BF053F904000AD0D94B06 +:10EFE00032460021984725730020E073D449A800D9 +:10EFF00040188460204670BD30B50023D04C0AE034 +:10F00000820012199268002A04D0D57B8D4201D16A +:10F01000134602E0401C0428F2DB184630BD0146CE +:10F020000120002904D1C64820300079C007C00F54 +:10F03000704770B50D00044607D0007B00F074F9EE +:10F0400029460120FFF7C8FD70BDA18A03230622CF +:10F05000BD480BF0D5F9217B0170617B41700BF04D +:10F06000E8F9B74820300079C007C00F0ED0B44986 +:10F0700020461630B34B06221E3106465C3B9847AD +:10F08000607B002805D0304605F03DFA0120E07392 +:10F09000D6E7207B314605F082FAF7E770B50446E3 +:10F0A0000D460120FFF798FD002D01D0012003E05F +:10F0B000E07B022801D10320E07370BD70B50D46DE +:10F0C0000446818AA04804230622401C0BF098F9CC +:10F0D000217B0170617B417085700BF0AAF9E07BA8 +:10F0E000042819D1964900204968002900D00878E1 +:10F0F000A52802D0A62805D00EE000210120FFF7A8 +:10F100006BFD09E0207B0321401CC0B2FFF774FFB8 +:10F110000028F2D0416888470120E07370BD10B527 +:10F120008749044649680020002900D00878A728AC +:10F130000CD0A8280ED1207B0121401CC0B2FFF7C3 +:10F140005BFF002802D08168884703E0002101208E +:10F15000FFF742FD207B00F0E7F810BDFFB581B05E +:10F160000D460120FFF71AFD009001287BD1297878 +:10F1700000260846A43834460427714A03000AF0E2 +:10F180000DFF050425313A4A5700687829460428BE +:10F1900061D2800080188768002F04D0F87B012896 +:10F1A00003D0032804D0432456E00220F87305E07E +:10F1B000787B0028F7D1B87B0028F4D13A6838462C +:10F1C0009047040048D00120F87345E0687804288F +:10F1D00041D28000801880680028E4D0C17B0329D8 +:10F1E000E1D105E003210020FFF706FF00281DD034 +:10F1F000C77341680DE0687804282CD2800080181D +:10F200008068002812D0C17B0129CCD10521C173AF +:10F210008168884720E003210020FFF7EDFE0028E9 +:10F22000C1D10121FFF7E8FE0028EFD1012613E04C +:10F2300004200024A3009B189B68002B16D0641C9C +:10F24000E4B2042CF6D3042812D0A02912D0A129AC +:10F2500016D0A2291AD040242046304303D021469C +:10F260000120FFF7B9FC009805B0F0BD2046EAE7A1 +:10F270004B24F1E769782B1D049A00F0CEF803E0E7 +:10F280006978049A00F088FA0446E5E76978049AF8 +:10F2900000F0E5FBF8E710B502462B480C460123C9 +:10F2A0000621401F0BF0ACF804700BF0C2F810BD43 +:10F2B00010B5084600781946002800D09030204B41 +:10F2C000C2B2586800281DD0007800281AD018460D +:10F2D000203040798000C0188068448A8C4211D167 +:10F2E00000234382437B002B04D0012B05D0022B4B +:10F2F00008D105E000F0EFF804E000F077FA01E053 +:10F3000000F015FC002010BD10B514460246FF2089 +:10F31000002903D121461046FFF77CFC2178002903 +:10F3200001D100F0C7FB10BD810010B504480C18D6 +:10F33000A068002801D00AF0FDFF0020A06010BDE9 +:10F3400098910020750F0000A40600001CB5027BF8 +:10F350006B461A70002906D001225A704A885A80DA +:10F360000979197101E000215970E44C4482184672 +:10F3700005F0E4F9014668464078084302D020468B +:10F38000FFF789FF1CBD70B5044601250878002AE7 +:10F3900011D0A28B4B889A420DD1A92802D0AA285D +:10F3A00003D006E0207C042101E0207C08210843F2 +:10F3B0002074002509E0A92801D0AA2805D12046FB +:10F3C00000F064F9A18B4018A083284670BD10B5E9 +:10F3D0000024C477CA4A037B5371FFF7B7FF204666 +:10F3E00010BD0021C177C649027B4A71017C4906E4 +:10F3F00001D50021AAE7704710B50021C177C049A7 +:10F40000BE4C027B4A71E41C4482007B05F0FFF98C +:10F4100001462046FFF73FFF10BDFFB50F46588855 +:10F420001021084381B058801C4616460025202133 +:10F430000198FFF7CBFD00282FD0002141732278DF +:10F44000827347748682C17761788177AD490160A4 +:10F45000AD494160AD498160A94A01995171817BF3 +:10F460000029A1781BD0890706D4017C0222114310 +:10F470000174A178890703D5017C0122114301742D +:10F48000A178C90703D0017C2022114301742146D1 +:10F4900000F0BCF8284605B0F0BD4B25FAE7490757 +:10F4A000E3D5E6E770B50C460120FFF777FB05468C +:10F4B00001280ED160789249800020394018806878 +:10F4C000002181838E4962784A7100222146FFF72C +:10F4D0005AFF284670BDF8B5C77B894D874C203D43 +:10F4E000BF263B000AF05AFD0604101D1037420FDC +:10F4F000824BDB1C994200D0C277418A002902D19D +:10F50000C17FFFF796FDF8BD6968140004D10122A0 +:10F51000FFF739FF0028F6D121460120FFF75CFBF9 +:10F52000F8BDA14205D1C37F002B02D0017C314040 +:10F5300009E0C277002A07D1704A5242D14203D172 +:10F54000017C402211430174418A0029E8D1C17F26 +:10F55000FFF7A4FDF8BDA14202D1017C3140017446 +:10F56000418A0029F6D1FFF7A9FDF8BDFFF7D7FDC5 +:10F57000F8BDF7B50E4662490546800020394018AF +:10F580008068002814D0C17B032911D1818AD5203D +:10F5900008230622C0000AF033FF05700446C67136 +:10F5A00006225B4B02A9401C984720460AF041FF07 +:10F5B000FEBD70B5524B8000203BC018846800250A +:10F5C000002C22D0607B00281FD1E07B03281CD1B7 +:10F5D000207CBF2318402074002904D03C290FD080 +:10F5E00043290ED10CE0607C00280AD0104600F0C0 +:10F5F00032FCFF2805D02146163100F059FC00E00E +:10F60000452529462046FFF759FD70BDF8B50D4642 +:10F610000646002120200AF033FE0446307B20708D +:10F62000A8784006400E6080286960606869A06024 +:10F63000287E6070687E2077707CFFF7F0FC207376 +:10F64000A878400707D5287B60730622A91D2046AD +:10F650002F4B0E3098476879A0762879E076688835 +:10F66000C00501D5012000E00020244F6077FF1E77 +:10F670007782204604F0BEFF050002D020460AF043 +:10F6800059FE29463846FFF706FEF8BD7CB50A4606 +:10F6900053880146FB2B01D8032007E0888B002804 +:10F6A00006D0181A83B2FB2B04D80220DCB203E088 +:10F6B000012000E00020FB240B7B6D462B7068705E +:10F6C000EC708B8B101D181801901078A9280ED0A3 +:10F6D00001202A46A870094D6D1E4D82104604F087 +:10F6E000CAFF01462846FFF7D6FD20467CBD002014 +:10F6F0002A46A870014DAD1EEFE70000392000003A +:10F70000B8910020CFF30018E3F30018F9F30018C4 +:10F71000190F00007CB50C46B1496B4649681C7056 +:10F720000A795A70827B012300259B02891C012AD9 +:10F7300012D0002A10D08A896B465A80C9899980D4 +:10F74000A84D4582684605F02EF901460C4302D0CB +:10F750002846FFF7A0FD7CBD69464B808D80EFE712 +:10F7600010B58A788273CA780024891C920603D463 +:10F77000027C01231A430274994A037B203253719D +:10F78000037BD37100F0EDF8204610BD9449027B55 +:10F7900020314A710021BDE770B5044690481646F5 +:10F7A000203000790D46C00601D4432418E00846F5 +:10F7B000FFF7D2FB002815D01C212046FFF706FCDE +:10F7C000002811D001214173457486828649016069 +:10F7D000864941608649002481602146FFF729FC63 +:10F7E000204670BD4024FBE74B24F9E770B57C4B05 +:10F7F000C57B04242033022D06D0042D03D1DC71F7 +:10F800000021FFF75BFC70BD002A04D0DC711146BB +:10F81000FFF744FC70BD734A521E914203D101218F +:10F82000FFF778FF70BD6F4A9142FBD10021EFE7EF +:10F83000F8B505466A482030C07904287AD068496E +:10F84000800040188768B87B042802D3687DC00711 +:10F8500070D0687D00214006800F0091002802D002 +:10F86000022803D005E00120009002E0387CC007A8 +:10F8700060D06E7FB98A3346163306225D480AF09F +:10F88000BFFD0446002E0BD0A682298CAA7F2046FD +:10F890008918594B163089B2C918584B32469847C7 +:10F8A000687D010747D5C00601D5032000E002208E +:10F8B0006070687DC00703D06078102108436070D5 +:10F8C000687D800703D56078202108436070687DDB +:10F8D000400703D5607840210843607000980028F5 +:10F8E00003D06078082108436070387B2070287F3F +:10F8F0006074E87E2074687E401CA074E87DFF2858 +:10F900001CD0C007C00F20720622291D3B4BA01C33 +:10F910009847687D40070AD5287E2946C007C00F52 +:10F92000E07306220A312046344B093098472046BE +:10F930000AF07FFDF8BDC006C00FB9E7FF202072B6 +:10F94000E7E7274910B52031C879042808D0244AB0 +:10F950008000801880680422CA714521FFF7AEFB41 +:10F9600010BDF8B50D460646002144200AF088FC7B +:10F97000044600274030C7708770707CFFF74FFB4C +:10F9800020706770B07B0121032801D0052800D1C9 +:10F990006170707C012806D16878C00603D5607854 +:10F9A000022210436070A7706878C00708D0A17069 +:10F9B000A888E080E888208168784007C00F20711F +:10F9C000084F20467F1E778204F0B2FF050002D068 +:10F9D00020460AF0AFFC29463846FFF75CFCF8BD2C +:10F9E000989100204220000061F700188DF7001860 +:10F9F0001FF10018A706000000800020190F00006A +:10FA000070B504468878A0730026542006558A886D +:10FA10008D1C002A05D00A204243062176480AF0B0 +:10FA20006FFD7648217B4171217B817129462046FB +:10FA300000F0A3F8304670BD70B5044606216E484C +:10FA40000AF0B1FD6D48217B41716D4D658205F075 +:10FA5000EFF9010002D02846FFF71DFC70BDF8B594 +:10FA6000074666480D460079002401090520164620 +:10FA7000884301D0432417E02846FFF76DFA002899 +:10FA800014D058213846FFF7A1FA002810D00221DF +:10FA90004173457486825B4901605B4941605B4903 +:10FAA00081600021FFF7C5FA2046F8BD4024FBE73E +:10FAB0004B24F9E770B5514E0025B17932468900E3 +:10FAC000203A89188C68FF280DD0617C002903D06A +:10FAD0002146163100F0ECF9A07B00280AD106215E +:10FAE00045480AF060FD0422012520460021B2713C +:10FAF000FFF7E4FA284670BD70B540488479042CBD +:10FB000013D03E49A00020394018856806223520D0 +:10FB10000223114640010AF073FCA52101704470D4 +:10FB20000AF087FC452040352875002070BDF8B5E7 +:10FB30000746C17B04263048304C022907D00329F0 +:10FB400010D004290DD154213846C95D11E01500AB +:10FB500003D006210AF027FDA67129463846FFF793 +:10FB60009DFAF8BD1500FCD006210AF01CFD3846B0 +:10FB70002946A671FFF7A2FAF8BDF8B50D4606466C +:10FB800000211E200AF07CFB0446707CFFF747FA38 +:10FB90006070002020703620405D2946A07006224B +:10FBA00030311B4BE01C98476878C007C00F60726B +:10FBB0006878C0070FD0A8886081E888A081A889EC +:10FBC000E081E8892082A88AE082E88A2083288A66 +:10FBD0006082688AA0820A4F20463537778205F016 +:10FBE000A5F8050002D020460AF0A4FB29463846B5 +:10FBF000FFF751FBF8BD0000F2060000B8910020AD +:10FC00000E20000001FA001839FA00181FF1001840 +:10FC1000190F000070B50C460546012901D101F00D +:10FC2000A6FCF24EAD007059A4000059002808D07F +:10FC30000C380168491C01D10AF07CFB7159002085 +:10FC4000085170BD70B50502ED1D16460C462846DC +:10FC50000AF03DFC1F280CD028460AF038FC002E84 +:10FC600002D00146214301E0A043014628460AF0A4 +:10FC700003FC70BD70B5164602021C460D460720F7 +:10FC8000022331460002D21D0AF0BAFB057044700F +:10FC90000AF0CFFB70BD70B50D460646D349800013 +:10FCA00008581346A9004258002A0CD010460C38B8 +:10FCB0000489E0B2052806D0062804D0117822462F +:10FCC0003046FFF7D7FF29463046FFF7A3FF012054 +:10FCD000A840C1B200223046FFF7B4FF70BDF1B5B5 +:10FCE00000988600C148815900980502002920D05B +:10FCF000E81D0AF0ECFB074600241F2F04D0214624 +:10FD00000098FFF787FF0AE0B848A10080594058E3 +:10FD1000002804D0462221460098FFF7BCFF641C4F +:10FD2000E4B2032CE9D3B14CA0590AF003FB002044 +:10FD3000A051E81D3F210AF09FFBE91DAC480AF0E5 +:10FD400032FCAB48E91D801C0AF02DFCF8BDFFB564 +:10FD500081B0054600242002C01D0AF0B8FB3F28F0 +:10FD600003D0641CE4B2032CF5D3032C71D0002122 +:10FD700058200AF085FAA6009C4F58229D4BB85196 +:10FD800000219847B859C8218187B9590F204031BF +:10FD90004875200200900021C01D0AF06DFBB95982 +:10FDA000029840318880B859E97B40308175B85954 +:10FDB000DF21403082790A402978002900D00121D2 +:10FDC00049010A4382718B4BB8590622A91C5C3B3E +:10FDD0004E309847B859697840300175854BB8590D +:10FDE00006225C3B473004999847B9590A9840313C +:10FDF0004873B959FF208881B9590398C88103987D +:10FE0000062822D001467A48009A1223F138D21DE2 +:10FE10000AF0F6FA0646029830806878754BC007FB +:10FE2000C00F707230460622A91C0A305C3B98470E +:10FE3000288970806889B080A889F080A87B30729A +:10FE40002878307430460AF0F4FA204605B0F0BD48 +:10FE5000FFE7FF24F9E70346644A00208100515878 +:10FE6000002903D040318988994203D0401CC0B298 +:10FE70000328F3D3032800D1FF20704701465E48D2 +:10FE8000032906D28A0059498958002901D04031F6 +:10FE90008888704701460020FF2908D08A0053490E +:10FEA0008958002903D0403188798006C00F7047F7 +:10FEB00070B54E4D84004F4B285906225C3B4730AD +:10FEC0009847285901214030417370BD02460020F7 +:10FED000FF2A0AD0022908D29300444AD258002AA5 +:10FEE00003D0C800401A47301018704701468A00F6 +:10FEF0003E4900208958002901D04031887D704753 +:10FF0000024600209200394B002909D001290CD06B +:10FF1000022904D1985840308079C006C00F70473C +:10FF20009858403080794007F8E7985840308079F9 +:10FF30000007F3E701460020032908D28A002B4975 +:10FF40008958002903D0403188798007800F704795 +:10FF500001460020FF2906D08A002449895800293B +:10FF600001D02031887F7047F0B5032827D21F4F7A +:10FF70008300FC58002C22D04034A579FB26354064 +:10FF8000CE07760F3543A571FC58EF263540120198 +:10FF9000154340340020A5710A0701D5032008E06D +:10FFA0004A0701D5022004E0C90701D1290700D57D +:10FFB0000120AA08F9589200024340318A7146E7AD +:10FFC00010B51924E401401EA0420AD2491EA142E4 +:10FFD00007D20A480A3B834203D2FF20F430824210 +:10FFE00001D9002010BD012010BD0000C0910020EB +:10FFF000F2070000750F0000FFFF0000770C000003 +:020000041801E1 +:10000000F7B582B016460546FFF725FF04020090BB +:10001000E01D0AF05CFA3F2823D000988700C24810 +:10002000C0598189FF2900D1C189E21D0423BF483D +:100030000AF0E6F9058086700AF0FBF9BA48C05963 +:100040008289FF2A08D00398002800D09030C3B2DC +:1000500001210098FFF70EFE324629460098FEF770 +:1000600001FE05B0F0BDF8B516460D46FFF7F3FEEC +:1000700007460402E01D0AF02AFA3F2812D0B80011 +:10008000A949009008580068002806D00278032A81 +:1000900003D1002D07D09035EDB22A460021384615 +:1000A000FFF7F9FDF8BD0C380189A048E21D0623D1 +:1000B000001D0AF0A5F9044630782071B0886080F0 +:1000C0007088208020460AF0B4F920790628E4D808 +:1000D00095490098FD2208584030417D11404175F6 +:1000E000DBE7F7B50C46FFF7B6FE06460502E81D4E +:1000F0000AF0EDF93F283DD08B4AB700D159086886 +:10010000002832D00378042B2FD1002C0DD090344E +:1001100040318879E4B2800627D5A12C21D01CDC9F +:10012000912C1ED09C2C20D11BE00C380189E120A1 +:10013000EA1D0823C0000AF063F9054602987C4BCB +:1001400001787948C0594030417508222846029903 +:10015000984728460AF06DF907E0A92C01D0AA2C8F +:1001600003D1487DFD2210404875224600213046CB +:10017000FFF791FDFEBDF8B50C460546FFF76BFE97 +:1001800006460702F81D0AF0A2F93F280DD066497D +:10019000B0000858FA1DC18964480423401E0AF0C3 +:1001A0002FF9058084700AF044F9F8BDFFB581B0DD +:1001B0000F46FFF750FE05460602F01D0AF087F9CC +:1001C0003F281FD03C469034574A3946112F0BD058 +:1001D00006DC00291DD0012906D00C2F2AD103E00E +:1001E000192901D01A2F25D1A90050584030837900 +:1001F0009B061FD5437DFD242340437550588068DE +:100200000AF017F92DE7E2B202212846FFF743FD75 +:1002100027E7A8001058F21DC189444806230E3074 +:100220000AF0EEF803990180049941800A998180CF +:100230000AF0FFF8002FE6D10024E4E7FFB581B013 +:1002400015460E46FFF707FE04460702F81D0AF0A2 +:100250003EF93F2818D03548FA1DF91D0E230B3002 +:100260000AF0CEF83049A2008958022340314A7D75 +:100270001A434A7509210170858046800499C1801E +:100280000A9901810AF0D5F8EBE6FFB581B01C466A +:100290001546FFF7E0FD06460702F81D0AF017F9BC +:1002A0003F2811D02049B0000858FA1DC1891F48C5 +:1002B000082329300AF0A4F80A998180C4800580B7 +:1002C000029941800AF0B5F8CBE6FFB581B00D4642 +:1002D000FFF7C1FD04460702F81D0AF0F8F83F28B1 +:1002E00021D0114E002D0ED1A0003058FA1DC18929 +:1002F0007320022300010AF083F8049941700399E6 +:1003000001700AF096F8A0003058806800280AD0E2 +:100310000078172807D1002D00D09035EAB20221CD +:100320002046FFF7B8FC9CE6C091002003070000C0 +:10033000190F0000F8B51E460546F84B1746800019 +:1003400018580024069A012903D11A214030144676 +:100350000170012208212846FFF774FC2846FFF7A8 +:100360008DFDC0B223463246394605F070FF0028A5 +:1003700005D09030C2B201212846FFF78CFCF8BDB1 +:1003800070B516460C460546FFF778FDC0B2002C46 +:1003900008D0314605F0B0FF012208212846FFF7BA +:1003A00051FC70BD002105F0A7FF962201212846CF +:1003B000FFF771FCD94AA8001058002140300170A5 +:1003C00070BDF3B581B001980F468100D348212359 +:1003D00046580198F18902023569D148D21D0AF0C8 +:1003E0000FF80446077002213B0009F0D7FD08050D +:1003F0003737371437100C37A87CC006C00E607032 +:10040000403631702AE00198FFF7A2FD16E0132074 +:100410004036307022E0687C012802D1287E012815 +:100420000BD04036B079012280060028E87D0BDB36 +:10043000022805D0042803D00FE0002060700DE0F2 +:10044000287C02280ED108E000280BD0012809D012 +:10045000042802D1287C022804D06170204609F0CB +:10046000E8FFFEBD6270F9E7F7B50F46064681006A +:10047000AA4832024558AA48E9891E23801CD21D89 +:1004800009F0BEFF04460770B81EA64F030009F02E +:1004900085FD0608042E1E231C2E02980078A070ED +:1004A0000DE028694030C17BA170427CD207D20F99 +:1004B000E270407CC207D20F3046FFF755FD403551 +:1004C000A879BF210840A87111E01C2200E0172282 +:1004D000A01C0299B8470AE01022A01C0299B84754 +:1004E0001022284624300299B8470020A8632046ED +:1004F00009F09FFFFEBDF8B5884A81005558884F26 +:100500002E462036F17F04028907E137002903DAFD +:10051000E11D38460AF047F8AA8F0A204243E11D40 +:10052000384609F0EDFFF07F02210843F077F8BD6F +:1005300070B50546794B800019583F22525C002463 +:1005400092071CD58A8F784CA24214D05204120C08 +:100550008A87A2420DD38C8718582A02C189704815 +:100560001E23801CD21D09F04BFF0821017009F0E9 +:1005700060FF032400E001242846FFF7BCFF20466B +:1005800070BDF0B50446654BA2009A58012012696F +:10059000137DD57E2B409E46537D157F2B409C4678 +:1005A000937CA500DE075D4B5B591B69DF7E1D7DDB +:1005B0003D401F7F5B7D3B401D43002E05D0537E99 +:1005C000DB0702D0002D00D10020544BA4001B59A2 +:1005D000ED071B6940335C7C002D07D001252C43BF +:1005E0005C74012905D0022903D007E06408640087 +:1005F000F6E74032527CD20700D10020032901D017 +:10060000042906D17146490703D46146490700D43D +:100610000020F0BD7FB50646404980000C58684672 +:10062000007A1D4600281BD002AA03213046FFF79E +:100630001BFF002D02D03046FFF75DFF0022012195 +:100640003046FFF728FB20690025002802D009F07A +:1006500071FE2561304601F0E9F8403425707FBD18 +:10066000002202213046FFF7FFFEE7E770B52B4B73 +:1006700082009A581469403215782E46143E330091 +:1006800009F08CFC060C04090609090C162000E090 +:100690001820107070BD1423137001E0142DF9D1CF +:1006A0004034237CDD0705D015201070207C4008E5 +:1006B000400006E09D0706D517201070207CFD2124 +:1006C00007E0207470BD5B0705D519201070207CF1 +:1006D000FB210840F5E7002904D000231A46FFF764 +:1006E00099FF70BD002100F0B7F870BD30B40B4B1E +:1006F00082009C5885005B5922691B6940330029A0 +:1007000008D0157DD27E154014221D74403422700D +:1007100030BCABE7557D127FF5E70000C0910020AB +:1007200013070000190F0000B80B0000F8B50E46C3 +:10073000FE4A8100545805022034E17FFC4FC9076E +:10074000002907D0E91D384609F02DFFE07F400859 +:100750004000E0773046083809F06BFE30780B280F +:100760000AD0052808D0E91DF24A384609F0C8FE2B +:10077000E07F01210843E077F8BDF3B50646EB4979 +:1007800080000D5881B02C6940352878102807D09A +:10079000112803D0122801D013280FD1102028705F +:1007A0004034207CC1070AD0C0B240084000207409 +:1007B00007213046FFF705FE11202870FEBD810796 +:1007C0002CD5FD2108402074DB48112287690821BF +:1007D000304601F094FA0090002F04D01022D74B3D +:1007E0003946401C984730460099FFF79FFF082282 +:1007F0000921304601F083FA0746CF48CE49203020 +:1008000000791E31C007C00F78700622CB4BB81C90 +:10081000984739463046FFF789FF0AE041070CD573 +:10082000FB21084020741320287006213046FFF772 +:10083000C8FD28781028B4D0FEBD0298002804D046 +:1008400001463046FFF752FFFEBD002301461A461F +:100850003046FFF7DFFEFEBD30B4B44B82009C583B +:1008600085005B5922691B694033002908D0557DFA +:10087000127F154010221D744034227030BC7CE77A +:10088000157DD27EF5E710B58100A84AA74B5158D7 +:1008900080001858096900694A7C00244030012A08 +:1008A00002D10A7E012A07D08A7C520706D44A7EEA +:1008B000520703D484730FE002220CE0CB7D0A7C44 +:1008C000032B05D0032A03D0012B03D8012A01D81A +:1008D000002200E00122827308464030827B002A19 +:1008E00006D0012A01D0022A03D10422C27300E0FB +:1008F000C4738A7CD20706D0497EC90703D0C17B66 +:1009000001221143C17310BD00B5884A8000105800 +:100910000029006907D0417F0B0009F03FFB060664 +:10092000060806080C11817DF6E7012000BD403065 +:10093000C07B400702E04030C07B0007C00F00BD15 +:10094000002000BDF7B500981646850077480024C2 +:100950004759224608210098FFF774F9062E0AD05D +:10096000112E0AD0222E0AD0002E0AD0903634063C +:10097000240E06D00BE0222409E0232407E02424DF +:1009800005E03846403081790822114381713E46A6 +:100990004036009930780A020E2830D00F282ED029 +:1009A0001A282BD1002C22D1604F01237859D21D57 +:1009B000C1895F48DA3809F023FD009A0021032A33 +:1009C00012D27A59002A0FD040329279530700D5BB +:1009D00001219207920F022A02D0032A04D101E0DA +:1009E000042200E00C221143017009F022FD0020D6 +:1009F0003070224601210098FFF74DF9FEBD002C12 +:100A000006D00023224601990098FFF703FEFEBDA1 +:100A10000F2823D13869817CC9071FD0407EC007C9 +:100A20001CD042481E234059D21DC1894048DE389F +:100A300009F0E6FC0446072020701C223F4BA01C56 +:100A40003969984720463D4B0822002114305C3319 +:100A5000984700206082204609F0EBFC01980028AE +:100A600004D001210098FFF7F7FEFEBD0021009899 +:100A7000FFF73CFEFEBDF0B505462C4A800010583D +:100A800085B02E4F046903AE002918D008222146F4 +:100A900001A82E31B847082221461E313046B847FA +:100AA000FF20000285430320000228180090244BF9 +:100AB000012201A92046FCF799FB05B0F0BD0822F0 +:100AC000214601A81E31B847082221462E31E5E70C +:100AD000F7B505468100154816464058174F8AB0AD +:100AE00010220021046902A85C37B84710220021B7 +:100AF00006A8B8470B98114F002844D0012128467A +:100B0000FFF7E4F980796946087200212846FFF76B +:100B1000DDF980796946487200212846FFF7D6F949 +:100B20000146062206A8B84701210BE0C09100202B +:100B3000F30700003075000098910020190F0000A5 +:100B4000DF0B01182846FFF7C1F90146062207A866 +:100B50000230B847012269468A7202A80330062291 +:100B600021461031B84702206946487404A8023073 +:100B7000062221461731B847FF2000028543002E88 +:100B800019D0012018E000212846FFF79FF980794D +:100B90006946087201212846FFF798F9807969466D +:100BA000487201212846FFF791F90146062206A85E +:100BB000B8470021B9E7022000020543FE4801952D +:100BC0000090002E02D021461E3101E021462E3138 +:100BD00006AB02AA2046FCF776FC0DB0F0BDF7B5D7 +:100BE0000346D7B2F548B900405886B0002833D044 +:100BF0004168002930D009780A292DD104464034B3 +:100C0000A1798D06ED0F002B03D09033DAB20023CB +:100C10005CE00669100A0006000E1FD001282CD0E7 +:100C2000022844D0032817D13846FFF791F904462B +:100C30000246E34B01A8079998471020021B01A820 +:100C4000DF4B001900215C339847002D55D001AAD5 +:100C500001213846FFF794FB09B0F0BD1022304661 +:100C6000D74B1E3007999847A0794006F4D401224B +:100C700029463846FFF72CFFEEE74806ECD40798E4 +:100C8000009011220321384601F039F8064610225F +:100C9000CB4B401C0099984731463846FFF746FD3C +:100CA000002D02D008202070D6E70720FBE7304651 +:100CB000C34B10223E308A330799984700280AD048 +:100CC0000421384600F0C5FD012364222946384638 +:100CD000FFF7A0FCC0E7A0794006BDD40E2020702D +:100CE000002D05D031461E31384600F0BFFDB3E778 +:100CF00000213846FFF7BFFEAEE70020034601465D +:100D0000009001AA3846FFF715FBA5E7F8B50D4698 +:100D10000746AA4980000E584620805D00248006C0 +:100D20004FD5687804280FD8E878410707D04007E6 +:100D3000400F012803D0042801D0052804D1A87849 +:100D4000002803D0012801D00A243AE02879C01FE6 +:100D50000A2801D3062434E03846FFF7E9FB0028CF +:100D600002D003282DD12BE03069002829D19548E5 +:100D700000790107890F0ED0E97809070DD44007E3 +:100D80000BD463206946087003246A46214638461E +:100D9000FFF76AFB15E0052413E03902CA1D08239A +:100DA0008948C91D09F02CFB06460A20307006222E +:100DB000691C834B701C9847304609F03AFB00E0F1 +:100DC00009242046F8BDF3B581B00F4601987B4950 +:100DD00080000E5878780024042859D8F878410704 +:100DE00007D04007400F012803D0042801D0052870 +:100DF0004ED1B878002801D0012849D13879C01FD8 +:100E00000A2847D235464035A879800650D428783C +:100E100001284DD1781C00F0E5FC002838D030695D +:100E20000622791C664B173098473069417E0907C6 +:100E300006D5807C000703D5A87940210843A87116 +:100E4000A879400603D45F480079400726D5019869 +:100E500000F0DBFC00281DD03069817D0198FFF790 +:100E600090FB002818D00198FFF70DFD0021019894 +:100E7000FFF74AFD002811D0052028703069403066 +:100E8000817B00290CD004210198FFF79AFA0FE02A +:100E90000A240DE006240BE0082409E0032407E0FF +:100EA000417C0422114341740021019800F0F1FCBF +:100EB0002046FEBDF8B50746404A80001458206918 +:100EC000002819D025464035AA793D4B9206D60F09 +:100ED00010223E30491C9847287807280CD1002E54 +:100EE0000CD00520287020694030407C400703D595 +:100EF0000021384600F0CDFC0020F8BD21693846BD +:100F00001E3100F0B3FC08202870F5E770B50646E6 +:100F10002A4A800014582069002815D04034A2794C +:100F2000274B9206D50F10222E30491C9847207867 +:100F3000082809D106202070A079400604D4002298 +:100F400029463046FFF7C4FD002070BD08B54A7839 +:100F5000511E0E2900D3082270210A4369460A70E7 +:100F600016498300C9580B69002B07D04031897995 +:100F700000238906C90FFFF74DFB03E06A460321F2 +:100F8000FFF772FA002008BD70B504460B4A8000D6 +:100F900012581346403318781D4615280AD1106997 +:100FA0001022074B491C9847A8798006C10F20469C +:100FB000FFF75CFB002070BDDF0B0118C091002023 +:100FC000190F0000B891002012070000F0B5054687 +:100FD000FF4A8000145887B02646403630781628DD +:100FE0001ED188784A78000210436A46108204A80D +:100FF0000822F84F0230C91CB84710226846216900 +:10100000B8472846FEF7A4FF6A469076072128468F +:10101000FFF72AFAB0798006C10F2846FFF726FBB2 +:10102000002007B0F0BD70B50446E94A80001258B0 +:101030001346403318781D4617280AD1106910222C +:10104000E44B491C9847A8798006C10F2046FFF75A +:101050000DFB0020AFE7F0B50D460646DC498000E9 +:101060000C5887B0274640373878182817D1062201 +:10107000D84BA91C04A89847687869468875D54B51 +:1010800010226846216998476A4605213046FFF7D5 +:10109000EBF9B8798006C10F3046FFF7E7FA002078 +:1010A000BFE770B50546CA4A80001458403420781E +:1010B00019280AD14A1C06212846FFF7D5F9A0793C +:1010C0008006C10F2846FFF7D1FA002073E7F8B574 +:1010D00006468700BE480D46C05900904878002457 +:1010E000410709D04007400F012805D0042803D04C +:1010F000052801D00A242DE03046FEF7CBFE00285B +:1011000028D13046FFF714FA002823D16878000769 +:101110000DD4B1480079400709D4632069460870AE +:1011200003246A4621463046FFF79EF912E00098F4 +:10113000006900280ED1A6483202C0590123C18996 +:10114000A648D21D09F05CF96978C906C90E01707C +:1011500009F06FF92046F8BDF3B581B00F4601984C +:101160009B4980000E583F20805D0025410701D536 +:10117000452549E0800701D5692545E0384600F05E +:1011800031FB002803D0F878C01F0A2801D36A2554 +:101190003AE0B878010790480029007901DA0007A1 +:1011A00000E04007002801DB63252DE001215220EB +:1011B00009F066F8874B5222002104465C33306107 +:1011C000984707222046834B394610309847A07C29 +:1011D000C00701D12075607507220121019800F038 +:1011E0008EFD0146207C4870607C8870A07CC870B1 +:1011F000E07C0871207D4871607D88710198FFF75F +:1012000095FA0120403630702846FEBDF7B5944669 +:101210000A4600986E4980000C580025002C35D0F5 +:1012200026464036B0798006C70F206900281DD0B9 +:101230004030417C4B0729D4042319434174206971 +:10124000002A0DD0634B102261469847002F02D030 +:10125000307805281AD10021009800F01AFB15E01B +:101260004030807B012811D1012500E0082530782D +:1012700000280BD02946009800F0EBFA2A4660209F +:101280000243012339460098FFF7C4F92846FEBD02 +:10129000F3B581B00C4601984D49800008580026EE +:1012A000002838D040300178112934D18079800667 +:1012B000C00F00900198FEF74BFE002102E0215480 +:1012C000401CC0B21028FAD311220621019800F068 +:1012D00016FD054610223F4F2146401CB8472946BF +:1012E0000198FFF723FA0B220721019800F007FD70 +:1012F0000546401C218A0170090A417021460822D6 +:101300001231E81CB84729460198FFF70FFA0099F7 +:101310000198FFF732FA3046FEBDF3B506462C4978 +:1013200080000C58002581B0002C22D0204640308F +:10133000017813291DD1807910228006C70F20461D +:10134000244B1430029998470020606311220A212F +:10135000304600F0D4FC044610221E4B401C02997B +:10136000984721463046FFF7E1F939463046FFF706 +:1013700004FA2846FEBDF3B583B0039814498000F3 +:1013800008580025009000286AD006464036B079FB +:101390008006C00F01900098046901982746173411 +:1013A000103700285CD03078022859D104980028E2 +:1013B00027D00146074B0722204698470648017967 +:1013C000090703D4A178F7221140A170A17807E0A2 +:1013D000C0910020190F0000B89100201B070000E9 +:1013E000090706D5B978090703D5B1794022114319 +:1013F000B171B1794A0606D40079400703D40325B8 +:101400001FE0082520E004984078002806D178786D +:10141000012803D1480601D4022512E0039800F008 +:10142000F4F9002807D0049881790398FFF7A9F808 +:10143000002802D017E0062503E0B079400612D458 +:101440000825307800280BD02946039800F001FACF +:101450002A4660200243012301990398FFF7DAF836 +:10146000284605B0F0BD0398FFF70DFA0121039857 +:10147000FFF74AFA0028C2D0A07841072DD04007D4 +:10148000400F042829D020793979084020716079EB +:1014900079790840607107220221039800F02FFC3F +:1014A00001462078487060788870A078C870E0782D +:1014B000087120794871607988710398FFF736F9CF +:1014C00007203070009800694030817B002907D0E8 +:1014D00004210398FEF775FFC2E700202071D9E7C9 +:1014E000417C042211434174BAE770B50E46EE4BBD +:1014F00081005C580025002C12D0214640318B79A8 +:101500009B060DD5002A07D01A230B700121FEF788 +:1015100037FF2034A67703E000221146FEF730FFA4 +:10152000284648E570B50D460646002A1ED12879A2 +:10153000DE49800040188038C26F291D3046904730 +:10154000040013D00146304600F083F928790128C1 +:101550000CD00B280AD03046FEF79CFC01466020D8 +:101560002246024301233046FFF754F823E570B5C5 +:101570000646CD4980000C5800252069002802D07D +:1015800008F0D8FE2561304600F050F9403425704F +:1015900011E5FEB5140A16460D460A461F460121FE +:1015A0002046FCF75BFD019001282AD1A000BE492E +:1015B000029008584621095C2A788906C90F0A2A30 +:1015C00004D00B2A26D00C2A7CD150E0002919D057 +:1015D000BE421DD126460446012152206D1C08F052 +:1015E0004FFE5222B24B002120619847B04B206938 +:1015F00006225C3B29461030984700213046FEF712 +:10160000E0FE5FE0691C2046FFF7A6FD024653E0BE +:10161000422253E02A461435002918D0BE42F7D1A1 +:101620002146941CC0890A0201460A23A148D21D02 +:1016300008F0E6FE0646208A30809D4B0822B01C4A +:1016400029465C3B9847304608F0F3FE3AE0518A61 +:10165000961C009120462B4632460121FEF76AFE79 +:1016600091490298B27E0858203082772AE00029FA +:10167000CED020306E78C07F0025410701D54525AA +:1016800019E0800701D5692515E08B4831070079FD +:10169000002901DA000700E04007002801DB63258C +:1016A00009E002220B21204600F029FB014646708A +:1016B0002046FFF73BF82A46002A03D001212046A6 +:1016C000FEF7E9FA0198FEBD70B5054616460C46D0 +:1016D000084608F0FCFE3F281DD0240A002E1AD030 +:1016E0007148A10040584068002814D000780A28AA +:1016F00011D12E2D10D008210D46204600F0A9F85A +:101700002046FEF7C7FB60212A460A430146012313 +:101710002046FEF77FFF4EE40B21EDE770B505464E +:101720001446104608F0D3FE3F281FD0240A5E4915 +:10173000A00008585F49DC318D4210D14621095C78 +:101740002030C27F0423520852001A43C277890610 +:10175000C90F002345222046FEF75CFF06E0C821A2 +:1017600081872030C17FFD221140C177002022E413 +:1017700070B516460D46FEF76EFBFF281ED04A498F +:10178000820089584968002902D009780A2916D0B0 +:1017900001024848CA1D1E23401FC91D08F030FE23 +:1017A00004460B2020702046414B082214306582ED +:1017B00031465C3B9847204608F03BFE4AE4012155 +:1017C000FFF759F946E470B50D46FEF744FB0446B1 +:1017D000FF2806D0FEF75EFB01462A462046FFF7AB +:1017E000B1F837E401460A780120042A01D9002023 +:1017F00070474A78002A01D0012AF8D10A79102AC4 +:10180000F5D849791029F2D870470146264A89004F +:10181000525800201369D97C9B7E994200D3194607 +:10182000072902D3012020329177704710B51E4A54 +:10183000810054582034E17FC90709D001021D48B6 +:10184000C91DDC3008F0AFFEE07F40084000E077C3 +:1018500010BD70B50C4605460222052100F04FFA76 +:10186000014644702846FEF761FF2FE470B50E462E +:1018700005461122042100F042FA04460C4B1022C6 +:10188000401C31465C3B984721462846FEF74EFFF8 +:101890001CE4FF2212029043090210B501430748DD +:1018A000FBF7D5FC10BD0000C091002014C5011845 +:1018B000750F000017070000B8910020DF0B01181A +:1018C00070B584007B4E0D46012909D130598168DD +:1018D0000830002904D008F032FC08F02BFDF5E7B1 +:1018E0003059AD004059002808D00C380168491C17 +:1018F00001D108F01FFD31590020485170BD70B56D +:1019000004460021302008F0BBFC30226A4B05461B +:10191000002198471720A885A000664924020D5091 +:10192000601D002108F0A8FD0825601D08F0CFFD0E +:1019300001462943601D08F09FFD70BDF8B51C46A7 +:101940001546074600290BD1A08801F08BF8060048 +:1019500006D06570A288234603213846B047F8BDFB +:101960000A2D06D16088010403D500254004400CEF +:10197000608020460C3801893A02052004230002C9 +:10198000521D08F03DFD457021780170618841804D +:1019900008F04FFDF8BD70B50D460446454980007E +:1019A0000858A9004358002B03D029462046FFF7CA +:1019B000C5FF29462046FFF783FF0120A840C5B296 +:1019C0002402601D08F083FDA8430146601D08F055 +:1019D00053FD70BDF8B50646850036480F464059A0 +:1019E000002829D00024002F05D046222146304669 +:1019F000FFF7D1FF03E021463046FFF761FF641C8B +:101A0000E4B2022CEFD3304601F044F9294C60597E +:101A1000016A2030002904D008F091FB08F08AFC0C +:101A2000F5E7304601F044F9304601F06BF86059B3 +:101A300008F080FC0020605134021520611D8001F7 +:101A400008F0B1FD611D1D4808F0ADFD601D1021BD +:101A500008F012FDF8BD174980000858808D7047C6 +:101A600070B5012217235202914200D31146172963 +:101A700000D219460F4D84002A590423918510493C +:101A8000020209590D48C9893F38521D08F0B8FCB7 +:101A90002959898D018029594968002902D00A787D +:101AA000012A04D00021418008F0C3FC70BD4988A0 +:101AB000F9E70000E8910020750F000041050000E3 +:101AC000C091002070B50124094D84402888002968 +:101AD0000BD0204205D16888002802D0062008F0EB +:101AE0009FFD28882043288070BDA043FBE70000AD +:101AF000F491002010B5044600020021001D08F0FA +:101B0000BBFC0021242008F0BBFB002807D00021EB +:101B10000160416081600173017404214174994A3C +:101B2000A100505010BDF8B50646C8B2B400174623 +:101B3000052814D0072811D1084608F0C8FC3F2812 +:101B40000CD0914800594068002807D000780C2834 +:101B500004D1002201213046FEF79DF8F8BD084669 +:101B600008F0B5FC1028F9D0884D285900680028E5 +:101B700007D00078122804D13A4600213046FFF7FA +:101B80000AFF295900204968002900D008780D284B +:101B900001D00E28E2D13A4601213046FFF7FBFE84 +:101BA000F8BDF3B507468600764881B08459002C0D +:101BB00027D0A068002801D008F0BCFB7449207B26 +:101BC0004A88101848800BE0A9887248814204D1E5 +:101BD000298946223846FFF7A6FF284608F0AAFBC7 +:101BE0002068002807D0204608F0A9FA0546029888 +:101BF0000028F2D1E8E7634CA05908F09BFB0020D5 +:101C0000A05138023F21001D08F036FCFEBDF3B59F +:101C100085B005985B4980000E58002E5FD034686F +:101C2000002C04D00698002801D0012000E00020FC +:101C3000039049E0002069468880012708F0E3F915 +:101C400005468088544943185249A0884942C842F1 +:101C500025D121460C31081D0290E089002800D0D2 +:101C600000E0002701AA0097891C029800F09CF967 +:101C70000090002803D10298008800280FD1218904 +:101C8000009A0598FFF74FFF304608F058FA2046B3 +:101C900008F050FB00200390009800280DD1694601 +:101CA000898838030843E8800598FEF7E7F8C0B252 +:101CB000294607F078FF002813D0A88808F0B8F963 +:101CC0000698002802D003980028B3D13068002875 +:101CD00013D00021012041400598FFF7F3FE07B023 +:101CE000F0BD2B494888401E4880307B401C307333 +:101CF0000698401EC0B20690E3E70121EAE770B5FE +:101D00000D46114608318BB201021446CA1D214806 +:101D1000091D08F075FB0621C1808480057208301A +:101D200070BD70B50D46114609318BB201021446E3 +:101D30004A1D1848091D08F063FB0421C1808480F6 +:101D40000572083070BDF8B5069D1E4614460F4654 +:101D5000042A13D0062C13D004212A460A3200028A +:101D600093B2021D01430B48401C08F049FB077069 +:101D700000214180C48085800672F8BD0521ECE712 +:101D80000721EAE7F8910020C0910020E8910020A7 +:101D9000F49100200604000000800020F8B50F46F2 +:101DA000540021461E460E318BB2010215460A1D13 +:101DB0007A48091DA41C08F023FB0521C180211DC0 +:101DC000818001210172477244818581002D00D0FC +:101DD000C68108F02EFBF8BD70B50D460102144611 +:101DE000CA1D0E236D48091D08F00AFB0521C1809C +:101DF0000621818013210172457202214181848173 +:101E000008F017FB70BD70B50D4601021446CA1DDF +:101E100014236248091D08F0F3FA0521C1800C2142 +:101E200081801221017245720821418121888181BE +:101E30006188C181A1880182E188418208F0F9FAB4 +:101E400070BD10B50A790024012A0AD0122A0CD0DC +:101E5000132A0FD0002349791A46FFF79FFF204627 +:101E600010BD091D00F00AF802E0091D00F02BF872 +:101E70000446F4E7091D00F062F8F9E770B58B88B5 +:101E800000244C220546002B04D0012B04D0022B49 +:101E900005D103E03C2202E0312200E03322404839 +:101EA000AE00805900230068002800D00378092B79 +:101EB00007D140784978814203D100212846FDF7B7 +:101EC000EAFE204670BD70B50C4605460026FDF7BB +:101ED000E1FF012825D063892289A188E088FEF7E7 +:101EE0006FF8002824D02902CA1D0E232D48C91DD1 +:101EF00008F086FA0921017061784170A18841805B +:101F0000E18881802189C1806189018108F091FA8D +:101F10002348A9004058FD224030417D11404175C1 +:101F20000BE0002361781A462846FFF737FF04E0EC +:101F3000617801222846FFF74FFF304670BD70B52B +:101F40000C4605460026FDF7A5FF002809D01448D9 +:101F5000A90040588268002A1ED01078092807D0AE +:101F60001AE0002361781A462846FFF717FF13E0AE +:101F70006078517888420FD1A088002801D048228B +:101F800000E0002202212846FDF785FE05482902CF +:101F9000E430C91D08F007FB304670BD06040000A0 +:101FA000C09100200E070000FFB583B00D46044627 +:101FB00000210C980193271D8E4B0091002814D00E +:101FC00026887C207C2E00D9064628883246C119F6 +:101FD00001989847059806802888801928802088CD +:101FE000801B2080009807B0F0BD6188207904290B +:101FF0000AD18149C140C90706D1012129807870E1 +:102000002088401E20807F1C7C482188808B88424D +:1020100002D231200090E6E7764B04222146019857 +:102020009847019826887821001D782E00D90E4601 +:10203000704B3246394698470599301D0880CBE7EA +:10204000FEB51D46002301936D4B800014461B58BE +:102050000A9A081D099E0090022A21D108790122BE +:1020600022804A88042A08D1634AC240D00704D19A +:10207000022020800888401C0880587C1946401F98 +:10208000C7B222880098173110185A4B3A46984721 +:10209000781C2988C0B2081A28802088C01920809E +:1020A000002E12D02888B0420DD321880098514BC1 +:1020B0000818324608999847208880192080288877 +:1020C000801B288001E0342001900198FEBDF8B506 +:1020D00006464B4980000C580025A068002806D011 +:1020E000342101730C3008F0A4F9A56011E0207CC4 +:1020F000617C88420DD204280BD3A28A101F0228CB +:1021000007D80095A37D34213046FFF71CFE08F068 +:1021100090F9257404206074F8BDF7B582B00020F2 +:1021200001900F4602983649800016460C5821E06F +:10213000904214D2121A8A4200D2114622468DB21F +:10214000123280182B4B2A4639689847207C401958 +:1021500020743088401B3080386840193860207CFB +:10216000042807D1608A0C210C2800D30846617C22 +:1021700040186074207C627C904202D23188002931 +:10218000D6D1C0B2D1B2884230D1A68A658AA77DA5 +:10219000301F02281FD81948808BA84206D3042E6E +:1021A00006D10298FFF757FCA84201D2312006E081 +:1021B000002D03D0019800281AD001E034200190AE +:1021C000002000903B46324601990298FFF7BBFD84 +:1021D0000C38A060E581A068002807D0019900298B +:1021E00004D00C3008F025F90020A06005B0F0BD47 +:1021F0002846E6E7190F000022AA0A43989100201A +:10220000F89100203EB50546B8A107C96B4607C343 +:102210001024B94B0C22694628469847002806D15D +:10222000A87B002802D1E87B002802D004242046A5 +:102230003EBD0224FBE7FEB50E460546ABA207CA2B +:102240006B4607C3AC4C0C22694628468A3CA04723 +:102250000422284631460C30A047FEBDF8B51E4684 +:1022600015460C46B14202D10A46294612E00746FD +:10227000102C03D1FFF7C6FF04460C37102E04D1F3 +:102280002846FFF7BFFF06460C35B44206D122466A +:1022900029463846984B9847002801D00020F8BDC1 +:1022A0000120F8BD70B515460446102903D1FFF78B +:1022B000A9FF01460C34022907D160782178000279 +:1022C0000843A84201D1012070BD002070BD10B5A7 +:1022D000491EC9B200F018F910BDF7B50E46002529 +:1022E00014462946009800F05FFA020069D0108970 +:1022F0000099824F884206D110463946083027603F +:1023000000F0BAFA55E0081A062148438018C1893E +:102310000A308C464904890F20D101880523DB024D +:10232000CB1A032B03D929231B02994216D1744BD4 +:10233000994220D100995289491C8A4219D32760B9 +:102340000289801D120A3A7022685170090A917040 +:102350002168C91C00F0AAFAC01C2AE06146C90B1A +:102360002DD061460905090D0818011D216040881E +:102370001FE0802526E062461205120D1018604A03 +:10238000521E914217D18088002100F00DFA0028DA +:10239000EFD0276001893970090A79702168428974 +:1023A0008A70120ACA7021680830091D00F064FAA8 +:1023B000001D308006E0001D20600220F9E70625A0 +:1023C00000E001252846FEBDFFB50F4681B0154649 +:1023D00006460124002100F0E7F9002830D00189E9 +:1023E0000624B1422CD0711A062251430818C28922 +:1023F0000A305104890F0FD101880523DB02CB1A63 +:10240000032B1DD929231B02994219D09B1C9942E9 +:1024100016D05B1C994213D0D10B11D01105090DB8 +:102420000C1820887E19864209D8334B60198A3BE4 +:102430003A46001D049998476680002400E00D2468 +:10244000204605B0F0BDF8B50E46154607460124F6 +:10245000002100F0A9F900281FD00189B9421CD041 +:10246000791A062251430B18D8890A334004800F89 +:1024700009D118880521C902411A03290DD929213A +:102480000902884209D05E80E9041E48998801D576 +:10249000014300E08143998000242046F8BDF8B54F +:1024A0000E46154607460124002100F07DF900285C +:1024B0001AD00189B94217D0791A062251430B1854 +:1024C000D8890A334004800F09D118880521C90230 +:1024D000411A032908D929210902884204D05888C1 +:1024E000B0432843588000242046F8BDFB349B5F4E +:1024F0008000008000100000A30F0000D491002095 +:10250000032800000010000070B50446F94A238833 +:1025100000201268002B0AD10CE054899C4205D39C +:1025200012895918914200D3012070BD1268002A07 +:10253000F3D170BD012307E016895D18B54205D3BC +:10254000538912685B1C9BB2002AF5D1238070BDB1 +:10255000F8B50546CE88888868807004800F1446D8 +:10256000022806D00F4601282AD00222022A29D0AA +:102570000EE00F683846FFF745FE0246102807D0E8 +:102580000320400386430C37042AEFD1D0020643D0 +:10259000A41AD94B394620469847601B2880F00B77 +:1025A00035D03005000D411D49084900641A2080CE +:1025B00000206080601B310B09030843A88027E0DE +:1025C0000422D3E77878397800020843CB49288081 +:1025D000884201D10020F1E7C849FF31884202D08A +:1025E000491C884203D1F004C00F801CE6E7C349B0 +:1025F000491E884203D0292109028842CFD10220F6 +:10260000A41F208060800021A180601BD6E7AE80DF +:102610002046F8BDFFB583B0002000901020019047 +:10262000507A15464006800F0F46029003D00228CC +:1026300009D001280CD00226022E02D030461030DC +:102640000190002421E02868FFF7DCFD0646F3E74F +:102650000426F1E7002F07D0601CC108795C400711 +:10266000400FC140C8070ED06868E100401800F074 +:10267000B0F900283AD00199081880B2019000986A +:10268000401CC0B20090641CE4B2287AA042E1D899 +:1026900000990398FFF738FF002828D100210198FE +:1026A00007F0EEFD044601986A7A2018019002981E +:1026B00002281ED029460698606003980088208171 +:1026C000009BC0186081002022736073022E1BD013 +:1026D0000198894B801B3246019098470198001B56 +:1026E0000838E0810020064600902EE0402007B028 +:1026F000F0BD2968102EDED09F2002400C31042E40 +:10270000D9D120200243D6E748780978000208434F +:10271000E7E7002F07D0701CC108795C4007400F25 +:10272000C140C8070FD06868F10041180098062220 +:10273000504300191030019AFFF70AFF01900098EA +:10274000401CC0B20090761CF6B2287AB042E0D8A5 +:10275000684A0021106805E023890589AB4203D34C +:10276000014600680028F7D12060002901D00C60E4 +:1027700000E014600020BAE770B55E4E3468002CAB +:102780000ED0207BC00705D0002365681A460421BF +:102790001846A8472046256807F0CCFD2C00F0D14C +:1027A00000203060706070BD30B5524C024609CCDC +:1027B000083C002B13D01D89954210D858899042AF +:1027C00001D3184630BD186809E0038993420AD83E +:1027D0004389934202D3437BDB0707D0006800287C +:1027E000F3D1002030BD0029F5D1FAE7606030BD9B +:1027F00010B5404B1A6813E0548984420FD3507BC4 +:10280000C407E40F8C4203D04008400008435073D3 +:102810005868904201D100205860002010BD126815 +:10282000002A02D014898442E6D9012010BD30B5B7 +:1028300083885C04A40F0BD104880525ED02651B79 +:10284000032D03D929252D02AC4201D1062030BD2C +:10285000DC0B04D01B051B0D1818008801E01805BF +:10286000000D824201D3072030BD5118814201D9A9 +:102870000D2030BD002030BD10B50B46014600795B +:102880004006820FC88808D04118012A0AD018468D +:10289000194B10229847102010BD1870000A58706C +:1028A000022010BD1846FFF7C6FCF4E710B50B4632 +:1028B000014680884004820F088808D04118012A08 +:1028C0000AD018460C4B10229847102010BD1870E3 +:1028D000000A5870022010BD1846FFF7ACFCF4E760 +:1028E0001389834213D1107BC00909D00348801E8D +:1028F00008E00000CC910020190F00000328000020 +:102900000520C0020870000A487002207047C01AF3 +:102910000623584380180A30C8E7F0B50E46002554 +:102920009C46144607462946FFF73EFF01004DD05E +:102930000889B8423FD0381A0622504340180A305E +:102940006246002A00D01060828853049B0F09D190 +:1029500003880527FF02DF1B032F2CD929273F02FD +:10296000BB4228D04088002C23D00346E340DB073D +:102970001ED0097BCB0601D508251AE08B0701D4B0 +:10298000D20400D50C250907890F092C09D00C2C7D +:102990000AD00D2C0AD00007800F814209D90846C1 +:1029A00007E08007800FF8E70006F5E78006F3E709 +:1029B000062530800BE0002C03D0092C04D006251E +:1029C00005E001204002F4E70020F2E70125284657 +:1029D000F0BD70B505460188C08806244004800F0C +:1029E0001CD0012802D0022802D02CE0042009E0EB +:1029F0002868FFF707FC29684A7B0B7B1102194303 +:102A000002280BD0841DE888C10B05D00005000DFD +:102A1000401D400840000419204670BD1048814206 +:102A2000FAD0C01E81420ED0401C81420BD00C480F +:102A3000FF30814202D0401C814206D1A988052086 +:102A400040028843E8D00024E6E70548401E814262 +:102A500003D0292000028142D5D10C24DCE70000FC +:102A60000328000010B50021FFF79EFE406810BD4E +:102A7000F8B514460D4607460A4600266946204624 +:102A8000FFF74BFF040006D00C2C02D0062C1CD004 +:102A900036E00024012668460088002830D03846F9 +:102AA000FDF748FA002822D00E2D22D00121384609 +:102AB000FDF726FA002812D0002E1AD03846FDF76E +:102AC00047FA102815D20C241AE00C2D18D00D2D21 +:102AD00016D0092D01D0032412E0022410E00221B7 +:102AE0003846FDF70DFA002801D00F2408E0052430 +:102AF00006E03846FDF71EFA694609888842F6D393 +:102B00002046F8BD70B5FF4D84002859806A002822 +:102B100005D00C3807F00EFC29590020886270BDE2 +:102B2000FFB581B0174601980D46F64A810050580E +:102B30001E46806A002817D04388AB4211D14478E2 +:102B4000062C02D0002C05D000E080240198FFF76D +:102B5000D9FF0FE0808838805058806A801D30602F +:102B600013E00198FFF7CEFF324639462846FFF7BB +:102B7000B4FB0446062C08D12846FFF773FF06462F +:102B800000232A4619460198B047204605B0F0BDFB +:102B9000FFB585B0088816460C46002704902088AB +:102BA0000121FFF701FE050015D021882889814207 +:102BB00000D2208020883188884214D82A4669466D +:102BC000FFF78EFE03466A4608990E98FFF746FB0C +:102BD00000280AD104E030882080002F1AD004E0B9 +:102BE0002088401C2080002F0ED02288002309213D +:102BF0000598FFF73DFF07462088294600F0A3FE11 +:102C00003080002F0AD010E0318880B2884201D88D +:102C10000028C4D104980A27208006E02188109B50 +:102C20000F9A0598FFF77CFF0746384609B0F0BDBC +:102C3000F8B507460020009008780C46122827D0E7 +:102C40001D26E5883846FEF706FFC01E854200D2E5 +:102C5000284685B2281D82B231463846FFF761F812 +:102C60000646A088214670800831A74B2A46301DB1 +:102C700098473046083807F0DCFB2078122805D04A +:102C80003902A24AA248491D07F03AFC0098F8BD53 +:102C90001B26D6E770B59B4D84002859016910307A +:102CA000002904D007F04BFA07F044FBF5E770BDAC +:102CB00070B5944D8400285981691830002904D0DA +:102CC00007F03DFA07F036FBF5E770BD70B5154625 +:102CD0000E461C4605220121FFF723F84670458069 +:102CE0000471083807F0A5FB70BD10B5002A05D0A7 +:102CF00013460A461221FFF7E9FF10BD01221321F6 +:102D0000FFF70FF8083807F094FB10BDF3B5814FBB +:102D100081B00E46BD8B042203210198FFF701F814 +:102D2000BA8B718804468A4200D211460198FEF798 +:102D300097FE20466580083807F07BFB0020FEBD2B +:102D4000F3B585B0002002900F460598FEF783FE8C +:102D5000801E86B2049605987C88B988800000257C +:102D600003908C4201D8002C01D101201FE00121E9 +:102D70002046FFF719FD0090002817D000898442F3 +:102D800000D20446B888A04226D30121182007F0BB +:102D900077FA0190848001992046C91D009AFFF7B7 +:102DA0009FFD0199002D887103D003E00A20029055 +:102DB0001AE00546A84203D0019807F0BBFA13E0D9 +:102DC0005049039808580199183007F09BF9701B77 +:102DD000801E641C86B2A4B2B888A04204D3002C22 +:102DE00002D0A81C8642C2D2464C03982058806963 +:102DF000002812D004980027801B801C82B2052175 +:102E00000598FEF78EFF0646022D0AD0022070704C +:102E100003983D4D2058846913E00298002817D08C +:102E200018E00120F3E7F019A1884180BF1CBFB270 +:102E3000F019E11DA279801CA847A0792468C01967 +:102E400087B2002CEFD13046083807F0F2FA07E0DD +:102E50000A20029003467A8839780598FFF736FFF2 +:102E6000002007B0F0BDF3B58BB00C46488869462A +:102E70008881204640380990C68F0B9880000790C3 +:102E8000002E0AD10B98FEF7E6FD401E86B2608840 +:102E9000A18888421ED800281CD0A01D0A90801C42 +:102EA000059009986946808F04AA083887B2A088DF +:102EB00008830A9808A96D4607C5022306AA03A934 +:102EC0000B98FFF765FE050006D00A2D50D0062DA1 +:102ED0004ED03FE001254BE0E0880521C902884241 +:102EE00002D0491C884209D16846008CF9B2C3B2AD +:102EF000049A0598FFF7B2F9002815D16846008CAE +:102F0000B84209E0E8910020190F00003075000078 +:102F100041050000989100201CD1FD4B3A460499D0 +:102F200005989847002815D10121082007F0A8F935 +:102F300001466846808988806846008BC880F54ACB +:102F40000798361F1058B6B2183007F0DBF80B9808 +:102F5000FFF7D8FD6946088B401C8881A0888989C5 +:102F6000884205D36946098B884201D0042E98D245 +:102F70000998062DC68734D0E64E07983058183089 +:102F800007F0B6F8002822D08000801C82B200240E +:102F900007210B98FEF7C5FE014607983058806957 +:102FA0000CE0630082885B185A80641CA2B2540053 +:102FB0006418C3886380521C006894B20028F0D162 +:102FC0000846083807F035FA062D0DD006E06846A9 +:102FD000828921782B460B98FFF778FE00200DB0F0 +:102FE000F0BD6846808960800120F8E7F3B58DB0B8 +:102FF000002006900D4648886946088228464038D9 +:103000000A90C48F0027002C0CD10D98FEF723FDE9 +:10301000801E84B26888A988884201D8002801D11E +:10302000012006900D98BB498000079008588069E0 +:10303000002800D087790698002856D1A81D0B904B +:103040000A98A988808F6A4691840B9908AB03AAD5 +:103050006E460EC6801FC3B209AA04A90D98FFF7D9 +:1030600097FD0690002840D1684681898F4201D0A3 +:10307000002F3AD1A01EFD22FD2800D31046814228 +:1030800000D2084686B230460121083007F0F8F831 +:10309000059068468789018A05989D4B818005982F +:1030A0008A3B867105983246C01D08999847A01B37 +:1030B000801E84B29749079808580599183007F080 +:1030C00021F868468089864202D10D98FFF71AFDE3 +:1030D0006A46908C411C89B21182AA888A4204D324 +:1030E000824202D0B81C8442AAD20A98C4870698A9 +:1030F00006283FD0874C07982058183006F0F8FF74 +:1031000000282DD00799002661588C69A179891C67 +:103110004143891C8AB209210D98FEF702FE05463B +:10312000A079801C687011E0A819A1888170090A33 +:10313000C170B61C764BB6B2A819E11D8A3BA279C4 +:10314000801C9847A0792468801986B2002CEBD1A6 +:103150002846083807F06DF9069806280DD006E0D5 +:103160006846028A2978069B0D98FFF7AFFD00207C +:103170000FB0F0BD6846008A68800120F8E7F3B51B +:103180008BB0002002900D46488869468881284609 +:1031900040380890C48F00200490002C0CD10B986C +:1031A000FEF759FC801E84B26888A988884201D83D +:1031B000002801D1012002900B9856498000079009 +:1031C00008588069002801D080790490029800286E +:1031D0005BD1A81D0A900898A988808F6A46118340 +:1031E0000A9909AB05AA6E460EC6801FC3B206AA8D +:1031F00003A90B98FFF7CCFC0290002845D1694643 +:10320000898A0498884201D000283ED1201FFB22E1 +:10321000FB2800D31046814200D2084686B23046D1 +:1032200001210C3007F02CF807466846808A04908C +:1032300068468089B8806846008BF8803846344BF1 +:103240003E72093032468A3B09999847A01B001FFD +:1032500084B23049079808583946183006F052FFB2 +:103260006846808A864202D10B98FFF74BFC6A467B +:10327000108B411C89B29181AA888A4205D382426F +:1032800003D00498001D8442A5D20898C4870298F0 +:1032900006284AD01F4C07982058183006F028FFFF +:1032A000002839D00799002661588C69217A091DB8 +:1032B0004143891C8AB211210B98FEF732FD054665 +:1032C000207A001D687019E0A819A1888170090A88 +:1032D000C170B61CB2B2A818E1888170090AC17029 +:1032E000921C96B20A4B2146A81909318A3B227AD0 +:1032F000801C9847207A2468801986B2002CE3D17C +:103300002846083807F095F80298062810D00AE0F9 +:10331000A30F0000E8910020684682892978029B6B +:103320000B98FFF7D3FC002059E668468089688037 +:10333000012054E67CB50C464A8805460023092145 +:10334000FFF796FB030007D1618801AB6A46284668 +:10335000FFF7E6FB030007D0062B2ED0628821780A +:103360002846FFF7B3FC26E0684604882846FEF7A7 +:1033700072FB401E844200D2204684B2601C82B29E +:103380000B212846FEF7CDFC0646FF4B2246401C8B +:10339000019998473046083807F04BF8684600888E +:1033A000844208D12846FEF756FB401EA04202D0B8 +:1033B0002846FFF7A7FB00207CBD01207CBDFEB5A1 +:1033C0000D464A88064600230921FFF751FB0400F9 +:1033D00007D1698801AB6A463046FFF7A1FB0400BC +:1033E0000AD0062C3BD06A88297823463046FFF75E +:1033F0006DFC062C33D030E06946A88809888842E5 +:1034000001D90724EFE70C1A3046FEF724FB401ED3 +:10341000844200D2204684B2601C82B20D21304624 +:10342000FEF77FFC0746A8880199D74B4118224632 +:10343000781C98473846083806F0FBFFA88869468C +:1034400009880019884208D13046FEF704FB401E67 +:10345000A04202D03046FFF755FB0020FEBD012000 +:10346000FEBDF3B587B00898C84940380390808FF7 +:103470000025C0034018000C05900798C44980003F +:1034800002900858183006F033FE06460398C48FA1 +:10349000002C39D10798FEF7DEFA401E84B233E0E3 +:1034A000089871000F187A88002309210798FFF700 +:1034B000DFFA05002FD179886B4604AA0798FFF739 +:1034C0002FFB050020D16846008AA04200D3204689 +:1034D00087B238460121083006F0D2FE019087807D +:1034E0000198A94B3A46801D00999847A84902982F +:1034F00008580199183006F005FE0798FFF702FBFF +:10350000E01B761C84B2B6B20598B04203D9002CF9 +:1035100001D0002DC4D00398002DC48722D1079874 +:10352000FEF799FA001B82B200270F210798FEF7D9 +:10353000F8FB009096490298085884690AE00098C0 +:10354000A11DC019904BA288401C9847A0882468F0 +:10355000C01987B2002CF2D10098083806F069FF34 +:10356000002D0BD0062D0CD0089871000818428849 +:1035700008982B4601780798FFF7A8FB002009B0B0 +:10358000F0BD0120FBE7F0B506460A78002085B0C3 +:10359000122A10D0522A11D10C464039888F0027A8 +:1035A000001F85B2628802AB0A213046FFF760FA3D +:1035B000002805D01FE0304600F02DFA05B0F0BD20 +:1035C000002229460298FFF732F9002813D1522031 +:1035D00003906788241D3846FFF744FA84466946FD +:1035E000039808804D8001946B463A46012130468D +:1035F0006446A04701273846E0E7F3B5084685B0A2 +:10360000403800900025C68F0C462F46002E07D16B +:10361000628800230B210598FFF72AFA050037D1AD +:103620000598638800218000594A049010589C46F0 +:103630008646006905E0C28A9A4201D1012100E074 +:103640000068002802D00029F5D003E0002901D14C +:10365000002E26D00098808F801F80B20290704686 +:10366000203006F06CFD039060883105090D019152 +:103670000090A388029A0399059800F093F9050039 +:103680001CD04349049808580399203006F050FD97 +:10369000628821782B460598FFF718FB384607B05B +:1036A000F0BD6046FFF7DEF906460023628802217E +:1036B0000598B0470127002DEAD1EFE702981721BE +:1036C000801D82B20598FEF72CFB05466088688055 +:1036D000A11D2D4BA81D029A9847A088A8802846B6 +:1036E000083806F0A6FE0227D8E7F3B587B0089899 +:1036F000002140380290C08F0491009108994978C8 +:1037000001297DD107998900039100285AD12048C9 +:1037100040580469002C55D0002006460546059007 +:103720002746E08A00211437FFF73EF800280DD025 +:1037300001897A88914209D0511A0622514308180A +:10374000228961890A30FFF772F800E001200090B9 +:1037500001200190009800280DD1788805998842B1 +:1037600004D00590E68800202546A0802089B0423C +:1037700013D90720009008987A880178009B079851 +:10378000FFF7A4FA079805E0190F00000000FFFFFB +:10379000E8910020FFF77EFA11E0B04206D2A54280 +:1037A00004D0E68060892546A08005E06189401844 +:1037B00086B2A8884018A8802468002CB0D102994D +:1037C0000198C887AE4E039830580469002C40D049 +:1037D000E08A0490A0880690254614350498FFF7E7 +:1037E00041F90746A08869464881208969460881D1 +:1037F00060894880A81D019016200880002000E004 +:1038000027E005902668002E0ED0069800280BD0E1 +:10381000F18A354604981435814205D1012005907E +:10382000FF201730694608806B460121049A0798EB +:10383000B847934903980858103006F080FC20469A +:1038400006F078FD059834460028CED1012004907A +:103850000DE00798FFF71EFA0098002807D1012213 +:1038600019210798FEF75DFA083806F0E2FD049882 +:1038700085E6F8B507468500814E1BE0207D214690 +:10388000C0061431000F401E00067E4A800D1258FB +:1038900038469047002804D001280FD002280BD1C9 +:1038A00008E03846FFF704FA7059203006F047FC6C +:1038B00006F040FD7059046A002CDFD1F8BDF8B560 +:1038C00006460A7A0402FF2580006D4B1E2A02D0AC +:1038D000D70715D033E01858002100680D4600289E +:1038E00000D00178132901D0142928D1611D664820 +:1038F00006F059FE002211463046FEF74CF81EE055 +:10390000002A1CD0D706FF0E182F18D8142A16D05C +:103910001A58126A002A14D000270022CA801858A8 +:103920000C39203006F0EEFB0125601D06F0CFFDBE +:10393000000704D4002F02D03046FFF79AFF284634 +:10394000F8BD0127E9E7F0B50C89844201D1488927 +:10395000F0BD021B06235A435218D3890A325B0476 +:103960009B0FF5D11388494EB342F1D1401C00257D +:1039700083B2771E488910E05189921D4904890F4E +:1039800004D11188B14205D0B94203D05B1C9BB26F +:10399000002D02D05B1E98B2F0BD9842FCD39C4231 +:1039A000EAD3F0BDF8B58600002535480095855965 +:1039B00014462D69069A2746002D09D0AD880127A7 +:1039C0002D197F02BD4202D911200090F8BDAFB27F +:1039D0004C810B81079B2A48CB8080590D46046996 +:1039E00010300AE0E18A914206D92A46214606F0C3 +:1039F00002FC002C03D008E02468002CF2D12048FF +:103A000029468059103006F07DFB1D488059006919 +:103A100087800098F8BDFEB5074608464038808F7D +:103A20000C46001F85B24A8800266B460B2138469B +:103A3000FFF71EF8030006D1002229460098FEF782 +:103A4000F6FE030006D0628821783846FFF73EF97B +:103A50003046FEBD122002906688241D3046FFF7D6 +:103A600001F884466946029808804D8001946B46AF +:103A70003246012138466446A0470126E8E70000A7 +:103A8000E891002040C5011841050000032800000E +:103A900010B501221E21FEF744F9083806F0C9FCD2 +:103AA00010BD10B50C4601021520F74A8001491DD2 +:103AB00006F026FD2046083806F0BBFC10BDFEB51A +:103AC00001468000F14B02901A589468002C64D093 +:103AD00050680190E2890092921D0C3893B20089DF +:103AE0000A02264601460C360027E948521D06F018 +:103AF00087FC009A05468280019881882980019878 +:103B0000C1886980307A092819D137460837727A16 +:103B1000A81D391DDF4B921E98477878811E8FB201 +:103B20002168002903D06988081A801C6880304603 +:103B300024680C3806F0FEFB26460C3622E00836D8 +:103B40000196403EB08F401E86B2009887420AD24E +:103B5000C01B3246864200D30246E8190199CD4B7C +:103B6000801D491C9847B81987B22068002802D0E8 +:103B70006888801B68802468019826460C361438B3 +:103B800006F0D8FB002CDAD1C04902980858002171 +:103B90008160C160284606F04CFCFEBD10B50446AD +:103BA000BD484988828B8A4200D211462046FDF7E3 +:103BB00057FFB648A10040584068002802D000785E +:103BC000012801D0412200E0002201212046FDF71A +:103BD000E2FE002010BDF3B583B00398AB4A80002D +:103BE000019010584068002802D00178072901D0C0 +:103BF00040223AE0009004984078012809D010272C +:103C0000049800254038808F2E46801E80B2029096 +:103C100024E00227F4E79D4901983B1D08584068BD +:103C20000C380189039802029948521D801E06F043 +:103C3000E7FB04460498974B401946882680A770F6 +:103C4000AD1C0498ADB24119E01C3A46891C984756 +:103C5000E81985B2204606F0ECFB02988542DAD3DB +:103C60000098C088B04205D8002201210398FDF7D2 +:103C700092FE0FE00098761C868000980121408813 +:103C8000C903084300994880804901980858406852 +:103C900006F0CFFB002005B0F0BDF3B583B003986C +:103CA0007A498000009008584468002C02D020789F +:103CB000032801D040223AE0049878494038808FA8 +:103CC0000026C0034018000C3746019029E06F49D8 +:103CD0000098637808589B1D40680C380189039848 +:103CE00002026B48521D401F06F08AFB0546710018 +:103CF0000498761C0818B1B24A00408828800498BD +:103D0000491C101847886F808EB260782871214650 +:103D10000831604B6278681D9847284606F089FB99 +:103D200001988642D3D3E088B84205D80022012109 +:103D30000398FDF730FE0CE07F1CA780608801210E +:103D4000C90308436080514900980858406806F04C +:103D500070FB00209FE7F3B589B000250846019568 +:103D600040380595808F0C46801E80B204900999DA +:103D7000464E8F00F15928464968002900D008783E +:103D8000099A1202039204286ED0052805D006284D +:103D900003D00A2872D04022D6E00091607807282C +:103DA00001D9102000E0022002900520079048E091 +:103DB0006019C1788278080210430690019000983B +:103DC000007805280CD00098009A437807980832AC +:103DD00028180019801C0299FEF740FA00282DD0FF +:103DE0002A48039AC059029B4068521D0C38018929 +:103DF00027489B1DC01E06F003FB06460698308030 +:103E0000AD1CA8B221188978401C317180B22118EC +:103E1000CA788B7811021943801C718085B2029890 +:103E200070716119B01D1B4B891C029A984702984A +:103E3000281885B2304606F0FCFA02E06078401996 +:103E400085B204988542B3D30098C1880198814215 +:103E500079D90099401C8880009801214088C903C5 +:103E600008430099488077E00020064602900498B5 +:103E70000691400703D01020009040E073E001203D +:103E800002900220F8E7000030750000E891002061 +:103E900009050000190F0000989100200000FFFFA5 +:103EA000F748039AC059009B4068521D0C3801899D +:103EB000F448083306F0A4FA0646601941883180B8 +:103EC000AD1CA9B260184288891C89B26018728042 +:103ED0004288B280891C02988DB2002816D00098C2 +:103EE000B0716119F01DE84B891C009A9847009841 +:103EF000281885B230880190304606F09AFA049866 +:103F00008542CDD30298002807D017E0DC4831461F +:103F1000C0590C39083006F0F5F8002E0ED00422F6 +:103F20000A210998FDF7FDFE01467088488009982E +:103F3000FFF7B7FD00200BB0F0BD04E00698C18884 +:103F40000198814205D8002201210998FDF723FD3F +:103F500007E00699401C8880C948C059406806F0AF +:103F600068FA0598E7E70998FDF775FD6378801E04 +:103F700098421BDDF059039A4068521D0C380189A4 +:103F8000C0481B1D001D06F03BFA054660882880CE +:103F90006078211D801E82B2AA8000206880BA4B02 +:103FA000A81D9847284606F044FACCE7F0596288E5 +:103FB00040682146828062780839921EC2800022C1 +:103FC00002816078801E4880F0590C39083006F074 +:103FD00099F801200590F059C0E7F3B5084640383C +:103FE000808F85B0801E80B204904C780F462146A9 +:103FF00005F0AAFF0599A24A8900039151584D681E +:10400000002D69D02978022966D1002864D00026C5 +:104010000196142C01D0022000E010200090002016 +:10402000029032E096490398009B08589B1D406817 +:104030000C380189059802029248521D401E06F074 +:10404000DFF90446B8194088B61C2080B1B2781850 +:104050004288628001920098891C20718EB2B91941 +:10406000601D894B891C009A984700992A46701850 +:1040700086B26B780832601DFEF7F0F8002801D098 +:1040800001200290204606F0D4F904988642029856 +:1040900006D200280AD17D4901988842C2D101E0A8 +:1040A000002803D1E9880198814205D80022012126 +:1040B0000598FDF770FC0CE0401CA8806888012181 +:1040C000C903084368806E4903980858406806F0A1 +:1040D000B0F9002007B02FE74122E8E7F3B581B03F +:1040E000002000900198664A860090590F46456866 +:1040F0000021002D00D02978042907D008291FD0DD +:1041000009291DD00A291BD041223AE0083006F0C7 +:1041100016F804460C341022791C5B4B1330984778 +:104120001020A071204606F084F92088E988814299 +:1041300001D8002225E0401CA880514880593CE06D +:104140003946403FBA8F4E48521E94B20839002279 +:104150004A8080590C39083005F0D4FF288900289E +:1041600002D0844200D30446454FB8598068C189C3 +:10417000091989B2C181012000904002814205D90C +:10418000112201210198FDF706FC19E00198FDF7C5 +:1041900062FC401EA04204DC2889A04205D8002809 +:1041A00003D00198FFF78BFCC3E7E9880919E98080 +:1041B000002801D0001B2881B859406806F039F961 +:1041C0000098FEBDF3B585B005982D4A8000039098 +:1041D00010584068002802D001780B2901D04122F4 +:1041E00047E006994039898F0190491E002589B220 +:1041F0002E460095029132E021490398B2000858FA +:1042000040680C38018901981718F888801D83B21E +:10421000059802021B48521D001D06F0F1F8B988EE +:10422000044601800298F988401B814200D208466A +:1042300082B2A280002060800698134B4119A01D15 +:10424000491C9847A08841198DB2F988884201D04D +:1042500050200090204606F0ECF8761CF6B201984B +:104260004078B042C8D80298854201D050200090D2 +:10427000009A01210598FDF78EFB00202AE7000037 +:10428000E891002005050000190F0000FFFF000065 +:1042900010B56149820089584968002902D009781F +:1042A0000C2901D0412200E000220121FDF773FB1F +:1042B000002010BDF8B5584F0B468600B9594C6820 +:1042C000002C02D021780C2905D041220121FDF7D4 +:1042D00062FB0020F8BD18464038808FE188801FBF +:1042E00085B298882A46401A80B221460C316081F6 +:1042F0004118981D494B9847002804D160892189AD +:104300004019884201D90020C0436081B8594068F3 +:1043100006F08FF8DDE710B53F498300C958002249 +:104320004968002900D00A780C2A03D00F2A0BD044 +:10433000412204E04A8909898A4205D0522201219A +:10434000FDF729FB002010BD0022F8E770B50D46EF +:104350004039898F324A091F8EB281005158B21DEF +:1043600093B202022878C989521D1B2816D02D4805 +:1043700006F046F8044628781B2812D01320207037 +:1043800066806888A080254B291DA01D32468A3B87 +:104390009847204606F04DF8002070BD2148401E89 +:1043A000E6E71220EBE770B5044608790D461228BF +:1043B00009D11B49A00008582202C1891948521D81 +:1043C000163006F047F82A7901212046FDF7E3FA76 +:1043D000002070BD70B506460A7A0D46FF20002405 +:1043E000D10707D0002A05D01D2A03D851080E4B4B +:1043F00089005C58002C0DD01D2A07D01B2A05D03F +:10440000310215208001491D06F0CDF829460831FA +:104410003046A04770BD0000E8910020A30F0000C7 +:10442000C09100200D05000070C50118F3B50024EF +:10443000224FCE0781B0F60F1C206043C519A87B20 +:1044400009280BD129461431019806F04EF90028AD +:1044500004D0A87EC007C00F864204D0641CE4B21A +:10446000042CE9D303E0042C01D20120FEBD00207E +:10447000FEBD1C214843114910B54018002181732D +:10448000F9F773FC10BD70B50C49054600241C20DB +:1044900060434018807B002805D0641CE4B2042CE3 +:1044A000F5D3072070BD1C2060434018082200216E +:1044B000034B143098472C70002070BD04920020EC +:1044C000750F0000032283079B0F02D083079B0F09 +:1044D00000E01346244843708B079B0F01D08A07E6 +:1044E000920F0270704702461B3AE02A0AD8FF2258 +:1044F0004932904206D31D4A904203D81A4A403AA4 +:104500009087D187704770B50146174D0C24002065 +:10451000803D1C2242435219937B072B03D116691D +:104520003678F6070FD1052B03D112695278D207DE +:1045300009D1401CC0B20428EBD30B4806220C4B17 +:104540000A3898470024204670BD70B505460146DC +:1045500005480622064C0A38A04703480622294689 +:104560001038A04770BD00008492002090420000E7 +:10457000190F000010B50346E94C00201C214143EF +:1045800009198A7B521E022A03D8096909789942BF +:1045900004D0401CC0B20428F0D3FF2010BDF3B5F6 +:1045A00081B04227FFF7E6FF0446042820D21C20F2 +:1045B000DB4960434618356900270622D94B284657 +:1045C000143002999847B07B022811D1EFF310867E +:1045D00072B6287BC00709D070204443D248FF340C +:1045E00006225934CF4B20180299984786F3108839 +:1045F0003846FEBDF8B504460C260078FFF7BAFF32 +:104600006946C74D0870FF2806D01C214843401951 +:10461000807B01282DD104E00846FFF734FF060017 +:1046200027D1684600781C214843401900690028BA +:1046300001D005F07FFE684600781C2148434119EF +:10464000FF200C610876217B002903D0012908D0C6 +:10465000022906D1B249062270312046B14B1430EE +:104660009847684600781C22504301214019817305 +:1046700000263046F8BDFEB5054642200090287859 +:10468000FFF778FF0746FF2850D0072000901C2036 +:10469000A349784340180190A9780026490044189E +:1046A000607D143400280DD005F009FD06464088D1 +:1046B000E9784018402805D9607805F005FD00200C +:1046C000607033E06878032801D001280CD160784D +:1046D000002801D005F0F8FC05F0D9FC6070002836 +:1046E00024D005F0ECFC0646308872888E4B80188A +:1046F00080B2C0188B4BEA78696898477088E9786F +:10470000401870806878032801D002280CD10198E5 +:10471000807B02280CD02078002801D005F0D4FC42 +:104720006078207000206070002000900098FEBD2E +:104730006278A978384603F00CFEF1E7F8B5054633 +:1047400012260078FFF716FF0746FF2808D01C2026 +:104750003946414372480C18617D002955D101E06A +:10476000422652E0E17D00294FD16978002944D0EA +:10477000064620694188CA0717D00907890F07D064 +:10478000417B0E30FFF752FE002801D00B263CE0A3 +:1047900000201C2141438919897B002903D0401C3A +:1047A000C0B20428F5D304280BD0A07B02280AD07D +:1047B0002A7969883846266903F022FC002808D047 +:1047C00022E0072621E02A796988384603F0F7FBC2 +:1047D0001AE00220A073B078514DC00714D068468B +:1047E000FFF751FE00280FD16846007820761C2282 +:1047F000042150434019817306E0384603F07CFDE4 +:10480000002801D10320A07300263046F8BD10B562 +:10481000FFF7B0FEFF2808D01C21414A4143891808 +:10482000897B012903D00C2010BD422010BD00F06F +:104830005BF8002010BDF8B50C4609781C225143E6 +:10484000374AE0788E18211D37690091B17B357E9B +:10485000032918D000281BD02846009900F0A8FB97 +:1048600028461C2148432E4940180021C180009948 +:104870000989490081800521018141810121C1739C +:104880008581B17317E000212848FAF704FD04E0A0 +:1048900060783C2801D0432801D10120B073B8785A +:1048A000C00705D01C211E4A00206943891888735F +:1048B00060783C2809D1E078002801D0002100E090 +:1048C0003C212846009AFAF71FFDE078002802D123 +:1048D0006078002804D0617838782A46FAF769FEB3 +:1048E000FF2030760020F8BDF8B500240C491C22CA +:1048F0005043274645182E19307D002802D005F078 +:10490000E3FB3775641CE4B2042CF4D32869002857 +:1049100002D005F00FFD2F610020A873F8BD000044 +:1049200004920020190F00000080002039200000B0 +:1049300038B505460C2300206946F94C0870097803 +:104940001C2048430019827B062A01D3082A05D976 +:10495000491CC8B2694608700428F0D3684600783C +:10496000042806D21C2148430019807B062818D150 +:1049700004E06846FFF787FD030012D1684600781F +:104980001C21484300190069002801D005F0D2FC21 +:10499000684600781C21484300190621056181738F +:1049A0000023184638BD70B503460C25DC4A0020AC +:1049B0001C2141438918897B062901D3082903D981 +:1049C000401CC0B20428F3D31978002904D001296F +:1049D00017D01225284670BD0428FBD21C2148435D +:1049E0008418A07B0728F5D103F07DFF050006D0D1 +:1049F0000620A0730021032005F0D5FDEAE708207A +:104A000023E00428E6D21C2141438C18A27B082A0B +:104A1000E0D0217E5E78490800254900002E00D0B4 +:104A2000012631432176FD2631405E78022E0ED0DC +:104A300000267600314321765988A1829988E18247 +:104A4000072A06D003F0DAFD0720A073C2E701268B +:104A5000EFE720690078800702D5B14A763200E09E +:104A600000229988588803F04DFFB3E710B5AC4A8F +:104A700000201C2141438918897B072904D0401C50 +:104A8000C0B20428F5D303E0042801D203F0B6FD38 +:104A9000002010BDF0B5487E8FB0401CC0B2099018 +:104AA0000C46087D1C2148439D4906224018076991 +:104AB0009C4D002105A8A847062200216846A8476A +:104AC0000025E07D2E460290FF282BD0954B062234 +:104AD000211D05A85C3B9847607D40072FD5607875 +:104AE000002810D03878C507E07BED0F8009012839 +:104AF00001D1022005438A498A4B0622703168465B +:104B00005C3B98470EE02146864B06220A316846F8 +:104B10005C3B9847257E002D04D0E07B800903286C +:104B200000D0FE25607D400709D5684640798009A0 +:104B3000012804D1FE2D02D1787802287ED3207D71 +:104B40001C21484376494018007EC10777D0099957 +:104B5000012905D08006800F06D0022803D101E08C +:104B60000007F8E701267DE0A27CFF210020002A53 +:104B700003D0208A010B0005000D05AA0B920A370D +:104B8000029A03970C92627D079108920290608CC2 +:104B9000049000200D90054620370A9036E00E2044 +:104BA00003996843461831460B9805F09EFD00288E +:104BB0002BD0F17A0C98814227D1B17A08988142A2 +:104BC00023D1317B079881421FD107990020FF290B +:104BD00009D00E21039A69438918CA8802998A422A +:104BE00001D0F18001200499062909D30E214D43FB +:104BF000039969180A8904998A4201D0318130E009 +:104C000000282ED101200A902BE06D1C787EA8424E +:104C1000C5DC0D98002824D1387E0E214843039925 +:104C2000404B4518062228465C3B0B99984708984C +:104C3000A8720C98E8720798287301E039E035E013 +:104C40000298E88004982881387E401CC0B23876EB +:104C5000042801D100203876787E042801D2401C37 +:104C600078760A9EA07D012801D0002004E0002E65 +:104C700001D0022000E001200999227D01290CD0F9 +:104C80001C214A432649CF2351180A7E1A400001AD +:104C900002430A76002E09D00BE01C214A4320492A +:104CA000F32351180A7E1A408000F1E72046FAF7F4 +:104CB000BFFD607F002802D0208C05F093F9002012 +:104CC0000FB0F0BD10B548781C2148431449441872 +:104CD000A07B08280ED0E08A002810D00521090208 +:104CE0004843A18A0A225143421A0021032005F0B9 +:104CF00007FC08E000210C48FAF7CDFA01E0FAF7CA +:104D000020FE0620A073A07B062802D0207E80070C +:104D100004D5206900214030C1708170002010BD91 +:104D200004920020750F000042200000F0B500261C +:104D300089B0054668460C240670704B2022314627 +:104D400001A8984768460670684600781C216C4A9E +:104D500041438918897B052905D0401CC0B26946AA +:104D600008700428F0D36846007804285DD3687A78 +:104D700005F072FC06466846FFF785FB040054D137 +:104D80002EE0142060434119CA89C88A520090421B +:104D900000D3104682B20220022A00D802460B8AB3 +:104DA000088B5F00B84200D3384683B2934200D8E4 +:104DB00013469C46630101A818184760C98901AFD2 +:104DC0004900F9506346C360002182608174C17458 +:104DD000694609780182F8F7CEFF002802D1641CE9 +:104DE000B442CEDBB44201DA3B241EE068460178CF +:104DF0001C204143424801AB08180521056181731D +:104E000000200BE04101C9184A69D203140C142296 +:104E1000424352195483098B9183401CB042F1DB09 +:104E20006846007803F08FFE0446204609B0F0BDC6 +:104E300070B50024324D0C261C2060434019807B45 +:104E4000052804D0641CE4B2042CF5D30BE0042C38 +:104E500009D204F035F81C2044436419206905F098 +:104E600069FA00202061304670BDF8B50E781C222A +:104E7000234B487872430090D418A27BC878052A47 +:104E80003AD1091D27690D46002F27D0002822D0CE +:104E9000304600F08DF8698CE180298914224900A0 +:104EA000A180009902235143CA19D18A20460229C0 +:104EB00000D819460181128B8A4200D911464181DE +:104EC00086810421C173F8F71EFF2A46002130466F +:104ED000FAF71AFA08E00020A07308E00021094858 +:104EE000FAF7D9F90020A0732069002804D02069BE +:104EF00005F020FA002020610020F8BD750F0000A9 +:104F0000049200200E20000010B50C460102491C3E +:104F10000346002C11D0FF200230002A14D0FA4A98 +:104F20009B00D258002A0BD040239B5CDB439B079D +:104F300006D0F64A05F0E4FA10BDFF200130ECE798 +:104F400092890A235A43F5E705F02DFB10BDF8B509 +:104F500006468700EC48C559002D28D02C6A03E08E +:104F60002046246805F0E6F9002CF9D10124A000C0 +:104F70002858002802D00C3805F0DCF9641E64B211 +:104F8000002CF4DA002211463046FFF7BDFF002264 +:104F900001213046FFF7B8FF3002FF21401C05F029 +:104FA0006BFA284605F0C6F9D7480021C151F8BD73 +:104FB000F8B5D54C06468700E0590D46002802D0CA +:104FC000FF242046F8BD0021442005F059F9E051A6 +:104FD000002862D0044630020021401C05F04CFA43 +:104FE0004422CB4B00212046984729892181698999 +:104FF0006181A989A18129462046C54F0522143126 +:1050000018305C3FB84720462830EB210170D12191 +:105010004170012181700821C1700021017141712D +:105020008171C1711B23FF21E38149316182238298 +:10503000A182B84926228B8FE386C98F2187515DD3 +:105040000838491CA175E17502216177B1494031E9 +:105050000A7882764978C176E08F4108287849003D +:10506000002818D000200143E1872946304604F08B +:10507000D5FB04461C204643A64806224038361875 +:1050800030461430A91CB8476878B0762878F07696 +:105090000920B07395E70120E5E7072491E770B593 +:1050A000994C8300E358002B1AD040331C78E54319 +:1050B000AD0715D0A508ED43AD0711D0002910D0DC +:1050C000012905D002290BD1A108890011431970CB +:1050D0001978F324214092001143197000F0D0F99F +:1050E00070BDA00880001043187070BDF8B50402B0 +:1050F0000646641C17460D46204605F0E8F9824A2C +:10510000B1005158AA008F500121A9400143C9B2F2 +:10511000204605F0B1F9F8BD30B47B4B84001B5933 +:10512000002B10D08C001B59002B0CD09C78002C2D +:105130000BD0012C0ED0022C14D0032C03D1002A4A +:1051400001D00220987030BC7047002AFBD00122A9 +:105150009A7001E0002A02D0012230BCD4E600227D +:105160009A70FAE7002AEED10320EBE7F8B505467E +:105170000002401C0F46009005F0A9F9064662495E +:10518000A8000C58002239462846FFF7C5FFBD008D +:1051900060590C3805F0CEF800206051FF2E06D083 +:1051A0000120B84031468143009805F065F9F8BD0B +:1051B00070B51C461546544B82009A58002A11D0EF +:1051C0008B00D258002A0DD01278130004F0E6FEAE +:1051D000090A060B101A1F2933380A0022462946ED +:1051E00000F0A2FB70BD2246294601F031F970BDE6 +:1051F00000292246294602D001F01AFF70BD01F0B5 +:1052000042FE70BD2246294601F007FB70BD002911 +:105210002246294602D002F057FC70BD02F086FB00 +:1052200070BD00292246294602D000F0E5FE70BD7F +:1052300000F0C1FE70BD2246294600F087FA70BD1D +:105240002246294602F0E3F970BD70B513461C0AE8 +:105250002D4B0A46A5005B590020FF211578002B35 +:105260000BD04026F65CF643B60706D01968002935 +:1052700007D0072D04D0022070BD072DFCD200E01E +:1052800009782B0004F08AFE0805060A0E12161A89 +:105290001E05F1E7204600F04CFB70BD204601F0F2 +:1052A000ADF970BD204602F0D4F870BD204601F083 +:1052B000B4FB70BD204602F02AFD70BD204601F00F +:1052C00054F870BD204600F091FA70BD100A10B578 +:1052D000D9B20D4A8300D258002A3DD040239B5CAE +:1052E000DB439B0738D01368002B1AD01B788B4206 +:1052F00017D1032902D005292ED10DE00022042167 +:1053000001F0DBFC28E0000088920020409C0000B7 +:10531000750F0000449200200022042102F0D2F90F +:105320001AE05268002A17D012788A4214D1032951 +:1053300004D0052907D008290ED109E000220A214E +:1053400001F0D5FD08E00022072102F019FB03E07F +:105350000022042102F032F9002010BD10B5100A1D +:105360000122222100F09EF9002010BD10B51E4B35 +:1053700084001B59002B10D08C001B59002B0CD023 +:105380009C78002C0AD0012C0CD0022C10D0032CBD +:1053900003D1002A01D10020987010BD002AFCD052 +:1053A0000320F9E7002AF8D002229A70002203E0D5 +:1053B000002AF2D101229A70FFF7A6FD10BD024625 +:1053C000094B92009A5800201268002A03D01278E4 +:1053D0008A4201D123207047032A03D0052A01D035 +:1053E000082AF8D12A2070478892002070B5154607 +:1053F000100A0C46214A81005158002911D0227907 +:10540000032A10D0403109788907890F032905D074 +:1054100000290CD001223D2100F044F9208804F03D +:10542000E1FD002070BD214600F0E1F8F9E7FAF750 +:1054300012FD01022A462046091D05F012F801203E +:1054400070BD70B5150AD8B2032804D02846F9F704 +:10545000DAFA002070BD0949A8000C58002C09D0C8 +:105460002046203004F06BFE04F064FFE08F022140 +:105470008843E087284600F003F8EAE78892002096 +:10548000F8B50746834980000D58E88F800728D477 +:1054900001262A464032804B2C6A32E01078617A2D +:1054A0000007800F4900C9184978C140C807C00FDC +:1054B00025D004F0C7FD2146784B09310090C01873 +:1054C000774B227A9847E88F02210843E887217AB0 +:1054D0003846009A04F04BFB002803D0009804F0F3 +:1054E000C8FDF8BD002EFCD12846203021460546D7 +:1054F00004F02FFE2146284604F01AFEF8BD246869 +:105500000026002CCAD1F8BDF7B50F4600986149B6 +:1055100080000E58002F1ED0002E1CD0387819287D +:1055200019D25D4940000D5C012128460C3004F081 +:10553000A7FE0446029860602046594B2A46394629 +:1055400009309847304625722146203004F0DAFDB4 +:105550000098FFF795FFFEBD70B50C460B4605465B +:1055600002220021FFF724FE2346022201212846C1 +:10557000FFF71EFE002070BD70B50C460B460546B9 +:1055800003220021FFF714FE2346032201212846AF +:10559000FFF70EFE002070BD10B50B460122002162 +:1055A000FFF706FE002010BD38B504280CD2394D97 +:1055B00084002C59002C07D02034247A04252C4058 +:1055C00000D00124002C01D10D2907D911246D46EA +:1055D0002C70AA7069701A46694605E00D216C4668 +:1055E000217062701A466946FFF78EFF38BDF0B52C +:1055F0000C460546274980000E582188274B182263 +:10560000C9188BB0264B01A89847403630786946B8 +:1056100080070979800F192928D21F4B4A00668814 +:105620009F5CBE422CD1D2185278C240D2071FD004 +:105630008800194664390B58E28801A92846984722 +:1056400001000BD03D2916D0282914D068460079D6 +:105650000A46014600232846FFF7A6FF208804F0EB +:10566000C1FC0BB0F0BD022804D0F7E7002807D03A +:105670000128F8D13D210122284600F013F8EDE77A +:1056800007226B461A705970284600226946FFF7B8 +:105690003BFFE3E78892002010C60118008000203D +:1056A000190F000010B50446814B80001B58403391 +:1056B0009878002809D199701146204604F021FA03 +:1056C000032202212046FFF7EAFC10BD70B5054613 +:1056D000774A800010580029046825D16178002994 +:1056E00002D0012920D11AE0032202212846FFF727 +:1056F000D6FC002201212846FFF70EFD217928461D +:1057000000F019F801206070002211462846FFF7CA +:105710002DFE012200212846FFF7FEFC70BD6179B5 +:1057200001222846FFF7BEFF00212846FFF71EFD95 +:1057300070BD0021CAE708B502226B461A70597085 +:10574000C0B25C4A6946FFF7DFFE08BD002901D1FF +:105750001178BBE7704770B50E4604465449800087 +:105760000D58002211462046FFF7D6FC00220121E9 +:105770002046FFF7D1FCE88F7178C007C21720469A +:10578000521CFFF78FFF002070BDF8B5150A48497D +:10579000A8000C58D8B21646162801D04221085548 +:1057A0002346423300221F4611462846FFF700FDDC +:1057B0003B46002201212846FFF7FAFC0322022182 +:1057C0002846FFF76CFCFF21304604F055FE4034BC +:1057D000A27800212846FAF713FC00212846FFF79B +:1057E000B6FB2846FEF745FE0020F8BD70B514460E +:1057F00006462F4A80001058C08F800512D4002919 +:1058000005D00022631D11463046FFF7D1FC01256B +:10581000224600213046FFF769FC00213046FFF7A1 +:1058200055FF00E00225284670BD70B50E462049A0 +:1058300082008C580025002C09D040342178C943BF +:10584000890704D06178C90703D03A2517E00C25F1 +:1058500015E00102491CFF2006230A46073004F028 +:10586000CFFD07210170002141700671132E08D071 +:10587000467104F0DEFD607801210843607028461F +:1058800070BD16214171F4E710B50C460102491CA8 +:10589000FF2006230A46073004F0B2FD07210170FD +:1058A000002141700471447104F0C3FD10BD00007B +:1058B0008892002033570118F8B50F46064681003C +:1058C0005748445825686878002815D0012825D005 +:1058D0001F27E87800280AD0224630323946304661 +:1058E000FAF7C1FB40346078FD2108406070002168 +:1058F0003046FFF73BFCF8BDE08F4007E9D4304667 +:1059000000F07FF8E08F08210843E08701206870ED +:10591000024600213046FFF7FFFBF8BD002211468A +:105920003046FFF7F9FBD4E7002901D11178C3E72E +:10593000704770B500250446FF2909D001250021D4 +:10594000FFF7D4FB00212046FFF7B6FF284670BDC5 +:10595000D0780028FAD03249A0000A584220815C51 +:1059600020463032FAF77FFBF0E770B52C4D82000D +:10597000AC584E7830231E554B8863868988A186A3 +:10598000E38F04210B43E387A9580968002902D05B +:105990000978012909D0190705D400F032F8E08F01 +:1059A00008218843E087002070BD0021FFF784FFB5 +:1059B000F9E770B51A4982008C580025002C09D0EF +:1059C00040342178C943890704D06178890703D519 +:1059D0003A2514E00C2512E00102491CFF200423A3 +:1059E0000A46073004F00CFD0121017000224270CC +:1059F000C17004F01EFD60780221084360702846E3 +:105A000070BD1CB50C216A4611700B2151700549FF +:105A100051800521918000226946FFF775FD1CBD6C +:105A200088920020C509000010B5FF4982008958FE +:105A30004968002906D00978062903D100221121DE +:105A400000F010F810BD10B5F74982008958496878 +:105A5000002906D00978062903D10022122100F07E +:105A600001F810BDF0B51746064685B08000EE4A35 +:105A70000090155804206C6862788A420BD0132974 +:105A800001D03D2701E03D2F04D1012239463046A7 +:105A9000FFF708FEC0E00A390B0004F07FFA0906A0 +:105AA0003F46577389A8BDBC55000021304604F01D +:105AB000B4F8012200213046FFF758FC2746E98F51 +:105AC0002037B87D8906C90F884207D0D74B2422DA +:105AD00003213046FFF768FD12206070B87D002872 +:105AE00012D00021304604F0B3F9012202213046E1 +:105AF000FFF7D5FA0B256946304600220D70FFF7F7 +:105B000003FD657001221BE0022211463046FFF7BB +:105B1000C6FA304600F049FA0D203CE0002130463C +:105B200004F07EF90C206070ECE70222114630464A +:105B3000FFF7B5FA304600F038FA0D206070002209 +:105B400001213046FFF7E8FA05B0F0BD6A46107053 +:105B5000254600A820350822B54F013021462C31BA +:105B6000B847042202A829460130B84700226946F6 +:105B70003046FFF7C9FCA18E221D3046FBF7F8FD29 +:105B80000E2008E0002F08D0A84B06220321304643 +:105B9000FFF70AFD12206070D6E720462146A54B8C +:105BA00001220C3024310096F7F720FB0F20F2E79A +:105BB0002146224630460C311C3204F061F90121A5 +:105BC000304604F045F905216A461170304600223E +:105BD0006946FFF799FC102060700122114630469B +:105BE000FFF79AFAE88F01214902084347E00022B3 +:105BF00001213046FFF790FA0121304604F010F9F8 +:105C00001120607006216B46197030468A4A694639 +:105C1000FFF77AFC98E70627834800994058002848 +:105C200025D040300078C043800720D00121304685 +:105C300003F0F3FF002202213046FFF730FA002F75 +:105C400003D02034A07D002803D039463046FBF72E +:105C5000BAFDE98F20208143002F12D0002040019F +:105C60000143E987002211463046FFF77FFB0121FF +:105C70003046FFF77BFAE88F012149028843E88725 +:105C800062E70120EBE710B567498200895809688F +:105C9000002906D00978062903D10022022100F04C +:105CA00001F810BDF0B51746064687B080005E4A81 +:105CB000009015582C68607888421CD0092901D0C2 +:105CC0003D2712E0132F0ED004DC062F07D0082F3B +:105CD000F6D108E01A2F04D0222FF1D103E00528D5 +:105CE00001D00428ECD13D2F04D1012239463046A1 +:105CF000FFF7D8FCCCE0030004F050F909061F1AA6 +:105D0000427785A240C540000021304603F085FF60 +:105D10003620005D00280BD00A216A4611703046FB +:105D200000226946FFF7F0FB01206070024657E051 +:105D3000304600F03AF903201FE0012200213046EE +:105D4000FFF7ADF9012211463046FFF70FFB0022A5 +:105D500011463046FFF7E0F90021304604F078F8AC +:105D60000021304604F05CF80B216B461970304678 +:105D7000324A6946FFF7C8FB0220607007B0F0BDE9 +:105D80002246A08E2432069203236A461370507274 +:105D9000000A9072274600A81C370822244D0130C3 +:105DA000211DA847082202A803300699A84704220B +:105DB00004A839460330A847002269463046FFF759 +:105DC000A3FB04206070012200213046FFF7A4F9F4 +:105DD0002034A07D002802D00222114601E00222D8 +:105DE00001213046FFF75BF9C8E702220021304667 +:105DF000FFF755F9012211463046FFF7B7FA0520A3 +:105E0000607001220BE0204621460A4B01220C3033 +:105E100024310096F7F7EAF906206070002200218D +:105E20003046FFF779F9A9E788920020475A011810 +:105E3000190F0000FF5E0118295A0118875C01182C +:105E40002146224630460C311C3204F019F801215B +:105E5000304603F0FDFF0121304603F0E1FF06214B +:105E60006B461970304600226946FFF74DFB08204B +:105E70006070012200213046FFF74EF9E88F0121C2 +:105E80004902084337E0002211463046FFF744F943 +:105E9000FE4800994058002821D040300078C04387 +:105EA00080071CD0284640304178F72211404170CD +:105EB0000121304603F0B1FE002202213046FFF7F7 +:105EC000EEF8002201213046FFF750FAE98F20203A +:105ED0008143002F11D0002040010143E98739465A +:105EE0003046FBF770FC00213046FFF73FF9E88FA2 +:105EF000012149028843E88740E70120ECE7F8B533 +:105F00000F461006E149800D0858154600282AD092 +:105F10004022125CD243920725D0AA008958DC4E59 +:105F2000C98FC90720D00468002C1CD0207806280F +:105F300019D16078032802D006280FD109E0042285 +:105F4000204639461C30B0470822391D20462430EF +:105F500003E01022204639460C30B0476178E8B2A1 +:105F60000022FFF79FFEF8BD4468002CFBD020788C +:105F70000628F8D160780D2802D00F280FD109E04B +:105F80000422204639462030B0470822391D2046D9 +:105F90002C3003E01022204639460C30B04761789F +:105FA000E8B20022FFF75EFDF8BD10B50146B94822 +:105FB000F7F74DF910BD30B4B44C8300E358002915 +:105FC00010D0012910D0022912D0032912D1517802 +:105FD00003290BD04033197889070BD03D2230BC00 +:105FE00009215FE61278FAE71A22F8E79278F6E7D5 +:105FF0005278F4E730BC704710B5A44C8300E358E6 +:1060000000290ED0012903D0022901D0032907D18C +:1060100040331978890703D03D221321FFF722FD71 +:1060200010BD1278F9E770B5054698498000085808 +:106030000024C18FC90702D14068002802D024245F +:10604000204670BD0122FF2038231146073004F09E +:10605000D7F90246062010700A2050700121362020 +:1060600081542846FFF742F800220A212846FFF70C +:10607000F9FCE5E710B58549820089580024CA8FEC +:10608000D2070AD0096800290DD0097806290AD15B +:1060900000220121FFF706FE06E04968002902D030 +:1060A0000978062902D02424204610BD00220B21A5 +:1060B000FFF7D8FCF8E7F7B500980D468100734864 +:1060C00000264458E08FC0070BD02068002825D058 +:1060D0000078062822D13D2209210098FFF7E2FD31 +:1060E0001DE060680C27002814D10122FF2038230E +:1060F0001146073004F084F9074606203870002066 +:106100003621C8553A4601210098FEF7EFFF0A20D4 +:106110007870074660680178062902D02426304648 +:10612000FEBD0446A97A687A09020143A186294680 +:10613000042213312046564B1C309847294608222A +:106140000B312046524B243098470822691C504B93 +:10615000201D9847002239460098FFF783FCDEE7B0 +:10616000F8B50E4605468100484800244058C18FC6 +:10617000C90706D00068002809D0017806290FD089 +:1061800005E04068002802D00078062802D02424C8 +:106190002046F8BD3D2213212846FFF763FCF7E7B0 +:1061A0003146074604220931394B203098470822EE +:1061B000711C3846364B2C30984700220421284663 +:1061C000FFF770FDE4E710B53049820089580024DC +:1061D000CA8FD20706D00968002909D00978062994 +:1061E0000ED005E04968002902D00978062902D0BE +:1061F0002424204610BD3D221321FFF733FCF8E78D +:1062000000220521FFF74EFDF3E710B51F4982007C +:1062100089580024CA8FD20706D00968002909D0FE +:10622000097806290ED005E04968002902D00978CE +:10623000062902D02424204610BD00221021FFF799 +:1062400011FCF8E700220821FFF72CFDF3E7FFB56A +:106250000E4982008E58002581B0002E1ED0374690 +:1062600040373978C943890718D0F18FC90715D04D +:10627000042815D22821895DC907C90F00D0012142 +:1062800000290DD0797809070CD505E08892002007 +:10629000190F0000FF5E01183A252BE00C2529E0BC +:1062A0001A2527E00102491CFF2038230A4607303F +:1062B00004F0A6F8044606202070002060700498C0 +:1062C000002805D0A0860822344B201D039998474A +:1062D00010222046314B0C3002999847F08F8006EF +:1062E000C10F36200155204604F0A3F87878082124 +:1062F00008437870284627E4F8B5294F06468500FC +:1063000078590C2400282ED04022125CD2439207E8 +:1063100029D04068002826D00278062A23D1427866 +:106320000E2A20D10024002905D010221B4B0C304E +:106330009847002213E02030807D00280ED00121F4 +:106340003046FEF713FF78590122C18F5202914364 +:10635000C18706213046FFF797FA04E006220E2196 +:106360003046FFF77FFB2046F8BD70B50025044698 +:10637000FF290AD001250021FEF7B8FE00221146B0 +:106380002046FFF78FFC284670BD0549A00008583D +:10639000403081782046FBF716FAF4E7190F000029 +:1063A000889200203EB56C462170EB236370D122A9 +:1063B000A2700122E27000226271A271E271227267 +:1063C0002271092906D19B4A810051582031097A4E +:1063D0000B40637000222146FFF796F83EBDF8B5EA +:1063E0000F4606468100934844582568687800287F +:1063F00015D0012826D01F27E87800280AD0224689 +:10640000283239463046F9F76CFE40346078FB217B +:106410000840607000213046FEF7A8FEF8BDE08F0E +:106420000106E9D4C00701D0082100E00E21304662 +:10643000FFF7B8FF01206870024600213046FEF7E2 +:106440006BFEF8BD002211463046FEF765FED3E72D +:1064500030B400290ED001290ED002291ED0032904 +:106460001ED151780E291BD19178002918D01A29F4 +:1064700006D011E01178F8E751780E2910D11A21D1 +:10648000042809D26B4B82009A58002A04D020328B +:10649000137A0824A343137230BCA0E75178E4E7D1 +:1064A00030BC704770B5634A8300D2580024D38F44 +:1064B000DB0701D0242418E013464D7820321572F2 +:1064C0008D785572CD7895720D79D5724D79157399 +:1064D0008D795573CD799573097AD173D98F8022CF +:1064E0001143D9870921FFF75DFF204670BD70B5C4 +:1064F000504A8300D2580024D38FDB071AD01346AA +:106500004D78203215728D785572CD7895720D794F +:10651000D5724D7915738D795573CD799573097A47 +:10652000D173D98F80221143D9870921FFF73AFF10 +:10653000204670BD2424FBE770B53E4D84002B59E6 +:106540004E781A46203216728E785672CE7896722F +:106550000E79D6724E7916738E795673CE799673FC +:10656000097AD173D98F80221143D98729590968B3 +:10657000002905D00978022902D10021FFF72FFF59 +:10658000002070BDF8B5014682002A4800248058DA +:10659000021E0AD0054640352B78DB439B0704D00A +:1065A0006B785B0703D53A2426E00C2424E0002610 +:1065B0000127042907D22030007A0823184000D090 +:1065C0000120002806D1D08FC20703D1000601D4D4 +:1065D0001A2411E00902491CFF2004230A4607304F +:1065E00003F00EFF022101704670C77003F021FF17 +:1065F00068780421084368702046F8BD70B500250E +:106600000446FF2909D001250021FEF76FFD002176 +:106610002046FFF7E4FE284670BDD0780028FAD067 +:106620000449A0000A584220815C20462832F9F72C +:1066300058FDF0E788920020F3B50646FE4A800038 +:10664000155800272C6883B06178002902D00129F1 +:1066500070D13BE001216170E98F09060CD5042E51 +:106660000AD21058002807D02130007A08210840AB +:1066700000D0012000280AD1E088F049884200D3E8 +:106680000846E0806089884200D308466081E3883C +:10669000A1886289248914276D462F706C70240AA2 +:1066A000AC70EA70120A2A716971090AA971EB715A +:1066B000190A2972304600226946FEF725FF012299 +:1066C00000213046FEF728FD05B0F0BD002211463E +:1066D0003046FEF721FD0498002819D1298A208927 +:1066E00081420BD1E989A288914207D1A98A6289A6 +:1066F000914203D1698AE288914209D0009063896E +:10670000A288E188304603F0ECFA00281FD0002769 +:10671000002F0FD020892882A088E8816089A88274 +:10672000E0886882208900906389A288E1883046E9 +:10673000F9F7ABFDE078002804D040356878DF2118 +:106740000840687000213046FEF710FDBCE70127C5 +:10675000DEE7FFB583B003980C9C8500B64840592E +:10676000C58EA54200D22C46058FA7B29D4200D30C +:106770001D467C237C2A00D91A464524240116464E +:10678000A14200D80C46C18F09060CD503990429F3 +:1067900009D2010007D02921095C0822114000D04C +:1067A0000121002906D1A5498D4200D30D468C4216 +:1067B00000D30C46018AB14208D1C189B94205D142 +:1067C000818AA14202D1418AA94211D00682C781A1 +:1067D0008482458223463A4629460096039803F070 +:1067E00080FA23463A46294600960398F9F74DFD6C +:1067F0001522694603980A704E70320A8A70CC706E +:10680000220A0A714F713A0A8A71CD712A0A0A72F4 +:106810000022FEF779FE07B0F0BD30B4002910D099 +:10682000012910D0022920D0032920D15178142920 +:106830001DD1917800291AD0192908D01A2906D01B +:1068400011E01178F6E75178142910D119210428A4 +:1068500009D2794B82009A58002A04D02032137A48 +:106860002024A343137230BCE6E65178E2E730BC43 +:106870007047F8B5704B82009A5800255268002A7C +:1068800001D0242529E08B784E781C024A1C344321 +:106890001B2C1DD3537916791A0232431B2A17D3A6 +:1068A0000B79CE781B023343FF264936C91CB3420D +:1068B0000ED34F7909793F023943B14208D3FB2CFB +:1068C00006D8FB2A04D85E4EB34201D8B14201D9A2 +:1068D000202502E00094FFF73CFF2846F8BDF8B5FC +:1068E0000A460546810054480024405801680029A2 +:1068F00002D00878042801D0242443E09078567808 +:106900000002531C30431B2816D35E791F793602D0 +:106910003E431B2E10D31679D77836023E43FF270D +:106920004937D21CBE4207D35679177936023E4307 +:10693000FF274937BE4201D220241FE08E888642BD +:1069400000D23046888050781778CE8800023843CD +:10695000864200D23046C88058791B790E890002E1 +:106960001843864200D230460881507912794B890B +:1069700000021043834200D218464881214628462F +:10698000FFF75AFE2046F8BDF7B517462A498200A0 +:106990008C580025002C0AD0264640363178C94351 +:1069A000890704D07178890603D53A2531E00C2592 +:1069B0002FE004282FD22821095D2022114000D089 +:1069C0000121002927D0E28901998A4202D1618AF6 +:1069D000B9421BD00102491CFF200C230A46073094 +:1069E00003F00EFD04210170002141700121C170EE +:1069F00001998180C7807C21018145210901418164 +:106A000003F017FD70782021084370700198E0862C +:106A100027872846FEBD1A25FBE738B50024054622 +:106A2000FF290FD001240021FEF760FB002128463A +:106A3000FFF702FE204638BD88920020480800007B +:106A400090420000D0780028F4D00020034602468F +:106A5000014600902846F9F718FCEBE730B5F74CF3 +:106A60000398E47AA40701D5012400E006248A42B1 +:106A700016D8FF25F435AB4212D81925ED01A942ED +:106A80000ED8A2420CD3A8420AD80A2808D30A2258 +:106A900050438A00891849085B1C5943884201DA2F +:106AA000002030BD012030BDF0B50C460746E4495A +:106AB00080000E588DB0384603F027FAA1880222D4 +:106AC00049000091E18849000191A189022900D87B +:106AD00011460291E1890222022900D81146254679 +:106AE00020350391E9786A46490091741782F18F45 +:106AF000C9070BD10199401E081803F025FA084672 +:106B00000299C91C02910399C91C0391C107C90FBD +:106B10006A46D174E17800291DD1697A00291AD119 +:106B2000618AC84A914216D0002914D0A1886A46C9 +:106B30004900089102990991118A9185618A490059 +:106B40000818A188490003F0FFF908A80A91F7F78F +:106B500072F900280BD06846F7F70DF900280AD023 +:106B60000020E084E088A084E8700DB0F0BD608A69 +:106B7000E084089815E0F18F0698C90704D1401CFD +:106B8000059903F0E1F9084683B20598218AC0030C +:106B9000020C384603F011F9AB4903F0EBF9E0843D +:106BA0000598C003000CDEE770B586B014466A464F +:106BB000117005460822211DA44E00A80130B047DF +:106BC0002320005D6A46507221460E22103102A831 +:106BD0000230B047002269462846FEF795FC06B011 +:106BE00070BDF7B5164686B0954A8100019054589D +:106BF0002922F178925D114301D0012700E000279E +:106C00000799002945D1B18C2289914207D1328957 +:106C100063899A4203D17289A3899A4205D021815E +:106C2000318961817189A18101271C21884A4143F1 +:106C30008D18B1890222022900D811460491F189E8 +:106C40000222022900D81146039103F05EF9009058 +:106C50002089400002902846F7F787F80298A8801C +:106C60000098E8800498288103996981E08FC00723 +:106C70000CD10098A988401E081803F065F9E98036 +:106C80002889C01C28816889C01C68812846F7F7BC +:106C90003AF8002F07D0A0890090638922890799CC +:106CA0000198F9F783FAF078002804D0403460782E +:106CB000EF210840607009B0F0BDF0B516460746F8 +:106CC00085B0BA005E4B00929D5800202C680629C2 +:106CD0000BD062788A427DD161780B0003F05EF9B7 +:106CE000072B280896BCBABCBA0006216170F3E7EE +:106CF000002211463846FEF70FFA002E18D0042F56 +:106D000016D24F4900980858002811D02030007A38 +:106D100000210222104000D00120002808D0E88F76 +:106D2000C00704D11C204A4A78438018C17393E0FD +:106D3000012028210855E88F10210843E8872046C4 +:106D400020300390007A0028384626D003F026F839 +:106D500001463B4A009810584089C2008018081824 +:106D600009302084039A01219170208221463846FF +:106D7000FFF79AFEE28CE2832089238C61896E46BC +:106D80000BC60398A38C8178384602F069FF06464B +:106D900004206070002E5FD121E002F0FFFF20820E +:106DA00021463846FFF780FEE08C60822548A082AD +:106DB000E08220836083A08322460F213846FFF7BC +:106DC000F3FE012200213846FEF7A6F9E88FC0073E +:106DD00003D000E018E002202EE003202CE0002188 +:106DE0006A4611700399384689785170E18B518059 +:106DF000A18C91802189D18061891181218C51815F +:106E000000226946FEF780FB05B0F0BD0022114666 +:106E10003846FEF781F9002E1ED12089228C618927 +:106E20006B4607C32220015DA38CE28B384602F03B +:106E300017FF060010D104206070E5E7989200204B +:106E400088920020FFFF0000E2040000190F0000FC +:106E5000049200200028D7D0E078002805D12846E9 +:106E6000403041784906490E417022463146384645 +:106E7000FFF7B7FE00213846FEF778F9E88F1021BA +:106E80008843E887C0E730B4F84B84001B59DC8F97 +:106E9000E40701D0022400E00324002910D00129D6 +:106EA00011D002291FD003291FD151780F291CD1DD +:106EB0009278002A19D0192A09D01A2A07D00FE08F +:106EC00006241278F5E751780F290ED11A220428EA +:106ED00006D2002B04D02033197A0225A943197257 +:106EE000214630BCE9E65278E3E730BC7047F7B59D +:106EF00084B0049B16469C00DC4B00221D591046B2 +:106F00006C680B290BD063788B422DD16178C91F37 +:106F10000B0003F043F805113D077F7F7B000B2139 +:106F20006170F3E7002E75D1002201210498FEF76D +:106F3000F3F8012028210855E88F1021084327463F +:106F4000E8872037387A002810D02089228C618980 +:106F50006B4607C3A38CE28BB978049802F080FEDD +:106F6000060057D10A20607007B0F0BDA1882889BB +:106F7000814216D8E288824213D322896B899A42D1 +:106F80000FD16289AB899A420BD1A0802889E08019 +:106F9000002E12D0002332460F210498FEF704FB86 +:106FA00041E0608900902389E2880498F9F746F966 +:106FB0000820607001207872D6E7E88FC00713D0F0 +:106FC00004982A230102491CFF200A46073003F0D7 +:106FD00017FAA74B05462A222146984701206870D8 +:106FE000284603F026FA1EE021460498FFF75CFDD0 +:106FF000224610210498FFF7D7FD09206070012276 +:1070000011460498FEF788F8AEE703E0002AABD0FB +:10701000002808D1224631460498FFF7E2FDE98FA7 +:1070200010208143E98701210498FEF79FF89BE730 +:10703000092300290AD0022906D003290CD151784E +:10704000102909D1927803E0527801E012780B23DD +:10705000002A01D019464AE77047F7B582B00C46BE +:107060000298824980000E5820890090A188174616 +:107070000025E3880A460298FFF7F0FC002803D0B9 +:10708000F08FC00741D101E020253FE060897949B8 +:10709000381A80B2884201D2282537E030680028AB +:1070A00002D00178032904D070680921002813D088 +:1070B00027E0A1888184E18801812189418161895A +:1070C00001846188C1836178203081702A46032160 +:1070D0000298FFF7F2FD19E00122FF202A23114652 +:1070E000073003F08DF90246032010700021D170A3 +:1070F00029208154481E508201210298FDF7F6FF95 +:10710000072170680278032A02D0242528467BE6EE +:107110004170A2888284E288028122894281628948 +:1071200002846288C28362782030827001220272F7 +:1071300000220298FFF7DBFEE8E7F7B582B00C46C5 +:1071400002984A49800008580190406800270028AA +:1071500001D0242779E0207AE179000208430090E9 +:10716000A079617903020B43A078617802020A4397 +:107170002179E07809020143E61C651C0298FFF7BB +:107180006DFC00280AD00198C08FC00708D00321E9 +:107190000298FEF714F9070002D056E01E2754E0CB +:1071A00002982A230102491CFF200A46073003F0F7 +:1071B00027F9024603201070072050700023D37077 +:1071C0006978287809020143918071783078090242 +:1071D0000143D180687929790002084310817079D0 +:1071E00031790002084350811146657A2031CD7013 +:1071F000E07AA57A000228431082607B257B00029A +:1072000028435082E07BA57B000228439082607C6B +:10721000257C00022843D082E07CA57C0002284324 +:107220001083607D257D000228435083E07DA47D8E +:107230000002204390834B7201210298FDF756FF14 +:10724000002207210298FFF752FE3846DCE5F7B529 +:1072500082B0029800278200044880580468002CFD +:1072600002D02078032807D0242759E088920020F4 +:10727000190F0000FF7F0000087ACA79000210434E +:1072800000908879CD1C4E1C497903020B4370781D +:10729000317802020A43697828780902014302988A +:1072A000FFF7DCFB002833D0707831780002084308 +:1072B000A18888422ED3E288944690422AD86A78E0 +:1072C0002B7812021A43624524D88A4222D372795B +:1072D000337912021A4323899A421BD1814200D981 +:1072E0000846A08068782A7800021043844500D9B7 +:1072F0006046A08068792A79618900021043814242 +:1073000000D9084660810020E0832034A07002E0AC +:107310001E2700E020273A4602210298FFF7CDFC05 +:10732000384671E5F8B50C4605468000A149009045 +:1073300008580026002810D0074640373978C9433E +:1073400089070AD0042D0AD22821095C02221140A3 +:1073500000D00121002902D004E00C2648E0C08FB3 +:10736000C00704D07878C00603D53A2640E01A2634 +:107370003EE02902491CFF202A230A46073003F079 +:107380003FF803210170002141700123C37061881F +:10739000628949008A4200D21146C181218822892E +:1073A00049008A4200D2114681816188C1802188CA +:1073B0008180A1880181E18800224181042D0CD2C5 +:1073C0007C4C00996158002907D02031097A0222AB +:1073D000114201D0012200E0002201465A40203132 +:1073E0000A724B7203F025F8787810210843787000 +:1073F0003046F8BD10B503466E4A9C0012590C2069 +:10740000002A25D04024A45CE443A40720D052687D +:10741000002915D0002A1BD0D4884888844200D97E +:107420002046D08090880C88A04200D820469080CA +:107430005489C888844200D920465081002202E045 +:10744000002A05D03B2208211846FFF750FD0020F6 +:1074500010BD70B514460646564A800000251258E5 +:10746000FF2912D0D08FC00602D5607800281CD02A +:107470000125224600213046FDF738FE61780022C2 +:107480003046FFF71AFC284670BDE078002806D089 +:107490004032917822463046FFF7A3FBF3E74032B3 +:1074A00050784006400E5070EDE70225EBE7F8B546 +:1074B0000D46100A1C21404A414300278C18FF2B1F +:1074C00006D0DEB23146F8F756FE012E0BD014E09E +:1074D000E088A188401C02F037FD288888420CD043 +:1074E0002046F6F742FC2888A1884018401E02F08A +:1074F0002BFDE1802046F6F706FC3846F8BD70B556 +:10750000C5B22C4EAC003059002850D04030017824 +:10751000C94389074BD04078C10648D4C00946D139 +:107520002902491CFF202A230A46073002F068FF7F +:107530001C21214A6943335989180A89DB8F4989FB +:10754000DB0701D1C91ED21E032303700023437041 +:10755000C3708281C18131590989C180315909893A +:107560008180315949890181315989894181315954 +:10757000CA8FD2070BD0042D1AD2002918D020317F +:10758000097A0222114000D00121002910D00022E6 +:10759000014620310A724B720021C943418202F038 +:1075A00048FF30598022403041781143417070BD0E +:1075B0000122EDE78892002004920020F7B50098A0 +:1075C000042682003C481027845865686878884201 +:1075D00009D103280FD004280CD1204605221830E9 +:1075E000364B291D9847E08F0121B843E08700986A +:1075F000FDF7BCFDFEBDE08F291D3843E0876A8999 +:10760000009802F053FB0028EDD16E70FEBD0029FA +:107610000BD129498300C95812784968002904D040 +:107620000978082901D10521C8E77047F8B50E4649 +:1076300007462149800008580025C18FC90702D19B +:107640004068002801D0242525E0F0881C49101A44 +:1076500080B2884201D228251DE03902491CFF2052 +:107660000C230A46073002F0CBFE044608202070A7 +:10767000032060700522711C104B201D9847F08874 +:107680006081224601213846FDF730FD00220321AA +:107690003846FFF793FF2846F8BD8100064840585A +:1076A000002806D04021095CC943890701D0183061 +:1076B000704700207047000088920020190F0000DA +:1076C000FF7F0000F7B582B0029817468200FD48A0 +:1076D00000268558002F2C6805D0002211460298FC +:1076E000FDF71AFDE8E06078884278D1030002F0E7 +:1076F00055FC0504403BC2EBBB00E88F102108435A +:10770000E8872846E1792030C176A1798176E17A4F +:107710000177E179EA7D4800D040C00705D0A07923 +:10772000AA7D4000D040C0077ED1A27916266B46C4 +:1077300002981E7099705A7000226946FDF7E4FEA7 +:10774000012200210298FDF7E7FCE88FC00701D075 +:107750000220B7E0A0790121C00700D000210298E3 +:1077600002F0FFFA0320ADE0002211460298FDF777 +:10777000D3FCA079012100280CD0AB7D4200DA4077 +:10778000D20701D0002002E0800702D5022020723B +:1077900000E02172E07900280CD0EB7D4200DA4055 +:1077A000D20701D0002002E0800702D502206072DB +:1077B00000E06172A07A002812D0207AA97D00280A +:1077C00001D04108491C607AEA7D002801D04208B6 +:1077D000521C914204D000206072207246E043E0C7 +:1077E000207A002802D1617A00293FD0A97D0028A3 +:1077F00001D04108491C491EC8B20090607AE97D59 +:10780000002801D04108491C491ECFB2029802F05D +:10781000C5FA6989CA0089184018093083B2A38063 +:107820003A460099029800E045E002F076FA070037 +:107830001ED001260020A08020726072627A217A18 +:107840009446A2886B469646182202981A70597080 +:1078500062469A707246DA70110A197100226946FE +:10786000FDF752FE002E41D105B0F0BD0126E5E73F +:1078700004206070E2E7002211460298FDF74CFCFC +:10788000207A002802D1617A002915D0617AAA7D78 +:10789000002901D04A08521C521ED1B2EA7D0028AC +:1078A00001D04208521C521ED2B2A388029802F0A4 +:1078B00034FA070005D019E00421029802F051FAC9 +:1078C00014E004206070CFE7E88FC00702D0617A2F +:1078D000207A01E0217A607A002902D04908491C07 +:1078E000E975002802D04008401CA875E98F1020D7 +:1078F0008143E987E078002805D1207A002802D169 +:10790000607A00280DD0EB7DAA7D39460298F8F701 +:10791000DCFCE078002804D040356878BF210840BE +:10792000687000210298FDF721FC9DE7002910D026 +:10793000012910D0022920D0032920D151781629FD +:107940001DD19278002A1AD0192A08D01A2A06D0F6 +:1079500011E01278F6E75178162910D1192204287F +:1079600009D2584B81005958002904D021310B7A93 +:107970005B085B000B720021A4E65278E2E77047D7 +:10798000F8B51746064682004E48002F85586C68A9 +:1079900004D00421304602F0E4F914E06078884213 +:1079A00058D1052813D0062855D0072852D1207A5F +:1079B000002802D04008401CE875607A002802D0F8 +:1079C0004008401CA875E88FC10767D075E0E88FB4 +:1079D00010210843E887C0071ED03102491CFF2050 +:1079E0000C230A46073002F00BFD0521017001212E +:1079F00041700021C170294620318A7EA3791A4046 +:107A00008271CA7EE3791A40C271097FC172A17A7C +:107A1000817202F00EFDD6E72035A87EA279012101 +:107A20001040C00700D00021304602F09AF906202D +:107A30006070A97EEA7E17236C462370A270617085 +:107A4000304600226946FDF75FFD012211463046AF +:107A5000FDF762FBF8BD002201213046FDF75CFB1B +:107A6000207A002802D1617A002992D0617AAA7D19 +:107A7000002901D04A08521C521ED1B2EA7D0028CA +:107A800001D04208521C521ED2B2A388304602F0E6 +:107A900044F9070097D107206070F8BD1021884392 +:107AA000E887207A002802D1607A002805D0EB7D93 +:107AB000AA7D39463046F8F708FC01213046FDF72B +:107AC00055FBF8BD88920020002901D1127857E7B4 +:107AD000704770B50C460646A1498000085800253D +:107AE0004168002901D0242537E0A17800290CD075 +:107AF0006178002909D0C08FC00708D00521304621 +:107B0000FDF75DFC050002D027E01E2525E03102CF +:107B1000491CFF200C230A46073002F071FC0521A6 +:107B2000017041706178C171A17881710246A078BD +:107B30006178884206D1002804D0411E084201D154 +:107B4000012000E00020907201213046FDF7CEFABE +:107B5000002205213046FFF713FF284670BD70B59F +:107B60007F4A83008C78D2580025002C02D04B78B5 +:107B7000002B00D11E25D38FDB0705D01368002B07 +:107B800002D01A78052A01D0242517E09A792240DC +:107B90009A71DA794C782240DA718C7849788C4283 +:107BA00006D1002C04D0611E0C4201D1012100E05D +:107BB000002199722A460221FFF784FD284670BDF4 +:107BC000F8B513464A78054696080024B600C81C46 +:107BD000002E03D18E78B708BF0001D020240DE01D +:107BE000002A01D1002E09D04678077836023E439C +:107BF0009B1B5C4E9BB2B34200D22824584BAE0074 +:107C00009E593368002B02D01F78052F08D0736867 +:107C1000002B02D01E78052E10D02424204650E7D9 +:107C20001A72897859724178027808021043988054 +:107C3000224603212846FFF745FDEFE71A728978AF +:107C40005972417802780802104398802246062132 +:107C50002846FFF795FEE1E702469300404A0C20D4 +:107C6000D258002A0AD040239B5CDB439B0705D0F7 +:107C7000D07D4870907D0870002088707047F8B5FE +:107C80000C468200364900268F583146042807D218 +:107C9000002F05D02921C95DC907C90F00D00121D6 +:107CA0004D0001210D43002F09D040373978C943D9 +:107CB000890704D07978490603D53A2625E00C26B1 +:107CC00023E06178294202D02178294201D11A2685 +:107CD0001BE00102491CFF200C230A46073002F07A +:107CE0008FFB05210170002141700121C170617875 +:107CF0002940C171217829408171A178C17202F0B7 +:107D000098FB78784021084378703046D9E6F8B57A +:107D100015460746124A800000261458FF2912D043 +:107D2000E08FC00602D56878002817D001262A46C1 +:107D300000213846FDF7DAF9697800223846FFF766 +:107D4000C1FC3046BDE6E8780028FAD0E37DA27D8C +:107D50004034A1783846F8F7B8FAF2E70226F0E79F +:107D600088920020FF7F000070B5304D1C21A87A5A +:107D700048432F494418A08C002802D102F01CF976 +:107D8000A084208A4004400C2082A87A0621401C4E +:107D900002F0DAF8A97270BD24491C22897A514395 +:107DA000234A89180A8AD20B05D0898BC90A8142D5 +:107DB00001D10120704700207047F8B50E460546F6 +:107DC00002F0A0FC194CC022A17B1346CB40217BC2 +:107DD000C0B20907090F0B438707BF0F0121B94044 +:107DE0000B432B70A37B1746DF40237B1B091F43EC +:107DF0006F70A37BDA4033071B0F1A43AA70627BB4 +:107E000000095201203202430A43EA70607B0321D9 +:107E1000401C02F099F86173A07B0221401C02F023 +:107E200093F8A173207B401C2073F8BD989200202A +:107E300000830020F7B5164607468500FE494859DD +:107E4000002828D004460021F5F778FDA08E000711 +:107E500002D50220F6F7C6F80198002815D00423B1 +:107E6000FF220021F54802F0CBFA0770002146708E +:107E7000C170002E05D0218F002902D02034A17EB0 +:107E800000E00021817002F0D4FAEB4C605902F05E +:107E900051FA00206051FEBDF8B51F4600230D4683 +:107EA00006461C46002A04D0104602F008F98378E2 +:107EB0000488B10048190006020DE1481218908F9D +:107EC000568F9B1DF6B21B021E4356879487012DC9 +:107ED00010D10B06548F0421240924010C4354872C +:107EE000190D7723DB00C918138F89089B0B9B039F +:107EF0000B431387002F03D0002801D002F0E4F8D1 +:107F0000F8BD38B5002817D0014620310C46CA7E8E +:107F1000416A4B1C08D04368CA4DC91AC903702373 +:107F2000090C53435B1919800C2100911346C64973 +:107F3000F5F732FD0120207738BD70B504003DD043 +:107F4000A08E254600072035002803DAA07D401CBE +:107F5000A07523E0A16A6068411A0A01E16A12096A +:107F600049008A421AD3A17D491CA175A06202F082 +:107F7000C9FB112101F0E8FF4804E97F000C00294A +:107F800007D0002802D0202802D002E0012000E023 +:107F90001F20616808180101090961602046F5F792 +:107FA000D4FB00280AD0E87F002807D1606A401C73 +:107FB00004D0E87E3C220121FFF73CFF70BD30B5C4 +:107FC000EFF3108372B684009B48002500593A24D1 +:107FD00025540287828E120704D5012241681203BC +:107FE000891804E0002905D04268490151180901A7 +:107FF000090901E00021C94383F31088416230BDC3 +:10800000F7B586B006988C4D8600A8590C24002838 +:108010007ED10021402002F033F9A851002877D00A +:10802000054606981C214843884940180190046978 +:1080300002F092FB069A039202904022844B0021A8 +:10804000284698478348E8618348A8610220E8757C +:108050000520A8750020A8608048A8822846203006 +:10806000069A00900146C276A068E8626088A886F9 +:10807000607F4877207F401E887708982887F0B275 +:10808000761CF7B204900026607802F0E5FA01460B +:10809000A88E13280AD004DC10280DD012280FD186 +:1080A00008E0152804D01D280AD101E06C4805E03D +:1080B0000126FBE70626F9E76A48022641432961C3 +:1080C0000498012E04D1617BC90701D0012200E090 +:1080D0000022217BD201CB070321490211435A0E12 +:1080E000114320221143020155483143161871876C +:1080F000217B0422C907490E11433A011018059249 +:1081000004904187A88E400718D50098C07E00E0F3 +:10811000EFE006214843AF21C900471852482146E5 +:108120004B4B0E31062238185C3B9847708F032169 +:10813000C0B2890208437087B7870DE00198002319 +:10814000027D19460698FFF7A7FE01980023827D5D +:1081500001210698FFF7A0FEA88E410701D48007F1 +:1081600004D4308F800B800330870EE07721059890 +:10817000C9004018318F8008890B8903014331877A +:108180000498018F4904490C0187308F4004400C4A +:108190003087A88E2B490207069870235843403930 +:1081A00046180190002A0CDA02984914401801017F +:1081B00009090220F5F711FF2C4881880520296163 +:1081C00000E004203082A078400701D5002000E0C4 +:1081D000A07E01020198F184234BFF308D30C0183E +:1081E00021461B4B0E3106225C3B9847154A0199EC +:1081F000607B8F187882A88E000702D4F1200002DD +:1082000000E01B4830851F2070850098C07E8006E6 +:10821000000E01017720C00008188008B0861549BB +:108220008888F083C888308413487084B18C5520C6 +:10823000090A0902014321E0A89200200602000079 +:108240008083002080810020CFAC011804920020A0 +:10825000750F00003B7F0118037F011801600000CB +:108260002E070000B205000000800020D092002000 +:10827000278000009892002055550000B18400200E +:1082800038817881A88EC006C00FC0003880009861 +:10829000807F81000143F182217B0398C907C90FC8 +:1082A0000002202210430843708201982146334B7C +:1082B000FF30143106225930C018314B984760788E +:1082C000F988E022914340010143F98002986860F7 +:1082D0000020A8602846F5F738FA002808D106AB38 +:1082E00007CBFFF76CFE0099002008776868A8624A +:1082F0000024204609B0F0BD10B503460C20EFF372 +:10830000108472B69A001F49895800291ED0203166 +:10831000087F002802D0012817D105E000220121A2 +:108320001846FFF787FD10E0CA7E70235A43164BAC +:108330000120D218108005231B071868012252065D +:1083400090431043186002200877002084F31088BF +:1083500010BD70B5EFF3108472B68500094B5B5900 +:108360003C25ED5C002D04D020315A5484F3108854 +:1083700070BD0123FFF790FDF8E7000000800020AA +:10838000190F0000A89200208081002070B5FF4CDA +:10839000002520680068002828D0014620310A7E88 +:1083A000002A02D0012A21D10FE00021F5F7C6FAF8 +:1083B000F5F7D0FD2068006801F0BCFF206805607B +:1083C000017A49084900017210E0087D7023584382 +:1083D000EF4B0122C018028005200007026801232C +:1083E0001B069A431A430260022008762068007A2E +:1083F00000280FD10223FF220021E64802F000F8F6 +:108400002168497A4170057002F013F8206801F084 +:1084100091FF256070BDF7B58100DC4882B005682A +:108420006C5826462036307D009002F095F903996D +:108430000746401A00010009401C216A4008814299 +:1084400001D9091A12E0F5F785FDD3480068411CEF +:1084500001D0606007E0A18DE08D081A4000C119CD +:10846000CE48014061600020A060E18D2162084695 +:10847000CB494843C8498988884200D308462061CF +:10848000C6496868491C88420BD86168081A00010F +:1084900001210009C906884203D2FFF777FF05B022 +:1084A000F0BD0498002803D10521A17561686162BF +:1084B000BC49A182F17D012000038A0010430843DA +:1084C000009B70214B43B249403959180F46C8826E +:1084D000AF49208C59180880B07D0B2801D00A289C +:1084E00001D1B1480881B14A206A904200D31046B8 +:1084F0000122D2030243FA850020C884287C800729 +:1085000008D52946AA48FF330A31062259331818DC +:10851000A84B9847287CA97C82076B7CD20F002946 +:1085200001D1800701D5012000E000201B020901D4 +:108530000B43910000250B430343FB84B17D3A8A32 +:10854000520952010A433A822046F5F7FEF8002804 +:10855000A5D175776586A2E738B500280CD004460A +:108560002034227D0C210091A37E9349F5F714FA63 +:10857000F5F7F0FC0120207638BD10B5040014D0CA +:108580003820005D002810D102F0E6F8616A411A37 +:108590000A01A18D120949008A4203D3A17D491C19 +:1085A000A17560622046F5F7D0F810BD70B5774927 +:1085B0000C200968002920D00D68002D1CD038201F +:1085C000405D002818D102F0C7F869680446081B0E +:1085D000000101220009D206904203D9601A00016D +:1085E000000940423C2807DD00212846F5F7A6F99E +:1085F00028466C60F5F7A9F8002070BDF1B5634D11 +:108600000C24286886B0002876D10021142001F0BF +:1086100037FE286000286FD0044602F09DF80490D1 +:108620000020039006981C2148436449614F40187C +:1086300000901422002106695C372868B847B0789A +:10864000C00733D00021642001F01AFE206000280A +:108650002CD0642205460021B8475948E8615948A2 +:10866000A8610320E8750520A87530894C49484366 +:1086700049498988884200D308464A492861A98225 +:10868000F088A885F288EA852846317920300023D1 +:108690004175C3752A628376069A027501290BD04B +:1086A00000200390207A0121084320723078C0070F +:1086B000424803D0763002E00120F2E770300146F4 +:1086C0000290062220463B4B0A30984730782074AF +:1086D00070786074069860720025A5740098808A8E +:1086E00000280AD038494843491101F02DFC04996B +:1086F00040180001000902E0F2E00020C043606081 +:10870000069827688006000E00010590002F7DD096 +:1087100001972037387D00213977092179762B4957 +:108720001B4B8A8870214143403BCD188C46EA831D +:10873000264AD2882A84264A6A84AB8C55221B0A90 +:108740001B021343AB84124B0022C9180091CA8448 +:108750003178A27C8907637CC90F002A02D1227C70 +:10876000920701D5012200E000221B0289000B4381 +:108770001343EB8417492985009A00211181009A3F +:1087800051813178C907C90F000225E0B892002055 +:108790008081002005020000D0920020FEFFFF0F24 +:1087A000E204000001600000723E0000FF3F000094 +:1087B00000800020190F0000B5B0011804920020BD +:1087C0007B85011859850118204E000098920020E1 +:1087D000555500002780000020221043084368827E +:1087E00060465B4BFF3006225930C018594B029946 +:1087F000984706206885787D01280AD00020A88641 +:1088000000998882387F002812D000E039E00A20E1 +:108810000FE077210598C90040188008A8860099C4 +:108820008882387F002801D00B2002E0092000E078 +:108830000820B875C0B20B2801D00A2802D10099CF +:1088400045480881B87D2882F87D0121090382000E +:1088500011430143E98201980099008C0880019836 +:108860003E49006A884200D308460121C9030143FA +:10887000E985E88EC009C001E886A88D400840005F +:10888000A8850398002818D0354A05980321801838 +:10889000428F120912010A43428700218187418FCA +:1088A0000322C9B2920211434187018F890B8903C8 +:1088B0000187018F4904490C01872B4929484862E7 +:1088C0002068002500280AD00499416004464162CE +:1088D000F4F73BFF002802D13D20055565860024B2 +:1088E000204607B0F0BD10B50C20EFF3108472B62F +:1088F0001E490968002902D0FFF748FD002084F3D3 +:10890000108810BDF8B5194905460C680C201646AC +:10891000002C1BD0002D0BD001F01EFF0746144881 +:108920001449684301F010FB38180001000901E008 +:108930000020C0436060002E05D006222046054B73 +:1089400031460A309847FFF731FE0020F8BD00009D +:1089500000800020190F0000723E0000FF3F000061 +:10896000808300200100010000010050B892002027 +:10897000204E00007102000070B5FA4C00252068FE +:108980000068002827D0014620314A7B002A02D007 +:10899000012A20D10FE00021F4F7D0FFF5F7DAFA31 +:1089A0002068006801F0C6FC20680560C17C4908A9 +:1089B0004900C1740FE0087E70235843EA4B01223E +:1089C000C018028005231B07186812069043104345 +:1089D0001860022048732068C17C002912D14068C9 +:1089E000002809D141200423FF22C00001F008FD26 +:1089F0002168097D0170C57001F01BFD206801F040 +:108A000099FC256070BDF7B50D46D6498000096810 +:108A10000C5801F0A1FE0646401B00010009254646 +:108A2000401C2035216A40082F7E814201D9091A55 +:108A300009E0F5F78FFACD480068411C11D060605D +:108A40000020A060618D21620846C9494843C7499A +:108A50008988884200D3084620610298002808D0FF +:108A60000BE0218D608D081A4000C2498019084032 +:108A7000E5E70A21A17561686162BF49A182012011 +:108A8000687570204743B848218C38180180218CC4 +:108A90000122D2030A43B44940397918CA85002615 +:108AA000C6842046F4F751FE002800D1AE75FEBD05 +:108AB000FEB504002DD0AB48254620350068297E40 +:108AC00001916E7D02910189408900908F003946A5 +:108AD000606801F039FA0098791A40000818B1006E +:108AE0000831814200D938180299702251439E4AB8 +:108AF0008008801B403A8918C8870C200090EB7DC5 +:108B00009E492046019AF4F747FFF5F723FA012022 +:108B10006873FEBD10B5040014D02D20005D002840 +:108B200010D101F019FE616A411A0A01218D120962 +:108B300049008A4203D3A17D491CA1756062204689 +:108B4000F4F703FE10BDF1B592B00320099069203F +:108B500000010F9001F000FE0E9001F0D3FD814C5A +:108B6000070220683F0A00287DD10021442001F03F +:108B700087FB2060002876D000210D9112991C22DD +:108B800051437F4A7F4B891844220D6904460021D6 +:108B90009847129921756978A176A978E1762646D9 +:108BA00029782036F175002131764020015568780A +:108BB000C007734801D0763000E07030014608905D +:108BC0002046704B062226305C3B984720466D4B72 +:108BD0000622E91C2C305C3B9847BF2060759F2023 +:108BE000A0750320E075CD2020761F2060762046FA +:108BF0001C3012990690FFF7E0F837802220390CDC +:108C000001550220F07038460C2101F09DF94F1DEE +:108C10005D4837710089F4F7B5FA7071594B042239 +:108C200068465C3B06999847564B032231465C3BAD +:108C300001A89847F0786946C8710020088121464C +:108C4000504B052215315C3B04A898477079694662 +:108C50004001384348752746687A0837C00748D02E +:108C600000213C2000E028E101F00AFB2060002800 +:108C70003FD03C22434B069000210790984707982D +:108C80004249C16107984249816107980421C17531 +:108C900007980A218175079800218160A889344AC4 +:108CA0005043324A9288904200D31046079A10618E +:108CB0000798314A828206986A8902850698AA89AD +:108CC0004285069820300173069B1A62C1757F2287 +:108CD000027501234375129A0276688B3880A88B3F +:108CE0007880688AB880A88AF8803972E07C184356 +:108CF000E074388869464881B8888881F888214BB3 +:108D0000C881162223485C3B98470120A0746878EC +:108D10000021B174129A80079206120E2168120186 +:108D2000C00F0C9200297DD0069120311091097E50 +:108D300070230B9159430C4B0622403BCF180A91EC +:108D40007A85094B2289C91807914A8077230C9AA2 +:108D5000DB00D2189208BA868A82A17C00291BD037 +:108D60000F211AE0BC92002080810020D0920020C8 +:108D7000E2040000FCFFFF0F01600000F1B30118E6 +:108D800004920020750F000098920020158B0118A6 +:108D9000B18A0118908600200E2100233982504AA2 +:108DA0009188F983D18839844E497984BA8C5521C8 +:108DB000120A12020A43BA840799CB842978B27C3A +:108DC00009028000014350000143F984B07C00286F +:108DD00002D007990D988881287800280ED1B07CA0 +:108DE00000280BD10A98404BFF30E91C06228D3039 +:108DF000C0183E4B98470799A87848820126F60389 +:108E00003B4900203985079908810799488169788D +:108E10000B98C907C90F000220221043084378822B +:108E2000062200E017E00A982F4BFF305930C01897 +:108E30002E4B089998471098B110007B820011437F +:108E40000143F98206980799008C088006983146FC +:108E5000008C0143F985274A0C9805218018428F20 +:108E6000120912010A4342870F998187418F11220B +:108E7000C9B2520211434187018F890B89030187CF +:108E8000A9781D4BCA07120E052100251A430A4373 +:108E90004287018F4904490C0187656020680028DA +:108EA0000BD00E99416004464162F4F74EFC002855 +:108EB00001D12034A57500200990099813B0F0BDA8 +:108EC00010B50C20EFF3108472B60C490968002924 +:108ED00002D0FFF751FD002084F3108810BD000080 +:108EE000989200205555000000800020190F0000C6 +:108EF000278000008083002020220000BC920020F8 +:108F0000F8B5FC4980000C5826464036F08D00909C +:108F100000281DD0F848216E0289708E0F46101867 +:108F20004143F648192278439202801A01F00CF866 +:108F3000401E85B23946606E01F006F8401E85423B +:108F400000D22846009980B2884200D30846F085B6 +:108F5000F8BDF8B50F46E74980000C580821F940E4 +:108F6000E07D2346101A8033E54AC01E5043420874 +:108F700094465A7B4820D04062460830101A5A88DE +:108F80001D7896381E46904200D310464822FA407B +:108F90000832801A4034E28F520601D58A00801AC6 +:108FA00000F0D2FF854200D22846B071F8BDF8B576 +:108FB000D04A8100555800902E468036B07B48221A +:108FC000C2407088B1880832884200D8084610181C +:108FD00095304000CA4900F0B7FFEA7D296E401C79 +:108FE0008A1A101A801E2F4644084037F88FC0078F +:108FF00013D0C1487A8E008980184843192189010D +:1090000000F0A2FFBE49103000F09EFF241A388EF7 +:10901000002802D0844200D30446009870214843BF +:10902000B84941180C80B74940394018C487708846 +:10903000B18840184B214000C9004018A86528613C +:10904000F8BDFEB507468000AA4A019010580028D6 +:109050004AD0064638020A46411CA948633801F046 +:10906000F9F930462430009001F069F8344605469D +:1090700080341CE0207AA17A800040180006010D9F +:10908000A1480918488F8007800F012806D00228C0 +:1090900004D0032802D1888F00F0EBFF207B04214D +:1090A000401E2073A07A401C00F04EFFA172207B6E +:1090B0000028DFD1308C002809D000F0DAFF06E06C +:1090C000A88800F0B5FF009801F039F80546002D9A +:1090D000F6D139460420F4F7A7FF304601F02AF90B +:1090E0008449019800220A50FEBDF8B50546814921 +:1090F00080000C58824B264640362902B078643BEB +:10910000491C012804D002280DD0032824D10FE0E7 +:109110000322184601F09EF92846FFF748FF226E09 +:109120008034A17B15E00822184601F093F913E082 +:109130000522184601F08EF9204620302746417C52 +:1091400080377973007CB8732846FFF730FFB97B0E +:10915000226E2846FFF7FDFE0020B070F8BDF7B57F +:1091600088B008988C46810062483C27445800200B +:109170000590254600904035E88F666C810723D521 +:10918000C00721D02146002080310874002A1BD05E +:10919000E88D002818D0EA8F530515D5530713D44E +:1091A000120711D4AA78002A04D0AA8E2B8812188C +:1091B0009A4209D2226E424392191601EA8E36096A +:1091C0001018E886012008740121C9066046801B3A +:1091D00000010009884207D2206E80190601E88E3E +:1091E0003609401CE886F1E7606D0190A8780128F7 +:1091F00046D1204620300290C07F002840D1A88E62 +:10920000E98E40182988401A81B24048814237D2FD +:109210000298807F002820D1208F80190601E88FD6 +:109220003609C10704D0A18F490889190E013609F2 +:10923000226B2266618FE985626B62660121029A68 +:10924000C007917706D08820005DFFF759FEE88FB0 +:10925000C00702D102990120C8770196A88EE98E35 +:1092600040182988401A80B205E0226E0199891AB7 +:109270000901090901910146401E80B20029F4D17B +:10928000E88F800701D5606E01E0206E80000390BA +:10929000C6E00296E88F0690C00764D000200490D4 +:1092A0002A20285E0090E16C701A01011248090919 +:1092B0000289688E101848431921890100F044FE84 +:1092C000470006984037800705D401200490A88DF8 +:1092D0000B494843C719A878012807D120462030F8 +:1092E000817F002902D0C07F002811D00498002877 +:1092F00013D018E0C09200209892002090D0030074 +:10930000710200008081002080830020FF7F000028 +:10931000A08FFD494843C71905E0FB49206E48432B +:109320004008B84270D979080491F749049800F0D0 +:109330000BFE0299091A090109090291F2494843F1 +:109340000499091A0098401A009008D50298EE492D +:10935000401E000100090290009840180090A06093 +:10936000A06DC1192161029860602046F4F7EDF903 +:10937000002860D0A07D401CA075206E80190601D9 +:10938000E88E3609401C81B2E986A878012847D1C9 +:10939000204620300290C07F002841D1A88E40187E +:1093A0002988401A81B2D948814239D20298807FF7 +:1093B000002821D1208F80190601E88F3609C107C6 +:1093C00004D0A18F490889190E013609226B226643 +:1093D000618FE985626B6266C00703D08820005DFB +:1093E000FFF78EFD029901208877616E0391E98F66 +:1093F000C90701D10299C8770196A88EE98E401855 +:109400002988401A80B206E012E0226E0199891A7A +:109410000901090901910146401E80B20029F4D1D9 +:109420000198301A010103980909814200D230E7FE +:10943000059800280CD00020892108556664E88F23 +:10944000C00703D0009828853C37A7640BB0F0BD57 +:10945000E88F800701D5082100E03E210898FFF73A +:10946000F0FDF3E7F0B5AA4980000D5887B0E86A2F +:10947000002808D1686AE862002804D0C088810505 +:10948000890D7C2041532C464034E08FEE6AC006A3 +:1094900009D5002E07D0A08F002802D130680028FF +:1094A00001D0012000E000200290298C014318D057 +:1094B0002F468037387B042815D1F87A0421C01C48 +:1094C00000F042FD387A800008180006010D91482E +:1094D0000818018FC90B04D1428F10218A430A4317 +:1094E000428707B0F0BD04900428FAD2288C0028E7 +:1094F00007D0698C039003200190009100202884FC +:109500002DE002980028ECD0A08F002808D1306808 +:10951000002805D00646E862C0888005800DA08737 +:10952000F088B1888205920D8A18A18F521A92B2E2 +:1095300003928204920F012A00D002220192BA798A +:10954000914200D311460091032109038843012170 +:1095500009034018F080A08F0099401AA087387A3C +:1095600082000292F87A1118C9B205910421C01C38 +:1095700000F0EAFC029A8818C2B2E08FC10609D551 +:10958000002E07D0A18F002902D13168002901D017 +:10959000012100E000210291410603D50099091D37 +:1095A00089B2009181040DD40299002908D1C00725 +:1095B00008D00198032803D05748C07AC00701D0CB +:1095C000012000E00020059B00999C460902000153 +:1095D000019B01431943634618014E4BC018418754 +:1095E00003998187E18F890409D41101C9180A8F71 +:1095F000D20B04D14B8F1022934313434B87018F1F +:109600004904490C0187F87A0421401C00F09CFCB5 +:10961000F972387B401C38730498401CC0B262E772 +:10962000FEB505007ED02E468036377A00202C46C7 +:10963000403401970290A08EE18E4018A086019FD1 +:1096400070214F433549791800910886E08FFF213A +:1096500001318843E087800516D5E08EF1794843D3 +:10966000618F4018252100F06FFC08B2002801DA54 +:10967000253000B2294AC1B2403ABB181A8D92096E +:1096800092010A431A8560870020E086E08FC007B8 +:109690001BD0A86C2249401C400888420CD91A49AA +:1096A0004A1E801800F050FC0121C90301431B48E9 +:1096B00040383818C18508E0C1030120C0030818EC +:1096C0001649000C40397918C885A178002941D085 +:1096D000A08E2288801A0D4A80B290423AD2284643 +:1096E000203002290CD1009A298E5180009A698E6F +:1096F00091800099027DCB885B095B011343CB808D +:10970000A17803291ED10EE071020000FF7F000046 +:10971000C092002080830020989200208081002049 +:10972000FF3F000029E0FF49427C7918CB8A0C27D3 +:10973000BB4392001343CB82027CCB8A9B089B00E5 +:109740001343CB82A178012902D1C07F002801D028 +:10975000012002900020019B00901A46F249284601 +:10976000F4F71AF9707A022801D001207072029879 +:10977000002802D0307AFFF7B8FCFEBD10B5040017 +:1097800015D000F0E9FF0146226E606C80180001E0 +:109790000009606420464030C28E521CC286A07D03 +:1097A0000022401CA0758034207AFFF7D8FC10BD41 +:1097B000F1B500988100DD48445821468031487A4F +:1097C00000282AD125464035E88FC00725D0087CDF +:1097D000002822D0274600F0BFFF616C0646881B98 +:1097E0000001216E0009884217D900213846F4F79C +:1097F000A5F8216E06E0401A000100096064E88EB9 +:10980000401EE886606C821B120112098A42F2D85F +:10981000002231460098FFF7A2FCF8BDF3B587B0EF +:109820000798C24E8700F0590C250C4600287DD1C0 +:109830000021942000F024FDF051002876D0074646 +:109840000020029000F088FF059007989422049071 +:10985000B74B002138469847B648F861B648B8611A +:109860000320F87500211020B960B8754002B88255 +:109870003E46803607983D4630724035E88F4208B4 +:1098800020785200002800D00120024301208002ED +:109890008243EA870020A886E88668872046203031 +:1098A000039000798000A885608C8100F96520898B +:1098B000810039666089E885A0894101796603984D +:1098C0004079F071A07BF3F74FFC6886E88F102198 +:1098D0000843E88700213173B172F1723984F9626B +:1098E000A9871B22FF21328049317180B180B2717A +:1098F00003998979717303998979B1730021F1739F +:10990000C00702D0307AFFF7FBFA217804980029CB +:109910007ED0032170225043824A03468018009073 +:109920000190018203981121807900E0E6E00902AC +:109930008200114301430198C18204980102202052 +:109940000143019841820198218AC1830198618A6B +:109950000184A17E607E090201430198418401983F +:10996000E17E828C120A12020A438284E07B002884 +:1099700000D00120F1790122D2034003C90602433D +:10998000C80C024301980285664A002140329818AB +:1099900004900187E98F10158143E07B00286CD08B +:1099A000002040020143E987019906204885079875 +:1099B000FFF7FDFA04997C20088104990020488172 +:1099C0000146019A1E20D085049AA08A5080049AEC +:1099D000E08A9080049A207ED08001984187019887 +:1099E000C28ED209D201C2860198828D52085200DD +:1099F000828500200190307A0199800004904018FF +:109A0000C0B20690481C042100F09EFA049800E0C1 +:109A100031E0081801060A0D7721C90051188A089B +:109A20000121C90306981143020144481018018717 +:109A30000021418781870198401C01900428DADBCE +:109A4000307A81017720C000081800998008888644 +:109A5000EB8FD80713D00399E0698A79FF21593138 +:109A6000D140228C083149005118354C89B28446C6 +:109A7000624202910FE002214CE7012091E7E16987 +:109A80000020F9646885E06913E00919401C89B277 +:109A90000001000902919142F7D26146F9640299EE +:109AA0006985F96D001D0818A98D4908081800017D +:109AB0000009F96C396579657864D80700D0029897 +:109AC000D90700B2288504D01D4AA98D52425143BE +:109AD00000E03C21B964D90700D10020B860002221 +:109AE00005990798FFF73BFB00200090388A317AF0 +:109AF00083B204203A6EF4F784FA0025284609B0B0 +:109B0000F0BD70B505460C22EFF3108472B68300E9 +:109B10000648C058002826D003468030427A002AE2 +:109B200013D00FE040810020EBB70118C092002055 +:109B3000750F00007D970118219601188083002081 +:109B40008FFDFFFF012A0DD10AE0002908D0002176 +:109B50001846F3F7F3FE16212846FFF772FA01E0E4 +:109B600002214172002284F31088104670BD70B546 +:109B700005460C20EFF3108472B6AE00ED4B9B59F6 +:109B8000002B0DD01A8459844033D88F0821084304 +:109B9000D8872846FFF766FC2846FFF709FE002015 +:109BA00084F3108870BD70B505468400E2480C232C +:109BB000005900282FD040300278D24392072AD093 +:109BC000CA88960522D0C678002E04D09E02B243E1 +:109BD000CA800022C270EFF3108672B6D5480059D1 +:109BE000002810D00446243000F08CFA2046403083 +:109BF000C18F08221143C1872846FFF733FC28464E +:109C0000FFF7D6FD002386F3108804E09104890F46 +:109C100001D10121C170184670BD70B506460C20F7 +:109C2000EFF3108572B6B300C24AD258002A14D09E +:109C300014464032D08F102398430B011843D0872D +:109C4000002909D03046FFF70DFC8034207B002826 +:109C500002D03046FFF7ACFD002085F3108870BDC0 +:109C6000F0B504460C20EFF31086079F72B6A500EE +:109C7000B04C6459002C16D025464035A8780028F1 +:109C80000DD10120A8702F808800A0879000208728 +:109C90009800206305986087069840016063002063 +:109CA0002034A077E07786F31088F0BD70B50C24DF +:109CB000EFF3108572B683009E48C05800280CD080 +:109CC000034640339E78002E07D102249C701A80F0 +:109CD00005229A4B30309847002485F3108820469F +:109CE00070BDF8B507460C20EFF3108672B6BD00C4 +:109CF000904C6559002D0DD02C4680342280618017 +:109D0000A3803846FFF753F9A17B38462A6EFFF748 +:109D100020F9002086F31088F8BDF8B594460C278A +:109D2000EFF3108672B68400824A1459002C14D0C6 +:109D300025464035AA78002A0FD10322AA702B802D +:109D4000224620321174634653748E22125D8A4279 +:109D500002D9226EFFF7FDF8002786F310883846F7 +:109D6000F8BD70B505460C20EFF3108472B6AB0059 +:109D7000704AD358002B0AD004290BD08E20C05C27 +:109D8000884203D91A6E2846FFF7E3F8002084F3CF +:109D9000108870BD1A6E8033997BF4E7014600206D +:109DA000EFF3108272B68B006249C958002901D0C6 +:109DB0004031888E82F310887047F8B500259C46A4 +:109DC0002E462C46EFF3108772B683005948C058D0 +:109DD000002807D0034640339C8EDB8E466CE31888 +:109DE000056E9CB287F310880123601ADB0398424A +:109DF00000DC081B910400B20C0C6843614680191A +:109E00004900401A00010009214600F09DF8601A3F +:109E1000A04200D100204A494843401C4010F8BDF0 +:109E200010B5444A8300D258002A10D070235843FA +:109E3000444BC018438A0424A3438C002343438229 +:109E40004032D08F4023984389010843D08710BD0A +:109E500010B5384A8300D258002A10D070235843D6 +:109E6000384BC018438A0224A3434C002343438247 +:109E70004032D08F2023984349010843D08710BD3A +:109E8000F0B52C4C8300E358002B2ED02D4F7023BF +:109E9000002458434037C3199C84DC841C855C85AE +:109EA0009C85DC85234615196E782D7836022E4365 +:109EB0005D004519ED19AE83A41C5B1CDBB2E4B256 +:109EC000042BF0D300220F23CC1825781D3C247FCF +:109ED0002D0225436CBA55004519ED19AC819B1E26 +:109EE000521CD2B2DBB2082AEED3F0BD01460020EC +:109EF000EFF3108272B68B000E49C958002901D0C9 +:109F00008F20085682F31088704710B50146002054 +:109F1000EFF3108472B68A0006498958002906D0EA +:109F2000086D096E4008490800F00EF888B284F305 +:109F3000108810BDC092002088920020190F0000E8 +:109F4000710200004081002030B50B460146002020 +:109F50002022012409E00D46D5409D4205D31D462F +:109F60009540491B2546954040191546521E002D27 +:109F7000F1DC30BD70B500242546002801DA01244B +:109F80004042002901DA01254942FFF7DDFFAC42DA +:109F900000D04042002C00D0494270BD30B474461D +:109FA000641E2578641CAB4200D21D46635D5B00D5 +:109FB000E31830BC1847000010B54B4C0021208836 +:109FC00000280DD000F06FFB1F21081A2188C0B2B5 +:109FD0000122824091432180DF21C001C900411844 +:109FE000084610BDDF21C90010B5401AC109EFF3C2 +:109FF000108072B63C4A138801248C40234313809E +:10A0000080F3108810BD10B5374C002061880029FE +:10A010000DD0084600F047FB1F21081A6188C0B226 +:10A020000122824091436180C0000019183010BDA8 +:10A030002E492D4A40185188C009012383401943F5 +:10A040005180704710B5284C0021A08800280ED000 +:10A0500000F029FB1F21081AA188C0B2012282400A +:10A060009143A180182148439721C900411808460F +:10A0700010BD972210B5D2001821801AFFF764FF97 +:10A0800019498A88012383401A438A8010BD10B57C +:10A09000154C0021E08800280FD000F004FB1F21A0 +:10A0A000081AE188C0B2012282409143E180820017 +:10A0B000002112195181401CC1B2084610BD0A4945 +:10A0C00080004018001D704759210901884202D3C1 +:10A0D000401A800900E0401E034AD18801238340D2 +:10A0E0001943D180704700000890002008F4FFFF5A +:10A0F00001460020096802E00968401C80B200297E +:10A10000FAD170470268002A05D0426811604160A8 +:10A110000020086070470160F9E70368002B05D054 +:10A120004368196042600020106070470160F9E7E1 +:10A130000268002A00D141600A600160704702464F +:10A140000068002804D001681160002900D1516026 +:10A15000704710B500242346026805E08A4201D109 +:10A16000012405E013461268002AF7D1002C07D01D +:10A170000A68002B06D01A6042688A4200D1436008 +:10A18000204610BD0260F7E7002906D013680B6077 +:10A190004368934200D14160704703681B680360C5 +:10A1A000F6E71368002905D00B604368934200D19D +:10A1B000416070470360F8E7F7B50F460646002593 +:10A1C000046814E020460299B84700280DD02068A2 +:10A1D000002D01D0286000E030602068002802D007 +:10A1E0000020206005E0756003E025462468002C0F +:10A1F000E8D12046FEBD10B40C000ED0002301684B +:10A2000001E00B460968A14201D00029F9D1002BD9 +:10A2100003D01A60116010BC704710BC114687E76C +:10A220000B000DD0016800E00968994202D00029B6 +:10A23000FAD105E0002903D00B68002B02D002E020 +:10A2400011465FE74260086810600A607047F7B522 +:10A2500004680E4607460025002C08D0029A2146C5 +:10A2600030469047002803D125462468F4E77E60F5 +:10A270003460002D01D02E60FEBD3E60FEBD0000AA +:10A28000F3B5C01C00248508AD002D1D81B0264605 +:10A2900027460C2D00D20C25EFF31080009072B6EB +:10A2A000029802213018FFF74FFE0806810D4F4833 +:10A2B0002A46081880690C320EE04188A9420AD368 +:10A2C000914202D28368002B05D0002C02D0638813 +:10A2D0008B4200D9044640680028EED1002C03D000 +:10A2E0006088904200D20546761CF6B2022E02D259 +:10A2F000002CD5D001E0002C0BD06088A8420CD1F6 +:10A30000A16860684860606800280AD0A168816020 +:10A3100007E03748F2F79CFE07E0401B80B2608000 +:10A320000419658033482080271D009880F3108829 +:10A330003846FEBDF0B50023021F2F491180548816 +:10A340001946EFF31085AC4672B69D00274E5F00AC +:10A35000AD19AD69BE19368CA84204D3AE19864238 +:10A3600001D3294601E05B1CDBB2022B01D200299C +:10A37000EBD00020214B2DE04D886D18954211D176 +:10A380004888001982B24A8048685318984228D1F8 +:10A390004388D2184A8042684A604068002820D02A +:10A3A00081601EE08A4213D24260906010191380CF +:10A3B000884209D1486850604868002800D082600F +:10A3C0004888001950800CE051608A60548008E091 +:10A3D000084649680029CFD142605160906054809E +:10A3E0001380604680F31088F0BD0000509000207C +:10A3F000F2F2F2F2388300000FF000005AA50000DC +:10A40000F8B504460F4618461D46164601210C3085 +:10A41000FFF736FF0021C94301608480C7800681B1 +:10A4200045810C30114B04462A46002198472046AE +:10A43000F8BD10B501460C39EFF3108472B60C4824 +:10A44000FFF760FE0B48016808221143016084F3A6 +:10A45000108810BD10B50023FFF7D2FFFFF7E9FF0A +:10A4600010BD03460C3BD9801A81E2E7750F00004E +:10A470005090002094900020F8B50C460746010A41 +:10A48000C0B2082822D21A4A8000125800209047F1 +:10A4900000281BD00178A14218D004701548164D31 +:10A4A000082600903A4615490098FFF785FE0100FE +:10A4B0000CD0EFF3108472B60E480838FFF722FE76 +:10A4C00028683043286084F31088EBE7F8BD10B5A6 +:10A4D000010AC0B2FF24082807D2054A800012589A +:10A4E00000209047002800D00478204610BD0000CE +:10A4F000749000205890002094900020A9D000185B +:10A50000F0B50746414885B015460E46824201D94E +:10A51000054602E0002D00D10A253A043D483243A9 +:10A520003B490490FFF748FE040006D101211020AA +:10A53000FFF7A6FE87800446C680EFF3108672B64A +:10A5400002A800F014F986F31088029800907D208C +:10A550000399000145436D1801912F492846FFF7E3 +:10A56000F3FC2D492D4A4143691AE160009908180E +:10A5700000010009A06021460498FFF768FE254805 +:10A5800010380069A04203D1C168806800F029F941 +:10A59000E168A068F2F79CFD002802D0042000F0DA +:10A5A0003FF805B0F0BD70B51A4C0246103C256965 +:10A5B000002D29D0AB88174893421AD1EB888B42E3 +:10A5C00017D1FFF7BCFD2469002C0DD0E168A0680D +:10A5D00000F007F9E168A068F2F77AFD00280ED0D4 +:10A5E000042000F01DF80AE00021481E00F0F9F8F0 +:10A5F00005E012040A430649FFF7DEFD0546002D7B +:10A6000002D02846FFF796FE70BD0000FFFF7F02D4 +:10A610003BD10018609000207102000013D1001897 +:10A6200010B5EFF3108172B60A4B1A68012484400A +:10A6300022431A6081F3108810BD10B5EFF310812A +:10A6400072B6044B1A6801248440A2431A6081F355 +:10A65000108810BD94900020410855221140401AE6 +:10A660000246332180080A400840101801090818E2 +:10A670000007000F70472021020401D0102110466E +:10A68000020201D010460839020101D01046091F0C +:10A69000820001D01046891E420001D01046491E9A +:10A6A000C00F081A70472021020C01D0102110465B +:10A6B000020A01D010460839020901D01046091FCC +:10A6C000820801D01046891E420801D0881E7047BA +:10A6D000081A70470021425C002A01D00020704710 +:10A6E000491C0629F7DB0120704710B50022835C66 +:10A6F0008C5CA34201D0002010BD521C062AF6DB60 +:10A70000012010BD0549064A08685043054A8018D3 +:10A71000086040087047014908607047D8920020DF +:10A720006D4EC64187D612000A49002804D04869F8 +:10A730004004400E1830704708694004400E28302D +:10A740007047002902D080002C307047C000503084 +:10A75000704700008000005001200D49C007886349 +:10A76000886BC00FFCD1886B000100097047012184 +:10A77000074AC9079163916BC90FFCD1916BD26BEA +:10A780000901090927231B019A1A06C07047000016 +:10A79000C00000500521431C10220907002B06D0E1 +:10A7A000694B58620A6288699043104301E08869E6 +:10A7B00090438861704710B50522441C202312077E +:10A7C000002C0AD027242401611A5F4CA062E162A8 +:10A7D000136290699843184301E09069984390612F +:10A7E00010BD30B5EFF3108472B6451C052240232E +:10A7F0001207002D0AD027252D01691A524D286312 +:10A800006963136290699843184301E09069984323 +:10A81000906184F3108830BDF0B50020844601209B +:10A82000494EC007B063B06BC00FFCD1B06B0501DF +:10A8300046482D090088002845D145480068002871 +:10A8400041D10121C906002205200007836970203B +:10A85000034038D03F4FD80609D5706A401B040129 +:10A860002409A01EB8422ED28C4200D2214698065E +:10A870000DD5B06A401B04012409A01EB84222D2A3 +:10A880008C4204D2F06A214627221201121A58067D +:10A8900012D5306B401B00010009831EBB4212D24F +:10A8A000884209D8736B27242401E31A884201D314 +:10A8B000934201D201461A46F06B80180A228009A1 +:10A8C0005143401884466046F0BD7FB504461020D1 +:10A8D000EFF3108272B61D4B1D8805431D8082F375 +:10A8E00010881E4E1C481D4D5C36002902D01022D7 +:10A8F000A84702E010220021B047002C04D010220B +:10A9000021466846A84703E0102200216846B04768 +:10A910000D48009940384163019981630299C163F0 +:10A92000094A039911604C21516004210522120744 +:10A93000116293698B430B439361026B01218A433C +:10A940000A4302637FBD0000C00000500090002059 +:10A9500094900020FFFFFF0730810020190F0000B6 +:10A960001FB50220FFF769FE054B68461022034918 +:10A97000984769460020F2F781FC1FBD4081002006 +:10A98000190F000070B5EFF3108572B62048FFF77D +:10A99000D6FB040002D00020C043206085F310885D +:10A9A000002C26D020464038808F1A49884220D17A +:10A9B000E088194B010A0006A288800D1B5810463A +:10A9C0009847051E05D021460C312389E288A088CE +:10A9D000A847002804D001280BD0022809D103E0A1 +:10A9E0002046FFF7A7FC04E0094821460830FFF79E +:10A9F00089FBEFF3108072B605490968002904D17C +:10AA000006490A6808239A430A6080F3108870BDDB +:10AA10005090002038830000749000209490002013 +:10AA20007FB51C4D0420FFF708FE2C69002C30D0A8 +:10AA3000EFF3108672B66846FFF799FE86F310882A +:10AA400001990098039102900146A0680122411AE1 +:10AA5000C91E09010909D20691420CD2E168FFF72B +:10AA6000C0FEE168A068F2F733FB002811D0002196 +:10AA7000481EFFF7B6FE07481030FFF760FB04469C +:10AA8000C1888088FF22FFF7E5FC2046FFF752FCD3 +:10AA9000C8E77FBD50900020F8B50620FFF7CDFD38 +:10AAA000104E3588002D1BD0002401270CE03846BD +:10AAB000A040284204D07088C1B22046F7F7A7F81A +:10AAC000641CE4B2032C02D270880028EFD13088D5 +:10AAD000002805D07088002802D00620FFF7A0FDCE +:10AAE000F8BD0000F4910020F1B590B0109800245A +:10AAF00080000B90E2E0E8481C21807A4843E74957 +:10AB00004518688A3D21084206D1A88A0107090F25 +:10AB1000052902D0032971D0CEE0A88CE049222279 +:10AB20004118E04E6846B0476846428BDE49104601 +:10AB30000A388842F0D86846C18A0629ECD3192021 +:10AB4000C0018142E8D86846008BFF23F433984265 +:10AB5000E2D8401C484391008842DDD2A88A694669 +:10AB60004006C00F0D90062209A83346984709A851 +:10AB70000D99F9F75BFC0028CED12C23FF22002190 +:10AB8000CA48FFF73DFC0746041D688B298B00046B +:10AB90000843A98B272289050C90890D1201E88AA8 +:10ABA000561A800BFFF7C0FD4000301ABF4906B2AD +:10ABB0006B3106E0701806B20C98401E00010009C7 +:10ABC0000C90002EF6DB1098387000207870012071 +:10ABD000F8702070B6490B980858808EC00603D5CF +:10ABE000A88A8006C00F00D00120E0730B98085897 +:10ABF000018F002903D02030807E01E042E0002058 +:10AC0000B87004222046A74B103003A998470322AE +:10AC10002046A44B193004A998476846C17C2046B9 +:10AC200020300E9001716846808A60846846C08A30 +:10AC300020816846008B60816846408BA081052298 +:10AC40002046984B143007A9984708A84078062258 +:10AC5000C1060E98C90E417108A84078914B400971 +:10AC6000A07309A9A01C98470D9860700C98E0612A +:10AC70002684E88A810B0E9881713846FFF7D9FB4C +:10AC8000012419E08A490B9808582030407F002899 +:10AC900012D0A88C82490C224118824E6846B047D7 +:10ACA000A88A69464006C50F062203A8B04703AA32 +:10ACB00029461098F4F75DFCFDF756F81098FDF75B +:10ACC0006BF8002800D016E7204611B0F0BDFEB5A5 +:10ACD000064677488B00C458002C41D00027002A34 +:10ACE00016D0012A14D0022A3AD0042A38D1254697 +:10ACF00008462035297F02297CD001212046F2F721 +:10AD00001DFEA08E000776D5A07D401CA075B3E087 +:10AD10000091019201212046F2F710FE25462035D0 +:10AD2000A87E401CC0B2A876297F022904D0218FBA +:10AD300000290BD0884209D3218F002903D08842F3 +:10AD400001D3432200E00022012106E0E87EFFF764 +:10AD5000CBFE002805D0002211460098FDF76AF8C6 +:10AD6000FEBDA08E400711D42A78002A05D0012309 +:10AD700000210098FDF790F82F706A78002A05D01E +:10AD8000012319460098FDF787F86F70A08E494996 +:10AD90000007019813D5002802D0A07D401C00E0D8 +:10ADA0000A20A075A182606A6660E0602046F2F722 +:10ADB000CCFC002801D12F77FEBD3C22C4E700283F +:10ADC0001AD0A06A301A0201E06A120940008242D9 +:10ADD00002D3A07D401CA075A662E87F002802D0A7 +:10ADE0006068B04202D0606A401C08D0A182616AEB +:10ADF000E16006E031E032E00522A275ECE72E4981 +:10AE0000A182FFF77FFC1121FFF79EF84804E97F3C +:10AE1000000C002907D0002802D0202802D002E030 +:10AE2000012000E01F20E16A49008919081801018A +:10AE3000090920466160F2F788FC0028BBD0E87F52 +:10AE4000002803D00021C94361602F77606A411C4C +:10AE5000B2D0E1688142B0D0FEBD002219E0A06A04 +:10AE6000301A0101E06A09094000814204D3A07D43 +:10AE7000401CA0756168A1622046F2F766FC0028BC +:10AE800099D0E87F0028E7D1606A401CE4D0E87ED2 +:10AE90003C22012162E700009892002000830020FC +:10AEA00000800020190F0000760C00000602000050 +:10AEB000A892002001A0000001600000F0B5810010 +:10AEC000B54889B0006841580591407A8006000E67 +:10AED000203103910890D8E0B0481C21807A484383 +:10AEE000AF494518A88C00900598AE4A408E904214 +:10AEF0007ED8688A3D220290104001D0102877D178 +:10AF00000020059C01903E3406900490FF27039892 +:10AF1000012207944277A88A0607360F072E44D2EB +:10AF20000027042E0CD1A04900984018211DFFF7DE +:10AF3000DCFB002812D00398407E062811D01B2786 +:10AF400024229A4B002120469847012E0BD0002E38 +:10AF500011D0022E11D0062E11D011E0FF20A075C5 +:10AF60008FE01A27ECE7A88A15270006C00F207685 +:10AF7000062001900BE0132702E0102700E01227C3 +:10AF800006200690A88A000A801FC0B20490002004 +:10AF9000A075677560760421A176A0747F20E076A5 +:10AFA000A88A4006C70FE77502E0A07DFF2868D099 +:10AFB0000298C00607D5607D4007CFD57648006867 +:10AFC000407C0128CAD9607D15281ED1019A0099BC +:10AFD000754B891889B2C9182046744B0A3006226D +:10AFE0005C3B9847688A4006C00F00D0012000E013 +:10AFF00049E06070688A4006C00F06D1207E0028B4 +:10B00000ACD0E07B80090328A8D0FF2F12D066497E +:10B010000098231D41181846644B06225C3B984754 +:10B0200002980006C00F2070288C60800298C0062D +:10B03000C00FE0742423FF2200215D48FFF7E0F9F0 +:10B040000746E88A2077594B242238465C3B07990B +:10B05000984704987877049800280BD00098388493 +:10B060000698B8774D481C22807A002150434C4AFC +:10B070008018818448480068407A38753846FFF760 +:10B08000D8F903984676FCF76FFE0398007DFCF72D +:10B0900083FE002800D01FE7089801014048803057 +:10B0A0000818018FC90B03D0018F4904490C01878F +:10B0B00009B0F0BDF8B5044637480068002832D022 +:10B0C0008B00C05800282ED00027002A13D0012A58 +:10B0D00011D0022A46D0042A25D10446FFF73CFBB2 +:10B0E000214605462031087E02283FD000200F76F9 +:10B0F000002816D13CE01646024620300091017E21 +:10B10000057D022904D000210776002904D10BE037 +:10B110000121F9E7FCF728FE2846FCF73DFE002850 +:10B12000F8D1FDF733F9F8BD01211046F2F706FC1E +:10B13000702045431F482818418D4905C90F04D088 +:10B14000418D01229202914341850098FFF7B6FE9E +:10B15000002E01D0012200E0002221460098FDF7D8 +:10B160005AF9F8BD0846FFF7A9FEF8BD0120BEE771 +:10B1700001212046F2F7E2FB606A281A0101A08D46 +:10B1800009094000814203D3A07D401CA07565627F +:10B190002046F2F7DAFAF8BDB89200209892002023 +:10B1A000008300207206000000800020750F000060 +:10B1B0000102000040810020F0B58100CB4887B03B +:10B1C0000568685802902030019060E0C8481C2152 +:10B1D000807A4843C7494418608A3D21084253D1C8 +:10B1E0002E462036307E00284ED1A08AA18C000742 +:10B1F000000F05910121019A0028917501D00128C5 +:10B2000042D1A08AE18A000A890B0091618B0A046D +:10B21000218B0A430492A18B27228905890D1201F3 +:10B22000511A22300391C0B20099FFF78AFA0746FB +:10B230000098FFF779FA381A039940004018AE4990 +:10B24000FF304A1E2D308018FEF77EFE049A8018CB +:10B2500000010009E863208CA886A08A8006C00F40 +:10B2600000D00120402148550098B075A34B0599A6 +:10B270000298C9180622A24B2E309847A08A400691 +:10B28000C00FE87601203076FCF76EFD0198007E55 +:10B29000FCF782FD002899D107B0F0BDF0B5810020 +:10B2A000924889B0056868580690287D2F46800628 +:10B2B000000E20370590387E00287DD005980101CA +:10B2C0008C4880300818008FC00B75D041202C238B +:10B2D000FF220021C000FFF793F80490041D069898 +:10B2E000B97D0A2220305143007E4E197021484317 +:10B2F00084494018808C80000790E86B0190708929 +:10B3000041000198401A3189000189000009029129 +:10B3100008360391FEF718FE08460399091A0198AA +:10B3200008180101090901980091081A01010798FC +:10B330000909814205D200990298401800010009CC +:10B34000009000202070E87E0622C007C00F6070C9 +:10B350000699A01C6A4B2E319847294604221C31BD +:10B360002046674B10309847308820817088608471 +:10B370002946052215312046614B14309847049820 +:10B38000317A41702046B97D203001908171B088BA +:10B390006081F088A08103222046594B394619303C +:10B3A00098470198F9780171019839794171787954 +:10B3B000A0730098E06100E00DE04020405DE07384 +:10B3C00004980121C1700498297D01700498686077 +:10B3D000FDF7D2FA01E000203876059801014548D2 +:10B3E00080300818018F4904490C018709B0F0BD6D +:10B3F000FEB53E4B05461868002833D08C00005936 +:10B4000000282FD00027002A13D0012A11D0022AA9 +:10B4100052D0042A26D10446FFF79EF9214605465C +:10B420002031487B02284BD000204F73002817D1D1 +:10B4300048E016460246203000950191417B057E8A +:10B44000022904D000214773002904D10BE0012117 +:10B45000F9E7FCF789FC2846FCF79EFC0028F8D1A8 +:10B46000FDF78AFAFEBD01211046F2F767FA702057 +:10B470004543244840382818418D4905C90F04D058 +:10B48000418D01229202914341850198FFF794FE7C +:10B490000198FFF703FF154800680028E2D0005923 +:10B4A0000028DFD0002E01D0012200E00022009908 +:10B4B0000198FDF7A8FAFEBD0846FFF77DFEFEBD28 +:10B4C0000120B2E701212046F2F738FA606A281A13 +:10B4D0000101208D09094000814203D3A07D401C59 +:10B4E000A07565622046F2F730F9FEBDBC920020DF +:10B4F000989200200083002071020000008000204C +:10B50000190F000080810020F1B582B00298F14946 +:10B51000800001900D582C468034207AA17A80005A +:10B5200040180299C0B20902009155E0708FB18FA6 +:10B530008007800F012816D0022814D003283AD1A2 +:10B540000846FEF796FDE4490198029B085800283A +:10B5500006D0006A4268002A02D0417A1846904715 +:10B560000322009922E0708F000A042805D97E2268 +:10B57000525B520601D5001F80B200281BD06F6AB3 +:10B580000818FA88B9889205920D8918884212D352 +:10B5900028462430FEF7D3FDE86AB84201D10020E6 +:10B5A000E862B888FEF744FD0099022283208000FB +:10B5B000491CFEF74FFF708F102188437087207B56 +:10B5C0000421401E2073A07A401CFEF7BDFCA1722E +:10B5D000207A80004018C0B2217B002905D00101EB +:10B5E000BE480E18308FC00BA0D14035E98F08201F +:10B5F0008143207B002800D00120C0000143E9875F +:10B60000FEBDF1B588B00898B24980000C580421FD +:10B6100025464035E88F8843E88708980002029065 +:10B62000DBE0AF491C22887A5043AC4A803A80184C +:10B630000090478A828A01929207920F0392C28AEF +:10B640000026D2B20692226D0592FA070BD0A54AC7 +:10B650001078401CC0B21070042803D3086800287A +:10B6600000D08047B4E09F4900220A70E98FCA07E2 +:10B6700004D0428B008B16040643E664C80570D4E0 +:10B68000FF2001300143E987C8070CD0A8780128C2 +:10B6900009D120462030817F002904D00121C177C3 +:10B6A0000898FDF722FDA88E2887E88FC00711D0E3 +:10B6B0000098808B27218005800D0901081A0490CD +:10B6C0008D20005DFFF730F841000498401A00B269 +:10B6D000854908E0606CE064206509E04018761E4A +:10B6E000360100B236090028F8DB688566642665F5 +:10B6F000E88F810707D402210843C207E887D20FE9 +:10B700000223029911E0C0071FD0206D410805985F +:10B710004008081A216E000100094908FEF714FCD0 +:10B72000002912D002230299FF226F48491C623877 +:10B73000FEF766FE0646206D216E40084908FEF7BA +:10B7400003FC31803046FEF774FEE88F410508D4D3 +:10B75000810706D50199490703D5012189020843CC +:10B76000E887380734D4E06C66210F4260652FD13A +:10B77000F80607D5E88F80210843E8870220892151 +:10B78000085525E00198060A22D0039800281FD00A +:10B79000042E04D9E88F800601D5361FB6B2009872 +:10B7A000878C514802990823FF226638491CFEF70E +:10B7B00027FE0780468003990171A98EC180FEF79C +:10B7C00038FEE88F04210843E88700990020888428 +:10B7D0008F2106980855FCF7C7FA0898FCF7DCFAA1 +:10B7E000002800D01DE709B0F0BDF8B50F46394874 +:10B7F00089004458002C3BD01300FEF7CFFB050412 +:10B80000043C40473900154601212046F2F796F8DE +:10B810008920005D022823D0FEF79EFF01462046C6 +:10B820004030C28F930724D5530722D4120720D467 +:10B830008278012A1DD00E22266E636C9B191B0193 +:10B840001B096364C38E26465B1CC386002D01D092 +:10B85000A27D521CB275C08FC005C20F384633E0BE +:10B860004034E08F000632D53D213846FDF7E9FB34 +:10B87000F8BD1022E0E73846FFF7C3FEF8BD3846B2 +:10B88000FFF742FE3846FDF7EDFDF8BDFEF764FF19 +:10B89000054601212046F2F751F820468030014646 +:10B8A000407A022813D0626C206E1018020112092F +:10B8B000204640306264C28E521CC286A07D0022A7 +:10B8C000401CA075087A2946FDF749FCF8BD1621F1 +:10B8D000CBE70000C09200208892002080830020E7 +:10B8E00098920020EB92002071020000F8B5052527 +:10B8F0002D07EC69534EA00726D502202862A96BBC +:10B90000514C3E206268521853085F00D21B4143DD +:10B91000CF184E4938466260FEF716FB4C49064385 +:10B920004E604A4A5043381A521E101A08600B20C3 +:10B9300028630120A861801E286221880820014315 +:10B94000042081432180F8BDE00737D00120286220 +:10B950000020A8613F49E9603D4B80339E63996BAD +:10B96000C90FFCD1996B3C4E0A013749120949882D +:10B97000CF0607D55F6AD71B3F013F09B74201D207 +:10B98000102738438F0607D59F6AD71B3F013F0911 +:10B99000B74201D2202738434F0607D51B6BD21A76 +:10B9A00012011209B24201D240221043264A8143B9 +:10B9B000A961138808218B4313800443E00606D550 +:10B9C00010202862A9698143A96100F01FF9A0062F +:10B9D00006D520202862A9698143A96100F040F8BA +:10B9E000200404D500F08EF80120C00328621B4912 +:10B9F000600608D540202862AA698243AA610868C7 +:10BA000010221043086060070CD504202862AA6940 +:10BA10008243AA610C4A13881026B34313800A6834 +:10BA200002430A60200706D508212962A8698843D5 +:10BA3000A86100F057F82869C00384D501200004EC +:10BA40006861F8BD000000800090002071020000D5 +:10BA5000400000501E0001000000000894900020EB +:10BA6000FEB5274D68462C68FEF781FE0126F606D6 +:10BA70002F460C3716E0E17D6068401A0099401AA5 +:10BA8000401C00010009B04224D200281ED0022828 +:10BA90000AD81B48FEF753FBA8608169002900D033 +:10BAA00088472C68002CE6D1386800280BD0082184 +:10BAB00005200007016282698A430A4382610168A6 +:10BAC000B14331430160F1F710FEFEBD0198A1685A +:10BAD0008842DED90A48FEF732FB01463846FEF7B7 +:10BAE00011FBDEE710B5064C0C342046FEF727FBB1 +:10BAF000002804D0C1690029F7D08847F5E710BDB8 +:10BB0000BC900020F8B505200007416A0801040F29 +:10BB10000E0F3B480A0701D5032202E0CA060BD5E7 +:10BB20000222A5004359002B05D0011980312818A5 +:10BB30000978006C9847F8BD314D4A07314B012711 +:10BB40008035002A31DA298AB74039421BD03201C8 +:10BB5000D11809888906490F062914D1B400035960 +:10BB60000422002B05D08119803120180978006C3F +:10BB70009847A87CB04203D1401C0007000FA8746E +:10BB8000288AB8432882288A002808D0411E084203 +:10BB9000D1D1A87C401C0007000FE874F8BD1A48FA +:10BBA0000188202291430180F8BD8907FCD522013C +:10BBB000D11809888906490F042911D00022A6004E +:10BBC0008359002B05D00119803130180978006C99 +:10BBD0009847288A3946A14088432882E97C04E0B6 +:10BBE0000122ECE7641C2407240F3A46A2401042CD +:10BBF00001D1A142F6D1AC740028D0D0F8BD00002C +:10BC0000D09000200080002000900020F8B501278F +:10BC100000250E4EFF06FEF79FFD3468002C12D063 +:10BC20006168401A00010009B8420CD20748FEF7CB +:10BC300086FAA168002901D020468847002DEAD065 +:10BC4000F2F702F9F8BD002CFAD1F8BD709100208E +:10BC50000246002000290FD1002A0ED035235B01B7 +:10BC6000D11A9A4213D00ADC0C49511813D0122968 +:10BC70000BD09E2900D10A4870470A487047062910 +:10BC800007D05229FAD10848704708487047084839 +:10BC9000704708487047084870470000FFF9FFFFE9 +:10BCA000B1F20018DD920020F9FA0018E1EE001858 +:10BCB0005DF10018A5F40018B1EC00180246002050 +:10BCC00003290FD2002A0ED0104BD11A9A4219D054 +:10BCD0000CDC0F49511813D00E4A89180ED00929CF +:10BCE00000D10D4870470D4840187047E0290BD02F +:10BCF000E12901D0E229F8D1094870470948704785 +:10BD00000948704709487047094870471207000002 +:10BD1000F9FBFFFF02FDFFFFBBE30018DE920020EE +:10BD20001D170118F1E10018CFE200189315011852 +:10BD3000FFE2001802460020032910D2002A0FD08B +:10BD400051231B01D11A9A421BD00CDC0E49511809 +:10BD500011D0FA2911D0FF39082900D10B487047BA +:10BD60000B4840187047012909D0302901D03129EA +:10BD7000F8D1084870470848704708487047084895 +:10BD80007047084870470000F9FBFFFFA5E700185F +:10BD9000E192002001E900185DE90018FFE40018B5 +:10BDA00005E80018BDE700180246002003290AD262 +:10BDB000002A09D00849511809D0FF39FC3908D0A8 +:10BDC000012900D1054870470548401870470548CB +:10BDD0007047054870470000F5FDFFFFD3EA0018E3 +:10BDE000E492002033EA0018C9E9001801460D4B1F +:10BDF0000020CA1A994210D007DC03290FD0FF395E +:10BE0000FF39032900D108487047012A03D0032ACB +:10BE1000FAD10648704706487047064870470648FA +:10BE20007047000005020000954A01186B4E01188A +:10BE300037480118C54C01186D4A01180246002008 +:10BE4000042912D2002A11D083239B00D11A9A42CE +:10BE500017D00EDCFF3A521E1BD0012A19D0062A39 +:10BE600015D0FF3A0C2A00D10B4870470B484018F8 +:10BE70007047012909D0022905D00329F8D10848C3 +:10BE80007047084870470848704708487047084896 +:10BE90007047084870470000ED530118E7920020F2 +:10BEA000AF740118435401188B570118CD52011873 +:10BEB0004B5201185D53011870B5064600F01AF98F +:10BEC000304600F07DF9304600F0A8F9304600F029 +:10BED00047F8304600F088FA304600F0D7F90524DC +:10BEE0001A4D2407002E14D0304600F0AFF800F0B1 +:10BEF000C5F8206840004008E10008432060206841 +:10BF0000C00FFCD1134912480862002028806860E5 +:10BF100070BD11490220F1F71DF91048A061012000 +:10BF2000288070BD70B509480088C00701D0012481 +:10BF300000E00224EFF3108572B600F05DF82046B1 +:10BF4000FFF7BAFF85F3108870BD00000090002055 +:10BF5000C8002C01C000005061A901180C8000002D +:10BF600010B51149002808D0104808803F204880AB +:10BF7000FF2088800F20C88010BD0D4B0020C2011B +:10BF8000C400D2186418401CA2830628F7D30020EE +:10BF900059231B0182018400D2186418401C22819D +:10BFA0000428F7D310BD000008900020FF03000014 +:10BFB000F80B000070B5054624221F4C00211D48D7 +:10BFC000A047202200211D48A047202200211C4814 +:10BFD000A0471B481B4901611B4900244161A00087 +:10BFE0002A586000401901892046F1F73FF8641C87 +:10BFF000E4B2022CF3D370BD10B50E48FEF79FF8E3 +:10C00000002802D0FEF796F9F7E70A4C08342046DC +:10C01000FEF795F8002802D0FEF78CF9F7E7054CFB +:10C0200010342046FEF78BF8002802D0FEF782F984 +:10C03000F7E710BD50900020750F000074900020AD +:10C040009490002085A9011821AA011810B5094C67 +:10C05000022808D12068002805D00648FEF76FF8AE +:10C06000FEF768F9F6E70020206003496060087079 +:10C0700010BD0000B4900020DC92002070B51422A6 +:10C08000144C00211248A047942200211248A047D6 +:10C090000020124A05461A2103019B181980401CF2 +:10C0A000C0B21028F8D30E482022056045600D4824 +:10C0B0000021056045600C48A04700210A48C9439B +:10C0C00001600A4801600A498180857170BD0000E5 +:10C0D000BC900020750F0000D09000200080002050 +:10C0E000649100207091002078910020D09200206F +:10C0F000E457000070B505001BD0012D11D0022DB2 +:10C1000016D100242046F2F728FD641CE4B2022C6C +:10C11000F8D300242046F3F7E2FD641CE4B2032CBC +:10C12000F8D3284600F030F800210620FEF7A4F9E5 +:10C1300070BD0E490620F0F7BEFF00240C480E4BE0 +:10C140000470282221460B4898470C490720F0F735 +:10C15000B2FF00200A4A0B4B3F2111548500401CBE +:10C16000C0B25C510328F8D370BD000051BC011867 +:10C17000DD92002098910020750F0000BDBC0118D1 +:10C18000DE920020C091002010B502280BD01022B2 +:10C190000A4B00210848984707480421183041718C +:10C1A000C171817110BD00242046F3F7BDF8641CF5 +:10C1B000E4B2042CF8D3EFE7A0910020750F000043 +:10C1C00070B5002400280ED001281CD0022809D107 +:10C1D000F6F7D2FA00212046F5F7FCFB641CE4B226 +:10C1E000032CF7D370BD09490520F0F764FF002048 +:10C1F000074A084B102111548500401CC0B25C5105 +:10C200000328F8D370BD0448046070BD35BD011823 +:10C21000E1920020E8910020CC91002070B500252B +:10C22000002814D001280DD002280FD10620FEF7D7 +:10C2300004FA002401212046F5F7B3FC641CE4B2A3 +:10C24000032CF7D30C4805800621418070BD0B49B3 +:10C250000620F0F77FFF0A490420F0F72CFF0020AA +:10C26000084A094B3F2111548400401CC0B21D51A3 +:10C270000328F8D370BD0000F491002099AA01189A +:10C28000A9BD0118E4920020F891002070B51D4D61 +:10C29000002829D0012817D0022824D11A4E0024C2 +:10C2A00001212046F8F753FE1C20604380190069E5 +:10C2B000002801D0FEF73EF8641CE4B2042CEFD352 +:10C2C00000210420FEF76FF90324842200210E4888 +:10C2D000A8470D481B2140308187FF214931C18784 +:10C2E00040300470447070BD08490020F0F7E3FE50 +:10C2F00007490120F0F7DFFE102200210548A8477A +:10C3000070BD0000750F000004920020EDBD011803 +:10C310003DBE011888920020F8B5FF25052401359F +:10C320002407022814D12068A84320602068400018 +:10C330004008E100084320602068C00FFCD1E060A5 +:10C34000401E60613349086901221203904308616D +:10C35000314820603148E0602E4931484031086260 +:10C360000026701C0621FDF7EFFD1C204143312003 +:10C37000000108188003010C1C2032464243294862 +:10C3800017183982FDF718FEB884761C062EE8DBF4 +:10C39000C420A0620020E062234E1F231B027021F4 +:10C3A000414389194A8A07029A433A434A82401C08 +:10C3B0000428F4DB2068A84328432060F8BD10B5AA +:10C3C00010221B4B002119489847FF20174CF530CD +:10C3D00020811848A0801848E080FEF793F9207368 +:10C3E00016490020087010BD10B5040010D0FFF7EA +:10C3F000E6FF2046FFF790FF204600F021F8204698 +:10C4000000F038F8204600F049F8204600F062F8C5 +:10C4100010BD0000C00000500F0610001E000100FB +:10C42000D902FFFF00830020408100209892002065 +:10C43000750F0000D6BE0000898E0000EB92002030 +:10C4400070B50B4D02280AD10324A00028580028FB +:10C4500001D0FDF76FFF641E64B2002CF5DA0020F6 +:10C4600001468200401CC0B2A9500428F9D370BD17 +:10C47000A892002010B5084C02280AD12068002894 +:10C4800007D00068002801D0FDF754FF2068FDF7B1 +:10C4900051FF0020206010BDB892002010B50C4C58 +:10C4A000022811D1206800280ED04068002802D050 +:10C4B0000C38FDF73FFF20680068002801D0FDF729 +:10C4C00039FF2068FDF736FF0020206010BD000016 +:10C4D000BC92002070B50E4E02280FD10024A5009A +:10C4E0007059002806D021460420F1F79DFD7059AF +:10C4F000FDF720FF641CE4B2042CF0D300200146B9 +:10C500008200401CC0B2B1500428F9D370BD0000B5 +:10C51000C09200200D0D0118C70D0118B50E0118AD +:10C520000D0F01184D0F0118890F0118CD0F0118BB +:10C530002710011857100118A3100118CF10011867 +:10C540000D2D0118412D0118672E0118ED2F01182E +:10C5500035330118BF330118633401187F310118D6 +:10C560008735011800000000FB350118EB36011873 +:10C57000A74301189D3B0118D73B01189B3C0118AC +:10C58000573D0118DD400118DD400118C541011873 +:10C59000DB3F01189142011800000000B54201186C +:10C5A000174301184D4301184D4301185B700118E2 +:10C5B0002D76011857570118B760011861610118ED +:10C5C000C76101180B62011899550118A56401187B +:10C5D0003965011827600118756001186B59011839 +:10C5E00059550118EF6401183B7101184F72011879 +:10C5F0007955011800000000000000007368011860 +:10C60000DF680118D37A01185F7B0118C17B01181C +:10C610000C010801020F17070D050105010D0201AC +:10C6200009010901010101030601020509011801BF +:10C6300018010305000000000901090103010301BD +:04C6400005010000F0 +:0400000500000000F7 +:00000001FF diff --git a/ble/lib/ble6_fw.lib b/ble/lib/ble6_fw.lib new file mode 100644 index 0000000..ce21954 Binary files /dev/null and b/ble/lib/ble6_fw.lib differ diff --git a/ble/lib/ble6_lite.lib b/ble/lib/ble6_lite.lib new file mode 100644 index 0000000..3629ac6 Binary files /dev/null and b/ble/lib/ble6_lite.lib differ diff --git a/ble/prf/prf.h b/ble/prf/prf.h new file mode 100644 index 0000000..02f161c --- /dev/null +++ b/ble/prf/prf.h @@ -0,0 +1,263 @@ +/** + **************************************************************************************** + * + * @file prf.h + * + * @brief Header file - used to manage and access BLE profiles. + * + **************************************************************************************** + */ + +#ifndef _PRF_H_ +#define _PRF_H_ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include +#include +#include "string.h" + +#include "blelib.h" +#include "le_err.h" +#include "att.h" +#include "attm_api.h" +#include "gatt_api.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Attribute is mandatory +#define ATT_MANDATORY (0xFF) +/// Attribute is optional +#define ATT_OPTIONAL (0x00) + +/// Possible values for setting client configuration characteristics +enum prf_cli_conf +{ + /// Stop notification/indication + PRF_CLI_STOP_NTFIND = 0x0000, + /// Start notification + PRF_CLI_START_NTF = 0x0001, + /// Start indication + PRF_CLI_START_IND = 0x0002, +}; + +/// Possible values for setting server configuration characteristics +enum prf_srv_conf +{ + /// Stop Broadcast + PRF_SRV_STOP_BCST = 0x0000, + /// Start Broadcast + PRF_SRV_START_BCST = 0x0001, +}; + +/// Service type +enum prf_svc_type +{ + PRF_PRIMARY_SERVICE = 0x00, + PRF_SECONDARY_SERVICE = 0x01 +}; + + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Characteristic Presentation Format Descriptor Size +#define PRF_PRES_FMT_SIZE (7) + +/// Characteristic Presentation information +struct prf_pres_fmt +{ + /// Unit (The Unit is a UUID) + uint16_t unit; + /// Description + uint16_t description; + /// Format + uint8_t format; + /// Exponent + uint8_t exponent; + /// Name space + uint8_t name_space; +}; + +/// Time profile Date and Time Size +#define PRF_DATA_TIME_SIZE (7) + +/// Time profile information +struct prf_date_time +{ + /// year time element + uint16_t year; + /// month time element + uint8_t month; + /// day time element + uint8_t day; + /// hour time element + uint8_t hour; + /// minute time element + uint8_t min; + /// second time element + uint8_t sec; +}; + +/** + * SFLOAT: Short Floating Point Type + * + * +----------+----------+---------+ + * | Exponent | Mantissa | Total | + * +------+----------+----------+---------+ + * | size | 4 bits | 12 bits | 16 bits | + * +------+----------+----------+---------+ + */ +typedef uint16_t prf_sfloat; + +/// Attribute information +struct prf_att_info +{ + /// Attribute Handle + uint16_t handle; + /// Attribute length + uint16_t length; + /// Status of request + uint8_t status; + /// Attribute value + uint8_t value[]; +}; + +/// service handles +struct prf_svc +{ + /// start handle + uint16_t shdl; + /// end handle + uint16_t ehdl; +}; + +/// included service handles +struct prf_incl_svc +{ + /// attribute handle + uint16_t handle; + /// included service start handle + uint16_t start_hdl; + /// included service end handle + uint16_t end_hdl; + /// UUID length + uint8_t uuid_len; + /// UUID + uint8_t uuid[ATT_UUID128_LEN]; +}; + +/// characteristic info +struct prf_char_inf +{ + /// Characteristic handle + uint16_t char_hdl; + /// Value handle + uint16_t val_hdl; + /// Characteristic properties + uint8_t prop; + /// End of characteristic offset + uint8_t char_ehdl_off; +}; + +/// characteristic description +struct prf_desc_inf +{ + /// Descriptor handle + uint16_t desc_hdl; +}; + +/// Characteristic definition +struct prf_char_def +{ + /// Characteristic UUID + uint16_t uuid; + /// Requirement Attribute Flag + uint8_t req_flag; + /// Mandatory Properties + uint8_t prop_mand; +}; + +/// Characteristic Descriptor definition +struct prf_desc_def +{ + /// Characteristic Descriptor uuid + uint16_t uuid; + /// requirement attribute flag + uint8_t req_flag; + /// Corresponding characteristic code + uint8_t char_code; +}; + +/// Message structure used to inform APP that a profile client role has been disabled +struct prf_client_disable_ind +{ + /// Status + uint8_t status; +}; + +/// Message structure used to inform APP that an error has occured in the profile server role task +struct prf_server_error_ind +{ + /// Message ID + uint16_t msg_id; + /// Status + uint8_t status; +}; + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief SVR Pack Characteristic Presentation Format descriptor value + **************************************************************************************** + */ +void prf_pack_pres_fmt(uint8_t *packed_val, const struct prf_pres_fmt* pres_fmt); + +/** + **************************************************************************************** + * @brief SVR Pack date time value + * + * @param[out] packed_date packed date time + * @param[in] date_time structure date time + * + * @return size of packed value + **************************************************************************************** + */ +uint8_t prf_pack_date_time(uint8_t *packed_date, const struct prf_date_time* date_time); + + +/** + **************************************************************************************** + * @brief CLI Unpack Characteristic Presentation Format descriptor value + **************************************************************************************** + */ +void prf_unpack_pres_fmt(const uint8_t *packed_val, struct prf_pres_fmt* pres_fmt); + +/** + **************************************************************************************** + * @brief CLI Unpack date time value + * + * @param[in] packed_date packed date time + * @param[out] date_time structure date time + * + * @return size of packed value + **************************************************************************************** + */ +uint8_t prf_unpack_date_time(uint8_t *packed_date, struct prf_date_time* date_time); + + +#endif /* _PRF_H_ */ diff --git a/ble/prf/prf_api.h b/ble/prf/prf_api.h new file mode 100644 index 0000000..1215af9 --- /dev/null +++ b/ble/prf/prf_api.h @@ -0,0 +1,213 @@ +/** + **************************************************************************************** + * + * @file prf_api.h + * + * @brief Header file - BLE Profiles' API functions, all inlcuded. + * + **************************************************************************************** + */ + +#ifndef PRF_API_H_ +#define PRF_API_H_ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Profile Enable +#if !defined(PRF_GATT) + #define PRF_GATT (1) +#endif + +/// Service Start Handle(0 = dynamically allocated) +#if !defined(GAP_START_HDL) + #define GAP_START_HDL (0) +#endif + +#if !defined(GATT_START_HDL) + #define GATT_START_HDL (0) +#endif + +#if !defined(MESH_START_HDL) + #define MESH_START_HDL (0) +#endif + +#if !defined(MESH_SVC_CFG) + #define MESH_SVC_CFG (0x03) //(MESH_ATT_PROV | MESH_ATT_PROXY) +#endif + +/// Attributes present in GAP Service +#if !defined(GAP_ATT_CFG) +#if (PRF_HIDS) + #define GAP_ATT_CFG (0x40) //(GAP_ATT_SLV_PREF_PAR_BIT) +#else + #define GAP_ATT_CFG (0) +#endif //(PRF_HIDS) +#endif + +/// GAP Attribute write permission requirement +enum gap_att_write_perm +{ + /// Disable write access + GAP_ATT_WRITE_DISABLE = 0, + /// Enable write access - no authentication required + GAP_ATT_WRITE_NO_AUTH = 1, + /// Write access requires unauthenticated link + GAP_ATT_WRITE_UNAUTH = 2, + /// Write access requires authenticated link + GAP_ATT_WRITE_AUTH = 3, + /// Write access requires secure connected link + GAP_ATT_WRITE_SEC_CON = 4 +}; + +/// GAP Attribute Configuration +/// 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 +/// +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ +/// | RFU |PCP | ICON_PERM | NAME_PERM | +/// +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ +/// - Bit [0-2] : Device Name write permission requirements for peer device (@see gap_att_write_perm) +/// - Bit [3-5] : Device Appearance write permission requirements for peer device (@see gap_att_write_perm) +/// - Bit [6] : Slave Preferred Connection Parameters present +/// - Bit [7-15]: Reserved +enum gap_att_cfg +{ + /// Device Name write permission requirements for peer device + GAP_ATT_NAME_PERM_MASK = 0x0007, + GAP_ATT_NAME_PERM_LSB = 0, + /// Device Appearance write permission requirements for peer device + GAP_ATT_ICON_PERM_MASK = 0x0038, + GAP_ATT_ICON_PERM_LSB = 3, + /// Slave Preferred Connection Parameters present in GAP Service. + GAP_ATT_SLV_PREF_PAR_BIT = 0x0040, + GAP_ATT_SLV_PREF_PAR_POS = 6, +}; + +/// Mesh Attribute Configuration +enum mesh_att_cfg +{ + /// Provisioning attribute + MESH_ATT_PROV = (1 << 0), + + /// Proxy attribute + MESH_ATT_PROXY = (1 << 1), +}; + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Add Generic Access Profile(0x1800) in the DB. + * + * @param[in] start_hdl Service start handle + * @param[in] att_cfg Attribute configuration @see gap_att_cfg + * + * @return Result status, LE_SUCCESS or Error Reason + **************************************************************************************** + */ +uint8_t gap_svc_init(uint16_t start_hdl, uint16_t att_cfg); + +/** + **************************************************************************************** + * @brief Retrieve Dev Info to Generic Access Profile, User implement for Callback. + * + * @param[in] conidx connection index + * @param[in] req request of info type @see enum gapc_dev_info + * @param[in] maxlen buffer length, DEV_NAME_MAX_LEN or size of gapc_conn_param + * @param[out] info pointer of buffer + * + * @return Length of device information, 0 means an error occurs. + **************************************************************************************** + */ +uint16_t gap_svc_get_dev_info(uint8_t conidx, uint8_t req, uint16_t maxlen, uint8_t *info); + +/** + **************************************************************************************** + * @brief Peer update device name or appearance to Generic Access Profile, default reject. + * + * @param[in] conidx connection index + * @param[in] req GAPC_DEV_NAME or GAPC_DEV_APPEARANCE @see enum gapc_dev_info + * @param[in] len length of info data + * @param[out] info pointer of data + * + * @return status of accept(GAP_ERR_NO_ERROR) or reject(GAP_ERR_REJECTED). + **************************************************************************************** + */ +uint8_t gap_svc_set_dev_info(uint8_t conidx, uint8_t req, uint16_t len, const uint8_t *info); + +/** + **************************************************************************************** + * @brief Add Generic Attribute Profile(0x1801) in the DB. + * + * @param[in] start_hdl Service start handle + * + * @return Result status, LE_SUCCESS or Error Reason + **************************************************************************************** + */ +uint8_t gatt_svc_init(uint16_t start_hdl); + +/** + **************************************************************************************** + * @brief Add Mesh Profiles in the DB. + * + * @param[in] start_hdl Service start handle + * @param[in] svc_cfg Service configuration + * + * @return Result status, LE_SUCCESS or Error Reason + **************************************************************************************** + */ +uint8_t mesh_svc_init(uint16_t start_hdl, uint16_t svc_cfg); + + +/* + * STANDARD PROFILES + **************************************************************************************** + */ + +/// Device Information Service Server +#include "prf_diss.h" + +/// Battery Service Server +#include "prf_bass.h" + +/// HID Over GATT Profile Server +#include "prf_hids.h" + +#if (PRF_SCPS) +/// Scan Parameters Profile Server +#include "prf_scps.h" +#endif + +/// user add more... + + +/* + * CUSTOMIZED PROFILES + **************************************************************************************** + */ + +/// Serial Service Profile +#include "prf_sess.h" + +#if (PRF_OTAS) +/// OTA Service Profile +#include "prf_otas.h" +#endif + +#if (PRF_PTSS) +/// Profile Testing Service +#include "prf_ptss.h" +#endif + +/// user add more... + + +#endif /* PRF_API_H_ */ diff --git a/ble/prf/prf_bass.c b/ble/prf/prf_bass.c new file mode 100644 index 0000000..2d869f3 --- /dev/null +++ b/ble/prf/prf_bass.c @@ -0,0 +1,481 @@ +/** + **************************************************************************************** + * + * @file prf_bass.c + * + * @brief Battery Service - Server Role Implementation. + * + * < If want to modify it, recommend to copy the file to 'user porject'/src > + **************************************************************************************** + */ + +#if (PRF_BASS) + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "prf.h" +#include "prf_bass.h" + +#if (DBG_BASS) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat,len) +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// Value of Battery Level and Power State +#define BAT_LVL_MIN (0) +#define BAT_LVL_MAX (100) +#define BAT_LVL_DFT (88) // 88% +#define PWR_STA_DFT (0xBB) + +/// Macro for Client Config value operation +#define BAS_LVL_NTF_GET(conidx) \ + ((bass_env.lvl_ntfs >> (conidx)) & PRF_CLI_START_NTF) + +#define BAS_LVL_NTF_CLR(conidx) \ + bass_env.lvl_ntfs &= ~(PRF_CLI_START_NTF << (conidx)) + +#define BAS_LVL_NTF_SET(conidx, conf) \ + bass_env.lvl_ntfs = (bass_env.lvl_ntfs & ~(PRF_CLI_START_NTF << (conidx))) | ((conf) << (conidx)) + +#if (BAS_PWR_STA) +#define BAS_PWR_NTF_GET(conidx) \ + ((bass_env.pwr_ntfs >> (conidx)) & PRF_CLI_START_NTF) + +#define BAS_PWR_NTF_CLR(conidx) \ + bass_env.pwr_ntfs &= ~(PRF_CLI_START_NTF << (conidx)) + +#define BAS_PWR_NTF_SET(conidx, conf) \ + bass_env.pwr_ntfs = (bass_env.pwr_ntfs & ~(PRF_CLI_START_NTF << (conidx))) | ((conf) << (conidx)) +#endif + +/// Bits of Battery Power State +struct bat_pwr_sta_def +{ + uint8_t level : 2; // bit[0:1] (0-Unknown, 1-Not Supported, 2-No, 3-Yes) + uint8_t charging : 2; // bit[2:3] (0-Unknown, 1-Not Chargeable, 2-No, 3-Yes) + uint8_t discharging : 2; // bit[4:5] (0-Unknown, 1-Not Supported, 2-No, 3-Yes) + uint8_t present : 2; // bit[6:7] (0-Unknown, 1-Not Supported, 2-No, 3-Yes) +}; + + +/** + **************************************************************************************** + * @section ENVIRONMENT DEFINITION + **************************************************************************************** + */ + +/// BAS Server Environment Variable +typedef struct bass_env_tag +{ + // Service Start Handle + uint16_t start_hdl; + + // Current Battery Level(0~100), unit in '%' + uint8_t bat_lvl; + // Client Config Bits of Battery Level - each 1Bit(NTF only), so max_peer=8. + uint8_t lvl_ntfs; + + #if (BAS_PWR_STA) + // Current Power State, @see struct bat_pwr_sta_def + uint8_t pwr_sta; + // Client Config Bits of Power State - each 1Bit(NTF only), so max_peer=8. + uint8_t pwr_ntfs; + #endif +} bass_env_t; + +/// Global Variable Declarations +__VAR_ENV bass_env_t bass_env; + + +/** + **************************************************************************************** + * @section ATTRIBUTES DEFINITION + **************************************************************************************** + */ + +/// BAS Attributes Index +enum bas_att_idx +{ + // Service Declaration, *MUST* Start at 0 + BAS_IDX_SVC, + + // Battery Level Char. + BAS_IDX_BAT_LVL_CHAR, + BAS_IDX_BAT_LVL_VAL, + BAS_IDX_BAT_LVL_NTF_CFG, + + #if (BAS_PWR_STA) + // Battery Power State Char. + BAS_IDX_PWR_STA_CHAR, + BAS_IDX_PWR_STA_VAL, + BAS_IDX_PWR_STA_NTF_CFG, + #endif //(BAS_PWR_STA) + + // Max Index, *NOTE* Minus 1(Svc Decl) is .nb_att + BAS_IDX_NB, +}; + +/// Attributes Description +const att_decl_t bas_atts[] = +{ + // Battery Level Char. Declaration and Value and CCC Descriptor + ATT_ELMT_DECL_CHAR( BAS_IDX_BAT_LVL_CHAR ), + ATT_ELMT( BAS_IDX_BAT_LVL_VAL, ATT_CHAR_BATTERY_LEVEL, PROP_NTF | PROP_RD, 0), + ATT_ELMT_DESC_CLI_CHAR_CFG( BAS_IDX_BAT_LVL_NTF_CFG ), + + #if (BAS_PWR_STA) + // Battery Power State Char. Declaration and Value and CCC Descriptor + ATT_ELMT_DECL_CHAR( BAS_IDX_PWR_STA_CHAR ), + ATT_ELMT(BAS_IDX_PWR_STA_VAL, ATT_CHAR_BATTERY_POWER_STATE, PROP_NTF | PROP_RD, 0), + ATT_ELMT_DESC_CLI_CHAR_CFG( BAS_IDX_PWR_STA_NTF_CFG ), + #endif +}; + +/// Service Description +const struct svc_decl bas_svc_db = +{ + .uuid = ATT_SVC_BATTERY_SERVICE, + .info = SVC_UUID(16), + .atts = bas_atts, + .nb_att = BAS_IDX_NB - 1, +}; + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @section SVC FUNCTIONS + **************************************************************************************** + */ + +/// Retrieve attribute handle from index (@see bass_att_idx) +static uint16_t bass_get_att_handle(uint8_t att_idx) +{ + ASSERT_ERR(att_idx < BAS_IDX_NB); + + return (att_idx + bass_env.start_hdl); +} + +/// Retrieve attribute index form handle +static uint8_t bass_get_att_idx(uint16_t handle) +{ + ASSERT_ERR((handle >= bass_env.start_hdl) && (handle < bass_env.start_hdl + BAS_IDX_NB)); + + return (handle - bass_env.start_hdl); +} + +/// Handles reception of the atts request from peer device +static void bass_svc_func(uint8_t conidx, uint8_t opcode, uint16_t handle, const void *param) +{ + uint8_t att_idx = bass_get_att_idx(handle); + + DEBUG("svc_func(cid:%d,op:0x%x,hdl:0x%x,att:%d)", conidx, opcode, handle, att_idx); + + switch (opcode) + { + case ATTS_READ_REQ: + { + if (att_idx == BAS_IDX_BAT_LVL_VAL) + { + DEBUG(" read_cfm(bat_lvl:%d)", bass_env.bat_lvl); + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint8_t), &(bass_env.bat_lvl)); + break; + } + + if (att_idx == BAS_IDX_BAT_LVL_NTF_CFG) + { + // retrieve notification config + uint16_t cli_cfg = BAS_LVL_NTF_GET(conidx); + + DEBUG(" read_cfm(lvl_ntf:%d)", cli_cfg); + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint16_t), (uint8_t *)&cli_cfg); + break; + } + + #if (BAS_PWR_STA) + if (att_idx == BAS_IDX_PWR_STA_VAL) + { + DEBUG(" read_cfm(pwr_sta:%d)", bass_env.pwr_sta); + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint8_t), &(bass_env.pwr_sta)); + break; + } + + if (att_idx == BAS_IDX_PWR_STA_NTF_CFG) + { + // retrieve notification config + uint16_t cli_cfg = BAS_PWR_NTF_GET(conidx); + + DEBUG(" read_cfm(pwr_ntf:%d)", cli_cfg); + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint16_t), (uint8_t *)&cli_cfg); + break; + } + #endif //(BAS_PWR_STA) + + // Send error response + gatt_read_cfm(conidx, PRF_ERR_APP_ERROR, handle, 0, NULL); + } break; + + case ATTS_WRITE_REQ: + { + const struct atts_write_ind *ind = param; + + DEBUG(" write_req(hdl:0x%x,att:%d,wr:0x%x,len:%d)", handle, att_idx, ind->wrcode, ind->length); + + #if (BAS_PWR_STA) + if ((att_idx == BAS_IDX_BAT_LVL_NTF_CFG) || (att_idx == BAS_IDX_PWR_STA_NTF_CFG)) + #else + if (att_idx == BAS_IDX_BAT_LVL_NTF_CFG) + #endif //(BAS_PWR_STA) + { + if ((!ind->more) && (ind->length == sizeof(uint16_t))) + { + uint16_t cli_cfg = read16p(ind->value); + + // update configuration if value for stop or NTF start + if (cli_cfg <= PRF_CLI_START_NTF) + { + // Send write confirm quickly! + gatt_write_cfm(conidx, LE_SUCCESS, handle); + + #if (BAS_PWR_STA) + if (att_idx == BAS_IDX_PWR_STA_NTF_CFG) + { + DEBUG(" set pwr_ntf(cid:%d,cfg:%d)", conidx, cli_cfg); + BAS_PWR_NTF_SET(conidx, cli_cfg); + + // Send Battery Power State Notify + if (cli_cfg == PRF_CLI_START_NTF) + { + gatt_ntf_send(conidx, bass_get_att_handle(BAS_IDX_PWR_STA_VAL), sizeof(uint8_t), &bass_env.pwr_sta); + } + } + else + #endif //(BAS_PWR_STA) + { + DEBUG(" set lvl_ntf(cid:%d,cfg:%d)", conidx, cli_cfg); + BAS_LVL_NTF_SET(conidx, cli_cfg); + + // Send Battery Level Notify + if (cli_cfg == PRF_CLI_START_NTF) + { + gatt_ntf_send(conidx, bass_get_att_handle(BAS_IDX_BAT_LVL_VAL), sizeof(uint8_t), &bass_env.bat_lvl); + } + } + break; + } + } + } + + // Send write confirm with error! + gatt_write_cfm(conidx, PRF_ERR_APP_ERROR, handle); + } break; + + case ATTS_INFO_REQ: + { + uint16_t length = ATT_MAX_LEN_GET(att_idx, bas_atts); + + // Send length-info confirm for prepWR judging. + DEBUG(" info_cfm(hdl:0x%x,att:%d,len:%d)", handle, att_idx, length); + gatt_info_cfm(conidx, LE_SUCCESS, handle, length); + } break; + + case ATTS_CMP_EVT: + { + const struct atts_cmp_evt *evt = param; + + DEBUG(" cmp_evt(op:0x%x,sta:0x%x)", evt->operation, evt->status); + // add 'if' to avoid warning #117-D: "evt" never referenced + if (evt->operation == GATT_NOTIFY) + { + // Update operation result + } + } break; + + default: + { + // nothing to do + } break; + } +} + +/** + **************************************************************************************** + * @section API FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Add Battery Service Profile in the DB. + * Customize via pre-define @see BAS_START_HDL + * + * @return Result status, LE_SUCCESS or Error Reason + **************************************************************************************** + */ +uint8_t bass_svc_init(void) +{ + uint8_t status = LE_SUCCESS; + + // Init Environment + bass_env.start_hdl = BAS_START_HDL; + bass_env.bat_lvl = BAT_LVL_DFT; + bass_env.lvl_ntfs = PRF_CLI_START_NTF; + #if (BAS_PWR_STA) + bass_env.pwr_sta = PWR_STA_DFT; + bass_env.pwr_ntfs = PRF_CLI_START_NTF; + #endif //(BAS_PWR_STA) + + // Create Service in database + status = attmdb_svc_create(&bass_env.start_hdl, NULL, &bas_svc_db, bass_svc_func); + DEBUG("svc_init(sta:0x%X,shdl:%d)", status, bass_env.start_hdl); + + return status; +} + +/** + **************************************************************************************** + * @brief Transmit Battery Level to peer device via NTF + * + * @param[in] conidx peer device connection index + * @param[in] bat_lvl Battery Level + * + * @return Status of the operation @see prf_err + **************************************************************************************** + */ +static uint8_t bass_bat_lvl_send(uint8_t conidx, uint8_t bat_lvl) +{ + uint8_t status = PRF_ERR_REQ_DISALLOWED; + + if ((bat_lvl <= BAT_LVL_MAX) + && (BAS_LVL_NTF_GET(conidx) == PRF_CLI_START_NTF)) + { + status = LE_SUCCESS; + gatt_ntf_send(conidx, bass_get_att_handle(BAS_IDX_BAT_LVL_VAL), sizeof(uint8_t), &bat_lvl); + } + + return status; +} + +/** + **************************************************************************************** + * @brief Update Battery Level value + * + * @param[in] bat_lvl Battery Level + **************************************************************************************** + */ +void bass_bat_lvl_update(uint8_t bat_lvl) +{ + if (bass_env.bat_lvl != bat_lvl) + { + bass_env.bat_lvl = bat_lvl; + + // todo update operation, loop on all connection + for (uint8_t idx = 0; idx < BLE_CONNECTION_MAX; idx++) + { + bass_bat_lvl_send(idx, bass_env.bat_lvl); + } + } +} + +/** + **************************************************************************************** + * @brief Enable Battery level Notification Configurations + * + * @param[in] conidx Connection index + * @param[in] ntf_cfg Notification Config @see prf_cli_conf + **************************************************************************************** + */ +void bass_set_lvl_ntf(uint8_t conidx, uint8_t ntf_cfg) +{ + //if (gapc_get_conhdl(conidx) != GAP_INVALID_CONHDL) + { + ntf_cfg &= PRF_CLI_START_NTF; // NTF only(0x0001) + + // update configuration + BAS_LVL_NTF_SET(conidx, ntf_cfg); + } +} + +#if (BAS_PWR_STA) +/** + **************************************************************************************** + * @brief Transmit Battery Power State to peer device via NTF + * + * @param[in] conidx peer device connection index + * @param[in] pwr_sta Power State + * + * @return Status of the operation @see prf_err + **************************************************************************************** + */ +static uint8_t bass_pwr_sta_send(uint8_t conidx, uint8_t pwr_sta) +{ + uint8_t status = PRF_ERR_REQ_DISALLOWED; + + if (BAS_PWR_NTF_GET(conidx) == PRF_CLI_START_NTF) + { + status = LE_SUCCESS; + gatt_ntf_send(conidx, bass_get_att_handle(BAS_IDX_PWR_STA_VAL), sizeof(uint8_t), &pwr_sta); + } + + return status; +} + +/** + **************************************************************************************** + * @brief Update Battery Power State value + * + * @param[in] pwr_sta Power State + **************************************************************************************** + */ +void bass_pwr_sta_update(uint8_t pwr_sta) +{ + if (bass_env.pwr_sta != pwr_sta) + { + bass_env.pwr_sta = pwr_sta; + + // todo update operation, loop on all connection + for (uint8_t idx = 0; idx < BLE_CONNECTION_MAX; idx++) + { + bass_pwr_sta_send(idx, bass_env.pwr_sta); + } + } +} + +/** + **************************************************************************************** + * @brief Enable Battery Power State Notification Configurations + * + * @param[in] conidx Connection index + * @param[in] ntf_cfg Notification Config @see prf_cli_conf + **************************************************************************************** + */ +void bass_set_pwr_ntf(uint8_t conidx, uint8_t ntf_cfg) +{ + //if (gapc_get_conhdl(conidx) != GAP_INVALID_CONHDL) + { + ntf_cfg &= PRF_CLI_START_NTF; // NTF only(0x0001) + + // update configuration + BAS_PWR_NTF_SET(conidx, ntf_cfg); + } +} +#endif //(BAS_PWR_STA) + + +#endif //(PRF_BASS) diff --git a/ble/prf/prf_bass.h b/ble/prf/prf_bass.h new file mode 100644 index 0000000..10e872d --- /dev/null +++ b/ble/prf/prf_bass.h @@ -0,0 +1,92 @@ +/** + **************************************************************************************** + * + * @file prf_bass.h + * + * @brief Header file - Battery Service Server Role + * + **************************************************************************************** + */ + +#ifndef PRF_BASS_H_ +#define PRF_BASS_H_ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Server Start Handle(0 = dynamically allocated) +#if !defined(BAS_START_HDL) + #define BAS_START_HDL (0) +#endif + +/// Support Battery Power State Characteristic +#if !defined(BAS_PWR_STA) + #define BAS_PWR_STA (1) +#endif + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Add Battery Service Profile in the DB. + * Customize via pre-define @see BAS_START_HDL + * + * @return Result status, LE_SUCCESS or Error Reason + **************************************************************************************** + */ +uint8_t bass_svc_init(void); + +/** + **************************************************************************************** + * @brief Update Battery Level value + * + * @param[in] bat_lvl Battery Level + **************************************************************************************** + */ +void bass_bat_lvl_update(uint8_t bat_lvl); + +/** + **************************************************************************************** + * @brief Enable Battery Level Notification Configurations + * + * @param[in] conidx Connection index + * @param[in] ntf_cfg Notification Config @see prf_cli_conf + **************************************************************************************** + */ +void bass_set_lvl_ntf(uint8_t conidx, uint8_t ntf_cfg); + +#if (BAS_PWR_STA) +/** + **************************************************************************************** + * @brief Update Battery Power State value + * + * @param[in] pwr_sta Power State + **************************************************************************************** + */ +void bass_pwr_sta_update(uint8_t pwr_sta); + +/** + **************************************************************************************** + * @brief Enable Battery Power State Notification Configurations + * + * @param[in] conidx Connection index + * @param[in] ntf_cfg Notification Config @see prf_cli_conf + **************************************************************************************** + */ +void bass_set_pwr_ntf(uint8_t conidx, uint8_t ntf_cfg); +#else +#define bass_pwr_sta_update(pwr_sta) +#define bass_set_pwr_ntf(conidx, ntf_cfg) +#endif + + +#endif /* PRF_BASS_H_ */ diff --git a/ble/prf/prf_diss.c b/ble/prf/prf_diss.c new file mode 100644 index 0000000..9575715 --- /dev/null +++ b/ble/prf/prf_diss.c @@ -0,0 +1,412 @@ +/** + **************************************************************************************** + * + * @file prf_diss.c + * + * @brief Device Information Service(DIS) - Server Role Implementation. + * + * < If want to modify it, recommend to copy the file to 'user porject'/src > + **************************************************************************************** + */ + +#if (PRF_DISS) + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "prf.h" +#include "prf_diss.h" + +#if (DBG_DISS) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// Manufacturer Name Value +#define INFO_MANUF_NAME ("BLE5x") +#define INFO_MANUF_NAME_LEN (sizeof(INFO_MANUF_NAME)-1) + +/// Model Number String Value +#define INFO_MODEL_NB_STR ("BLE5.2") +#define INFO_MODEL_NB_STR_LEN (sizeof(INFO_MODEL_NB_STR)-1) + +/// Serial Number +#define INFO_SERIAL_NB_STR ("11.0.2-LE") +#define INFO_SERIAL_NB_STR_LEN (sizeof(INFO_SERIAL_NB_STR)-1) + +/// Firmware Revision +#define INFO_FW_REV_STR ("11.0.2") +#define INFO_FW_REV_STR_LEN (sizeof(INFO_FW_REV_STR)-1) + +/// System ID Value - LSB -> MSB, Length=8(DIS_SYS_ID_LEN) +#define INFO_SYS_ID ("\x12\x34\x56\xFF\xFE\x9A\xBC\xDE") +#define INFO_SYS_ID_LEN (sizeof(INFO_SYS_ID)-1) + +/// Hardware Revision String +#define INFO_HW_REV_STR ("1.0.0") +#define INFO_HW_REV_STR_LEN (sizeof(INFO_HW_REV_STR)-1) + +/// Software Revision String +#define INFO_SW_REV_STR ("1.0.0") +#define INFO_SW_REV_STR_LEN (sizeof(INFO_SW_REV_STR)-1) + +/// IEEE Certif, Length>=6(DIS_IEEE_CERTIF_MIN_LEN) +#define INFO_IEEE ("\xFF\xEE\xDD\xCC\xBB\xAA") +#define INFO_IEEE_LEN (sizeof(INFO_IEEE)-1) + +/** + * PNP ID Value - LSB -> MSB, Length=7(DIS_PNP_ID_LEN) + * Vendor ID Source : 0x02 (USB Implementers Forum assigned Vendor ID value) + * Vendor ID : 0x045E (Microsoft Corp) + * Product ID : 0x0040 + * Product Version : 0x0300 + */ +#define INFO_PNP_ID ("\x02\x5E\x04\x40\x00\x00\x03") +#define INFO_PNP_ID_LEN (sizeof(INFO_PNP_ID)-1) + + +/** + **************************************************************************************** + * @section ENVIRONMENT DEFINITION + **************************************************************************************** + */ + +/// DIS Server Environment Variable +typedef struct diss_env_tag +{ + // Service Start Handle + uint16_t start_hdl; + // Supported features @see enum dis_features + uint16_t features; +} diss_env_t; + +/// Global Variable Declarations +__VAR_ENV diss_env_t diss_env; + + +/** + **************************************************************************************** + * @section ATTRIBUTES DEFINITION + **************************************************************************************** + */ + +/// DIS Attributes Index, keep up with @see enum dis_values +enum dis_att_idx +{ + // Service Declaration, *MUST* Start at 0 + DIS_IDX_SVC, + + // Manufacturer Name String Char. + DIS_IDX_MANUF_NAME_CHAR, + DIS_IDX_MANUF_NAME_VAL, + // Model Number String Char. + DIS_IDX_MODEL_NB_STR_CHAR, + DIS_IDX_MODEL_NB_STR_VAL, + // Serial Number String Char. + DIS_IDX_SERIAL_NB_STR_CHAR, + DIS_IDX_SERIAL_NB_STR_VAL, + // Hardware Revision String Char. + DIS_IDX_HW_REV_STR_CHAR, + DIS_IDX_HW_REV_STR_VAL, + // Firmware Revision String Char. + DIS_IDX_FW_REV_STR_CHAR, + DIS_IDX_FW_REV_STR_VAL, + // Software Revision String Char. + DIS_IDX_SW_REV_STR_CHAR, + DIS_IDX_SW_REV_STR_VAL, + // System Identifier Char. + DIS_IDX_SYS_ID_CHAR, + DIS_IDX_SYS_ID_VAL, + // IEEE Certificate Char. + DIS_IDX_IEEE_CHAR, + DIS_IDX_IEEE_VAL, + // PnP ID Char. + DIS_IDX_PNP_ID_CHAR, + DIS_IDX_PNP_ID_VAL, + + // Max Index, *NOTE* Minus 1(Svc Decl) is .nb_att + DIS_IDX_NB, +}; + +/// Attributes Description +const att_decl_t dis_atts[] = +{ + // Manufacturer Name Char. Declaration and Value + ATT_ELMT_DECL_CHAR( DIS_IDX_MANUF_NAME_CHAR ), + ATT_ELMT( DIS_IDX_MANUF_NAME_VAL, ATT_CHAR_MANUF_NAME, PROP_RD, DIS_VAL_MAX_LEN ), + + // Model Number String Char. Declaration and Value + ATT_ELMT_DECL_CHAR( DIS_IDX_MODEL_NB_STR_CHAR ), + ATT_ELMT( DIS_IDX_MODEL_NB_STR_VAL, ATT_CHAR_MODEL_NB, PROP_RD, DIS_VAL_MAX_LEN ), + + // Serial Number String Char. Declaration and Value + ATT_ELMT_DECL_CHAR( DIS_IDX_SERIAL_NB_STR_CHAR ), + ATT_ELMT( DIS_IDX_SERIAL_NB_STR_VAL, ATT_CHAR_SERIAL_NB, PROP_RD, DIS_VAL_MAX_LEN ), + + // Hardware Revision String Char. Declaration and Value + ATT_ELMT_DECL_CHAR( DIS_IDX_HW_REV_STR_CHAR ), + ATT_ELMT( DIS_IDX_HW_REV_STR_VAL, ATT_CHAR_HW_REV, PROP_RD, DIS_VAL_MAX_LEN ), + + // Firmware Revision String Char. Declaration and Value + ATT_ELMT_DECL_CHAR( DIS_IDX_FW_REV_STR_CHAR ), + ATT_ELMT( DIS_IDX_FW_REV_STR_VAL, ATT_CHAR_FW_REV, PROP_RD, DIS_VAL_MAX_LEN ), + + // Software Revision String Char. Declaration and Value + ATT_ELMT_DECL_CHAR( DIS_IDX_SW_REV_STR_CHAR ), + ATT_ELMT( DIS_IDX_SW_REV_STR_VAL, ATT_CHAR_SW_REV, PROP_RD, DIS_VAL_MAX_LEN ), + + // System ID Char. Declaration and Value + ATT_ELMT_DECL_CHAR( DIS_IDX_SYS_ID_CHAR ), + ATT_ELMT( DIS_IDX_SYS_ID_VAL, ATT_CHAR_SYS_ID, PROP_RD, DIS_SYS_ID_LEN ), + + // IEEE 11073-20601 Regulatory Certification Data List Char. Declaration and Value + ATT_ELMT_DECL_CHAR( DIS_IDX_IEEE_CHAR ), + ATT_ELMT( DIS_IDX_IEEE_VAL, ATT_CHAR_IEEE_CERTIF, PROP_RD, DIS_SYS_ID_LEN ), + + // PnP ID Char. Declaration and Value + ATT_ELMT_DECL_CHAR( DIS_IDX_PNP_ID_CHAR ), + ATT_ELMT( DIS_IDX_PNP_ID_VAL, ATT_CHAR_PNP_ID, PROP_RD, DIS_PNP_ID_LEN ), +}; + +/// Service Description +const struct svc_decl dis_svc_db = +{ + {.uuid = ATT_SVC_DEVICE_INFO}, + .info = SVC_UUID(16), + .atts = dis_atts, + .nb_att = DIS_IDX_NB - 1, +}; + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @section SVC FUNCTIONS + **************************************************************************************** + */ + +/// Retrieve value index from attribute handle +static uint8_t diss_get_val_idx(uint16_t handle) +{ + // handle start from first characteristic value handle + uint16_t cur_hdl = diss_env.start_hdl + 2; + + for (uint8_t idx = 0; idx < DIS_CHAR_MAX; idx++) + { + if (((diss_env.features >> idx) & 1) == 1) + { + // check if value handle correspond to requested handle + if (cur_hdl == handle) + { + return idx; + } + cur_hdl += 2; + } + } + + return DIS_CHAR_MAX; +} + +/// Handles reception of the read request from peer device +static void diss_svc_func(uint8_t conidx, uint8_t opcode, uint16_t handle, const void *param) +{ + uint8_t val_idx = diss_get_val_idx(handle); + + DEBUG("svc_func(cid:%d,op:0x%x,hdl:0x%x,att:%d)", conidx, opcode, handle, val_idx); + + if (opcode == ATTS_READ_REQ) + { + // Check Characteristic Code + if (val_idx < DIS_CHAR_MAX) + { + uint16_t length; + const uint8_t *value = diss_value_get(val_idx, &length); + + if (value != NULL) + { + // Send value to peer device. + gatt_read_cfm(conidx, LE_SUCCESS, handle, length, value); + return; + } + } + + // application error, value cannot be retrieved + gatt_read_cfm(conidx, PRF_ERR_APP_ERROR, handle, 0, NULL); + } +} + + +/** + **************************************************************************************** + * @section API FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Add Device Information Profile in the DB. + * Customize via pre-define @see DIS_START_HDL @see DIS_FEATURES + * + * @return Result status, LE_SUCCESS or Error Reason + **************************************************************************************** + */ +uint8_t diss_svc_init(void) +{ + uint8_t status = LE_SUCCESS; + uint32_t cfg_att = 0; + + // Init Environment + diss_env.start_hdl = DIS_START_HDL; + diss_env.features = DIS_FEATURES; + + // Compute Attributes supported + for (uint8_t i = 0; i < DIS_CHAR_MAX; i++) + { + if (((diss_env.features >> i) & 1) == 1) + { + cfg_att |= (3 << (i*2 + 1)); // 3:CHAR + VAL + } + } + + // Create Service in database + status = attmdb_svc_create(&diss_env.start_hdl, (uint8_t *)&cfg_att, &dis_svc_db, diss_svc_func); + + DEBUG("svc_init(sta:0x%X,shdl:%d,feat:0x%X,cfg:0x%X)", + status, diss_env.start_hdl, diss_env.features, cfg_att); + + return status; +} + +/** + **************************************************************************************** + * @brief Get value for attribute read (__weak func) + * + * @param[in] val_idx Index of Value to set @see enum dis_values + * @param[out] p_len Value Length + * + * @return Value data pointer + **************************************************************************************** + */ +__weak const uint8_t *diss_value_get(uint8_t val_idx, uint16_t *p_len) +{ + uint16_t length = 0; + const uint8_t *p_data = NULL; + + // Retrieve value information + switch (val_idx) + { + #if DIS_FEAT_SUP(MANUF_NAME) + case DIS_MANUF_NAME_CHAR: + { + length = INFO_MANUF_NAME_LEN; + p_data = (const uint8_t *)INFO_MANUF_NAME; + } break; + #endif + + #if DIS_FEAT_SUP(MODEL_NB_STR) + case DIS_MODEL_NB_STR_CHAR: + { + length = INFO_MODEL_NB_STR_LEN; + p_data = (const uint8_t *)INFO_MODEL_NB_STR; + } break; + #endif + + #if DIS_FEAT_SUP(SERIAL_NB_STR) + case DIS_SERIAL_NB_STR_CHAR: + { + length = INFO_SERIAL_NB_STR_LEN; + p_data = (const uint8_t *)INFO_SERIAL_NB_STR; + } break; + #endif + + #if DIS_FEAT_SUP(HW_REV_STR) + case DIS_HW_REV_STR_CHAR: + { + length = INFO_HW_REV_STR_LEN; + p_data = (const uint8_t *)INFO_HW_REV_STR; + } break; + #endif + + #if DIS_FEAT_SUP(FW_REV_STR) + case DIS_FW_REV_STR_CHAR: + { + length = INFO_FW_REV_STR_LEN; + p_data = (const uint8_t *)INFO_FW_REV_STR; + } break; + #endif + + #if DIS_FEAT_SUP(SW_REV_STR) + case DIS_SW_REV_STR_CHAR: + { + length = INFO_SW_REV_STR_LEN; + p_data = (const uint8_t *)INFO_SW_REV_STR; + } break; + #endif + + #if DIS_FEAT_SUP(SYS_ID) + case DIS_SYS_ID_CHAR: + { + // Check if length matches particular requirements + if (INFO_SYS_ID_LEN == DIS_SYS_ID_LEN) + { + length = INFO_SYS_ID_LEN; + p_data = (const uint8_t *)INFO_SYS_ID; + } + } break; + #endif + + #if DIS_FEAT_SUP(IEEE) + case DIS_IEEE_CHAR: + { + // Check if length matches particular requirements + if (INFO_IEEE_LEN >= DIS_IEEE_CERTIF_MIN_LEN) + { + length = INFO_IEEE_LEN; + p_data = (const uint8_t *)INFO_IEEE; + } + } break; + #endif + + #if DIS_FEAT_SUP(PNP_ID) + case DIS_PNP_ID_CHAR: + { + // Check if length matches particular requirements + if (INFO_PNP_ID_LEN == DIS_PNP_ID_LEN) + { + length = INFO_PNP_ID_LEN; + p_data = (const uint8_t *)INFO_PNP_ID; + } + } break; + #endif + + default: + break; + } + + // Check value length not exceed MAX_LEN + if (length > DIS_VAL_MAX_LEN) + { + length = DIS_VAL_MAX_LEN; + } + DEBUG("value_get(req:%d,len:%d)", val_idx, length); + + *p_len = length; + return p_data; +} + +#endif //(PRF_DISS) diff --git a/ble/prf/prf_diss.h b/ble/prf/prf_diss.h new file mode 100644 index 0000000..5c592f2 --- /dev/null +++ b/ble/prf/prf_diss.h @@ -0,0 +1,121 @@ +/** + **************************************************************************************** + * + * @file prf_diss.h + * + * @brief Header file - Device Information Service Server. + * + **************************************************************************************** + */ + +#ifndef PRF_DISS_H_ +#define PRF_DISS_H_ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Service Start Handle(0 = dynamically allocated) +#if !defined(DIS_START_HDL) + #define DIS_START_HDL (0) +#endif + +/// Information Characteristic Support +#if !defined(DIS_FEATURES) +#define DIS_FEATURES ( DIS_FEAT_MANUF_NAME_BIT |\ + DIS_FEAT_SERIAL_NB_STR_BIT |\ + DIS_FEAT_HW_REV_STR_BIT |\ + DIS_FEAT_FW_REV_STR_BIT |\ + DIS_FEAT_PNP_ID_BIT ) +#endif + +/// Maximal length for Char. values(20 bytes default) +#if !defined(DIS_VAL_MAX_LEN) +#define DIS_VAL_MAX_LEN (20) +#endif +/// System ID string length +#define DIS_SYS_ID_LEN (0x08) +/// IEEE Certif length (min 6 bytes) +#define DIS_IEEE_CERTIF_MIN_LEN (0x06) +/// PnP ID length +#define DIS_PNP_ID_LEN (0x07) + + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Supported Feature Flags, Bits of Index @see enum dis_values +#define DIS_FEAT_MANUF_NAME_BIT (0x0001) //(1 << DIS_MANUF_NAME_CHAR) +#define DIS_FEAT_MODEL_NB_STR_BIT (0x0002) //(1 << DIS_MODEL_NB_STR_CHAR) +#define DIS_FEAT_SERIAL_NB_STR_BIT (0x0004) //(1 << DIS_SERIAL_NB_STR_CHAR) +#define DIS_FEAT_HW_REV_STR_BIT (0x0008) //(1 << DIS_HW_REV_STR_CHAR) +#define DIS_FEAT_FW_REV_STR_BIT (0x0010) //(1 << DIS_FW_REV_STR_CHAR) +#define DIS_FEAT_SW_REV_STR_BIT (0x0020) //(1 << DIS_SW_REV_STR_CHAR) +#define DIS_FEAT_SYS_ID_BIT (0x0040) //(1 << DIS_SYS_ID_CHAR) +#define DIS_FEAT_IEEE_BIT (0x0080) //(1 << DIS_IEEE_CHAR) +#define DIS_FEAT_PNP_ID_BIT (0x0100) //(1 << DIS_PNP_ID_CHAR) +#define DIS_FEAT_ALL_SUP (0x01FF) // All features are supported + +#define DIS_FEAT_SUP(val) (DIS_FEATURES & DIS_FEAT_##val##_BIT) + +/// Device Value Indexes +enum dis_values +{ + /// Manufacturer Name String + DIS_MANUF_NAME_CHAR, + /// Model Number String + DIS_MODEL_NB_STR_CHAR, + /// Serial Number String + DIS_SERIAL_NB_STR_CHAR, + /// Hardware Revision String + DIS_HW_REV_STR_CHAR, + /// Firmware Revision String + DIS_FW_REV_STR_CHAR, + /// Software Revision String + DIS_SW_REV_STR_CHAR, + /// System Identifier + DIS_SYS_ID_CHAR, + /// IEEE Certificate + DIS_IEEE_CHAR, + /// Plug and Play Identifier + DIS_PNP_ID_CHAR, + + DIS_CHAR_MAX, +}; + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Add Device Information Profile in the DB. + * Customize via pre-define @see DIS_START_HDL @see DIS_FEATURES + * + * @return Result status, LE_SUCCESS or Error Reason + **************************************************************************************** + */ +uint8_t diss_svc_init(void); + +/** + **************************************************************************************** + * @brief Get value for attribute read (__weak func) + * + * @param[in] val_idx Index of Value to set @see enum dis_values + * @param[out] p_len Value Length + * + * @return Value data pointer + **************************************************************************************** + */ +const uint8_t *diss_value_get(uint8_t val_idx, uint16_t *p_len); + + +#endif /* PRF_DISS_H_ */ diff --git a/ble/prf/prf_hids.c b/ble/prf/prf_hids.c new file mode 100644 index 0000000..abc82a2 --- /dev/null +++ b/ble/prf/prf_hids.c @@ -0,0 +1,927 @@ +/** + **************************************************************************************** + * + * @file prf_hids.c + * + * @brief HID Service Profile - Template Source. + * + * < Implementation according to user's application-specific > + **************************************************************************************** + */ + +#if (PRF_HIDS) + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "prf.h" +#include "hid_desc.h" // application-specific, #include "prf_hids.h" + +#if (DBG_HIDS) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat,len) +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// Support Boot Protocol Mode or Not +#if !defined(HID_BOOT_SUP) + #define HID_BOOT_SUP (0) + #define HID_BOOT_KB (0) + #define HID_BOOT_MOUSE (0) +#endif + +/// Support Report Protocol Mode or Not +#if !defined(HID_REPORT_SUP) + #define HID_REPORT_SUP (1) + #define HID_RPT_KB (1) + #define HID_RPT_MEDIA (1) + #define HID_RPT_SYSTEM (1) + #define HID_RPT_MOUSE (1) + #define HID_RPT_PTP (0) +#endif + +/// Support Number of HID Connections +#if !defined(HID_CONN_MAX) + #define HID_CONN_MAX (1) // always one, BLE_CONNECTION_MAX +#endif + +/// Macro for Client Config value operation +#define HID_RPT_NTF_GET(conidx, ntf_idx) \ + ((hids_env.conn[conidx].rpt_ntfs >> (ntf_idx)) & PRF_CLI_START_NTF) + +#define HID_RPT_NTF_CLR(conidx, ntf_idx) \ + hids_env.conn[conidx].rpt_ntfs &= ~(PRF_CLI_START_NTF << (ntf_idx)) + +#define HID_RPT_NTF_SET(conidx, ntf_idx, conf) \ + hids_env.conn[conidx].rpt_ntfs = (hids_env.conn[conidx].rpt_ntfs & ~(PRF_CLI_START_NTF << (ntf_idx))) | ((conf) << (ntf_idx)) + + +/** + **************************************************************************************** + * @section ENVIRONMENT DEFINITION + **************************************************************************************** + */ + +typedef struct hid_conn_tag +{ + // Client Config of peer devices, max_bits=RPT_IDX_NB + uint8_t rpt_ntfs; + // keyboard Locks (bit0:num lock, bit1:caps lock, bit2:scroll lock) + uint8_t led_lock; + // Control Point key @see enum hid_ctrl_pt + uint8_t ctrl_pt; + // Boot or Report mode, @see enum hid_proto_mode + uint8_t proto_mode; +} hid_conn_t; + +/// HIDS Server Environment Sariable +typedef struct hids_env_tag +{ + // Service Start Handle + uint16_t start_hdl; + // Number of notify pkt + uint8_t nb_pkt; + // Connection Info + hid_conn_t conn[HID_CONN_MAX]; +} hids_env_t; + +/// Global Variable Declarations +__VAR_ENV hids_env_t hids_env; + + +/** + **************************************************************************************** + * @section ATTRIBUTES DEFINITION + **************************************************************************************** + */ + +/// HID Attributes Index +enum hid_att_idx +{ + // Service Declaration, *MUST* Start at 0 + HID_IDX_SVC, + + // HID Information + HID_IDX_HID_INFO_CHAR, + HID_IDX_HID_INFO_VAL, + + // HID Control Point + HID_IDX_HID_CTRL_PT_CHAR, + HID_IDX_HID_CTRL_PT_VAL, + + // Report Map + HID_IDX_REPORT_MAP_CHAR, //5 + HID_IDX_REPORT_MAP_VAL, + + #if (HID_BOOT_SUP) + // Protocol Mode(0-BOOT, 1-REPORT) + HID_IDX_PROTO_MODE_CHAR, + HID_IDX_PROTO_MODE_VAL, + + #if (HID_BOOT_KB) + // Boot Keyboard Input Report + HID_IDX_BOOT_KB_IN_RPT_CHAR, + HID_IDX_BOOT_KB_IN_RPT_VAL, //10 + HID_IDX_BOOT_KB_IN_RPT_NTF_CFG, + // Boot Keyboard Output Report + HID_IDX_BOOT_KB_OUT_RPT_CHAR, + HID_IDX_BOOT_KB_OUT_RPT_VAL, + #endif //(HID_BOOT_KB) + + #if (HID_BOOT_MOUSE) + // Boot Mouse Input Report + HID_IDX_BOOT_MOUSE_IN_RPT_CHAR, + HID_IDX_BOOT_MOUSE_IN_RPT_VAL, //15 + HID_IDX_BOOT_MOUSE_IN_RPT_NTF_CFG, + #endif //(HID_BOOT_MOUSE) + #endif //(HID_BOOT_SUP) + + #if (HID_REPORT_SUP) + #if (HID_RPT_KB) + // Keyboard Report IN + HID_IDX_KB_IN_RPT_CHAR, + HID_IDX_KB_IN_RPT_VAL, + HID_IDX_KB_IN_RPT_REF, + HID_IDX_KB_IN_RPT_NTF_CFG, //20 + // Keyboard Report OUT + HID_IDX_KB_OUT_RPT_CHAR, + HID_IDX_KB_OUT_RPT_VAL, + HID_IDX_KB_OUT_RPT_REF, + #endif //(HID_RPT_KB) + + #if (HID_RPT_MEDIA) + // Media IN Report + HID_IDX_MEDIA_IN_RPT_CHAR, + HID_IDX_MEDIA_IN_RPT_VAL, //25 + HID_IDX_MEDIA_IN_RPT_REF, + HID_IDX_MEDIA_IN_RPT_NTF_CFG, + #endif //(HID_RPT_MEDIA) + + #if (HID_RPT_SYSTEM) + // System IN Report + HID_IDX_SYS_IN_RPT_CHAR, + HID_IDX_SYS_IN_RPT_VAL, + HID_IDX_SYS_IN_RPT_REF, //30 + HID_IDX_SYS_IN_RPT_NTF_CFG, + #endif //(HID_RPT_SYSTEM) + + #if (HID_RPT_MOUSE) + // Mouse IN Report + HID_IDX_MOUSE_IN_RPT_CHAR, + HID_IDX_MOUSE_IN_RPT_VAL, + HID_IDX_MOUSE_IN_RPT_REF, + HID_IDX_MOUSE_IN_RPT_NTF_CFG, //35 + #endif //(HID_RPT_MOUSE) + + #if (HID_RPT_PTP) + // TouchPad IN Report + HID_IDX_TP_IN_RPT_CHAR, + HID_IDX_TP_IN_RPT_VAL, + HID_IDX_TP_IN_RPT_REF, + HID_IDX_TP_IN_RPT_NTF_CFG, + // MaxCnt FEAT Report + HID_IDX_MAXCNT_FEAT_RPT_CHAR, //40 + HID_IDX_MAXCNT_FEAT_RPT_VAL, + HID_IDX_MAXCNT_FEAT_RPT_REF, + // PTPHQA FEAT Report + HID_IDX_PTPHQA_FEAT_RPT_CHAR, + HID_IDX_PTPHQA_FEAT_RPT_VAL, + HID_IDX_PTPHQA_FEAT_RPT_REF, //45 + #endif //(HID_RPT_PTP) + #endif //(HID_REPORT_SUP) + + // Max Index, *NOTE* Minus 1(Svc Decl) is .nb_att + HID_IDX_NB, +}; + +/// Attributes Description +const att_decl_t hid_atts[] = +{ + // HID Information Char. Declaration and Value + ATT_ELMT_DECL_CHAR( HID_IDX_HID_INFO_CHAR ), + ATT_ELMT( HID_IDX_HID_INFO_VAL, ATT_CHAR_HID_INFO, PROP_RD, HID_INFO_SIZE ), + + // HID Control Point Char. Declaration + ATT_ELMT_DECL_CHAR( HID_IDX_HID_CTRL_PT_CHAR ), + ATT_ELMT( HID_IDX_HID_CTRL_PT_VAL, ATT_CHAR_HID_CTRL_PT, PROP_WC, HID_CTRL_PT_SIZE ), + + // Report Map Char. Declaration and Value + ATT_ELMT_DECL_CHAR( HID_IDX_REPORT_MAP_CHAR ), + ATT_ELMT( HID_IDX_REPORT_MAP_VAL, ATT_CHAR_REPORT_MAP, PROP_RD, 0 ), + + #if (HID_BOOT_SUP) + // Protocol Mode Char. Declaration and Value + ATT_ELMT_DECL_CHAR( HID_IDX_PROTO_MODE_CHAR ), + ATT_ELMT( HID_IDX_PROTO_MODE_VAL, ATT_CHAR_PROTOCOL_MODE, PROP_RD | PROP_WC, HID_PROTO_MODE_SIZE ), + + #if (HID_BOOT_KB) + // Boot Keyboard Input Report Char. Declaration and Value and CCC Descriptor + ATT_ELMT_DECL_CHAR( HID_IDX_BOOT_KB_IN_RPT_CHAR ), + ATT_ELMT( HID_IDX_BOOT_KB_IN_RPT_VAL, ATT_CHAR_BOOT_KB_IN_REPORT, PROP_RD | PROP_NTF, HID_BOOT_REPORT_MAX_LEN ), + ATT_ELMT_DESC_CLI_CHAR_CFG( HID_IDX_BOOT_KB_IN_RPT_NTF_CFG ), + + // Boot Keyboard Output Report Char. Declaration and Value + ATT_ELMT_DECL_CHAR( HID_IDX_BOOT_KB_OUT_RPT_CHAR ), + ATT_ELMT( HID_IDX_BOOT_KB_OUT_RPT_VAL, ATT_CHAR_BOOT_KB_OUT_REPORT, PROP_RD | PROP_WR | PROP_WC, HID_BOOT_REPORT_MAX_LEN ), + #endif //(HID_BOOT_KB) + + #if (HID_BOOT_MOUSE) + // Boot Mouse Input Report Char. Declaration and Value and CCC Descriptor + ATT_ELMT_DECL_CHAR( HID_IDX_BOOT_MOUSE_IN_RPT_CHAR ), + ATT_ELMT( HID_IDX_BOOT_MOUSE_IN_RPT_VAL, ATT_CHAR_BOOT_MOUSE_IN_REPORT, PROP_RD | PROP_NTF, HID_BOOT_REPORT_MAX_LEN ), + ATT_ELMT_DESC_CLI_CHAR_CFG( HID_IDX_BOOT_MOUSE_IN_RPT_NTF_CFG ), + #endif //(HID_BOOT_MOUSE) + #endif //(HID_BOOT_SUP) + + #if (HID_REPORT_SUP) + #if (HID_RPT_KB) + // Keyboard IN Report Char. Declaration and Value, Report Ref. and CCC Descriptor + ATT_ELMT_DECL_CHAR( HID_IDX_KB_IN_RPT_CHAR ), + ATT_ELMT( HID_IDX_KB_IN_RPT_VAL, ATT_CHAR_REPORT, PROP_RD | PROP_NTF, HID_REPORT_MAX_LEN ), + ATT_ELMT_DESC_REPORT_REF( HID_IDX_KB_IN_RPT_REF ), + ATT_ELMT_DESC_CLI_CHAR_CFG( HID_IDX_KB_IN_RPT_NTF_CFG ), + + // Keyboard OUT Report Char. Declaration and Value, Report Ref. Descriptor + ATT_ELMT_DECL_CHAR( HID_IDX_KB_OUT_RPT_CHAR ), + // Report Characteristic Value + ATT_ELMT( HID_IDX_KB_OUT_RPT_VAL, ATT_CHAR_REPORT, PROP_RD | PROP_WR | PROP_WC, HID_REPORT_MAX_LEN ), + // Report Characteristic - Report Reference Descriptor + ATT_ELMT_DESC_REPORT_REF( HID_IDX_KB_OUT_RPT_REF ), + #endif //(HID_RPT_KB) + + #if (HID_RPT_MEDIA) + // Media IN Report Char. Declaration and Value, Report Ref. and CCC Descriptor + ATT_ELMT_DECL_CHAR( HID_IDX_MEDIA_IN_RPT_CHAR ), + ATT_ELMT( HID_IDX_MEDIA_IN_RPT_VAL, ATT_CHAR_REPORT, PROP_RD | PROP_NTF, HID_REPORT_MAX_LEN ), + ATT_ELMT_DESC_REPORT_REF( HID_IDX_MEDIA_IN_RPT_REF ), + ATT_ELMT_DESC_CLI_CHAR_CFG( HID_IDX_MEDIA_IN_RPT_NTF_CFG ), + #endif //(HID_RPT_MEDIA) + + #if (HID_RPT_SYSTEM) + // System IN Report Char. Declaration and Value, Report Ref. and CCC Descriptor + ATT_ELMT_DECL_CHAR( HID_IDX_SYS_IN_RPT_CHAR ), + ATT_ELMT( HID_IDX_SYS_IN_RPT_VAL, ATT_CHAR_REPORT, PROP_RD | PROP_NTF, HID_REPORT_MAX_LEN ), + ATT_ELMT_DESC_REPORT_REF( HID_IDX_SYS_IN_RPT_REF ), + ATT_ELMT_DESC_CLI_CHAR_CFG( HID_IDX_SYS_IN_RPT_NTF_CFG ), + #endif //(HID_RPT_SYSTEM) + + #if (HID_RPT_MOUSE) + // Mouse IN Report Char. Declaration and Value, Report Ref. and CCC Descriptor + ATT_ELMT_DECL_CHAR( HID_IDX_MOUSE_IN_RPT_CHAR ), + ATT_ELMT( HID_IDX_MOUSE_IN_RPT_VAL, ATT_CHAR_REPORT, PROP_RD | PROP_NTF, HID_REPORT_MAX_LEN ), + ATT_ELMT_DESC_REPORT_REF( HID_IDX_MOUSE_IN_RPT_REF ), + ATT_ELMT_DESC_CLI_CHAR_CFG( HID_IDX_MOUSE_IN_RPT_NTF_CFG ), + #endif //(HID_RPT_MOUSE) + + #if (HID_RPT_PTP) + // TouchPad IN Report Char. Declaration and Value, Report Ref. and CCC Descriptor + ATT_ELMT_DECL_CHAR( HID_IDX_TP_IN_RPT_CHAR ), + ATT_ELMT( HID_IDX_TP_IN_RPT_VAL, ATT_CHAR_REPORT, PROP_RD | PROP_NTF, HID_REPORT_MAX_LEN ), + ATT_ELMT_DESC_REPORT_REF( HID_IDX_TP_IN_RPT_REF ), + ATT_ELMT_DESC_CLI_CHAR_CFG( HID_IDX_TP_IN_RPT_NTF_CFG ), + + // Max Count Feature Report Char. Declaration and Value, Report Ref. Descriptor + ATT_ELMT_DECL_CHAR( HID_IDX_MAXCNT_FEAT_RPT_CHAR ), + ATT_ELMT( HID_IDX_MAXCNT_FEAT_RPT_VAL, ATT_CHAR_REPORT, PROP_RD | PROP_WR, HID_REPORT_MAX_LEN ), + ATT_ELMT_DESC_REPORT_REF( HID_IDX_MAXCNT_FEAT_RPT_REF ), + + // PTPHQA Feature Report Char. Declaration and Value, Report Ref. Descriptor + ATT_ELMT_DECL_CHAR( HID_IDX_PTPHQA_FEAT_RPT_CHAR ), + ATT_ELMT( HID_IDX_PTPHQA_FEAT_RPT_VAL, ATT_CHAR_REPORT, PROP_RD | PROP_WR, HID_REPORT_MAX_LEN ), + ATT_ELMT_DESC_REPORT_REF( HID_IDX_PTPHQA_FEAT_RPT_REF ), + #endif //(HID_RPT_PTP) + #endif //(HID_REPORT_SUP) +}; + +/// Service Description +const struct svc_decl hid_svc_db = +{ + .uuid = ATT_SVC_HID, + .info = SVC_UUID(16) | SVC_SEC(UNAUTH), + .atts = hid_atts, + .nb_att = HID_IDX_NB - 1, +}; + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @section SVC FUNCTIONS + **************************************************************************************** + */ + +/// Retrieve attribute index form handle +static uint8_t hids_get_att_idx(uint16_t handle) +{ + ASSERT_ERR((handle >= hids_env.start_hdl) && (handle < hids_env.start_hdl + HID_IDX_NB)); + + return (handle - hids_env.start_hdl); +} + +/// Retrieve Report attribute handle from rpt_idx (@see rpt_ntf_idx) or ATT_INVALID_HDL +static uint16_t hids_get_rpt_handle(uint8_t rpt_idx) +{ + uint8_t att_idx = 0; + + switch (rpt_idx) + { + #if (HID_BOOT_SUP) + #if (HID_BOOT_KB) + case RPT_IDX_BOOT_KB: + { + att_idx = HID_IDX_BOOT_KB_IN_RPT_VAL; + } break; + #endif //(HID_BOOT_KB) + + #if (HID_BOOT_MOUSE) + case RPT_IDX_BOOT_MOUSE: + { + att_idx = HID_IDX_BOOT_MOUSE_IN_RPT_VAL; + } break; + #endif //(HID_BOOT_MOUSE) + #endif //(HID_BOOT_SUP) + + #if (HID_REPORT_SUP) + #if (HID_RPT_KB) + case RPT_IDX_KB: + { + att_idx = HID_IDX_KB_IN_RPT_VAL; + } break; + #endif //(HID_RPT_KB) + + #if (HID_RPT_MEDIA) + case RPT_IDX_MEDIA: + { + att_idx = HID_IDX_MEDIA_IN_RPT_VAL; + } break; + #endif //(HID_RPT_MEDIA) + + #if (HID_RPT_SYSTEM) + case RPT_IDX_SYSTEM: + { + att_idx = HID_IDX_SYS_IN_RPT_VAL; + } break; + #endif //(HID_RPT_SYSTEM) + + #if (HID_RPT_MOUSE) + case RPT_IDX_MOUSE: + { + att_idx = HID_IDX_MOUSE_IN_RPT_VAL; + } break; + #endif //(HID_RPT_MOUSE) + + #if (HID_RPT_PTP) + case RPT_IDX_TP: + { + att_idx = HID_IDX_TP_IN_RPT_VAL; + } break; + #endif //(HID_RPT_PTP) + #endif //(HID_REPORT_SUP) + + default: + { + att_idx = 0; // error index + } break; + } + + return (att_idx) ? (hids_env.start_hdl + att_idx) : ATT_INVALID_HDL; +} + +/// update configuration if value for stop or NTF start +static uint8_t hids_rpt_ntf_cfg(uint8_t conidx, uint8_t rpt_idx, const struct atts_write_ind *ind) +{ + uint8_t status = PRF_ERR_APP_ERROR; + + if ((!ind->more) && (ind->length == sizeof(uint16_t))) + { + uint16_t cli_cfg = read16p(ind->value); + + //if ((cli_cfg == PRF_CLI_STOP_NTFIND) || (cli_cfg == PRF_CLI_START_NTF)) + if (cli_cfg <= PRF_CLI_START_NTF) + { + DEBUG(" RPT_NTF_CFG(idx:%d,cfg:%d)", rpt_idx, cli_cfg); + + HID_RPT_NTF_SET(conidx, rpt_idx, cli_cfg); + status = LE_SUCCESS; + } + } + + return status; +} + +/// Confirm ATTS_WRITE_REQ +static void hids_att_write_cfm(uint8_t conidx, uint8_t att_idx, uint16_t handle, const struct atts_write_ind *ind) +{ + uint8_t status = LE_SUCCESS; + + switch (att_idx) + { + case HID_IDX_HID_CTRL_PT_VAL: + { + ASSERT_ERR(ind->length == HID_CTRL_PT_SIZE); + + DEBUG(" HID_CTRL_PT:%d", ind->value[0]); + hids_env.conn[conidx].ctrl_pt = ind->value[0]; + } break; + + #if (HID_BOOT_SUP) + case HID_IDX_PROTO_MODE_VAL: + { + ASSERT_ERR(ind->length == HID_PROTO_MODE_SIZE); + + DEBUG(" PROTO_MODE:%d", ind->value[0]); + hids_env.conn[conidx].proto_mode = ind->value[0]; + } break; + + #if (HID_BOOT_KB) + case HID_IDX_BOOT_KB_IN_RPT_NTF_CFG: + { + status = hids_rpt_ntf_cfg(conidx, RPT_IDX_BOOT_KB, ind); + } break; + + case HID_IDX_BOOT_KB_OUT_RPT_VAL: + { + ASSERT_ERR(ind->length == HID_KB_OUT_RPT_SIZE); + + DEBUG(" Led_Lock(b0:num,b1:caps,b2:scroll):0x%02x", ind->value[0]); + hids_env.conn[conidx].led_lock = ind->value[0]; + hids_led_lock(ind->value[0]); + } break; + #endif //(HID_BOOT_KB) + + #if (HID_BOOT_MOUSE) + case HID_IDX_BOOT_MOUSE_IN_RPT_NTF_CFG: + { + status = hids_rpt_ntf_cfg(conidx, RPT_IDX_BOOT_MOUSE, ind); + } break; + #endif //(HID_BOOT_MOUSE) + #endif //(HID_BOOT_SUP) + + #if (HID_REPORT_SUP) + #if (HID_RPT_KB) + case HID_IDX_KB_IN_RPT_NTF_CFG: + { + status = hids_rpt_ntf_cfg(conidx, RPT_IDX_KB, ind); + } break; + + case HID_IDX_KB_OUT_RPT_VAL: + { + ASSERT_ERR(ind->length == HID_KB_OUT_RPT_SIZE); + + DEBUG(" Led_Lock(b0:num,b1:caps,b2:scroll):0x%02x", ind->value[0]); + hids_env.conn[conidx].led_lock = ind->value[0]; + hids_led_lock(ind->value[0]); + } break; + #endif //(HID_RPT_KB) + + #if (HID_RPT_MEDIA) + case HID_IDX_MEDIA_IN_RPT_NTF_CFG: + { + status = hids_rpt_ntf_cfg(conidx, RPT_IDX_MEDIA, ind); + } break; + #endif //(HID_RPT_MEDIA) + + #if (HID_RPT_SYSTEM) + case HID_IDX_SYS_IN_RPT_NTF_CFG: + { + status = hids_rpt_ntf_cfg(conidx, RPT_IDX_SYSTEM, ind); + } break; + #endif //(HID_RPT_SYSTEM) + + #if (HID_RPT_MOUSE) + case HID_IDX_MOUSE_IN_RPT_NTF_CFG: + { + status = hids_rpt_ntf_cfg(conidx, RPT_IDX_MOUSE, ind); + } break; + #endif //(HID_RPT_MOUSE) + + #if (HID_RPT_PTP) + case HID_IDX_TP_IN_RPT_NTF_CFG: + { + status = hids_rpt_ntf_cfg(conidx, RPT_IDX_TP, ind); + } break; + + case HID_IDX_MAXCNT_FEAT_RPT_VAL: + case HID_IDX_PTPHQA_FEAT_RPT_VAL: + { + // maybe do something + } break; + #endif //(HID_RPT_PTP) + #endif //(HID_REPORT_SUP) + + default: + { + status = PRF_ERR_APP_ERROR; + } break; + } + + // Send write confirm, if no more data. + if (!ind->more) + gatt_write_cfm(conidx, status, handle); +} + +/// Confirm ATTS_READ_REQ +static void hids_att_read_cfm(uint8_t conidx, uint8_t att_idx, uint16_t handle) +{ + uint16_t length = 0; + + switch (att_idx) + { + case HID_IDX_HID_INFO_VAL: + { + struct hid_info_tag hid_info; + + hid_info.bcdHID = HID_INFO_BCDHID; + hid_info.bCountryCode = HID_INFO_BCODE; + hid_info.flags = HID_INFO_FLAGS; + DEBUG(" Read HID_INFO(bcd:0x%04X)", hid_info.bcdHID); + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_INFO_SIZE, (uint8_t *)&hid_info); + } break; + + case HID_IDX_REPORT_MAP_VAL: + { + const uint8_t *report_map = hid_get_report_map(&length); + + DEBUG(" Read REPORT_MAP(size:%d)", length); + gatt_read_cfm(conidx, LE_SUCCESS, handle, length, report_map); + } break; + + #if (HID_BOOT_SUP) + case HID_IDX_PROTO_MODE_VAL: + { + DEBUG(" Read PROTO_MODE(mode:%d)", hids_env.conn[conidx].proto_mode); + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_PROTO_MODE_SIZE, &(hids_env.conn[conidx].proto_mode)); + } break; + + #if (HID_BOOT_KB) + case HID_IDX_BOOT_KB_IN_RPT_VAL: + { + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_BOOT_KB_RPT_SIZE, NULL); // zero array + } break; + + case HID_IDX_BOOT_KB_IN_RPT_NTF_CFG: + { + uint16_t ntf_cfg = HID_RPT_NTF_GET(conidx, RPT_IDX_BOOT_KB); + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint16_t), (uint8_t *)&ntf_cfg); + } break; + + case HID_IDX_BOOT_KB_OUT_RPT_VAL: + { + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_KB_OUT_RPT_SIZE, &(hids_env.conn[conidx].led_lock)); + } break; + #endif //(HID_BOOT_KB) + + #if (HID_BOOT_MOUSE) + case HID_IDX_BOOT_MOUSE_IN_RPT_VAL: + { + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_BOOT_MOUSE_RPT_SIZE, NULL); // zero array + } break; + + case HID_IDX_BOOT_MOUSE_IN_RPT_NTF_CFG: + { + uint16_t ntf_cfg = HID_RPT_NTF_GET(conidx, RPT_IDX_BOOT_MOUSE); + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint16_t), (uint8_t *)&ntf_cfg); + } break; + #endif //(HID_BOOT_MOUSE) + #endif //(HID_BOOT_SUP) + + #if (HID_REPORT_SUP) + #if (HID_RPT_KB) + case HID_IDX_KB_IN_RPT_VAL: + { + gatt_read_cfm(conidx, LE_SUCCESS, handle, RPT_LEN_KB, NULL); // zero array + } break; + + case HID_IDX_KB_IN_RPT_REF: + { + struct hid_report_ref refer; + + refer.report_id = RPT_ID_KB; + refer.report_type = HID_REPORT_INPUT; + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_REPORT_REF_SIZE, (uint8_t *)&refer); + } break; + + case HID_IDX_KB_IN_RPT_NTF_CFG: + { + uint16_t ntf_cfg = HID_RPT_NTF_GET(conidx, RPT_IDX_KB); + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint16_t), (uint8_t *)&ntf_cfg); + } break; + + case HID_IDX_KB_OUT_RPT_VAL: + { + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_KB_OUT_RPT_SIZE, &(hids_env.conn[conidx].led_lock)); + } break; + + case HID_IDX_KB_OUT_RPT_REF: + { + struct hid_report_ref refer; + + refer.report_id = RPT_ID_KB; + refer.report_type = HID_REPORT_OUTPUT; + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_REPORT_REF_SIZE, (uint8_t *)&refer); + } break; + #endif //(HID_RPT_KB) + + #if (HID_RPT_MEDIA) + case HID_IDX_MEDIA_IN_RPT_VAL: + { + gatt_read_cfm(conidx, LE_SUCCESS, handle, RPT_LEN_MEDIA, NULL); // zero array + } break; + + case HID_IDX_MEDIA_IN_RPT_REF: + { + struct hid_report_ref refer; + + refer.report_id = RPT_ID_MEDIA; + refer.report_type = HID_REPORT_INPUT; + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_REPORT_REF_SIZE, (uint8_t *)&refer); + } break; + + case HID_IDX_MEDIA_IN_RPT_NTF_CFG: + { + uint16_t ntf_cfg = HID_RPT_NTF_GET(conidx, RPT_IDX_MEDIA); + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint16_t), (uint8_t *)&ntf_cfg); + } break; + #endif //(HID_RPT_MEDIA) + + #if (HID_RPT_SYSTEM) + case HID_IDX_SYS_IN_RPT_VAL: + { + gatt_read_cfm(conidx, LE_SUCCESS, handle, RPT_LEN_SYSTEM, NULL); // zero array + } break; + + case HID_IDX_SYS_IN_RPT_REF: + { + struct hid_report_ref refer; + + refer.report_id = RPT_ID_SYSTEM; + refer.report_type = HID_REPORT_INPUT; + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_REPORT_REF_SIZE, (uint8_t *)&refer); + } break; + + case HID_IDX_SYS_IN_RPT_NTF_CFG: + { + uint16_t ntf_cfg = HID_RPT_NTF_GET(conidx, RPT_IDX_SYSTEM); + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint16_t), (uint8_t *)&ntf_cfg); + } break; + #endif //(HID_RPT_SYSTEM) + + #if (HID_RPT_MOUSE) + case HID_IDX_MOUSE_IN_RPT_VAL: + { + gatt_read_cfm(conidx, LE_SUCCESS, handle, RPT_LEN_MOUSE, NULL); // zero array + } break; + + case HID_IDX_MOUSE_IN_RPT_REF: + { + struct hid_report_ref refer; + + refer.report_id = RPT_ID_MOUSE; + refer.report_type = HID_REPORT_INPUT; + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_REPORT_REF_SIZE, (uint8_t *)&refer); + } break; + + case HID_IDX_MOUSE_IN_RPT_NTF_CFG: + { + uint16_t ntf_cfg = HID_RPT_NTF_GET(conidx, RPT_IDX_MOUSE); + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint16_t), (uint8_t *)&ntf_cfg); + } break; + #endif //(HID_RPT_MOUSE) + + #if (HID_RPT_PTP) + case HID_IDX_TP_IN_RPT_VAL: + { + gatt_read_cfm(conidx, LE_SUCCESS, handle, RPT_LEN_TP, NULL); // zero array + } break; + + case HID_IDX_TP_IN_RPT_REF: + { + struct hid_report_ref refer; + + refer.report_id = RPT_ID_TP; + refer.report_type = HID_REPORT_INPUT; + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_REPORT_REF_SIZE, (uint8_t *)&refer); + } break; + + case HID_IDX_TP_IN_RPT_NTF_CFG: + { + uint16_t ntf_cfg = HID_RPT_NTF_GET(conidx, RPT_IDX_TP); + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint16_t), (uint8_t *)&ntf_cfg); + } break; + + case HID_IDX_MAXCNT_FEAT_RPT_VAL: + { + uint8_t finger = PTP_MAX_FINGER_CNT; + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint8_t), &finger); + } break; + + case HID_IDX_MAXCNT_FEAT_RPT_REF: + { + struct hid_report_ref refer; + + refer.report_id = RPT_ID_MAXCNT; + refer.report_type = HID_REPORT_FEATURE; + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_REPORT_REF_SIZE, (uint8_t *)&refer); + } break; + + case HID_IDX_PTPHQA_FEAT_RPT_VAL: + { + const uint8_t *ptp_hqa = hid_get_ptphqa_blob(&length); + gatt_read_cfm(conidx, LE_SUCCESS, handle, length, ptp_hqa); + } break; + + case HID_IDX_PTPHQA_FEAT_RPT_REF: + { + struct hid_report_ref refer; + + refer.report_id = RPT_ID_PTPHQA; + refer.report_type = HID_REPORT_FEATURE; + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_REPORT_REF_SIZE, (uint8_t *)&refer); + } break; + #endif //(HID_RPT_PTP) + #endif //(HID_REPORT_SUP) + + default: + { + // error response + gatt_read_cfm(conidx, PRF_ERR_APP_ERROR, handle, 0, NULL); + } break; + } +} + +/// Handles reception of the atts request from peer device +static void hids_svc_func(uint8_t conidx, uint8_t opcode, uint16_t handle, const void *param) +{ + uint8_t att_idx = hids_get_att_idx(handle); + + ASSERT_ERR(coindx < HID_CONN_MAX); + DEBUG("svc_func(cid:%d,op:0x%x,hdl:0x%x,att:%d)", conidx, opcode, handle, att_idx); + + switch (opcode) + { + case ATTS_READ_REQ: + { + hids_att_read_cfm(conidx, att_idx, handle); + } break; + + case ATTS_WRITE_REQ: + { + const struct atts_write_ind *ind = param; + + DEBUG(" write_req(hdl:0x%x,att:%d,wr:0x%x,len:%d)", handle, att_idx, ind->wrcode, ind->length); + hids_att_write_cfm(conidx, att_idx, handle, ind); + } break; + + case ATTS_INFO_REQ: + { + uint16_t length = ATT_MAX_LEN_GET(att_idx, hid_atts); + + // Send length-info confirm for prepWR judging. + DEBUG(" info_cfm(hdl:0x%x,att:%d,len:%d)", handle, att_idx, length); + gatt_info_cfm(conidx, LE_SUCCESS, handle, length); + } break; + + case ATTS_CMP_EVT: + { + const struct atts_cmp_evt *evt = param; + + hids_env.nb_pkt++; // release + + DEBUG(" cmp_evt(op:0x%x,sta:0x%x,nb:%d)", evt->operation, evt->status, hids_env.nb_pkt); + // add 'if' to avoid warning #117-D: "evt" never referenced + if (evt->operation == GATT_NOTIFY) + { + // Notify result + } + } break; + + default: + { + // nothing to do + } break; + } +} + + +/** + **************************************************************************************** + * @section API FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Add HID Service Profile in the DB + * Customize via pre-define @see HID_START_HDL + * + * @return Result status, LE_SUCCESS or Error Reason + **************************************************************************************** + */ +uint8_t hids_prf_init(void) +{ + uint8_t status = LE_SUCCESS; + + // Init Environment + hids_env.start_hdl = HID_START_HDL; + hids_env.nb_pkt = HID_NB_PKT_MAX; + + for (uint8_t conidx = 0; conidx < HID_CONN_MAX; conidx++) + { + hids_env.conn[conidx].rpt_ntfs = RPT_NTF_ALL; + hids_env.conn[conidx].led_lock = 0; + hids_env.conn[conidx].proto_mode = HID_REPORT_PROTOCOL_MODE; + hids_env.conn[conidx].ctrl_pt = HID_CTRL_PT_EXIT_SUSPEND; + } + + // Create Service in database + status = attmdb_svc_create(&hids_env.start_hdl, NULL, &hid_svc_db, hids_svc_func); + DEBUG("svc_init(sta:0x%X,shdl:%d,atts:%d)", status, hids_env.start_hdl, HID_IDX_NB-1); + + return status; +} + +/** + **************************************************************************************** + * @brief Show LED Lock of Keyboard Output, User Implement! (__weak func) + * + * @param[in] leds Bits of Led_Lock(b0:num,b1:caps,b2:scroll) + **************************************************************************************** + */ +__weak void hids_led_lock(uint8_t leds) +{ + // todo LED play... +} + +/** + **************************************************************************************** + * @brief Enable HID Notification Configurations. + * + * @param[in] conidx Connection index + * @param[in] rpt_ntf Notification Config Bits @see enum rpt_ntf_idx + **************************************************************************************** + */ +void hids_set_ccc(uint8_t conidx, uint8_t rpt_ntf) +{ + //if (gapc_get_conhdl(conidx) != GAP_INVALID_CONHDL) + { + // update configuration + hids_env.conn[conidx].rpt_ntfs = rpt_ntf; + } +} + +/** + **************************************************************************************** + * @brief Send HID Report to Host peer. + * + * @param[in] conidx Connection Index + * @param[in] rep_idx Report Index + * @param[in] rep_len Report Length + * @param[in] rep_val Report Value + * + * @return Status of the operation @see prf_err + **************************************************************************************** + */ +uint8_t hids_report_send(uint8_t conidx, uint8_t rep_idx, uint16_t rep_len, const uint8_t* rep_val) +{ + uint8_t status = PRF_ERR_REQ_DISALLOWED; + + if ((rep_len > 0) && (hids_env.nb_pkt > 0)) + { + if (HID_RPT_NTF_GET(conidx, rep_idx) == PRF_CLI_START_NTF) + { + uint16_t handle = hids_get_rpt_handle(rep_idx); + + if (handle != ATT_INVALID_HDL) + { + hids_env.nb_pkt--; // allocate + DEBUG("hid_ntf_send(len:%d,nb:%d)", rep_len, hids_env.nb_pkt); + debugHex(rep_val, rep_len); + gatt_ntf_send(conidx, handle, rep_len, rep_val); + status = LE_SUCCESS; + } + } + else + { + status = PRF_ERR_NTF_DISABLED; + } + } + + return status; +} + + +#endif //(PRF_HIDS) diff --git a/ble/prf/prf_hids.h b/ble/prf/prf_hids.h new file mode 100644 index 0000000..e6817f2 --- /dev/null +++ b/ble/prf/prf_hids.h @@ -0,0 +1,171 @@ +/** + **************************************************************************************** + * + * @file prf_hids.h + * + * @brief Header file - HID Service Server Role + * + **************************************************************************************** + */ + +#ifndef PRF_HIDS_H_ +#define PRF_HIDS_H_ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Server Start Handle(0 = dynamically allocated) +#if !defined(HID_START_HDL) + #define HID_START_HDL (0) +#endif + +/// Number of reports that can be sent +#if !defined(HID_NB_PKT_MAX) + #define HID_NB_PKT_MAX (10) +#endif + +/// Maximal length of Report/Boot Char. Value +#if !defined(HID_REPORT_MAX_LEN) + #define HID_REPORT_MAX_LEN (64) +#endif + +/// Size of HID BOOT keyboard/mouse report +#define HID_BOOT_REPORT_MAX_LEN (8) +#define HID_BOOT_KB_RPT_SIZE (8) // 1B(ctrlKeys) + 1B(resv0) + 6B(KeyCode) +#define HID_BOOT_MOUSE_RPT_SIZE (4) // 1B(button) + 1B(X) + 1B(Y) + 1B(Wheel) +/// Size of HID keyboard Output report +#define HID_KB_OUT_RPT_SIZE (1) // 1B(leds) + +/// Size of HID Information @see struct hid_info_tag +#define HID_INFO_SIZE (4) +/// Size of HID Control Point @see enum hid_ctrl_pt +#define HID_CTRL_PT_SIZE (1) +/// Size of HID Protocol Mode @see enum hid_proto_mode +#define HID_PROTO_MODE_SIZE (1) +/// Size of HID Report Ref. @see struct hid_report_ref +#define HID_REPORT_REF_SIZE (2) + +/// HID Information, default value +#define HID_INFO_BCDHID (0x0111) // HID Version 1.11 +#define HID_INFO_BCODE (0x00) // bCountryCode +#define HID_INFO_FLAGS (HID_REMOTE_WAKE_CAPABLE | HID_NORM_CONNECTABLE) + + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// HID Information flags +enum hid_info_flags +{ + /// Device capable of providing wake-up signal to a HID host + HID_REMOTE_WAKE_CAPABLE = 0x01, + /// Normally connectable support bit + HID_NORM_CONNECTABLE = 0x02, +}; + +/// Protocol Mode Char. value Keys +enum hid_proto_mode +{ + /// Boot Protocol Mode + HID_BOOT_PROTOCOL_MODE = 0x00, + /// Report Protocol Mode + HID_REPORT_PROTOCOL_MODE = 0x01, +}; + +/// HID Control Point Characteristic value keys +enum hid_ctrl_pt +{ + /// Suspend + HID_CTRL_PT_SUSPEND = 0x00, + /// Exit suspend + HID_CTRL_PT_EXIT_SUSPEND = 0x01, +}; + +/// Report Reference Char. Configuration Values +enum hid_report_type +{ + /// Input Report(RD & NTF) + HID_REPORT_INPUT = 0x01, + /// Output Report(RD & WR & WC) + HID_REPORT_OUTPUT = 0x02, + /// Feature Report(RD & WR) + HID_REPORT_FEATURE = 0x03, +}; + +/// HID Information structure +struct hid_info_tag +{ + /// bcdHID + uint16_t bcdHID; + /// bCountryCode + uint8_t bCountryCode; + /// Flags + uint8_t flags; +}; + +/// Report Reference structure +struct hid_report_ref +{ + /// Report ID + uint8_t report_id; + /// Report Type + uint8_t report_type; +}; + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Add HID Service Profile in the DB + * Customize via pre-define @see HID_START_HDL + * + * @return Result status, LE_SUCCESS or Error Reason + **************************************************************************************** + */ +uint8_t hids_prf_init(void); + +/** + **************************************************************************************** + * @brief Show LED Lock of Keyboard Output, User Implement! (__weak func) + * + * @param[in] leds Bits of Led_Lock(b0:num,b1:caps,b2:scroll) + **************************************************************************************** + */ +void hids_led_lock(uint8_t leds); + +/** + **************************************************************************************** + * @brief Enable HID Notification Configurations. + * + * @param[in] conidx Connection index + * @param[in] rpt_ntf Notification Config Bits @see enum rpt_ntf_idx. + **************************************************************************************** + */ +void hids_set_ccc(uint8_t conidx, uint8_t rpt_ntf); + +/** + **************************************************************************************** + * @brief Send HID Report to Host peer. + * + * @param[in] conidx Connection Index + * @param[in] rep_idx Report Index + * @param[in] rep_len Report Length + * @param[in] rep_val Report Value + * @return Status of the operation @see prf_err + **************************************************************************************** + */ +uint8_t hids_report_send(uint8_t conidx, uint8_t rep_idx, uint16_t rep_len, const uint8_t* rep_val); + + +#endif /* PRF_HIDS_H_ */ diff --git a/ble/prf/prf_otas.c b/ble/prf/prf_otas.c new file mode 100644 index 0000000..c280977 --- /dev/null +++ b/ble/prf/prf_otas.c @@ -0,0 +1,485 @@ +/** + **************************************************************************************** + * + * @file prf_otas.c + * + * @brief OTA Service - Server Role Implementation. + * + * < If want to modify it, recommend to copy the file to 'user porject'/src > + **************************************************************************************** + */ + +#if (PRF_OTAS) + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "prf.h" +#include "prf_otas.h" + +#if (DBG_OTAS) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// Max length of received once +#if !defined(OTA_RXD_MAX_LEN) + #define OTA_RXD_MAX_LEN (20) +#endif + +/// Max number of notify/indicate pkt +#if !defined(OTA_NB_PKT_MAX) + #define OTA_NB_PKT_MAX (5) +#endif + +/// Version String for OTA_IDX_READ_VAL Read +#define OTA_VERS_STR ("bleOTA v1.0") +#define OTA_VERS_STR_LEN (sizeof(OTA_VERS_STR) - 1) + +/// Macro for Client Config value operation +#define OTA_NTF_CFG_GET(conidx) \ + ((otas_env.ntf_bits >> (conidx*2)) & (PRF_CLI_START_NTF | PRF_CLI_START_IND)) + +#define OTA_NTF_CFG_CLR(conidx) \ + otas_env.ntf_bits &= ~((PRF_CLI_START_NTF | PRF_CLI_START_IND) << (conidx*2)) + +#define OTA_NTF_CFG_SET(conidx, conf) \ + otas_env.ntf_bits = (otas_env.ntf_bits & ~((PRF_CLI_START_NTF | PRF_CLI_START_IND) << (conidx*2))) | ((conf) << (conidx*2)) + + +/** + **************************************************************************************** + * @section ENVIRONMENT DEFINITION + **************************************************************************************** + */ + +/// Server Environment Variable +typedef struct otas_env_tag +{ + // Service Start Handle + uint16_t start_hdl; + // Client Config of peer devices - each 2Bits(NTF & IND), so max_peer=8. + uint16_t ntf_bits; + // Number of notify pkt + uint8_t nb_pkt; +} otas_env_t; + +/// Global Variable Declarations +otas_env_t otas_env; + + +/** + **************************************************************************************** + * @section ATTRIBUTES DEFINITION + **************************************************************************************** + */ + +/// Attributes Index +enum ota_att_idx +{ + // Service Declaration, *MUST* Start at 0 + OTA_IDX_SVC, + + // Serial TXD Char. + OTA_IDX_TXD_CHAR, + OTA_IDX_TXD_VAL, + OTA_IDX_TXD_NTF_CFG, + + // Serial RXD Char. + OTA_IDX_RXD_CHAR, + OTA_IDX_RXD_VAL, //5 + + #if (OTA_READ_SUP) + // Serial READ Char. + OTA_IDX_READ_CHAR, + OTA_IDX_READ_VAL, + #endif + + // Max Index, *NOTE* Minus 1(Svc Decl) is .nb_att + OTA_IDX_NB, +}; + +#if (OTA_UUID_128) +/// Characteristic Base UUID128 (User Customize) +#define OTA_ATT_UUID128(uuid) { 0xFC, 0x12, 0x41, 0x2A, 0xD2, 0xDE, 0x7E, 0x1D, \ + 0x4D, 0x47, 0xA2, 0x09, (uuid) & 0xFF, (uuid >> 8) & 0xFF, 0x00, 0x00 } + +/// Serial Service UUID128 +const uint8_t ota_svc_uuid[] = OTA_ATT_UUID128(0xFF50); +/// Serial Notify UUID128 +const uint8_t ota_char_txd_notify[] = OTA_ATT_UUID128(0xFF51); +/// Serial Write Command UUID128 +const uint8_t ota_char_rxd_write[] = OTA_ATT_UUID128(0xFF52); +/// Serial Read Command UUID128 +const uint8_t ota_char_val_read[] = OTA_ATT_UUID128(0xFF53); + +/// Attributes Description +const att_decl_t ota_atts[] = +{ + // Serial Notify Char. Declaration and Value and Client Char. Configuration Descriptor + ATT_ELMT_DECL_CHAR( OTA_IDX_TXD_CHAR ), + ATT_ELMT128( OTA_IDX_TXD_VAL, ota_char_txd_notify, PROP_NTF | PROP_IND, 0 ), + ATT_ELMT_DESC_CLI_CHAR_CFG( OTA_IDX_TXD_NTF_CFG ), + + // Serial Write Command Char. Declaration and Value + ATT_ELMT_DECL_CHAR( OTA_IDX_RXD_CHAR ), + ATT_ELMT128( OTA_IDX_RXD_VAL, ota_char_rxd_write, PROP_WC | PROP_WR, OTA_RXD_MAX_LEN ), + + #if (OTA_READ_SUP) + // Serial Read Command Char. Declaration and Value + ATT_ELMT_DECL_CHAR( OTA_IDX_READ_CHAR ), + ATT_ELMT128( OTA_IDX_READ_VAL, ota_char_val_read, PROP_RD, 0 ), + #endif //(OTA_READ_SUP) +}; + +/// Service Description +const struct svc_decl ota_svc_db = +{ + .uuid128 = ota_svc_uuid, + .info = SVC_UUID(128), + .atts = ota_atts, + .nb_att = OTA_IDX_NB - 1, +}; + +#else //(OTAS_UUID16) + +/// Serial Service UUID +#define OTA_SVC_UUID ATT_UUID16(0xFF50) +/// Serial Notify UUID +#define OTA_CHAR_TXD_NOTIFY ATT_UUID16(0xFF51) +/// Serial Write Command UUID +#define OTA_CHAR_RXD_WRITE ATT_UUID16(0xFF52) +/// Serial Read Command UUID +#define OTA_CHAR_VAL_READ ATT_UUID16(0xFF53) + +/// Attributes Description +const att_decl_t ota_atts[] = +{ + // Serial Notify Char. Declaration and Value and CCC Descriptor + ATT_ELMT_DECL_CHAR( OTA_IDX_TXD_CHAR ), + ATT_ELMT( OTA_IDX_TXD_VAL, OTA_CHAR_TXD_NOTIFY, PROP_NTF | PROP_IND, 0 ), + ATT_ELMT_DESC_CLI_CHAR_CFG( OTA_IDX_TXD_NTF_CFG ), + + // Serial Write Command Char. Declaration and Value + ATT_ELMT_DECL_CHAR( OTA_IDX_RXD_CHAR ), + ATT_ELMT( OTA_IDX_RXD_VAL, OTA_CHAR_RXD_WRITE, PROP_WC | PROP_WR, OTA_RXD_MAX_LEN ), + + #if (OTA_READ_SUP) + // Serial Read Command Char. Declaration and Value + ATT_ELMT_DECL_CHAR( OTA_IDX_READ_CHAR ), + ATT_ELMT( OTA_IDX_READ_VAL, OTA_CHAR_VAL_READ, PROP_RD, 0 ), + #endif //(OTA_READ_SUP) +}; + +/// Service Description +const struct svc_decl ota_svc_db = +{ + .uuid = OTA_SVC_UUID, + .info = SVC_UUID(16), + .atts = ota_atts, + .nb_att = OTA_IDX_NB - 1, +}; +#endif + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @section SVC FUNCTIONS + **************************************************************************************** + */ + +/// Retrieve attribute handle from index (@see ota_att_idx) +static uint16_t otas_get_att_handle(uint8_t att_idx) +{ + ASSERT_ERR(att_idx < OTA_IDX_NB); + + return att_idx + otas_env.start_hdl; +} + +/// Retrieve attribute index form handle +static uint8_t otas_get_att_idx(uint16_t handle) +{ + ASSERT_ERR((handle >= otas_env.start_hdl) && (handle < otas_env.start_hdl + OTA_IDX_NB)); + + return handle - otas_env.start_hdl; +} + +/// Handles reception of the atts request from peer device +static void otas_svc_func(uint8_t conidx, uint8_t opcode, uint16_t handle, const void *param) +{ + uint8_t att_idx = otas_get_att_idx(handle); + + DEBUG("svc_func(cid:%d,op:0x%x,hdl:0x%x,att:%d)", conidx, opcode, handle, att_idx); + + switch (opcode) + { + case ATTS_READ_REQ: + { + if (att_idx == OTA_IDX_TXD_NTF_CFG) + { + // retrieve notification config + uint16_t cli_cfg = OTA_NTF_CFG_GET(conidx); + + DEBUG(" read_cfm(txd_ntf:%d)", cli_cfg); + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint16_t), (uint8_t *)&cli_cfg); + break; + } + + #if (OTA_READ_SUP) + if (att_idx == OTA_IDX_READ_VAL) + { + otas_cb_rdv(conidx, att_idx, handle); + break; + } + #endif //(OTA_READ_SUP) + + // Send error response + gatt_read_cfm(conidx, PRF_ERR_APP_ERROR, handle, 0, NULL); + } break; + + case ATTS_WRITE_REQ: + { + const struct atts_write_ind *ind = param; + + DEBUG(" write_req(hdl:0x%x,att:%d,wr:0x%x,len:%d)", handle, att_idx, ind->wrcode, ind->length); + + if (att_idx == OTA_IDX_RXD_VAL) + { + // Send write conform first! + if (!ind->more) gatt_write_cfm(conidx, LE_SUCCESS, handle); + + // Next to process data received + otas_cb_rxd(conidx, ind->length, ind->value); + break; + } + + if (att_idx == OTA_IDX_TXD_NTF_CFG) + { + if ((!ind->more) && (ind->length == sizeof(uint16_t))) + { + uint16_t cli_cfg = read16p(ind->value); + + // update configuration if value for stop or NTF/IND start + if (cli_cfg <= PRF_CLI_START_IND) + { + DEBUG(" set txd_ntf(cid:%d,cfg:%d)", conidx, cli_cfg); + + OTA_NTF_CFG_SET(conidx, cli_cfg); + // Send write conform quickly! + gatt_write_cfm(conidx, LE_SUCCESS, handle); + + #if (OTA_CLI_CFG) + // Next to process cli_cfg changed + otas_cb_ccc(conidx, cli_cfg); + #endif //(OTA_CLI_CFG) + break; + } + } + } + + // Send write conform with error! + gatt_write_cfm(conidx, PRF_ERR_APP_ERROR, handle); + } break; + + case ATTS_INFO_REQ: + { + uint8_t status = LE_SUCCESS; + uint16_t length = 0; + + if (att_idx == OTA_IDX_RXD_VAL) + { + length = OTA_RXD_MAX_LEN; // accepted length + } + else if (att_idx == OTA_IDX_TXD_NTF_CFG) + { + length = sizeof(uint16_t); // CCC attribute + } + else + { + status = ATT_ERR_WRITE_NOT_PERMITTED; + } + + // Send length-info confirm for prepWR judging. + DEBUG(" info_cfm(hdl:0x%x,att:%d,sta:0x%X,len:%d)", handle, att_idx, status, length); + gatt_info_cfm(conidx, status, handle, length); + } break; + + case ATTS_CMP_EVT: + { + const struct atts_cmp_evt *evt = param; + + otas_env.nb_pkt++; // release + + DEBUG(" cmp_evt(op:0x%x,sta:0x%x,nb:%d)", evt->operation, evt->status, otas_env.nb_pkt); + // add 'if' to avoid warning #117-D: "evt" never referenced + if (evt->operation == GATT_NOTIFY) + { + // Notify result + } + } break; + + default: + { + // nothing to do + } break; + } +} + + +/** + **************************************************************************************** + * @section API FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Add Serial Service Profile in the DB. + * Customize via pre-define @see OTA_START_HDL + * + * @return Result status, LE_SUCCESS or Error Reason + **************************************************************************************** + */ +uint8_t otas_svc_init(void) +{ + uint8_t status = LE_SUCCESS; + + // Init Environment + otas_env.start_hdl = OTA_START_HDL; + otas_env.nb_pkt = OTA_NB_PKT_MAX; + otas_env.ntf_bits = 0; + + // Create Service in database + status = attmdb_svc_create(&otas_env.start_hdl, NULL, &ota_svc_db, otas_svc_func); + + DEBUG("svc_init(sta:0x%X,shdl:%d,nb_pkt:%d,ntf_bits:0x%X)", + status, otas_env.start_hdl, otas_env.nb_pkt, otas_env.ntf_bits); + + return status; +} + +/** + **************************************************************************************** + * @brief Enable setting client configuration characteristics + * + * @param[in] conidx Connection index + * @param[in] cli_cfg Client configuration @see prf_cli_conf + **************************************************************************************** + */ +void otas_set_ccc(uint8_t conidx, uint8_t cli_cfg) +{ + //if (gapc_get_conhdl(conidx) != GAP_INVALID_CONHDL) + { + // update configuration + OTA_NTF_CFG_SET(conidx, cli_cfg); + } +} + +/** + **************************************************************************************** + * @brief Transmit data to peer device via NTF or IND + * + * @param[in] conidx peer device connection index + * @param[in] len Length of data + * @param[in] data pointer of buffer + * + * @return Status of the operation @see prf_err + **************************************************************************************** + */ +uint8_t otas_txd_send(uint8_t conidx, uint16_t len, const uint8_t* data) +{ + uint8_t status = PRF_ERR_REQ_DISALLOWED; + + if ((len > 0) && (otas_env.nb_pkt > 0)) + { + uint8_t ntf_cfg = OTA_NTF_CFG_GET(conidx); + + if (ntf_cfg != PRF_CLI_STOP_NTFIND) + { + status = LE_SUCCESS; + gatt_ntf_send(conidx, otas_get_att_handle(OTA_IDX_TXD_VAL), len, data); + + otas_env.nb_pkt--; // allocate + DEBUG("txd_send(len:%d,nb:%d)", len, otas_env.nb_pkt); + } + else + { + status = PRF_ERR_NTF_DISABLED; + } + } + + return status; +} + +/** + **************************************************************************************** + * @brief Callback on received data from peer device via WC or WQ (__weak func) + * + * @param[in] conidx peer device connection index + * @param[in] len Length of data + * @param[in] data pointer of buffer + **************************************************************************************** + */ +__weak void otas_cb_rxd(uint8_t conidx, uint16_t len, const uint8_t *data) +{ + debugHex(data, len); + + // Loopback to txd, just test. + //otas_txd_send(conidx, len, data); +} + +#if (OTA_READ_SUP) +/** + **************************************************************************************** + * @brief Callback to response 'READ' from peer device (__weak func) + * + * @param[in] conidx peer device connection index + * @param[in] attidx SESS attribute index, converted with 'handle' + * @param[in] handle SESS attribute handle to send read cfm + * + * @return Length of value been READ + **************************************************************************************** + */ +__weak void otas_cb_rdv(uint8_t conidx, uint8_t attidx, uint16_t handle) +{ + uint16_t length = OTA_VERS_STR_LEN; + const uint8_t *p_data = (const uint8_t *)OTA_VERS_STR; + + DEBUG(" read_cfm(att:%d, len:%d)", attidx, length); + gatt_read_cfm(conidx, LE_SUCCESS, handle, length, p_data); +} +#endif //(OTA_READ_SUP) + +#if (OTA_CLI_CFG) +/** + **************************************************************************************** + * @brief Callback on enabled client config from peer device via WQ (__weak func) + * + * @param[in] conidx Connection index + * @param[in] cli_cfg Client configuration @see prf_cli_conf + **************************************************************************************** + */ +__weak void otas_cb_ccc(uint8_t conidx, uint8_t cli_cfg) +{ + // user override +} +#endif //(OTA_CLI_CFG) + + +#endif //PRF_OTAS diff --git a/ble/prf/prf_otas.h b/ble/prf/prf_otas.h new file mode 100644 index 0000000..69176ae --- /dev/null +++ b/ble/prf/prf_otas.h @@ -0,0 +1,119 @@ +/** + **************************************************************************************** + * + * @file prf_otas.h + * + * @brief Header file - OTA Service Profile (Server Role). + * + **************************************************************************************** + */ + +#ifndef PRF_OTAS_H_ +#define PRF_OTAS_H_ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Service Start Handle(0 = dynamically allocated) +#if !defined(OTA_START_HDL) + #define OTA_START_HDL (0) +#endif + +/// Use UUID 128bit or 16bit +#if !defined(OTA_UUID128) + #define OTA_UUID128 (1) +#endif + +/// Support READ Characteristic +#if !defined(OTA_READ_SUP) + #define OTA_READ_SUP (1) +#endif + +/// Callback of Client Config enable +#if !defined(OTA_CLI_CFG) + #define OTA_CLI_CFG (0) +#endif + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Add OTA Service Profile in the DB + * Customize via pre-define @see OTA_START_HDL + * + * @return Result status, LE_SUCCESS or Error Reason + **************************************************************************************** + */ +uint8_t otas_svc_init(void); + +/** + **************************************************************************************** + * @brief Enable setting client configuration characteristics + * + * @param[in] conidx Connection index + * @param[in] cli_cfg Client configuration @see prf_cli_conf + **************************************************************************************** + */ +void otas_set_ccc(uint8_t conidx, uint8_t cli_cfg); + +/** + **************************************************************************************** + * @brief Transmit data to peer device via NTF or IND + * + * @param[in] conidx peer device connection index + * @param[in] len Length of data + * @param[in] data pointer of buffer + * + * @return Status of the operation @see prf_err + **************************************************************************************** + */ +uint8_t otas_txd_send(uint8_t conidx, uint16_t len, const uint8_t *data); + +/** + **************************************************************************************** + * @brief Callback on received data from peer device via WC or WQ (__weak func) + * + * @param[in] conidx peer device connection index + * @param[in] len Length of data + * @param[in] data pointer of buffer + **************************************************************************************** + */ +void otas_cb_rxd(uint8_t conidx, uint16_t len, const uint8_t *data); + +#if (OTA_READ_SUP) +/** + **************************************************************************************** + * @brief Callback to response 'READ' from peer device (__weak func) + * + * @param[in] conidx peer device connection index + * @param[in] attidx SESS attribute index, converted with 'handle' + * @param[in] handle SESS attribute handle to send read cfm + * + * @return Length of value been READ + **************************************************************************************** + */ +void otas_cb_rdv(uint8_t conidx, uint8_t attidx, uint16_t handle); +#endif + +#if (OTA_CLI_CFG) +/** + **************************************************************************************** + * @brief Callback on enabled client config from peer device via WQ (__weak func) + * + * @param[in] conidx Connection index + * @param[in] cli_cfg Client configuration @see prf_cli_conf + **************************************************************************************** + */ +void otas_cb_ccc(uint8_t conidx, uint8_t cli_cfg); +#endif + +#endif /* PRF_OTAS_H_ */ diff --git a/ble/prf/prf_ptss.c b/ble/prf/prf_ptss.c new file mode 100644 index 0000000..18b3a14 --- /dev/null +++ b/ble/prf/prf_ptss.c @@ -0,0 +1,783 @@ +/** + **************************************************************************************** + * + * @file prf_ptss.c + * + * @brief Profile Testing Service - Server Role Implementation. + * + * < If want to modify it, recommend to copy the file to 'user porject'/src > + **************************************************************************************** + */ + +#if (PRF_PTSS) + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "prf.h" +#include "prf_ptss.h" + +#if (DBG_PTSS) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// Version String for Read +#define PTS_VERS_STR ("Ver:1.25") +#define PTS_VERS_STR_LEN (sizeof(PTS_VERS_STR) - 1) + +/// Macro for Client Config value operation +#define PTS_CLI_CFG_GET(conidx) \ + ((ptss_env.cli_cfg >> (conidx*2)) & (PRF_CLI_START_NTF | PRF_CLI_START_IND)) + +#define PTS_CLI_CFG_CLR(conidx) \ + ptss_env.cli_cfg &= ~((PRF_CLI_START_NTF | PRF_CLI_START_IND) << (conidx*2)) + +#define PTS_CLI_CFG_SET(conidx, conf) \ + ptss_env.cli_cfg = (ptss_env.cli_cfg & ~((PRF_CLI_START_NTF | PRF_CLI_START_IND) << (conidx*2))) | ((conf) << (conidx*2)) + + +/** + **************************************************************************************** + * @section ENVIRONMENT DEFINITION + **************************************************************************************** + */ + +/// Server Environment Variable +typedef struct ptss_env_tag +{ + // Service Start Handle + uint16_t start_hdl; + // CCC of peer devices(bits). + uint16_t cli_cfg; +} ptss_env_t; + +/// Global Variable Declarations +ptss_env_t ptss_env; + +/// Global state of bonded, changed in gapc +uint8_t pts_bond; + +/// Buffer of received data +static uint16_t recv_len = PTS_DATA_MAX_LEN; +static uint8_t recv_buf[PTS_DATA_MAX_LEN]; + +/// Buffer of read data +static uint16_t read_len = PTS_DATA_MAX_LEN; +static uint8_t read_buf[PTS_DATA_MAX_LEN]; + +/// Buffer of desc data +static uint16_t desc_len = PTS_DESC_MAX_LEN; +static uint8_t desc_buf[PTS_DESC_MAX_LEN]; + + +/** + **************************************************************************************** + * @section ATTRIBUTES DEFINITION + **************************************************************************************** + */ + +/// Service Attributes Indexes +enum pts_att_idx +{ + // Service Declaration, *MUST* Start at 0 + PTS_IDX_SVC, + + // Attribute No.1: NTF/IND/RD + PTS_IDX_ATT1_CHAR, + PTS_IDX_ATT1_VAL, + PTS_IDX_ATT1_DESC, + + // Attribute No.2: WR/WC/WS + PTS_IDX_ATT2_CHAR, + PTS_IDX_ATT2_VAL, + + // Attribute No.3: RD + PTS_IDX_ATT3_CHAR, + PTS_IDX_ATT3_VAL, + + // Max Index, *NOTE* Minus 1(Svc Decl) is .nb_att + PTS_IDX_NB, +}; + +///////////////////////////////////////////////////////////////////////////// +/// *** 0: Test for Normal *** +///////////////////////////////////////////////////////////////////////////// + +#define PTS0_SVC_UUID ATT_UUID16(0xFF00) + +#define PTS0_CHAR_ATT1 ATT_UUID16(0xFF01) +#define PTS0_CHAR_ATT2 ATT_UUID16(0xFF02) +#define PTS0_CHAR_ATT3 ATT_UUID16(0xFF03) + +const att_decl_t pts0_atts[] = +{ + // No.1 Characteristic Declaration and Value and CCC Descriptor + ATT_ELMT_DECL_CHAR( PTS_IDX_ATT1_CHAR ), + ATT_ELMT( PTS_IDX_ATT1_VAL, PTS0_CHAR_ATT1, PROP_NTF|PROP_IND, 0 ), + ATT_ELMT_DESC_CLI_CHAR_CFG( PTS_IDX_ATT1_DESC ), + + // No.2 Characteristic Declaration and Value + ATT_ELMT_DECL_CHAR( PTS_IDX_ATT2_CHAR ), + ATT_ELMT( PTS_IDX_ATT2_VAL, PTS0_CHAR_ATT2, PROP_WC|PROP_WR|PROP_WS, PTS_DATA_MAX_LEN ), + + // No.3 Characteristic Declaration and Value + ATT_ELMT_DECL_CHAR( PTS_IDX_ATT3_CHAR ), + ATT_ELMT( PTS_IDX_ATT3_VAL, PTS0_CHAR_ATT3, PROP_RD, 0 ), +}; + +const struct svc_decl pts0_svc_db = +{ + .uuid = PTS0_SVC_UUID, + .info = SVC_UUID(16), + .atts = pts0_atts, + .nb_att = PTS_IDX_NB - 1, +}; + +///////////////////////////////////////////////////////////////////////////// +/// *** 1: Test for ERROR *** +///////////////////////////////////////////////////////////////////////////// + +#define PTS1_SVC_UUID ATT_UUID16(0xFF20) + +#define PTS1_CHAR_ATT1 ATT_UUID16(0xFF21) +#define PTS1_CHAR_ATT2 ATT_UUID16(0xFF22) +#define PTS1_CHAR_ATT3 ATT_UUID16(0xFF23) + +const att_decl_t pts1_atts[] = +{ + // No.1 Characteristic Declaration and Value and User Descriptor + ATT_ELMT_DECL_CHAR( PTS_IDX_ATT1_CHAR ), + ATT_ELMT( PTS_IDX_ATT1_VAL, PTS1_CHAR_ATT1, PROP_WC|PROP_WR|PROP_RD, PTS_DATA_MAX_LEN ), + ATT_ELMT( PTS_IDX_ATT1_DESC, ATT_DESC_CHAR_USER_DESCRIPTION, PROP_RD, 0 ), + + // No.2 Characteristic Declaration and Value + ATT_ELMT_DECL_CHAR( PTS_IDX_ATT2_CHAR ), + ATT_ELMT( PTS_IDX_ATT2_VAL, PTS1_CHAR_ATT2, PROP_WC|PROP_WR|PROP_RD, PTS_DATA_MAX_LEN ), + + // No.3 Characteristic Declaration and Value + ATT_ELMT_DECL_CHAR( PTS_IDX_ATT3_CHAR ), + ATT_ELMT( PTS_IDX_ATT3_VAL, PTS1_CHAR_ATT3, PROP_WC|PROP_WR|PROP_RD, PTS_DATA_MAX_LEN ), +}; + +const struct svc_decl pts1_svc_db = +{ + .uuid = PTS1_SVC_UUID, + .info = SVC_UUID(16), + .atts = pts1_atts, + .nb_att = PTS_IDX_NB - 1, +}; + +///////////////////////////////////////////////////////////////////////////// +/// *** 2: Test for UUID128 *** +///////////////////////////////////////////////////////////////////////////// + +#define PTS_ATT_UUID128(uuid) { 0x16, 0x0A, 0x10, 0x40, 0xD1, 0x9F, 0x4C, 0x6C, \ + 0xB4, 0x55, 0xE3, 0xF7, (uuid) & 0xFF, (uuid >> 8) & 0xFF, 0x00, 0x00} + +const uint8_t PTS2_SVC_UUID[] = PTS_ATT_UUID128(0xFF00); + +const uint8_t PTS2_CHAR_ATT1[] = PTS_ATT_UUID128(0xFF01); +const uint8_t PTS2_CHAR_ATT2[] = PTS_ATT_UUID128(0xFF02); +const uint8_t PTS2_CHAR_ATT3[] = PTS_ATT_UUID128(0xFF03); + +const att_decl_t pts2_atts[] = +{ + // No.1 Characteristic Declaration and Value and User Descriptor + ATT_ELMT_DECL_CHAR( PTS_IDX_ATT1_CHAR ), + ATT_ELMT128( PTS_IDX_ATT1_VAL, PTS2_CHAR_ATT1, PROP_RD, 0 ), + ATT_ELMT( PTS_IDX_ATT1_DESC, ATT_DESC_CHAR_USER_DESCRIPTION, PROP_RD|PROP_WR, PTS_DESC_MAX_LEN ), + + // No.2 Characteristic Declaration and Value + ATT_ELMT_DECL_CHAR( PTS_IDX_ATT2_CHAR ), + ATT_ELMT128( PTS_IDX_ATT2_VAL, PTS2_CHAR_ATT2, PROP_WC|PROP_WR|PROP_RD, PTS_DATA_MAX_LEN ), + + // No.3 Characteristic Declaration and Value + ATT_ELMT_DECL_CHAR( PTS_IDX_ATT3_CHAR ), + ATT_ELMT128( PTS_IDX_ATT3_VAL, PTS2_CHAR_ATT3, PROP_RD|PROP_WR, PTS_DATA_MAX_LEN ), +}; + +const struct svc_decl pts_svc_db2 = +{ + .uuid128 = PTS2_SVC_UUID, + .info = SVC_UUID(128), + .atts = pts2_atts, + .nb_att = PTS_IDX_NB - 1, +}; + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @section SVC FUNCTIONS + **************************************************************************************** + */ + +/// Retrieve attribute handle from index (@see pts_att_idx) +static uint16_t ptss_get_att_handle(uint8_t att_idx) +{ + ASSERT_ERR(att_idx < PTS_ATT_NB); //svr_idx=0 + + return (att_idx + ptss_env.start_hdl); +} + +/// Retrieve attribute index form handle or ATT_INVALID_IDX if nothing found +static uint8_t ptss_get_att_idx(uint8_t *svr_idx, uint16_t handle) +{ + uint8_t att_idx = ATT_INVALID_IDX; + + if ((handle >= ptss_env.start_hdl) && (handle < ptss_env.start_hdl + PTS_IDX_NB)) + { + att_idx = handle - ptss_env.start_hdl; + *svr_idx = 0; + } + else if ((handle >= ptss_env.start_hdl + PTS_IDX_NB) && (handle < ptss_env.start_hdl + PTS_IDX_NB*2)) + { + att_idx = handle - (ptss_env.start_hdl + PTS_IDX_NB); + *svr_idx = 1; + } + else if ((handle >= ptss_env.start_hdl + PTS_IDX_NB*2) && (handle < ptss_env.start_hdl + PTS_IDX_NB*3)) + { + att_idx = handle - (ptss_env.start_hdl + PTS_IDX_NB*2); + *svr_idx = 2; + } + + return (att_idx); +} + +/// Handles reception of the attribute info request message. +static void ptss_att_info_cfm(uint8_t conidx, uint8_t svr_idx, uint8_t att_idx, uint16_t handle) +{ + uint16_t length = 0; + uint8_t status = LE_SUCCESS; + + if (att_idx != ATT_INVALID_IDX) + { + if (svr_idx == 1) // PTS1 Error + { + // Long Write Error + if (att_idx == PTS_IDX_ATT1_VAL) + { + if ((pts_bond & GAP_AUTH_BOND) == 0) + status = ATT_ERR_INSUFF_AUTHOR; + else + length = PTS_DATA_MAX_LEN; + } + else if (att_idx == PTS_IDX_ATT2_VAL) + { + if ((pts_bond & GAP_AUTH_MITM) == 0) + status = ATT_ERR_INSUFF_AUTHEN; + else + length = PTS_DATA_MAX_LEN; + } + else if (att_idx == PTS_IDX_ATT3_VAL) + { + //if (!pts_bond) + status = ATT_ERR_INSUFF_ENC_KEY_SIZE; + //else + // cfm->length = PTS_DATA_MAX_LEN; + } + else + { + status = ATT_ERR_WRITE_NOT_PERMITTED; + } + } + else if (svr_idx == 2) // PTS2 Normal + { + if ((att_idx == PTS_IDX_ATT2_VAL) || (att_idx == PTS_IDX_ATT3_VAL)) + { + length = PTS_DATA_MAX_LEN; + } + else if (att_idx == PTS_IDX_ATT1_DESC) + { + length = PTS_DESC_MAX_LEN; + } + else + { + status = ATT_ERR_WRITE_NOT_PERMITTED; + } + } + else // PTS0 Normal + { + if (att_idx == PTS_IDX_ATT2_VAL) + { + length = PTS_DATA_MAX_LEN; + } + else if (att_idx == PTS_IDX_ATT1_DESC) + { + length = sizeof(uint16_t); // CCC attribute + } + else + { + status = ATT_ERR_WRITE_NOT_PERMITTED; + } + } + } + else + { + status = PRF_ERR_APP_ERROR; + } + + DEBUG(" info_cfm(svr:%d,hdl:0x%x,sta:0x%x,len:%d)", svr_idx, param->handle, status, length); + + // Send info response + gatt_info_cfm(conidx, status, handle, length); +} + +/// Confirm ATTS_WRITE_REQ +static void ptss_att_write_cfm(uint8_t conidx, uint8_t svr_idx, uint8_t att_idx, uint16_t handle, const struct atts_write_ind *ind) +{ + uint8_t status = LE_SUCCESS; + + if (att_idx != ATT_INVALID_IDX) + { + if (svr_idx == 1) // PTS1 Error + { + // Write Error + if (att_idx == PTS_IDX_ATT1_VAL) + { + if ((pts_bond & GAP_AUTH_BOND) == 0) + status = ATT_ERR_INSUFF_AUTHOR; + } + else if (att_idx == PTS_IDX_ATT2_VAL) + { + if ((pts_bond & GAP_AUTH_MITM) == 0) + status = ATT_ERR_INSUFF_AUTHEN; + } + else if (att_idx == PTS_IDX_ATT3_VAL) + { + //if (!pts_bond) + status = ATT_ERR_INSUFF_ENC_KEY_SIZE; + } + else + { + status = ATT_ERR_WRITE_NOT_PERMITTED; + } + } + else if (svr_idx == 2) // PTS2 Normal + { + if ((att_idx == PTS_IDX_ATT2_VAL) || (att_idx == PTS_IDX_ATT3_VAL)) + { + // received data to callback + ptss_cb_recv(conidx, ind->length, ind->value); + + // Save data to read-back + if (att_idx == PTS_IDX_ATT2_VAL) + { + recv_len = ind->length; + memcpy(recv_buf, ind->value, ind->length); + } + else + { + read_len = ind->length; + memcpy(read_buf, ind->value, ind->length); + } + } + else if (att_idx == PTS_IDX_ATT1_DESC) + { + // Save desc to read-back + desc_len = ind->length; + memcpy(desc_buf, ind->value, desc_len); + } + else + { + status = ATT_ERR_WRITE_NOT_PERMITTED; + } + } + else // PTS0 Normal + { + if (att_idx == PTS_IDX_ATT2_VAL) + { + // received data to callback + ptss_cb_recv(conidx, ind->length, ind->value); + } + else if (att_idx == PTS_IDX_ATT1_DESC) + { + // update configuration if value for stop or notification enable + uint8_t cli_cfg = ind->value[0] & (PRF_CLI_START_NTF | PRF_CLI_START_IND); + + PTS_CLI_CFG_SET(conidx, cli_cfg); + + // client conf to callback + ptss_cb_ccc(conidx, cli_cfg); + } + else + { + status = PRF_ERR_APP_ERROR; + } + } + } + else + { + status = PRF_ERR_APP_ERROR; + } + + DEBUG(" --write_cfm(svr:%d,hdl:0x%x,sta:0x%x)", svr_idx, handle, status); + + // Send write conform + gatt_write_cfm(conidx, status, handle); +} + +/// Confirm ATTS_READ_REQ +static void ptss_att_read_cfm(uint8_t conidx, uint8_t svr_idx, uint8_t att_idx, uint16_t handle) +{ + uint16_t length = 0; + uint8_t status = LE_SUCCESS; + + if (att_idx != ATT_INVALID_IDX) + { + if (svr_idx == 1) // PTS1 Error + { + // Read Error + if (att_idx == PTS_IDX_ATT1_VAL) + { + if ((pts_bond & GAP_AUTH_BOND) == 0) + status = ATT_ERR_INSUFF_AUTHOR; + else + length = PTS_DATA_MAX_LEN; + } + else if (att_idx == PTS_IDX_ATT2_VAL) + { + if ((pts_bond & GAP_AUTH_MITM) == 0) + status = ATT_ERR_INSUFF_AUTHEN; + else + length = PTS_DATA_MAX_LEN; + } + else if (att_idx == PTS_IDX_ATT3_VAL) + { + //if (!pts_bond) + status = ATT_ERR_INSUFF_ENC_KEY_SIZE; + //else + // length = PTS_DATA_MAX_LEN; + } + else if (att_idx == PTS_IDX_ATT1_DESC) + { + length = 2 * gatt_get_mtu(conidx) - 2; + } + else + { + status = ATT_ERR_READ_NOT_PERMITTED; + } + } + else if (svr_idx == 2) // PTS2 Normal + { + if (att_idx == PTS_IDX_ATT1_VAL) + { + length = gatt_get_mtu(conidx); + + if (length < 512) length--; + } + else if (att_idx == PTS_IDX_ATT1_DESC) + { + length = desc_len; + } + else if (att_idx == PTS_IDX_ATT3_VAL) + { + length = read_len; + } + else if (att_idx == PTS_IDX_ATT2_VAL) + { + length = recv_len; + } + else + { + status = ATT_ERR_READ_NOT_PERMITTED; + } + } + else // PTS0 Normal + { + if (att_idx == PTS_IDX_ATT1_DESC) + { + length = sizeof(uint16_t); + } + else if (att_idx == PTS_IDX_ATT3_VAL) + { + //if (ptss_env.rdv_cb) + // length = ptss_env.rdv_cb(conidx, NULL); + length = gatt_get_mtu(conidx); + + if (length < 512) length--; + } + else + { + status = ATT_ERR_READ_NOT_PERMITTED; + } + } + } + else + { + status = PRF_ERR_APP_ERROR; + } + + DEBUG(" read_cfm(svr:%d,hdl:0x%x,sta:0x%x,len:%d)", svr_idx, param->handle, status, length); + + // Send read response + if (status == LE_SUCCESS) + { + if (svr_idx == 2) + { + // PTS2 read-back + if (att_idx == PTS_IDX_ATT2_VAL) + { + gatt_read_cfm(conidx, status, handle, recv_len, recv_buf); + return; + } + else if (att_idx == PTS_IDX_ATT3_VAL) + { + gatt_read_cfm(conidx, status, handle, read_len, read_buf); + return; + } + else if (att_idx == PTS_IDX_ATT1_DESC) + { + gatt_read_cfm(conidx, status, handle, desc_len, desc_buf); + return; + } + } + else + { + // PTS0 fill data + if (att_idx == PTS_IDX_ATT1_DESC) + { + uint16_t cli_cfg = PTS_CLI_CFG_GET(conidx); + + gatt_read_cfm(conidx, status, handle, length, (uint8_t *)&cli_cfg); + return; + } + else if (att_idx == PTS_IDX_ATT3_VAL) + { + ptss_cb_read(conidx, att_idx, handle); + return; + } + } + } + + gatt_read_cfm(conidx, status, handle, length, NULL); +} + +/// Handles reception of the atts request from peer device +static void ptss_svc_func(uint8_t conidx, uint8_t opcode, uint16_t handle, const void *param) +{ + uint8_t svr_idx, att_idx; + + att_idx = ptss_get_att_idx(&svr_idx, handle); + DEBUG("svc_func(cid:%d,op:0x%x,hdl:0x%x,svr:%d,att:%d)", conidx, opcode, handle, svr_idx, att_idx); + + switch (opcode) + { + case ATTS_READ_REQ: + { + ptss_att_read_cfm(conidx, svr_idx, att_idx, handle); + } break; + + case ATTS_WRITE_REQ: + { + const struct atts_write_ind *ind = param; + + DEBUG(" write_req(hdl:0x%x,att:%d,wr:0x%x,len:%d)", handle, att_idx, ind->wrcode, ind->length); + ptss_att_write_cfm(conidx, svr_idx, att_idx, handle, ind); + } break; + + case ATTS_INFO_REQ: + { + ptss_att_info_cfm(conidx, svr_idx, att_idx, handle); + } break; + + case ATTS_CMP_EVT: + { + const struct atts_cmp_evt *evt = param; + + DEBUG(" cmp_evt(op:0x%x,sta:0x%x,seq:%d)", evt->operation, evt->status, evt->seq_num); + // add 'if' to avoid warning #117-D: "evt" never referenced + if (evt->operation == GATT_NOTIFY) + { + // Notify result + } + } break; + + default: + { + // nothing to do + } break; + } +} + + +/** + **************************************************************************************** + * @section API FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Add Service Profile in the DB + * Customize via pre-define @see PTSS_START_HDL + * + * @return Result status, LE_SUCCESS or Error Reason + **************************************************************************************** + */ +uint8_t ptss_svc_init(void) +{ + uint8_t status = LE_SUCCESS; + uint16_t next_hdl; + + // Init Environment + ptss_env.start_hdl = PTS_START_HDL; + ptss_env.cli_cfg = 0; + + #if (PTSS_START_HDL) + *start_hdl = PTSS_START_HDL; // at special handle + #endif + + // Create Service in database + status = attmdb_svc_create(&ptss_env.start_hdl, NULL, &pts0_svc_db, ptss_svc_func); + + DEBUG("svc_init0(sta:0x%X,shdl:%d)", status, ptss_env.start_hdl); + if (status != LE_SUCCESS) + { + return status; + } + + next_hdl = ptss_env.start_hdl + PTS_IDX_NB; + status = attmdb_svc_create(&next_hdl, NULL, &pts1_svc_db, ptss_svc_func); + + DEBUG("svc_init1(sta:0x%X,shdl:%d)", status, next_hdl); + if (status != LE_SUCCESS) + { + return status; + } + + next_hdl += PTS_IDX_NB; + status = attmdb_svc_create(&next_hdl, NULL, &pts_svc_db2, ptss_svc_func); + if (status != LE_SUCCESS) + { + return status; + } + + return status; +} + +/** + **************************************************************************************** + * @brief Enable setting client configuration characteristics + * + * @param[in] conidx Connection index + * @param[in] cli_cfg Client configuration @see prf_cli_conf + * + * @return Status of the operation @see prf_err + **************************************************************************************** + */ +void ptss_set_ccc(uint8_t conidx, uint8_t cli_cfg) +{ + //if (gapc_get_conhdl(conidx) != GAP_INVALID_CONHDL) + { + // update configuration + PTS_CLI_CFG_SET(conidx, cli_cfg); + } +} + +/** + **************************************************************************************** + * @brief Transmit data to peer device via NTF or IND + * + * @param[in] conidx peer destination connection index + * @param[in] handle Handle of NTF/IND + * @param[in] len Length of data + * @param[in] data pointer of buffer + * + * @return Status of the operation @see prf_err + **************************************************************************************** + */ +uint8_t ptss_evt_send(uint8_t conidx, uint16_t handle, uint16_t len, const uint8_t* data) +{ + uint8_t status = PRF_ERR_REQ_DISALLOWED; + + if (len > 0) + { + uint8_t cli_cfg = PTS_CLI_CFG_GET(conidx); + + if (cli_cfg != PRF_CLI_STOP_NTFIND) + { + uint8_t operation = (cli_cfg & PRF_CLI_START_NTF) ? GATT_NOTIFY : GATT_INDICATE; + + if (handle == 0) ptss_get_att_handle(PTS_IDX_ATT1_VAL); + + gatt_ntf_send(conidx, handle, len, data); + + DEBUG("Send(hdl:0x%x,op:0x%x,len:%d)", handle, operation, len); + status = LE_SUCCESS; + } + else + { + status = PRF_ERR_NTF_DISABLED; + } + } + + return status; +} + +/** + **************************************************************************************** + * @brief Callback on received data from peer device via WC or WQ (__weak func) + * + * @param[in] conidx peer device connection index + * @param[in] len Length of data + * @param[in] data pointer of buffer + **************************************************************************************** + */ +__weak void ptss_cb_recv(uint8_t conidx, uint16_t len, const uint8_t *data) +{ + DEBUG("Recv(cid:%d,len:%d)", conidx, len); + debugHex(data, len); +} + +/** + **************************************************************************************** + * @brief Callback to response 'READ' from peer device (__weak func) + * + * @param[in] conidx peer device connection index + * @param[in] attidx SESS attribute index, converted with 'handle' + * @param[in] handle SESS attribute handle to send read cfm + * + * @return Length of value been READ + **************************************************************************************** + */ +__weak void ptss_cb_read(uint8_t conidx, uint8_t attidx, uint16_t handle) +{ + uint16_t length = PTS_VERS_STR_LEN; + const uint8_t *p_data = (const uint8_t *)PTS_VERS_STR; + + DEBUG(" read_cfm(att:%d, len:%d)", attidx, length); + gatt_read_cfm(conidx, LE_SUCCESS, handle, length, p_data); +} + +/** + **************************************************************************************** + * @brief Callback on enabled client config from peer device via WQ (__weak func) + * + * @param[in] conidx Connection index + * @param[in] cli_cfg Client configuration @see prf_cli_conf + **************************************************************************************** + */ +__weak void ptss_cb_ccc(uint8_t conidx, uint8_t cli_cfg) +{ + DEBUG("Enable(cid:%d,cfg:%d)", conidx, cli_cfg); +} + + +#endif //PRF_PTSS diff --git a/ble/prf/prf_ptss.h b/ble/prf/prf_ptss.h new file mode 100644 index 0000000..24f5128 --- /dev/null +++ b/ble/prf/prf_ptss.h @@ -0,0 +1,106 @@ +/** + **************************************************************************************** + * + * @file prf_ptss.h + * + * @brief Header file - Profile Testing Service (Server Role). + * + **************************************************************************************** + */ + +#ifndef PRF_PTSS_H_ +#define PRF_PTSS_H_ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Service Start Handle(0 = dynamically allocated) +#if !defined(PTS_START_HDL) + #define PTS_START_HDL (0x50) +#endif + +/// Max length of received once +#define PTS_DATA_MAX_LEN (22) +/// Max length of user description +#define PTS_DESC_MAX_LEN (22) + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Add Service Profile in the DB + * Customize via pre-define @see PTS_START_HDL + * + * @return Result status, LE_SUCCESS or Error Reason + **************************************************************************************** + */ +uint8_t ptss_svc_init(void); + +/** + **************************************************************************************** + * @brief Enable setting client configuration characteristics + * + * @param[in] conidx Connection index + * @param[in] cli_cfg Client configuration @see prf_cli_conf + **************************************************************************************** + */ +void ptss_set_ccc(uint8_t conidx, uint8_t cli_cfg); + +/** + **************************************************************************************** + * @brief Transmit data to peer device via NTF or IND + * + * @param[in] conidx peer destination connection index + * @param[in] handle Handle of NTF/IND + * @param[in] len Length of data + * @param[in] data pointer of buffer + * + * @return Status of the operation @see prf_err + **************************************************************************************** + */ +uint8_t ptss_evt_send(uint8_t conidx, uint16_t handle, uint16_t len, const uint8_t* data); + +/** + **************************************************************************************** + * @brief Callback on received data from peer device via WC or WQ (__weak func) + * + * @param[in] conidx peer device connection index + * @param[in] len Length of data + * @param[in] data pointer of buffer + **************************************************************************************** + */ +void ptss_cb_recv(uint8_t conidx, uint16_t len, const uint8_t *data); + +/** + **************************************************************************************** + * @brief Callback to response 'READ' from peer device (__weak func) + * + * @param[in] conidx peer device connection index + * @param[in] attidx SESS attribute index, converted with 'handle' + * @param[in] handle SESS attribute handle to send read cfm + * + * @return Length of value been READ + **************************************************************************************** + */ +void ptss_cb_read(uint8_t conidx, uint8_t attidx, uint16_t handle); + +/** + **************************************************************************************** + * @brief Callback on enabled client config from peer device via WQ (__weak func) + * + * @param[in] conidx Connection index + * @param[in] cli_cfg Client configuration @see prf_cli_conf + **************************************************************************************** + */ +void ptss_cb_ccc(uint8_t conidx, uint8_t cli_cfg); + +#endif /* PRF_PTSS_H_ */ diff --git a/ble/prf/prf_scps.c b/ble/prf/prf_scps.c new file mode 100644 index 0000000..569a99e --- /dev/null +++ b/ble/prf/prf_scps.c @@ -0,0 +1,370 @@ +/** + **************************************************************************************** + * + * @file prf_scps.c + * + * @brief Scan Parameters Profile Server Role. + * + **************************************************************************************** + */ + +#if (PRF_SCPS) + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "prf.h" +#include "prf_scps.h" + +#if (DBG_SCPS) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// Scan Interval Window Value length @see struct scp_scan_intv_wd +#define SCP_SCAN_INTV_WD_LEN (0x04) + +/// Macro for Client Config value operation +#define SCP_NTF_CFG_GET(conidx) \ + ((scps_env.ntf_bits >> (conidx)) & (PRF_CLI_START_NTF)) + +#define SCP_NTF_CFG_CLR(conidx) \ + scps_env.ntf_bits &= ~((PRF_CLI_START_NTF) << (conidx)) + +#define SCP_NTF_CFG_SET(conidx, conf) \ + scps_env.ntf_bits = (scps_env.ntf_bits & ~((PRF_CLI_START_NTF) << (conidx))) | ((conf) << (conidx)) + +/// Requires scan refresh +enum spcs_refresh +{ + SCPS_REQUIRES_REFRESH = 0x00, +}; + + +/** + **************************************************************************************** + * @section ENVIRONMENT DEFINITION + **************************************************************************************** + */ + +/// SCP Server Environment Variable +typedef struct scps_env_tag +{ + // Service Start Handle + uint16_t start_hdl; + // Database configuration @see scp_features + uint8_t features; + // Notification config of peer devices, each 1-bit. + uint8_t ntf_bits; +} scps_env_t; + +/// Global Variable Declarations +scps_env_t scps_env; + + +/** + **************************************************************************************** + * @section ATTRIBUTES DEFINITION + **************************************************************************************** + */ + +/// Attributes configure @see enum scp_att_index +#define SCP_CFG_ATT_MANDATORY_MASK 0x07 +#define SCP_CFG_ATT_SCAN_REFRESH_MASK 0x38 + +/// Attributes Indexes +enum scp_att_index +{ + // Service Declaration, *MUST* Start at 0 + SCP_IDX_SVC, + + // Scan Interval Window Char. + SCP_IDX_SCAN_INTV_WD_CHAR, + SCP_IDX_SCAN_INTV_WD_VAL, + + // Scan Refresh Char. + SCP_IDX_SCAN_REFRESH_CHAR, + SCP_IDX_SCAN_REFRESH_VAL, + SCP_IDX_SCAN_REFRESH_NTF_CFG, + + // Max Index, *NOTE* Minus 1(Svc Decl) is .nb_att + SCP_IDX_NB, +}; + + +/// Full SCP Description +const att_decl_t scp_atts[] = +{ + // Scan Interval Window Char. Declaration and Value + ATT_ELMT_DECL_CHAR( SCP_IDX_SCAN_INTV_WD_CHAR ), + // Scan Interval Window Characteristic Value + ATT_ELMT( SCP_IDX_SCAN_INTV_WD_VAL, ATT_CHAR_SCAN_INTV_WD, PROP_WC, SCP_SCAN_INTV_WD_LEN ), + + // Scan Refresh Char. Declaration and Value and CCC Descriptor + ATT_ELMT_DECL_CHAR( SCP_IDX_SCAN_REFRESH_CHAR ), + ATT_ELMT( SCP_IDX_SCAN_REFRESH_VAL, ATT_CHAR_SCAN_REFRESH, PROP_NTF, 0 ), + ATT_ELMT_DESC_CLI_CHAR_CFG( SCP_IDX_SCAN_REFRESH_NTF_CFG ), +}; + +const struct svc_decl scp_svc_db = +{ + .uuid = ATT_SVC_SCAN_PARAMETERS, + .info = SVC_UUID(16), + .atts = scp_atts, + .nb_att = SCP_IDX_NB - 1, +}; + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @section SVC FUNCTIONS + **************************************************************************************** + */ + +/// Retrieve attribute handle from idx @see scp_att_index +#define scps_get_att_handle(idx) (scps_env.start_hdl + (idx)) + +/// Retrieve attribute index form handle +#define scps_get_att_idx(handle) (handle - scps_env.start_hdl) + +/// Handles reception of the atts request from peer device +static void scps_svc_func(uint8_t conidx, uint8_t opcode, uint16_t handle, const void *param) +{ + uint8_t att_idx = scps_get_att_idx(handle); + + DEBUG("svc_func(cid:%d,op:0x%x,hdl:0x%x,att:%d)", conidx, opcode, handle, att_idx); + + switch (opcode) + { + case ATTS_READ_REQ: + { + DEBUG("read_req(cid:%d,hdl:0x%x)", conidx, param->handle); + + // Scan Refresh Notification Configuration + if (att_idx == SCP_IDX_SCAN_REFRESH_NTF_CFG) + { + if((scps_env.features & SCP_SCAN_REFRESH_SUP) != 0) + { + uint16_t cli_cfg = SCP_NTF_CFG_GET(conidx);; + + DEBUG(" read_cfm(txd_ntf:%d)", cli_cfg); + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint16_t), (uint8_t *)&cli_cfg); + break; + } + } + + // Send error response + gatt_read_cfm(conidx, PRF_ERR_APP_ERROR, handle, 0, NULL); + } break; + + case ATTS_WRITE_REQ: + { + const struct atts_write_ind *ind = param; + + DEBUG(" write_req(hdl:0x%x,att:%d,wr:0x%x,len:%d)", handle, att_idx, ind->wrcode, ind->length); + + // Scan Interval Window Value + if (att_idx == SCP_IDX_SCAN_INTV_WD_VAL) + { + uint16_t scan_intv = read16(&ind->value[0]); // value align=2 + uint16_t scan_window = read16(&ind->value[2]); + + // Check interval and window validity + if ((scan_window <= scan_intv) + && (scan_window <= SCP_SCAN_WINDOW_MAX) && (scan_window >= SCP_SCAN_WINDOW_MIN) + && (scan_intv <= SCP_SCAN_INTERVAL_MAX) && (scan_intv >= SCP_SCAN_INTERVAL_MIN)) + { + // Send write conform first! + gatt_write_cfm(conidx, LE_SUCCESS, handle); + + scps_cb_scan_param(conidx, scan_intv, scan_window); + break; + } + } + // Scan Refresh Notification Configuration + else if (att_idx == SCP_IDX_SCAN_REFRESH_NTF_CFG) + { + // Check if Scan Refresh Characteristic is supported + if ((scps_env.features & SCP_SCAN_REFRESH_SUP) != 0) + { + uint8_t ntf_cfg = ind->value[0]; // 2bytes, only LSB used + + // Only update configuration if value for stop or notification enable + if ((ntf_cfg == PRF_CLI_STOP_NTFIND) || (ntf_cfg == PRF_CLI_START_NTF)) + { + DEBUG(" NTF_CFG(cid:%d,cfg:%d)", conidx, ntf_cfg); + + SCP_NTF_CFG_SET(conidx, ntf_cfg); + // Send write conform quickly! + gatt_write_cfm(conidx, LE_SUCCESS, handle); + break; + } + } + } + + // Send write conform with error! + gatt_write_cfm(conidx, PRF_ERR_APP_ERROR, handle); + } break; + + case ATTS_INFO_REQ: + { + uint8_t status = LE_SUCCESS; + uint16_t length = 0; + + if (att_idx == SCP_IDX_SCAN_REFRESH_NTF_CFG) + { + length = sizeof(uint16_t); // CCC attribute + } + else + { + status = ATT_ERR_WRITE_NOT_PERMITTED; + } + + // Send length-info confirm for prepWR judging. + DEBUG(" info_cfm(hdl:0x%x,att:%d,sta:0x%X,len:%d)", handle, att_idx, status, length); + gatt_info_cfm(conidx, status, handle, length); + } break; + + case ATTS_CMP_EVT: + { + const struct atts_cmp_evt *evt = param; + + DEBUG(" cmp_evt(op:0x%x,sta:0x%x)", evt->operation, evt->status); + // add 'if' to avoid warning #117-D: "evt" never referenced + if (evt->operation == GATT_NOTIFY) + { + // Notify result + } + } break; + + default: + { + // nothing to do + } break; + } +} + + +/** + **************************************************************************************** + * @section API FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Add Scan Parameters Profile in the DB + * Customize via pre-define @see SCP_START_HDL @see SCP_FEATURES + * + * @return Result status, LE_SUCCESS or Error Reason + **************************************************************************************** + */ +uint8_t scps_svc_init(void) +{ + uint8_t status = LE_SUCCESS; + uint8_t cfg_att = SCP_CFG_ATT_MANDATORY_MASK; + // Init Environment + scps_env.start_hdl = SCP_START_HDL; + scps_env.features = SCP_FEATURES; + scps_env.ntf_bits = 0; + + // Compute Attributes supported + if (scps_env.features & SCP_SCAN_REFRESH_SUP) + { + cfg_att |= SCP_CFG_ATT_SCAN_REFRESH_MASK; + } + + // Create Service in database + status = attmdb_svc_create(&scps_env.start_hdl, (uint8_t *)&cfg_att, &scp_svc_db, scps_svc_func); + + DEBUG("svc_init(sta:0x%X,shdl:%d,feat:0x%X,cfg:0x%X)", + status, scps_env.start_hdl, scps_env.features, cfg_att); + + return status; +} + +/** + **************************************************************************************** + * @brief Enable SCP Notification Configurations + * + * @param[in] conidx Connection index + * @param[in] ntf_cfg Scan Refresh Notification Config @see prf_cli_conf + * + * @return Status of the operation @see prf_err + **************************************************************************************** + */ +void scps_set_ccc(uint8_t conidx, uint8_t ntf_cfg) +{ + //if (gapc_get_conhdl(conidx) != GAP_INVALID_CONHDL) + { + SCP_NTF_CFG_SET(conidx, ntf_cfg); + } +} + +/** + **************************************************************************************** + * @brief Send a scan refresh to peer device via NTF + * + * @param[in] conidx Connection index + * + * @return Status of the operation @see prf_err + **************************************************************************************** + */ +uint8_t scps_scan_refresh(uint8_t conidx) +{ + uint8_t status = PRF_ERR_REQ_DISALLOWED; + + // check if Notification supported + if (scps_env.features & SCP_SCAN_REFRESH_SUP) + { + if (SCP_NTF_CFG_GET(conidx) != PRF_CLI_STOP_NTFIND) + { + // send notification to peer device + uint8_t req = SCPS_REQUIRES_REFRESH; + + DEBUG("Refresh Send"); + gatt_ntf_send(conidx, scps_get_att_handle(SCP_IDX_SCAN_REFRESH_VAL), sizeof(uint8_t), &req); + status = LE_SUCCESS; + } + else + { + status = PRF_ERR_NTF_DISABLED; + } + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Callback on received scan params from peer device via WC (__weak func) + * + * @param[in] conidx Connection index + * @param[in] scan_intv Scan interval value + * @param[in] scan_wd Scan window value + * + **************************************************************************************** + */ +__weak void scps_cb_scan_param(uint8_t conidx, uint16_t scan_intv, uint16_t scan_wd) +{ + DEBUG("SCAN_PARAM(cid:%d,intv:%d,winw:%d)", conidx, scan_intv, scan_wd); +} + + +#endif //PRF_SCPS diff --git a/ble/prf/prf_scps.h b/ble/prf/prf_scps.h new file mode 100644 index 0000000..69b0b6c --- /dev/null +++ b/ble/prf/prf_scps.h @@ -0,0 +1,101 @@ +/** + **************************************************************************************** + * + * @file prf_scps.h + * + * @brief Header file - Scan Parameters Profile Server. + * + **************************************************************************************** + */ + +#ifndef PRF_SCPS_H_ +#define PRF_SCPS_H_ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Server Start Handle(0 = dynamically allocated) +#if !defined(SCP_START_HDL) + #define SCP_START_HDL (0) +#endif + +/// Scan Refresh Characteristic(Support or Not) +#if !defined(SCP_FEATURES) + #define SCP_FEATURES (SCP_SCAN_REFRESH_SUP) +#endif + +/// Scanning set parameters range min +#define SCP_SCAN_INTERVAL_MIN 0x04 +/// Scanning set parameters range max +#define SCP_SCAN_INTERVAL_MAX 0x4000 + +/// Scanning set parameters range min +#define SCP_SCAN_WINDOW_MIN 0x04 +/// Scanning set parameters range max +#define SCP_SCAN_WINDOW_MAX 0x4000 + +/// Features Flag Masks +enum scp_features +{ + /// Scan Refresh Characteristic is not supported + SCP_SCAN_REFRESH_NOT_SUP = 0, + /// Scan Refresh Characteristic is supported + SCP_SCAN_REFRESH_SUP, +}; + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Add Scan Parameters Profile in the DB + * Customize via pre-define @see SCP_START_HDL @see SCP_FEATURES + * + * @return Result status, LE_SUCCESS or Error Reason + **************************************************************************************** + */ +uint8_t scps_svc_init(void); + +/** + **************************************************************************************** + * @brief Enable SCP Notification Configurations + * + * @param[in] conidx Connection index + * @param[in] ntf_cfg Scan Refresh Notification Config @see prf_cli_conf + **************************************************************************************** + */ +void scps_set_ccc(uint8_t conidx, uint8_t ntf_cfg); + +/** + **************************************************************************************** + * @brief Send a scan refresh to peer device via NTF + * + * @param[in] conidx Connection index + * + * @return Status of the operation @see prf_err + **************************************************************************************** + */ +uint8_t scps_scan_refresh(uint8_t conidx); + +/** + **************************************************************************************** + * @brief Callback on received scan params from peer device via WC (__weak func) + * + * @param[in] conidx Connection index + * @param[in] scan_intv Scan interval value + * @param[in] scan_wd Scan window value + * + **************************************************************************************** + */ +void scps_cb_scan_param(uint8_t conidx, uint16_t scan_intv, uint16_t scan_wd); + + +#endif /* PRF_SCPS_H_ */ diff --git a/ble/prf/prf_sess.c b/ble/prf/prf_sess.c new file mode 100644 index 0000000..bbedf9d --- /dev/null +++ b/ble/prf/prf_sess.c @@ -0,0 +1,485 @@ +/** + **************************************************************************************** + * + * @file prf_sess.c + * + * @brief Serial Service - Server Role Implementation. + * + * < If want to modify it, recommend to copy the file to 'user porject'/src > + **************************************************************************************** + */ + +#if (PRF_SESS) + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "prf.h" +#include "prf_sess.h" + +#if (DBG_SESS) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// Max length of received once +#if !defined(SES_RXD_MAX_LEN) + #define SES_RXD_MAX_LEN (0x200) +#endif + +/// Max number of notify/indicate pkt +#if !defined(SES_NB_PKT_MAX) + #define SES_NB_PKT_MAX (5) +#endif + +/// Version String for SES_IDX_READ_VAL Read +#define SES_VERS_STR ("Ver:1.25") +#define SES_VERS_STR_LEN (sizeof(SES_VERS_STR) - 1) + +/// Macro for Client Config value operation +#define SES_NTF_CFG_GET(conidx) \ + ((sess_env.ntf_bits >> (conidx*2)) & (PRF_CLI_START_NTF | PRF_CLI_START_IND)) + +#define SES_NTF_CFG_CLR(conidx) \ + sess_env.ntf_bits &= ~((PRF_CLI_START_NTF | PRF_CLI_START_IND) << (conidx*2)) + +#define SES_NTF_CFG_SET(conidx, conf) \ + sess_env.ntf_bits = (sess_env.ntf_bits & ~((PRF_CLI_START_NTF | PRF_CLI_START_IND) << (conidx*2))) | ((conf) << (conidx*2)) + + +/** + **************************************************************************************** + * @section ENVIRONMENT DEFINITION + **************************************************************************************** + */ + +/// Server Environment Variable +typedef struct sess_env_tag +{ + // Service Start Handle + uint16_t start_hdl; + // Client Config of peer devices - each 2Bits(NTF & IND), so max_peer=8. + uint16_t ntf_bits; + // Number of notify pkt + uint8_t nb_pkt; +} sess_env_t; + +/// Global Variable Declarations +sess_env_t sess_env; + + +/** + **************************************************************************************** + * @section ATTRIBUTES DEFINITION + **************************************************************************************** + */ + +/// Attributes Index +enum ses_att_idx +{ + // Service Declaration, *MUST* Start at 0 + SES_IDX_SVC, + + // Serial TXD Char. + SES_IDX_TXD_CHAR, + SES_IDX_TXD_VAL, + SES_IDX_TXD_NTF_CFG, + + // Serial RXD Char. + SES_IDX_RXD_CHAR, + SES_IDX_RXD_VAL, //5 + + #if (SES_READ_SUP) + // Serial READ Char. + SES_IDX_READ_CHAR, + SES_IDX_READ_VAL, + #endif + + // Max Index, *NOTE* Minus 1(Svc Decl) is .nb_att + SES_IDX_NB, +}; + +#if (SES_UUID_128) +/// Characteristic Base UUID128 (User Customize) +#define SES_ATT_UUID128(uuid) { 0x16, 0x0A, 0x10, 0x40, 0xD1, 0x9F, 0x4C, 0x6C, \ + 0xB4, 0x55, 0xE3, 0xF7, (uuid) & 0xFF, (uuid >> 8) & 0xFF, 0x00, 0x00 } + +/// Serial Service UUID128 +const uint8_t ses_svc_uuid[] = SES_ATT_UUID128(0xFF00); +/// Serial Notify UUID128 +const uint8_t ses_char_txd_notify[] = SES_ATT_UUID128(0xFF01); +/// Serial Write Command UUID128 +const uint8_t ses_char_rxd_write[] = SES_ATT_UUID128(0xFF02); +/// Serial Read Command UUID128 +const uint8_t ses_char_val_read[] = SES_ATT_UUID128(0xFF03); + +/// Attributes Description +const att_decl_t ses_atts[] = +{ + // Serial Notify Char. Declaration and Value and Client Char. Configuration Descriptor + ATT_ELMT_DECL_CHAR( SES_IDX_TXD_CHAR ), + ATT_ELMT128( SES_IDX_TXD_VAL, ses_char_txd_notify, PROP_NTF | PROP_IND, 0 ), + ATT_ELMT_DESC_CLI_CHAR_CFG( SES_IDX_TXD_NTF_CFG ), + + // Serial Write Command Char. Declaration and Value + ATT_ELMT_DECL_CHAR( SES_IDX_RXD_CHAR ), + ATT_ELMT128( SES_IDX_RXD_VAL, ses_char_rxd_write, PROP_WC | PROP_WR, SES_RXD_MAX_LEN ), + + #if (SES_READ_SUP) + // Serial Read Command Char. Declaration and Value + ATT_ELMT_DECL_CHAR( SES_IDX_READ_CHAR ), + ATT_ELMT128( SES_IDX_READ_VAL, ses_char_val_read, PROP_RD, 0 ), + #endif //(SES_READ_SUP) +}; + +/// Service Description +const struct svc_decl ses_svc_db = +{ + {.uuid128 = ses_svc_uuid}, + .info = SVC_UUID(128), + .atts = ses_atts, + .nb_att = SES_IDX_NB - 1, +}; + +#else //(SESS_UUID16) + +/// Serial Service UUID +#define SES_SVC_UUID ATT_UUID16(0xFF00) +/// Serial Notify UUID +#define SES_CHAR_TXD_NOTIFY ATT_UUID16(0xFF01) +/// Serial Write Command UUID +#define SES_CHAR_RXD_WRITE ATT_UUID16(0xFF02) +/// Serial Read Command UUID +#define SES_CHAR_VAL_READ ATT_UUID16(0xFF03) + +/// Attributes Description +const att_decl_t ses_atts[] = +{ + // Serial Notify Char. Declaration and Value and CCC Descriptor + ATT_ELMT_DECL_CHAR( SES_IDX_TXD_CHAR ), + ATT_ELMT( SES_IDX_TXD_VAL, SES_CHAR_TXD_NOTIFY, PROP_NTF | PROP_IND, 0 ), + ATT_ELMT_DESC_CLI_CHAR_CFG( SES_IDX_TXD_NTF_CFG ), + + // Serial Write Command Char. Declaration and Value + ATT_ELMT_DECL_CHAR( SES_IDX_RXD_CHAR ), + ATT_ELMT( SES_IDX_RXD_VAL, SES_CHAR_RXD_WRITE, PROP_WC | PROP_WR, SES_RXD_MAX_LEN ), + + #if (SES_READ_SUP) + // Serial Read Command Char. Declaration and Value + ATT_ELMT_DECL_CHAR( SES_IDX_READ_CHAR ), + ATT_ELMT( SES_IDX_READ_VAL, SES_CHAR_VAL_READ, PROP_RD, 0 ), + #endif //(SES_READ_SUP) +}; + +/// Service Description +const struct svc_decl ses_svc_db = +{ + .uuid = SES_SVC_UUID, + .info = SVC_UUID(16), + .atts = ses_atts, + .nb_att = SES_IDX_NB - 1, +}; +#endif + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @section SVC FUNCTIONS + **************************************************************************************** + */ + +/// Retrieve attribute handle from index (@see ses_att_idx) +static uint16_t sess_get_att_handle(uint8_t att_idx) +{ + ASSERT_ERR(att_idx < SES_IDX_NB); + + return att_idx + sess_env.start_hdl; +} + +/// Retrieve attribute index form handle +static uint8_t sess_get_att_idx(uint16_t handle) +{ + ASSERT_ERR((handle >= sess_env.start_hdl) && (handle < sess_env.start_hdl + SES_IDX_NB)); + + return handle - sess_env.start_hdl; +} + +/// Handles reception of the atts request from peer device +static void sess_svc_func(uint8_t conidx, uint8_t opcode, uint16_t handle, const void *param) +{ + uint8_t att_idx = sess_get_att_idx(handle); + + DEBUG("svc_func(cid:%d,op:0x%x,hdl:0x%x,att:%d)", conidx, opcode, handle, att_idx); + + switch (opcode) + { + case ATTS_READ_REQ: + { + if (att_idx == SES_IDX_TXD_NTF_CFG) + { + // retrieve notification config + uint16_t cli_cfg = SES_NTF_CFG_GET(conidx); + + DEBUG(" read_cfm(txd_ntf:%d)", cli_cfg); + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint16_t), (uint8_t *)&cli_cfg); + break; + } + + #if (SES_READ_SUP) + if (att_idx == SES_IDX_READ_VAL) + { + sess_cb_rdv(conidx, att_idx, handle); + break; + } + #endif //(SES_READ_SUP) + + // Send error response + gatt_read_cfm(conidx, PRF_ERR_APP_ERROR, handle, 0, NULL); + } break; + + case ATTS_WRITE_REQ: + { + const struct atts_write_ind *ind = param; + + DEBUG(" write_req(hdl:0x%x,att:%d,wr:0x%x,len:%d)", handle, att_idx, ind->wrcode, ind->length); + + if (att_idx == SES_IDX_RXD_VAL) + { + // Send write conform first! + if (!ind->more) gatt_write_cfm(conidx, LE_SUCCESS, handle); + + // Next to process data received + sess_cb_rxd(conidx, ind->length, ind->value); + break; + } + + if (att_idx == SES_IDX_TXD_NTF_CFG) + { + if ((!ind->more) && (ind->length == sizeof(uint16_t))) + { + uint16_t cli_cfg = read16p(ind->value); + + // update configuration if value for stop or NTF/IND start + if (cli_cfg <= PRF_CLI_START_IND) + { + DEBUG(" set txd_ntf(cid:%d,cfg:%d)", conidx, cli_cfg); + + SES_NTF_CFG_SET(conidx, cli_cfg); + // Send write conform quickly! + gatt_write_cfm(conidx, LE_SUCCESS, handle); + + #if (SES_CLI_CFG) + // Next to process cli_cfg changed + sess_cb_ccc(conidx, cli_cfg); + #endif //(SES_CLI_CFG) + break; + } + } + } + + // Send write conform with error! + gatt_write_cfm(conidx, PRF_ERR_APP_ERROR, handle); + } break; + + case ATTS_INFO_REQ: + { + uint8_t status = LE_SUCCESS; + uint16_t length = 0; + + if (att_idx == SES_IDX_RXD_VAL) + { + length = SES_RXD_MAX_LEN; // accepted length + } + else if (att_idx == SES_IDX_TXD_NTF_CFG) + { + length = sizeof(uint16_t); // CCC attribute + } + else + { + status = ATT_ERR_WRITE_NOT_PERMITTED; + } + + // Send length-info confirm for prepWR judging. + DEBUG(" info_cfm(hdl:0x%x,att:%d,sta:0x%X,len:%d)", handle, att_idx, status, length); + gatt_info_cfm(conidx, status, handle, length); + } break; + + case ATTS_CMP_EVT: + { + const struct atts_cmp_evt *evt = param; + + sess_env.nb_pkt++; // release + + DEBUG(" cmp_evt(op:0x%x,sta:0x%x,nb:%d)", evt->operation, evt->status, sess_env.nb_pkt); + // add 'if' to avoid warning #117-D: "evt" never referenced + if (evt->operation == GATT_NOTIFY) + { + // Notify result + } + } break; + + default: + { + // nothing to do + } break; + } +} + + +/** + **************************************************************************************** + * @section API FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Add Serial Service Profile in the DB. + * Customize via pre-define @see SES_START_HDL + * + * @return Result status, LE_SUCCESS or Error Reason + **************************************************************************************** + */ +uint8_t sess_svc_init(void) +{ + uint8_t status = LE_SUCCESS; + + // Init Environment + sess_env.start_hdl = SES_START_HDL; + sess_env.nb_pkt = SES_NB_PKT_MAX; + sess_env.ntf_bits = 0; + + // Create Service in database + status = attmdb_svc_create(&sess_env.start_hdl, NULL, &ses_svc_db, sess_svc_func); + + DEBUG("svc_init(sta:0x%X,shdl:%d,nb_pkt:%d,ntf_bits:0x%X)", + status, sess_env.start_hdl, sess_env.nb_pkt, sess_env.ntf_bits); + + return status; +} + +/** + **************************************************************************************** + * @brief Enable setting client configuration characteristics + * + * @param[in] conidx Connection index + * @param[in] cli_cfg Client configuration @see prf_cli_conf + **************************************************************************************** + */ +void sess_set_ccc(uint8_t conidx, uint8_t cli_cfg) +{ + //if (gapc_get_conhdl(conidx) != GAP_INVALID_CONHDL) + { + // update configuration + SES_NTF_CFG_SET(conidx, cli_cfg); + } +} + +/** + **************************************************************************************** + * @brief Transmit data to peer device via NTF or IND + * + * @param[in] conidx peer device connection index + * @param[in] len Length of data + * @param[in] data pointer of buffer + * + * @return Status of the operation @see prf_err + **************************************************************************************** + */ +uint8_t sess_txd_send(uint8_t conidx, uint16_t len, const uint8_t* data) +{ + uint8_t status = PRF_ERR_REQ_DISALLOWED; + + if ((len > 0) && (sess_env.nb_pkt > 0)) + { + uint8_t ntf_cfg = SES_NTF_CFG_GET(conidx); + + if (ntf_cfg != PRF_CLI_STOP_NTFIND) + { + status = LE_SUCCESS; + gatt_ntf_send(conidx, sess_get_att_handle(SES_IDX_TXD_VAL), len, data); + + sess_env.nb_pkt--; // allocate + DEBUG("txd_send(len:%d,nb:%d)", len, sess_env.nb_pkt); + } + else + { + status = PRF_ERR_NTF_DISABLED; + } + } + + return status; +} + +/** + **************************************************************************************** + * @brief Callback on received data from peer device via WC or WQ (__weak func) + * + * @param[in] conidx peer device connection index + * @param[in] len Length of data + * @param[in] data pointer of buffer + **************************************************************************************** + */ +__weak void sess_cb_rxd(uint8_t conidx, uint16_t len, const uint8_t *data) +{ + debugHex(data, len); + + // Loopback to txd, just test. + //sess_txd_send(conidx, len, data); +} + +#if (SES_READ_SUP) +/** + **************************************************************************************** + * @brief Callback to response 'READ' from peer device (__weak func) + * + * @param[in] conidx peer device connection index + * @param[in] attidx SESS attribute index, converted with 'handle' + * @param[in] handle SESS attribute handle to send read cfm + * + * @return Length of value been READ + **************************************************************************************** + */ +__weak void sess_cb_rdv(uint8_t conidx, uint8_t attidx, uint16_t handle) +{ + uint16_t length = SES_VERS_STR_LEN; + const uint8_t *p_data = (const uint8_t *)SES_VERS_STR; + + DEBUG(" read_cfm(att:%d, len:%d)", attidx, length); + gatt_read_cfm(conidx, LE_SUCCESS, handle, length, p_data); +} +#endif //(SES_READ_SUP) + +#if (SES_CLI_CFG) +/** + **************************************************************************************** + * @brief Callback on enabled client config from peer device via WQ (__weak func) + * + * @param[in] conidx Connection index + * @param[in] cli_cfg Client configuration @see prf_cli_conf + **************************************************************************************** + */ +__weak void sess_cb_ccc(uint8_t conidx, uint8_t cli_cfg) +{ + // user override +} +#endif //(SES_CLI_CFG) + + +#endif //PRF_SESS diff --git a/ble/prf/prf_sess.h b/ble/prf/prf_sess.h new file mode 100644 index 0000000..8108510 --- /dev/null +++ b/ble/prf/prf_sess.h @@ -0,0 +1,119 @@ +/** + **************************************************************************************** + * + * @file prf_sess.h + * + * @brief Header file - Serial Service Profile (Server Role). + * + **************************************************************************************** + */ + +#ifndef PRF_SESS_H_ +#define PRF_SESS_H_ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Service Start Handle(0 = dynamically allocated) +#if !defined(SES_START_HDL) + #define SES_START_HDL (0) +#endif + +/// Use UUID 128bit or 16bit +#if !defined(SES_UUID_128) + #define SES_UUID_128 (0) +#endif + +/// Support READ Characteristic +#if !defined(SES_READ_SUP) + #define SES_READ_SUP (0) +#endif + +/// Callback of Client Config enable +#if !defined(SES_CLI_CFG) + #define SES_CLI_CFG (0) +#endif + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Add Serial Service Profile in the DB. + * Customize via pre-define @see SES_START_HDL + * + * @return Result status, LE_SUCCESS or Error Reason + **************************************************************************************** + */ +uint8_t sess_svc_init(void); + +/** + **************************************************************************************** + * @brief Enable setting client configuration characteristics + * + * @param[in] conidx Connection index + * @param[in] cli_cfg Client configuration @see prf_cli_conf + **************************************************************************************** + */ +void sess_set_ccc(uint8_t conidx, uint8_t cli_cfg); + +/** + **************************************************************************************** + * @brief Transmit data to peer device via NTF or IND + * + * @param[in] conidx peer device connection index + * @param[in] len Length of data + * @param[in] data pointer of buffer + * + * @return Status of the operation @see prf_err + **************************************************************************************** + */ +uint8_t sess_txd_send(uint8_t conidx, uint16_t len, const uint8_t *data); + +/** + **************************************************************************************** + * @brief Callback on received data from peer device via WC or WQ (__weak func) + * + * @param[in] conidx peer device connection index + * @param[in] len Length of data + * @param[in] data pointer of buffer + **************************************************************************************** + */ +void sess_cb_rxd(uint8_t conidx, uint16_t len, const uint8_t *data); + +#if (SES_READ_SUP) +/** + **************************************************************************************** + * @brief Callback to response 'READ' from peer device (__weak func) + * + * @param[in] conidx peer device connection index + * @param[in] attidx SESS attribute index, converted with 'handle' + * @param[in] handle SESS attribute handle to send read cfm + * + * @return Length of value been READ + **************************************************************************************** + */ +void sess_cb_rdv(uint8_t conidx, uint8_t attidx, uint16_t handle); +#endif + +#if (SES_CLI_CFG) +/** + **************************************************************************************** + * @brief Callback on enabled client config from peer device via WQ (__weak func) + * + * @param[in] conidx Connection index + * @param[in] cli_cfg Client configuration @see prf_cli_conf + **************************************************************************************** + */ +void sess_cb_ccc(uint8_t conidx, uint8_t cli_cfg); +#endif + +#endif /* PRF_SESS_H_ */ diff --git a/core/b6x.h b/core/b6x.h new file mode 100644 index 0000000..c40ee8b --- /dev/null +++ b/core/b6x.h @@ -0,0 +1,133 @@ +#ifndef _B6X_H_ +#define _B6X_H_ +/* + * ========================================================================== + * ---------- Interrupt Number Definition ----------------------------------- + * ========================================================================== + */ + +typedef enum IRQn +{ +/****** Cortex-M0 Processor Exceptions Numbers *************************************************/ + NMI_IRQn = -14, /*!< 2 Non Maskable Interrupt */ + HardFault_IRQn = -13, /*!< 3 Cortex-M0 Hard Fault Interrupt */ + SVCall_IRQn = -5, /*!< 11 Cortex-M0 SV Call Interrupt */ + PendSV_IRQn = -2, /*!< 14 Cortex-M0 Pend SV Interrupt */ + SysTick_IRQn = -1, /*!< 15 Cortex-M0 System Tick Interrupt */ + + /****** Cortex-M0 specific Interrupt Numbers **********************************************/ + EXTI_IRQn = 0, /* 0 | EXTI Interrupt */ + IWDT_IRQn = 1, /* 1 | IWDT Interrupt */ + BLE_IRQn = 2, /* 2 | BLE Interrupt */ + DMAC_IRQn = 3, /* 3 | DMAC Interrupt */ + BB_LP_IRQn = 4, /* 4 | BB WAKEUP Interrupt */ + BTMR_IRQn = 5, /* 5 | BTMR Interrupt */ + CTMR_IRQn = 6, /* 6 | CTMR Interrupt */ + ATMR_IRQn = 7, /* 7 | ATMR Interrupt */ + RTC_IRQn = 8, /* 8 | RTC Interrupt */ + I2C_IRQn = 9, /* 9 | I2C Interrupt */ + SPIM_IRQn = 10, /* 10 | SPIM Interrupt */ + SPIS_IRQn = 11, /* 11 | SPIS Interrupt */ + UART1_IRQn = 12, /* 12 | UART1 Interrupt */ + UART2_IRQn = 13, /* 13 | UART2 Interrupt */ + AON_PMU_IRQn = 14, /* 14 | AON_PMU Interrupt */ + LVD33_IRQn = 15, /* 15 | LVD33 Interrupt */ + BOD12_IRQn = 16, /* 16 | BOD12 Interrupt */ + USB_IRQn = 17, /* 17 | USB Interrupt */ + USB_SOF_IRQn = 18, /* 18 | USB_SOF Interrupt */ + FSHC_IRQn = 19, /* 19 | FSHC Interrupt */ + MDM_IRQn = 20, /* 20 | Interrupt */ + RF_IRQn = 21, /* 21 | Interrupt */ +} IRQn_Type; + +#define __IRQFN __attribute__((section("ram_func"))) + +/* + * ========================================================================== + * ----------- Processor and Core Peripheral Section ------------------------ + * ========================================================================== + */ + +/* Configuration of the Cortex-M0 Processor and Core Peripherals */ +#define __MPU_PRESENT 0 /*!< cm0ikmcu does not provide a MPU present or not */ +#define __NVIC_PRIO_BITS 2 /*!< cm0ikmcu Supports 2 Bits for the Priority Levels */ +#define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */ + +#if (1) +#define __VTOR_PRESENT 1 +#include "core_cm0plus.h" /* Cortex-M0 plus processor and core peripherals */ +#else +#include "core_cm0.h" /* Cortex-M0 processor and core peripherals */ +#endif + +#if defined ( __CC_ARM ) +#pragma anon_unions +#pragma diag_suppress 1296 +#endif + +/* SYSTICK - Cortex-M0 SysTick Register */ +typedef struct +{ + __IO uint32_t CSR; //0x0, Control and Status + __IO uint32_t RVR; //0x4, Reload Value + __IO uint32_t CVR; //0x8, Current Value + __IO uint32_t CALIB; //0xC, Calibration +} TICK_TypeDef; + + +/***************************************************************************/ +/* Peripheral Memory map */ +/***************************************************************************/ +#define BOOTROM_BASE ((uint32_t)0x00000000) // Boot Memory (4KB) +#define FLASH_BASE ((uint32_t)0x18000000) // FLASH Controller (16MB) +#define CACHE_REG_BASE ((uint32_t)0x19000000) // CACHE Reg (4KB) +#define SRAM_BASE ((uint32_t)0x20003000) // SRAM Memory (20KB) +#define RETN_BASE ((uint32_t)0x20008000) // BLE EM Memory (8KB) +#define AHB_BASE ((uint32_t)0x40000000) // AHB Peripheral (64KB) +#define APB1_BASE ((uint32_t)0x40020000) // APB Peripheral (64KB) +#define APB2_BASE ((uint32_t)0x40030000) // APB Peripheral (64KB) + +/* + * ========================================================================== + * ---------------------------- Common MACRO ------------------------------ + * ========================================================================== + */ + +/** @brief Enable interrupts globally in the system. + * This macro must be used when the initialization phase is over and the interrupts + * can start being handled by the system. + */ +#define GLOBAL_INT_START() __enable_irq() //__set_PRIMASK(0) + +/** @brief Disable interrupts globally in the system. + * This macro must be used when the system wants to disable all the interrupt + * it could handle. + */ +#define GLOBAL_INT_STOP() __disable_irq() //__set_PRIMASK(1) + +/** @brief Disable interrupts globally in the system. + * This macro must be used in conjunction with the @ref GLOBAL_INT_RESTORE macro since this + * last one will close the brace that the current macro opens. This means that both + * macros must be located at the same scope level. + */ +#define GLOBAL_INT_DISABLE() \ +do { \ + uint32_t __l_irq_rest = __get_PRIMASK(); \ + __disable_irq(); + +/** @brief Restore interrupts from the previous global disable. + * @sa GLOBAL_INT_DISABLE + */ +//if (__l_irq_rest == 0) __enable_irq(); +#define GLOBAL_INT_RESTORE() \ + __set_PRIMASK(__l_irq_rest); \ +} while(0) + + +#define WR_8(addr,value) (*(volatile uint8_t *)(addr)) = (value) +#define WR_32(addr,value) (*(volatile uint32_t *)(addr)) = (value) +#define RD_32(addr) (*(volatile uint32_t *)(addr)) + +#include "rom.h" + +#endif //_B6X_H_ diff --git a/core/core_cm0.h b/core/core_cm0.h new file mode 100644 index 0000000..b43ce55 --- /dev/null +++ b/core/core_cm0.h @@ -0,0 +1,798 @@ +/**************************************************************************//** + * @file core_cm0.h + * @brief CMSIS Cortex-M0 Core Peripheral Access Layer Header File + * @version V4.30 + * @date 20. October 2015 + ******************************************************************************/ +/* Copyright (c) 2009 - 2015 ARM LIMITED + + 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 ARM 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 COPYRIGHT HOLDERS AND 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. + ---------------------------------------------------------------------------*/ + + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_CM0_H_GENERIC +#define __CORE_CM0_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup Cortex_M0 + @{ + */ + +/* CMSIS CM0 definitions */ +#define __CM0_CMSIS_VERSION_MAIN (0x04U) /*!< [31:16] CMSIS HAL main version */ +#define __CM0_CMSIS_VERSION_SUB (0x1EU) /*!< [15:0] CMSIS HAL sub version */ +#define __CM0_CMSIS_VERSION ((__CM0_CMSIS_VERSION_MAIN << 16U) | \ + __CM0_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */ + +#define __CORTEX_M (0x00U) /*!< Cortex-M Core */ + + +#if defined ( __CC_ARM ) + #define __ASM __asm /*!< asm keyword for ARM Compiler */ + #define __INLINE __inline /*!< inline keyword for ARM Compiler */ + #define __STATIC_INLINE static __inline + +#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #define __ASM __asm /*!< asm keyword for ARM Compiler */ + #define __INLINE __inline /*!< inline keyword for ARM Compiler */ + #define __STATIC_INLINE static __inline + +#elif defined ( __GNUC__ ) + #define __ASM __asm /*!< asm keyword for GNU Compiler */ + #define __INLINE inline /*!< inline keyword for GNU Compiler */ + #define __STATIC_INLINE static inline + +#elif defined ( __ICCARM__ ) + #define __ASM __asm /*!< asm keyword for IAR Compiler */ + #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */ + #define __STATIC_INLINE static inline + +#elif defined ( __TMS470__ ) + #define __ASM __asm /*!< asm keyword for TI CCS Compiler */ + #define __STATIC_INLINE static inline + +#elif defined ( __TASKING__ ) + #define __ASM __asm /*!< asm keyword for TASKING Compiler */ + #define __INLINE inline /*!< inline keyword for TASKING Compiler */ + #define __STATIC_INLINE static inline + +#elif defined ( __CSMC__ ) + #define __packed + #define __ASM _asm /*!< asm keyword for COSMIC Compiler */ + #define __INLINE inline /*!< inline keyword for COSMIC Compiler. Use -pc99 on compile line */ + #define __STATIC_INLINE static inline + +#else + #error Unknown compiler +#endif + +/** __FPU_USED indicates whether an FPU is used or not. + This core does not support an FPU at all +*/ +#define __FPU_USED 0U + +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TMS470__ ) + #if defined __TI_VFP_SUPPORT__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#endif + +#include "core_cmInstr.h" /* Core Instruction Access */ +#include "core_cmFunc.h" /* Core Function Access */ + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM0_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_CM0_H_DEPENDANT +#define __CORE_CM0_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __CM0_REV + #define __CM0_REV 0x0000U + #warning "__CM0_REV not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 2U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group Cortex_M0 */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ + uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t _reserved0:1; /*!< bit: 0 Reserved */ + uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ + uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[31U]; + __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[31U]; + __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[31U]; + __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[31U]; + uint32_t RESERVED4[64U]; + __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */ +} NVIC_Type; + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ + uint32_t RESERVED0; + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + uint32_t RESERVED1; + __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ +#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ +#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Cortex-M0 Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor. + Therefore they are not covered by the Cortex-M0 header file. + @{ + */ +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) ((value << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) ((value & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Cortex-M0 Hardware */ +#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ +#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ +#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ +#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + +#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ +#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ +#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ + + +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +/* Interrupt Priorities are WORD accessible only under ARMv6M */ +/* The following MACROS handle generation of the register offset and byte masks */ +#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL) +#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) ) +#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) ) + + +/** + \brief Enable External Interrupt + \details Enables a device-specific interrupt in the NVIC interrupt controller. + \param [in] IRQn External interrupt number. Value cannot be negative. + */ +__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn) +{ + NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); +} + + +/** + \brief Disable External Interrupt + \details Disables a device-specific interrupt in the NVIC interrupt controller. + \param [in] IRQn External interrupt number. Value cannot be negative. + */ +__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn) +{ + NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); +} + + +/** + \brief Get Pending Interrupt + \details Reads the pending register in the NVIC and returns the pending bit for the specified interrupt. + \param [in] IRQn Interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + */ +__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of an external interrupt. + \param [in] IRQn Interrupt number. Value cannot be negative. + */ +__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of an external interrupt. + \param [in] IRQn External interrupt number. Value cannot be negative. + */ +__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); +} + + +/** + \brief Set Interrupt Priority + \details Sets the priority of an interrupt. + \note The priority cannot be set for every core interrupt. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + */ +__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) < 0) + { + SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } + else + { + NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of an interrupt. + The interrupt number can be positive to specify an external (device specific) interrupt, + or negative to specify an internal (core) interrupt. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) < 0) + { + return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__STATIC_INLINE void NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + SCB_AIRCR_SYSRESETREQ_Msk); + __DSB(); /* Ensure completion of memory access */ + + for (;;) /* wait until reset */ + { + __NOP(); + } +} + +/*@} end of CMSIS_Core_NVICFunctions */ + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM0_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/core/core_cm0plus.h b/core/core_cm0plus.h new file mode 100644 index 0000000..5392971 --- /dev/null +++ b/core/core_cm0plus.h @@ -0,0 +1,813 @@ +/**************************************************************************//** + * @file core_cm0plus.h + * @brief CMSIS Cortex-M0+ Core Peripheral Access Layer Header File + * @version V3.30 + * @date 17. February 2014 + * + * @note + * + ******************************************************************************/ +/* Copyright (c) 2009 - 2014 ARM LIMITED + + 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 ARM 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 COPYRIGHT HOLDERS AND 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. + ---------------------------------------------------------------------------*/ + + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +#ifndef __CORE_CM0PLUS_H_GENERIC +#define __CORE_CM0PLUS_H_GENERIC + +/** \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** \ingroup Cortex-M0+ + @{ + */ + +/* CMSIS CM0P definitions */ +#define __CM0PLUS_CMSIS_VERSION_MAIN (0x03) /*!< [31:16] CMSIS HAL main version */ +#define __CM0PLUS_CMSIS_VERSION_SUB (0x20) /*!< [15:0] CMSIS HAL sub version */ +#define __CM0PLUS_CMSIS_VERSION ((__CM0PLUS_CMSIS_VERSION_MAIN << 16) | \ + __CM0PLUS_CMSIS_VERSION_SUB) /*!< CMSIS HAL version number */ + +#define __CORTEX_M (0x00) /*!< Cortex-M Core */ + + +#if defined ( __CC_ARM ) + #define __ASM __asm /*!< asm keyword for ARM Compiler */ + #define __INLINE __inline /*!< inline keyword for ARM Compiler */ + #define __STATIC_INLINE static __inline + +#elif defined ( __GNUC__ ) + #define __ASM __asm /*!< asm keyword for GNU Compiler */ + #define __INLINE inline /*!< inline keyword for GNU Compiler */ + #define __STATIC_INLINE static inline + +#elif defined ( __ICCARM__ ) + #define __ASM __asm /*!< asm keyword for IAR Compiler */ + #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */ + #define __STATIC_INLINE static inline + +#elif defined ( __TMS470__ ) + #define __ASM __asm /*!< asm keyword for TI CCS Compiler */ + #define __STATIC_INLINE static inline + +#elif defined ( __TASKING__ ) + #define __ASM __asm /*!< asm keyword for TASKING Compiler */ + #define __INLINE inline /*!< inline keyword for TASKING Compiler */ + #define __STATIC_INLINE static inline + +#elif defined ( __CSMC__ ) /* Cosmic */ + #define __packed + #define __ASM _asm /*!< asm keyword for COSMIC Compiler */ + #define __INLINE inline /*use -pc99 on compile line !< inline keyword for COSMIC Compiler */ + #define __STATIC_INLINE static inline + +#endif + +/** __FPU_USED indicates whether an FPU is used or not. This core does not support an FPU at all +*/ +#define __FPU_USED 0 + +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TMS470__ ) + #if defined __TI__VFP_SUPPORT____ + #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __CSMC__ ) /* Cosmic */ + #if ( __CSMC__ & 0x400) // FPU present for parser + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif +#endif + +#include /* standard types definitions */ +#include /* Core Instruction Access */ +#include /* Core Function Access */ + +#endif /* __CORE_CM0PLUS_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_CM0PLUS_H_DEPENDANT +#define __CORE_CM0PLUS_H_DEPENDANT + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __CM0PLUS_REV + #define __CM0PLUS_REV 0x0000 + #warning "__CM0PLUS_REV not defined in device header file; using default!" + #endif + + #ifndef __MPU_PRESENT + #define __MPU_PRESENT 0 + #warning "__MPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __VTOR_PRESENT + #define __VTOR_PRESENT 0 + #warning "__VTOR_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 2 + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0 + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/*@} end of group Cortex-M0+ */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + - Core MPU Register + ******************************************************************************/ +/** \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { +#if (__CORTEX_M != 0x04) + uint32_t _reserved0:27; /*!< bit: 0..26 Reserved */ +#else + uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */ + uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ + uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */ +#endif + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + + +/** \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + + +/** \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ +#if (__CORTEX_M != 0x04) + uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ +#else + uint32_t _reserved0:7; /*!< bit: 9..15 Reserved */ + uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ + uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */ +#endif + uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ + uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + + +/** \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ + uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ + uint32_t FPCA:1; /*!< bit: 2 FP extension active flag */ + uint32_t _reserved0:29; /*!< bit: 3..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/*@} end of group CMSIS_CORE */ + + +/** \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IO uint32_t ISER[1]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[31]; + __IO uint32_t ICER[1]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[31]; + __IO uint32_t ISPR[1]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[31]; + __IO uint32_t ICPR[1]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[31]; + uint32_t RESERVED4[64]; + __IO uint32_t IP[8]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */ +} NVIC_Type; + +/*@} end of group CMSIS_NVIC */ + + +/** \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __I uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IO uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ +#if (__VTOR_PRESENT == 1) + __IO uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ +#else + uint32_t RESERVED0; +#endif + __IO uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IO uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IO uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + uint32_t RESERVED1; + __IO uint32_t SHP[2]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */ + __IO uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24 /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20 /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16 /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4 /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0 /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL << SCB_CPUID_REVISION_Pos) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_NMIPENDSET_Pos 31 /*!< SCB ICSR: NMIPENDSET Position */ +#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28 /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27 /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26 /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25 /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23 /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22 /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12 /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0 /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL << SCB_ICSR_VECTACTIVE_Pos) /*!< SCB ICSR: VECTACTIVE Mask */ + +#if (__VTOR_PRESENT == 1) +/* SCB Interrupt Control State Register Definitions */ +#define SCB_VTOR_TBLOFF_Pos 8 /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0xFFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ +#endif + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16 /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16 /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15 /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2 /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1 /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4 /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2 /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1 /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_STKALIGN_Pos 9 /*!< SCB CCR: STKALIGN Position */ +#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3 /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_SVCALLPENDED_Pos 15 /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IO uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IO uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IO uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __I uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16 /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2 /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1 /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0 /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL << SysTick_CTRL_ENABLE_Pos) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0 /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL << SysTick_LOAD_RELOAD_Pos) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0 /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31 /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30 /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0 /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + +#if (__MPU_PRESENT == 1) +/** \ingroup CMSIS_core_register + \defgroup CMSIS_MPU Memory Protection Unit (MPU) + \brief Type definitions for the Memory Protection Unit (MPU) + @{ + */ + +/** \brief Structure type to access the Memory Protection Unit (MPU). + */ +typedef struct +{ + __I uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ + __IO uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ + __IO uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */ + __IO uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ + __IO uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */ +} MPU_Type; + +/* MPU Type Register */ +#define MPU_TYPE_IREGION_Pos 16 /*!< MPU TYPE: IREGION Position */ +#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ + +#define MPU_TYPE_DREGION_Pos 8 /*!< MPU TYPE: DREGION Position */ +#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ + +#define MPU_TYPE_SEPARATE_Pos 0 /*!< MPU TYPE: SEPARATE Position */ +#define MPU_TYPE_SEPARATE_Msk (1UL << MPU_TYPE_SEPARATE_Pos) /*!< MPU TYPE: SEPARATE Mask */ + +/* MPU Control Register */ +#define MPU_CTRL_PRIVDEFENA_Pos 2 /*!< MPU CTRL: PRIVDEFENA Position */ +#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ + +#define MPU_CTRL_HFNMIENA_Pos 1 /*!< MPU CTRL: HFNMIENA Position */ +#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ + +#define MPU_CTRL_ENABLE_Pos 0 /*!< MPU CTRL: ENABLE Position */ +#define MPU_CTRL_ENABLE_Msk (1UL << MPU_CTRL_ENABLE_Pos) /*!< MPU CTRL: ENABLE Mask */ + +/* MPU Region Number Register */ +#define MPU_RNR_REGION_Pos 0 /*!< MPU RNR: REGION Position */ +#define MPU_RNR_REGION_Msk (0xFFUL << MPU_RNR_REGION_Pos) /*!< MPU RNR: REGION Mask */ + +/* MPU Region Base Address Register */ +#define MPU_RBAR_ADDR_Pos 8 /*!< MPU RBAR: ADDR Position */ +#define MPU_RBAR_ADDR_Msk (0xFFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */ + +#define MPU_RBAR_VALID_Pos 4 /*!< MPU RBAR: VALID Position */ +#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */ + +#define MPU_RBAR_REGION_Pos 0 /*!< MPU RBAR: REGION Position */ +#define MPU_RBAR_REGION_Msk (0xFUL << MPU_RBAR_REGION_Pos) /*!< MPU RBAR: REGION Mask */ + +/* MPU Region Attribute and Size Register */ +#define MPU_RASR_ATTRS_Pos 16 /*!< MPU RASR: MPU Region Attribute field Position */ +#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */ + +#define MPU_RASR_XN_Pos 28 /*!< MPU RASR: ATTRS.XN Position */ +#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */ + +#define MPU_RASR_AP_Pos 24 /*!< MPU RASR: ATTRS.AP Position */ +#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */ + +#define MPU_RASR_TEX_Pos 19 /*!< MPU RASR: ATTRS.TEX Position */ +#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */ + +#define MPU_RASR_S_Pos 18 /*!< MPU RASR: ATTRS.S Position */ +#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */ + +#define MPU_RASR_C_Pos 17 /*!< MPU RASR: ATTRS.C Position */ +#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */ + +#define MPU_RASR_B_Pos 16 /*!< MPU RASR: ATTRS.B Position */ +#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */ + +#define MPU_RASR_SRD_Pos 8 /*!< MPU RASR: Sub-Region Disable Position */ +#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */ + +#define MPU_RASR_SIZE_Pos 1 /*!< MPU RASR: Region Size Field Position */ +#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */ + +#define MPU_RASR_ENABLE_Pos 0 /*!< MPU RASR: Region enable bit Position */ +#define MPU_RASR_ENABLE_Msk (1UL << MPU_RASR_ENABLE_Pos) /*!< MPU RASR: Region enable bit Disable Mask */ + +/*@} end of group CMSIS_MPU */ +#endif + + +/** \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Cortex-M0+ Core Debug Registers (DCB registers, SHCSR, and DFSR) + are only accessible over DAP and not via processor. Therefore + they are not covered by the Cortex-M0 header file. + @{ + */ +/*@} end of group CMSIS_CoreDebug */ + + +/** \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Cortex-M0+ Hardware */ +#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ +#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ +#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ +#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + +#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ +#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ +#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ + +#if (__MPU_PRESENT == 1) + #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ + #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ +#endif + +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Register Access Functions + ******************************************************************************/ +/** \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +/* Interrupt Priorities are WORD accessible only under ARMv6M */ +/* The following MACROS handle generation of the register offset and byte masks */ +#define _BIT_SHIFT(IRQn) ( (((uint32_t)(IRQn) ) & 0x03) * 8 ) +#define _SHP_IDX(IRQn) ( ((((uint32_t)(IRQn) & 0x0F)-8) >> 2) ) +#define _IP_IDX(IRQn) ( ((uint32_t)(IRQn) >> 2) ) + + +/** \brief Enable External Interrupt + + The function enables a device-specific interrupt in the NVIC interrupt controller. + + \param [in] IRQn External interrupt number. Value cannot be negative. + */ +__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn) +{ + NVIC->ISER[0] = (1 << ((uint32_t)(IRQn) & 0x1F)); +} + + +/** \brief Disable External Interrupt + + The function disables a device-specific interrupt in the NVIC interrupt controller. + + \param [in] IRQn External interrupt number. Value cannot be negative. + */ +__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn) +{ + NVIC->ICER[0] = (1 << ((uint32_t)(IRQn) & 0x1F)); +} + + +/** \brief Get Pending Interrupt + + The function reads the pending register in the NVIC and returns the pending bit + for the specified interrupt. + + \param [in] IRQn Interrupt number. + + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + */ +__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + return((uint32_t) ((NVIC->ISPR[0] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0)); +} + + +/** \brief Set Pending Interrupt + + The function sets the pending bit of an external interrupt. + + \param [in] IRQn Interrupt number. Value cannot be negative. + */ +__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + NVIC->ISPR[0] = (1 << ((uint32_t)(IRQn) & 0x1F)); +} + + +/** \brief Clear Pending Interrupt + + The function clears the pending bit of an external interrupt. + + \param [in] IRQn External interrupt number. Value cannot be negative. + */ +__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + NVIC->ICPR[0] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* Clear pending interrupt */ +} + + +/** \brief Set Interrupt Priority + + The function sets the priority of an interrupt. + + \note The priority cannot be set for every core interrupt. + + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + */ +__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if(IRQn < 0) { + SCB->SHP[_SHP_IDX(IRQn)] = (SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFF << _BIT_SHIFT(IRQn))) | + (((priority << (8 - __NVIC_PRIO_BITS)) & 0xFF) << _BIT_SHIFT(IRQn)); } + else { + NVIC->IP[_IP_IDX(IRQn)] = (NVIC->IP[_IP_IDX(IRQn)] & ~(0xFF << _BIT_SHIFT(IRQn))) | + (((priority << (8 - __NVIC_PRIO_BITS)) & 0xFF) << _BIT_SHIFT(IRQn)); } +} + + +/** \brief Get Interrupt Priority + + The function reads the priority of an interrupt. The interrupt + number can be positive to specify an external (device specific) + interrupt, or negative to specify an internal (core) interrupt. + + + \param [in] IRQn Interrupt number. + \return Interrupt Priority. Value is aligned automatically to the implemented + priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn) +{ + + if(IRQn < 0) { + return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & 0xFF) >> (8 - __NVIC_PRIO_BITS))); } /* get priority for Cortex-M0 system interrupts */ + else { + return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & 0xFF) >> (8 - __NVIC_PRIO_BITS))); } /* get priority for device specific interrupts */ +} + + +/** \brief System Reset + + The function initiates a system reset request to reset the MCU. + */ +__STATIC_INLINE void NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = ((0x5FA << SCB_AIRCR_VECTKEY_Pos) | + SCB_AIRCR_SYSRESETREQ_Msk); + __DSB(); /* Ensure completion of memory access */ + while(1); /* wait until reset */ +} + +/*@} end of CMSIS_Core_NVICFunctions */ + + + +/* ################################## SysTick function ############################################ */ +/** \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if (__Vendor_SysTickConfig == 0) + +/** \brief System Tick Configuration + + The function initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + + \param [in] ticks Number of ticks between two interrupts. + + \return 0 Function succeeded. + \return 1 Function failed. + + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1) > SysTick_LOAD_RELOAD_Msk) return (1); /* Reload value impossible */ + + SysTick->LOAD = ticks - 1; /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1<<__NVIC_PRIO_BITS) - 1); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0); /* Function successful */ +} + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + + +#endif /* __CORE_CM0PLUS_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ + +#ifdef __cplusplus +} +#endif diff --git a/core/core_cmFunc.h b/core/core_cmFunc.h new file mode 100644 index 0000000..477f0e8 --- /dev/null +++ b/core/core_cmFunc.h @@ -0,0 +1,637 @@ +/**************************************************************************//** + * @file core_cmFunc.h + * @brief CMSIS Cortex-M Core Function Access Header File + * @version V3.30 + * @date 17. February 2014 + * + * @note + * + ******************************************************************************/ +/* Copyright (c) 2009 - 2014 ARM LIMITED + + 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 ARM 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 COPYRIGHT HOLDERS AND 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 __CORE_CMFUNC_H +#define __CORE_CMFUNC_H + + +/* ########################### Core Function Access ########################### */ +/** \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions + @{ + */ + +#if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/ +/* ARM armcc specific functions */ + +#if (__ARMCC_VERSION < 400677) + #error "Please use ARM Compiler Toolchain V4.0.677 or later!" +#endif + +/* intrinsic void __enable_irq(); */ +/* intrinsic void __disable_irq(); */ + +/** \brief Get Control Register + + This function returns the content of the Control Register. + + \return Control Register value + */ +__STATIC_INLINE uint32_t __get_CONTROL(void) +{ + register uint32_t __regControl __ASM("control"); + return(__regControl); +} + + +/** \brief Set Control Register + + This function writes the given value to the Control Register. + + \param [in] control Control Register value to set + */ +__STATIC_INLINE void __set_CONTROL(uint32_t control) +{ + register uint32_t __regControl __ASM("control"); + __regControl = control; +} + + +/** \brief Get IPSR Register + + This function returns the content of the IPSR Register. + + \return IPSR Register value + */ +__STATIC_INLINE uint32_t __get_IPSR(void) +{ + register uint32_t __regIPSR __ASM("ipsr"); + return(__regIPSR); +} + + +/** \brief Get APSR Register + + This function returns the content of the APSR Register. + + \return APSR Register value + */ +__STATIC_INLINE uint32_t __get_APSR(void) +{ + register uint32_t __regAPSR __ASM("apsr"); + return(__regAPSR); +} + + +/** \brief Get xPSR Register + + This function returns the content of the xPSR Register. + + \return xPSR Register value + */ +__STATIC_INLINE uint32_t __get_xPSR(void) +{ + register uint32_t __regXPSR __ASM("xpsr"); + return(__regXPSR); +} + + +/** \brief Get Process Stack Pointer + + This function returns the current value of the Process Stack Pointer (PSP). + + \return PSP Register value + */ +__STATIC_INLINE uint32_t __get_PSP(void) +{ + register uint32_t __regProcessStackPointer __ASM("psp"); + return(__regProcessStackPointer); +} + + +/** \brief Set Process Stack Pointer + + This function assigns the given value to the Process Stack Pointer (PSP). + + \param [in] topOfProcStack Process Stack Pointer value to set + */ +__STATIC_INLINE void __set_PSP(uint32_t topOfProcStack) +{ + register uint32_t __regProcessStackPointer __ASM("psp"); + __regProcessStackPointer = topOfProcStack; +} + + +/** \brief Get Main Stack Pointer + + This function returns the current value of the Main Stack Pointer (MSP). + + \return MSP Register value + */ +__STATIC_INLINE uint32_t __get_MSP(void) +{ + register uint32_t __regMainStackPointer __ASM("msp"); + return(__regMainStackPointer); +} + + +/** \brief Set Main Stack Pointer + + This function assigns the given value to the Main Stack Pointer (MSP). + + \param [in] topOfMainStack Main Stack Pointer value to set + */ +__STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) +{ + register uint32_t __regMainStackPointer __ASM("msp"); + __regMainStackPointer = topOfMainStack; +} + + +/** \brief Get Priority Mask + + This function returns the current state of the priority mask bit from the Priority Mask Register. + + \return Priority Mask value + */ +__STATIC_INLINE uint32_t __get_PRIMASK(void) +{ + register uint32_t __regPriMask __ASM("primask"); + return(__regPriMask); +} + + +/** \brief Set Priority Mask + + This function assigns the given value to the Priority Mask Register. + + \param [in] priMask Priority Mask + */ +__STATIC_INLINE void __set_PRIMASK(uint32_t priMask) +{ + register uint32_t __regPriMask __ASM("primask"); + __regPriMask = (priMask); +} + + +#if (__CORTEX_M >= 0x03) + +/** \brief Enable FIQ + + This function enables FIQ interrupts by clearing the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +#define __enable_fault_irq __enable_fiq + + +/** \brief Disable FIQ + + This function disables FIQ interrupts by setting the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +#define __disable_fault_irq __disable_fiq + + +/** \brief Get Base Priority + + This function returns the current value of the Base Priority register. + + \return Base Priority register value + */ +__STATIC_INLINE uint32_t __get_BASEPRI(void) +{ + register uint32_t __regBasePri __ASM("basepri"); + return(__regBasePri); +} + + +/** \brief Set Base Priority + + This function assigns the given value to the Base Priority register. + + \param [in] basePri Base Priority value to set + */ +__STATIC_INLINE void __set_BASEPRI(uint32_t basePri) +{ + register uint32_t __regBasePri __ASM("basepri"); + __regBasePri = (basePri & 0xff); +} + + +/** \brief Get Fault Mask + + This function returns the current value of the Fault Mask register. + + \return Fault Mask register value + */ +__STATIC_INLINE uint32_t __get_FAULTMASK(void) +{ + register uint32_t __regFaultMask __ASM("faultmask"); + return(__regFaultMask); +} + + +/** \brief Set Fault Mask + + This function assigns the given value to the Fault Mask register. + + \param [in] faultMask Fault Mask value to set + */ +__STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask) +{ + register uint32_t __regFaultMask __ASM("faultmask"); + __regFaultMask = (faultMask & (uint32_t)1); +} + +#endif /* (__CORTEX_M >= 0x03) */ + + +#if (__CORTEX_M == 0x04) + +/** \brief Get FPSCR + + This function returns the current value of the Floating Point Status/Control register. + + \return Floating Point Status/Control register value + */ +__STATIC_INLINE uint32_t __get_FPSCR(void) +{ +#if (__FPU_PRESENT == 1) && (__FPU_USED == 1) + register uint32_t __regfpscr __ASM("fpscr"); + return(__regfpscr); +#else + return(0); +#endif +} + + +/** \brief Set FPSCR + + This function assigns the given value to the Floating Point Status/Control register. + + \param [in] fpscr Floating Point Status/Control value to set + */ +__STATIC_INLINE void __set_FPSCR(uint32_t fpscr) +{ +#if (__FPU_PRESENT == 1) && (__FPU_USED == 1) + register uint32_t __regfpscr __ASM("fpscr"); + __regfpscr = (fpscr); +#endif +} + +#endif /* (__CORTEX_M == 0x04) */ + + +#elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/ +/* GNU gcc specific functions */ + +/** \brief Enable IRQ Interrupts + + This function enables IRQ interrupts by clearing the I-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_irq(void) +{ + __ASM volatile ("cpsie i" : : : "memory"); +} + + +/** \brief Disable IRQ Interrupts + + This function disables IRQ interrupts by setting the I-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_irq(void) +{ + __ASM volatile ("cpsid i" : : : "memory"); +} + + +/** \brief Get Control Register + + This function returns the content of the Control Register. + + \return Control Register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_CONTROL(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, control" : "=r" (result) ); + return(result); +} + + +/** \brief Set Control Register + + This function writes the given value to the Control Register. + + \param [in] control Control Register value to set + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_CONTROL(uint32_t control) +{ + __ASM volatile ("MSR control, %0" : : "r" (control) : "memory"); +} + + +/** \brief Get IPSR Register + + This function returns the content of the IPSR Register. + + \return IPSR Register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_IPSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, ipsr" : "=r" (result) ); + return(result); +} + + +/** \brief Get APSR Register + + This function returns the content of the APSR Register. + + \return APSR Register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_APSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, apsr" : "=r" (result) ); + return(result); +} + + +/** \brief Get xPSR Register + + This function returns the content of the xPSR Register. + + \return xPSR Register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_xPSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, xpsr" : "=r" (result) ); + return(result); +} + + +/** \brief Get Process Stack Pointer + + This function returns the current value of the Process Stack Pointer (PSP). + + \return PSP Register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PSP(void) +{ + register uint32_t result; + + __ASM volatile ("MRS %0, psp\n" : "=r" (result) ); + return(result); +} + + +/** \brief Set Process Stack Pointer + + This function assigns the given value to the Process Stack Pointer (PSP). + + \param [in] topOfProcStack Process Stack Pointer value to set + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack) +{ + __ASM volatile ("MSR psp, %0\n" : : "r" (topOfProcStack) : "sp"); +} + + +/** \brief Get Main Stack Pointer + + This function returns the current value of the Main Stack Pointer (MSP). + + \return MSP Register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_MSP(void) +{ + register uint32_t result; + + __ASM volatile ("MRS %0, msp\n" : "=r" (result) ); + return(result); +} + + +/** \brief Set Main Stack Pointer + + This function assigns the given value to the Main Stack Pointer (MSP). + + \param [in] topOfMainStack Main Stack Pointer value to set + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) +{ + __ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) : "sp"); +} + + +/** \brief Get Priority Mask + + This function returns the current state of the priority mask bit from the Priority Mask Register. + + \return Priority Mask value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PRIMASK(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, primask" : "=r" (result) ); + return(result); +} + + +/** \brief Set Priority Mask + + This function assigns the given value to the Priority Mask Register. + + \param [in] priMask Priority Mask + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PRIMASK(uint32_t priMask) +{ + __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory"); +} + + +#if (__CORTEX_M >= 0x03) + +/** \brief Enable FIQ + + This function enables FIQ interrupts by clearing the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_fault_irq(void) +{ + __ASM volatile ("cpsie f" : : : "memory"); +} + + +/** \brief Disable FIQ + + This function disables FIQ interrupts by setting the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_fault_irq(void) +{ + __ASM volatile ("cpsid f" : : : "memory"); +} + + +/** \brief Get Base Priority + + This function returns the current value of the Base Priority register. + + \return Base Priority register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_BASEPRI(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, basepri_max" : "=r" (result) ); + return(result); +} + + +/** \brief Set Base Priority + + This function assigns the given value to the Base Priority register. + + \param [in] basePri Base Priority value to set + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_BASEPRI(uint32_t value) +{ + __ASM volatile ("MSR basepri, %0" : : "r" (value) : "memory"); +} + + +/** \brief Get Fault Mask + + This function returns the current value of the Fault Mask register. + + \return Fault Mask register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FAULTMASK(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, faultmask" : "=r" (result) ); + return(result); +} + + +/** \brief Set Fault Mask + + This function assigns the given value to the Fault Mask register. + + \param [in] faultMask Fault Mask value to set + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask) +{ + __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory"); +} + +#endif /* (__CORTEX_M >= 0x03) */ + + +#if (__CORTEX_M == 0x04) + +/** \brief Get FPSCR + + This function returns the current value of the Floating Point Status/Control register. + + \return Floating Point Status/Control register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FPSCR(void) +{ +#if (__FPU_PRESENT == 1) && (__FPU_USED == 1) + uint32_t result; + + /* Empty asm statement works as a scheduling barrier */ + __ASM volatile (""); + __ASM volatile ("VMRS %0, fpscr" : "=r" (result) ); + __ASM volatile (""); + return(result); +#else + return(0); +#endif +} + + +/** \brief Set FPSCR + + This function assigns the given value to the Floating Point Status/Control register. + + \param [in] fpscr Floating Point Status/Control value to set + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FPSCR(uint32_t fpscr) +{ +#if (__FPU_PRESENT == 1) && (__FPU_USED == 1) + /* Empty asm statement works as a scheduling barrier */ + __ASM volatile (""); + __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc"); + __ASM volatile (""); +#endif +} + +#endif /* (__CORTEX_M == 0x04) */ + + +#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/ +/* IAR iccarm specific functions */ +#include + + +#elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/ +/* TI CCS specific functions */ +#include + + +#elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/ +/* TASKING carm specific functions */ +/* + * The CMSIS functions have been implemented as intrinsics in the compiler. + * Please use "carm -?i" to get an up to date list of all intrinsics, + * Including the CMSIS ones. + */ + + +#elif defined ( __CSMC__ ) /*------------------ COSMIC Compiler -------------------*/ +/* Cosmic specific functions */ +#include + +#endif + +/*@} end of CMSIS_Core_RegAccFunctions */ + +#endif /* __CORE_CMFUNC_H */ diff --git a/core/core_cmInstr.h b/core/core_cmInstr.h new file mode 100644 index 0000000..5824637 --- /dev/null +++ b/core/core_cmInstr.h @@ -0,0 +1,687 @@ +/**************************************************************************//** + * @file core_cmInstr.h + * @brief CMSIS Cortex-M Core Instruction Access Header File + * @version V3.30 + * @date 17. February 2014 + * + * @note + * + ******************************************************************************/ +/* Copyright (c) 2009 - 2014 ARM LIMITED + + 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 ARM 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 COPYRIGHT HOLDERS AND 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 __CORE_CMINSTR_H +#define __CORE_CMINSTR_H + + +/* ########################## Core Instruction Access ######################### */ +/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface + Access to dedicated instructions + @{ +*/ + +#if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/ +/* ARM armcc specific functions */ + +#if (__ARMCC_VERSION < 400677) + #error "Please use ARM Compiler Toolchain V4.0.677 or later!" +#endif + + +/** \brief No Operation + + No Operation does nothing. This instruction can be used for code alignment purposes. + */ +#define __NOP __nop + + +/** \brief Wait for Interrupt + + Wait for Interrupt is a hint instruction that suspends execution + until one of a number of events occurs. + */ +#define __WFI __wfi + + +/** \brief Wait for Event + + Wait for Event is a hint instruction that permits the processor to enter + a low-power state until one of a number of events occurs. + */ +#define __WFE __wfe + + +/** \brief Send Event + + Send Event is a hint instruction. It causes an event to be signaled to the CPU. + */ +#define __SEV __sev + + +/** \brief Instruction Synchronization Barrier + + Instruction Synchronization Barrier flushes the pipeline in the processor, + so that all instructions following the ISB are fetched from cache or + memory, after the instruction has been completed. + */ +#define __ISB() __isb(0xF) + + +/** \brief Data Synchronization Barrier + + This function acts as a special kind of Data Memory Barrier. + It completes when all explicit memory accesses before this instruction complete. + */ +#define __DSB() __dsb(0xF) + + +/** \brief Data Memory Barrier + + This function ensures the apparent order of the explicit memory operations before + and after the instruction, without ensuring their completion. + */ +#define __DMB() __dmb(0xF) + + +/** \brief Reverse byte order (32 bit) + + This function reverses the byte order in integer value. + + \param [in] value Value to reverse + \return Reversed value + */ +#define __REV __rev + + +/** \brief Reverse byte order (16 bit) + + This function reverses the byte order in two unsigned short values. + + \param [in] value Value to reverse + \return Reversed value + */ +#ifndef __NO_EMBEDDED_ASM +__attribute__((section(".rev16_text"))) __STATIC_INLINE __ASM uint32_t __REV16(uint32_t value) +{ + rev16 r0, r0 + bx lr +} +#endif + +/** \brief Reverse byte order in signed short value + + This function reverses the byte order in a signed short value with sign extension to integer. + + \param [in] value Value to reverse + \return Reversed value + */ +#ifndef __NO_EMBEDDED_ASM +__attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int32_t __REVSH(int32_t value) +{ + revsh r0, r0 + bx lr +} +#endif + + +/** \brief Rotate Right in unsigned value (32 bit) + + This function Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits. + + \param [in] value Value to rotate + \param [in] value Number of Bits to rotate + \return Rotated value + */ +#define __ROR __ror + + +/** \brief Breakpoint + + This function causes the processor to enter Debug state. + Debug tools can use this to investigate system state when the instruction at a particular address is reached. + + \param [in] value is ignored by the processor. + If required, a debugger can use it to store additional information about the breakpoint. + */ +#define __BKPT(value) __breakpoint(value) + + +#if (__CORTEX_M >= 0x03) + +/** \brief Reverse bit order of value + + This function reverses the bit order of the given value. + + \param [in] value Value to reverse + \return Reversed value + */ +#define __RBIT __rbit + + +/** \brief LDR Exclusive (8 bit) + + This function performs a exclusive LDR command for 8 bit value. + + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +#define __LDREXB(ptr) ((uint8_t ) __ldrex(ptr)) + + +/** \brief LDR Exclusive (16 bit) + + This function performs a exclusive LDR command for 16 bit values. + + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +#define __LDREXH(ptr) ((uint16_t) __ldrex(ptr)) + + +/** \brief LDR Exclusive (32 bit) + + This function performs a exclusive LDR command for 32 bit values. + + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +#define __LDREXW(ptr) ((uint32_t ) __ldrex(ptr)) + + +/** \brief STR Exclusive (8 bit) + + This function performs a exclusive STR command for 8 bit values. + + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +#define __STREXB(value, ptr) __strex(value, ptr) + + +/** \brief STR Exclusive (16 bit) + + This function performs a exclusive STR command for 16 bit values. + + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +#define __STREXH(value, ptr) __strex(value, ptr) + + +/** \brief STR Exclusive (32 bit) + + This function performs a exclusive STR command for 32 bit values. + + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +#define __STREXW(value, ptr) __strex(value, ptr) + + +/** \brief Remove the exclusive lock + + This function removes the exclusive lock which is created by LDREX. + + */ +#define __CLREX __clrex + + +/** \brief Signed Saturate + + This function saturates a signed value. + + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (1..32) + \return Saturated value + */ +#define __SSAT __ssat + + +/** \brief Unsigned Saturate + + This function saturates an unsigned value. + + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (0..31) + \return Saturated value + */ +#define __USAT __usat + + +/** \brief Count leading zeros + + This function counts the number of leading zeros of a data value. + + \param [in] value Value to count the leading zeros + \return number of leading zeros in value + */ +#define __CLZ __clz + +#endif /* (__CORTEX_M >= 0x03) */ + + +#elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/ +/* GNU gcc specific functions */ + +/* Define macros for porting to both thumb1 and thumb2. + * for thumb1, use low register (r0-r7), specified by constrant "l" + * Otherwise, use general registers, specified by constrant "r" */ +#if defined (__thumb__) && !defined (__thumb2__) +#define __CMSIS_GCC_OUT_REG(r) "=l" (r) +#define __CMSIS_GCC_USE_REG(r) "l" (r) +#else +#define __CMSIS_GCC_OUT_REG(r) "=r" (r) +#define __CMSIS_GCC_USE_REG(r) "r" (r) +#endif + +/** \brief No Operation + + No Operation does nothing. This instruction can be used for code alignment purposes. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __NOP(void) +{ + __ASM volatile ("nop"); +} + + +/** \brief Wait for Interrupt + + Wait for Interrupt is a hint instruction that suspends execution + until one of a number of events occurs. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __WFI(void) +{ + __ASM volatile ("wfi"); +} + + +/** \brief Wait for Event + + Wait for Event is a hint instruction that permits the processor to enter + a low-power state until one of a number of events occurs. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __WFE(void) +{ + __ASM volatile ("wfe"); +} + + +/** \brief Send Event + + Send Event is a hint instruction. It causes an event to be signaled to the CPU. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __SEV(void) +{ + __ASM volatile ("sev"); +} + + +/** \brief Instruction Synchronization Barrier + + Instruction Synchronization Barrier flushes the pipeline in the processor, + so that all instructions following the ISB are fetched from cache or + memory, after the instruction has been completed. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __ISB(void) +{ + __ASM volatile ("isb"); +} + + +/** \brief Data Synchronization Barrier + + This function acts as a special kind of Data Memory Barrier. + It completes when all explicit memory accesses before this instruction complete. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __DSB(void) +{ + __ASM volatile ("dsb"); +} + + +/** \brief Data Memory Barrier + + This function ensures the apparent order of the explicit memory operations before + and after the instruction, without ensuring their completion. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __DMB(void) +{ + __ASM volatile ("dmb"); +} + + +/** \brief Reverse byte order (32 bit) + + This function reverses the byte order in integer value. + + \param [in] value Value to reverse + \return Reversed value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __REV(uint32_t value) +{ +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) + return __builtin_bswap32(value); +#else + uint32_t result; + + __ASM volatile ("rev %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return(result); +#endif +} + + +/** \brief Reverse byte order (16 bit) + + This function reverses the byte order in two unsigned short values. + + \param [in] value Value to reverse + \return Reversed value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __REV16(uint32_t value) +{ + uint32_t result; + + __ASM volatile ("rev16 %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return(result); +} + + +/** \brief Reverse byte order in signed short value + + This function reverses the byte order in a signed short value with sign extension to integer. + + \param [in] value Value to reverse + \return Reversed value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE int32_t __REVSH(int32_t value) +{ +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + return (short)__builtin_bswap16(value); +#else + uint32_t result; + + __ASM volatile ("revsh %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return(result); +#endif +} + + +/** \brief Rotate Right in unsigned value (32 bit) + + This function Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits. + + \param [in] value Value to rotate + \param [in] value Number of Bits to rotate + \return Rotated value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __ROR(uint32_t op1, uint32_t op2) +{ + return (op1 >> op2) | (op1 << (32 - op2)); +} + + +/** \brief Breakpoint + + This function causes the processor to enter Debug state. + Debug tools can use this to investigate system state when the instruction at a particular address is reached. + + \param [in] value is ignored by the processor. + If required, a debugger can use it to store additional information about the breakpoint. + */ +#define __BKPT(value) __ASM volatile ("bkpt "#value) + + +#if (__CORTEX_M >= 0x03) + +/** \brief Reverse bit order of value + + This function reverses the bit order of the given value. + + \param [in] value Value to reverse + \return Reversed value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __RBIT(uint32_t value) +{ + uint32_t result; + + __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); + return(result); +} + + +/** \brief LDR Exclusive (8 bit) + + This function performs a exclusive LDR command for 8 bit value. + + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint8_t __LDREXB(volatile uint8_t *addr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrexb %0, %1" : "=r" (result) : "Q" (*addr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrexb %0, [%1]" : "=r" (result) : "r" (addr) : "memory" ); +#endif + return ((uint8_t) result); /* Add explicit type cast here */ +} + + +/** \brief LDR Exclusive (16 bit) + + This function performs a exclusive LDR command for 16 bit values. + + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint16_t __LDREXH(volatile uint16_t *addr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrexh %0, %1" : "=r" (result) : "Q" (*addr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrexh %0, [%1]" : "=r" (result) : "r" (addr) : "memory" ); +#endif + return ((uint16_t) result); /* Add explicit type cast here */ +} + + +/** \brief LDR Exclusive (32 bit) + + This function performs a exclusive LDR command for 32 bit values. + + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __LDREXW(volatile uint32_t *addr) +{ + uint32_t result; + + __ASM volatile ("ldrex %0, %1" : "=r" (result) : "Q" (*addr) ); + return(result); +} + + +/** \brief STR Exclusive (8 bit) + + This function performs a exclusive STR command for 8 bit values. + + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *addr) +{ + uint32_t result; + + __ASM volatile ("strexb %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) ); + return(result); +} + + +/** \brief STR Exclusive (16 bit) + + This function performs a exclusive STR command for 16 bit values. + + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __STREXH(uint16_t value, volatile uint16_t *addr) +{ + uint32_t result; + + __ASM volatile ("strexh %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) ); + return(result); +} + + +/** \brief STR Exclusive (32 bit) + + This function performs a exclusive STR command for 32 bit values. + + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __STREXW(uint32_t value, volatile uint32_t *addr) +{ + uint32_t result; + + __ASM volatile ("strex %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) ); + return(result); +} + + +/** \brief Remove the exclusive lock + + This function removes the exclusive lock which is created by LDREX. + + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __CLREX(void) +{ + __ASM volatile ("clrex" ::: "memory"); +} + + +/** \brief Signed Saturate + + This function saturates a signed value. + + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (1..32) + \return Saturated value + */ +#define __SSAT(ARG1,ARG2) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1); \ + __ASM ("ssat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + + +/** \brief Unsigned Saturate + + This function saturates an unsigned value. + + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (0..31) + \return Saturated value + */ +#define __USAT(ARG1,ARG2) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1); \ + __ASM ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + + +/** \brief Count leading zeros + + This function counts the number of leading zeros of a data value. + + \param [in] value Value to count the leading zeros + \return number of leading zeros in value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint8_t __CLZ(uint32_t value) +{ + uint32_t result; + + __ASM volatile ("clz %0, %1" : "=r" (result) : "r" (value) ); + return ((uint8_t) result); /* Add explicit type cast here */ +} + +#endif /* (__CORTEX_M >= 0x03) */ + + +#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/ +/* IAR iccarm specific functions */ +#include + + +#elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/ +/* TI CCS specific functions */ +#include + + +#elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/ +/* TASKING carm specific functions */ +/* + * The CMSIS functions have been implemented as intrinsics in the compiler. + * Please use "carm -?i" to get an up to date list of all intrinsics, + * Including the CMSIS ones. + */ + + +#elif defined ( __CSMC__ ) /*------------------ COSMIC Compiler -------------------*/ +/* Cosmic specific functions */ +#include + +#endif + +/*@}*/ /* end of group CMSIS_Core_InstructionInterface */ + +#endif /* __CORE_CMINSTR_H */ diff --git a/core/gnu/Makefile.common b/core/gnu/Makefile.common new file mode 100644 index 0000000..6331e6a --- /dev/null +++ b/core/gnu/Makefile.common @@ -0,0 +1,74 @@ +SDK_ROOT ?= ../.. +GNU_INSTALL_ROOT ?= $(SDK_ROOT)/tools/gcc-arm-none-eabi-10.3-2021.10 +GNU_VERSION ?= 10.3.1 + +RM = rm -rf + +## Selecting Core +CORTEX_M = 0 + +## Toolchain commands +GNU_PREFIX = arm-none-eabi +CC = $(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-gcc +CXX = $(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-c++ +AS = $(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-as +AR = $(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-ar -r +LD = $(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-ld +NM = $(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-nm +OBJDUMP = $(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-objdump +OBJCOPY = $(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-objcopy +SIZE = $(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-size +STRIP = $(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-strip + + +## library file +LIBFILES ?= -lc_nano -lgcc -lnosys + +## library path +LIBDIR += -L $(GNU_INSTALL_ROOT)/lib/gcc/arm-none-eabi/$(GNU_VERSION)/thumb/v6-m/nofp +LIBDIR += -L $(GNU_INSTALL_ROOT)/arm-none-eabi/lib/thumb/v6-m/nofp +LIBDIR += -L $(SDK_ROOT)/drivers/lib + +## include +INC = $(GNU_INSTALL_ROOT)/arm-none-eabi/include + +## Options for specific architecture +CORE = CM$(CORTEX_M) +ARCH_FLAGS = -mthumb -mcpu=cortex-m$(CORTEX_M) + +## Startup code & linker script +STARTUP ?= $(SDK_ROOT)/core/gnu/startup.S +LINKER_SCRIPT ?= $(SDK_ROOT)/core/gnu/link_xip.ld + +# Optimization flags +OPT ?= -Os -g + +## C flags common to all targets +CFLAGS += $(OPT) +CFLAGS += $(ARCH_FLAGS) +# Generate .d file +#CFLAGS += -MP -MD +CFLAGS += -std=gnu11 +CFLAGS += -Wall +#CFLAGS += -Werror +# close all warning +#CFLAGS += -w +CFLAGS += -msoft-float +# keep every function in a separate section, this allows linker to discard unused ones +CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing +CFLAGS += -fno-builtin -fshort-enums + +## Assembler flags common to all targets +ASMFLAGS += $(ARCH_FLAGS) +# support ARM/Thumb interworking +ASMFLAGS += -mthumb-interwork + +## Linker flags +LDFLAGS += $(OPT) +LDFLAGS += -T$(LINKER_SCRIPT) -nostdlib -EL +# Remove unused sections (on some targets) +LDFLAGS += --gc-sections +# Reduce code size by using target specific optimizations +LDFLAGS += --relax +# cross reference table +LDFLAGS += --cref diff --git a/core/gnu/link_xip.ld b/core/gnu/link_xip.ld new file mode 100644 index 0000000..4edb1d2 --- /dev/null +++ b/core/gnu/link_xip.ld @@ -0,0 +1,210 @@ +/* Linker script to configure memory regions. + * Need modifying for a specific board. + * FLASH.ORIGIN: starting address of flash + * FLASH.LENGTH: length of flash + * RAM.ORIGIN: starting address of RAM bank 0 + * RAM.LENGTH: length of RAM bank 0 + */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x18008000, LENGTH = 0x38000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x4000 +} + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which code can use without definition: + * __exidx_start + * __exidx_end + * __copy_table_start__ + * __copy_table_end__ + * __zero_table_start__ + * __zero_table_end__ + * __etext + * __data_start__ + * __preinit_array_start + * __preinit_array_end + * __init_array_start + * __init_array_end + * __fini_array_start + * __fini_array_end + * __data_end__ + * __bss_start__ + * __bss_end__ + * __end__ + * end + * __HeapLimit + * __StackLimit + * __StackTop + * __stack + */ +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + KEEP(*(.text.user_irq_handler)) + + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* To copy multiple ROM to RAM sections, + * uncomment .copy.table section and, + * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ + /* + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + LONG (__etext) + LONG (__data_start__) + LONG (__data_end__ - __data_start__) + LONG (__etext2) + LONG (__data2_start__) + LONG (__data2_end__ - __data2_start__) + __copy_table_end__ = .; + } > FLASH + */ + + /* To clear multiple BSS sections, + * uncomment .zero.table section and, + * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ + /* + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + LONG (__bss_start__) + LONG (__bss_end__ - __bss_start__) + LONG (__bss2_start__) + LONG (__bss2_end__ - __bss2_start__) + __zero_table_end__ = .; + } > FLASH + */ + + __etext = ALIGN (4); + .data : AT (__etext) + { + __data_start__ = .; + + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + /* + *(RAM_FSHLIST) + *(RAM_FSHCODE) + */ + + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss) + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + PROVIDE(end = .); + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /DISCARD/ : + { + *(.debug) + *(.debug*) + *(.ARM.attributes) + *(.comment) + *(.stab) + *(.stabstr) + } + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/core/gnu/startup.S b/core/gnu/startup.S new file mode 100644 index 0000000..a8f9193 --- /dev/null +++ b/core/gnu/startup.S @@ -0,0 +1,218 @@ + .syntax unified + .arch armv6-m + + .extern main + + .section .stack + .align 3 +#ifdef __STACK_SIZE + .equ Stack_Size, __STACK_SIZE +#else + .equ Stack_Size, 0x600 +#endif + + .globl __StackTop + .globl __StackLimit +__StackLimit: + .space Stack_Size + .size __StackLimit, . - __StackLimit +__StackTop: + .size __StackTop, . - __StackTop + + .section .heap + .align 3 + + .equ Heap_Size, 0 + + .globl __HeapBase + .globl __HeapLimit +__HeapBase: + .if Heap_Size + .space Heap_Size + .endif + .size __HeapBase, . - __HeapBase +__HeapLimit: + .size __HeapLimit, . - __HeapLimit + + .section .isr_vector + .align 2 + .globl __isr_vector +__isr_vector: + .long __StackTop /* Top of Stack */ + .long Reset_Handler /* Reset Handler */ + .long NMI_Handler /* NMI Handler */ + .long HardFault_Handler /* Hard Fault Handler */ + .long 0 /* Reserved */ + .long 0 /* Reserved */ + .long 0 /* Reserved */ + .long 0 /* Reserved */ + .long 0 /* Reserved */ + .long 0 /* Reserved */ + .long 0 /* Reserved */ + .long SVC_Handler /* SVCall Handler */ + .long 0 /* Reserved */ + .long 0 /* Reserved */ + .long PendSV_Handler /* PendSV Handler */ + .long SysTick_Handler /* SysTick Handler */ + + /* External interrupts */ + .long EXTI_IRQHandler /* 0 */ + .long IWDT_IRQHandler /* 1 */ + .long BLE_IRQHandler /* 2 */ + .long DMAC_IRQHandler /* 3 */ + .long BB_LP_IRQHandler /* 4 */ + .long BTMR_IRQHandler /* 5 */ + .long CTMR1_IRQHandler /* 6 */ + .long ADMR1_IRQHandler /* 7 */ + .long RTC_IRQHandler /* 8 */ + .long I2C1_IRQHandler /* 9 */ + .long SPIM_IRQHandler /* 10*/ + .long SPIS_IRQHandler /* 11 */ + .long UART1_IRQHandler /* 12 */ + .long UART2_IRQHandler /* 13 */ + .long AON_PMU_IRQHandler /* 14 */ + .long LVD33_IRQHandler /* 15 */ + .long BOD12_IRQHandler /* 16 */ + .long USB_IRQHandler /* 17 */ + .long USB_SOF_IRQHandler /* 18 */ + .long FSHC_IRQHandler /* 19 */ + .long 0 /* 20 Reserved*/ + .long 0 /* 21 Reserved*/ + .long 0 /* 22 Reserved*/ + .long 0 /* 23 Reserved*/ + .long 0 /* 24 Reserved*/ + .long 0 /* 25 Reserved*/ + .long 0 /* 26 Reserved*/ + .long 0 /* 27 Reserved*/ + .long 0 /* 28 Reserved*/ + .long 0 /* 29 Reserved*/ + .long 0 /* 30 Reserved*/ + .long 0 /* 31 Reserved*/ + .size __isr_vector, . - __isr_vector + + + .text + .thumb + .thumb_func + .align 1 + .globl Reset_Handler + .type Reset_Handler, %function + .section ".text.user_irq_handler" +Reset_Handler: + ldr r1, =__etext + ldr r2, =__data_start__ + ldr r3, =__data_end__ + + + subs r3, r2 + ble .L_loop1_done + +.L_loop1: + subs r3, #4 + ldr r0, [r1,r3] + str r0, [r2,r3] + bgt .L_loop1 + +.L_loop1_done: + + + +/* Single BSS section scheme. + * + * The BSS section is specified by following symbols + * __bss_start__: start of the BSS section. + * __bss_end__: end of the BSS section. + * + * Both addresses must be aligned to 4 bytes boundary. + */ + ldr r1, =__bss_start__ + ldr r2, =__bss_end__ + + movs r0, 0 + + subs r2, r1 + ble .L_loop3_done + +.L_loop3: + subs r2, #4 + str r0, [r1, r2] + bgt .L_loop3 + +.L_loop3_done: + bl main + + .pool + .size Reset_Handler, . - Reset_Handler + +/* Dummy Exception Handlers (infinite loops which can be modified) */ + + .weak NMI_Handler + .type NMI_Handler, %function +NMI_Handler: + b . + .size NMI_Handler, . - NMI_Handler + + + .weak HardFault_Handler + .type HardFault_Handler, %function +HardFault_Handler: + b . + .size HardFault_Handler, . - HardFault_Handler + + + .weak SVC_Handler + .type SVC_Handler, %function +SVC_Handler: + b . + .size SVC_Handler, . - SVC_Handler + + + .weak PendSV_Handler + .type PendSV_Handler, %function +PendSV_Handler: + b . + .size PendSV_Handler, . - PendSV_Handler + + + .weak SysTick_Handler + .type SysTick_Handler, %function +SysTick_Handler: + b . + .size SysTick_Handler, . - SysTick_Handler + + .globl Default_Handler + .type Default_Handler, %function +Default_Handler: + b . + .size Default_Handler, . - Default_Handler + +/* Macro to define default handlers. Default handler + * will be weak symbol and just dead loops. They can be + * overwritten by other handlers */ + .macro def_irq_handler handler_name + .weak \handler_name + .set \handler_name, Default_Handler + .endm + + def_irq_handler EXTI_IRQHandler /* 0 */ + def_irq_handler IWDT_IRQHandler /* 1 */ + def_irq_handler BLE_IRQHandler /* 2 */ + def_irq_handler DMAC_IRQHandler /* 3 */ + def_irq_handler BB_LP_IRQHandler /* 4 */ + def_irq_handler BTMR_IRQHandler /* 5 */ + def_irq_handler CTMR1_IRQHandler /* 6 */ + def_irq_handler ADMR1_IRQHandler /* 7 */ + def_irq_handler RTC_IRQHandler /* 8 */ + def_irq_handler I2C1_IRQHandler /* 9 */ + def_irq_handler SPIM_IRQHandler /* 10*/ + def_irq_handler SPIS_IRQHandler /* 11 */ + def_irq_handler UART1_IRQHandler /* 12 */ + def_irq_handler UART2_IRQHandler /* 13 */ + def_irq_handler AON_PMU_IRQHandler /* 14 */ + def_irq_handler LVD33_IRQHandler /* 15 */ + def_irq_handler BOD12_IRQHandler /* 16 */ + def_irq_handler USB_IRQHandler /* 17 */ + def_irq_handler USB_SOF_IRQHandler /* 18 */ + def_irq_handler FSHC_IRQHandler /* 19 */ + + .end diff --git a/core/iar/link_xip.icf b/core/iar/link_xip.icf new file mode 100644 index 0000000..39302ad --- /dev/null +++ b/core/iar/link_xip.icf @@ -0,0 +1,34 @@ +/*###ICF### Section handled by ICF editor, don't touch! ****/ +/*-Editor annotation file-*/ +/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ +/*-Specials-*/ +define symbol __ICFEDIT_intvec_start__ = 0x18008000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0x18008000; +define symbol __ICFEDIT_region_ROM_end__ = 0x18040000; +define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; +define symbol __ICFEDIT_region_RAM_end__ = 0x20004000; + +/* +export symbol __ICFEDIT_region_RAM_start__; +export symbol __ICFEDIT_region_RAM_end__; +*/ +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x600; +define symbol __ICFEDIT_size_heap__ = 0x000; +/**** End of ICF editor section. ###ICF###*/ + +define memory mem with size = 4G; +define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; +define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; + +define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; +define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; + +initialize by copy { readwrite }; +do not initialize { section .noinit }; + +keep { section .intvec }; +place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; +place in ROM_region { readonly }; +place at end of RAM_region { block RamBottom with fixed order {readwrite, block CSTACK, block HEAP} }; \ No newline at end of file diff --git a/core/iar/startup_iar.s b/core/iar/startup_iar.s new file mode 100644 index 0000000..44142da --- /dev/null +++ b/core/iar/startup_iar.s @@ -0,0 +1,201 @@ +;******************************************************************************** +;* File Name : startup_iar.s +;* Author : wq. +;* Version : V1.0.0 +;* Date : 2021.7.15 +;* Description : Dragon Devices vector table for EWARM toolchain. +;* This module performs: +;* - Set the initial SP +;* - Set the initial PC == __iar_program_start, +;* - Set the vector table entries with the exceptions ISR +;* address. +;* After Reset the Cortex-M0 processor is in Thread mode, +;* priority is Privileged, and the Stack is set to Main. +;******************************************************************************** +;* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS +;* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. +;* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, +;* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE +;* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING +;* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +;* FOR MORE INFORMATION PLEASE READ CAREFULLY THE LICENSE AGREEMENT FILE +;* LOCATED IN THE ROOT DIRECTORY OF THIS FIRMWARE PACKAGE. +;*******************************************************************************/ +; +; +; The modules in this file are included in the libraries, and may be replaced +; by any user-defined modules that define the PUBLIC symbol _program_start or +; a user defined start symbol. +; To override the cstartup defined in the library, simply add your modified +; version to the workbench project. +; +; The vector table is normally located at address 0. +; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. +; The name "__vector_table" has special meaning for C-SPY: +; it is where the SP start value is found, and the NVIC vector +; table register (VTOR) is initialized to this address if != 0. + + MODULE ?cstartup + + ;; Forward declaration of sections. + SECTION CSTACK:DATA:NOROOT(3) + + SECTION .intvec:CODE:NOROOT(2) + + EXTERN __iar_program_start + PUBLIC __vector_table + PUBLIC __Vectors + PUBLIC __Vectors_End + PUBLIC __Vectors_Size + + DATA + +__vector_table + DCD sfe(CSTACK) ; 0, load top of stack + DCD Reset_Handler ; 1, Reset Handler + DCD NMI_Handler ; 2, NMI Handler + DCD HardFault_Handler ; 3, Hard Fault Handler + DCD 0 ; 4, Reserved + DCD 0 ; 5, Reserved + DCD 0 ; 6, Reserved + DCD 0 ; 7, Reserved + DCD 0 ; 8, Reserved + DCD 0 ; 9, Reserved + DCD 0 ; 10, Reserved + DCD SVCall_Handler ; 11, SVCall Handler + DCD 0 ; 12, Reserved + DCD 0 ; 13, Reserved + DCD PendSV_Handler ; 14, PendSV Handler + DCD SysTick_Handler ; 15, SysTick Handler + + ; External Interrupts + DCD EXTI_IRQHandler ; 0, EXTI + DCD IWDT_IRQHandler ; 1, IWDT + DCD BLE_IRQHandler ; 2, BB + DCD DMAC_IRQHandler ; 3, DMAChannel + DCD BB_LP_IRQHandler ; 4, BB_LowPower + DCD BTMR_IRQHandler ; 5, DMAC + DCD CTMR1_IRQHandler ; 6, CTMR1 + DCD ADMR1_IRQHandler ; 7, ATMR1 + DCD RTC_IRQHandler ; 8, RTC + DCD I2C1_IRQHandler ; 9, I2C1 + DCD SPIM_IRQHandler ; 10, SPI Master + DCD SPIS_IRQHandler ; 11, SPI Slave + DCD UART1_IRQHandler ; 12, UART1 + DCD UART2_IRQHandler ; 13, UART2 + DCD AON_PMU_IRQHandler ; 14, PMU + DCD LVD33_IRQHandler ; 15, LVD + DCD BOD12_IRQHandler ; 16, BOD + DCD USB_IRQHandler ; 17, USB + DCD USB_SOF_IRQHandler ; 18, USB_SOF + DCD FSHC_IRQHandler ; 19, FSHC + DCD 0 ; 20, Reserved + DCD 0 ; 21, Reserved + DCD 0 ; 22, Reserved + DCD 0 ; 23, Reserved + DCD 0 ; 24, Reserved + DCD 0 ; 25, Reserved + DCD 0 ; 26, Reserved + DCD 0 ; 27, Reserved + DCD 0 ; 28, Reserved + DCD 0 ; 29, Reserved + DCD 0 ; 30, Reserved + DCD 0 ; 31, Reserved + +__Vectors_End +__Vectors EQU __vector_table +__Vectors_Size EQU __Vectors_End - __Vectors + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; Reset_Handler +;; + THUMB + + PUBWEAK Reset_Handler + SECTION .text:CODE:NOROOT:REORDER(2) +Reset_Handler + LDR R0, =__iar_program_start + BX R0 + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Dummy Exception Handlers +;; (infinite loops here, can be modified) +;; + + PUBWEAK NMI_Handler + SECTION .text:CODE:NOROOT:REORDER(1) +NMI_Handler + B . + + + PUBWEAK HardFault_Handler + SECTION .text:CODE:NOROOT:REORDER(1) +HardFault_Handler + B . + + + PUBWEAK SVCall_Handler + SECTION .text:CODE:NOROOT:REORDER(1) +SVCall_Handler + B . + + + PUBWEAK PendSV_Handler + SECTION .text:CODE:NOROOT:REORDER(1) +PendSV_Handler + B . + + + PUBWEAK SysTick_Handler + SECTION .text:CODE:NOROOT:REORDER(1) +SysTick_Handler + B . + + PUBWEAK EXTI_IRQHandler + PUBWEAK IWDT_IRQHandler + PUBWEAK BLE_IRQHandler + PUBWEAK DMAC_IRQHandler + PUBWEAK BB_LP_IRQHandler + PUBWEAK BTMR_IRQHandler + PUBWEAK CTMR1_IRQHandler + PUBWEAK ADMR1_IRQHandler + PUBWEAK RTC_IRQHandler + PUBWEAK I2C1_IRQHandler + PUBWEAK SPIM_IRQHandler + PUBWEAK SPIS_IRQHandler + PUBWEAK UART1_IRQHandler + PUBWEAK UART2_IRQHandler + PUBWEAK AON_PMU_IRQHandler + PUBWEAK LVD33_IRQHandler + PUBWEAK BOD12_IRQHandler + PUBWEAK USB_IRQHandler + PUBWEAK USB_SOF_IRQHandler + PUBWEAK FSHC_IRQHandler + + SECTION .text:CODE:NOROOT:REORDER(1) + +EXTI_IRQHandler +IWDT_IRQHandler +BLE_IRQHandler +DMAC_IRQHandler +BB_LP_IRQHandler +BTMR_IRQHandler +CTMR1_IRQHandler +ADMR1_IRQHandler +RTC_IRQHandler +I2C1_IRQHandler +SPIM_IRQHandler +SPIS_IRQHandler +UART1_IRQHandler +UART2_IRQHandler +AON_PMU_IRQHandler +LVD33_IRQHandler +BOD12_IRQHandler +USB_IRQHandler +USB_SOF_IRQHandler +FSHC_IRQHandler + + B . + + END diff --git a/core/mdk/link_sram.sct b/core/mdk/link_sram.sct new file mode 100644 index 0000000..e7b379d --- /dev/null +++ b/core/mdk/link_sram.sct @@ -0,0 +1,21 @@ +; ************************************************************* +; *** Scatter-Loading Description File generated by uVision *** +; ************************************************************* + +LR_IROM1 0x20003600 0x4A00 +{ + ER_IROM1 +0 + { + *.o (RESET, +First) + *(InRoot$$Sections) + startup*.o (+RO) + + .ANY (+RO) + .ANY (+RW +ZI) + } + + RW_IRAM_STACK 0x20003600-0x600 UNINIT 0x600 + { + .ANY (STACK) + } +} \ No newline at end of file diff --git a/core/mdk/link_xip.sct b/core/mdk/link_xip.sct new file mode 100644 index 0000000..b0e3a95 --- /dev/null +++ b/core/mdk/link_xip.sct @@ -0,0 +1,40 @@ +#! armcc -E -I ..\src\ +#include "cfg.h" + +#define SCT_FLASH_BASE (0x18004000) +#define SCT_FLASH_END (0x18020000) +#define SCT_FLASH_LEN (SCT_FLASH_END - SCT_FLASH_BASE) + +LR_IROM1 SCT_FLASH_BASE SCT_FLASH_LEN +{ + ER_IROM1 SCT_FLASH_BASE SCT_FLASH_LEN + { + *.o (RESET, +First) + *(InRoot$$Sections) + startup*.o (+RO) + .ANY (+RO) + } + + RW_IRAM_VECT 0x20003000 EMPTY 152 + { + ; sram vector + } + + RW_IRAM_USER +0 + { + *.o(ram_func*) + .ANY (+RW +ZI) + } + + RW_IRAM_STACK 0x20008000-0x600 UNINIT 0x600 + { + .ANY (STACK) + } + + RW_IRAM_RETN 0x20008000 UNINIT 0x2000 + { + ; retention memory 8KB + ; user manual init + *.o(user_retention) + } +} diff --git a/core/mdk/link_xip_ble.sct b/core/mdk/link_xip_ble.sct new file mode 100644 index 0000000..39e8612 --- /dev/null +++ b/core/mdk/link_xip_ble.sct @@ -0,0 +1,52 @@ +#! armcc -E -I ..\src\ -I ..\..\..\ble\api +#include "cfg.h" +#include "blelib.h" + +#define SCT_FLASH_BASE (0x18004000) +#define SCT_FLASH_END (0x18020000) +#define SCT_FLASH_LEN (SCT_FLASH_END - SCT_FLASH_BASE) + +LR_IROM1 SCT_FLASH_BASE SCT_FLASH_LEN +{ + ER_IROM1 SCT_FLASH_BASE SCT_FLASH_LEN + { + *.o (RESET, +First) + *(InRoot$$Sections) + startup*.o (+RO) + .ANY (+RO) + } + + RW_IRAM_VECT 0x20003000 EMPTY 152 + { + ; sram vector + } + + RW_IRAM_USER +0 + { + *.o(ram_func*) + .ANY (+RW +ZI) + } + + RW_IRAM_STACK 0x20008000-0x600 UNINIT 0x600 + { + .ANY (STACK) + } + + RW_IRAM_EXCH BLE_EXCH_BASE EMPTY BLE_EXCH_SIZE + { + ; configured with BLE HW + } + + RW_IRAM_HEAP BLE_HEAP_BASE EMPTY BLE_HEAP_SIZE + { + ; configured with ble_heap() + } + + RW_IRAM_RWZI BLE_RWZI_BASE UNINIT BLE_RWZI_SIZE + { + ; ZI data, manual inited in lib + *ble6*.lib (+RW +ZI) + ; user manual init + *.o(user_retention) + } +} diff --git a/core/mdk/link_xip_blelite.sct b/core/mdk/link_xip_blelite.sct new file mode 100644 index 0000000..8a9cf29 --- /dev/null +++ b/core/mdk/link_xip_blelite.sct @@ -0,0 +1,51 @@ +#! armcc -E -I ..\src\ -I ..\..\..\ble\api +#include "cfg.h" +#include "blelib.h" + +#define SCT_FLASH_BASE (0x18004000) +#define SCT_FLASH_END (0x18020000) +#define SCT_FLASH_LEN (SCT_FLASH_END - SCT_FLASH_BASE) + +LR_IROM1 SCT_FLASH_BASE SCT_FLASH_LEN +{ + ER_IROM1 SCT_FLASH_BASE SCT_FLASH_LEN + { + *.o (RESET, +First) + *(InRoot$$Sections) + startup*.o (+RO) + .ANY (+RO) + } + + RW_IRAM_VECT 0x20003000 EMPTY 152 + { + ; sram vector + } + + RW_IRAM_USER +0 + { + *.o(ram_func*) + ;.ANY (+RW +ZI) + } + + RW_IRAM_STACK 0x20008000-0x600 UNINIT 0x600 + { + .ANY (STACK) + } + + RW_IRAM_EXCH BLE_EXCH_BASE EMPTY BLE_EXCH_SIZE + { + ; configured with BLE HW + } + + RW_IRAM_HEAP BLE_HEAP_BASE EMPTY BLE_HEAP_SIZE + { + ; configured with ble_heap() + } + + RW_IRAM_RWZI BLE_RWZI_BASE UNINIT BLE_RWZI_SIZE + { + ; ZI data, manual inited in lib + *ble6*.lib (+RW +ZI) + .ANY (+RW +ZI) ; retention + } +} diff --git a/core/mdk/link_xip_mesh.sct b/core/mdk/link_xip_mesh.sct new file mode 100644 index 0000000..72edf51 --- /dev/null +++ b/core/mdk/link_xip_mesh.sct @@ -0,0 +1,52 @@ +#! armcc -E -I ..\src\ -I ..\..\..\ble\api +#include "cfg.h" +#include "blelib.h" + +#define SCT_FLASH_BASE (0x18004000) +#define SCT_FLASH_END (0x18040000) +#define SCT_FLASH_LEN (SCT_FLASH_END - SCT_FLASH_BASE) + +LR_IROM1 SCT_FLASH_BASE SCT_FLASH_LEN +{ + ER_IROM1 SCT_FLASH_BASE SCT_FLASH_LEN + { + *.o (RESET, +First) + *(InRoot$$Sections) + startup*.o (+RO) + .ANY (+RO) + } + + RW_IRAM_VECT 0x20003000 EMPTY 152 + { + ; sram vector + } + + RW_IRAM_USER +0 + { + *.o(ram_func*) + .ANY (+RW +ZI) + } + + RW_IRAM_STACK 0x20008000-0xA00 UNINIT 0xA00 + { + .ANY (STACK) ; Mesh's STACK Size ~2.5K + } + + RW_IRAM_EXCH BLE_EXCH_BASE EMPTY BLE_EXCH_SIZE + { + ; configured with BLE HW + } + + RW_IRAM_HEAP BLE_HEAP_BASE EMPTY BLE_HEAP_SIZE + { + ; configured with ble_heap() + } + + RW_IRAM_RWZI BLE_RWZI_BASE UNINIT BLE_RWZI_SIZE + { + ; ZI data, manual inited in lib + *ble6*.lib (+RW +ZI) + ; user manual init + *.o(user_retention) + } +} diff --git a/core/mdk/startup.s b/core/mdk/startup.s new file mode 100644 index 0000000..4c087b2 --- /dev/null +++ b/core/mdk/startup.s @@ -0,0 +1,225 @@ +;ChipId: B6x + +;Stack Configuration------------------------------------------------------------ +Stack_Size EQU 0x600 + AREA STACK, NOINIT, READWRITE, ALIGN=3 +Stack_Mem SPACE Stack_Size +__initial_sp +;------------------------------------------------------------------------------- + +;Heap Configuration------------------------------------------------------------- +Heap_Size EQU 0x200 + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +Heap_Mem SPACE Heap_Size +__heap_limit +;------------------------------------------------------------------------------- + PRESERVE8 + THUMB + +; Vector Table Mapped to Address 0 at Reset------------------------------------- + AREA RESET, DATA, READONLY + EXPORT __Vectors + +__Vectors DCD __initial_sp ; 0, load top of stack + DCD Reset_Handler ; 1, Reset Handler + DCD NMI_Handler ; 2, NMI Handler + DCD HardFault_Handler ; 3, Hard Fault Handler + DCD 0 ; 4, Reserved + DCD 0 ; 5, Reserved + DCD 0 ; 6, Reserved + DCD 0 ; 7, Reserved + DCD 0 ; 8, Reserved + DCD 0 ; 9, Reserved + DCD 0 ; 10, Reserved + DCD SVCall_Handler ; 11, SVCall Handler + DCD 0 ; 12, Reserved + DCD 0 ; 13, Reserved + DCD PendSV_Handler ; 14, PendSV Handler + DCD SysTick_Handler ; 15, SysTick Handler + + ; External interrupts + DCD EXTI_IRQHandler ; 0, EXTI + DCD IWDT_IRQHandler ; 1, IWDT + DCD BLE_IRQHandler ; 2, BB + DCD DMAC_IRQHandler ; 3, DMAChannel + DCD BB_LP_IRQHandler ; 4, BB_LowPower + DCD BTMR_IRQHandler ; 5, BTMR + DCD CTMR_IRQHandler ; 6, CTMR + DCD ATMR_IRQHandler ; 7, ATMR + DCD RTC_IRQHandler ; 8, RTC + DCD I2C_IRQHandler ; 9, I2C + DCD SPIM_IRQHandler ; 10, SPI Master + DCD SPIS_IRQHandler ; 11, SPI Slave + DCD UART1_IRQHandler ; 12, UART1 + DCD UART2_IRQHandler ; 13, UART2 + DCD AON_PMU_IRQHandler ; 14, PMU + DCD LVD33_IRQHandler ; 15, LVD + DCD BOD12_IRQHandler ; 16, BOD + DCD USB_IRQHandler ; 17, USB + DCD USB_SOF_IRQHandler ; 18, USB_SOF + DCD FSHC_IRQHandler ; 19, FSHC + DCD MDM_IRQHandler ; 20, MODEM + DCD RF_IRQHandler ; 21, RF + +__Vectors_End + +__Vectors_Size EQU __Vectors_End - __Vectors + +;------------------------------------------------------------------------------- + AREA |.INT|, CODE, READONLY + +;Reset Handler------------------------------------------------------------------ +Reset_Handler PROC + EXPORT Reset_Handler [WEAK] + IMPORT __main + IMPORT core_vector + IMPORT trim_load + + ;#ifndef CACHE_USE_SRAM + IF :LNOT::DEF:CACHE_USE_SRAM + ;cache cfg + ;SYSCFG->CACHSRAM_CFG = 0; + MOVS R0, #0x00 + LDR R1, =0x4000102C + STR R0, [R1] + + ;CACHE->CRCR0.Word = 0x18004025; + LDR R0, =0x18004025 + LDR R1, =0x1900000C + STR R0, [R1] + + ;CACHE->CCFR.CACHE_INST_DATA = 1; + ;MOVS R0, #0x08 + ;LDR R1, =0x19000004 + ;STR R0, [R1] + + ;CACHE->CCR.CACHE_EN = 1; + MOVS R0, #0x01 + LDR R1, =0x19000000 + STR R0, [R1] + ENDIF + + ; copy vector to sram + LDR R0, =__Vectors + LDR R1, =core_vector + BLX R1 + + ;APBMISC->XOSC16M_CTRL.Word = 0x00014894; + ;.XOSC16M_LP=0 .XOSC16M_CAP_TR=0x14 + LDR R0, =0x00014894 + LDR R1, =0x40031054 + STR R0, [R1] + + ; load ft trim + LDR R1, =trim_load + BLX R1 + + LDR R0, =__main + BX R0 + ENDP + +; Dummy Exception Handlers (infinite loops here, can be modified) + +NMI_Handler PROC + EXPORT NMI_Handler [WEAK] + B . + ENDP + +HardFault_Handler\ + PROC + EXPORT HardFault_Handler [WEAK] + B . + ENDP + +SVCall_Handler PROC + EXPORT SVCall_Handler [WEAK] + B . + ENDP + +PendSV_Handler PROC + EXPORT PendSV_Handler [WEAK] + B . + ENDP + +SysTick_Handler PROC + EXPORT SysTick_Handler [WEAK] + B . + ENDP + +;peripheral module int --------------------------------------------------------- +Default_Handler PROC + EXPORT EXTI_IRQHandler [WEAK] + EXPORT IWDT_IRQHandler [WEAK] + EXPORT BLE_IRQHandler [WEAK] + EXPORT DMAC_IRQHandler [WEAK] + EXPORT BB_LP_IRQHandler [WEAK] + EXPORT BTMR_IRQHandler [WEAK] + EXPORT CTMR_IRQHandler [WEAK] + EXPORT ATMR_IRQHandler [WEAK] + EXPORT RTC_IRQHandler [WEAK] + EXPORT I2C_IRQHandler [WEAK] + EXPORT SPIM_IRQHandler [WEAK] + EXPORT SPIS_IRQHandler [WEAK] + EXPORT UART1_IRQHandler [WEAK] + EXPORT UART2_IRQHandler [WEAK] + EXPORT AON_PMU_IRQHandler [WEAK] + EXPORT LVD33_IRQHandler [WEAK] + EXPORT BOD12_IRQHandler [WEAK] + EXPORT USB_IRQHandler [WEAK] + EXPORT USB_SOF_IRQHandler [WEAK] + EXPORT FSHC_IRQHandler [WEAK] + EXPORT MDM_IRQHandler [WEAK] + EXPORT RF_IRQHandler [WEAK] + +EXTI_IRQHandler +IWDT_IRQHandler +BLE_IRQHandler +DMAC_IRQHandler +BB_LP_IRQHandler +BTMR_IRQHandler +CTMR_IRQHandler +ATMR_IRQHandler +RTC_IRQHandler +I2C_IRQHandler +SPIM_IRQHandler +SPIS_IRQHandler +UART1_IRQHandler +UART2_IRQHandler +AON_PMU_IRQHandler +LVD33_IRQHandler +BOD12_IRQHandler +USB_IRQHandler +USB_SOF_IRQHandler +FSHC_IRQHandler +MDM_IRQHandler +RF_IRQHandler + B . + ENDP + + ALIGN +;******************************************************************************* +; User Stack and Heap initialization +;******************************************************************************* + IF :DEF:__MICROLIB + + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + + ELSE + + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, = Heap_Mem + LDR R1, = (Stack_Mem + Stack_Size) + LDR R2, = (Heap_Mem + Heap_Size) + LDR R3, = Stack_Mem + BX LR + + ALIGN + + ENDIF + + END diff --git a/core/mdk/startup_mesh.s b/core/mdk/startup_mesh.s new file mode 100644 index 0000000..32214e0 --- /dev/null +++ b/core/mdk/startup_mesh.s @@ -0,0 +1,225 @@ +;ChipId: B6x + +;Stack Configuration------------------------------------------------------------ +Stack_Size EQU 0xA00 ; Mesh's STACK Size ~2.5K + AREA STACK, NOINIT, READWRITE, ALIGN=3 +Stack_Mem SPACE Stack_Size +__initial_sp +;------------------------------------------------------------------------------- + +;Heap Configuration------------------------------------------------------------- +Heap_Size EQU 0x200 + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +Heap_Mem SPACE Heap_Size +__heap_limit +;------------------------------------------------------------------------------- + PRESERVE8 + THUMB + +; Vector Table Mapped to Address 0 at Reset------------------------------------- + AREA RESET, DATA, READONLY + EXPORT __Vectors + +__Vectors DCD __initial_sp ; 0, load top of stack + DCD Reset_Handler ; 1, Reset Handler + DCD NMI_Handler ; 2, NMI Handler + DCD HardFault_Handler ; 3, Hard Fault Handler + DCD 0 ; 4, Reserved + DCD 0 ; 5, Reserved + DCD 0 ; 6, Reserved + DCD 0 ; 7, Reserved + DCD 0 ; 8, Reserved + DCD 0 ; 9, Reserved + DCD 0 ; 10, Reserved + DCD SVCall_Handler ; 11, SVCall Handler + DCD 0 ; 12, Reserved + DCD 0 ; 13, Reserved + DCD PendSV_Handler ; 14, PendSV Handler + DCD SysTick_Handler ; 15, SysTick Handler + + ; External interrupts + DCD EXTI_IRQHandler ; 0, EXTI + DCD IWDT_IRQHandler ; 1, IWDT + DCD BLE_IRQHandler ; 2, BB + DCD DMAC_IRQHandler ; 3, DMAChannel + DCD BB_LP_IRQHandler ; 4, BB_LowPower + DCD BTMR_IRQHandler ; 5, BTMR + DCD CTMR_IRQHandler ; 6, CTMR + DCD ATMR_IRQHandler ; 7, ATMR + DCD RTC_IRQHandler ; 8, RTC + DCD I2C_IRQHandler ; 9, I2C + DCD SPIM_IRQHandler ; 10, SPI Master + DCD SPIS_IRQHandler ; 11, SPI Slave + DCD UART1_IRQHandler ; 12, UART1 + DCD UART2_IRQHandler ; 13, UART2 + DCD AON_PMU_IRQHandler ; 14, PMU + DCD LVD33_IRQHandler ; 15, LVD + DCD BOD12_IRQHandler ; 16, BOD + DCD USB_IRQHandler ; 17, USB + DCD USB_SOF_IRQHandler ; 18, USB_SOF + DCD FSHC_IRQHandler ; 19, FSHC + DCD MDM_IRQHandler ; 20, MODEM + DCD RF_IRQHandler ; 21, RF + +__Vectors_End + +__Vectors_Size EQU __Vectors_End - __Vectors + +;------------------------------------------------------------------------------- + AREA |.INT|, CODE, READONLY + +;Reset Handler------------------------------------------------------------------ +Reset_Handler PROC + EXPORT Reset_Handler [WEAK] + IMPORT __main + IMPORT core_vector + IMPORT trim_load + + ;#ifndef CACHE_USE_SRAM + IF :LNOT::DEF:CACHE_USE_SRAM + ;cache cfg + ;SYSCFG->CACHSRAM_CFG = 0; + MOVS R0, #0x00 + LDR R1, =0x4000102C + STR R0, [R1] + + ;CACHE->CRCR0.Word = 0x18004025; + LDR R0, =0x18004025 + LDR R1, =0x1900000C + STR R0, [R1] + + ;CACHE->CCFR.CACHE_INST_DATA = 1; + ;MOVS R0, #0x08 + ;LDR R1, =0x19000004 + ;STR R0, [R1] + + ;CACHE->CCR.CACHE_EN = 1; + MOVS R0, #0x01 + LDR R1, =0x19000000 + STR R0, [R1] + ENDIF + + ; copy vector to sram + LDR R0, =__Vectors + LDR R1, =core_vector + BLX R1 + + ;APBMISC->XOSC16M_CTRL.Word = 0x00014894; + ;.XOSC16M_LP=0 .XOSC16M_CAP_TR=0x14 + LDR R0, =0x00014894 + LDR R1, =0x40031054 + STR R0, [R1] + + ; load ft trim + LDR R1, =trim_load + BLX R1 + + LDR R0, =__main + BX R0 + ENDP + +; Dummy Exception Handlers (infinite loops here, can be modified) + +NMI_Handler PROC + EXPORT NMI_Handler [WEAK] + B . + ENDP + +HardFault_Handler\ + PROC + EXPORT HardFault_Handler [WEAK] + B . + ENDP + +SVCall_Handler PROC + EXPORT SVCall_Handler [WEAK] + B . + ENDP + +PendSV_Handler PROC + EXPORT PendSV_Handler [WEAK] + B . + ENDP + +SysTick_Handler PROC + EXPORT SysTick_Handler [WEAK] + B . + ENDP + +;peripheral module int --------------------------------------------------------- +Default_Handler PROC + EXPORT EXTI_IRQHandler [WEAK] + EXPORT IWDT_IRQHandler [WEAK] + EXPORT BLE_IRQHandler [WEAK] + EXPORT DMAC_IRQHandler [WEAK] + EXPORT BB_LP_IRQHandler [WEAK] + EXPORT BTMR_IRQHandler [WEAK] + EXPORT CTMR_IRQHandler [WEAK] + EXPORT ATMR_IRQHandler [WEAK] + EXPORT RTC_IRQHandler [WEAK] + EXPORT I2C_IRQHandler [WEAK] + EXPORT SPIM_IRQHandler [WEAK] + EXPORT SPIS_IRQHandler [WEAK] + EXPORT UART1_IRQHandler [WEAK] + EXPORT UART2_IRQHandler [WEAK] + EXPORT AON_PMU_IRQHandler [WEAK] + EXPORT LVD33_IRQHandler [WEAK] + EXPORT BOD12_IRQHandler [WEAK] + EXPORT USB_IRQHandler [WEAK] + EXPORT USB_SOF_IRQHandler [WEAK] + EXPORT FSHC_IRQHandler [WEAK] + EXPORT MDM_IRQHandler [WEAK] + EXPORT RF_IRQHandler [WEAK] + +EXTI_IRQHandler +IWDT_IRQHandler +BLE_IRQHandler +DMAC_IRQHandler +BB_LP_IRQHandler +BTMR_IRQHandler +CTMR_IRQHandler +ATMR_IRQHandler +RTC_IRQHandler +I2C_IRQHandler +SPIM_IRQHandler +SPIS_IRQHandler +UART1_IRQHandler +UART2_IRQHandler +AON_PMU_IRQHandler +LVD33_IRQHandler +BOD12_IRQHandler +USB_IRQHandler +USB_SOF_IRQHandler +FSHC_IRQHandler +MDM_IRQHandler +RF_IRQHandler + B . + ENDP + + ALIGN +;******************************************************************************* +; User Stack and Heap initialization +;******************************************************************************* + IF :DEF:__MICROLIB + + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + + ELSE + + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, = Heap_Mem + LDR R1, = (Stack_Mem + Stack_Size) + LDR R2, = (Heap_Mem + Heap_Size) + LDR R3, = Stack_Mem + BX LR + + ALIGN + + ENDIF + + END diff --git a/core/reg/reg_aon.h b/core/reg/reg_aon.h new file mode 100644 index 0000000..416d621 --- /dev/null +++ b/core/reg/reg_aon.h @@ -0,0 +1,325 @@ +#ifndef _REG_AON_H_ +#define _REG_AON_H_ + +#include "reg_base.h" + +//================================ +//BLOCK AON define + +#define AON_BASE ((uint32_t)0x40030000) +#define AON_BACKUP0_ADDR_OFFSET 0x000 +#define AON_BACKUP1_ADDR_OFFSET 0x004 +#define AON_BKHOLD_CTRL_ADDR_OFFSET 0x008 +#define AON_BACKUP2_ADDR_OFFSET 0x00c +#define AON_BLE_RTC_CTL_ADDR_OFFSET 0x010 +#define AON_SCAN_MODE_CTRL_ADDR_OFFSET 0x014 +#define AON_PMU_CTRL_ADDR_OFFSET 0x018 +#define AON_PMU_WKUP_CTRL_ADDR_OFFSET 0x01c +#define AON_PMU_WKUP_ST_ADDR_OFFSET 0x020 +#define AON_PMU_ANA_CTRL_ADDR_OFFSET 0x024 +#define AON_XOSC16M_CTRL_ADDR_OFFSET 0x028 + +//================================ +//BLOCK AON reg struct define + +typedef union //0x008 +{ + struct + { + uint32_t RC32K_MSB_TRIM_CFG: 4; // bit[3:0] + uint32_t RC32K_LSB_TRIM_CFG: 10; // bit[13:4] + uint32_t XOSC_EST_MODE: 1; // bit14 --- + // 1: extarnal clock through XOSC16M_IN PAD into chip, and XOSC16M_OUT PAD is not driven by XOSC16M + // 0: the XOSC16M_IN & XOSC16M_OUT are connected with crystal oscillator. + uint32_t PIOA19_FUNC_SEL: 1; // bit15 --- + // 0: pioa19 used as reset pin + // 1: pioa19 used as GPIO + // can't be reset by pin reset + uint32_t AONLDO_TRIM_RUN: 4; // bit[19:16] --- LDOBK_TRIM, + // inverter the high two bits + // 0: 1.208 + // 1: 1.253 + // 2: 1.298 + // 3: 1.335 + // 4: 1.035 + // 5: 1.080 + // 6: 1.118 + // 7: 1.163 + // 8: 0.854 + // 9: 0.899 + // 10: 0.944 + // 11: 0.989 + // 12: 0.674 + // 13: 0.719 + // 14: 0.764 + // 15: 0.809 + uint32_t CORELDO_TRIM_RUN: 5; // bit[24:20] --- CORE LDO trim, used when ST_RUN + uint32_t RSV_END: 7; // bit[31:25] + }; + uint32_t Word; +} AON_BKHOLD_CTRL_TypeDef; //0x008 + + +//================================ +#define AON_RC32K_MSB_TRIM_CFG_LSB 0 +#define AON_RC32K_MSB_TRIM_CFG_WIDTH 4 +#define AON_RC32K_LSB_TRIM_CFG_LSB 4 +#define AON_RC32K_LSB_TRIM_CFG_WIDTH 10 +#define AON_XOSC_EST_MODE_POS 14 +#define AON_PIOA19_FUNC_SEL_POS 15 +#define AON_AONLDO_TRIM_RUN_LSB 16 +#define AON_AONLDO_TRIM_RUN_WIDTH 4 +#define AON_CORELDO_TRIM_RUN_LSB 20 +#define AON_CORELDO_TRIM_RUN_WIDTH 5 +//================================ + +typedef union //0x010 +{ + struct + { + uint32_t BLELOWCLK_EN: 1; // bit0 + uint32_t BLELOWCLK_SEL: 1; // bit1 --- BLE low power clock source select + // 0: lsi clock, 32K + // 1: HSE clock/500; 32K + // set as 1 condtion: + // chip is just in deepsleep mode, and makesure + uint32_t RTC_EN: 1; // bit2 + // 0: RTC disable + // 1: RTC enable + uint32_t RSV_END: 29; // bit[31:3] + }; + uint32_t Word; +} AON_BLE_RTC_CTL_TypeDef; //0x010 + + +//================================ +#define AON_BLELOWCLK_EN_POS 0 +#define AON_BLELOWCLK_SEL_POS 1 +#define AON_RTC_EN_POS 2 +//================================ + +typedef union //0x014 +{ + struct + { + uint32_t SCAN_MODE_REQ: 1; // bit0 + uint32_t SCAN_ZIP_CFG: 1; // bit1 + uint32_t RSV_END: 30; // bit[31:2] + }; + uint32_t Word; +} AON_SCAN_MODE_CTRL_TypeDef; //0x014 + + +//================================ +#define AON_SCAN_MODE_REQ_POS 0 +#define AON_SCAN_ZIP_CFG_POS 1 +//================================ + +typedef union //0x018 +{ + struct + { + uint32_t AUTO_DIS_RC32K: 1; // bit0 + // when auto_dis_rc32k is 1 + // RC32K is auto disable when chip in poweroff state or deepsleep state + // RC32K is auto enable when wakeup event happen for poweroff state or deepsleep + // the RTC and BB WAKE LP can't used as wakeup source for DEEPSLEEP or poweroff + // only GPIO or reset pin can be use + uint32_t CORELDO_EN_RUN: 1; // bit1 --- When PMU is on ST_RUN, CORE LDO enable is controlled by coreldo_en_run + uint32_t OSC_EN_RUN: 1; // bit2 --- When PMU is on ST_RUN, OSC enable is controlled by osc_en_run + uint32_t RC32K_EN_RUN: 1; // bit3 --- only use when PMU in ST_RUN, RC32K + uint32_t EM_PD_EN: 1; // bib4 --- + // 1 : EM is power down + // 0 : EN is power enable + uint32_t EM_ACCESS_EN: 1; // bit5 --- + // 1: EM is can be access + // 0: EM is isolation + // note: + // em_access_en set as 0 before em_pd_en set as 1 + // em_access_en set as 1 after em_pd_en set as 0 + uint32_t RSV_NOUSE1: 2; // bit[7:6] --- Ignore me + uint32_t POWEROFF_LOG: 1; // bit8 --- + // when is 1, chip is powerup from POWEROFF state + // else means chip is initial powerup or powerup from BOD event happen + // cleared by poweroff_log_clr + uint32_t EM_PD_ACK: 1; // bit9 + uint32_t RSV_END: 22; // bit[31:10] + }; + uint32_t Word; +} AON_PMU_CTRL_TypeDef; //0x018 + + +//================================ +#define AON_AUTO_DIS_RC32K_POS 0 +#define AON_CORELDO_EN_RUN_POS 1 +#define AON_OSC_EN_RUN_POS 2 +#define AON_RC32K_EN_RUN_POS 3 +#define AON_EM_PD_EN_POS 4 +#define AON_EM_ACCESS_EN_POS 5 +#define AON_POWEROFF_LOG_POS 8 +#define AON_EM_PD_ACK_POS 9 +//================================ + +typedef union //0x01c +{ + struct + { + uint32_t BLE_WKUP_SEL: 2; // bit[1:0] --- both use when deepsleep or poweroff state + // 2'b00 disable ble wakeup + // 2'b01: select ble_osc_en as wakeup source + // 2'b10: select ble_radio_en as wakeup source + // 2'b11: select ble_wakeup_lp as wakeup source + // when poweroff mode, only ble_osc_en can be used + uint32_t BLE_LATCH_N: 1; // bit2 --- + // 0: latch the signal from BB to BLE LP counter + // 1: enable the signal from BB to BLE LP counter + // config as 0 before chip into poweroff mode + // set as 1 after chip powerup and retain the BB state + uint32_t IO_WKUP_EN: 1; // bit3 --- both use when deepsleep or poweroff state + uint32_t RTC_WKUP_EN: 1; // bit4 --- both use when deepsleep or poweroff state + uint32_t IO_LATCH_N: 1; // bit5 --- + // 0: latch the GPIO control signal from core to AON + // 1: enable the GPIO control signal from core to AON + // config as 0 before chip into poweroff mode + // set as 1 after chip powerup and retain the GPIO config + uint32_t RC32K_TRIM_SEL: 1; // bit6 --- + // 0: use rc32k_msb_trim_cfg and rc32k_lsb_trim_cfg control the RC32K freq + // 1: use RC32K calib result control the RC32K freq + uint32_t RSV_END: 25; // bit[31:7] + }; + uint32_t Word; +} AON_PMU_WKUP_CTRL_TypeDef; //0x01c + + +//================================ +#define AON_BLE_WKUP_SEL_LSB 0 +#define AON_BLE_WKUP_SEL_WIDTH 2 +#define AON_BLE_LATCH_N_POS 2 +#define AON_IO_WKUP_EN_POS 3 +#define AON_RTC_WKUP_EN_POS 4 +#define AON_IO_LATCH_N_POS 5 +#define AON_RC32K_TRIM_SEL_POS 6 +//================================ + +typedef union //0x020 +{ + struct + { + uint32_t IO_WKUP_ST: 1; // bit0 + uint32_t BLE_WKUP_ST: 1; // bit1 + uint32_t RTC_WKUP_ST: 1; // bit2 + uint32_t AON_PMU_INT: 1; // bit3 + uint32_t RSV_NOUSE1: 4; // bit[7:4] --- Ignore me + uint32_t BOD12_OUT12_ST: 1; // bit8 + uint32_t LVD33_OUT12_ST: 1; // bit9 + uint32_t RSV_END: 22; // bit[31:10] + }; + uint32_t Word; +} AON_PMU_WKUP_ST_TypeDef; //0x020 + + +//================================ +#define AON_IO_WKUP_ST_POS 0 +#define AON_BLE_WKUP_ST_POS 1 +#define AON_RTC_WKUP_ST_POS 2 +#define AON_AON_PMU_INT_POS 3 +#define AON_BOD12_OUT12_ST_POS 8 +#define AON_LVD33_OUT12_ST_POS 9 +//================================ + +typedef union //0x024 +{ + struct + { + uint32_t BK_BOD_TRIM: 3; // bit[2:0] + uint32_t LDO_BOD_EN: 1; // bit3 --- BOD function: + // detect the VDD12 + // when VDD12 < vth: BOD12_OUT12 is 1 + // else BOD12_OUT12 is 0 + uint32_t LDO_BOD_RST_EN: 1; // bit4 + uint32_t LDO12_IBSEL: 5; // bit[9:5] + uint32_t LDO_LVD_EN: 1; // bit10 + uint32_t LDO_LVD_SEL: 3; // bit[13:11] --- BOD function: + // detect the VDD33 + // when VDD33 < vth: LVD33_OUT12 is 1 + // else BOD12_OUT12 is 0 + uint32_t LDO_LVD_RST_EN: 1; // bit14 + uint32_t RSV_NOUSE1: 1; // bit15 --- Ignore me + uint32_t ANA_RESV: 16; // bit[31:16] --- + // [0] LDO_DPLL VREG12_EN1 TEST EN + // [1] LDO_DPLL VREG12_EN2 TEST EN + // [2] LDO_DPLL EN + // [3] LDO32K TEST EN + // [4] LDOCORE TEST EN + // [7:5] LDODPLL_TRIM[2:0] + // [8] DPLL2 ref clock select:0-OSC 16M, 1-RC 16M + }; + uint32_t Word; +} AON_PMU_ANA_CTRL_TypeDef; //0x024 + + +//================================ +#define AON_BK_BOD_TRIM_LSB 0 +#define AON_BK_BOD_TRIM_WIDTH 3 +#define AON_LDO_BOD_EN_POS 3 +#define AON_LDO_BOD_RST_EN_POS 4 +#define AON_LDO12_IBSEL_LSB 5 +#define AON_LDO12_IBSEL_WIDTH 5 +#define AON_LDO_LVD_EN_POS 10 +#define AON_LDO_LVD_SEL_LSB 11 +#define AON_LDO_LVD_SEL_WIDTH 3 +#define AON_LDO_LVD_RST_EN_POS 14 +#define AON_ANA_RESV_LSB 16 +#define AON_ANA_RESV_WIDTH 16 +//================================ + +typedef union //0x028 +{ + struct + { + uint32_t EN_LDO_XOSC_REG: 1; // bit0 + uint32_t EN_LDO_SEL: 1; // bit1 --- EN_LDO_XOSC control select + // 0: EN_LDO_XOSC is controlled by XOSC16M_EN + // 1: EN_LDO_XOSC is controlled by EN_LDO_XOSC_REG + uint32_t BYPASS_LDO_XOSC: 1; // bit2 + uint32_t RSV_END: 29; // bit[31:3] + }; + uint32_t Word; +} AON_XOSC16M_CTRL_TypeDef; //0x028 + + +//================================ +#define AON_EN_LDO_XOSC_REG_POS 0 +#define AON_EN_LDO_SEL_POS 1 +#define AON_BYPASS_LDO_XOSC_POS 2 +//================================ + +//================================ +//BLOCK AON top struct define +typedef struct +{ + __IO uint32_t BACKUP0 ; // 0x000, valid-bit:16 + // can't be reset by pin reset, por12_bk_stb + __IO uint32_t BACKUP1 ; // 0x004, valid-bit:8 + // can't be reset by pin reset por12_bk_stb + __IO AON_BKHOLD_CTRL_TypeDef BKHOLD_CTRL ; // 0x008, + // can't be reset by pin reset por12_bk_stb + __IO uint32_t BACKUP2 ; // 0x00c, valid-bit:8 + // can be reset by pin reset + __IO AON_BLE_RTC_CTL_TypeDef BLE_RTC_CTL ; // 0x010, + __IO AON_SCAN_MODE_CTRL_TypeDef SCAN_MODE_CTRL ; // 0x014, + // how to into scan mode + // 1: CPU write this scan_mode_req + // 2: wait 200us; + __IO AON_PMU_CTRL_TypeDef PMU_CTRL ; // 0x018, + __IO AON_PMU_WKUP_CTRL_TypeDef PMU_WKUP_CTRL ; // 0x01c, + // set deepsleep poweroff wakeup source + __I AON_PMU_WKUP_ST_TypeDef PMU_WKUP_ST ; // 0x020, + __IO AON_PMU_ANA_CTRL_TypeDef PMU_ANA_CTRL ; // 0x024, + __IO AON_XOSC16M_CTRL_TypeDef XOSC16M_CTRL ; // 0x028, +} AON_TypeDef; + + +#define AON (( AON_TypeDef *) AON_BASE) + +#endif diff --git a/core/reg/reg_apbmisc.h b/core/reg/reg_apbmisc.h new file mode 100644 index 0000000..5f9e88b --- /dev/null +++ b/core/reg/reg_apbmisc.h @@ -0,0 +1,439 @@ +#ifndef _REG_APBMISC_H_ +#define _REG_APBMISC_H_ + +#include "reg_base.h" + +//================================ +//BLOCK APBMISC define + +#define APBMISC_BASE ((uint32_t)0x40031000) +#define APBMISC_RC32K_CALIB_ST_ADDR_OFFSET 0x000 +#define APBMISC_RCCALIB_CTRL_ADDR_OFFSET 0x004 +#define APBMISC_RCCALIB_START_ADDR_OFFSET 0x008 +#define APBMISC_RCFREQ_GET_ADDR_OFFSET 0x00c +#define APBMISC_RC_FREQ_VAL_ADDR_OFFSET 0x010 +#define APBMISC_RCCALIB_STCLR_ADDR_OFFSET 0x014 +#define APBMISC_RC16M_CNT_CTRL_ADDR_OFFSET 0x018 +#define APBMISC_RTCINT_CTRL_ADDR_OFFSET 0x01c +#define APBMISC_RTC_SEC_ADDR_OFFSET 0x020 +#define APBMISC_RTC_MS_ADDR_OFFSET 0x024 +#define APBMISC_RTC_ALARM_SEC_ADDR_OFFSET 0x028 +#define APBMISC_RTC_ALARM_MS_ADDR_OFFSET 0x02c +#define APBMISC_RTC_SEC_SHD_ADDR_OFFSET 0x030 +#define APBMISC_RTC_MS_SHD_ADDR_OFFSET 0x034 +#define APBMISC_AON_PMU_CTRL_ADDR_OFFSET 0x038 +#define APBMISC_LDO_UD_CTRL_ADDR_OFFSET 0x03c +#define APBMISC_PIOA_WKUP_POS_ADDR_OFFSET 0x040 +#define APBMISC_PIOA_WKUP_NEG_ADDR_OFFSET 0x044 +#define APBMISC_POWEROFF_WORD_CMD_ADDR_OFFSET 0x048 +#define APBMISC_POWEROFF_LOG_CLR_ADDR_OFFSET 0x04c +#define APBMISC_RC16M_FREQ_TRIM_ADDR_OFFSET 0x050 +#define APBMISC_XOSC16M_CTRL_ADDR_OFFSET 0x054 +#define APBMISC_BLE_LP_CTRL_ADDR_OFFSET 0x058 +#define APBMISC_BLE_SYNC_TIME_ADDR_OFFSET 0x05c +#define APBMISC_BLE_FINECNT_BOUND_ADDR_OFFSET 0x060 +#define APBMISC_BLE_CLKNCNT_SAMP_ADDR_OFFSET 0x064 +#define APBMISC_BLE_FINECNT_SAMP_ADDR_OFFSET 0x068 +#define APBMISC_BLE_CLKNCNT_CFG_ADDR_OFFSET 0x06c +#define APBMISC_BLE_FINECNT_CFG_ADDR_OFFSET 0x070 +#define APBMISC_BLE_DP_TWCORE_ADDR_OFFSET 0x074 +#define APBMISC_BLE_UPLOAD_ADDR_OFFSET 0x078 +#define APBMISC_DPLL_CTRL_ADDR_OFFSET 0x07c +#define APBMISC_ANAMISC_CTRL_ADDR_OFFSET 0x080 +#define APBMISC_ANAMISC_ST_ADDR_OFFSET 0x084 + +//================================ +//BLOCK APBMISC reg struct define +typedef union //0x000 +{ + struct + { + uint32_t RC32K_MSB_CALIB: 4; // bit[3:0] --- the final RC trim value + uint32_t RSV_NOUSE1: 12; // bit[15:4]--- Ignore me + uint32_t RC32K_LSB_CALIB: 10; // bit[25:16] + uint32_t RSV_END: 6; // bit[31:26] + }; + uint32_t Word; +} APBMISC_RC32K_CALIB_ST_TypeDef; //0x000 + + +//================================ +#define APBMISC_RC32K_MSB_CALIB_LSB 0 +#define APBMISC_RC32K_MSB_CALIB_WIDTH 4 +#define APBMISC_RC32K_LSB_CALIB_LSB 16 +#define APBMISC_RC32K_LSB_CALIB_WIDTH 10 +//================================ + +typedef union //0x004 +{ + struct + { + uint32_t RCCALIB_TARGET: 20; // bit[19:0] --- rccalib_target = Fref * (rccalib_cycles+1) / Flsi + // when rccalib_clksel + // 2'b00: rccalib_target = 16e6 * rccalib_cycles /32000 + // 2'b01: rccalib_target = 64e6 * rccalib_cycles /32000 + // 2'b10: rccalib_target = 128e6 * rccalib_cycles /32000 + uint32_t RCCALIB_CYCLES: 8; // bit[27:20] --- each RC calib step window is (rccalib_cycles+1) of LSI clock + uint32_t RCCALIB_SCAL_EN: 1; // bit28 --- + // 0: all calib step window is depend on rccalib_cycles + // 1: calib step window when search rc32k_msb_calib[3:0] & rc32k_lsb_calib[9:5] is scale down 2 + // and calib step window rc32k_lsb_calib[4:0] is depend on rccalib_cycles + uint32_t RCCALIB_DLY: 1; // bit29 --- + // when is 1:add one LSI clock delay between msb_calib or lsb_calib change to start count + uint32_t RSV_END: 2; // bit[31:30] + }; + uint32_t Word; +} APBMISC_RCCALIB_CTRL_TypeDef; //0x004 + + +//================================ +#define APBMISC_RCCALIB_TARGET_LSB 0 +#define APBMISC_RCCALIB_TARGET_WIDTH 20 +#define APBMISC_RCCALIB_CYCLES_LSB 20 +#define APBMISC_RCCALIB_CYCLES_WIDTH 8 +#define APBMISC_RCCALIB_SCAL_EN_POS 28 +#define APBMISC_RCCALIB_DLY_POS 29 +//================================ + +typedef union //0x014 +{ + struct + { + uint32_t RCCALIB_DONE: 1; // bit0 + uint32_t RCFREQ_DONE: 1; // bit1 + uint32_t RSV_NOUSE1: 6; // bit[7:2] --- Ignore me + uint32_t RCCALIB_DONE_CLR: 1; // bit8 + uint32_t RCFREQ_DONE_CLR: 1; // bit9 + uint32_t RSV_END: 22; // bit[31:10] + }; + uint32_t Word; +} APBMISC_RCCALIB_STCLR_TypeDef; //0x014 + + +//================================ +#define APBMISC_RCCALIB_DONE_POS 0 +#define APBMISC_RCFREQ_DONE_POS 1 +#define APBMISC_RCCALIB_DONE_CLR_POS 8 +#define APBMISC_RCFREQ_DONE_CLR_POS 9 +//================================ + +typedef union //0x018 +{ + struct + { + uint32_t RC16M_WIN_SET: 15; // bit[14:0] --- RC16M cnt window + // (rc16m_win_set<<10) osc16m cycles + uint32_t RC16M_CNT_START: 1; // bit15 + uint32_t RC16M_WIN_CNT: 15; // bit[30:16] + uint32_t RC16M_CNT_DONE: 1; // bit31 + }; + uint32_t Word; +} APBMISC_RC16M_CNT_CTRL_TypeDef; //0x018 + + +//================================ +#define APBMISC_RC16M_WIN_SET_LSB 0 +#define APBMISC_RC16M_WIN_SET_WIDTH 15 +#define APBMISC_RC16M_CNT_START_POS 15 +#define APBMISC_RC16M_WIN_CNT_LSB 16 +#define APBMISC_RC16M_WIN_CNT_WIDTH 15 +#define APBMISC_RC16M_CNT_DONE_POS 31 +//================================ + +typedef union //0x01c +{ + struct + { + uint32_t RTC_INT_EN: 1; // bit0 --- rtc interrupt enable + uint32_t RTC_INT_CLR: 1; // bit1 --- rtc intrrrupt clear + uint32_t RTC_INT_ST: 1; // bit2 --- rtc interrupt status + uint32_t RTC_SET_BUSY: 1; // bit3 + uint32_t RSV_END: 28; // bit[31:4] + }; + uint32_t Word; +} APBMISC_RTCINT_CTRL_TypeDef; //0x01c + + +//================================ +#define APBMISC_RTC_INT_EN_POS 0 +#define APBMISC_RTC_INT_CLR_POS 1 +#define APBMISC_RTC_INT_ST_POS 2 +#define APBMISC_RTC_SET_BUSY_POS 3 +//================================ + +typedef union //0x038 +{ + struct + { + uint32_t LDO_LP_SEL_RUN: 1; // bit0 --- + // 0: CORE LDO is HP mode + // 1: CORE LDO is lp mode + uint32_t AON_PWR_SEL_RUN: 1; // bit1 --- + // 0: select AON_LDO out as AON power + // 1: select CORE_LDO out as AON power + uint32_t HSI_EN_RUN: 1; // bit2 --- When PMU is on ST_RUN, hsi_en is controlled by hsi_en_run + // 1: RC16M enable + uint32_t FSH_PW_EN_RUN: 1; // bit3 + uint32_t RSV_NOUSE1: 4; // bit[7:4] --- Ignore me + uint32_t LDO_LP_SEL_DP: 1; // bit8 --- When PMU is on ST_DP, CORE LDO lp mode is controlled by ldo_lp_sel_dp + uint32_t AON_PWR_SEL_DP: 1; // bit9 --- When PMU is on ST_DP, AON_PWR_SEL is controlled by aon_pwr_sel_dp + uint32_t OSC_EN_DP: 1; // bit10--- When PMU is on ST_DP, OSC enable is controlled by osc_en_dp + uint32_t HSI_EN_DP: 1; // bit11--- When PMU is on ST_DP, hsi_en is controlled by hsi_en_dp + // 1: RC16M enable + uint32_t FSH_PW_EN_DP: 1; // bit12 + uint32_t RSV_NOUSE2: 3; // bit[15:13] --- Ignore me + uint32_t CLK_STB_TIME: 6; // bit[21:16] --- clock stable time for exit from deepsleep + // unit : 30.5us (RC32K clock period) + // stable time : 30.5* (clk_stb_time + 1) + // recommend value: + // 6'd3 (120us) for only wait RC16M stable when exit from deepsleep + // 6'd63(2ms) for both wait RC16M and HOSC16M stable when exit from deepsleep + uint32_t WKUP_ST_CLR: 1; // bit22 + uint32_t AON_PMU_INT_CLR: 1; // bit23 + uint32_t RSV_END: 8; // bit[31:24] + }; + uint32_t Word; +} APBMISC_AON_PMU_CTRL_TypeDef; //0x038 + + +//================================ +#define APBMISC_LDO_LP_SEL_RUN_POS 0 +#define APBMISC_AON_PWR_SEL_RUN_POS 1 +#define APBMISC_HSI_EN_RUN_POS 2 +#define APBMISC_FSH_PW_EN_RUN_POS 3 +#define APBMISC_LDO_LP_SEL_DP_POS 8 +#define APBMISC_AON_PWR_SEL_DP_POS 9 +#define APBMISC_OSC_EN_DP_POS 10 +#define APBMISC_HSI_EN_DP_POS 11 +#define APBMISC_FSH_PW_EN_DP_POS 12 +#define APBMISC_CLK_STB_TIME_LSB 16 +#define APBMISC_CLK_STB_TIME_WIDTH 6 +#define APBMISC_WKUP_ST_CLR_POS 22 +#define APBMISC_AON_PMU_INT_CLR_POS 23 +//================================ + +typedef union //0x03c +{ + struct + { + uint32_t CORELDO_TRIM_DP: 5; // bit[4:0] + uint32_t RSV_NOUSE1: 3; // bit[7:5] --- Ignore me + uint32_t CORELDO_TRIM_STEP: 5; // bit[12:8] + uint32_t RSV_NOUSE2: 3; // bit[15:13]-- Ignore me + uint32_t AONLDO_TRIM_OFF: 4; // bit[19:16] + uint32_t AONLDO_UD_STEP: 3; // bit[22:20]-- LDOBK TRIM + uint32_t RSV_END: 9; // bit[31:23] + }; + uint32_t Word; +} APBMISC_LDO_UD_CTRL_TypeDef; //0x03c + + +//================================ +#define APBMISC_CORELDO_TRIM_DP_LSB 0 +#define APBMISC_CORELDO_TRIM_DP_WIDTH 5 +#define APBMISC_CORELDO_TRIM_STEP_LSB 8 +#define APBMISC_CORELDO_TRIM_STEP_WIDTH 5 +#define APBMISC_AONLDO_TRIM_OFF_LSB 16 +#define APBMISC_AONLDO_TRIM_OFF_WIDTH 4 +#define APBMISC_AONLDO_UD_STEP_LSB 20 +#define APBMISC_AONLDO_UD_STEP_WIDTH 3 +//================================ + +typedef union //0x054 +{ + struct + { + uint32_t XOSC16M_CAP_TR: 6; // bit[5:0] + uint32_t XOSC16M_LP: 1; // bit6 + uint32_t EN_XO16MBUF: 1; // bit7 + uint32_t XOSC16M_BIAS_ADJ: 4; // bit[11:8] + uint32_t XOSC16M_SEL: 1; // bit12 + uint32_t RSV_NOUSE1: 1; // bit13 --- Ignore me + uint32_t LDO_XOSC_TR: 4; // bit[17:14] + uint32_t RSV_END: 14; // bit[31:18] + }; + uint32_t Word; +} APBMISC_XOSC16M_CTRL_TypeDef; //0x054 + + +//================================ +#define APBMISC_XOSC16M_CAP_TR_LSB 0 +#define APBMISC_XOSC16M_CAP_TR_WIDTH 6 +#define APBMISC_XOSC16M_LP_POS 6 +#define APBMISC_EN_XO16MBUF_POS 7 +#define APBMISC_XOSC16M_BIAS_ADJ_LSB 8 +#define APBMISC_XOSC16M_BIAS_ADJ_WIDTH 4 +#define APBMISC_XOSC16M_SEL_POS 12 +#define APBMISC_LDO_XOSC_TR_LSB 14 +#define APBMISC_LDO_XOSC_TR_WIDTH 4 +//================================ + +typedef union //0x058 +{ + struct + { + uint32_t BLE_WAKEUP_REQ: 1; // bit0 --- software wakeup the BB from BB in deepsleep + uint32_t RSV_NOUSE1: 7; // bit[7:1] --- Ignore me + uint32_t BLE_OSC_EN_ST: 1; // bit8 + uint32_t BLE_RADIO_EN_ST: 1; // bit9 + uint32_t BLE_SAMP_VALID: 1; // bit10 --- + // when is 1, ble_clkncnt_samp & ble_finecnt_samp can be read + // auto cleared by HW + uint32_t BLE_DP_VALID: 1; // bit11 --- + // when is 1, BB is deepsleep, and the remained sleep time is larger than ble_dp_twcore + // auto cleared when BB exit deepsleep + uint32_t RSV_END: 20; // bit[31:12] + }; + uint32_t Word; +} APBMISC_BLE_LP_CTRL_TypeDef; //0x058 + + +//================================ +#define APBMISC_BLE_WAKEUP_REQ_POS 0 +#define APBMISC_BLE_OSC_EN_ST_POS 8 +#define APBMISC_BLE_RADIO_EN_ST_POS 9 +#define APBMISC_BLE_SAMP_VALID_POS 10 +#define APBMISC_BLE_DP_VALID_POS 11 +//================================ + +typedef union //0x07c +{ + struct + { + uint32_t RSV_NOUSE1: 2; // bit[1:0] --- Ignore me + uint32_t DPLL2_EN: 1; // bit2 + uint32_t DPLL2_LOCK_BYPASS_EN: 1; // bit3 + uint32_t DPLL2_EN_CLK48M: 1; // bit4 + uint32_t RSV_END: 27; // bit[31:5] + }; + uint32_t Word; +} APBMISC_DPLL_CTRL_TypeDef; //0x07c + + +//================================ +#define APBMISC_DPLL2_EN_POS 2 +#define APBMISC_DPLL2_LOCK_BYPASS_EN_POS 3 +#define APBMISC_DPLL2_EN_CLK48M_POS 4 +//================================ + +typedef union //0x078 +{ + struct + { + uint32_t TESTA_CONN2XO_EN: 1; // bit0 + uint32_t LDO_BOD_TEST_EN: 1; // bit1 + uint32_t LDO_BOD_INT_EN: 1; // bit2 + uint32_t LDO_LVD_INT_EN: 1; // bit3 + uint32_t BK_VBK_TEST_EN: 1; // bit4 + uint32_t RSV_END: 27; // bit[31:5] + }; + uint32_t Word; +} APBMISC_ANAMISC_CTRL_TypeDef; //0x078 + + +//================================ +#define APBMISC_TESTA_CONN2XO_EN_POS 0 +#define APBMISC_LDO_BOD_TEST_EN_POS 1 +#define APBMISC_LDO_BOD_INT_EN_POS 2 +#define APBMISC_LDO_LVD_INT_EN_POS 3 +#define APBMISC_BK_VBK_TEST_EN_POS 4 +//================================ + +typedef union //0x084 +{ + struct + { + uint32_t RSV_NOUSE1: 1; // bit0 ---Ignore me + uint32_t DPLL2_LOCK_READY: 1; // bit1 + uint32_t LVD_MODE: 1; // bit2 --- + // 0: 1.8V IO voltage + // 1: 3.3V IO valtage + uint32_t RSV_END: 29; // bit[31:3] + }; + uint32_t Word; +} APBMISC_ANAMISC_ST_TypeDef; //0x07c + + +//================================ +#define APBMISC_DPLL2_LOCK_READY_POS 1 +#define APBMISC_LVD_MODE_POS 2 +//================================ + +//================================ +//BLOCK APBMISC top struct define +typedef struct +{ + __I APBMISC_RC32K_CALIB_ST_TypeDef RC32K_CALIB_ST ; // 0x000, + __IO APBMISC_RCCALIB_CTRL_TypeDef RCCALIB_CTRL ; // 0x004, + __O uint32_t RCCALIB_START ; // 0x008, + // RC32K calib follow + // 0: set AON.rc32k_trim_sel =1 + // 1: select calib ref clock: RCC.rccalib_clksel, enable calib clock : RCC.rccalib_clken=1 + // 2: config rccalib_target and rccalib_cycles, set rccalib_start as 1 + // 3: wait rccalib_done as 1 + // 4: set rccalib_done_clr as 1 to clear status + // 5: read rc32k_msb_calib and rc32k_lsb_calib + // 6: write AON.rc32k_msb_trim_cfg and AON.rc32k_lsb_trim_cfg + // 7: set AON.rc32k_trim_sel =0 + __O uint32_t RCFREQ_GET ; // 0x00c, + // 0: config rccalib_target and rccalib_cycles, set rcfreq_get as 1 + // 1: wait rcfreq_done as 1 + // 2: set rcfreq_done_clr as 1 to clear status + // 3: read rc_freq_val + __I uint32_t RC_FREQ_VAL ; // 0x010, + __IO APBMISC_RCCALIB_STCLR_TypeDef RCCALIB_STCLR ; // 0x014, + __IO APBMISC_RC16M_CNT_CTRL_TypeDef RC16M_CNT_CTRL ; // 0x018, + __IO APBMISC_RTCINT_CTRL_TypeDef RTCINT_CTRL ; // 0x01c, + __IO uint32_t RTC_SEC ; // 0x020, + // direct set current RTC value + __IO uint32_t RTC_MS ; // 0x024, + // direct set current RTC value + // note rtc_sec is must set before rtc_ms + __IO uint32_t RTC_ALARM_SEC ; // 0x028, + __IO uint32_t RTC_ALARM_MS ; // 0x02c, + __I uint32_t RTC_SEC_SHD ; // 0x030, + __I uint32_t RTC_MS_SHD ; // 0x034, + __IO APBMISC_AON_PMU_CTRL_TypeDef AON_PMU_CTRL ; // 0x038, + __IO APBMISC_LDO_UD_CTRL_TypeDef LDO_UD_CTRL ; // 0x03c, + __IO uint32_t PIOA_WKUP_POS ; // 0x040, + // enable the IO posedge wakeup the chip from deepsleep or poweroff + // IO0 ~ IO18 + __IO uint32_t PIOA_WKUP_NEG ; // 0x044, + // enable the IO negedge wakeup the chip from deepsleep or poweroff + // IO0 ~ IO19 + __O uint32_t POWEROFF_WORD_CMD ; // 0x048, + // software POWEROFF cmd + // when poweroff_word_cmd[31:0] is written as 32'h77ED_29B4, chip go to POWEROFF + __O uint32_t POWEROFF_LOG_CLR ; // 0x04c, + __IO uint32_t RC16M_FREQ_TRIM ; // 0x050, + // RC16M trim reg + __IO APBMISC_XOSC16M_CTRL_TypeDef XOSC16M_CTRL ; // 0x054, + __IO APBMISC_BLE_LP_CTRL_TypeDef BLE_LP_CTRL ; // 0x058, + __I uint32_t BLE_SYNC_TIME ; // 0x05c, + // the time from pos of sync_window to syncfound + // unit : 16M clock period + // ble_sync_time[19:4] is us + __IO uint32_t BLE_FINECNT_BOUND ; // 0x060, + // finecnt boundary + // set the half slot time : ( ble_finecnt_bound + 1 ) *0.5 us + // unit : 0.5us + // default is 312.5us ( BLE half slot time) + __I uint32_t BLE_CLKNCNT_SAMP ; // 0x064, + __I uint32_t BLE_FINECNT_SAMP ; // 0x068, + __O uint32_t BLE_CLKNCNT_CFG ; // 0x06c, + __O uint32_t BLE_FINECNT_CFG ; // 0x070, + __IO uint32_t BLE_DP_TWCORE ; // 0x074, + // the threhold for BB remained deepsleep time for Core go into Deepsleep + // unit: RC32K clock + // default is 5ms + __O uint32_t BLE_UPLOAD ; // 0x078, + // set as 1 when chip exit from poweroff and write back the BB reg + __IO APBMISC_DPLL_CTRL_TypeDef DPLL_CTRL ; // 0x07c, + __IO APBMISC_ANAMISC_CTRL_TypeDef ANAMISC_CTRL ; // 0x080, + __I APBMISC_ANAMISC_ST_TypeDef ANAMISC_ST ; // 0x084, +} APBMISC_TypeDef; + + +#define APBMISC (( APBMISC_TypeDef *) APBMISC_BASE) + +#endif diff --git a/core/reg/reg_base.h b/core/reg/reg_base.h new file mode 100644 index 0000000..1e2afae --- /dev/null +++ b/core/reg/reg_base.h @@ -0,0 +1,29 @@ +#ifndef REG_BASE_H_ +#define REG_BASE_H_ + +#include +#include +#include + +#define __I volatile const /* defines 'read only' permissions */ +#define __O volatile /* defines 'write only' permissions */ +#define __IO volatile /* defines 'read / write' permissions */ + +#define REG_RD(addr) (*(volatile uint32_t *)(addr)) +#define REG_WR(addr, value) (*(volatile uint32_t *)(addr)) = (value) + +/* + * This macro is for use by other macros to form a fully valid C statement. + * Without this, the if/else conditionals could show unexpected behavior. + * (The while condition below evaluates false without generating a + * constant-controlling-loop type of warning on most compilers.) + */ +#if !defined(dowl) + #define dowl(x) do { x } while(__LINE__ == -1) +#endif + +#if defined ( __CC_ARM ) +#pragma anon_unions +#endif + +#endif // REG_BASE_H_ diff --git a/core/reg/reg_btmr.h b/core/reg/reg_btmr.h new file mode 100644 index 0000000..3bfbfe5 --- /dev/null +++ b/core/reg/reg_btmr.h @@ -0,0 +1,105 @@ +#ifndef _REG_BTMR_H_ +#define _REG_BTMR_H_ + +#include "reg_base.h" + +//================================ +//BLOCK BTMR define + +#define BTMR_BASE ((uint32_t)0x40020000) +#define BTMR_CR1_ADDR_OFFSET 0x000 +#define BTMR_CR2_ADDR_OFFSET 0x004 +#define BTMR_IER_ADDR_OFFSET 0x00c +#define BTMR_IDR_ADDR_OFFSET 0x010 +#define BTMR_IVS_ADDR_OFFSET 0x014 +#define BTMR_RIF_ADDR_OFFSET 0x018 +#define BTMR_IFM_ADDR_OFFSET 0x01c +#define BTMR_ICR_ADDR_OFFSET 0x020 +#define BTMR_EGR_ADDR_OFFSET 0x024 +#define BTMR_CNT_ADDR_OFFSET 0x034 +#define BTMR_PSC_ADDR_OFFSET 0x038 +#define BTMR_ARR_ADDR_OFFSET 0x03c +#define BTMR_DMAEN_ADDR_OFFSET 0x058 + +//================================ +//BLOCK BTMR reg struct define +typedef union //0x000 +{ + struct + { + uint32_t CEN: 1; // bit0 --- counter enable + uint32_t UDIS: 1; // bit1 --- update disable + uint32_t URS: 1; // bit2 --- update request source + uint32_t OPM: 1; // bit3 --- one plus mode + uint32_t RSV_NOUSE1: 3; // bit[6:4]-Ignore me + uint32_t ARPE: 1; // bit7 --- auto reload preload enable + uint32_t RSV_END: 24; // bit[31:8] + }; + uint32_t Word; +} BTMR_CR1_TypeDef; //0x000 + + +//================================ +#define BTMR_CEN_POS 0 +#define BTMR_UDIS_POS 1 +#define BTMR_URS_POS 2 +#define BTMR_OPM_POS 3 +#define BTMR_ARPE_POS 7 +//================================ + +typedef union //0x004 +{ + struct + { + uint32_t RSV_NOUSE1: 4; // bit[3:0] --- Ignore me + uint32_t MMS: 3; // bit[6:4] --- master mode select= + uint32_t RSV_END: 25; // bit[31:7] + }; + uint32_t Word; +} BTMR_CR2_TypeDef; //0x004 + + +//================================ +#define BTMR_MMS_LSB 4 +#define BTMR_MMS_WIDTH 3 +//================================ + +//================================ +//BLOCK BTMR top struct define +typedef struct +{ + __IO BTMR_CR1_TypeDef CR1 ; // 0x000, + // control register 1 + __IO BTMR_CR2_TypeDef CR2 ; // 0x004, + // control register 2 + __I uint32_t RSV0[1] ; + __O uint32_t IER ; // 0x00c, + // interrupt enable register + __O uint32_t IDR ; // 0x010, + // interrupt disable register + __I uint32_t IVS ; // 0x014, + // interrupt vaild status register + __I uint32_t RIF ; // 0x018, + // interrupt raw flag register + __I uint32_t IFM ; // 0x01c, + // interrupt masked flag register + __O uint32_t ICR ; // 0x020, + // interrupt clear status register + __IO uint32_t EGR ; // 0x024, + // event generation register + __I uint32_t RSV1[3] ; + __IO uint32_t CNT ; // 0x034, + // timer counter + __IO uint32_t PSC ; // 0x038, + // prescaler + __IO uint32_t ARR ; // 0x03c, + // auto-reload register + __I uint32_t RSV2[6] ; + __IO uint32_t DMAEN ; // 0x058, + // dma trigger event enable +} BTMR_TypeDef; + + +#define BTMR (( BTMR_TypeDef *) BTMR_BASE) + +#endif diff --git a/core/reg/reg_cache.h b/core/reg/reg_cache.h new file mode 100644 index 0000000..712c2eb --- /dev/null +++ b/core/reg/reg_cache.h @@ -0,0 +1,198 @@ +#ifndef _REG_CACHE_H_ +#define _REG_CACHE_H_ + +#include "reg_base.h" + +//================================ +//BLOCK CACHE define + +#define CACHE_BASE ((uint32_t)0x19000000) +#define CACHE_CCR_ADDR_OFFSET 0x000 +#define CACHE_CCFR_ADDR_OFFSET 0x004 +#define CACHE_CIR_ADDR_OFFSET 0x008 +#define CACHE_CRCR0_ADDR_OFFSET 0x00c +#define CACHE_CRCR1_ADDR_OFFSET 0x010 +#define CACHE_CRCR2_ADDR_OFFSET 0x014 +#define CACHE_CRCR3_ADDR_OFFSET 0x018 + +//================================ +//BLOCK CACHE reg struct define +typedef union //0x000 +{ + struct + { + uint32_t CACHE_EN: 1; // bit0 --- + // 0: cache disable + // 1: cache enable + uint32_t RESERVED: 31; // bit[31:1] + }; + uint32_t Word; +} CACHE_CCR_TypeDef; //0x000 + + +//================================ +#define CACHE_CACHE_EN_POS 0 +#define CACHE_RESERVED_LSB 1 +#define CACHE_RESERVED_WIDTH 31 +//================================ + +typedef union //0x004 +{ + struct + { + uint32_t RSV_NOUSE1: 3; // bit[2:0] --- Ignore me + uint32_t CACHE_INST_DATA: 1; // bit3 the control bits of cached data type configuration + // 0: only instruction data can be cached + // 1: both instruction and common data can be cached + // note: it requires that arb_xx_hprot[0] indicate whether this access is instruction data + // request or common data request + uint32_t RSV_END: 28; // bit[31:4] + }; + uint32_t Word; +} CACHE_CCFR_TypeDef; //0x004 + + +//================================ +#define CACHE_CACHE_INST_DATA_POS 3 +//================================ + +typedef union //0x008 +{ + struct + { + uint32_t INV_ALL: 1; // bit0 --- The control bit of invalid all cache lines operation. Set this + // bit to start an invalid all cache lines operation, and the bit + // will be cleared when the operation is done. + uint32_t INV_ONE: 1; // bit1 --- The control bit of invalid one cache line operation. Set this + // bit to start an invalid one cache line operation, and the bit + // will be cleared when the operation is done. + uint32_t RSV_NOUSE1: 2; // bit[3:2] --- Ignore me + uint32_t INV_ADDR: 28; // bit[31:4]--- The high bits of cache line address of invalid one cache + // line operation. + }; + uint32_t Word; +} CACHE_CIR_TypeDef; //0x008 + + +//================================ +#define CACHE_INV_ALL_POS 0 +#define CACHE_INV_ONE_POS 1 +#define CACHE_INV_ADDR_LSB 4 +#define CACHE_INV_ADDR_WIDTH 28 +//================================ + +typedef union //0x00c +{ + struct + { + uint32_t CRCR0_EN: 1; // bit0 --- Cache region enable bit. Only enable bit is set that the + // cacheable region is valid. + uint32_t SIZE: 5; // bit[5:1] --- These control bits indicate the size of cacheable region. + // Detail is shown below table. + uint32_t RSV_NOUSE1: 4; // bit[9:6] --- Ignore me + uint32_t BASE_ADDR: 22; // bit[31:10]-- High 22 bits of base address of cacheable region. + }; + uint32_t Word; +} CACHE_CRCR0_TypeDef; //0x00c + + +//================================ +#define CACHE_CRCR0_EN_POS 0 +#define CACHE_SIZE_LSB 1 +#define CACHE_SIZE_WIDTH 5 +#define CACHE_BASE_ADDR_LSB 10 +#define CACHE_BASE_ADDR_WIDTH 22 +//================================ + +typedef union //0x010 +{ + struct + { + uint32_t CRCR1_EN: 1; // bit0 --- Cache region enable bit. Only enable bit is set that the + // cacheable region is valid. + uint32_t SIZE: 5; // bit[5:1] --- These control bits indicate the size of cacheable region. + // Detail is shown below table. + uint32_t RSV_NOUSE1: 4; // bit[9:6] --- Ignore me + uint32_t BASE_ADDR: 22; // bit[31:10]-- High 22 bits of base address of cacheable region. + }; + uint32_t Word; +} CACHE_CRCR1_TypeDef; //0x010 + + +//================================ +#define CACHE_CRCR1_EN_POS 0 +#define CACHE_SIZE_LSB 1 +#define CACHE_SIZE_WIDTH 5 +#define CACHE_BASE_ADDR_LSB 10 +#define CACHE_BASE_ADDR_WIDTH 22 +//================================ + +typedef union //0x014 +{ + struct + { + uint32_t CRCR2_EN: 1; // bit0 --- Cache region enable bit. Only enable bit is set that the + // cacheable region is valid. + uint32_t SIZE: 5; // bit[5:1] --- These control bits indicate the size of cacheable region. + // Detail is shown below table. + uint32_t RSV_NOUSE1: 4; // bit[9:6] --- Ignore me + uint32_t BASE_ADDR: 22; // bit[31:10]-- High 22 bits of base address of cacheable region. + }; + uint32_t Word; +} CACHE_CRCR2_TypeDef; //0x014 + + +//================================ +#define CACHE_CRCR2_EN_POS 0 +#define CACHE_SIZE_LSB 1 +#define CACHE_SIZE_WIDTH 5 +#define CACHE_BASE_ADDR_LSB 10 +#define CACHE_BASE_ADDR_WIDTH 22 +//================================ + +typedef union //0x018 +{ + struct + { + uint32_t CRCR3_EN: 1; // bit0 --- Cache region enable bit. Only enable bit is set that the + // cacheable region is valid. + uint32_t SIZE: 5; // bit[5:1] --- These control bits indicate the size of cacheable region. + // Detail is shown below table. + uint32_t RSV_NOUSE1: 4; // bit[9:6] --- Ignore me + uint32_t BASE_ADDR: 22; // bit[31:10]-- High 22 bits of base address of cacheable region. + }; + uint32_t Word; +} CACHE_CRCR3_TypeDef; //0x018 + + +//================================ +#define CACHE_CRCR3_EN_POS 0 +#define CACHE_SIZE_LSB 1 +#define CACHE_SIZE_WIDTH 5 +#define CACHE_BASE_ADDR_LSB 10 +#define CACHE_BASE_ADDR_WIDTH 22 +//================================ + +//================================ +//BLOCK CACHE top struct define +typedef struct +{ + __IO CACHE_CCR_TypeDef CCR ; // 0x000, + // This register is responsible for making cache enable or disable. + __IO CACHE_CCFR_TypeDef CCFR ; // 0x004, + // This register controls the software configuration of cache. Note: The cache should be disabled before + // changing the configuration, or fatal errors may occur. + __IO CACHE_CIR_TypeDef CIR ; // 0x008, + // This register controls the invalid operation for cache, including invalid one cache line and invalid all. + __IO CACHE_CRCR0_TypeDef CRCR0 ; // 0x00c, + // This register controls the cacheable region. Request address must locate in the cacheable region and this + // region is enabled, or read data will not be cached. + __IO CACHE_CRCR1_TypeDef CRCR1 ; // 0x010, + __IO CACHE_CRCR2_TypeDef CRCR2 ; // 0x014, + __IO CACHE_CRCR3_TypeDef CRCR3 ; // 0x018, +} CACHE_TypeDef; + + +#define CACHE (( CACHE_TypeDef *) CACHE_BASE) + +#endif diff --git a/core/reg/reg_csc.h b/core/reg/reg_csc.h new file mode 100644 index 0000000..ce49435 --- /dev/null +++ b/core/reg/reg_csc.h @@ -0,0 +1,273 @@ +#ifndef _REG_CSC_H_ +#define _REG_CSC_H_ + +#include "reg_base.h" + +//================================ +//BLOCK CSC define + + +#define CSC_BASE ((uint32_t)0x40002000) +#define CSC_OUT_CTRL0_ADDR_OFFSET 0x000 +#define CSC_OUT_CTRL1_ADDR_OFFSET 0x004 +#define CSC_OUT_CTRL2_ADDR_OFFSET 0x008 +#define CSC_OUT_CTRL3_ADDR_OFFSET 0x00c +#define CSC_OUT_CTRL4_ADDR_OFFSET 0x010 +#define CSC_OUT_CTRL5_ADDR_OFFSET 0x014 +#define CSC_OUT_CTRL6_ADDR_OFFSET 0x018 +#define CSC_OUT_CTRL7_ADDR_OFFSET 0x01c +#define CSC_OUT_CTRL8_ADDR_OFFSET 0x020 +#define CSC_OUT_CTRL9_ADDR_OFFSET 0x024 +#define CSC_OUT_CTRL10_ADDR_OFFSET 0x028 +#define CSC_OUT_CTRL11_ADDR_OFFSET 0x02c +#define CSC_OUT_CTRL12_ADDR_OFFSET 0x030 +#define CSC_OUT_CTRL13_ADDR_OFFSET 0x034 +#define CSC_OUT_CTRL14_ADDR_OFFSET 0x038 +#define CSC_OUT_CTRL15_ADDR_OFFSET 0x03c +#define CSC_OUT_CTRL16_ADDR_OFFSET 0x040 +#define CSC_OUT_CTRL17_ADDR_OFFSET 0x044 +#define CSC_OUT_CTRL18_ADDR_OFFSET 0x048 +#define CSC_OUT_CTRL19_ADDR_OFFSET 0x04c +#define CSC_IN_CTRL0_ADDR_OFFSET 0x080 +#define CSC_IN_CTRL1_ADDR_OFFSET 0x084 +#define CSC_IN_CTRL2_ADDR_OFFSET 0x088 +#define CSC_IN_CTRL3_ADDR_OFFSET 0x08c +#define CSC_IN_CTRL4_ADDR_OFFSET 0x090 +#define CSC_IN_CTRL5_ADDR_OFFSET 0x094 +#define CSC_IN_CTRL6_ADDR_OFFSET 0x098 +#define CSC_IN_CTRL7_ADDR_OFFSET 0x09c +#define CSC_IN_CTRL8_ADDR_OFFSET 0x0a0 +#define CSC_IN_CTRL9_ADDR_OFFSET 0x0a4 +#define CSC_IN_CTRL10_ADDR_OFFSET 0x0a8 +#define CSC_IN_CTRL11_ADDR_OFFSET 0x0ac +#define CSC_IN_CTRL12_ADDR_OFFSET 0x0b0 +#define CSC_IN_CTRL13_ADDR_OFFSET 0x0b4 +#define CSC_PIOA00_CTRL_ADDR_OFFSET 0x100 +#define CSC_PIOA01_CTRL_ADDR_OFFSET 0x104 +#define CSC_PIOA02_CTRL_ADDR_OFFSET 0x108 +#define CSC_PIOA03_CTRL_ADDR_OFFSET 0x10c +#define CSC_PIOA04_CTRL_ADDR_OFFSET 0x110 +#define CSC_PIOA05_CTRL_ADDR_OFFSET 0x114 +#define CSC_PIOA06_CTRL_ADDR_OFFSET 0x118 +#define CSC_PIOA07_CTRL_ADDR_OFFSET 0x11c +#define CSC_PIOA08_CTRL_ADDR_OFFSET 0x120 +#define CSC_PIOA09_CTRL_ADDR_OFFSET 0x124 +#define CSC_PIOA10_CTRL_ADDR_OFFSET 0x128 +#define CSC_PIOA11_CTRL_ADDR_OFFSET 0x12c +#define CSC_PIOA12_CTRL_ADDR_OFFSET 0x130 +#define CSC_PIOA13_CTRL_ADDR_OFFSET 0x134 +#define CSC_PIOA14_CTRL_ADDR_OFFSET 0x138 +#define CSC_PIOA15_CTRL_ADDR_OFFSET 0x13c +#define CSC_PIOA16_CTRL_ADDR_OFFSET 0x140 +#define CSC_PIOA17_CTRL_ADDR_OFFSET 0x144 +#define CSC_PIOA18_CTRL_ADDR_OFFSET 0x148 +#define CSC_PIOA19_CTRL_ADDR_OFFSET 0x14c +#define CSC_FSH_IO_CTRL_RUN_ADDR_OFFSET 0x180 +#define CSC_FSH_IO_CTRL_DP_ADDR_OFFSET 0x184 + + +typedef union +{ + struct + { + uint32_t FSEL: 3; // bit[2:0] --- function select + uint32_t RSV_NOUSE1: 2; // bit[4:3] --- Ignore me + uint32_t DS: 1; // bit5 --- drive strength mode + uint32_t PUPDCTRL: 2; // bit[7:6] --- pull up/down + uint32_t IE: 1; // bit8 --- input enable + uint32_t CE: 1; // bit9 --- 1ma current spurce enable + uint32_t AE: 1; // bit10 --- analog enable + uint32_t ODE: 1; // bit11 --- open drain enable + uint32_t RSV_END: 20; // bit[31:12] + }; + uint32_t Word; +} CSC_IO_CTRL_TypeDef; + +//================================ +#define CSC_IO_FSEL_LSB 0 +#define CSC_IO_FSEL_WIDTH 3 +#define CSC_IO_DS_POS 5 +#define CSC_IO_PUPDCTRL_LSB 6 +#define CSC_IO_PUPDCTRL_WIDTH 2 +#define CSC_IO_IE_POS 8 +#define CSC_IO_CE_POS 9 +#define CSC_IO_AE_POS 10 +#define CSC_IO_ODE_POS 11 +//================================ +// +typedef union //0x000 +{ + struct + { + uint32_t CSC_FSEL: 5; // bit[4:0] --- pad output function select + // padio0 sel pad port, for example:pioa00,pioa01... + uint32_t RSV_NOUSE1: 2; // bit[6:5] --- Ignore me + uint32_t CSC_FEN: 1; // bit7 --- csc peripheral function enable + uint32_t RSV_END: 24; // bit[31:8] + }; + uint32_t Word; +} CSC_OUTPUT_CTRL_TypeDef; + +//================================ +#define CSC_FOUT_SEL_LSB 0 +#define CSC_FOUT_SEL_WIDTH 5 +#define CSC_FOUT_EN_POS 7 +//================================ + +typedef union //0x000 +{ + struct + { + uint32_t CSC_FSEL: 5; // bit[4:0] --- pad input function select + // padio0 sel pad port, for example:pioa00,pioa01... + uint32_t RSV_NOUSE1: 2; // bit[6:5] --- Ignore me + uint32_t CSC_FEN: 1; // bit7 --- csc peripheral function enable + uint32_t RSV_END: 24; // bit[31:8] + }; + uint32_t Word; +} CSC_INPUT_CTRL_TypeDef; + +//================================ +#define CSC_FIN_SEL_LSB 0 +#define CSC_FIN_SEL_WIDTH 5 +#define CSC_FIN_EN_POS 7 +//================================ + +typedef union //0x180 +{ + struct + { + uint32_t QSCK_OE_EN_RUN: 1; // bit0 + uint32_t QSCK_PUPDCTRL_RUN: 2; // bit[2:1] + uint32_t QSCK_IE_RUN: 1; // bit3 + uint32_t QCSN_OE_EN_RUN: 1; // bit4 + uint32_t QCSN_PUPDCTRL_RUN: 2; // bit[6:5] + uint32_t QCSN_IE_RUN: 1; // bit7 + uint32_t QIO0_OE_EN_RUN: 1; // bit8 + uint32_t QIO0_PUPDCTRL_RUN: 2; // bit[10:9] + uint32_t QIO0_IE_RUN: 1; // bit11 + uint32_t QIO1_OE_EN_RUN: 1; // bit12 + uint32_t QIO1_PUPDCTRL_RUN: 2; // bit[14:13] + uint32_t QIO1_IE_RUN: 1; // bit15 + uint32_t QIO2_OE_EN_RUN: 1; // bit16 + uint32_t QIO2_PUPDCTRL_RUN: 2; // bit[18:17] + uint32_t QIO2_IE_RUN: 1; // bit19 + uint32_t QIO3_OE_EN_RUN: 1; // bit20 + uint32_t QIO3_PUPDCTRL_RUN: 2; // bit[22:21] + uint32_t QIO3_IE_RUN: 1; // bit23 + uint32_t QSCK_DS_RUN: 1; // bit24 + uint32_t QCSN_DS_RUN: 1; // bit25 + uint32_t QIO0_DS_RUN: 1; // bit26 + uint32_t QIO1_DS_RUN: 1; // bit27 + uint32_t QIO2_DS_RUN: 1; // bit28 + uint32_t QIO3_DS_RUN: 1; // bit29 + uint32_t RSV_END: 2; // bit[31:30] + }; + uint32_t Word; +} CSC_FSH_PAD_RUN_CTRL_TypeDef; //0x180 + +//================================ +#define CSC_QSCK_OE_EN_RUN_POS 0 +#define CSC_QSCK_PUPDCTRL_RUN_LSB 1 +#define CSC_QSCK_PUPDCTRL_RUN_WIDTH 2 +#define CSC_QSCK_IE_RUN_POS 3 +#define CSC_QCSN_OE_EN_RUN_POS 4 +#define CSC_QCSN_PUPDCTRL_RUN_LSB 5 +#define CSC_QCSN_PUPDCTRL_RUN_WIDTH 2 +#define CSC_QCSN_IE_RUN_POS 7 +#define CSC_QIO0_OE_EN_RUN_POS 8 +#define CSC_QIO0_PUPDCTRL_RUN_LSB 9 +#define CSC_QIO0_PUPDCTRL_RUN_WIDTH 2 +#define CSC_QIO0_IE_RUN_POS 11 +#define CSC_QIO1_OE_EN_RUN_POS 12 +#define CSC_QIO1_PUPDCTRL_RUN_LSB 13 +#define CSC_QIO1_PUPDCTRL_RUN_WIDTH 2 +#define CSC_QIO1_IE_RUN_POS 15 +#define CSC_QIO2_OE_EN_RUN_POS 16 +#define CSC_QIO2_PUPDCTRL_RUN_LSB 17 +#define CSC_QIO2_PUPDCTRL_RUN_WIDTH 2 +#define CSC_QIO2_IE_RUN_POS 19 +#define CSC_QIO3_OE_EN_RUN_POS 20 +#define CSC_QIO3_PUPDCTRL_RUN_LSB 21 +#define CSC_QIO3_PUPDCTRL_RUN_WIDTH 2 +#define CSC_QIO3_IE_RUN_POS 23 +#define CSC_QSCK_DS_RUN_POS 24 +#define CSC_QCSN_DS_RUN_POS 25 +#define CSC_QIO0_DS_RUN_POS 26 +#define CSC_QIO1_DS_RUN_POS 27 +#define CSC_QIO2_DS_RUN_POS 28 +#define CSC_QIO3_DS_RUN_POS 29 +//================================ + +typedef union //0x184 +{ + struct + { + uint32_t QSCK_OE_EN_DP: 1; // bit0 + uint32_t QSCK_PUPDCTRL_DP: 2; // bit[2:1] + uint32_t QSCK_IE_DP: 1; // bit3 + uint32_t QCSN_OE_EN_DP: 1; // bit4 + uint32_t QCSN_PUPDCTRL_DP: 2; // bit[6:5] + uint32_t QCSN_IE_DP: 1; // bit7 + uint32_t QIO0_OE_EN_DP: 1; // bit8 + uint32_t QIO0_PUPDCTRL_DP: 2; // bit[10:9] + uint32_t QIO0_IE_DP: 1; // bit11 + uint32_t QIO1_OE_EN_DP: 1; // bit12 + uint32_t QIO1_PUPDCTRL_DP: 2; // bit[14:13] + uint32_t QIO1_IE_DP: 1; // bit15 + uint32_t QIO2_OE_EN_DP: 1; // bit16 + uint32_t QIO2_PUPDCTRL_DP: 2; // bit[18:17] + uint32_t QIO2_IE_DP: 1; // bit19 + uint32_t QIO3_OE_EN_DP: 1; // bit20 + uint32_t QIO3_PUPDCTRL_DP: 2; // bit[22:21] + uint32_t QIO3_IE_DP: 1; // bit23 + uint32_t RSV_END: 8; // bit[31:24] + }; + uint32_t Word; +} CSC_FSH_PAD_DP_CTRL_TypeDef; //0x184 + +//================================ +#define CSC_QSCK_OE_EN_DP_POS 0 +#define CSC_QSCK_PUPDCTRL_DP_LSB 1 +#define CSC_QSCK_PUPDCTRL_DP_WIDTH 2 +#define CSC_QSCK_IE_DP_POS 3 +#define CSC_QCSN_OE_EN_DP_POS 4 +#define CSC_QCSN_PUPDCTRL_DP_LSB 5 +#define CSC_QCSN_PUPDCTRL_DP_WIDTH 2 +#define CSC_QCSN_IE_DP_POS 7 +#define CSC_QIO0_OE_EN_DP_POS 8 +#define CSC_QIO0_PUPDCTRL_DP_LSB 9 +#define CSC_QIO0_PUPDCTRL_DP_WIDTH 2 +#define CSC_QIO0_IE_DP_POS 11 +#define CSC_QIO1_OE_EN_DP_POS 12 +#define CSC_QIO1_PUPDCTRL_DP_LSB 13 +#define CSC_QIO1_PUPDCTRL_DP_WIDTH 2 +#define CSC_QIO1_IE_DP_POS 15 +#define CSC_QIO2_OE_EN_DP_POS 16 +#define CSC_QIO2_PUPDCTRL_DP_LSB 17 +#define CSC_QIO2_PUPDCTRL_DP_WIDTH 2 +#define CSC_QIO2_IE_DP_POS 19 +#define CSC_QIO3_OE_EN_DP_POS 20 +#define CSC_QIO3_PUPDCTRL_DP_LSB 21 +#define CSC_QIO3_PUPDCTRL_DP_WIDTH 2 +#define CSC_QIO3_IE_DP_POS 23 +//================================ + +//================================ +//BLOCK CSC top struct define +typedef struct +{ + __IO CSC_OUTPUT_CTRL_TypeDef CSC_OUTPUT[20] ; // 0x000 ~ 0x04C, + __I uint32_t RSV0[12] ; // 0x050 ~ 0x07C, + __IO CSC_INPUT_CTRL_TypeDef CSC_INPUT[14] ; // 0x080 ~ 0x0B4, + __I uint32_t RSV1[18] ; // 0x0B8 ~ 0x0FC, + __IO CSC_IO_CTRL_TypeDef CSC_PIO[20] ; // 0x100 ~ 0x14C, + __I uint32_t RSV2[12] ; // 0x150 ~ 0x17C + __IO CSC_FSH_PAD_RUN_CTRL_TypeDef FSH_PAD_RUN_CTRL ; // 0x180, + __IO CSC_FSH_PAD_DP_CTRL_TypeDef FSH_PAD_DP_CTRL ; // 0x184, +} CSC_TypeDef; + + +#define CSC (( CSC_TypeDef *) CSC_BASE) + +#endif diff --git a/core/reg/reg_dma.h b/core/reg/reg_dma.h new file mode 100644 index 0000000..5a21c68 --- /dev/null +++ b/core/reg/reg_dma.h @@ -0,0 +1,166 @@ +#ifndef _REG_DMA_H_ +#define _REG_DMA_H_ + +#include "reg_base.h" + +//================================ +//BLOCK DMA define + +#define DMA_BASE ((uint32_t)0x40026000) +#define DMA_STATUS_ADDR_OFFSET 0x000 +#define DMA_CFG_ADDR_OFFSET 0x004 +#define DMA_CTRLBASE_POINTER_ADDR_OFFSET 0x008 +#define DMA_ALTCTRLBASE_POINTER_ADDR_OFFSET 0x00c +#define DMA_WAIT_REQ_STA_ADDR_OFFSET 0x010 +#define DMA_SOFT_REQ_ADDR_OFFSET 0x014 +#define DMA_USEBURST_SET_ADDR_OFFSET 0x018 +#define DMA_USEBURST_CLR_ADDR_OFFSET 0x01c +#define DMA_REQMSK_SET_ADDR_OFFSET 0x020 +#define DMA_REQMSK_CLR_ADDR_OFFSET 0x024 +#define DMA_CHNL_EN_SET_ADDR_OFFSET 0x028 +#define DMA_CHNL_EN_CLR_ADDR_OFFSET 0x02c +#define DMA_PRIALT_SET_ADDR_OFFSET 0x030 +#define DMA_PRIALT_CLR_ADDR_OFFSET 0x034 +#define DMA_PRIORITY_SET_ADDR_OFFSET 0x038 +#define DMA_PRIORITY_CLR_ADDR_OFFSET 0x03c +#define DMA_ERR_CLR_ADDR_OFFSET 0x04c +#define DMA_INTEGR_CFG_ADDR_OFFSET 0xe00 +#define DMA_STALL_STA_ADDR_OFFSET 0xe08 +#define DMA_REQ_STA_ADDR_OFFSET 0xe10 +#define DMA_SREQ_STA_ADDR_OFFSET 0xe18 +#define DMA_DONE_SET_ADDR_OFFSET 0xe20 +#define DMA_DONE_CLR_ADDR_OFFSET 0xe24 +#define DMA_ACTIVE_SET_ADDR_OFFSET 0xe28 +#define DMA_ACTIVE_CLR_ADDR_OFFSET 0xe2c +#define DMA_ERR_SET_ADDR_OFFSET 0xe48 + +//================================ +//BLOCK DMA reg struct define +typedef union //0x000 +{ + struct + { + uint32_t EN: 1; // bit0 --- + // 0: controller is disabled + // 1: controller is enabled + uint32_t RSV_NOUSE1: 3; // bit[3:1] --- Ignore me + uint32_t STATE: 4; // bit[7:4] --- current state of the control state machine + uint32_t RSV_NOUSE2: 8; // bit[15:8]--- Ignore me + uint32_t CHNLS_MINUS1: 5; // bit[20:16]-- number of availiable dma channels minus one + // for example 00000 = controller configured to use 1 dma channel + uint32_t RSV_NOUSE3: 7; // bit[27:21]-- Ignore me + uint32_t TEST_STATUS: 4; // bit[31:28]-- + // 0: controller does not include the integration test logic + // 1: controller include the integration test logic + // 2-0xf = undefined + }; + uint32_t Word; +} DMA_STATUS_TypeDef; //0x000 + + +//================================ +#define DMA_EN_POS 0 +#define DMA_STATE_LSB 4 +#define DMA_STATE_WIDTH 4 +#define DMA_CHNLS_MINUS1_LSB 16 +#define DMA_CHNLS_MINUS1_WIDTH 5 +#define DMA_TEST_STATUS_LSB 28 +#define DMA_TEST_STATUS_WIDTH 4 +//================================ + +typedef union //0x004 +{ + struct + { + uint32_t EN: 1; // bit0 --- enble the controller + uint32_t RSV_NOUSE1: 4; // bit[4:1] --- Ignore me + uint32_t CHNL_PROT_CTRL: 3; // bit[7:5] --- [5]cacheable, [6]bufferable, [7]priviledged + uint32_t RSV_END: 24; // bit[31:8] + }; + uint32_t Word; +} DMA_CFG_TypeDef; //0x004 + + +//================================ +#define DMA_EN_POS 0 +#define DMA_CHNL_PROT_CTRL_LSB 5 +#define DMA_CHNL_PROT_CTRL_WIDTH 3 +//================================ + +typedef union //0x008 +{ + struct + { + uint32_t RSV_NOUSE1: 8; // bit[7:0] --- Ignore me + uint32_t CTRL_BASE_PTR: 24; // bit[31:8]--- pointer to the base address of the primary data structure + }; + uint32_t Word; +} DMA_CTRLBASE_POINTER_TypeDef; //0x008 + + +//================================ +#define DMA_CTRL_BASE_PTR_LSB 8 +#define DMA_CTRL_BASE_PTR_WIDTH 24 +//================================ + +//================================ +//BLOCK DMA top struct define +typedef struct +{ + __I DMA_STATUS_TypeDef STATUS ; // 0x000, + __O DMA_CFG_TypeDef CFG ; // 0x004, + __IO DMA_CTRLBASE_POINTER_TypeDef CTRLBASE_POINTER ; // 0x008, + __I uint32_t ALTCTRLBASE_POINTER ; // 0x00c, + __I uint32_t WAIT_REQ_STA ; // 0x010, + // channel 0 wait on request status + __O uint32_t SOFT_REQ ; // 0x014, + // channel 0 generate a software dma request + __IO uint32_t USEBURST_SET ; // 0x018, + // disable dma_sreq[0] generating dma requests + __IO uint32_t USEBURST_CLR ; // 0x01c, + // enable dma_sreq[0] dma requests + __IO uint32_t REQMSK_SET ; // 0x020, + // disable channel[0] generating dma requests + __IO uint32_t REQMSK_CLR ; // 0x024, + // enable channel[0] generating dma requests + __IO uint32_t CHNL_EN_SET ; // 0x028, + // enable channel[0] + __IO uint32_t CHNL_EN_CLR ; // 0x02c, + // disable channel[0] + __IO uint32_t PRIALT_SET ; // 0x030, + // config channel[] to use the alternate data structure + __IO uint32_t PRIALT_CLR ; // 0x034, + // config channel[0] to use the primary data structure + __IO uint32_t PRIORITY_SET ; // 0x038, + // config channel[0] priority + __IO uint32_t PRIORITY_CLR ; // 0x03c, + // clr channel[0] priority + __I uint32_t RSV0[3] ; + __IO uint32_t ERR_CLR ; // 0x04c, + __I uint32_t RSV1[876] ; + __IO uint32_t INTEGR_CFG ; // 0xe00, + __I uint32_t RSV2[1] ; + __I uint32_t STALL_STA ; // 0xe08, + __I uint32_t RSV3[1] ; + __I uint32_t REQ_STA ; // 0xe10, + // return status of dma_req[0] + __I uint32_t RSV4[1] ; + __I uint32_t SREQ_STA ; // 0xe18, + // return status of dma_sreq[0] + __I uint32_t RSV5[1] ; + __IO uint32_t DONE_SET ; // 0xe20, + // enable to assert dma_done[0] signals + __O uint32_t DONE_CLR ; // 0xe24, + // enable to deassert dma_done[0] signals + __IO uint32_t ACTIVE_SET ; // 0xe28, + // enable to assert dma_active[0] signals + __O uint32_t ACTIVE_CLR ; // 0xe2c, + // enable to desassert dma_active[0] signals + __I uint32_t RSV6[6] ; + __IO uint32_t ERR_SET ; // 0xe48, +} DMA_TypeDef; + + +#define DMA (( DMA_TypeDef *) DMA_BASE) + +#endif diff --git a/core/reg/reg_dmachcfg.h b/core/reg/reg_dmachcfg.h new file mode 100644 index 0000000..831b2aa --- /dev/null +++ b/core/reg/reg_dmachcfg.h @@ -0,0 +1,117 @@ +#ifndef _REG_DMACHCFG_H_ +#define _REG_DMACHCFG_H_ + +#include "reg_base.h" + +//================================ +//BLOCK DMACHCFG define + +#define DMACHCFG_BASE ((uint32_t)0x40027000) +#define DMACHCFG_IFLAG0_ADDR_OFFSET 0x000 +#define DMACHCFG_IFLAG1_ADDR_OFFSET 0x004 +#define DMACHCFG_ISFR0_ADDR_OFFSET 0x008 +#define DMACHCFG_ISFR1_ADDR_OFFSET 0x00c +#define DMACHCFG_ICFR0_ADDR_OFFSET 0x010 +#define DMACHCFG_ICFR1_ADDR_OFFSET 0x014 +#define DMACHCFG_IEFR0_ADDR_OFFSET 0x018 +#define DMACHCFG_IEFR1_ADDR_OFFSET 0x01c +#define DMACHCFG_CHSEL0_CONTAIN_ADDR_OFFSET 0x100 +#define DMACHCFG_CHSEL1_CONTAIN_ADDR_OFFSET 0x104 + +//================================ +//BLOCK DMACHCFG reg struct define +typedef union //0x100 +{ + struct + { + uint32_t CH0_SEL: 6; // bit[5:0] + uint32_t RSV_NOUSE1: 2; // bit[7:6] --- Ignore me + uint32_t CH1_SEL: 6; // bit[13:8] + uint32_t RSV_NOUSE2: 2; // bit[15:14]-- Ignore me + uint32_t CH2_SEL: 6; // bit[21:16] + uint32_t RSV_NOUSE3: 2; // bit[23:22]-- Ignore me + uint32_t CH3_SEL: 6; // bit[29:24] + uint32_t RSV_END: 2; // bit[31:30] + }; + uint32_t Word; +} DMACHCFG_CHSEL0_CONTAIN_TypeDef; //0x100 + + +//================================ +#define DMACHCFG_CH0_SEL_LSB 0 +#define DMACHCFG_CH0_SEL_WIDTH 6 +#define DMACHCFG_CH1_SEL_LSB 8 +#define DMACHCFG_CH1_SEL_WIDTH 6 +#define DMACHCFG_CH2_SEL_LSB 16 +#define DMACHCFG_CH2_SEL_WIDTH 6 +#define DMACHCFG_CH3_SEL_LSB 24 +#define DMACHCFG_CH3_SEL_WIDTH 6 +//================================ + +typedef union //0x104 +{ + struct + { + uint32_t CH4_SEL: 6; // bit[5:0] + uint32_t RSV_NOUSE1: 2; // bit[7:6] --- Ignore me + uint32_t CH5_SEL: 6; // bit[13:8] + uint32_t RSV_NOUSE2: 2; // bit[15:14]-- Ignore me + uint32_t CH6_SEL: 6; // bit[21:16] + uint32_t RSV_NOUSE3: 2; // bit[23:22]-- Ignore me + uint32_t CH7_SEL: 6; // bit[29:24] + uint32_t RSV_END: 2; // bit[31:30] + }; + uint32_t Word; +} DMACHCFG_CHSEL1_CONTAIN_TypeDef; //0x104 + + +//================================ +#define DMACHCFG_CH4_SEL_LSB 0 +#define DMACHCFG_CH4_SEL_WIDTH 6 +#define DMACHCFG_CH5_SEL_LSB 8 +#define DMACHCFG_CH5_SEL_WIDTH 6 +#define DMACHCFG_CH6_SEL_LSB 16 +#define DMACHCFG_CH6_SEL_WIDTH 6 +#define DMACHCFG_CH7_SEL_LSB 24 +#define DMACHCFG_CH7_SEL_WIDTH 6 +//================================ + +//================================ +//BLOCK DMACHCFG top struct define +typedef struct +{ + __I uint32_t IFLAG0 ; // 0x000, + // dma interupt flag + __I uint32_t IFLAG1 ; // 0x004, + // dma err flag + __IO uint32_t ISFR0 ; // 0x008, + // no use + __IO uint32_t ISFR1 ; // 0x00c, + // no use + __O uint32_t ICFR0 ; // 0x010, + // clear dma channel interupt + __O uint32_t ICFR1 ; // 0x014, + // clear dma interupt error flag + __IO uint32_t IEFR0 ; // 0x018, + // enable dma channel[x] interupt + __IO uint32_t IEFR1 ; // 0x01c, + // enable dma error interrupt + __I uint32_t RSV0[56] ; + + union + { + __IO uint32_t CHSEL[2]; + struct + { + __IO DMACHCFG_CHSEL0_CONTAIN_TypeDef CHSEL0_CONTAIN ; // 0x100, + // include channel(0~3) + __IO DMACHCFG_CHSEL1_CONTAIN_TypeDef CHSEL1_CONTAIN ; // 0x104, + // include channel(4~7) + }; + }; +} DMACHCFG_TypeDef; + + +#define DMACHCFG (( DMACHCFG_TypeDef *) DMACHCFG_BASE) + +#endif diff --git a/core/reg/reg_exti.h b/core/reg/reg_exti.h new file mode 100644 index 0000000..9af35ea --- /dev/null +++ b/core/reg/reg_exti.h @@ -0,0 +1,131 @@ +#ifndef _REG_EXTI_H_ +#define _REG_EXTI_H_ + +#include "reg_base.h" + +//================================ +//BLOCK EXTI define + +#define EXTI_BASE ((uint32_t)0x40028000) +#define EXTI_IER_ADDR_OFFSET 0x000 +#define EXTI_IDR_ADDR_OFFSET 0x004 +#define EXTI_IVS_ADDR_OFFSET 0x008 +#define EXTI_RIF_ADDR_OFFSET 0x00c +#define EXTI_IFM_ADDR_OFFSET 0x010 +#define EXTI_ICR_ADDR_OFFSET 0x014 +#define EXTI_RTS_ADDR_OFFSET 0x018 +#define EXTI_FTS_ADDR_OFFSET 0x01c +#define EXTI_SWI_ADDR_OFFSET 0x020 +#define EXTI_ADTE_ADDR_OFFSET 0x024 +#define EXTI_DB_ADDR_OFFSET 0x028 +#define EXTI_DBC_ADDR_OFFSET 0x02c + +//================================ +//BLOCK EXTI reg struct define +typedef union //0x000 +{ + struct + { + uint32_t EXTI_SRC0: 1; // bit0 + uint32_t EXTI_SRC1: 1; // bit1 + uint32_t EXTI_SRC2: 1; // bit2 + uint32_t EXTI_SRC3: 1; // bit3 + uint32_t EXTI_SRC4: 1; // bit4 + uint32_t EXTI_SRC5: 1; // bit5 + uint32_t EXTI_SRC6: 1; // bit6 + uint32_t EXTI_SRC7: 1; // bit7 + uint32_t EXTI_SRC8: 1; // bit8 + uint32_t EXTI_SRC9: 1; // bit9 + uint32_t EXTI_SRC10: 1; // bit10 + uint32_t EXTI_SRC11: 1; // bit11 + uint32_t EXTI_SRC12: 1; // bit12 + uint32_t EXTI_SRC13: 1; // bit13 + uint32_t EXTI_SRC14: 1; // bit14 + uint32_t EXTI_SRC15: 1; // bit15 + uint32_t EXTI_SRC16: 1; // bit16 + uint32_t EXTI_SRC17: 1; // bit17 + uint32_t EXTI_SRC18: 1; // bit18 + uint32_t EXTI_SRC19: 1; // bit19 + uint32_t RSV_END: 12; // bit[31:20] + }; + uint32_t Word; +} EXTI_LOCA_TypeDef; //0x000 + +//================================ +#define EXTI_LOCAL_SRC0_POS 0 +#define EXTI_LOCAL_SRC1_POS 1 +#define EXTI_LOCAL_SRC2_POS 2 +#define EXTI_LOCAL_SRC3_POS 3 +#define EXTI_LOCAL_SRC4_POS 4 +#define EXTI_LOCAL_SRC5_POS 5 +#define EXTI_LOCAL_SRC6_POS 6 +#define EXTI_LOCAL_SRC7_POS 7 +#define EXTI_LOCAL_SRC8_POS 8 +#define EXTI_LOCAL_SRC9_POS 9 +#define EXTI_LOCAL_SRC10_POS 10 +#define EXTI_LOCAL_SRC11_POS 11 +#define EXTI_LOCAL_SRC12_POS 12 +#define EXTI_LOCAL_SRC13_POS 13 +#define EXTI_LOCAL_SRC14_POS 14 +#define EXTI_LOCAL_SRC15_POS 15 +#define EXTI_LOCAL_SRC16_POS 16 +#define EXTI_LOCAL_SRC17_POS 17 +#define EXTI_LOCAL_SRC18_POS 18 +#define EXTI_LOCAL_SRC19_POS 19 +//================================ + +typedef union //0x02c +{ + struct + { + uint32_t DB_CNT: 3; // bit[2:0] --- debounce cnts, db_cnt = db_cnt_val + 1 + uint32_t RSV_NOUSE1: 5; // bit[7:3] --- Ignore me + uint32_t DB_PRE: 8; // bit[15:8]--- debounce one cnt include current clk cycles, db_pre = db_pre_val + 1 + uint32_t RSV_END: 16; // bit[31:16] + }; + uint32_t Word; +} EXTI_DBC_TypeDef; //0x02c + + + +//================================ +#define EXTI_DB_CNT_LSB 0 +#define EXTI_DB_CNT_WIDTH 3 +#define EXTI_DB_PRE_LSB 8 +#define EXTI_DB_PRE_WIDTH 8 +//================================ + +//================================ +//BLOCK EXTI top struct define +typedef struct +{ + __O EXTI_LOCA_TypeDef IER; // 0x000, + // exti interrupt enable register + __O EXTI_LOCA_TypeDef IDR; // 0x004, + // exti interrupt disable register + __I EXTI_LOCA_TypeDef IVS; // 0x008, + // exti interrupt valid status register + __I EXTI_LOCA_TypeDef RIF; // 0x00c, + // exti raw interrupt flag status register + __I EXTI_LOCA_TypeDef IFM; // 0x010, + // exti interrupt flag masked status register + __O EXTI_LOCA_TypeDef ICR; // 0x014, + // exti interrupt clear register + __IO EXTI_LOCA_TypeDef RTS; // 0x018, + // exti rising edge trigger selection register + __IO EXTI_LOCA_TypeDef FTS; // 0x01c, + // exti falling edge trigger selection register + __IO EXTI_LOCA_TypeDef SWI; // 0x020, + // exti software interrupt event register + __IO EXTI_LOCA_TypeDef ADTE; // 0x024, + // exti ad trigger enable + __IO EXTI_LOCA_TypeDef DB; // 0x028, + // exti input debounce enable register + __IO EXTI_DBC_TypeDef DBC; // 0x02c, + // exti input debounce sample rate control register +} EXTI_TypeDef; + + +#define EXTI (( EXTI_TypeDef *) EXTI_BASE) + +#endif diff --git a/core/reg/reg_fshc.h b/core/reg/reg_fshc.h new file mode 100644 index 0000000..134fbde --- /dev/null +++ b/core/reg/reg_fshc.h @@ -0,0 +1,398 @@ +#ifndef _REG_FSHC_H_ +#define _REG_FSHC_H_ + +#include "reg_base.h" + +//================================ +//BLOCK FSHC define + +#define FSHC_BASE ((uint32_t)0x40006000) +#define FSHC_SPDR_RD_ADDR_OFFSET 0x000 +#define FSHC_SPDR_WR_ADDR_OFFSET 0x004 +#define FSHC_SPCR_ADDR_OFFSET 0x008 +#define FSHC_RXTX_DAT_LEN_ADDR_OFFSET 0x00c +#define FSHC_CMD_REG_ADDR_OFFSET 0x010 +#define FSHC_ADDR_REG_ADDR_OFFSET 0x014 +#define FSHC_MCU_ADRCMD_BIT_LEN_ADDR_OFFSET 0x018 +#define FSHC_SEND_CTRL_ADDR_OFFSET 0x01c +#define FSHC_SEND_EN_ADDR_OFFSET 0x020 +#define FSHC_FIFO_STATUS_ADDR_OFFSET 0x024 +#define FSHC_RXPTR_INC_EN_ADDR_OFFSET 0x028 +#define FSHC_ST_ADDR_OFFSET 0x02c +#define FSHC_CACHE_CMD1_ADDR_OFFSET 0x030 +#define FSHC_CACHE_CMD2_ADDR_OFFSET 0x034 +#define FSHC_CACHE_DELAY_SET_ADDR_OFFSET 0x038 +#define FSHC_CACHE_RESUME_DELAY_MAX_ADDR_OFFSET 0x03c +#define FSHC_DELAY_SET_ADDR_OFFSET 0x040 +#define FSHC_BYPASS_HPM_ADDR_OFFSET 0x044 +#define FSHC_ATOM_OP_EN_ADDR_OFFSET 0x048 +#define FSHC_CLR_HPM_ADDR_OFFSET 0x04c +#define FSHC_CONTINUE_RD_MOD_INDEX_ADDR_OFFSET 0x050 +#define FSHC_CONTINUE_STATUS_ADDR_OFFSET 0x054 +#define FSHC_DLY_CFG_ADDR_OFFSET 0x058 +#define FSHC_CACHE_ACCESS_STATUS_ADDR_OFFSET 0x05c + +//================================ +//BLOCK FSHC reg struct define +typedef union //0x008 +{ + struct + { + uint32_t CPOL: 1; // bit0 --- + // cpol = 1,spi_clk sample data_in at negedge, + // cpol = 0,spi_clk sample data_in at posedge, + uint32_t AUTO_CHECK_ST: 1; // bit1 --- auto_check_st is 1: + // auto read status before send suspend cmd + // note:set must before flash_busy set as 1 + uint32_t FLASH_BUSY_SET: 1; // bit2 --- When this bit is set 1, cache will read flash with suspend and resume mode + // For example: flash in erase status, cache want to read, you should set this bit first; + uint32_t FLASH_BUSY_CLR: 1; // bit3 --- when auto_check_st is 0, + // use to clear flash_busy + // when auto_check_st is 1, + // use to clear flash_st_done + uint32_t FLASH_INT_EN: 1; // bit4 --- when is 1 + // flash int is set when flash_st_done is 1 + uint32_t RSV_END: 27; // bit[31:5] + }; + uint32_t Word; +} FSHC_SPCR_TypeDef; //0x008 + + +//================================ +#define FSHC_CPOL_POS 0 +#define FSHC_AUTO_CHECK_ST_POS 1 +#define FSHC_FLASH_BUSY_SET_POS 2 +#define FSHC_FLASH_BUSY_CLR_POS 3 +#define FSHC_FLASH_INT_EN_POS 4 +//================================ + +typedef union //0x018 +{ + struct + { + uint32_t MCU_ADR_MAX_LEN: 6; // bit[5:0] --- MCU adr cycle length,include dummy cycle, max is 32 bit, only 24 bit is valid, others is zero; + // we use largest flash is 16MByte, so max address bit number is 24 bit; + // transmit address with spi mode, mcu_adr_max_len = (address bit number - 1) + dummy cycle + // transmit address with qpi mode, mcu_adr_max_len = ((address bit number)/4 - 1) + dummy cycle + uint32_t MCU_CMD_MAX_LEN: 6; // bit[11:6] --- MCU cmd cycle length,include dummy cycle, max is 32 bit, only 8 bit is vaild, others is zero; + // transmit command with spi mode, mcu_cmd_max_len = 7 + dummy cycle + // transmit command with qpi mode, mcu_cmd_max_len = 1 + dummy cycle + uint32_t RSV_END: 20; // bit[31:12] + }; + uint32_t Word; +} FSHC_MCU_ADRCMD_BIT_LEN_TypeDef; //0x018 + + +//================================ +#define FSHC_MCU_ADR_MAX_LEN_LSB 0 +#define FSHC_MCU_ADR_MAX_LEN_WIDTH 6 +#define FSHC_MCU_CMD_MAX_LEN_LSB 6 +#define FSHC_MCU_CMD_MAX_LEN_WIDTH 6 +//================================ + +typedef union //0x01c +{ + struct + { + uint32_t DATA_BIT_NUM: 2; // bit[1:0] --- MCU transmit data bit number + // 0/1: 1 bit spi mode, 2: 2bits dual mode, 3: 4bits quad mode + uint32_t ADDR_BIT_NUM: 2; // bit[3:2] --- MCU transmit address bit number + // 0/1: 1 bit spi mode, 2: 2bits dual mode, 3: 4bits quad mode + uint32_t CMD_BIT_NUM: 2; // bit[5:4] --- MCU transmit command bit number + // For GD, only 1bit command is used. For EON, 4bits #command can be used + // 0/1: 1 bit spi mode, 2: 2bits dual mode, 3: 4bits quad mode + uint32_t ADR_WITH_ARG: 2; // bit[7:6] --- MCU address argument + // 2'b00/2'b11: address followed by idle + // 2'b01: address followed by wdata + // 2'b10: address followed by rdata + uint32_t CMD_WITH_ARG: 3; // bit[10:8]--- MCU command argument + // 3'b011: command followed by address + // 3'b101: command followed by wdata + // 3'b110: command followed by rdata + // others: command followed by idle + uint32_t RSV_END: 21; // bit[31:11] + }; + uint32_t Word; +} FSHC_SEND_CTRL_TypeDef; //0x01c + + +//================================ +#define FSHC_DATA_BIT_NUM_LSB 0 +#define FSHC_DATA_BIT_NUM_WIDTH 2 +#define FSHC_ADDR_BIT_NUM_LSB 2 +#define FSHC_ADDR_BIT_NUM_WIDTH 2 +#define FSHC_CMD_BIT_NUM_LSB 4 +#define FSHC_CMD_BIT_NUM_WIDTH 2 +#define FSHC_ADR_WITH_ARG_LSB 6 +#define FSHC_ADR_WITH_ARG_WIDTH 2 +#define FSHC_CMD_WITH_ARG_LSB 8 +#define FSHC_CMD_WITH_ARG_WIDTH 3 +//================================ + +typedef union //0x024 +{ + struct + { + uint32_t RXFIFO_EMPTY: 1; // bit0 --- MCU rxfifo empty flag,when '1',fifo is empty,can't read; + // Additional one AHB cycle are needed to read this register bit versus a standard AHB read + uint32_t RXFIFO_FULL: 1; // bit1 --- MCU rxfifo full flag,when '1',fifo is full,can continue read data from rxfifo + uint32_t TXFIFO_EMPTY: 1; // bit2 --- MCU txfifo empty flag,when '1', fifo is empty,can continue write data to txfifo; + uint32_t TXFIFO_FULL: 1; // bit3 --- MCU txfifo full flag,when '1',fifo is full,can't write data to the fifo; + // Additional one AHB cycle are needed to read this register bit versus a standard AHB read + uint32_t RSV_END: 28; // bit[31:4] + }; + uint32_t Word; +} FSHC_FIFO_STATUS_TypeDef; //0x024 + + +//================================ +#define FSHC_RXFIFO_EMPTY_POS 0 +#define FSHC_RXFIFO_FULL_POS 1 +#define FSHC_TXFIFO_EMPTY_POS 2 +#define FSHC_TXFIFO_FULL_POS 3 +//================================ + +typedef union //0x02c +{ + struct + { + uint32_t CMD_SEND_STATUS: 1; // bit0 --- MCU + // 1: mcu request is not ack, can't configurate new command + // 0: allow configure new command + // Additional 3 AHB cycles are needed to read this register bit versus a standard AHB read + uint32_t FLASH_BUSY: 1; // bit1 --- set by flash_busy_set + // when auto_check_st is 0: + // cleared by flash_busy_clr + // when auto_check_st is 0: + // cleared by hardware flash_st_done + uint32_t FLASH_ST_DONE: 1; // bit2 --- only effect when auto_check_st is 1, + // cleared by flash_busy_clr + uint32_t RSV_END: 29; // bit[31:3] + }; + uint32_t Word; +} FSHC_ST_TypeDef; //0x02c + + +//================================ +#define FSHC_CMD_SEND_STATUS_POS 0 +#define FSHC_FLASH_BUSY_POS 1 +#define FSHC_FLASH_ST_DONE_POS 2 +//================================ + +typedef union //0x030 +{ + struct + { + uint32_t READ_CMD: 8; // bit[7:0] --- Read command index,EBH,0BH etc + uint32_t SUS_CMD: 8; // bit[15:8] --- suspend command index, 75H + uint32_t RESUME_CMD: 8; // bit[23:16]--- resume command index,7AH + uint32_t HPM_CMD: 8; // bit[31:24]--- high performance mode command index,A3H + }; + uint32_t Word; +} FSHC_CACHE_CMD1_TypeDef; //0x030 + + +//================================ +#define FSHC_READ_CMD_LSB 0 +#define FSHC_READ_CMD_WIDTH 8 +#define FSHC_SUS_CMD_LSB 8 +#define FSHC_SUS_CMD_WIDTH 8 +#define FSHC_RESUME_CMD_LSB 16 +#define FSHC_RESUME_CMD_WIDTH 8 +#define FSHC_HPM_CMD_LSB 24 +#define FSHC_HPM_CMD_WIDTH 8 +//================================ + +typedef union //0x034 +{ + struct + { + uint32_t EXITHPM_CMD: 8; // bit[7:0] --- exit high performance mode command index, 06H + uint32_t CONTINU_RD_MOD: 8; // bit[15:8] --- continuous read mode command, continu_rd_mod will be sent follow by address; + // Notice: continu_rd_mod and continue_rd_mod_index control flash in continuous read mode. + // Look at the continue_rd_mod_index for details. + uint32_t RD_STATUS_CMD: 8; // bit[23:16]--- read status cmd + // only used when both auto_check_st and flash_busy is 1 + uint32_t RD_STATUS_MASK: 8; // bit[31:24] + }; + uint32_t Word; +} FSHC_CACHE_CMD2_TypeDef; //0x034 + + +//================================ +#define FSHC_EXITHPM_CMD_LSB 0 +#define FSHC_EXITHPM_CMD_WIDTH 8 +#define FSHC_CONTINU_RD_MOD_LSB 8 +#define FSHC_CONTINU_RD_MOD_WIDTH 8 +#define FSHC_RD_STATUS_CMD_LSB 16 +#define FSHC_RD_STATUS_CMD_WIDTH 8 +#define FSHC_RD_STATUS_MASK_LSB 24 +#define FSHC_RD_STATUS_MASK_WIDTH 8 +//================================ + +typedef union //0x038 +{ + struct + { + uint32_t ADR_BIT_MAX: 5; // bit[4:0] --- Only use in cache read mode, other cache cmd don't have address. + // Cache address cycle length. adr_bit_max = address length cycle - 1 + dummy cycle. + // For example: In GD flash Quad I/O Fast Read, want address 8 cycles + dummy 4 cycles, so adr_bit_max = (8-1+4) = 11 (Decimal) + // For example: In GD flash SPI Fast Read (0BH), want address 24 cycles + dummy 8 cycles, so adr_bit_max = (24-1+8) = 31 (Decimal) + uint32_t SUS_DELAY_MAX: 16; // bit[20:5] --- Set the delay time after send hpm command,default is GigaDevice flash value(0.2us) + uint32_t HPM_DELAY_MAX: 6; // bit[26:21]--- The value of hpm_delay_max can not be 2+5n,(n=0,1,2,...) like 22,27,32,37. + // Best valus is 4+5n. like 24,29,34,39. Here 22,27,32,37 is decimal number. + // Set the delay time after sumpend command, default is GigaDevice flash value(2us) + uint32_t RSV_END: 5; // bit[31:27] + }; + uint32_t Word; +} FSHC_CACHE_DELAY_SET_TypeDef; //0x038 + + +//================================ +#define FSHC_ADR_BIT_MAX_LSB 0 +#define FSHC_ADR_BIT_MAX_WIDTH 5 +#define FSHC_SUS_DELAY_MAX_LSB 5 +#define FSHC_SUS_DELAY_MAX_WIDTH 16 +#define FSHC_HPM_DELAY_MAX_LSB 21 +#define FSHC_HPM_DELAY_MAX_WIDTH 6 +//================================ + +typedef union //0x040 +{ + struct + { + uint32_t HPM_LEN: 6; // bit[5:0] --- hpm command length, default is 6'h1f, + // on quad command mode -------- hpm_len = (length of hpm_command)/4 - 1 + dummy cycle, + // on spi command mode -------- hpm_len = (length of hpm_command) + dummy cycle - 1 + // cache_no_dummy_cmd_len/cache_cmd_len/hpm_len distinguish + // -------------------------------------------------------# + // cmd cmd length register + // hpm hpm_len + // qpi read cache_cmd_len + // suspend cache_no_dummy_cmd_len + // resume cache_no_dummy_cmd_len + // exit_hpm cache_no_dummy_cmd_len + // rst_continue cache_no_dummy_cmd_len + // set continue include in adr_bit_max + uint32_t CACHE_CMD_LEN: 4; // bit[9:6] --- only use in qpi read cmd, default is 4'h7, + // on quad command mode ----- cache_cmd_len = 1 + dummy cycle, + // on spi command mode ----- cache_cmd_len = 7 + dummy cycle + uint32_t CACHE_NO_DUMMY_CMD_LEN: 4; // bit[13:10]--- use in suspend/resume/exit_hpm cmd, default is 4'h7, + // on quad command mode -------- cache_no_dummy_cmd_len = (length of command)/4 - 1, + // on spi command mode -------- cache_no_dummy_cmd_len = (length of command) - 1. + uint32_t CACHE_ADDR_BIT_NUM: 2; // bit[15:14]--- CACHE transmit address bit number + // 0/1: 1 bit spi mode, 2: 2bits dual mode, 3: 4bits quad mode + uint32_t CACHE_CMD_BIT_NUM: 2; // bit[17:16]--- CACHE transmit command bit number + // /1: 1 bit spi mode, 2: 2bits dual mode, 3: 4bits quad mode + uint32_t CACHE_DATA_BIT_NUM: 2; // bit[19:18]--- CACHE transmit data bit number + // 0/1: 1 bit spi mode, 2: 2bits dual mode, 3: 4bits quad mod + uint32_t RSV_END: 12; // bit[31:20] + }; + uint32_t Word; +} FSHC_DELAY_SET_TypeDef; //0x040 + + +//================================ +#define FSHC_HPM_LEN_LSB 0 +#define FSHC_HPM_LEN_WIDTH 6 +#define FSHC_CACHE_CMD_LEN_LSB 6 +#define FSHC_CACHE_CMD_LEN_WIDTH 4 +#define FSHC_CACHE_NO_DUMMY_CMD_LEN_LSB 10 +#define FSHC_CACHE_NO_DUMMY_CMD_LEN_WIDTH 4 +#define FSHC_CACHE_ADDR_BIT_NUM_LSB 14 +#define FSHC_CACHE_ADDR_BIT_NUM_WIDTH 2 +#define FSHC_CACHE_CMD_BIT_NUM_LSB 16 +#define FSHC_CACHE_CMD_BIT_NUM_WIDTH 2 +#define FSHC_CACHE_DATA_BIT_NUM_LSB 18 +#define FSHC_CACHE_DATA_BIT_NUM_WIDTH 2 +//================================ + +//================================ +//BLOCK FSHC top struct define +typedef struct +{ + __I uint32_t SPDR_RD ; // 0x000, + // mcu read rx fifo data via this register; + // read this register, should set rxptr_inc_en first; + // rxfifo_empty in fifo_status register, + // if rxfifo_empty is 1, means rxfifo is empty, mcu can't read + __O uint32_t SPDR_WR ; // 0x004, + // mcu write tx fifo data via this register; + // txfifo_full in fifo_status register, + // if txfifo_full is 1, means txfifo is full, mcu can't write; + __IO FSHC_SPCR_TypeDef SPCR ; // 0x008, + __IO uint32_t RXTX_DAT_LEN ; // 0x00c, + // set must before flash_busy set as 1 + __IO uint32_t CMD_REG ; // 0x010, + // MCU access flash command. + __IO uint32_t ADDR_REG ; // 0x014, + // MCU access flash start address,byte address + __IO FSHC_MCU_ADRCMD_BIT_LEN_TypeDef MCU_ADRCMD_BIT_LEN ; // 0x018, + __IO FSHC_SEND_CTRL_TypeDef SEND_CTRL ; // 0x01c, + __O uint32_t SEND_EN ; // 0x020, + // MCU start transmit,write 1 to start transmit command/address/data, + // hardware will check the posedge of the signal + __I FSHC_FIFO_STATUS_TypeDef FIFO_STATUS ; // 0x024, + __IO uint32_t RXPTR_INC_EN ; // 0x028, + // MCU read rxfifo enable + // 1 ------ rx fifo rxptr increment enable + // 0 ------ rx fifo rxptr increment disable + __I FSHC_ST_TypeDef ST ; // 0x02c, + __IO FSHC_CACHE_CMD1_TypeDef CACHE_CMD1 ; // 0x030, + // cache command, Gigadevice command is supported in default + // cache access flash only use qpi_read/suspend/resume/hpm/exithpm/rst_continue/continu_rd_mod cmd; + // in these cmd, rst_continue is fixed 8'hFF, others can configure. + __IO FSHC_CACHE_CMD2_TypeDef CACHE_CMD2 ; // 0x034, + // cache command, Gigadevice command is supported in default + // cache access flash only use qpi_read/suspend/resume/hpm/exithpm/rst_continue/continu_rd_mod cmd; + // in these cmd, rst_continue is fixed 8'hFF, others can configure. + __IO FSHC_CACHE_DELAY_SET_TypeDef CACHE_DELAY_SET ; // 0x038, + __IO uint32_t CACHE_RESUME_DELAY_MAX; // 0x03c, + // resume delay time. + // This register control the interval time of two read when erase flash. + // delay time: (1/F(flash))*resume_delay_max. + __IO FSHC_DELAY_SET_TypeDef DELAY_SET ; // 0x040, + __IO uint32_t BYPASS_HPM ; // 0x044, + // 0----enable cache hpm + // 1----disable cache hpm + __IO uint32_t ATOM_OP_EN ; // 0x048, + // Set this bit, fshc won't ack cache request and cache request will be pended. + // Note: 1. if cache is reading in hpm mode or continue mode, MCU should exit hpm or rst continue first before accessing flash + // 2. The system will die when set this bit to 1 and CPU fetch instruct or data, because fshc won't ack cache request + __O uint32_t CLR_HPM ; // 0x04c, + // Set this bit to 1 before MCU send command when cache is working in hpm, and flash clock will be switched. + // For example: when cache reads flash in hpm, MCU want to access flash. In such case, MCU should set atom_op_en, + // then set this bit, then send exit hpm cmd. + __IO uint32_t CONTINUE_RD_MOD_INDEX ; // 0x050, + // continue_rd_mod valid indication + // if you want to enter continuous read mode + // 1.set continue_rd_mod with enter continue read mode value; + // 2.set continue_rd_mod == continue_rd_mod_index. + // both satisfy two condition, flash will entrance continuous read mode. + // if you don't want to enter continuous read mode + // 1.set continue_rd_mod with exit continue read mode value; + // 2.set continue_rd_mod != continue_rd_mod_index. + // both satisfy two condition, flash won't entrance continuous read mode. + // gigedevice ----- enter continue read mode value is 8'hAX, ex:8'ha0; + // exit continue read mode value is other value except 8'hAX, ex:8'h00,8'h55,8'hff; + // MACRONIX ----- enter performance enhance mode value is bit7 != bit3, bit6 != bit2, bit5 != bit1, bit4 != bit0, ex:8'ha5,8'h5a,8'h0f; + // exit performance enhance value mode bit7 = bit3, bit6 = bit2, bit5 = bit1, bit4 = bit0, ex: 8'haa,8'h00,8'hff; + // Winbond ----- enter continue read mode index,{2'bxx,2'b10,4'bxxxx},the value of continu_rd_mod = {2'bxx,2'b10,4'bxxxx} if want to use continue read mode, + // SST ----- don't have continuous read mode, so the value of continu_rd_mod != continue_rd_mod_index. + // EoN ----- enter performance enhance mode value bit7 != bit3, bit6 != bit2, bit5 != bit1, bit4 != bit0, ex:8'ha5,8'h5a,8'h0f; + // exit performance enhance value bit7 = bit3, bit6 = bit2, bit5 = bit1, bit4 = bit0, ex: 8'haa,8'h00,8'hff. + __I uint32_t CONTINUE_STATUS ; // 0x054, + // 1 ------ flash be in continue read mode for cache path. + __IO uint32_t DLY_CFG ; // 0x058, + // used delay cell number + // 0 - used 1 delay cell; 1 - used 2 delay cell; ... 7 - used 8 delay cell; + __I uint32_t CACHE_ACCESS_STATUS ; // 0x05c, + // This bit reflect cache access flash status. use for switching from cache to mcu access flash. + // 1: cache bus is busy, mcu not to break. + // 0: only when is 0, MCU can send cmd to access flash. +} FSHC_TypeDef; + + +#define FSHC (( FSHC_TypeDef *) FSHC_BASE) + +#endif diff --git a/core/reg/reg_gpio.h b/core/reg/reg_gpio.h new file mode 100644 index 0000000..c15e419 --- /dev/null +++ b/core/reg/reg_gpio.h @@ -0,0 +1,58 @@ +#ifndef _REG_GPIO_H_ +#define _REG_GPIO_H_ + +#include "reg_base.h" + +//================================ +//BLOCK GPIO define + +#define GPIO_BASE ((uint32_t)0x40010000) +#define GPIO_DAT_SET_ADDR_OFFSET 0x000 +#define GPIO_DAT_CLR_ADDR_OFFSET 0x004 +#define GPIO_DAT_TOG_ADDR_OFFSET 0x008 +#define GPIO_DAT_MSK_ADDR_OFFSET 0x00c +#define GPIO_DAT_ADDR_OFFSET 0x010 +#define GPIO_PIN_ADDR_OFFSET 0x014 +#define GPIO_DIR_SET_ADDR_OFFSET 0x020 +#define GPIO_DIR_CLR_ADDR_OFFSET 0x024 +#define GPIO_DIR_TOG_ADDR_OFFSET 0x028 +#define GPIO_DIR_MSK_ADDR_OFFSET 0x02c +#define GPIO_DIR_ADDR_OFFSET 0x030 + +//================================ +//BLOCK GPIO top struct define +typedef struct +{ + __O uint32_t DAT_SET; // 0x000, + // WR: (1: gpio is set high level, 0: no effect) + __O uint32_t DAT_CLR; // 0x004, + // WR: (1: gpio is set low level, 0: no effect) + __O uint32_t DAT_TOG; // 0x008, + // WR: (1: gpio state is overturn (1->0 or 0->1)) + __IO uint32_t DAT_MSK; // 0x00c, + // WR: (1: dat_set, dat_clr, dat_tog, dat can not set, 0: no effect) + // RD: () + __IO uint32_t DAT ; // 0x010, + // WR: (1: write this register equal to write dat_set, dat_clr, dat_tog) + // RD: (return current register value) + __I uint32_t PIN ; // 0x014, + // RD: (get gpio current state(1: high level, 0: low level)) + __I uint32_t RSV0[2]; + __O uint32_t DIR_SET; // 0x020, + // WR: (1: set gpio is output, 0: no effect) + __O uint32_t DIR_CLR; // 0x024, + // WR: (1: clear gpio output function, 0: no effect) + __O uint32_t DIR_TOG; // 0x028, + // WR: (1: gpio direction is overturn (1->0 or 0->1)) + __IO uint32_t DIR_MSK; // 0x02c, + // WR: (1: dir_set, dir_clr, dir_tog, dir can not set, 0: no effect) + // RD: () + __IO uint32_t DIR ; // 0x030, + // WR: (write this register equal to write dir_set, dir_clr, dir_tog) + // RD: (get gpio current direction (1: output, 0: input)) +} GPIO_TypeDef; + + +#define GPIO (( GPIO_TypeDef *) GPIO_BASE) + +#endif diff --git a/core/reg/reg_i2c.h b/core/reg/reg_i2c.h new file mode 100644 index 0000000..e1c8252 --- /dev/null +++ b/core/reg/reg_i2c.h @@ -0,0 +1,355 @@ +#ifndef _REG_I2C_H_ +#define _REG_I2C_H_ + +#include "reg_base.h" + +//================================ +//BLOCK I2C define + +#define I2C_BASE ((uint32_t)0x40029000) +#define I2C_CONSET_ADDR_OFFSET 0x000 +#define I2C_CONCLR_ADDR_OFFSET 0x004 +#define I2C_SR_ADDR_OFFSET 0x008 +#define I2C_DATA_ADDR_OFFSET 0x00c +#define I2C_CLK_ADDR_OFFSET 0x010 +#define I2C_SADR0_ADDR_OFFSET 0x014 +#define I2C_ADM0_ADDR_OFFSET 0x018 +#define I2C_XSADR_ADDR_OFFSET 0x01c +#define I2C_XADM_ADDR_OFFSET 0x020 +#define I2C_SRST_ADDR_OFFSET 0x024 +#define I2C_SADR1_ADDR_OFFSET 0x028 +#define I2C_ADM1_ADDR_OFFSET 0x02c +#define I2C_SADR2_ADDR_OFFSET 0x030 +#define I2C_ADM2_ADDR_OFFSET 0x034 +#define I2C_SADR3_ADDR_OFFSET 0x038 +#define I2C_ADM3_ADDR_OFFSET 0x03c + +//================================ +//BLOCK I2C reg struct define +typedef union //0x000 +{ + struct + { + uint32_t SL7VAL: 1; // bit0 --- 7-bit addr control bit + uint32_t SL10VAL: 1; // bit1 --- 10-bit addr control bit + uint32_t AAK: 1; // bit2 --- + // 1.when this bit is 1 and satisfy any of the following conditions + // (1)rcv 7-bit addr first byte or 10-bit second byte + // (2)rcv radio addr and gcebab is 1 + // (3)master or slaver mode receive data + // i2c will transmit a ack(sda low level) + // 2.if this bit is 0, when master or slaver mode receive data will not transmit ack + // 3.when slaver mode transmit data, clear this bit,slaver think this data is last + uint32_t IFLG: 1; // bit3 --- flag signal + uint32_t STP: 1; // bit4 --- master stop signal auto clear + // master mode set stp 1 will send stop signal + // slaver mode set stp 1, slaver think receive stop signal + uint32_t STA: 1; // bit5 --- master start signal auto clear + // master mode set sta 1, change into master and send start signal if already master mode, send restart signal + // slaver mode set sta 1, after ending current tasks then change into master mode + uint32_t ENAB: 1; // bit6 --- i2c enable + uint32_t IEN: 1; // bit7 --- i2c interrupt enable + uint32_t GCAVAL: 1; // bit8 + uint32_t RSV_END: 23; // bit[31:9] + }; + uint32_t Word; +} I2C_CONSET_TypeDef; //0x000 + + +//================================ +#define I2C_SL7VAL_POS 0 +#define I2C_SL10VAL_POS 1 +#define I2C_AAK_POS 2 +#define I2C_IFLG_POS 3 +#define I2C_STP_POS 4 +#define I2C_STA_POS 5 +#define I2C_ENAB_POS 6 +#define I2C_IEN_POS 7 +#define I2C_GCAVAL_POS 8 +//================================ + +typedef union //0x004 +{ + struct + { + uint32_t RSV_NOUSE1: 2; // bit[1:0] --- Ignore me + uint32_t AAC: 1; // bit2 + uint32_t IFLG: 1; // bit3 + uint32_t RSV_NOUSE2: 1; // bit4 --- Ignore me + uint32_t STAC: 1; // bit5 + uint32_t ENC: 1; // bit6 + uint32_t IEC: 1; // bit7 + uint32_t RSV_END: 24; // bit[31:8] + }; + uint32_t Word; +} I2C_CONCLR_TypeDef; //0x004 + + +//================================ +#define I2C_AAC_POS 2 +#define I2C_IFLG_POS 3 +#define I2C_STAC_POS 5 +#define I2C_ENC_POS 6 +#define I2C_IEC_POS 7 +//================================ + +typedef union //0x008 +{ + struct + { + uint32_t RSV_NOUSE1: 3; // bit[2:0] --- Ignore me + uint32_t STATUS: 5; // bit[7:3] --- i2c_status + uint32_t RSV_END: 24; // bit[31:8] + }; + uint32_t Word; +} I2C_SR_TypeDef; //0x008 + + +//================================ +#define I2C_STATUS_LSB 3 +#define I2C_STATUS_WIDTH 5 +//================================ + +typedef union //0x00c +{ + struct + { + uint32_t DATA: 8; // bit[7:0] --- transfer address/data + uint32_t REV_END: 24; // bit[31:7] + }; + uint32_t Word; +} I2C_DATA_TypeDef; //0x00c + + +//================================ +#define I2C_DATA_LSB 0 +#define I2C_DATA_WIDTH 8 +#define I2C_REV_END_LSB 8 +#define I2C_REV_END_WIDTH 24 +//================================ + +typedef union //0x010 +{ + struct + { + uint32_t M: 4; // bit[3:0] --- i2c master mode scl frequency + uint32_t N: 3; // bit[6:4] --- i2c samp frequency + uint32_t RSV_END: 25; // bit[31:7] + }; + uint32_t Word; +} I2C_CLK_TypeDef; //0x010 + + +//================================ +#define I2C_M_LSB 0 +#define I2C_M_WIDTH 4 +#define I2C_N_LSB 4 +#define I2C_N_WIDTH 3 +//================================ + +typedef union //0x014 +{ + struct + { + uint32_t GCEBAB: 1; // bit0 + uint32_t SADR: 7; // bit[7:1] --- slaa0 + uint32_t RSV_END: 24; // bit[31:8] + }; + uint32_t Word; +} I2C_SADR0_TypeDef; //0x014 + + +//================================ +#define I2C_GCEBAB_POS 0 +#define I2C_SADR_LSB 1 +#define I2C_SADR_WIDTH 7 +//================================ + +typedef union //0x018 +{ + struct + { + uint32_t RSV_NOUSE1: 1; // bit0 + uint32_t MASK: 7; // bit[7:1] --- adm0 + uint32_t RSV_END: 24; // bit[31:8] + }; + uint32_t Word; +} I2C_ADM0_TypeDef; //0x018 + + +//================================ +#define I2C_MASK_LSB 1 +#define I2C_MASK_WIDTH 7 +//================================ + +typedef union //0x01c +{ + struct + { + uint32_t XGCENAB: 1; // bit0 + uint32_t ADDR: 10; // bit[10:1] --- xsla + uint32_t RSV_END: 21; // bit[31:11] + }; + uint32_t Word; +} I2C_XSADR_TypeDef; //0x01c + + +//================================ +#define I2C_XGCENAB_POS 0 +#define I2C_ADDR_LSB 1 +#define I2C_ADDR_WIDTH 10 +//================================ + +typedef union //0x020 +{ + struct + { + uint32_t RSV_NOUSE1: 1; // bit0 --- Ignore me + uint32_t MASK: 10; // bit[10:1] + uint32_t RSV_END: 21; // bit[31:11] + }; + uint32_t Word; +} I2C_XADM_TypeDef; //0x020 + + +//================================ +#define I2C_XADM_MASK_LSB 1 +#define I2C_XADM_MASK_WIDTH 10 +//================================ + +typedef union //0x028 +{ + struct + { + uint32_t GCEBAB: 1; // bit0 + uint32_t SADR: 7; // bit[7:1] --- slaa1 + uint32_t RSV_END: 24; // bit[31:8] + }; + uint32_t Word; +} I2C_SADR1_TypeDef; //0x028 + + +//================================ +#define I2C_GCEBAB_POS 0 +#define I2C_SADR_LSB 1 +#define I2C_SADR_WIDTH 7 +//================================ + +typedef union //0x02c +{ + struct + { + uint32_t RSV_NOUSE1: 1; // bit0 --- Ignore me + uint32_t MASK: 7; // bit[7:1] --- adm1 + uint32_t RSV_END: 24; // bit[31:8] + }; + uint32_t Word; +} I2C_ADM1_TypeDef; //0x02c + + +//================================ +#define I2C_ADM_MASK_LSB 1 +#define I2C_ADM_MASK_WIDTH 7 +//================================ + +typedef union //0x030 +{ + struct + { + uint32_t GCEBAB: 1; // bit0 + uint32_t SADR: 7; // bit[7:1] --- slaa2 + uint32_t RSV_END: 24; // bit[31:8] + }; + uint32_t Word; +} I2C_SADR2_TypeDef; //0x030 + + +//================================ +#define I2C_GCEBAB_POS 0 +#define I2C_SADR_LSB 1 +#define I2C_SADR_WIDTH 7 +//================================ + +typedef union //0x034 +{ + struct + { + uint32_t RSV_NOUSE1: 1; // bit0 --- Ignore me + uint32_t MASK: 7; // bit[7:1] --- adm2 + uint32_t RSV_END: 24; // bit[31:8] + }; + uint32_t Word; +} I2C_ADM2_TypeDef; //0x034 + +typedef union //0x038 +{ + struct + { + uint32_t GCEBAB: 1; // bit0 + uint32_t SADR: 7; // bit[7:1] --- slaa3 + uint32_t RSV_END: 24; // bit[31:8] + }; + uint32_t Word; +} I2C_SADR3_TypeDef; //0x038 + + +//================================ +#define I2C_GCEBAB_POS 0 +#define I2C_SADR_LSB 1 +#define I2C_SADR_WIDTH 7 +//================================ + +typedef union //0x03c +{ + struct + { + uint32_t RSV_NOUSE1: 1; // bit0 --- Ignore me + uint32_t MASK: 7; // bit[7:1] --- adm3 + uint32_t RSV_END: 24; // bit[31:8] + }; + uint32_t Word; +} I2C_ADM3_TypeDef; //0x03c + + +//================================ +//BLOCK I2C top struct define +typedef struct +{ + __IO I2C_CONSET_TypeDef CONSET ; // 0x000, + // i2c control set register -- i2c control reg + __O I2C_CONCLR_TypeDef CONCLR ; // 0x004, + // i2c control clr register + __I I2C_SR_TypeDef SR ; // 0x008, + // i2c status register -- i2c status reg + __IO I2C_DATA_TypeDef DATA ; // 0x00c, + // i2c data register -- i2c data reg (addr+r/w and data) 8bits + __IO I2C_CLK_TypeDef CLK ; // 0x010, + // i2c ccrfs register -- i2c clock (scl) speed contorl reg + __IO I2C_SADR0_TypeDef SADR0 ; // 0x014, + // i2c slaa register -- slaver address reg + __IO I2C_ADM0_TypeDef ADM0 ; // 0x018, + // i2c adm0 register + __IO I2C_XSADR_TypeDef XSADR ; // 0x01c, + // i2c xsla register -- extension slaver address reg + __IO I2C_XADM_TypeDef XADM ; // 0x020, + // i2c xadm0 register + __O uint32_t SRST ; // 0x024, + // reserved + __IO I2C_SADR1_TypeDef SADR1 ; // 0x028, + // i2c slaa1 register + __IO I2C_ADM1_TypeDef ADM1 ; // 0x02c, + // i2c adm1 register + __IO I2C_SADR2_TypeDef SADR2 ; // 0x030, + // i2c slaa2 register + __IO I2C_ADM2_TypeDef ADM2 ; // 0x034, + // i2c adm2 register + __IO I2C_SADR3_TypeDef SADR3 ; // 0x038, + // i2c slaa3 register + __IO I2C_ADM3_TypeDef ADM3 ; // 0x03c, + // i2c adm3 register +} I2C_TypeDef; + + +#define I2C (( I2C_TypeDef *) I2C_BASE) + +#endif diff --git a/core/reg/reg_iwdt.h b/core/reg/reg_iwdt.h new file mode 100644 index 0000000..1702faf --- /dev/null +++ b/core/reg/reg_iwdt.h @@ -0,0 +1,65 @@ +#ifndef _REG_IWDT_H_ +#define _REG_IWDT_H_ + +#include "reg_base.h" + +//================================ +//BLOCK IWDT define + +#define IWDT_BASE ((uint32_t)0x4002a000) +#define IWDT_LOAD_ADDR_OFFSET 0x000 +#define IWDT_VALUE_ADDR_OFFSET 0x004 +#define IWDT_CTRL_ADDR_OFFSET 0x008 +#define IWDT_INTCLR_ADDR_OFFSET 0x00c +#define IWDT_RIS_ADDR_OFFSET 0x010 +#define IWDT_LOCK_ADDR_OFFSET 0x100 + +//================================ +//BLOCK IWDT reg struct define +typedef union //0x008 +{ + struct + { + uint32_t EN: 1; // bit0 --- iwdg enable + uint32_t INTEN: 1; // bit1 --- iwdg interrupt enable + uint32_t RSTEN: 1; // bit2 --- iwdg reset enable + uint32_t CLKSEL: 1; // bit3 --- iwdg clk select + // 0:iwdt clk select apbclk + // 1:iwdt clk select lsi + uint32_t RSV_END: 28; // bit[31:4] + }; + uint32_t Word; +} IWDT_CTRL_TypeDef; //0x008 + + +//================================ +#define IWDT_EN_POS 0 +#define IWDT_INTEN_POS 1 +#define IWDT_RSTEN_POS 2 +#define IWDT_CLKSEL_POS 3 +//================================ + +//================================ +//BLOCK IWDT top struct define +typedef struct +{ + __IO uint32_t LOAD ; // 0x000, + // reload value register + __I uint32_t VALUE ; // 0x004, + // current value register + __IO IWDT_CTRL_TypeDef CTRL ; // 0x008, + // control register + __O uint32_t INTCLR ; // 0x00c, + // interrupt flag clear register + __I uint32_t RIS ; // 0x010, + // interrupt flag register + __I uint32_t RSV0[59]; + __IO uint32_t LOCK ; // 0x100, + // iwdg register locking register + // write 0x1ACCE551 to unlock +} IWDT_TypeDef; + + +#define IWDT (( IWDT_TypeDef *) IWDT_BASE) + +#endif diff --git a/core/reg/reg_mdm.h b/core/reg/reg_mdm.h new file mode 100644 index 0000000..a7d3857 --- /dev/null +++ b/core/reg/reg_mdm.h @@ -0,0 +1,251 @@ +#ifndef _REG_MDM_H_ +#define _REG_MDM_H_ + +#include "reg_base.h" + +//================================ +//BLOCK MDM define + +#define MDM_BASE ((uint32_t)0x40009000) +#define MDM_REG0_ADDR_OFFSET 0x000 +#define MDM_REG1_ADDR_OFFSET 0x004 +#define MDM_CRC_PRESET_ADDR_OFFSET 0x008 +#define MDM_ACCESS_REG_ADDR_OFFSET 0x00c +#define MDM_DAT_CFG_ADDR_OFFSET 0x010 +#define MDM_EXT_CTRL_ADDR_OFFSET 0x014 +#define MDM_RXSYNC_WIN_ADDR_OFFSET 0x018 +#define MDM_SLOT_SET_ADDR_OFFSET 0x01c +#define MDM_FINECNT_SET_ADDR_OFFSET 0x020 +#define MDM_SLOTCNT_SET_ADDR_OFFSET 0x024 +#define MDM_FINECNT_ADDR_OFFSET 0x028 +#define MDM_SLOTCNT_ADDR_OFFSET 0x02c +#define MDM_EXT_TX_DAT_ADDR_OFFSET 0x030 +#define MDM_EXT_RX_DAT_ADDR_OFFSET 0x034 +#define MDM_EXT_ST_ADDR_OFFSET 0x038 + +//================================ +//BLOCK MDM reg struct define +typedef union //0x000 +{ + struct + { + uint32_t RF_CHANNEL_NO: 6; // bit[5:0] + uint32_t WHITENING_ON: 1; // bit6 + uint32_t CD1_EN: 1; // bit7 + uint32_t ACC_REG_EN: 1; // bit8 + uint32_t TX_INVERT: 1; // bit9 + uint32_t RX_INVERT: 1; // bit10 + uint32_t IQ_INVERT: 1; // bit11 + uint32_t LI_INVERT: 1; // bit12 + uint32_t LQ_INVERT: 1; // bit13 + uint32_t ACC_INVERT: 1; // bit14 + uint32_t FILT2_CLK_PH: 1; // bit15 --- no use + uint32_t TXCLK_PH: 1; // bit16 --- use for RF CTRL sample the modem out TX_DATA + // 0: use the posedge clk sample + // 1: use the negedge clk sample + uint32_t RSV_NOUSE1: 1; // bit17 + uint32_t DEBUG_MODE: 4; // bit[21:18] --- debug out select + uint32_t TX_SCALE_EN: 1; // bit22 + uint32_t TX_SCALE_COEF_1M: 3; // bit[25:23] --- + // tx_scale_coef[2]==1 : tx_out = tx_in *( 1 + tx_scale_coef[1:0]/16) + // tx_scale_coef[2]==0 : tx_out = tx_in *( 1 - tx_scale_coef[1:0]/16) + uint32_t TX_SCALE_COEF_2M: 3; // bit[28:26] --- + // tx_scale_coef[2]==1 : tx_out = tx_in *( 1 + tx_scale_coef[1:0]/16) + // tx_scale_coef[2]==0 : tx_out = tx_in *( 1 - tx_scale_coef[1:0]/16) + uint32_t RSV_END: 3; // bit[31:29] + }; + uint32_t Word; +} MDM_REG0_TypeDef; //0x000 + + +//================================ +#define MDM_RF_CHANNEL_NO_LSB 0 +#define MDM_RF_CHANNEL_NO_WIDTH 6 +#define MDM_WHITENING_ON_POS 6 +#define MDM_CD1_EN_POS 7 +#define MDM_ACC_REG_EN_POS 8 +#define MDM_TX_INVERT_POS 9 +#define MDM_RX_INVERT_POS 10 +#define MDM_IQ_INVERT_POS 11 +#define MDM_LI_INVERT_POS 12 +#define MDM_LQ_INVERT_POS 13 +#define MDM_ACC_INVERT_POS 14 +#define MDM_FILT2_CLK_PH_POS 15 +#define MDM_TXCLK_PH_POS 16 +#define MDM_DEBUG_MODE_LSB 18 +#define MDM_DEBUG_MODE_WIDTH 4 +#define MDM_TX_SCALE_EN_POS 22 +#define MDM_TX_SCALE_COEF_1M_LSB 23 +#define MDM_TX_SCALE_COEF_1M_WIDTH 3 +#define MDM_TX_SCALE_COEF_2M_LSB 26 +#define MDM_TX_SCALE_COEF_2M_WIDTH 3 +//================================ + +typedef union //0x004 +{ + struct + { + uint32_t MIN_MAG_CONF: 11; // bit[10:0] + uint32_t RSV_NOUSE1: 1; // bit11 + uint32_t DRIFT_COR_SET: 2; // bit[13:12] + uint32_t RSV_NOUSE2: 2; // bit[15:14] + uint32_t IF_SHIFT: 13; // bit[28:16] + uint32_t RSV_END: 3; // bit[31:29] + }; + uint32_t Word; +} MDM_REG1_TypeDef; //0x004 + + +//================================ +#define MDM_MIN_MAG_CONF_LSB 0 +#define MDM_MIN_MAG_CONF_WIDTH 11 +#define MDM_DRIFT_COR_SET_LSB 12 +#define MDM_DRIFT_COR_SET_WIDTH 2 +#define MDM_IF_SHIFT_LSB 16 +#define MDM_IF_SHIFT_WIDTH 13 +//================================ + +typedef union //0x010 +{ + struct + { + uint32_t MDM_DAT_SET: 8; // bit[7:0] + uint32_t MDM_DIRECT_SET: 1; // bit8 --- + // 0: modem out use the gauss filter out + // 1: modem out data is use mdm_dat_set[7:0] + uint32_t RSV_END: 23; // bit[31:9] + }; + uint32_t Word; +} MDM_DAT_CFG_TypeDef; //0x010 + + +//================================ +#define MDM_MDM_DAT_SET_LSB 0 +#define MDM_MDM_DAT_SET_WIDTH 8 +#define MDM_MDM_DIRECT_SET_POS 8 +//================================ + +typedef union //0x014 +{ + struct + { + uint32_t MDM_EXT_EN: 1; // bit0 --- + uint32_t MDM_INT_EN: 5; // bit[5:1] --- + // [0] mdm_tx_done interrupt en + // [1] mdm_sync_err interrupt en + // [2] mdm_slot_int interrupt en + // [3] mdm_slot_over interrupt en + // [4] mdm_sync_found interrupt en + uint32_t MDM_SLOT_CNT_HOLD: 1; // bit6 + uint32_t MDM_SLOT_UPLOAD: 1; // bit7 + uint32_t MDM_SLOT_INT_CLR: 1; // bit8 + uint32_t RSV_END: 23; // bit[31:9] + }; + uint32_t Word; +} MDM_EXT_CTRL_TypeDef; //0x014 + + +//================================ +#define MDM_MDM_EXT_EN_POS 0 +#define MDM_MDM_INT_EN_LSB 1 +#define MDM_MDM_INT_EN_WIDTH 5 +#define MDM_MDM_SLOT_CNT_HOLD_POS 6 +#define MDM_MDM_SLOT_UPLOAD_POS 7 +#define MDM_MDM_SLOT_INT_CLR_POS 8 +//================================ + +typedef union //0x01c +{ + struct + { + uint32_t MDM_SLOT_WIN: 12; // bit[11:0] --- + // slot window : (mdm_slot_win + 1 ) us + // max slot window : 4096 us + // default : 1ms + uint32_t MDM_SLOT_OFF: 12; // bit[23:12] --- + // slot interrput event offset + uint32_t RSV_END: 8; // bit[31:24] + }; + uint32_t Word; +} MDM_SLOT_SET_TypeDef; //0x01c + + +//================================ +#define MDM_MDM_SLOT_WIN_LSB 0 +#define MDM_MDM_SLOT_WIN_WIDTH 12 +#define MDM_MDM_SLOT_OFF_LSB 12 +#define MDM_MDM_SLOT_OFF_WIDTH 12 +//================================ + +typedef union //0x038 +{ + struct + { + uint32_t MDM_TX_DONE: 1; // bit0 --- + // when is 1 + // TX fifo is empty and last bit is sent out + // cleared when tx_en is 0 + uint32_t MDM_SYNC_ERR: 1; // bit1 --- + // when RX sync over time, + // mdm_sync_err is 1 + // cleared by rx_en is 0 + uint32_t MDM_SLOT_INT: 1; // bit2 --- + // cleared by mdm_slot_int_clr + uint32_t MDM_SLOT_OVER: 1; // bit3 --- + // cleared by mdm_slot_int_clr + uint32_t MDM_SYNC_FOUND: 1; // bit4 --- + // cleared by rx_en is 0 + uint32_t FIFO_EMPTY: 1; // bit5 + uint32_t FIFO_FULL: 1; // bit6 + uint32_t FIFO_NUM: 3; // bit[9:7] + uint32_t MDM_SYNC_TIME: 12; // bit[21:10] --- + // only valid when mdm_sync_found is 1 + // cleared when RX_EN is 0 + uint32_t RSV_END: 10; // bit[31:22] + }; + uint32_t Word; +} MDM_EXT_ST_TypeDef; //0x038 + + +//================================ +#define MDM_MDM_TX_DONE_POS 0 +#define MDM_MDM_SYNC_ERR_POS 1 +#define MDM_MDM_SLOT_INT_POS 2 +#define MDM_MDM_SLOT_OVER_POS 3 +#define MDM_MDM_SYNC_FOUND_POS 4 +#define MDM_FIFO_EMPTY_POS 5 +#define MDM_FIFO_FULL_POS 6 +#define MDM_FIFO_NUM_LSB 7 +#define MDM_FIFO_NUM_WIDTH 3 +#define MDM_MDM_SYNC_TIME_LSB 10 +#define MDM_MDM_SYNC_TIME_WIDTH 12 +//================================ + +//================================ +//BLOCK MDM top struct define +typedef struct +{ + __IO MDM_REG0_TypeDef REG0 ; // 0x000, + __IO MDM_REG1_TypeDef REG1 ; // 0x004, + __IO uint32_t CRC_PRESET ; // 0x008, + __IO uint32_t ACCESS_REG ; // 0x00c, + __IO MDM_DAT_CFG_TypeDef DAT_CFG ; // 0x010, + __IO MDM_EXT_CTRL_TypeDef EXT_CTRL ; // 0x014, + __IO uint32_t RXSYNC_WIN ; // 0x018, + // ext rx sync window : + // (mdm_ext_rxsync_win + 1) us + // max sync time : 4096 us + // default is 2ms + __IO MDM_SLOT_SET_TypeDef SLOT_SET ; // 0x01c, + __IO uint32_t FINECNT_SET ; // 0x020, + __IO uint32_t SLOTCNT_SET ; // 0x024, + __I uint32_t FINECNT ; // 0x028, + __I uint32_t SLOTCNT ; // 0x02c, + __O uint32_t EXT_TX_DAT ; // 0x030, + __I uint32_t EXT_RX_DAT ; // 0x034, + __I MDM_EXT_ST_TypeDef EXT_ST ; // 0x038, +} MDM_TypeDef; + +#define MDM (( MDM_TypeDef *) MDM_BASE) + +#endif diff --git a/core/reg/reg_rcc.h b/core/reg/reg_rcc.h new file mode 100644 index 0000000..4eb8c2d --- /dev/null +++ b/core/reg/reg_rcc.h @@ -0,0 +1,582 @@ +#ifndef _REG_RCC_H_ +#define _REG_RCC_H_ + +#include "reg_base.h" + +//================================ +//BLOCK RCC define + +#define RCC_BASE ((uint32_t)0x40000000) +#define RCC_CLK_EN_ST_ADDR_OFFSET 0x000 +#define RCC_AHBCLK_DIV_ADDR_OFFSET 0x004 +#define RCC_APB1CLK_DIV_ADDR_OFFSET 0x008 +#define RCC_APB2CLK_DIV_ADDR_OFFSET 0x00c +#define RCC_CFG_ADDR_OFFSET 0x010 +#define RCC_STCALIB_ADDR_OFFSET 0x014 +#define RCC_HSE_DET_CTRL_ADDR_OFFSET 0x018 +#define RCC_CHIP_RSTREQ_ADDR_OFFSET 0x01c +#define RCC_AHBRST_CTRL_ADDR_OFFSET 0x020 +#define RCC_APBRST_CTRL_ADDR_OFFSET 0x024 +#define RCC_AHBCLK_EN_RUN_ADDR_OFFSET 0x028 +#define RCC_APBCLK_EN_RUN_ADDR_OFFSET 0x02c +#define RCC_AHBCLK_EN_SLEEP_ADDR_OFFSET 0x030 +#define RCC_APBCLK_EN_SLEEP_ADDR_OFFSET 0x034 +#define RCC_AHBCLK_EN_DPSLEEP_ADDR_OFFSET 0x038 +#define RCC_APBCLK_EN_DPSLEEP_ADDR_OFFSET 0x03c +#define RCC_BLE_CLKRST_CTRL_ADDR_OFFSET 0x040 +#define RCC_CHIP_RST_ST_CLR_ADDR_OFFSET 0x044 + +//================================ +//BLOCK RCC reg struct define +typedef union //0x000 +{ + struct + { + uint32_t HSE_DIG_EN: 1; // bit0 + uint32_t LSI_DIG_EN: 1; // bit1 + uint32_t HSI_DIG_EN: 1; // bit2 + uint32_t DPLL_DIG_EN: 1; // bit3 + uint32_t CSS_EN: 1; // bit4 --- HSE stable check enable + uint32_t RCCALIB_CLKEN: 1; // bit5 + uint32_t BIST_CLK_EN: 1; // bit6 + uint32_t RC16M_CNT_CLKEN: 1; // bit7 + uint32_t FSHCCLK_SEL: 4; // bit[11:8] --- fshc clock source select + // 4'b0001: HSI clock + // 4'b0010: HSE clock + // 4'b0100: DPLL clock + // 4'b1000: DPLL 128M div out + // note: if fshc clock select DPLL 42M, + // fshcclk_diven must be set as 1 before fshcclk_sel + // config as 4'b1000 + uint32_t RCCALIB_CLKSEL: 2; // bit[13:12] + uint32_t FSHCCLK_DIVEN: 1; // bit14 --- 1: 128M divider for fshc enable + uint32_t FSHCCLK_DIV_NUM: 3; // bit[17:15]--- note fshcclk_div_num must be larger than 0 + // div clock = dpll_128m/(fshcclk_div_num + 1) + uint32_t IWDT_FCLK_DIS_DP: 1; // bit18 --- disable the IWDT function clock (RC32K clock) when chip is in DeepSleep + // Note : the IWDT function clock is auto enable, when chip is exit out DeepSleep + uint32_t CSS_FLAG: 1; // bit19 + uint32_t HSI_RDY: 1; // bit20 + uint32_t RSV_NOUSE1: 1; // bit21 --- Ignore me + uint32_t LSI_RDY: 1; // bit22 + uint32_t HSE_RDY: 1; // bit23 + uint32_t RSV_END: 8; // bit[31:24] + }; + uint32_t Word; +} RCC_CLK_EN_ST_TypeDef; //0x000 + + +//================================ +#define RCC_HSE_DIG_EN_POS 0 +#define RCC_LSI_DIG_EN_POS 1 +#define RCC_HSI_DIG_EN_POS 2 +#define RCC_DPLL_DIG_EN_POS 3 +#define RCC_CSS_EN_POS 4 +#define RCC_RCCALIB_CLKEN_POS 5 +#define RCC_BIST_CLK_EN_POS 6 +#define RCC_RC16M_CNT_CLKEN_POS 7 +#define RCC_FSHCCLK_SEL_LSB 8 +#define RCC_FSHCCLK_SEL_WIDTH 4 +#define RCC_RCCALIB_CLKSEL_LSB 12 +#define RCC_RCCALIB_CLKSEL_WIDTH 2 +#define RCC_FSHCCLK_DIVEN_POS 14 +#define RCC_FSHCCLK_DIV_NUM_LSB 15 +#define RCC_FSHCCLK_DIV_NUM_WIDTH 3 +#define RCC_IWDT_FCLK_DIS_DP_POS 18 +#define RCC_CSS_FLAG_POS 19 +#define RCC_HSI_RDY_POS 20 +#define RCC_LSI_RDY_POS 22 +#define RCC_HSE_RDY_POS 23 +//================================ + +typedef union //0x010 +{ + struct + { + uint32_t SYSCLK_SW: 4; // bit[3:0] --- system clock source select + // 1: HSI clock + // 2: HSE clock + // 4: PLL 64M clock + // 8: LSI clock + uint32_t MCO_SW: 4; // bit[7:4] --- + // 0: no output + // 1: hsi clock + // 2: hse clock + // 3: PLL clock + // 4: lsi clock + // 5: system clock + // 6: ahb clock + // 7: apb clock + // 8: fshc clock + uint32_t DPLL_CLK_SW: 1; // bit8 --- + // 1'b0: DPLL clock is use 64M + // 1'b1: DPLL clock is use 48M + uint32_t RSV_END: 23; // bit[31:9] + }; + uint32_t Word; +} RCC_CFG_TypeDef; //0x010 + + +//================================ +#define RCC_SYSCLK_SW_LSB 0 +#define RCC_SYSCLK_SW_WIDTH 4 +#define RCC_MCO_SW_LSB 4 +#define RCC_MCO_SW_WIDTH 4 +#define RCC_DPLL_CLK_SW_POS 8 +//================================ + +typedef union //0x018 +{ + struct + { + uint32_t CLK_DET_EN: 1; // bit0 --- 1: HSE clock detect enable + uint32_t CLK_DET_RSTREQ: 1; // bit1 --- 1: reset the HSE clock detect module + uint32_t RSV_NOUSE1: 6; // bit[7:2] --- Ignore me + uint32_t CLK_DET_PASS: 1; // bit8 + uint32_t CLK_DET_FAIL: 1; // bit9 + uint32_t RSV_END: 22; // bit[31:10] + }; + uint32_t Word; +} RCC_HSE_DET_CTRL_TypeDef; //0x018 + + +//================================ +#define RCC_CLK_DET_EN_POS 0 +#define RCC_CLK_DET_RSTREQ_POS 1 +#define RCC_CLK_DET_PASS_POS 8 +#define RCC_CLK_DET_FAIL_POS 9 +//================================ + +typedef union //0x020 +{ + struct + { + uint32_t RSV_NOUSE1: 1; // bit0 --- Ignore me + uint32_t SYSCFG_RSTREQ: 1; // bit1 + uint32_t CSC_RSTREQ: 1; // bit2 + uint32_t RSV_NOUSE2: 1; // bit3 --- Ignore me + uint32_t SPIM_RSTREQ: 1; // bit4 + uint32_t SPIS_RSTREQ: 1; // bit5 + uint32_t FSHC_RSTREQ: 1; // bit6 + uint32_t ADC_RSTREQ: 1; // bit7 + uint32_t GPIOA_RSTREQ: 1; // bit8 + uint32_t AHB2P1_RSTREQ: 1; // bit9 + uint32_t AHB2P2_RSTREQ: 1; // bit10 + uint32_t CACHE_RSTREQ: 1; // bit11 + uint32_t USB_RSTREQ: 1; // bit12 ---use for ahb2apb bridge + uint32_t RSV_END: 19; // bit[31:13] + }; + uint32_t Word; +} RCC_AHBRST_CTRL_TypeDef; //0x020 + + +//================================ +#define RCC_SYSCFG_RSTREQ_POS 1 +#define RCC_CSC_RSTREQ_POS 2 +#define RCC_SPIM_RSTREQ_POS 4 +#define RCC_SPIS_RSTREQ_POS 5 +#define RCC_FSHC_RSTREQ_POS 6 +#define RCC_ADC_RSTREQ_POS 7 +#define RCC_GPIOA_RSTREQ_POS 8 +#define RCC_AHB2P1_RSTREQ_POS 9 +#define RCC_AHB2P2_RSTREQ_POS 10 +#define RCC_CACHE_RSTREQ_POS 11 +#define RCC_USB_RSTREQ_POS 12 +//================================ + +typedef union //0x024 +{ + struct + { + uint32_t BTMR_RSTREQ: 1; // bit0 + uint32_t CTMR_RSTREQ: 1; // bit1 + uint32_t ATMR_RSTREQ: 1; // bit2 + uint32_t UART1_RSTREQ: 1; // bit3 + uint32_t UART2_RSTREQ: 1; // bit4 + uint32_t RSV_NOUSE1: 1; // bit5 --- Ignore me + uint32_t DMAC_RSTREQ: 1; // bit6 + uint32_t RSV_NOUSE2: 1; // bit7 --- Ignore me + uint32_t EXTI_RSTREQ: 1; // bit8 + uint32_t I2C_RSTREQ: 1; // bit9 + uint32_t RSV_NOUSE3: 1; // bit10 ---Ignore me + uint32_t MDM_RSTREQ: 1; // bit11 + uint32_t RF_RSTREQ: 1; // bit12 + uint32_t PLL_CAL_RSTREQ: 1; // bit13 + uint32_t RCCALIB_RSTREQ: 1; // bit14 + uint32_t RC16M_CNT_RSTREQ: 1; // bit15 + uint32_t BLE_LOW_CLK_RSTREQ: 1; // bit16 + uint32_t RTC_RST_REQ: 1; // bit17 --- + // 1:soft reset RTC + uint32_t RSV_END: 14; // bit[31:18] + }; + uint32_t Word; +} RCC_APBRST_CTRL_TypeDef; //0x024 + + +//================================ +#define RCC_BTMR_RSTREQ_POS 0 +#define RCC_CTMR_RSTREQ_POS 1 +#define RCC_ATMR_RSTREQ_POS 2 +#define RCC_UART1_RSTREQ_POS 3 +#define RCC_UART2_RSTREQ_POS 4 +#define RCC_DMAC_RSTREQ_POS 6 +#define RCC_EXTI_RSTREQ_POS 8 +#define RCC_I2C_RSTREQ_POS 9 +#define RCC_MDM_RSTREQ_POS 11 +#define RCC_RF_RSTREQ_POS 12 +#define RCC_PLL_CAL_RSTREQ_POS 13 +#define RCC_RCCALIB_RSTREQ_POS 14 +#define RCC_RC16M_CNT_RSTREQ_POS 15 +#define RCC_BLE_LOW_CLK_RSTREQ_POS 16 +#define RCC_RTC_RST_REQ_POS 17 +//================================ + +typedef union //0x028 +{ + struct + { + uint32_t RCC_CLKEN_RUN: 1; // bit0 + uint32_t SYSCFG_CLKEN_RUN: 1; // bit1 + uint32_t RSV_NOUSE1: 2; // bit[3:2] --- Ignore me + uint32_t SPIM_CLKEN_RUN: 1; // bit4 + uint32_t SPIS_CLKEN_RUN: 1; // bit5 + uint32_t FSHC_CLKEN_RUN: 1; // bit6 + uint32_t ADC_CLKEN_RUN: 1; // bit7 + uint32_t RSV_NOUSE2: 1; // bit8 --- Ignore me + uint32_t AHB2P1_CLKEN_RUN: 1; // bit9 --- use for ahb2apb1 bridge + uint32_t AHB2P2_CLKEN_RUN: 1; // bit10 --- use for ahb2apb2 bridge + uint32_t CACHE_CLKEN_RUN: 1; // bit11 + uint32_t USB_CLKEN_RUN: 1; // bit12 + uint32_t RSV_END: 19; // bit[31:13] + }; + uint32_t Word; +} RCC_AHBCLK_EN_RUN_TypeDef; //0x028 + + +//================================ +#define RCC_RCC_CLKEN_RUN_POS 0 +#define RCC_SYSCFG_CLKEN_RUN_POS 1 +#define RCC_SPIM_CLKEN_RUN_POS 4 +#define RCC_SPIS_CLKEN_RUN_POS 5 +#define RCC_FSHC_CLKEN_RUN_POS 6 +#define RCC_ADC_CLKEN_RUN_POS 7 +#define RCC_AHB2P1_CLKEN_RUN_POS 9 +#define RCC_AHB2P2_CLKEN_RUN_POS 10 +#define RCC_CACHE_CLKEN_RUN_POS 11 +#define RCC_USB_CLKEN_RUN_POS 12 +//================================ + +typedef union //0x02c +{ + struct + { + uint32_t BTMR_CLKEN_RUN: 1; // bit0 + uint32_t CTMR_CLKEN_RUN: 1; // bit1 + uint32_t ATMR_CLKEN_RUN: 1; // bit2 + uint32_t UART1_CLKEN_RUN: 1; // bit3 + uint32_t UART2_CLKEN_RUN: 1; // bit4 + uint32_t RSV_NOUSE1: 1; // bit5 --- Ignore me + uint32_t DMAC_CLKEN_RUN: 1; // bit6 + uint32_t RSV_NOUSE2: 1; // bit7 --- Ignore me + uint32_t EXTI_CLKEN_RUN: 1; // bit8 + uint32_t I2C_CLKEN_RUN: 1; // bit9 + uint32_t IWDT_CLKEN_RUN: 1; // bit10 + uint32_t MDM_CLKEN_RUN: 1; // bit11 + uint32_t RF_CLKEN_RUN: 1; // bit12 + uint32_t RSV_NOUSE3: 3; // bit[15:13] --- Ignore me + uint32_t AON_CLKEN_RUN: 1; // bit16 + uint32_t APBMISC_CLKEN_RUN: 1; // bit17 + uint32_t RSV_END: 14; // bit[31:18] + }; + uint32_t Word; +} RCC_APBCLK_EN_RUN_TypeDef; //0x02c + + +//================================ +#define RCC_BTMR_CLKEN_RUN_POS 0 +#define RCC_CTMR_CLKEN_RUN_POS 1 +#define RCC_ATMR_CLKEN_RUN_POS 2 +#define RCC_UART1_CLKEN_RUN_POS 3 +#define RCC_UART2_CLKEN_RUN_POS 4 +#define RCC_DMAC_CLKEN_RUN_POS 6 +#define RCC_EXTI_CLKEN_RUN_POS 8 +#define RCC_I2C_CLKEN_RUN_POS 9 +#define RCC_IWDT_CLKEN_RUN_POS 10 +#define RCC_MDM_CLKEN_RUN_POS 11 +#define RCC_RF_CLKEN_RUN_POS 12 +#define RCC_AON_CLKEN_RUN_POS 16 +#define RCC_APBMISC_CLKEN_RUN_POS 17 +//================================ + +typedef union //0x030 +{ + struct + { + uint32_t RCC_CLKEN_SLEEP: 1; // bit0 + uint32_t SYSCFG_CLKEN_SLEEP: 1; // bit1 + uint32_t RSV_NOUSE1: 2; // bit[3:2] --- Ignore me + uint32_t SPIM_CLKEN_SLEEP: 1; // bit4 + uint32_t SPIS_CLKEN_SLEEP: 1; // bit5 + uint32_t FSHC_CLKEN_SLEEP: 1; // bit6 + uint32_t ADC_CLKEN_SLEEP: 1; // bit7 + uint32_t RSV_NOUSE2: 1; // bit8 --- Ignore me + uint32_t AHB2P1_CLKEN_SLEEP: 1; // bit9 --- use for ahb2apb1 bridge + uint32_t AHB2P2_CLKEN_SLEEP: 1; // bit10 --- use for ahb2apb2 bridge + uint32_t CACHE_CLKEN_SLEEP: 1; // bit11 + uint32_t USB_CLKEN_SLEEP: 1; // bit12 + uint32_t RSV_END: 19; // bit[31:13] + }; + uint32_t Word; +} RCC_AHBCLK_EN_SLEEP_TypeDef; //0x030 + + +//================================ +#define RCC_RCC_CLKEN_SLEEP_POS 0 +#define RCC_SYSCFG_CLKEN_SLEEP_POS 1 +#define RCC_SPIM_CLKEN_SLEEP_POS 4 +#define RCC_SPIS_CLKEN_SLEEP_POS 5 +#define RCC_FSHC_CLKEN_SLEEP_POS 6 +#define RCC_ADC_CLKEN_SLEEP_POS 7 +#define RCC_AHB2P1_CLKEN_SLEEP_POS 9 +#define RCC_AHB2P2_CLKEN_SLEEP_POS 10 +#define RCC_CACHE_CLKEN_SLEEP_POS 11 +#define RCC_USB_CLKEN_SLEEP_POS 12 +//================================ + +typedef union //0x034 +{ + struct + { + uint32_t BTMR_CLKEN_SLEEP: 1; // bit0 + uint32_t CTMR_CLKEN_SLEEP: 1; // bit1 + uint32_t ATMR_CLKEN_SLEEP: 1; // bit2 + uint32_t UART1_CLKEN_SLEEP: 1; // bit3 + uint32_t UART2_CLKEN_SLEEP: 1; // bit4 + uint32_t RSV_NOUSE1: 1; // bit5 --- Ignore me + uint32_t DMAC_CLKEN_SLEEP: 1; // bit6 + uint32_t RSV_NOUSE2: 1; // bit7 --- Ignore me + uint32_t EXTI_CLKEN_SLEEP: 1; // bit8 + uint32_t I2C_CLKEN_SLEEP: 1; // bit9 + uint32_t IWDT_CLKEN_SLEEP: 1; // bit10 + uint32_t MDM_CLKEN_SLEEP: 1; // bit11 + uint32_t RF_CLKEN_SLEEP: 1; // bit12 + uint32_t RSV_NOUSE3: 3; // bit[15:13] --- Ignore me + uint32_t AON_CLKEN_SLEEP: 1; // bit16 + uint32_t APBMISC_CLKEN_SLEEP: 1; // bit17 + uint32_t RSV_END: 14; // bit[31:18] + }; + uint32_t Word; +} RCC_APBCLK_EN_SLEEP_TypeDef; //0x034 + + +//================================ +#define RCC_BTMR_CLKEN_SLEEP_POS 0 +#define RCC_CTMR_CLKEN_SLEEP_POS 1 +#define RCC_ATMR_CLKEN_SLEEP_POS 2 +#define RCC_UART1_CLKEN_SLEEP_POS 3 +#define RCC_UART2_CLKEN_SLEEP_POS 4 +#define RCC_DMAC_CLKEN_SLEEP_POS 6 +#define RCC_EXTI_CLKEN_SLEEP_POS 8 +#define RCC_I2C_CLKEN_SLEEP_POS 9 +#define RCC_IWDT_CLKEN_SLEEP_POS 10 +#define RCC_MDM_CLKEN_SLEEP_POS 11 +#define RCC_RF_CLKEN_SLEEP_POS 12 +#define RCC_AON_CLKEN_SLEEP_POS 16 +#define RCC_APBMISC_CLKEN_SLEEP_POS 17 +//================================ + +typedef union //0x038 +{ + struct + { + uint32_t RCC_CLKEN_DPSLEEP: 1; // bit0 + uint32_t SYSCFG_CLKEN_DPSLEEP: 1; // bit1 + uint32_t RSV_NOUSE1: 2; // bit[3:2] --- Ignore me + uint32_t SPIM_CLKEN_DPSLEEP: 1; // bit4 + uint32_t SPIS_CLKEN_DPSLEEP: 1; // bit5 + uint32_t FSHC_CLKEN_DPSLEEP: 1; // bit6 + uint32_t ADC_CLKEN_DPSLEEP: 1; // bit7 + uint32_t RSV_NOUSE2: 1; // bit8 --- Ignore me + uint32_t AHB2P1_CLKEN_DPSLEEP: 1; // bit9 --- use for ahb2apb1 bridge + uint32_t AHB2P2_CLKEN_DPSLEEP: 1; // bit10 --- use for ahb2apb2 bridge + uint32_t CACHE_CLKEN_DPSLEEP: 1; // bit11 + uint32_t USB_CLKEN_DPSLEEP: 1; // bit12 + uint32_t RSV_END: 19; // bit[31:13] + }; + uint32_t Word; +} RCC_AHBCLK_EN_DPSLEEP_TypeDef; //0x038 + + +//================================ +#define RCC_RCC_CLKEN_DPSLEEP_POS 0 +#define RCC_SYSCFG_CLKEN_DPSLEEP_POS 1 +#define RCC_SPIM_CLKEN_DPSLEEP_POS 4 +#define RCC_SPIS_CLKEN_DPSLEEP_POS 5 +#define RCC_FSHC_CLKEN_DPSLEEP_POS 6 +#define RCC_ADC_CLKEN_DPSLEEP_POS 7 +#define RCC_AHB2P1_CLKEN_DPSLEEP_POS 9 +#define RCC_AHB2P2_CLKEN_DPSLEEP_POS 10 +#define RCC_CACHE_CLKEN_DPSLEEP_POS 11 +#define RCC_USB_CLKEN_DPSLEEP_POS 12 +//================================ + +typedef union //0x03c +{ + struct + { + uint32_t BTMR_CLKEN_DPSLEEP: 1; // bit0 + uint32_t CTMR_CLKEN_DPSLEEP: 1; // bit1 + uint32_t ATMR_CLKEN_DPSLEEP: 1; // bit2 + uint32_t UART1_CLKEN_DPSLEEP: 1; // bit3 + uint32_t UART2_CLKEN_DPSLEEP: 1; // bit4 + uint32_t RSV_NOUSE1: 1; // bit5 --- Ignore me + uint32_t DMAC_CLKEN_DPSLEEP: 1; // bit6 + uint32_t RSV_NOUSE2: 1; // bit7 --- Ignore me + uint32_t EXTI_CLKEN_DPSLEEP: 1; // bit8 + uint32_t I2C_CLKEN_DPSLEEP: 1; // bit9 + uint32_t IWDT_CLKEN_DPSLEEP: 1; // bit10 + uint32_t MDM_CLKEN_DPSLEEP: 1; // bit11 + uint32_t RF_CLKEN_DPSLEEP: 1; // bit12 + uint32_t RSV_NOUSE3: 3; // bit[15:13] --- Ignore me + uint32_t AON_CLKEN_DPSLEEP: 1; // bit16 + uint32_t APBMISC_CLKEN_DPSLEEP: 1; // bit17 + uint32_t RSV_END: 14; // bit[31:18] + }; + uint32_t Word; +} RCC_APBCLK_EN_DPSLEEP_TypeDef; //0x03c + + +//================================ +#define RCC_BTMR_CLKEN_DPSLEEP_POS 0 +#define RCC_CTMR_CLKEN_DPSLEEP_POS 1 +#define RCC_ATMR_CLKEN_DPSLEEP_POS 2 +#define RCC_UART1_CLKEN_DPSLEEP_POS 3 +#define RCC_UART2_CLKEN_DPSLEEP_POS 4 +#define RCC_DMAC_CLKEN_DPSLEEP_POS 6 +#define RCC_EXTI_CLKEN_DPSLEEP_POS 8 +#define RCC_I2C_CLKEN_DPSLEEP_POS 9 +#define RCC_IWDT_CLKEN_DPSLEEP_POS 10 +#define RCC_MDM_CLKEN_DPSLEEP_POS 11 +#define RCC_RF_CLKEN_DPSLEEP_POS 12 +#define RCC_AON_CLKEN_DPSLEEP_POS 16 +#define RCC_APBMISC_CLKEN_DPSLEEP_POS 17 +//================================ + +typedef union //0x040 +{ + struct + { + uint32_t BLE_AHB_RSTREQ: 1; // bit0 + uint32_t BLE_CRYPT_RSTREQ: 1; // bit1 + uint32_t BLE_MASTER_RSTREQ: 1; // bit2 + uint32_t BLE_AHBEN: 1; // bit3 + uint32_t BLECLK_DIV: 2; // bit[5:4] --- BLE master clock source select + // 0: CPU_HCLK, used when system clock select as HSE clock; + // 1: CPU_HCLK/2, used when system clock is select as PLL 64M, and hclk_scal config as /2 + // 2: CPU_HCLK/3, used when system clock is select as PLL 48M, + // 3: CPU_HCLK/4, used when system clock is select as PLL 64M, + uint32_t RSV_END: 26; // bit[31:6] + }; + uint32_t Word; +} RCC_BLE_CLKRST_CTRL_TypeDef; //0x040 + + +//================================ +#define RCC_BLE_AHB_RSTREQ_POS 0 +#define RCC_BLE_CRYPT_RSTREQ_POS 1 +#define RCC_BLE_MASTER_RSTREQ_POS 2 +#define RCC_BLE_AHBEN_POS 3 +#define RCC_BLECLK_DIV_LSB 4 +#define RCC_BLECLK_DIV_WIDTH 2 +//================================ + +typedef union //0x044 +{ + struct + { + uint32_t POR12_BK_FLG: 1; // bit0 + uint32_t LVD33_OUT_RST_FLG: 1; // bit1 + uint32_t BOD12_OUT_RST_FLG: 1; // bit2 + uint32_t PIN_RSTN_FLG: 1; // bit3 + uint32_t POR12_CORE_FLG: 1; // bit4 + uint32_t IWDTRST_FLG: 1; // bit5 + uint32_t CHIPRST_FLG: 1; // bit6 + uint32_t SYSRST_FLG: 1; // bit7 + uint32_t POR12_BK_FLG_CLR: 1; // bit8 + uint32_t LVD33_OUT_RST_FLG_CLR: 1; // bit9 + uint32_t BOD12_OUT_RST_FLG_CLR: 1; // bit10 + uint32_t PIN_RSTN_FLG_CLR: 1; // bit11 + uint32_t POR12_CORE_FLG_CLR: 1; // bit12 + uint32_t IWDTRST_FLG_CLR: 1; // bit13 + uint32_t CHIPRST_FLG_CLR: 1; // bit14 + uint32_t SYSRST_FLG_CLR: 1; // bit15 + uint32_t RSV_END: 16; // bit[31:16] + }; + uint32_t Word; +} RCC_CHIP_RST_ST_CLR_TypeDef; //0x044 + + +//================================ +#define RCC_POR12_BK_FLG_POS 0 +#define RCC_LVD33_OUT_RST_FLG_POS 1 +#define RCC_BOD12_OUT_RST_FLG_POS 2 +#define RCC_PIN_RSTN_FLG_POS 3 +#define RCC_POR12_CORE_FLG_POS 4 +#define RCC_IWDTRST_FLG_POS 5 +#define RCC_CHIPRST_FLG_POS 6 +#define RCC_SYSRST_FLG_POS 7 +#define RCC_POR12_BK_FLG_CLR_POS 8 +#define RCC_LVD33_OUT_RST_FLG_CLR_POS 9 +#define RCC_BOD12_OUT_RST_FLG_CLR_POS 10 +#define RCC_PIN_RSTN_FLG_CLR_POS 11 +#define RCC_POR12_CORE_FLG_CLR_POS 12 +#define RCC_IWDTRST_FLG_CLR_POS 13 +#define RCC_CHIPRST_FLG_CLR_POS 14 +#define RCC_SYSRST_FLG_CLR_POS 15 +//================================ + +//================================ +//BLOCK RCC top struct define +typedef struct +{ + __IO RCC_CLK_EN_ST_TypeDef CLK_EN_ST ; // 0x000, + __IO uint32_t AHBCLK_DIV ; // 0x004, + // ahb clock div value: value arange : 0 ~255 + // ahb_clk = sys_clk/(ahbclk_div+1); + // default is ahb_clk = sys_clk; + __IO uint32_t APB1CLK_DIV ; // 0x008, + // apb1 clock div value: value arange : 0 ~255 + // apb1_clk = ahb_clk/(apb1clk_div+1); + // default is apb1_clk = ahb_clk; + __IO uint32_t APB2CLK_DIV ; // 0x00c, + // apb2 clock div value: value arange : 0 ~255 + // apb2_clk = ahb_clk/(apb2clk_div+1); + // default is apb2_clk = ahb_clk; + // Note: maske sure the apb2_clk is not large than 16M + // that means : + // when sys_clk is DPLL 64M, the apb2clk_div must set as 8'h3 + __IO RCC_CFG_TypeDef CFG ; // 0x010, + __IO uint32_t STCALIB ; // 0x014, + __IO RCC_HSE_DET_CTRL_TypeDef HSE_DET_CTRL ; // 0x018, + __I uint32_t RSV ; // 0x01c, + __IO RCC_AHBRST_CTRL_TypeDef AHBRST_CTRL ; // 0x020, + __IO RCC_APBRST_CTRL_TypeDef APBRST_CTRL ; // 0x024, + __IO RCC_AHBCLK_EN_RUN_TypeDef AHBCLK_EN_RUN ; // 0x028, + // this reg is used when CPU is normal running mode + __IO RCC_APBCLK_EN_RUN_TypeDef APBCLK_EN_RUN ; // 0x02c, + // this reg is used when CPU is normal running mode + __IO RCC_AHBCLK_EN_SLEEP_TypeDef AHBCLK_EN_SLEEP ; // 0x030, + // this reg is used when CPU is sleeping mode + __IO RCC_APBCLK_EN_SLEEP_TypeDef APBCLK_EN_SLEEP ; // 0x034, + // this reg is used when CPU is sleeping mode + __IO RCC_AHBCLK_EN_DPSLEEP_TypeDef AHBCLK_EN_DPSLEEP ; // 0x038, + // this reg is used when CPU is Deepsleep mode + __IO RCC_APBCLK_EN_DPSLEEP_TypeDef APBCLK_EN_DPSLEEP ; // 0x03c, + // this reg is used when CPU is Deepsleep mode + __IO RCC_BLE_CLKRST_CTRL_TypeDef BLE_CLKRST_CTRL ; // 0x040, + __IO RCC_CHIP_RST_ST_CLR_TypeDef CHIP_RST_ST_CLR ; // 0x044, +} RCC_TypeDef; + + +#define RCC (( RCC_TypeDef *) RCC_BASE) + +#endif diff --git a/core/reg/reg_rf.h b/core/reg/reg_rf.h new file mode 100644 index 0000000..bb70f2d --- /dev/null +++ b/core/reg/reg_rf.h @@ -0,0 +1,1268 @@ +#ifndef _REG_RF_H_ +#define _REG_RF_H_ + +#include "reg_base.h" + +//================================ +//BLOCK RF define + +#define RF_BASE ((uint32_t)0x4002C000) +#define RF_DIG_CTRL_ADDR_OFFSET 0x000 +#define RF_PLL_TAB_OFFSET_ADDR_OFFSET 0x004 +#define RF_PLL_GAIN_CTRL_ADDR_OFFSET 0x008 +#define RF_RSSI_CTRL_ADDR_OFFSET 0x00c +#define RF_PLL_DAC_TAB0_ADDR_OFFSET 0x010 +#define RF_PLL_CAL_ST_ADDR_OFFSET 0x014 +#define RF_PLL_FREQ_CTRL_ADDR_OFFSET 0x018 +#define RF_PLL_DYM_CTRL_ADDR_OFFSET 0x01c +#define RF_FSM_DLY_CTRL0_ADDR_OFFSET 0x020 +#define RF_FSM_DLY_CTRL1_ADDR_OFFSET 0x024 +#define RF_PLL_CAL_DAC_STEP_ADDR_OFFSET 0x028 +#define RF_PLL_GAIN_CAL_VAL_ADDR_OFFSET 0x02c +#define RF_PLL_DAC_TAB1_ADDR_OFFSET 0x030 +#define RF_PLL_DAC_TAB2_ADDR_OFFSET 0x034 +#define RF_DATA_DLY_CTRL_ADDR_OFFSET 0x038 +#define RF_TX_CH_MAP_ADDR_OFFSET 0x03c +#define RF_RX_CHIDX37_MAP_ADDR_OFFSET 0x040 +#define RF_RX_CHIDX38_MAP_ADDR_OFFSET 0x044 +#define RF_RX_CHIDX39_MAP_ADDR_OFFSET 0x048 +#define RF_BPFMIX_CTRL_ADDR_OFFSET 0x04c +#define RF_AGC_CTRL0_ADDR_OFFSET 0x050 +#define RF_AGC_CTRL1_ADDR_OFFSET 0x054 +#define RF_AGC_CTRL2_ADDR_OFFSET 0x058 +#define RF_ANA_TRIM_ADDR_OFFSET 0x05c +#define RF_ANAMISC_CTRL1_ADDR_OFFSET 0x060 +#define RF_ANA_PWR_CTRL_ADDR_OFFSET 0x064 +#define RF_ANA_EN_CTRL_ADDR_OFFSET 0x068 +#define RF_PLL_ANA_CTRL_ADDR_OFFSET 0x06c +#define RF_RF_RSV_ADDR_OFFSET 0x070 +#define RF_RF_ANA_ST0_ADDR_OFFSET 0x074 + +//================================ +//BLOCK RF reg struct define +typedef union //0x000 +{ + struct + { + uint32_t ANA_TEST_EN: 1; // bit0 --- + // 0: RF ANALOG digital input is controlled by rfdig_gsm + // 1: RF ANALOG digital input is controlled by reg + uint32_t LDO_TEST_EN: 1; // bit1 --- + // 0: analog block power is controlled by RF Dig FSM + // 1: analog block power is controlled by reg + uint32_t PLL_CAL_TEST_EN: 1; // bit2 --- + // 0: PLL AFC & GAIN CAL controlled by rf_pll_cal module + // 1: PLL AFC & GAIN CAL directed controlled by reg + uint32_t FSM_CTRL_SEL: 1; // bit3 --- + // 0: RF Dig FSM input signal is from BB + // 1: RF Dig FSM input signal is from rf_reg + // : channel number + // : rate + // : tx_en + // : rx_en + uint32_t PA_GAIN_TARGET_SEL: 1; // bit4 --- + // 0: the pa_gain_target is from BB + // 1: the pa_gain_target is from sw_pa_gain_target + uint32_t PLL_AFC_BY: 1; // bit5 --- + // 0: rfdig FSM start AFC calib + // 1: rfdig FSM bypass AFC calib, + uint32_t PLL_BPF_CAL_BY: 1; // bit6 --- + // 0: rfdig FSM start BPF calib + // 1: rfdig FSM bypass BPF calib, + uint32_t PLL_FREQ_SEL: 1; // bit7 --- + // 0: PLL frequency is controlled by channel number + // PLL_RTX_SEL is controlled by PLL_RTX_SEL_REG + // 1: PLL frequency is controlled by reg sw_di_s & sw_frac + // PLL_RTX_SEL is controlled by fsm_pll_rtx_sel + uint32_t PLL_FREQ_EXT_EN: 1; // bit8 --- + // 0: PLL_FREQ_ADJ[4:0] is driven by AFC Calib logic + // 1: PLL_FREQ_ADJ[4:0] is driven by PLL_FREQ_EXT + uint32_t PLL_GAIN_CAL_BY: 1; // bit9 --- + // 0: rfdig FSM start PLL GAIN calib + // 1: rfdig FSM bypass PLL GAIN calib + uint32_t PLL_VTXD_EXT_EN: 1; // bit10 --- + // 0: PLL_DAC_ADJ[4:0] is driven by GAIN Calib logic + // 1: PLL_DAC_ADJ[4:0] is driven by PLL_VTXD_EXT + uint32_t PLL_GAIN_CAL_STEP: 1; // bit11 --- + // 1: MCU step by step debug PLL GAIN CAL + // note: only effect when pll_gain_cal_by is 1 + uint32_t PLL_GAIN_CAL_TAB: 1; // bit12 --- + // active when pll_gain_cal_by is 1 and pll_vtxd_ext_en is 0 & pll_gain_cal_step is 0 + // 1: PLL_DAC_ADJ[4:0] is driven by lookup table + uint32_t PLL_GAIN_CAL_MODE: 2; // bit[14:13] --- + // 0,1 : dividor 2 , calib start from 5'h10 + // 2: use the lookup table out, and detect the df1 error + // with pll_gain_cal_th, when df1 error is too larger than pll_gain_cal_dac_step + // just report pll_gain_cal_err state; + // the pll_gain_cal_err state is cleared when next time of tx_en is 1, or + // 3: use the lookup table out as gain cal start value, and then detect the df1 err + // the final calib out = table_out + df1 err / pll_gain_cal_dac_step + uint32_t PLL_AFC_ROUND: 1; // bit15 --- + // 0: floor result + uint32_t PLL_AFC_STEP: 1; // bit16 --- + // 1: MCU step by step debug PLL AFC + // note: only effect when pll_afc_by is 1 + uint32_t PLL_FREQ_DC: 3; // bit[19:17] --- + // DC offset used for AFC calib done + // signed data: -4 ~ 3 + // 1: round result + uint32_t PLL_AFC_MODE: 1; // bit20 --- + // 0: set hbw_en as 1 when AFC is done + // 1: don't set hbw_en as 1 when AFC is done + // note: set as 1 before makesure pll_gain_cal_by is 0 + uint32_t PLL_AFC_FRAC_EN: 1; // bit21 --- + // 1: use PLL_FRAC[23] + uint32_t SW_PLL_CAL_CLKEN: 1; // bit22 --- + // enable PLL AFC & GAIN CAL clock by MCU + // set as 1 when pll_afc_by or pll_gain_cal_by is 1 + uint32_t SW_AFC_EN: 1; // bit23 --- + // 1: PLL AFC Calibration start work + // note: only effect when pll_afc_by is 1 + uint32_t SW_GAIN_CAL_EN: 1; // bit24 --- + // 1: PLL GAIN Calibration start work + // note: only effect when pll_gain_cal_by is 1 + uint32_t SW_PLL_VREF_SEL: 1; // bit25 --- + // use to control DAC_VREF_SEL when pll_gain_cal_step is 1 + // or used when pll_cal_test_en is 1 + uint32_t SW_PLL_HBW_EN: 1; // bit26 --- + // 0: HBW_EN is driven by pll_cal logic + // 1: software set PLL is in HBW_EN as 1 + uint32_t SDM_FRAC_INT_MODE: 1; // bit27 --- + uint32_t PLL_CAL_ERR_CLR: 1; // bit28 --- + uint32_t CAL_ERR_INT_EN: 1; // bit29 --- + // rf_int = cal_err_int_en & pll_gain_cal_err + uint32_t RF_DBG_SEL: 2; // bit[31:30] --- + // 2'b01: tx debug port + // 2'b10: rx debug port + }; + uint32_t Word; +} RF_DIG_CTRL_TypeDef; //0x000 + + +//================================ +#define RF_ANA_TEST_EN_POS 0 +#define RF_LDO_TEST_EN_POS 1 +#define RF_PLL_CAL_TEST_EN_POS 2 +#define RF_FSM_CTRL_SEL_POS 3 +#define RF_PA_GAIN_TARGET_SEL_POS 4 +#define RF_PLL_AFC_BY_POS 5 +#define RF_PLL_BPF_CAL_BY_POS 6 +#define RF_PLL_FREQ_SEL_POS 7 +#define RF_PLL_FREQ_EXT_EN_POS 8 +#define RF_PLL_GAIN_CAL_BY_POS 9 +#define RF_PLL_VTXD_EXT_EN_POS 10 +#define RF_PLL_GAIN_CAL_STEP_POS 11 +#define RF_PLL_GAIN_CAL_TAB_POS 12 +#define RF_PLL_GAIN_CAL_MODE_LSB 13 +#define RF_PLL_GAIN_CAL_MODE_WIDTH 2 +#define RF_PLL_AFC_ROUND_POS 15 +#define RF_PLL_AFC_STEP_POS 16 +#define RF_PLL_FREQ_DC_LSB 17 +#define RF_PLL_FREQ_DC_WIDTH 3 +#define RF_PLL_AFC_MODE_POS 20 +#define RF_PLL_AFC_FRAC_EN_POS 21 +#define RF_SW_PLL_CAL_CLKEN_POS 22 +#define RF_SW_AFC_EN_POS 23 +#define RF_SW_GAIN_CAL_EN_POS 24 +#define RF_SW_PLL_VREF_SEL_POS 25 +#define RF_SW_PLL_HBW_EN_POS 26 +#define RF_SDM_FRAC_INT_MODE_POS 27 +#define RF_PLL_CAL_ERR_CLR_POS 28 +#define RF_CAL_ERR_INT_EN_POS 29 +#define RF_RF_DBG_SEL_LSB 30 +#define RF_RF_DBG_SEL_WIDTH 2 +//================================ + +typedef union //0x004 +{ + struct + { + uint32_t TX_FRAC_OFFSET: 10; // bit[9:0] --- + // signed data, unit : 1MHz/1024, near as 1KHz + // arrange: -512KHz ~ 511 KHz + uint32_t RX_FRAC_OFFSET: 10; // bit[19:10] --- + // signed data, unit : 1MHz/1024, near as 1KHz + // arrange: -512KHz ~ 511 KHz + uint32_t PLL_FREQ_EXT: 6; // bit[25:20] --- + // used when pll_freq_ext_en or pll_afc_step is 1 + uint32_t RSV_END: 6; // bit[31:26] + }; + uint32_t Word; +} RF_PLL_TAB_OFFSET_TypeDef; //0x004 + + +//================================ +#define RF_TX_FRAC_OFFSET_LSB 0 +#define RF_TX_FRAC_OFFSET_WIDTH 10 +#define RF_RX_FRAC_OFFSET_LSB 10 +#define RF_RX_FRAC_OFFSET_WIDTH 10 +#define RF_PLL_FREQ_EXT_LSB 20 +#define RF_PLL_FREQ_EXT_WIDTH 6 +//================================ + +typedef union //0x008 +{ + struct + { + uint32_t PLL_VTXD_EXT: 6; // bit[5:0] --- + // used when pll_vtxd_ext_en or pll_gain_cal_step is 1 + uint32_t PLL_GAIN_CAL_DC: 3; // bit[8:6] --- + // DC offset used for GAIN CAL calib done + // signed data: -4 ~ 3 + uint32_t PLL_GAIN_CAL_WIN: 6; // bit[14:9] --- + // PLL GAIN CAL step window + // step window time : (pll_gain_cal_win + 1) us + uint32_t PLL_GAIN_CAL_TH: 12; // bit[26:15] --- + // gain cal clock : afc_clk = clk_vco/ 4 + // df1 target value is 250K, peak to peak is 2 * df1 + // K is default 80 : + // 2* df1*K /4: 2* 250K * 80 /4 = 10M + // pll_gain_cal_th : 10 * (GAIN CAL step window) + uint32_t RSV_END: 5; // bit[31:27] + }; + uint32_t Word; +} RF_PLL_GAIN_CTRL_TypeDef; //0x008 + + +//================================ +#define RF_PLL_VTXD_EXT_LSB 0 +#define RF_PLL_VTXD_EXT_WIDTH 6 +#define RF_PLL_GAIN_CAL_DC_LSB 6 +#define RF_PLL_GAIN_CAL_DC_WIDTH 3 +#define RF_PLL_GAIN_CAL_WIN_LSB 9 +#define RF_PLL_GAIN_CAL_WIN_WIDTH 6 +#define RF_PLL_GAIN_CAL_TH_LSB 15 +#define RF_PLL_GAIN_CAL_TH_WIDTH 12 +//================================ + +typedef union //0x00c +{ + struct + { + uint32_t RSSI_VAL: 8; // bit[7:0] + uint32_t AGC_LNA_GAIN: 4; // bit[11:9] + uint32_t AGC_BPF_GAIN_ADJ: 2; // bit[13:12] + uint32_t AGC_MIXL_GAIN_CTL: 1; // bit14 + uint32_t AGC_MIXH_GAIN_CTL: 1; // bit15 + uint32_t SW_RSSI_READY: 1; // bit16 + uint32_t SW_RSSI_REQ: 1; // bit17 + uint32_t RF_FSM_STATE: 5; // bit[22:18] + uint32_t RSV_END: 9; // bit[31:23] + }; + uint32_t Word; +} RF_RSSI_CTRL_TypeDef; //0x00c + + +//================================ +#define RF_RSSI_VAL_LSB 0 +#define RF_RSSI_VAL_WIDTH 8 +#define RF_AGC_LNA_GAIN_LSB 8 +#define RF_AGC_LNA_GAIN_WIDTH 4 +#define RF_AGC_BPF_GAIN_ADJ_LSB 12 +#define RF_AGC_BPF_GAIN_ADJ_WIDTH 2 +#define RF_AGC_MIXL_GAIN_CTL_POS 14 +#define RF_AGC_MIXH_GAIN_CTL_POS 15 +#define RF_SW_RSSI_READY_POS 16 +#define RF_SW_RSSI_REQ_POS 17 +#define RF_RF_FSM_STATE_LSB 18 +#define RF_RF_FSM_STATE_WIDTH 5 +//================================ + +typedef union //0x010 +{ + struct + { + uint32_t PLL_DAC_ADJ00: 6; // bit[5:0] --- + // 2402 ~ 2407 + uint32_t PLL_DAC_ADJ01: 6; // bit[11:6] --- + // 2416 ~ 2423 + uint32_t PLL_DAC_ADJ02: 6; // bit[17:12] --- + // 2432 ~ 2439 + uint32_t PLL_DAC_ADJ03: 6; // bit[23:18] --- + // 2448 ~ 2455 + uint32_t PLL_DAC_ADJ04: 6; // bit[29:24] --- + // 2464 ~ 2471 + uint32_t RSV_END: 2; // bit[31:30] + }; + uint32_t Word; +} RF_PLL_DAC_TAB0_TypeDef; //0x010 + + +//================================ +#define RF_PLL_DAC_ADJ00_LSB 0 +#define RF_PLL_DAC_ADJ00_WIDTH 6 +#define RF_PLL_DAC_ADJ01_LSB 6 +#define RF_PLL_DAC_ADJ01_WIDTH 6 +#define RF_PLL_DAC_ADJ02_LSB 12 +#define RF_PLL_DAC_ADJ02_WIDTH 6 +#define RF_PLL_DAC_ADJ03_LSB 18 +#define RF_PLL_DAC_ADJ03_WIDTH 6 +#define RF_PLL_DAC_ADJ04_LSB 24 +#define RF_PLL_DAC_ADJ04_WIDTH 6 +//================================ + +typedef union //0x014 +{ + struct + { + uint32_t AFC_CALIB_DONE: 1; // bit0 + uint32_t GAIN_CALIB_DONE: 1; // bit1 + uint32_t PLL_FREQ_ADJ_ST: 6; // bit[7:2] + uint32_t PLL_GAIN_CAL_ST: 6; // bit[13:8] + uint32_t CALIB_CNT_RPT: 16; // bit[29:14] + uint32_t PLL_GAIN_CAL_ERR: 1; // bit30 --- + // when pll_gain_cal_mode is 2'b10 + // set as 1 when the df1 err is too larger than pll_gain_cal_dac_step + // ceared by next tx_en is 1 or pll_cal_err_clr is 1 + uint32_t RSV_END: 1; // bit31 + }; + uint32_t Word; +} RF_PLL_CAL_ST_TypeDef; //0x014 + + +//================================ +#define RF_AFC_CALIB_DONE_POS 0 +#define RF_GAIN_CALIB_DONE_POS 1 +#define RF_PLL_FREQ_ADJ_ST_LSB 2 +#define RF_PLL_FREQ_ADJ_ST_WIDTH 6 +#define RF_PLL_GAIN_CAL_ST_LSB 8 +#define RF_PLL_GAIN_CAL_ST_WIDTH 6 +#define RF_CALIB_CNT_RPT_LSB 14 +#define RF_CALIB_CNT_RPT_WIDTH 16 +#define RF_PLL_GAIN_CAL_ERR_POS 30 +//================================ + +typedef union //0x018 +{ + struct + { + uint32_t SW_PLL_FRAC: 24; // bit[23:0] + uint32_t SW_PLL_DI_S: 5; // bit[28:24] + uint32_t RSV_END: 3; // bit[31:29] + }; + uint32_t Word; +} RF_PLL_FREQ_CTRL_TypeDef; //0x018 + + +//================================ +#define RF_SW_PLL_FRAC_LSB 0 +#define RF_SW_PLL_FRAC_WIDTH 24 +#define RF_SW_PLL_DI_S_LSB 24 +#define RF_SW_PLL_DI_S_WIDTH 5 +//================================ + +typedef union //0x01c +{ + struct + { + uint32_t SW_CH_NUM: 6; // bit[5:0] --- + // only used when FSM_CTRL_SEL is 1 + uint32_t SW_RATE: 2; // bit[7:6] --- + // only used when FSM_CTRL_SEL is 1 + // 00: 1M + // 01: 2M + // 1x: forbidden + uint32_t SW_TX_EN: 1; // bit8 --- + // only used when FSM_CTRL_SEL is 1 + uint32_t SW_RX_EN: 1; // bit9 --- + // only used when FSM_CTRL_SEL is 1 + uint32_t SW_PA_GAIN_TARGET: 4; // bit[13:10] --- + // when ana_test is 1 + // PA_GAIN is driven by pa_gain_target + // else PA_GAIN is driven by RF Dig FSM, and ramp up to pa_gain_target + uint32_t RSV_END: 18; // bit[31:14] + }; + uint32_t Word; +} RF_PLL_DYM_CTRL_TypeDef; //0x01c + + +//================================ +#define RF_SW_CH_NUM_LSB 0 +#define RF_SW_CH_NUM_WIDTH 6 +#define RF_SW_RATE_LSB 6 +#define RF_SW_RATE_WIDTH 2 +#define RF_SW_TX_EN_POS 8 +#define RF_SW_RX_EN_POS 9 +#define RF_SW_PA_GAIN_TARGET_LSB 10 +#define RF_SW_PA_GAIN_TARGET_WIDTH 4 +//================================ + +typedef union //0x020 +{ + struct + { + uint32_t LDO_START_TIME: 4; // bit[3:0] --- + // wait RF LDO stable time (ldo_start_time + 1) us , and then select PLL_RTX_SEL value + // unit is us + // 2~10 us, default is 3us + uint32_t EN_PLL_TIME: 4; // bit[7:4] --- + // after LDO stable, delay (en_pll_time + 1) us, then enable PLL; unit : us + // 2~10 us, default is 3us + uint32_t AFC_START_TIME: 4; // bit[11:8] --- + // delay (afc_start_time +1) us to enable AFC after pll enable, + // 2~10 us, default is 3us + uint32_t BPF_START_TIME: 6; // bit[17:12] --- + // delay (bpf_start_time + 1) us to enable BPF CAL after pll enable + uint32_t TX_END_DLY_TIME: 4; // bit[21:18] --- + // delay (tx_end_dly_time + 1) us from neg of bb_tx_en to neg modem_tx_en + uint32_t RX_END_DLY_TIME: 4; // bit[25:22] --- + // delay (rx_end_dly_time + 1) us from neg of bb_rx_en to neg modem_rx_en + uint32_t TX_PA_RAMPDOWN_TIME: 4; // bit[29:26] --- + // delay (tx_pa_rampdown_time+1) us to start PA RAMPDOWN after neg of modem_tx_en + uint32_t RSV_END: 2; // bit[31:30] + }; + uint32_t Word; +} RF_FSM_DLY_CTRL0_TypeDef; //0x020 + + +//================================ +#define RF_LDO_START_TIME_LSB 0 +#define RF_LDO_START_TIME_WIDTH 4 +#define RF_EN_PLL_TIME_LSB 4 +#define RF_EN_PLL_TIME_WIDTH 4 +#define RF_AFC_START_TIME_LSB 8 +#define RF_AFC_START_TIME_WIDTH 4 +#define RF_BPF_START_TIME_LSB 12 +#define RF_BPF_START_TIME_WIDTH 6 +#define RF_TX_END_DLY_TIME_LSB 18 +#define RF_TX_END_DLY_TIME_WIDTH 4 +#define RF_RX_END_DLY_TIME_LSB 22 +#define RF_RX_END_DLY_TIME_WIDTH 4 +#define RF_TX_PA_RAMPDOWN_TIME_LSB 26 +#define RF_TX_PA_RAMPDOWN_TIME_WIDTH 4 +//================================ + +typedef union //0x024 +{ + struct + { + uint32_t LNA_START_TIME: 8; // bit[7:0] --- + // delay (lna_start_time +1) us to enable + // LNA, MIX, BPF, LMT, RSSI + // after pll enable + uint32_t EN_PA_TIME: 8; // bit[15:8] --- + // delay (enpa_time +1) us to enable PA_GAIN after tx enable + // unit : us + // Note: make sure en_pa_time is larger than afc_start_time + uint32_t AGC_START_TIME: 4; // bit[19:16] --- + // delay (agc_start_time +1) us to enable AGC after enable LNA & MIXER + uint32_t PA_STARTUP_TIME: 4; // bit[23:20] --- + // start PA rampup time after PA GAIN enable + // unit : us + uint32_t PA_STEP_TIME: 4; // bit[27:24] --- + // PA GAIN step time, unit : 0.5us + // step time : 0.5* ( pa_step_time + 1 ) us + // 0.5 ~ 8us + // 0: is forbidden + uint32_t RSV_END: 4; // bit[31:28] + }; + uint32_t Word; +} RF_FSM_DLY_CTRL1_TypeDef; //0x024 + + +//================================ +#define RF_LNA_START_TIME_LSB 0 +#define RF_LNA_START_TIME_WIDTH 8 +#define RF_EN_PA_TIME_LSB 8 +#define RF_EN_PA_TIME_WIDTH 8 +#define RF_AGC_START_TIME_LSB 16 +#define RF_AGC_START_TIME_WIDTH 4 +#define RF_PA_STARTUP_TIME_LSB 20 +#define RF_PA_STARTUP_TIME_WIDTH 4 +#define RF_PA_STEP_TIME_LSB 24 +#define RF_PA_STEP_TIME_WIDTH 4 +//================================ + +typedef union //0x02c +{ + struct + { + uint32_t PLL_GAIN_CAL_DF0: 12; // bit[11:0] + uint32_t PLL_GAIN_CAL_DF1: 12; // bit[23:12] + uint32_t PLL_CAL_STATE: 5; // bit[28:24] + uint32_t RSV_END: 3; // bit[31:29] + }; + uint32_t Word; +} RF_PLL_GAIN_CAL_VAL_TypeDef; //0x02c + + +//================================ +#define RF_PLL_GAIN_CAL_DF0_LSB 0 +#define RF_PLL_GAIN_CAL_DF0_WIDTH 12 +#define RF_PLL_GAIN_CAL_DF1_LSB 12 +#define RF_PLL_GAIN_CAL_DF1_WIDTH 12 +#define RF_PLL_CAL_STATE_LSB 24 +#define RF_PLL_CAL_STATE_WIDTH 5 +//================================ + +typedef union //0x030 +{ + struct + { + uint32_t PLL_DAC_ADJ10: 6; // bit[5:0] --- + // 2408 ~ 2415 + uint32_t PLL_DAC_ADJ11: 6; // bit[11:6] --- + // 2424 ~ 2431 + uint32_t PLL_DAC_ADJ12: 6; // bit[17:12] --- + // 2440 ~ 2447 + uint32_t PLL_DAC_ADJ13: 6; // bit[23:18] --- + // 2456 ~ 2463 + uint32_t PLL_DAC_ADJ14: 6; // bit[29:24] --- + // 2472 ~ 2479 + uint32_t RSV_END: 2; // bit[31:30] + }; + uint32_t Word; +} RF_PLL_DAC_TAB1_TypeDef; //0x030 + + +//================================ +#define RF_PLL_DAC_ADJ10_LSB 0 +#define RF_PLL_DAC_ADJ10_WIDTH 6 +#define RF_PLL_DAC_ADJ11_LSB 6 +#define RF_PLL_DAC_ADJ11_WIDTH 6 +#define RF_PLL_DAC_ADJ12_LSB 12 +#define RF_PLL_DAC_ADJ12_WIDTH 6 +#define RF_PLL_DAC_ADJ13_LSB 18 +#define RF_PLL_DAC_ADJ13_WIDTH 6 +#define RF_PLL_DAC_ADJ14_LSB 24 +#define RF_PLL_DAC_ADJ14_WIDTH 6 +//================================ + +typedef union //0x034 +{ + struct + { + uint32_t PLL_DAC_ADJ05: 6; // bit[5:0] --- + // 2480 ~ 2487 + uint32_t PLL_DAC_ADJ15: 6; // bit[11:6] --- + // 2488 ~ 2495 + uint32_t RSV_END: 20; // bit[31:12] + }; + uint32_t Word; +} RF_PLL_DAC_TAB2_TypeDef; //0x034 + + +//================================ +#define RF_PLL_DAC_ADJ05_LSB 0 +#define RF_PLL_DAC_ADJ05_WIDTH 6 +#define RF_PLL_DAC_ADJ15_LSB 6 +#define RF_PLL_DAC_ADJ15_WIDTH 6 +//================================ + +typedef union //0x038 +{ + struct + { + uint32_t SDM_DAT_SEL: 1; // bit0 --- + // 0: SDM data from rf_ana + // 1: SDM data from mdm + uint32_t MDM_SDM_DATA_DLY_1M: 3; // bit[3:1] + uint32_t DAC_DATA_DLY_1M: 3; // bit[6:4] + uint32_t MDM_SDM_DATA_DLY_2M: 3; // bit[9:7] + uint32_t DAC_DATA_DLY_2M: 3; // bit[12:10] + uint32_t SDM_CLK_PH: 1; // bit13 --- + // 1: inverter the BAKIN_PFD clock for SDM + uint32_t RSV_END: 18; // bit[31:14] + }; + uint32_t Word; +} RF_DATA_DLY_CTRL_TypeDef; //0x038 + + +//================================ +#define RF_SDM_DAT_SEL_POS 0 +#define RF_MDM_SDM_DATA_DLY_1M_LSB 1 +#define RF_MDM_SDM_DATA_DLY_1M_WIDTH 3 +#define RF_DAC_DATA_DLY_1M_LSB 4 +#define RF_DAC_DATA_DLY_1M_WIDTH 3 +#define RF_MDM_SDM_DATA_DLY_2M_LSB 7 +#define RF_MDM_SDM_DATA_DLY_2M_WIDTH 3 +#define RF_DAC_DATA_DLY_2M_LSB 10 +#define RF_DAC_DATA_DLY_2M_WIDTH 3 +#define RF_SDM_CLK_PH_POS 13 +//================================ + +typedef union //0x03c +{ + struct + { + uint32_t TX_DI_S_CHIDX37: 5; // bit[4:0] + uint32_t TX_FRAC_CHIDX37: 4; // bit[8:5] --- + // high 4bits of the tx_frac[23:0], low 20bits is 0 + uint32_t RSV_NOUSE1: 1; // bit9 + uint32_t TX_DI_S_CHIDX38: 5; // bit[14:10] + uint32_t TX_FRAC_CHIDX38: 4; // bit[18:15] --- + // high 4bits of the tx_frac[23:0], low 20bits is 0 + uint32_t RSV_NOUSE2: 1; // bit19 + uint32_t TX_DI_S_CHIDX39: 5; // bit[24:20] + uint32_t TX_FRAC_CHIDX39: 4; // bit[28:25] --- + // high 4bits of the tx_frac[23:0], low 20bits is 0 + uint32_t RSV_END: 3; // bit[31:29] + }; + uint32_t Word; +} RF_TX_CH_MAP_TypeDef; //0x03c + + +//================================ +#define RF_TX_DI_S_CHIDX37_LSB 0 +#define RF_TX_DI_S_CHIDX37_WIDTH 5 +#define RF_TX_FRAC_CHIDX37_LSB 5 +#define RF_TX_FRAC_CHIDX37_WIDTH 4 +#define RF_TX_DI_S_CHIDX38_LSB 10 +#define RF_TX_DI_S_CHIDX38_WIDTH 5 +#define RF_TX_FRAC_CHIDX38_LSB 15 +#define RF_TX_FRAC_CHIDX38_WIDTH 4 +#define RF_TX_DI_S_CHIDX39_LSB 20 +#define RF_TX_DI_S_CHIDX39_WIDTH 5 +#define RF_TX_FRAC_CHIDX39_LSB 25 +#define RF_TX_FRAC_CHIDX39_WIDTH 4 +//================================ + +typedef union //0x040 +{ + struct + { + uint32_t RX_DI_S_CHIDX37: 5; // bit[4:0] + uint32_t RX_FRAC_CHIDX37: 24; // bit[28:5] + uint32_t RSV_END: 3; // bit[31:29] + }; + uint32_t Word; +} RF_RX_CHIDX37_MAP_TypeDef; //0x040 + + +//================================ +#define RF_RX_DI_S_CHIDX37_LSB 0 +#define RF_RX_DI_S_CHIDX37_WIDTH 5 +#define RF_RX_FRAC_CHIDX37_LSB 5 +#define RF_RX_FRAC_CHIDX37_WIDTH 24 +//================================ + +typedef union //0x044 +{ + struct + { + uint32_t RX_DI_S_CHIDX38: 5; // bit[4:0] + uint32_t RX_FRAC_CHIDX38: 24; // bit[28:5] + uint32_t RSV_END: 3; // bit[31:29] + }; + uint32_t Word; +} RF_RX_CHIDX38_MAP_TypeDef; //0x044 + + +//================================ +#define RF_RX_DI_S_CHIDX38_LSB 0 +#define RF_RX_DI_S_CHIDX38_WIDTH 5 +#define RF_RX_FRAC_CHIDX38_LSB 5 +#define RF_RX_FRAC_CHIDX38_WIDTH 24 +//================================ + +typedef union //0x048 +{ + struct + { + uint32_t RX_DI_S_CHIDX39: 5; // bit[4:0] + uint32_t RX_FRAC_CHIDX39: 24; // bit[28:5] + uint32_t RSV_END: 3; // bit[31:29] + }; + uint32_t Word; +} RF_RX_CHIDX39_MAP_TypeDef; //0x048 + + +//================================ +#define RF_RX_DI_S_CHIDX39_LSB 0 +#define RF_RX_DI_S_CHIDX39_WIDTH 5 +#define RF_RX_FRAC_CHIDX39_LSB 5 +#define RF_RX_FRAC_CHIDX39_WIDTH 24 +//================================ + +typedef union //0x04c +{ + struct + { + uint32_t BPF_BW_ADJ: 2; // bit[1:0] + uint32_t BPF_CAL_CODE_EXT: 6; // bit[7:2] + uint32_t BPF_CAL_CODE_EXT_EN: 1; // bit8 + uint32_t BPF_CAL_EN: 1; // bit9 --- + // only used when pll_bpf_cal_by is 1 + uint32_t BPF_CENT_ADJ: 2; // bit[11:10] + uint32_t BPF_IADJ: 3; // bit[14:12] + uint32_t BPF_MODE_SEL: 1; // bit15 + uint32_t MIXH_BIAS_CTL: 3; // bit[18:16] + uint32_t MIXH_BIAS_SEL: 1; // bit19 + uint32_t MIXH_ENB_CAP: 1; // bit20 + uint32_t MIXL_BIAS_CTL: 3; // bit[23:21] + uint32_t MIXL_BIAS_SEL: 1; // bit24 + uint32_t PA_CAP: 4; // bit[28:25] + uint32_t RSV_END: 3; // bit[31:29] + }; + uint32_t Word; +} RF_BPFMIX_CTRL_TypeDef; //0x04c + + +//================================ +#define RF_BPF_BW_ADJ_LSB 0 +#define RF_BPF_BW_ADJ_WIDTH 2 +#define RF_BPF_CAL_CODE_EXT_LSB 2 +#define RF_BPF_CAL_CODE_EXT_WIDTH 6 +#define RF_BPF_CAL_CODE_EXT_EN_POS 8 +#define RF_BPF_CAL_EN_POS 9 +#define RF_BPF_CENT_ADJ_LSB 10 +#define RF_BPF_CENT_ADJ_WIDTH 2 +#define RF_BPF_IADJ_LSB 12 +#define RF_BPF_IADJ_WIDTH 3 +#define RF_BPF_MODE_SEL_POS 15 +#define RF_MIXH_BIAS_CTL_LSB 16 +#define RF_MIXH_BIAS_CTL_WIDTH 3 +#define RF_MIXH_BIAS_SEL_POS 19 +#define RF_MIXH_ENB_CAP_POS 20 +#define RF_MIXL_BIAS_CTL_LSB 21 +#define RF_MIXL_BIAS_CTL_WIDTH 3 +#define RF_MIXL_BIAS_SEL_POS 24 +#define RF_PA_CAP_LSB 25 +#define RF_PA_CAP_WIDTH 4 +//================================ + +typedef union //0x050 +{ + struct + { + uint32_t AGC_S00H: 6; // bit[5:0] + uint32_t AGC_S00L: 6; // bit[11:6] + uint32_t AGC_S00_BPF_ADJ: 2; // bit[13:12] + uint32_t AGC_S00_LNA_ADJ: 2; // bit[15:14] + uint32_t AGC_S00_LNA_BYPS_ADJ: 1; // bit16 + uint32_t AGC_S00_LNA_EN_ADJ: 1; // bit17 + uint32_t AGC_S00_MIX_ADJ: 2; // bit[19:18] + uint32_t AGC_POWER_DET_EN: 1; // bit20 + uint32_t AGC_TEST_EN: 1; // bit21 + uint32_t AGC_TEST_S: 2; // bit[23:22] + uint32_t AGC_T_ADJ: 2; // bit[25:24] + uint32_t AGC_VH_ADD_ADJ: 2; // bit[27:26] + uint32_t DISABLE_AGC: 1; // bit28 + uint32_t RSV_END: 3; // bit[31:29] + }; + uint32_t Word; +} RF_AGC_CTRL0_TypeDef; //0x050 + + +//================================ +#define RF_AGC_S00H_LSB 0 +#define RF_AGC_S00H_WIDTH 6 +#define RF_AGC_S00L_LSB 6 +#define RF_AGC_S00L_WIDTH 6 +#define RF_AGC_S00_BPF_ADJ_LSB 12 +#define RF_AGC_S00_BPF_ADJ_WIDTH 2 +#define RF_AGC_S00_LNA_ADJ_LSB 14 +#define RF_AGC_S00_LNA_ADJ_WIDTH 2 +#define RF_AGC_S00_LNA_BYPS_ADJ_POS 16 +#define RF_AGC_S00_LNA_EN_ADJ_POS 17 +#define RF_AGC_S00_MIX_ADJ_LSB 18 +#define RF_AGC_S00_MIX_ADJ_WIDTH 2 +#define RF_AGC_POWER_DET_EN_POS 20 +#define RF_AGC_TEST_EN_POS 21 +#define RF_AGC_TEST_S_LSB 22 +#define RF_AGC_TEST_S_WIDTH 2 +#define RF_AGC_T_ADJ_LSB 24 +#define RF_AGC_T_ADJ_WIDTH 2 +#define RF_AGC_VH_ADD_ADJ_LSB 26 +#define RF_AGC_VH_ADD_ADJ_WIDTH 2 +#define RF_DISABLE_AGC_POS 28 +//================================ + +typedef union //0x054 +{ + struct + { + uint32_t AGC_S01H: 6; // bit[5:0] + uint32_t AGC_S01L: 6; // bit[11:6] + uint32_t AGC_S01_BPF_ADJ: 2; // bit[13:12] + uint32_t AGC_S01_LNA_ADJ: 2; // bit[15:14] + uint32_t AGC_S01_LNA_BYPS_ADJ: 1; // bit16 + uint32_t AGC_S01_LNA_EN_ADJ: 1; // bit17 + uint32_t AGC_S01_MIX_ADJ: 2; // bit[19:18] + uint32_t RSV_END: 12; // bit[31:20] + }; + uint32_t Word; +} RF_AGC_CTRL1_TypeDef; //0x054 + + +//================================ +#define RF_AGC_S01H_LSB 0 +#define RF_AGC_S01H_WIDTH 6 +#define RF_AGC_S01L_LSB 6 +#define RF_AGC_S01L_WIDTH 6 +#define RF_AGC_S01_BPF_ADJ_LSB 12 +#define RF_AGC_S01_BPF_ADJ_WIDTH 2 +#define RF_AGC_S01_LNA_ADJ_LSB 14 +#define RF_AGC_S01_LNA_ADJ_WIDTH 2 +#define RF_AGC_S01_LNA_BYPS_ADJ_POS 16 +#define RF_AGC_S01_LNA_EN_ADJ_POS 17 +#define RF_AGC_S01_MIX_ADJ_LSB 18 +#define RF_AGC_S01_MIX_ADJ_WIDTH 2 +//================================ + +typedef union //0x058 +{ + struct + { + uint32_t AGC_S10L: 6; // bit[5:0] + uint32_t AGC_S10_BPF_ADJ: 2; // bit[7:6] + uint32_t AGC_S10_LNA_ADJ: 2; // bit[9:8] + uint32_t AGC_S10_LNA_BYPS_ADJ: 1; // bit10 + uint32_t AGC_S10_LNA_EN_ADJ: 1; // bit11 + uint32_t AGC_S10_MIX_ADJ: 2; // bit[13:12] + uint32_t RSV_NOUSE1: 2; // bit[15:14] + uint32_t AGC_S11_BPF_ADJ: 2; // bit[17:16] + uint32_t AGC_S11_LNA_ADJ: 2; // bit[19:18] + uint32_t AGC_S11_LNA_BYPS_ADJ: 1; // bit20 + uint32_t AGC_S11_LNA_EN_ADJ: 1; // bit21 + uint32_t AGC_S11_MIX_ADJ: 2; // bit[23:22] + uint32_t RSV_END: 8; // bit[31:24] + }; + uint32_t Word; +} RF_AGC_CTRL2_TypeDef; //0x058 + + +//================================ +#define RF_AGC_S10L_LSB 0 +#define RF_AGC_S10L_WIDTH 6 +#define RF_AGC_S10_BPF_ADJ_LSB 6 +#define RF_AGC_S10_BPF_ADJ_WIDTH 2 +#define RF_AGC_S10_LNA_ADJ_LSB 8 +#define RF_AGC_S10_LNA_ADJ_WIDTH 2 +#define RF_AGC_S10_LNA_BYPS_ADJ_POS 10 +#define RF_AGC_S10_LNA_EN_ADJ_POS 11 +#define RF_AGC_S10_MIX_ADJ_LSB 12 +#define RF_AGC_S10_MIX_ADJ_WIDTH 2 +#define RF_AGC_S11_BPF_ADJ_LSB 16 +#define RF_AGC_S11_BPF_ADJ_WIDTH 2 +#define RF_AGC_S11_LNA_ADJ_LSB 18 +#define RF_AGC_S11_LNA_ADJ_WIDTH 2 +#define RF_AGC_S11_LNA_BYPS_ADJ_POS 20 +#define RF_AGC_S11_LNA_EN_ADJ_POS 21 +#define RF_AGC_S11_MIX_ADJ_LSB 22 +#define RF_AGC_S11_MIX_ADJ_WIDTH 2 +//================================ + +typedef union //0x05c +{ + struct + { + uint32_t BG_BIAS_TRIM: 2; // bit[1:0] + uint32_t BG_RES_TRIM: 5; // bit[6:2] + uint32_t BG_VREF_FINE: 3; // bit[9:7] + uint32_t LDO_RX_TRIM: 3; // bit[12:10] + uint32_t LDO_TX_TRIM: 3; // bit[15:13] + uint32_t LNA_RES_TRIM: 3; // bit[18:16] + uint32_t BPF_GAIN_ADJ: 2; // bit[20:19] + uint32_t MIXL_GAIN_CTL: 1; // bit21 + uint32_t MIXH_GAIN_CTL: 1; // bit22 + uint32_t LNA_GAIN: 4; // bit[26:23] + uint32_t DAC_BLE_DELAY_ADJ_2M: 5; // bit[31:27] + }; + uint32_t Word; +} RF_ANA_TRIM_TypeDef; //0x05c + + +//================================ +#define RF_BG_BIAS_TRIM_LSB 0 +#define RF_BG_BIAS_TRIM_WIDTH 2 +#define RF_BG_RES_TRIM_LSB 2 +#define RF_BG_RES_TRIM_WIDTH 5 +#define RF_BG_VREF_FINE_LSB 7 +#define RF_BG_VREF_FINE_WIDTH 3 +#define RF_LDO_RX_TRIM_LSB 10 +#define RF_LDO_RX_TRIM_WIDTH 3 +#define RF_LDO_TX_TRIM_LSB 13 +#define RF_LDO_TX_TRIM_WIDTH 3 +#define RF_LNA_RES_TRIM_LSB 16 +#define RF_LNA_RES_TRIM_WIDTH 3 +#define RF_BPF_GAIN_ADJ_LSB 19 +#define RF_BPF_GAIN_ADJ_WIDTH 2 +#define RF_MIXL_GAIN_CTL_POS 21 +#define RF_MIXH_GAIN_CTL_POS 22 +#define RF_LNA_GAIN_LSB 23 +#define RF_LNA_GAIN_WIDTH 4 +#define RF_DAC_BLE_DELAY_ADJ_2M_LSB 27 +#define RF_DAC_BLE_DELAY_ADJ_2M_WIDTH 5 +//================================ + +typedef union //0x060 +{ + struct + { + uint32_t DAC_BLE_DELAY_ADJ_1M: 5; // bit[4:0] + uint32_t DAC_REFL_ADJ: 3; // bit[7:5] + uint32_t DAC_CAL_DATA_EXT: 1; // bit8 + uint32_t DAC_CAL_EN_EXT: 1; // bit9 + uint32_t DAC_EXT_EN: 1; // bit10 + uint32_t DAC_REFH_ADDJ: 1; // bit11 + uint32_t DAC_REFH_ADJ: 1; // bit12 + uint32_t BYP_LDOIF: 1; // bit13 + uint32_t BYP_LDOPLL: 1; // bit14 + uint32_t BYP_LDOTX: 1; // bit15 + uint32_t BYP_LDOVCO: 1; // bit16 + uint32_t CF_BW08M_ADJ: 1; // bit17 + uint32_t RSV_NOUSE1: 1; // bit18 + uint32_t TSTEN_CBPF: 1; // bit19 + uint32_t TSTEN_RSSI: 1; // bit20 + uint32_t AT0_SEL: 4; // bit[24:21] + uint32_t AT1_SEL: 4; // bit[28:25] + uint32_t VCO_RES: 2; // bit[30:29] + uint32_t VCOAFC_SEL: 1; // bit31 + }; + uint32_t Word; +} RF_ANAMISC_CTRL1_TypeDef; //0x060 + + +//================================ +#define RF_DAC_BLE_DELAY_ADJ_1M_LSB 0 +#define RF_DAC_BLE_DELAY_ADJ_1M_WIDTH 5 +#define RF_DAC_REFL_ADJ_LSB 5 +#define RF_DAC_REFL_ADJ_WIDTH 3 +#define RF_DAC_CAL_DATA_EXT_POS 8 +#define RF_DAC_CAL_EN_EXT_POS 9 +#define RF_DAC_EXT_EN_POS 10 +#define RF_DAC_REFH_ADDJ_POS 11 +#define RF_DAC_REFH_ADJ_POS 12 +#define RF_BYP_LDOIF_POS 13 +#define RF_BYP_LDOPLL_POS 14 +#define RF_BYP_LDOTX_POS 15 +#define RF_BYP_LDOVCO_POS 16 +#define RF_CF_BW08M_ADJ_POS 17 +#define RF_TSTEN_CBPF_POS 19 +#define RF_TSTEN_RSSI_POS 20 +#define RF_AT0_SEL_LSB 21 +#define RF_AT0_SEL_WIDTH 4 +#define RF_AT1_SEL_LSB 25 +#define RF_AT1_SEL_WIDTH 4 +#define RF_VCO_RES_LSB 29 +#define RF_VCO_RES_WIDTH 2 +#define RF_VCOAFC_SEL_POS 31 +//================================ + +typedef union //0x064 +{ + struct + { + uint32_t TEST_EN_LDO_VCO: 1; // bit0 --- + // used when ldo_test_en is 1 + uint32_t TEST_EN_LDO_PA: 1; // bit1 --- + // used when ldo_test_en is 1 + uint32_t TEST_EN_LDO_IF: 1; // bit2 --- + // used when ldo_test_en is 1 + uint32_t TEST_EN_LDO_PLL: 1; // bit3 --- + // used when ldo_test_en is 1 + uint32_t TEST_EN_DAC_DIG_PWR: 1; // bit4 --- + // used when ldo_test_en is 1 + uint32_t TEST_EN_AGC_PWR: 1; // bit5 --- + // used when ldo_test_en is 1 + uint32_t TEST_EN_LDO_TX: 1; // bit6 --- + // used when ldo_test_en is 1 + uint32_t RSV_NOUSE1: 1; // bit7 --- + uint32_t TX_EN_LDO_VCO: 1; // bit8 --- + // used when RF is controlled by RF Dig FSM & in TX mode + uint32_t TX_EN_LDO_PA: 1; // bit9 --- + // used when RF is controlled by RF Dig FSM & in TX mode + uint32_t TX_EN_LDO_IF: 1; // bit10 --- + // used when RF is controlled by RF Dig FSM & in TX mode + uint32_t TX_EN_LDO_PLL: 1; // bit11 --- + // used when RF is controlled by RF Dig FSM & in TX mode + uint32_t TX_EN_DAC_DIG_PWR: 1; // bit12 --- + // used when RF is controlled by RF Dig FSM & in TX mode + uint32_t TX_EN_AGC_PWR: 1; // bit13 --- + // used when RF is controlled by RF Dig FSM & in TX mode + uint32_t TX_EN_LDO_TX: 1; // bit14 --- + // used when RF is controlled by RF Dig FSM & in TX mode + uint32_t RSV_NOUSE2: 1; // bit15 --- + uint32_t RX_EN_LDO_VCO: 1; // bit16 --- + // used when RF is controlled by RF Dig FSM & in RX mode + uint32_t RX_EN_LDO_PA: 1; // bit17 --- + // used when RF is controlled by RF Dig FSM & in RX mode + uint32_t RX_EN_LDO_IF: 1; // bit18 --- + // used when RF is controlled by RF Dig FSM & in RX mode + uint32_t RX_EN_LDO_PLL: 1; // bit19 --- + // used when RF is controlled by RF Dig FSM & in RX mode + uint32_t RX_EN_DAC_DIG_PWR: 1; // bit20 --- + // used when RF is controlled by RF Dig FSM & in RX mode + uint32_t RX_EN_AGC_PWR: 1; // bit21 --- + // used when RF is controlled by RF Dig FSM & in RX mode + uint32_t RX_EN_LDO_TX: 1; // bit22 --- + // used when RF is controlled by RF Dig FSM & in RX mode + uint32_t CLK_EN_DAC: 1; // bit23 + uint32_t CLK_EN_BPF: 1; // bit24 + uint32_t CLK_EN_PLL: 1; // bit25 + uint32_t CLK_EN_AGC: 1; // bit26 + uint32_t RSV_END: 5; // bit[31:27] + }; + uint32_t Word; +} RF_ANA_PWR_CTRL_TypeDef; //0x064 + + +//================================ +#define RF_TEST_EN_LDO_VCO_POS 0 +#define RF_TEST_EN_LDO_PA_POS 1 +#define RF_TEST_EN_LDO_IF_POS 2 +#define RF_TEST_EN_LDO_PLL_POS 3 +#define RF_TEST_EN_DAC_DIG_PWR_POS 4 +#define RF_TEST_EN_AGC_PWR_POS 5 +#define RF_TEST_EN_LDO_TX_POS 6 +#define RF_TX_EN_LDO_VCO_POS 8 +#define RF_TX_EN_LDO_PA_POS 9 +#define RF_TX_EN_LDO_IF_POS 10 +#define RF_TX_EN_LDO_PLL_POS 11 +#define RF_TX_EN_DAC_DIG_PWR_POS 12 +#define RF_TX_EN_AGC_PWR_POS 13 +#define RF_TX_EN_LDO_TX_POS 14 +#define RF_RX_EN_LDO_VCO_POS 16 +#define RF_RX_EN_LDO_PA_POS 17 +#define RF_RX_EN_LDO_IF_POS 18 +#define RF_RX_EN_LDO_PLL_POS 19 +#define RF_RX_EN_DAC_DIG_PWR_POS 20 +#define RF_RX_EN_AGC_PWR_POS 21 +#define RF_RX_EN_LDO_TX_POS 22 +#define RF_CLK_EN_DAC_POS 23 +#define RF_CLK_EN_BPF_POS 24 +#define RF_CLK_EN_PLL_POS 25 +#define RF_CLK_EN_AGC_POS 26 +//================================ + +typedef union //0x068 +{ + struct + { + uint32_t EN_AGC_REG: 1; // bit0 --- + // 0: signal is controlled by RF Dig FSM + // 1: the signal to analog is 1 + uint32_t EN_BPF_REG: 1; // bit1 --- + // 0: signal is controlled by RF Dig FSM + // 1: the signal to analog is 1 + uint32_t EN_DAC_BLE_REG: 1; // bit2 --- + // 0: signal is controlled by RF Dig FSM + // 1: the signal to analog is 1 + uint32_t EN_LMT_RSSI_REG: 1; // bit3 --- + // 0: signal is controlled by RF Dig FSM + // 1: the signal to analog is 1 + uint32_t EN_LNA_REG: 1; // bit4 --- + // 0: signal is controlled by RF Dig FSM + // 1: the signal to analog is 1 + uint32_t EN_MIXH_REG: 1; // bit5 --- + // 0: signal is controlled by RF Dig FSM + // 1: the signal to analog is 1 + uint32_t EN_MIXL_REG: 1; // bit6 --- + // 0: signal is controlled by RF Dig FSM + // 1: the signal to analog is 1 + uint32_t EN_PA_REG: 1; // bit7 --- + // 0: signal is controlled by RF Dig FSM + // 1: the signal to analog is 1 + uint32_t EN_PLL_REG: 1; // bit8 --- + // 0: signal is controlled by RF Dig FSM + // 1: the signal to analog is 1 + uint32_t EN_RSSI_I_REG: 1; // bit9 --- + // 0: signal is controlled by RF Dig FSM + // 1: the signal to analog is 1 + uint32_t EN_RSSI_Q_REG: 1; // bit10 --- + // 0: signal is controlled by RF Dig FSM + // 1: the signal to analog is 1 + uint32_t EN_FB_DIV_REG: 1; // bit11 --- + // used when pll_cal_test_en as 1 + uint32_t PLL_CALIB_PD_REG: 1; // bit12 --- + // used when pll_cal_test_en as 1 + uint32_t TX_OPEN_PD_REG: 1; // bit13 --- + // used when pll_cal_test_en as 1 + uint32_t BAND_CAL_DONE_REG: 1; // bit14 --- + // used when pll_cal_test_en as 1 + uint32_t GAIN_CAL_DONE_REG: 1; // bit15 --- + // used when pll_cal_test_en as 1 + uint32_t EN_BG: 1; // bit16 --- + // direct control RF ANA + uint32_t EN_LMT_OUTI_EXT: 1; // bit17 --- + // direct control RF ANA + uint32_t EN_LMT_OUTQ_EXT: 1; // bit18 --- + // direct control RF ANA + uint32_t EN_LNA_BYPS: 1; // bit19 --- + // direct control RF ANA + uint32_t EN_DAC_ZB: 1; // bit20 --- + // direct control RF ANA + uint32_t CF_BW12M_ADJ_REG: 1; // bit21 --- + // used when ana_test_en is 1 + uint32_t DAC_VCTRL_BUF_REG: 1; // bit22 + uint32_t DAC_VCTRL_EN_REG: 1; // bit23 + uint32_t ANT_CAP_RX: 4; // bit[27:24] + uint32_t ANT_CAP_TX: 4; // bit[31:28] + }; + uint32_t Word; +} RF_ANA_EN_CTRL_TypeDef; //0x068 + + +//================================ +#define RF_EN_AGC_REG_POS 0 +#define RF_EN_BPF_REG_POS 1 +#define RF_EN_DAC_BLE_REG_POS 2 +#define RF_EN_LMT_RSSI_REG_POS 3 +#define RF_EN_LNA_REG_POS 4 +#define RF_EN_MIXH_REG_POS 5 +#define RF_EN_MIXL_REG_POS 6 +#define RF_EN_PA_REG_POS 7 +#define RF_EN_PLL_REG_POS 8 +#define RF_EN_RSSI_I_REG_POS 9 +#define RF_EN_RSSI_Q_REG_POS 10 +#define RF_EN_FB_DIV_REG_POS 11 +#define RF_PLL_CALIB_PD_REG_POS 12 +#define RF_TX_OPEN_PD_REG_POS 13 +#define RF_BAND_CAL_DONE_REG_POS 14 +#define RF_GAIN_CAL_DONE_REG_POS 15 +#define RF_EN_BG_POS 16 +#define RF_EN_LMT_OUTI_EXT_POS 17 +#define RF_EN_LMT_OUTQ_EXT_POS 18 +#define RF_EN_LNA_BYPS_POS 19 +#define RF_EN_DAC_ZB_POS 20 +#define RF_CF_BW12M_ADJ_REG_POS 21 +#define RF_DAC_VCTRL_BUF_REG_POS 22 +#define RF_DAC_VCTRL_EN_REG_POS 23 +#define RF_ANT_CAP_RX_LSB 24 +#define RF_ANT_CAP_RX_WIDTH 4 +#define RF_ANT_CAP_TX_LSB 28 +#define RF_ANT_CAP_TX_WIDTH 4 +//================================ + +typedef union //0x06c +{ + struct + { + uint32_t PLL_BW_ADJ: 3; // bit[2:0] + uint32_t PLL_CP_OS_EN: 1; // bit3 + uint32_t PLL_CP_OS_ADJ: 4; // bit[7:4] + uint32_t PLL_DIV_ADJ: 2; // bit[9:8] + uint32_t PLL_DI_P: 5; // bit[14:10] + uint32_t PLL_FAST_LOCK_EN: 1; // bit15 + uint32_t PLL_FBDIV_RST_EXT: 1; // bit16 + uint32_t PLL_FBDIV_RST_SEL: 1; // bit17 + uint32_t PLL_LOCK_BYPS: 1; // bit18 + uint32_t PLL_PS_CNT_RST_SEL: 1; // bit19 + uint32_t PLL_REF_SEL: 1; // bit20 + uint32_t PLL_SDM_TEST_EN: 1; // bit21 + uint32_t PLL_VCO_ADJ: 3; // bit[24:22] + uint32_t PLL_VCTRL_EXT_EN: 1; // bit25 + uint32_t PLL_VREF_ADJ: 3; // bit[28:26] + uint32_t PLL_MIX_SEL: 1; // bit29 --- + // 1: +2M IF for RX + // 0: -2M IF for RX + // to RF Analog block + uint32_t PLL_RTX_SEL_REG: 1; // bit30 --- + // used when ana_test_en is 1 + uint32_t PLL_SEL_RTX_BW: 1; // bit31 --- + // direct to RF Analog block + }; + uint32_t Word; +} RF_PLL_ANA_CTRL_TypeDef; //0x06c + + +//================================ +#define RF_PLL_BW_ADJ_LSB 0 +#define RF_PLL_BW_ADJ_WIDTH 3 +#define RF_PLL_CP_OS_EN_POS 3 +#define RF_PLL_CP_OS_ADJ_LSB 4 +#define RF_PLL_CP_OS_ADJ_WIDTH 4 +#define RF_PLL_DIV_ADJ_LSB 8 +#define RF_PLL_DIV_ADJ_WIDTH 2 +#define RF_PLL_DI_P_LSB 10 +#define RF_PLL_DI_P_WIDTH 5 +#define RF_PLL_FAST_LOCK_EN_POS 15 +#define RF_PLL_FBDIV_RST_EXT_POS 16 +#define RF_PLL_FBDIV_RST_SEL_POS 17 +#define RF_PLL_LOCK_BYPS_POS 18 +#define RF_PLL_PS_CNT_RST_SEL_POS 19 +#define RF_PLL_REF_SEL_POS 20 +#define RF_PLL_SDM_TEST_EN_POS 21 +#define RF_PLL_VCO_ADJ_LSB 22 +#define RF_PLL_VCO_ADJ_WIDTH 3 +#define RF_PLL_VCTRL_EXT_EN_POS 25 +#define RF_PLL_VREF_ADJ_LSB 26 +#define RF_PLL_VREF_ADJ_WIDTH 3 +#define RF_PLL_MIX_SEL_POS 29 +#define RF_PLL_RTX_SEL_REG_POS 30 +#define RF_PLL_SEL_RTX_BW_POS 31 +//================================ + +typedef union //0x074 +{ + struct + { + uint32_t AGC_STATE0: 1; // bit0 + uint32_t AGC_STATE1: 1; // bit1 + uint32_t BPF_CAL_CODE: 6; // bit[7:2] + uint32_t BG_VREF_OK12: 1; // bit8 + uint32_t BPF_CAL_DONE: 1; // bit9 + uint32_t PLL_LOCK: 1; // bit10 + uint32_t FAST_LOCK_DONE: 1; // bit11 + uint32_t AGC_STATE_TEST: 2; // bit[13:12] + uint32_t RSV_END: 18; // bit[31:14] + }; + uint32_t Word; +} RF_RF_ANA_ST0_TypeDef; //0x074 + + +//================================ +#define RF_AGC_STATE0_POS 0 +#define RF_AGC_STATE1_POS 1 +#define RF_BPF_CAL_CODE_LSB 2 +#define RF_BPF_CAL_CODE_WIDTH 6 +#define RF_BG_VREF_OK12_POS 8 +#define RF_BPF_CAL_DONE_POS 9 +#define RF_PLL_LOCK_POS 10 +#define RF_FAST_LOCK_DONE_POS 11 +#define RF_AGC_STATE_TEST_LSB 12 +#define RF_AGC_STATE_TEST_WIDTH 2 +//================================ + +//================================ +//BLOCK RF top struct define +typedef struct +{ + __IO RF_DIG_CTRL_TypeDef DIG_CTRL ; // 0x000, + __IO RF_PLL_TAB_OFFSET_TypeDef PLL_TAB_OFFSET ; // 0x004, + __IO RF_PLL_GAIN_CTRL_TypeDef PLL_GAIN_CTRL ; // 0x008, + __IO RF_RSSI_CTRL_TypeDef RSSI_CTRL ; // 0x00c, + __IO RF_PLL_DAC_TAB0_TypeDef PLL_DAC_TAB0 ; // 0x010, + __I RF_PLL_CAL_ST_TypeDef PLL_CAL_ST ; // 0x014, + __IO RF_PLL_FREQ_CTRL_TypeDef PLL_FREQ_CTRL ; // 0x018, + __IO RF_PLL_DYM_CTRL_TypeDef PLL_DYM_CTRL ; // 0x01c, + __IO RF_FSM_DLY_CTRL0_TypeDef FSM_DLY_CTRL0 ; // 0x020, + __IO RF_FSM_DLY_CTRL1_TypeDef FSM_DLY_CTRL1 ; // 0x024, + __IO uint32_t PLL_CAL_DAC_STEP ; // 0x028, + // when pll_gain_cal_mode is 2'b10 : + // pll_cal_dac_step = N * abs ( pll_gain_cal_df1 - pll_gain_cal_df0 ) / 8, + // N is software define , common value is 2 or 4 + // when pll_gain_cal_mode is 2'b11 : + // pll_cal_dac_step = 4* abs ( pll_gain_cal_df1 - pll_gain_cal_df0 ) / 8 + // data format : ( 8,2) unsigned data + __I RF_PLL_GAIN_CAL_VAL_TypeDef PLL_GAIN_CAL_VAL ; // 0x02c, + __IO RF_PLL_DAC_TAB1_TypeDef PLL_DAC_TAB1 ; // 0x030, + __IO RF_PLL_DAC_TAB2_TypeDef PLL_DAC_TAB2 ; // 0x034, + __IO RF_DATA_DLY_CTRL_TypeDef DATA_DLY_CTRL ; // 0x038, + __IO RF_TX_CH_MAP_TypeDef TX_CH_MAP ; // 0x03c, + __IO RF_RX_CHIDX37_MAP_TypeDef RX_CHIDX37_MAP ; // 0x040, + __IO RF_RX_CHIDX38_MAP_TypeDef RX_CHIDX38_MAP ; // 0x044, + __IO RF_RX_CHIDX39_MAP_TypeDef RX_CHIDX39_MAP ; // 0x048, + __IO RF_BPFMIX_CTRL_TypeDef BPFMIX_CTRL ; // 0x04c, + __IO RF_AGC_CTRL0_TypeDef AGC_CTRL0 ; // 0x050, + __IO RF_AGC_CTRL1_TypeDef AGC_CTRL1 ; // 0x054, + __IO RF_AGC_CTRL2_TypeDef AGC_CTRL2 ; // 0x058, + __IO RF_ANA_TRIM_TypeDef ANA_TRIM ; // 0x05c, + __IO RF_ANAMISC_CTRL1_TypeDef ANAMISC_CTRL1 ; // 0x060, + __IO RF_ANA_PWR_CTRL_TypeDef ANA_PWR_CTRL ; // 0x064, + __IO RF_ANA_EN_CTRL_TypeDef ANA_EN_CTRL ; // 0x068, + __IO RF_PLL_ANA_CTRL_TypeDef PLL_ANA_CTRL ; // 0x06c, + __IO uint32_t RF_RSV ; // 0x070, + // [0] : RF TEMP connect to ADC_VIN[15] + // [1] : RF BANDGAP connect to ADC_VIN[15] + // [2] : RF RSSI connect to ADC_VIN[15] + // [3] : RF VDD_IF connect to ADC_VIN[15] + // [15]: CLK_128M_DAC enable signal + __I RF_RF_ANA_ST0_TypeDef RF_ANA_ST0 ; // 0x074, +} RF_TypeDef; + + +#define RF (( RF_TypeDef *) RF_BASE) + +#endif diff --git a/core/reg/reg_sadc.h b/core/reg/reg_sadc.h new file mode 100644 index 0000000..2a06bdb --- /dev/null +++ b/core/reg/reg_sadc.h @@ -0,0 +1,315 @@ +#ifndef _REG_SADC_H_ +#define _REG_SADC_H_ + +#include "reg_base.h" + +//================================ +//BLOCK SADC define + +#define SADC_BASE ((uint32_t)0x40007000) +#define SADC_CTRL_ADDR_OFFSET 0x000 +#define SADC_AUTO_SW_CTRL_ADDR_OFFSET 0x004 +#define SADC_CH_CTRL_ADDR_OFFSET 0x008 +#define SADC_STCTRL_ADDR_OFFSET 0x00c +#define SADC_DC_OFFSET_ADDR_OFFSET 0x010 +#define SADC_AUX_ST_ADDR_OFFSET 0x014 +#define SADC_PCM_DAT_ADDR_OFFSET 0x018 +#define SADC_SADC_CALIB_DATIN_ADDR_OFFSET 0x01c +#define SADC_SADC_CALIB_DATSEL_ADDR_OFFSET 0x020 +#define SADC_SADC_CALIB_DATOUT_ADDR_OFFSET 0x024 +#define SADC_SADC_ANA_CTRL_ADDR_OFFSET 0x028 +#define SADC_MIC_CTRL_ADDR_OFFSET 0x02c + +//================================ +//BLOCK SADC reg struct define +typedef union //0x000 +{ + struct + { + uint32_t SADC_SOC: 1; // bit0 + uint32_t SADC_CALIB_MODE: 1; // bit1 + uint32_t SADC_CONV_MODE: 1; // bit2 + uint32_t SADC_DMAC_EN: 1; // bit3 + uint32_t SADC_CLK_PH: 1; // bit4 + uint32_t SADC_SAMP_MOD: 2; // bit[6:5] --- + // 2'b00: software mode(normal mode) + // 2'b01: RSSI sample mode( ADC controlled by BB) + // 2'b10: decimation filter mode ( sample vioce data, must enable DMA) + // 2'b11: SOC is from ADTIM adctrg + uint32_t SADC_DECIM_END: 1; // bit7 --- write as 1 to stop decimation filter + uint32_t SADC_RSSI_SAMP_DLY: 6; // bit[13:8]--- delay time from rssi_req to SADC sample RSSI + // unit: one 16M clock period + // range: 0 ~ 4us + uint32_t SADC_DBG_CTRL: 1; // bit14 --- + // 0: normal mode + // 1: chip is configed as SADC analog IP + // the SOC & CLK is from external chip + uint32_t RSV_NOUSE1: 1; // bit15 --- Ignore me + uint32_t SADC_HPF_COEF: 4; // bit[19:16]-- decimation filter high pass filter coef + // 0: high pass filter is bypass + // 1~12: y(n)= (1-2^-sadc_hpf_coef)*y(n-1) + x(n) - x(n-1) + uint32_t SADC_AUX_CLK_DIV: 10; // bit[29:20]-- adc function clock = hclk / (sadc_aux_clk_div + 1 ) + // note + // 1: make sure adc function clock is not more than 16M + // 2: when sadc_samp_mod is 2'b10 ( decimation filter mode) + // please makesure adc function clock is 16M + uint32_t RSV_END: 2; // bit[31:30] + }; + uint32_t Word; +} SADC_CTRL_TypeDef; //0x000 + + +//================================ +#define SADC_SADC_SOC_POS 0 +#define SADC_SADC_CALIB_MODE_POS 1 +#define SADC_SADC_CONV_MODE_POS 2 +#define SADC_SADC_DMAC_EN_POS 3 +#define SADC_SADC_CLK_PH_POS 4 +#define SADC_SADC_SAMP_MOD_LSB 5 +#define SADC_SADC_SAMP_MOD_WIDTH 2 +#define SADC_SADC_DECIM_END_POS 7 +#define SADC_SADC_RSSI_SAMP_DLY_LSB 8 +#define SADC_SADC_RSSI_SAMP_DLY_WIDTH 6 +#define SADC_SADC_DBG_CTRL_POS 14 +#define SADC_SADC_HPF_COEF_LSB 16 +#define SADC_SADC_HPF_COEF_WIDTH 4 +#define SADC_SADC_AUX_CLK_DIV_LSB 20 +#define SADC_SADC_AUX_CLK_DIV_WIDTH 10 +//================================ + +typedef union //0x004 +{ + struct + { + uint32_t AUTO_SW_CH: 1; // bit0 --- when is 1 + // ADC_VIN_SEL is auto change + // only used when sadc_samp_mod is 2'b11 + uint32_t AUTO_CH_NUM: 3; // bit[3:1] --- swith order: + uint32_t RSV_END: 28; // bit[31:4] + }; + uint32_t Word; +} SADC_AUTO_SW_CTRL_TypeDef; //0x004 + + +//================================ +#define SADC_AUTO_SW_CH_POS 0 +#define SADC_AUTO_CH_NUM_LSB 1 +#define SADC_AUTO_CH_NUM_WIDTH 3 +//================================ + +typedef union //0x008 +{ + struct + { + uint32_t SADC_CH_SET0: 4; // bit[3:0] --- when auto_sw_ch is 0 + // SADC_VIN_SEL is sadc_ch_set0 + // 0: VDD33/2 + // 1: PAD_VBK + // 2: PAD_VDD12 + // 3: PGAOUT + // 4: MICIN + // 5~14: ADCIN0 ~ ADCIN9 + // 15: RF + // RF.RF_RSV[0] : RF TEMP + // RF.RF_RSV[1] : RF BANDGAP + // RF.RF_RSV[2] : RF RSSI + // RF.RF_RSV[3] : RF VDD_IF + uint32_t SADC_CH_SET1: 4; // bit[7:4] + uint32_t SADC_CH_SET2: 4; // bit[11:8] + uint32_t SADC_CH_SET3: 4; // bit[15:12] + uint32_t SADC_CH_SET4: 4; // bit[19:16] + uint32_t SADC_CH_SET5: 4; // bit[23:20] + uint32_t SADC_CH_SET6: 4; // bit[27:24] + uint32_t SADC_CH_SET7: 4; // bit[31:28] + }; + uint32_t Word; +} SADC_CH_CTRL_TypeDef; //0x008 + + +//================================ +#define SADC_SADC_CH_SET0_LSB 0 +#define SADC_SADC_CH_SET0_WIDTH 4 +#define SADC_SADC_CH_SET1_LSB 4 +#define SADC_SADC_CH_SET1_WIDTH 4 +#define SADC_SADC_CH_SET2_LSB 8 +#define SADC_SADC_CH_SET2_WIDTH 4 +#define SADC_SADC_CH_SET3_LSB 12 +#define SADC_SADC_CH_SET3_WIDTH 4 +#define SADC_SADC_CH_SET4_LSB 16 +#define SADC_SADC_CH_SET4_WIDTH 4 +#define SADC_SADC_CH_SET5_LSB 20 +#define SADC_SADC_CH_SET5_WIDTH 4 +#define SADC_SADC_CH_SET6_LSB 24 +#define SADC_SADC_CH_SET6_WIDTH 4 +#define SADC_SADC_CH_SET7_LSB 28 +#define SADC_SADC_CH_SET7_WIDTH 4 +//================================ + +typedef union //0x00c +{ + struct + { + uint32_t SADC_AUX_FLG: 1; // bit0 + uint32_t SADC_FILTER_BUSY: 1; // bit1 + uint32_t SADC_AUX_FLG_CLR: 1; // bit2 + uint32_t RSV_END: 29; // bit[31:3] + }; + uint32_t Word; +} SADC_STCTRL_TypeDef; //0x00c + + +//================================ +#define SADC_SADC_AUX_FLG_POS 0 +#define SADC_SADC_FILTER_BUSY_POS 1 +#define SADC_SADC_AUX_FLG_CLR_POS 2 +//================================ + +typedef union //0x014 +{ + struct + { + uint32_t SADC_AUX_DOUT: 10; // bit[9:0] + uint32_t RSV_NOUSE1: 2; // bit[11:10] --- Ignore me + uint32_t SADC_CH_ST: 4; // bit[15:12] + uint32_t RSV_END: 16; // bit[31:16] + }; + uint32_t Word; +} SADC_AUX_ST_TypeDef; //0x014 + + +//================================ +#define SADC_SADC_AUX_DOUT_LSB 0 +#define SADC_SADC_AUX_DOUT_WIDTH 10 +#define SADC_SADC_CH_ST_LSB 12 +#define SADC_SADC_CH_ST_WIDTH 4 +//================================ + +typedef union //0x028 +{ + struct + { + uint32_t SADC_EN: 1; // bit0 + uint32_t SADC_VREF_TRIM: 2; // bit[2:1] --- + // 0: 1.2V + // 1: 1.8V + // 2: 2.4V + // 3: 3V + uint32_t SADC_IBSEL_CMP: 3; // bit[5:3] --- + // 000: 15uA + // 111: 105uA + // 15uA/step + uint32_t SADC_IBSEL_VCM: 3; // bit[8:6] --- + // 000: 15uA + // 111: 105uA + // 15uA/step + uint32_t SADC_IBSEL_VREF: 3; // bit[11:9] --- + // 000: 15uA + // 111: 105uA + // 15uA/step + uint32_t SADC_IBSEL_BUF: 3; // bit[14:12] --- + // 000: 15uA + // 111: 105uA + // 15uA/step + uint32_t SADC_VREF_SEL: 1; // bit15 --- + // 0: ref is from VDDA + // 1: ref is gen from VBG + uint32_t SADC_CALCAP_SEL: 2; // bit[17:16] --- + // 01: most precision but narrow range + // 11: widest range but less precision + uint32_t SADC_CAL_OS: 2; // bit[19:18] --- + // 01: single ended tie to GND + // 01: single ended tie to VREF + uint32_t SADC_INBUF_BYPSS: 1; // bit20 --- + // 0: through input buffer + // 1: bypass input buffer + uint32_t RSV_END: 11; // bit[31:21] + }; + uint32_t Word; +} SADC_SADC_ANA_CTRL_TypeDef; //0x028 + + +//================================ +#define SADC_SADC_EN_POS 0 +#define SADC_SADC_VREF_TRIM_LSB 1 +#define SADC_SADC_VREF_TRIM_WIDTH 2 +#define SADC_SADC_IBSEL_CMP_LSB 3 +#define SADC_SADC_IBSEL_CMP_WIDTH 3 +#define SADC_SADC_IBSEL_VCM_LSB 6 +#define SADC_SADC_IBSEL_VCM_WIDTH 3 +#define SADC_SADC_IBSEL_VREF_LSB 9 +#define SADC_SADC_IBSEL_VREF_WIDTH 3 +#define SADC_SADC_IBSEL_BUF_LSB 12 +#define SADC_SADC_IBSEL_BUF_WIDTH 3 +#define SADC_SADC_VREF_SEL_POS 15 +#define SADC_SADC_CALCAP_SEL_LSB 16 +#define SADC_SADC_CALCAP_SEL_WIDTH 2 +#define SADC_SADC_CAL_OS_LSB 18 +#define SADC_SADC_CAL_OS_WIDTH 2 +#define SADC_SADC_INBUF_BYPSS_POS 20 +//================================ + +typedef union //0x02c +{ + struct + { + uint32_t MIC_MODE_SEL: 1; // bit0 --- Analog microphone connect mode selected + // 1: connect without cap and res + // 0: connect with coupling cap + uint32_t MIC_PD: 1; // bit1 --- Micbias powerdown signal + uint32_t MIC_TRIM: 7; // bit[8:2] --- Micbias output voltage trimming signal + uint32_t MIC_VREF_SEL: 1; // bit9 --- Micbias Internal voltage reference selected + // 0: 750mV + // 1: 1.5V + uint32_t PGA_BIAS_SEL: 2; // bit[11:10]-- PGA enable signal, high active + uint32_t PGA_EN: 1; // bit 12 + uint32_t PGA_VOL: 5; // bit[17:13] + uint32_t PGA_VREF_SEL: 1; // bit18 -- pga Internal voltage reference selected + // 0: 750mV + // 1: 1.5V + uint32_t RSV_END: 13; // bit[31:19] + }; + uint32_t Word; +} SADC_MIC_CTRL_TypeDef; //0x024 + + +//================================ +//#define SADC_MIC_MODE_SEL_POS 0 +//#define SADC_MIC_PD_POS 1 +//#define SADC_MIC_TRIM_LSB 2 +//#define SADC_MIC_TRIM_WIDTH 7 +//#define SADC_MIC_VREF_SEL_POS 9 +//#define SADC_PGA_BIAS_SEL_LSB 10 +//#define SADC_PGA_BIAS_SEL_WIDTH 2 +//#define SADC_PGA_EN_POS 12 +//#define SADC_PGA_VOL_LSB 13 +//#define SADC_PGA_VOL_WIDTH 5 +//#define SADC_PGA_VREF_SEL_POS 18 +//================================ + +//================================ +//BLOCK SADC top struct define +typedef struct +{ + __IO SADC_CTRL_TypeDef CTRL ; // 0x000, + __IO SADC_AUTO_SW_CTRL_TypeDef AUTO_SW_CTRL ; // 0x004, + __IO SADC_CH_CTRL_TypeDef CH_CTRL ; // 0x008, + __IO SADC_STCTRL_TypeDef STCTRL ; // 0x00c, + __IO uint32_t DC_OFFSET ; // 0x010, + // DC offset + // final out = ana_out + sadc_dc_off + // is sadc_dc_off is signed data + // data arrange : -8 ~ 7 for software or RSSI function + // command value for decimation is 10'h200 + __I SADC_AUX_ST_TypeDef AUX_ST ; // 0x014, + __I uint32_t PCM_DAT ; // 0x018, + __IO uint32_t SADC_CALIB_DATIN ; // 0x01c, + __IO uint32_t SADC_CALIB_DATSEL ; // 0x020, + __I uint32_t SADC_CALIB_DATOUT ; // 0x024, + __IO SADC_SADC_ANA_CTRL_TypeDef SADC_ANA_CTRL ; // 0x028, + __IO SADC_MIC_CTRL_TypeDef MIC_CTRL ; // 0x02c, +} SADC_TypeDef; + + +#define SADC (( SADC_TypeDef *) SADC_BASE) + +#endif diff --git a/core/reg/reg_spim.h b/core/reg/reg_spim.h new file mode 100644 index 0000000..dfb5858 --- /dev/null +++ b/core/reg/reg_spim.h @@ -0,0 +1,135 @@ +#ifndef _REG_SPIM_H_ +#define _REG_SPIM_H_ + +#include "reg_base.h" + +//================================ +//BLOCK SPIM define + +#define SPIM_BASE ((uint32_t)0x40004000) +#define SPIM_RX_DATA_ADDR_OFFSET 0x000 +#define SPIM_TX_DATA_ADDR_OFFSET 0x004 +#define SPIM_TXRX_BGN_ADDR_OFFSET 0x008 +#define SPIM_CTRL_ADDR_OFFSET 0x00c +#define SPIM_STATUS_CLR_ADDR_OFFSET 0x010 +#define SPIM_STATUS_ADDR_OFFSET 0x014 +#define SPIM_DAT_LEN_ADDR_OFFSET 0x018 + +//================================ +//BLOCK SPIM reg struct define +typedef union //0x00c +{ + struct + { + uint32_t SPIM_CRAT: 4; // bit[3:0] --- clock rate select,clk/2^(crat+1) + // 0-11 is supported + uint32_t SPIM_CPHA: 1; // bit4 --- clock phase bit + // 0: sck sample data in first edge; + // 1: sck sample data in second edge; + uint32_t SPIM_CPOL: 1; // bit5 --- clock polarity bit + // 0: sck is low in idle status; + // 1: sck is high in idle status; + uint32_t SPIM_TX_DMA_EN: 1; // bit6 --- + // 0: TX work as mcu mode + // 1: TX work as dma mode,after configure dma cfg,set txrx bgn to 1 to start the dma transission + uint32_t SPIM_RX_DMA_EN: 1; // bit7 --- + // 0: RX work as mcu mode + // 1: RX work as dma mode,after configure dma cfg,set txrx bgn to 1 to start the dma transission + uint32_t SPIM_INT_EN: 1; // bit8 --- interrupt enable bit + uint32_t SPIM_TX_EN: 1; // bit9 --- transmit to SPI slave enable + uint32_t SPIM_RX_EN: 1; // bit10--- receive from SPI slave enable + uint32_t SPIM_MSB_FST: 1; // bit11--- + // 0: LSB first + // 1: MSB first + uint32_t RSV_END: 20; // bit[31:12] + }; + uint32_t Word; +} SPIM_CTRL_TypeDef; //0x00c + + +//================================ +#define SPIM_SPIM_CRAT_LSB 0 +#define SPIM_SPIM_CRAT_WIDTH 4 +#define SPIM_SPIM_CPHA_POS 4 +#define SPIM_SPIM_CPOL_POS 5 +#define SPIM_SPIM_TX_DMA_EN_POS 6 +#define SPIM_SPIM_RX_DMA_EN_POS 7 +#define SPIM_SPIM_INT_EN_POS 8 +#define SPIM_SPIM_TX_EN_POS 9 +#define SPIM_SPIM_RX_EN_POS 10 +#define SPIM_SPIM_MSB_FST_POS 11 +#define SPIM_SPIM_RX_PH_POS 12 +//================================ + +typedef union //0x010 +{ + struct + { + uint32_t SPIM_TXDAT_CLR: 1; // bit0 --- set 1 to clear spi TX fifo status and inner counter + uint32_t SPIM_RXDAT_CLR: 1; // bit1 --- set 1 to clear spi RX fifo status and inner counter + uint32_t SPIM_CLR_INTF: 1; // bit2 --- write 1 to clear intf status + uint32_t RSV_END: 29; // bit[31:3] + }; + uint32_t Word; +} SPIM_STATUS_CLR_TypeDef; //0x010 + + +//================================ +#define SPIM_SPIM_TXDAT_CLR_POS 0 +#define SPIM_SPIM_RXDAT_CLR_POS 1 +#define SPIM_SPIM_CLR_INTF_POS 2 +//================================ + +typedef union //0x014 +{ + struct + { + uint32_t SPIM_TX_FEMPTY: 1; // bit0 --- tx fifo empty + uint32_t SPIM_TX_FFULL: 1; // bit1 --- tx fifo full + uint32_t SPIM_TX_FNUM: 3; // bit[4:2] --- data number in tx fifo + uint32_t SPIM_RX_FEMPTY: 1; // bit5 --- rx fifo empty + uint32_t SPIM_RX_FFULL: 1; // bit6 --- rx fifo full + uint32_t SPIM_RX_FNUM: 3; // bit[9:7] --- data length in rx fifo + uint32_t SPIM_INTF: 1; // bit10 --- rx/tx interrupt flag + uint32_t SPIM_BUSY: 1; // bit11 --- spim transfer busy signal + // 0: spim idle + // 1: spim busy,tx/rx is running + uint32_t RSV_END: 20; // bit[31:12] + }; + uint32_t Word; +} SPIM_STATUS_TypeDef; //0x014 + + +//================================ +#define SPIM_SPIM_TX_FEMPTY_POS 0 +#define SPIM_SPIM_TX_FFULL_POS 1 +#define SPIM_SPIM_TX_FNUM_LSB 2 +#define SPIM_SPIM_TX_FNUM_WIDTH 3 +#define SPIM_SPIM_RX_FEMPTY_POS 5 +#define SPIM_SPIM_RX_FFULL_POS 6 +#define SPIM_SPIM_RX_FNUM_LSB 7 +#define SPIM_SPIM_RX_FNUM_WIDTH 3 +#define SPIM_SPIM_INTF_POS 10 +#define SPIM_SPIM_BUSY_POS 11 +//================================ + +//================================ +//BLOCK SPIM top struct define +typedef struct +{ + __I uint32_t RX_DATA ; // 0x000, + __O uint32_t TX_DATA ; // 0x004, + __O uint32_t TXRX_BGN ; // 0x008, + // used when dullplex mode or only RX mode + __IO SPIM_CTRL_TypeDef CTRL ; // 0x00c, + __O SPIM_STATUS_CLR_TypeDef STATUS_CLR ; // 0x010, + __I SPIM_STATUS_TypeDef STATUS ; // 0x014, + __IO uint32_t DAT_LEN ; // 0x018, + // data length for RX in MCU or DMA mode + // valid bit[15:0] +} SPIM_TypeDef; + + +#define SPIM (( SPIM_TypeDef *) SPIM_BASE) + +#endif diff --git a/core/reg/reg_spis.h b/core/reg/reg_spis.h new file mode 100644 index 0000000..26db32c --- /dev/null +++ b/core/reg/reg_spis.h @@ -0,0 +1,162 @@ +#ifndef _REG_SPIS_H_ +#define _REG_SPIS_H_ + +#include "reg_base.h" + +//================================ +//BLOCK SPIS define + +#define SPIS_BASE ((uint32_t)0x40005000) +#define SPIS_CTRL_ADDR_OFFSET 0x000 +#define SPIS_STATUS_ADDR_OFFSET 0x004 +#define SPIS_INFO_CLR_ADDR_OFFSET 0x008 +#define SPIS_TX_DAT_ADDR_OFFSET 0x00c +#define SPIS_RX_DAT_ADDR_OFFSET 0x010 + +//================================ +//BLOCK SPIS reg struct define +typedef union //0x000 +{ + struct + { + uint32_t SPIS_LSBFIRST: 1; // bit0 --- + // 0: MSB first for SPIS TX/RX; + // 1: LSB first for SPIS TX/RX; + uint32_t SPIS_CPOL: 1; // bit1 --- spi clock polarity control bit when SPIS is IDLE(cs is 1); + // 0: sample the data at the first clock edge + // 1: sample the data at the second clock edge + uint32_t SPIS_CPHA: 1; // bit2 --- clock phase used for sample data + // 0: sample the data at the first clock edge + // 1: sample the data at the second clock edge + uint32_t SPIS_RX_EN: 1; // bit3 --- spis rx control signal + // default is enable + // 0: spis RX disable + // 1: spis RX enable + // SPIS RX enable only when both spis en and spis rx en set as 1 + uint32_t SPIS_RXINT_EN: 1; // bit4 --- + // 0: spis_rxint interrupt disable + // 1: spis_rxint interrupt enable + uint32_t SPIS_TX_DMA_MODE: 1; // bit5 --- SPIS TX operation mode control signal + // 1: DMA mode + // 0: MCU mode + uint32_t SPIS_RX_DMA_MODE: 1; // bit6 --- SPIS RX operation mode control signal + // 1: DMA mode + // 0: MCU mode + uint32_t SPIS_EN: 1; // bit7 --- + // 0: SPIS work disable + // 1: spis work enable + // [Note:the spis lsfirst,spis spol and spis spha can be configured only when spis en is 0] + uint32_t SPIS_OT_WIN: 8; // bit[15:8] --- config overtime window + // unit : bit width time + uint32_t SPIS_OT_EN: 1; // bit16 --- SPIS overtime enable + uint32_t SPIS_OTINT_EN: 1; // bit17 + uint32_t RSV_END: 14; // bit[31:18] + }; + uint32_t Word; +} SPIS_CTRL_TypeDef; //0x000 + + +//================================ +#define SPIS_SPIS_LSBFIRST_POS 0 +#define SPIS_SPIS_CPOL_POS 1 +#define SPIS_SPIS_CPHA_POS 2 +#define SPIS_SPIS_RX_EN_POS 3 +#define SPIS_SPIS_RXINT_EN_POS 4 +#define SPIS_SPIS_TX_DMA_MODE_POS 5 +#define SPIS_SPIS_RX_DMA_MODE_POS 6 +#define SPIS_SPIS_EN_POS 7 +#define SPIS_SPIS_OT_WIN_LSB 8 +#define SPIS_SPIS_OT_WIN_WIDTH 8 +#define SPIS_SPIS_OT_EN_POS 16 +#define SPIS_SPIS_OTINT_EN_POS 17 +//================================ + +typedef union //0x004 +{ + struct + { + uint32_t SPIS_RXFIFO_EMPTY: 1; // bit0 --- + // 0: spis_rxfifo is not empty + // 1: spis_rxfifo is empty + uint32_t SPIS_RXFIFO_FULL: 1; // bit1 --- + // 0: spis_rxfifo is not full + // 1: spis_rxfifo is full + uint32_t SPIS_RXFIFO_NUM: 3; // bit[4:2] --- the SPIS RX data number in rxfifo + uint32_t RSV_NOUSE1: 1; // bit5 --- Ignore me + uint32_t SPIS_RX_OVERRUN: 1; // bit6 --- SPIS rxfifo overrun error signal + // 0: cleared by spis rx overrun clr + // 1: rxfifo overrun error + uint32_t SPIS_CS: 1; // bit7 --- the signal pin SPIS_CS + // 0: SPIS is selected + // 1: SPIS is not selected + uint32_t SPIS_TXFIFO_EMPTY: 1; // bit8 --- + // 0: spis_txfifo is not empty + // 1: spis_txfifo is empty + uint32_t SPIS_TXFIFO_FULL: 1; // bit9 --- + // 0: spis_txfifo is not full + // 1: spis_txfifo is full + // [Note:When txfifo is not full,MCU can write tx dat reg + uint32_t SPIS_TXFIFO_NUM: 3; // bit[12:10] --- the SPIS TX data number in txfifo + uint32_t RSV_NOUSE2: 3; // bit[15:13] --- Ignore me + uint32_t SPIS_RXINT_ST: 1; // bit16 --- when SPIS RX 1 byte,spis_rxint is 1 + // cleared by spis_rxint_clr + uint32_t SPIS_OTINT_ST: 1; // bit17 --- set as 1 when SPIS overtime event happen + uint32_t RSV_END: 14; // bit[31:18] + }; + uint32_t Word; +} SPIS_STATUS_TypeDef; //0x004 + + +//================================ +#define SPIS_SPIS_RXFIFO_EMPTY_POS 0 +#define SPIS_SPIS_RXFIFO_FULL_POS 1 +#define SPIS_SPIS_RXFIFO_NUM_LSB 2 +#define SPIS_SPIS_RXFIFO_NUM_WIDTH 3 +#define SPIS_SPIS_RX_OVERRUN_POS 6 +#define SPIS_SPIS_CS_POS 7 +#define SPIS_SPIS_TXFIFO_EMPTY_POS 8 +#define SPIS_SPIS_TXFIFO_FULL_POS 9 +#define SPIS_SPIS_TXFIFO_NUM_LSB 10 +#define SPIS_SPIS_TXFIFO_NUM_WIDTH 3 +#define SPIS_SPIS_RXINT_ST_POS 16 +#define SPIS_SPIS_OTINT_ST_POS 17 +//================================ + +typedef union //0x008 +{ + struct + { + uint32_t SPIS_RX_OVERRUN_CLR: 1; // bit0 --- use to clear spis_rx_overrun + uint32_t SPIS_TXDAT_CLR: 1; // bit1 --- use to clear SPIS txfifo point and data reg + uint32_t SPIS_RXDAT_CLR: 1; // bit2 --- use to clear SPIS rxfifo point and data reg + uint32_t SPIS_RXINT_CLR: 1; // bit3 --- use clear spis_rxint + uint32_t SPIS_OTINT_CLR: 1; // bit4 + uint32_t RSV_END: 27; // bit[31:5] + }; + uint32_t Word; +} SPIS_INFO_CLR_TypeDef; //0x008 + + +//================================ +#define SPIS_SPIS_RX_OVERRUN_CLR_POS 0 +#define SPIS_SPIS_TXDAT_CLR_POS 1 +#define SPIS_SPIS_RXDAT_CLR_POS 2 +#define SPIS_SPIS_RXINT_CLR_POS 3 +#define SPIS_SPIS_OTINT_CLR_POS 4 +//================================ + +//================================ +//BLOCK SPIS top struct define +typedef struct +{ + __IO SPIS_CTRL_TypeDef CTRL ; // 0x000, + __I SPIS_STATUS_TypeDef STATUS ; // 0x004, + __O SPIS_INFO_CLR_TypeDef INFO_CLR ; // 0x008, + __O uint32_t TX_DAT ; // 0x00c, + __I uint32_t RX_DAT ; // 0x010, +} SPIS_TypeDef; + + +#define SPIS (( SPIS_TypeDef *) SPIS_BASE) + +#endif diff --git a/core/reg/reg_syscfg.h b/core/reg/reg_syscfg.h new file mode 100644 index 0000000..14f641d --- /dev/null +++ b/core/reg/reg_syscfg.h @@ -0,0 +1,239 @@ +#ifndef _REG_SYSCFG_H_ +#define _REG_SYSCFG_H_ + +#include "reg_base.h" + +//================================ +//BLOCK SYSCFG define + +#define SYSCFG_BASE ((uint32_t)0x40001000) +#define SYSCFG_BB_PMU_ENABLE_ADDR_OFFSET 0x000 +#define SYSCFG_AHB_MATRIX_PRIORITY_ADDR_OFFSET 0x004 +#define SYSCFG_DBG_CTRL_ADDR_OFFSET 0x008 +#define SYSCFG_USB_CTRL_ADDR_OFFSET 0x00c +#define SYSCFG_ROM_CTRL_ADDR_OFFSET 0x010 +#define SYSCFG_SRAM_CTRL_ADDR_OFFSET 0x014 +#define SYSCFG_ROM_SIGNATURE_TARGET_ADDR_OFFSET 0x018 +#define SYSCFG_BIST_MODE_ADDR_OFFSET 0x01c +#define SYSCFG_BIST_STATUS_ADDR_OFFSET 0x020 +#define SYSCFG_BIST_STATUS_CLR_ADDR_OFFSET 0x024 +#define SYSCFG_ROM_SIGNATURE_RPT_ADDR_OFFSET 0x028 +#define SYSCFG_CACHSRAM_CFG_ADDR_OFFSET 0x02c +#define SYSCFG_EM_BASE_CFG_ADDR_OFFSET 0x030 +#define SYSCFG_CACHE_ACCESS_CNT_ADDR_OFFSET 0x034 +#define SYSCFG_CACHE_HIT_CNT_ADDR_OFFSET 0x038 +#define SYSCFG_ACC_CCR_BUSY_ADDR_OFFSET 0x03c +#define SYSCFG_MFV_ARRAY_D_ADDR_OFFSET 0x040 +#define SYSCFG_SYS_BACKUP0_ADDR_OFFSET 0x044 + +//================================ +//BLOCK SYSCFG reg struct define +typedef union //0x008 +{ + struct + { + uint32_t SYS_DEBUG_SEL: 2; // bit[1:0] --- + // 2'b00: rf_debug port enable + // 2'b01: BB debug port enable + // 2'b10: MODEM debug port enable + // 2'b11: USB debug port enable + uint32_t RF_EXT_EN: 1; // bit2 --- chip set as RF IP block + // 0: rf reg is controlled by on chip logic; + // 1: rf reg is controlled by external through SPI interface + uint32_t RF_SPI_EN: 1; // bit3 --- + // 0: RF reg is direct controlled by APB interface + // 1: RF reg is controlled by SPI interface + // note + // {rf_ext_en,rf_spi_en} + // 00: rf reg is controlled by on chip APB interface + // 01: rf reg is controlled by BB througth SPI interface + // 11: rf reg is controlled by external Chip through SPI interface + // 10: forbidden + uint32_t IWDT_DEBUG: 1; // bit4 + uint32_t USB_DBG_SEL: 2; // bit[6:5] + uint32_t RSV_END: 25; // bit[31:7] + }; + uint32_t Word; +} SYSCFG_DBG_CTRL_TypeDef; //0x008 + + +//================================ +#define SYSCFG_SYS_DEBUG_SEL_LSB 0 +#define SYSCFG_SYS_DEBUG_SEL_WIDTH 2 +#define SYSCFG_RF_EXT_EN_POS 2 +#define SYSCFG_RF_SPI_EN_POS 3 +#define SYSCFG_IWDT_DEBUG_POS 4 +#define SYSCFG_USB_DBG_SEL_LSB 5 +#define SYSCFG_USB_DBG_SEL_WIDTH 2 +//================================ + +typedef union //0x00c +{ + struct + { + uint32_t USB_SOF_INT_EN: 1; // bit0 --- when is 1, USB SOF signal can be used as interrupt + uint32_t USB_PHY_MOD: 1; // bit1 --- + // 1: the chip is set as USB PHY + uint32_t DIG_USB_PU: 2; // bit[3:2] --- set as 1 when USB function enable + // when is 1, enable pullup 1.5K for DP + uint32_t DIG_USB_RXEN: 1; // bit4 + uint32_t RSV_NOUSE1: 3; // bit[7:5] --- Ignore me + uint32_t USB_NRSTO: 1; // bit8 --- when is 1, USB is exit reset + uint32_t USB_SUSPEND: 1; // bit9 + uint32_t RSV_END: 22; // bit[31:10] + }; + uint32_t Word; +} SYSCFG_USB_CTRL_TypeDef; //0x00c + + +//================================ +#define SYSCFG_USB_SOF_INT_EN_POS 0 +#define SYSCFG_USB_PHY_MOD_POS 1 +#define SYSCFG_DIG_USB_PU_LSB 2 +#define SYSCFG_DIG_USB_PU_WIDTH 2 +#define SYSCFG_DIG_USB_RXEN_POS 4 +#define SYSCFG_USB_NRSTO_POS 8 +#define SYSCFG_USB_SUSPEND_POS 9 +//================================ + +typedef union //0x010 +{ + struct + { + uint32_t ROM_RDMG: 4; // bit[3:0] + uint32_t ROM_RDMG_EN: 1; // bit4 + uint32_t MEM_SCAN_IN: 1; // bit5 + uint32_t RSV_NOUSE1: 2; // bit[7:6] --- Ignore me + uint32_t MDM_RDMG: 3; // bit[10:8] + uint32_t MDM_RDMG_EN: 1; // bit11 + uint32_t RSV_END: 20; // bit[31:12] + }; + uint32_t Word; +} SYSCFG_ROM_CTRL_TypeDef; //0x010 + + +//================================ +#define SYSCFG_ROM_RDMG_LSB 0 +#define SYSCFG_ROM_RDMG_WIDTH 4 +#define SYSCFG_ROM_RDMG_EN_POS 4 +#define SYSCFG_MEM_SCAN_IN_POS 5 +#define SYSCFG_MDM_RDMG_LSB 8 +#define SYSCFG_MDM_RDMG_WIDTH 3 +#define SYSCFG_MDM_RDMG_EN_POS 11 +//================================ + +typedef union //0x014 +{ + struct + { + uint32_t TAG_RDMG: 4; // bit[3:0] + uint32_t CACHE_RDMG: 4; // bit[7:4] + uint32_t EM_RDMG: 4; // bit[11:8] + uint32_t SADCMEM_RDMG: 4; // bit[15:12] + uint32_t USBMEM_RDMG: 4; // bit[19:16] + uint32_t DSRAM_RDMG: 3; // bit[22:20] + uint32_t RSV_NOUSE1: 1; // bit23 --- Ignore me + uint32_t TAG_RDMG_EN: 1; // bit24 + uint32_t CACHE_RDMG_EN: 1; // bit25 + uint32_t EM_RDMG_EN: 1; // bit26 + uint32_t SADCMEM_RDMG_EN: 1; // bit27 + uint32_t USBMEM_RDMG_EN: 1; // bit28 + uint32_t DSRAM_RDMG_EN: 1; // bit29 + uint32_t RSV_END: 2; // bit[31:30] + }; + uint32_t Word; +} SYSCFG_SRAM_CTRL_TypeDef; //0x014 + + +//================================ +#define SYSCFG_TAG_RDMG_LSB 0 +#define SYSCFG_TAG_RDMG_WIDTH 4 +#define SYSCFG_CACHE_RDMG_LSB 4 +#define SYSCFG_CACHE_RDMG_WIDTH 4 +#define SYSCFG_EM_RDMG_LSB 8 +#define SYSCFG_EM_RDMG_WIDTH 4 +#define SYSCFG_SADCMEM_RDMG_LSB 12 +#define SYSCFG_SADCMEM_RDMG_WIDTH 4 +#define SYSCFG_USBMEM_RDMG_LSB 16 +#define SYSCFG_USBMEM_RDMG_WIDTH 4 +#define SYSCFG_DSRAM_RDMG_LSB 20 +#define SYSCFG_DSRAM_RDMG_WIDTH 3 +#define SYSCFG_TAG_RDMG_EN_POS 24 +#define SYSCFG_CACHE_RDMG_EN_POS 25 +#define SYSCFG_EM_RDMG_EN_POS 26 +#define SYSCFG_SADCMEM_RDMG_EN_POS 27 +#define SYSCFG_USBMEM_RDMG_EN_POS 28 +#define SYSCFG_DSRAM_RDMG_EN_POS 29 +//================================ + +//================================ +//BLOCK SYSCFG top struct define +typedef struct +{ + __IO uint32_t BB_PMU_ENABLE ; // 0x000, + __IO uint32_t AHB_MATRIX_PRIORITY ; // 0x004, + __IO SYSCFG_DBG_CTRL_TypeDef DBG_CTRL ; // 0x008, + __IO SYSCFG_USB_CTRL_TypeDef USB_CTRL ; // 0x00c, + __IO SYSCFG_ROM_CTRL_TypeDef ROM_CTRL ; // 0x010, + __IO SYSCFG_SRAM_CTRL_TypeDef SRAM_CTRL ; // 0x014, + __IO uint32_t ROM_SIGNATURE_TARGET; // 0x018, + // set rom_target_signature value before bist_mode as 1 + __IO uint32_t BIST_MODE ; // 0x01c, + // all sram and rom bist start + // note: bist follow + // mode 1 : get report from GPIO + // 1) : config GPIO for glb_bist_done and glb_bist_fail + // 2) : set rom_signature_target value + // 3) : set bist_mode as 1 + // 4) : wait a fixed time + // 5) : check the glb_bist_done and glb_bist_fail state through GPIO + // + // mode 2 : get report from bist_statues + // 1) : set rom_signature_target value + // 2) : set bist_mode as 1 + // 3) : wait a fixed time + // 4) : reset chip, and reconnect chip through UART + // 5) : check the glb_bist_done and glb_bist_fail state through bist_status[1:0] + // option step 6) : set bist_status_clr as 1 for clear status + __I uint32_t BIST_STATUS ; // 0x020, + // [0] global bist done + // [1] global bist fail + // [2] em_bist_done + // [3] sram_bist_done + // [4] sadcmem_bist_done + // [5] mdm_bist_done + // [6] rom_bist_done + // [7] em_bist_fail + // [8] sram_bist_fail + // [9] sadcmem_bist_fail + // [10] mdmmem_bist_fail + // [11] rom_bist_fail + __O uint32_t BIST_STATUS_CLR ; // 0x024, + __I uint32_t ROM_SIGNATURE_RPT ; // 0x028, + // rom signature report, just use for debug + __IO uint32_t CACHSRAM_CFG ; // 0x02c, + // 0: the 4KB sram use as CACHE + // 1: the 4KB sram use as DATA SRAM: 0x2000_6000 ~ 0x2000_6FFF + __IO uint32_t EM_BASE_CFG ; // 0x030, + // 1KB step + // 0: BB EM base addr: 0x2000_8000, EM size : 8KB + // 1: BB EM base addr: 0x2000_8400, EM size : 7KB + // 2: BB EM base addr: 0x2000_8800, EM size : 6KB + // 3: BB EM base addr: 0x2000_8c00, EM size : 5KB + // 4: BB EM base addr: 0x2000_9000, EM size : 4KB + // 5: BB EM base addr: 0x2000_9400, EM size : 3KB + // 6: BB EM base addr: 0x2000_9800, EM size : 2KB + // 7: BB EM base addr: 0x2000_9c00, EM size : 1KB + __I uint32_t CACHE_ACCESS_CNT ; // 0x034, + __I uint32_t CACHE_HIT_CNT ; // 0x038, + __I uint32_t ACC_CCR_BUSY ; // 0x03c, + // cache status + __I uint32_t MFV_ARRAY_D ; // 0x040, + __IO uint32_t SYS_BACKUP0 ; // 0x044, + // only reset by core por12_core_stb +} SYSCFG_TypeDef; + + +#define SYSCFG (( SYSCFG_TypeDef *) SYSCFG_BASE) + +#endif diff --git a/core/reg/reg_timer.h b/core/reg/reg_timer.h new file mode 100644 index 0000000..750fe24 --- /dev/null +++ b/core/reg/reg_timer.h @@ -0,0 +1,444 @@ +#ifndef _REG_TIMER_H_ +#define _REG_TIMER_H_ + +#include "reg_base.h" + +#define CTMR_BASE 0x40021000 +#define ATMR_BASE 0x40022000 + +typedef union // 0x000 TIM_CR1 +{ + struct + { + uint32_t CEN: 1; // bit0 --- Counter Enable + uint32_t UDIS: 1; // bit1 --- Update Disable + uint32_t URS: 1; // bit2 --- Update Request Source + uint32_t OPM: 1; // bit3 --- One Pluse Mode + uint32_t DIR: 1; // bit4 --- Direction + uint32_t CMS: 2; // bit[6:5] --- Center-aligned Mode Select + uint32_t ARPE: 1; // bit7 --- Auto-Reload Preload Enable + uint32_t CKD: 2; // bit[9:8] --- Clock Division + uint32_t CMPSEL: 2; // bit[11:10]--- Compare input Select (Only ADTMR1) + uint32_t RES: 20; // bit[31:12]--- Reserved + }; + uint32_t Word; +} TIMER_CR1_Typedef; + +//================================ +#define TIMER_CEN_POS 0 +#define TIMER_UDIS_POS 1 +#define TIMER_URS_POS 2 +#define TIMER_OPM_POS 3 +#define TIMER_DIR_POS 4 +#define TIMER_CMS_LSB 5 +#define TIMER_CMS_WIDTH 2 +#define TIMER_ARPE_POS 7 +#define TIMER_CKD_LSB 8 +#define TIMER_CKD_WIDTH 2 +#define TIMER_CMP_SEL_LSB 10 +#define TIMER_CMP_SEL_WIDTH 2 +//================================ + + +typedef union // 0x004 TIM_CR2 +{ + struct + { + uint32_t CCPC: 1; // bit0 --- Capture/Compare Preload Control + uint32_t RES0: 1; // bit1 --- Reserved + uint32_t CCUS: 1; // bit2 --- Capture/Compare Control Update Select + uint32_t CCDS: 1; // bit3 --- Capture/Compare DMA Select + uint32_t MMS: 3; // bit[6:4] --- Master Mode Select + uint32_t TI1S: 1; // bit7 --- TI1 Select + uint32_t OIS1: 1; // bit8 --- Output Idle State1(OC1 Output) + uint32_t OIS1N: 1; // bit9 --- Output Idle State1(OC1N Output) + uint32_t OIS2: 1; // bit10 --- Output Idle State2(OC2 Output) + uint32_t OIS2N: 1; // bit11 --- Output Idle State2(OC2N Output) + uint32_t OIS3: 1; // bit12 --- Output Idle State3(OC3 Output) + uint32_t OIS3N: 1; // bit13 --- Output Idle State3(OC3N Output) + uint32_t OIS4: 1; // bit14 --- Output Idle State4(OC4 Output) + uint32_t RES1: 17; // bit[31:15]--- Reserved + }; + uint32_t Word; +} TIMER_CR2_Typedef; + + +//================================ +#define TIMER_CCPC_POS 0 +#define TIMER_CCUS_POS 2 +#define TIMER_CCDS_POS 3 +#define TIMER_MMS_LSB 4 +#define TIMER_MMS_WIDTH 3 +#define TIMER_TI1S_POS 7 +#define TIMER_OIS1_POS 8 +#define TIMER_OIS1N_POS 9 +#define TIMER_OIS2_POS 10 +#define TIMER_OIS2N_POS 11 +#define TIMER_OIS3_POS 12 +#define TIMER_OIS3N_POS 13 +#define TIMER_OIS4_POS 14 +//================================ + +typedef union // 0x008 TIM_SMCR +{ + struct + { + uint32_t SMS: 3; // bit[2:0] --- Slave Mode Select + uint32_t RES0: 1; // bit3 --- Reserved + uint32_t TS: 3; // bit[6:4] --- Trigger Select + uint32_t MSM: 1; // bit7 --- Master/Slave Mode + uint32_t ETF: 4; // bit[11:8] --- External Trigger Filter + uint32_t ETPS: 2; // bit[13:12]--- External Trigger Prescaler + uint32_t ETE: 1; // bit14 --- External Clock Enable + uint32_t ETP: 1; // bit15 --- External Trigger Polarity + uint32_t RES1: 16; // bit[31:16]--- Reserved + }; + uint32_t Word; +} TIMER_SMCR_Typedef; + + +//================================ +#define TIMER_SMS_LSB 0 +#define TIMER_SMS_WIDTH 3 +#define TIMER_TS_LSB 4 +#define TIMER_TS_WIDTH 3 +#define TIMER_MSM_POS 7 +#define TIMER_ETF_LSB 8 +#define TIMER_ETF_WIDTH 4 +#define TIMER_ETPS_LSB 12 +#define TIMER_ETPS_WIDTH 2 +#define TIMER_ETE_POS 14 +#define TIMER_ETP_POS 15 +//================================ + +typedef union // 0x00C/0x010/0x014/0x018/0x01C/0x020 TIM_IER/IDR/IVS/RIF/IFM/ICR +{ + struct + { + uint32_t UI: 1; // bit0 --- Update Interrupt + uint32_t CC1I: 1; // bit1 --- Capture/Compare 1 Interrupt + uint32_t CC2I: 1; // bit2 --- Capture/Compare 2 Interrupt + uint32_t CC3I: 1; // bit3 --- Capture/Compare 3 Interrupt + uint32_t CC4I: 1; // bit4 --- Capture/Compare 4 Interrupt + uint32_t COMI: 1; // bit5 --- COM Interrupt + uint32_t TI: 1; // bit6 --- Trigger Interrupt + uint32_t BI: 1; // bit7 --- Break Interrupt + uint32_t RES0: 1; // bit8 --- Reserved + uint32_t CC1OI: 1; // bit9 --- Capture/Compare 1 Overcapture Interrupt + uint32_t CC2OI: 1; // bit10 --- Capture/Compare 2 Overcapture Interrupt + uint32_t CC3OI: 1; // bit11 --- Capture/Compare 3 Overcapture Interrupt + uint32_t CC4OI: 1; // bit12 --- Capture/Compare 4 Overcapture Interrupt + uint32_t RES1: 19; // bit[31:13]--- Reserved + }; + uint32_t Word; +} TIMER_INT_Typedef; + + +//================================ +#define TIMER_UI_POS 0 +#define TIMER_CC1I_POS 1 +#define TIMER_CC2I_POS 2 +#define TIMER_CC3I_POS 3 +#define TIMER_CC4I_POS 4 +#define TIMER_COMI_POS 5 +#define TIMER_TI_POS 6 +#define TIMER_BI_POS 7 +#define TIMER_CC1OI_POS 9 +#define TIMER_CC2OI_POS 10 +#define TIMER_CC3OI_POS 11 +#define TIMER_CC4OI_POS 12 +//================================ + +typedef union // 0x024 TIM_EGR +{ + struct + { + uint32_t UG: 1; // bit0 --- Update Generation + uint32_t CC1G: 1; // bit1 --- Capture/Compare 1 Generation + uint32_t CC2G: 1; // bit2 --- Capture/Compare 2 Generation + uint32_t CC3G: 1; // bit3 --- Capture/Compare 3 Generation + uint32_t CC4G: 1; // bit4 --- Capture/Compare 4 Generation + uint32_t COMG: 1; // bit5 --- Capture/Compare Control Update Generation + uint32_t TG: 1; // bit6 --- Trigger Generation + uint32_t BG: 1; // bit7 --- Break Generation + uint32_t RES: 24; // bit[31:8]--- Reserved + }; + uint32_t Word; +} TIMER_EGR_Typedef; + +//================================ +#define TIMER_UG_POS 0 +#define TIMER_CC1G_POS 1 +#define TIMER_CC2G_POS 2 +#define TIMER_CC3G_POS 3 +#define TIMER_CC4G_POS 4 +#define TIMER_COMG_POS 5 +#define TIMER_TG_POS 6 +#define TIMER_BG_POS 7 +//================================ + +typedef union // 0x028 TIM_CCMR1 +{ + struct + { + uint32_t CC1S: 2; // bit[1:0] --- Capture/Compare 1 Select + uint32_t OC1FE: 1; // bit2 --- Output Compare 1 Fast Enable + uint32_t OC1PE: 1; // bit3 --- Output Compare 1 Preload Enable + uint32_t OC1M: 3; // bit[6:4] --- Output Compare 1 Mode + uint32_t OC1CE: 1; // bit7 --- Output Compare 1 Clear Enable + uint32_t CC2S: 2; // bit[9:8] --- Capture/Compare 2 Select + uint32_t OC2FE: 1; // bit10 --- Output Compare 2 Fast Enable + uint32_t OC2PE: 1; // bit11 --- Output Compare 2 Preload Enable + uint32_t OC2M: 3; // bit[14:12]--- Output Compare 2 Mode + uint32_t OC2CE: 1; // bit15 --- Output Compare 2 Clear Enable + uint32_t RES: 16; // bit[31:16]--- Reserved + }OUTPUT; + + struct + { + uint32_t CC1S: 2; // bit[1:0] --- Capture/Compare 1 Select + uint32_t IC1PSC: 2; // bit[3:2] --- Input Capture 1 Prescaler + uint32_t IC1F: 4; // bit[7:4] --- Input Capture 1 Filter + uint32_t CC2S: 2; // bit[9:8] --- Capture/Compare 2 Select + uint32_t IC2PSC: 2; // bit[11:10]--- Input Capture 2 Prescaler + uint32_t IC2F: 4; // bit[15:12]--- Input Capture 2 Filter + uint32_t RES: 16; // bit[31:16]--- Reserved + }INPUT; + uint32_t Word; +} TIMER_CCMR1_Typedef; + + +//================================ +#define TIMER_OUT_CC1S_LSB 0 +#define TIMER_OUT_CC1S_WIDTH 2 +#define TIMER_OUT_OC1FE_POS 2 +#define TIMER_OUT_OC1PE_POS 3 +#define TIMER_OUT_OC1M_LSB 4 +#define TIMER_OUT_OC1M_WIDTH 3 +#define TIMER_OUT_OC1CE_POS 7 +#define TIMER_OUT_CC2S_LSB 8 +#define TIMER_OUT_CC2S_WIDTH 2 +#define TIMER_OUT_OC2FE_POS 10 +#define TIMER_OUT_OC2PE_POS 11 +#define TIMER_OUT_OC2M_LSB 12 +#define TIMER_OUT_OC2M_WIDTH 3 +#define TIMER_OUT_OC2CE_POS 15 +//================================ +#define TIMER_IN_CC1S_LSB 0 +#define TIMER_IN_CC1S_WIDTH 2 +#define TIMER_IN_IC1PSC_LSB 2 +#define TIMER_IN_IC1PSC_WIDTH 2 +#define TIMER_IN_IC1F_LSB 4 +#define TIMER_IN_IC1F_WIDTH 4 +#define TIMER_IN_CC2S_LSB 8 +#define TIMER_IN_CC2S_WIDTH 2 +#define TIMER_IN_IC2PSC_LSB 10 +#define TIMER_IN_IC2PSC_WIDTH 2 +#define TIMER_IN_IC2F_LSB 12 +#define TIMER_IN_IC2F_WIDTH 4 +//================================ + + +typedef union // 0x02C TIM_CCMR2 +{ + struct + { + uint32_t CC3S: 2; // bit[1:0] --- Capture/Compare 3 Select + uint32_t OC3FE: 1; // bit2 --- Output Compare 3 Fast Enable + uint32_t OC3PE: 1; // bit3 --- Output Compare 3 Preload Enable + uint32_t OC3M: 3; // bit[6:4] --- Output Compare 3 Mode + uint32_t OC3CE: 1; // bit7 --- Output Compare 3 Clear Enable + uint32_t CC4S: 2; // bit[9:8] --- Capture/Compare 4 Select + uint32_t OC4FE: 1; // bit10 --- Output Compare 4 Fast Enable + uint32_t OC4PE: 1; // bit11 --- Output Compare 4 Preload Enable + uint32_t OC4M: 3; // bit[14:12]--- Output Compare 4 Mode + uint32_t OC4CE: 1; // bit15 --- Output Compare 4 Clear Enable + uint32_t RES: 16; // bit[31:16]--- Reserved + }OUTPUT; + + struct + { + uint32_t CC3S: 2; // bit[1:0] --- Capture/Compare 3 Select + uint32_t IC3PSC: 2; // bit[3:2] --- Input Capture 3 Prescaler + uint32_t IC3F: 4; // bit[7:4] --- Input Capture 3 Filter + uint32_t CC4S: 2; // bit[9:8] --- Capture/Compare 4 Select + uint32_t IC4PSC: 2; // bit[11:10]--- Input Capture 4 Prescaler + uint32_t IC4F: 4; // bit[15:12]--- Input Capture 4 Filter + uint32_t RES: 16; // bit[31:16]--- Reserved + }INPUT; + uint32_t Word; +} TIMER_CCMR2_Typedef; + + +//================================ +#define TIMER_OUT_CC3S_LSB 0 +#define TIMER_OUT_CC3S_WIDTH 2 +#define TIMER_OUT_OC3FE_POS 2 +#define TIMER_OUT_OC3PE_POS 3 +#define TIMER_OUT_OC3M_LSB 4 +#define TIMER_OUT_OC3M_WIDTH 3 +#define TIMER_OUT_OC3CE_POS 7 +#define TIMER_OUT_CC4S_LSB 8 +#define TIMER_OUT_CC4S_WIDTH 2 +#define TIMER_OUT_OC4FE_POS 10 +#define TIMER_OUT_OC4PE_POS 11 +#define TIMER_OUT_OC4M_LSB 12 +#define TIMER_OUT_OC4M_WIDTH 3 +#define TIMER_OUT_OC4CE_POS 15 +//================================ +#define TIMER_IN_CC3S_LSB 0 +#define TIMER_IN_CC3S_WIDTH 2 +#define TIMER_IN_IC3PSC_LSB 2 +#define TIMER_IN_IC3PSC_WIDTH 2 +#define TIMER_IN_IC3F_LSB 4 +#define TIMER_IN_IC3F_WIDTH 4 +#define TIMER_IN_CC4S_LSB 8 +#define TIMER_IN_CC4S_WIDTH 2 +#define TIMER_IN_IC4PSC_LSB 10 +#define TIMER_IN_IC4PSC_WIDTH 2 +#define TIMER_IN_IC4F_LSB 12 +#define TIMER_IN_IC4F_WIDTH 4 +//================================ + + +typedef union // 0x030 TIM_CCER +{ + struct + { + uint32_t CC1E: 1; //bit0 --- Capture/Compare 1 Output Enable + uint32_t CC1P: 1; //bit1 --- Capture/Compare 1 Output Polarity + uint32_t CC1NE: 1; //bit2 --- Capture/Compare 1 Complementary Output Enable + uint32_t CC1NP: 1; //bit3 --- Capture/Compare 1 Complementary Output Polarity + uint32_t CC2E: 1; //bit4 --- Capture/Compare 2 Output Enable + uint32_t CC2P: 1; //bit5 --- Capture/Compare 2 Output Polarity + uint32_t CC2NE: 1; //bit6 --- Capture/Compare 2 Complementary Output Enable + uint32_t CC2NP: 1; //bit7 --- Capture/Compare 2 Complementary Output Polarity + uint32_t CC3E: 1; //bit8 --- Capture/Compare 3 Output Enable + uint32_t CC3P: 1; //bit9 --- Capture/Compare 3 Output Polarity + uint32_t CC3NE: 1; //bit10 --- Capture/Compare 3 Complementary Output Enable + uint32_t CC3NP: 1; //bit11 --- Capture/Compare 3 Complementary Output Polarity + uint32_t CC4E: 1; //bit12 --- Capture/Compare 4 Output Enable + uint32_t CC4P: 1; //bit13 --- Capture/Compare 4 Output Polarity + uint32_t RES: 18; //bit[31:14]--- Reserved + }; + uint32_t Word; +} TIMER_CCER_Typedef; + +//================================ +#define TIMER_CC1E_POS 0 +#define TIMER_CC1P_POS 1 +#define TIMER_CC1NE_POS 2 +#define TIMER_CC1NP_POS 3 +#define TIMER_CC2E_POS 4 +#define TIMER_CC2P_POS 5 +#define TIMER_CC2NE_POS 6 +#define TIMER_CC2NP_POS 7 +#define TIMER_CC3E_POS 8 +#define TIMER_CC3P_POS 9 +#define TIMER_CC3NE_POS 10 +#define TIMER_CC3NP_POS 11 +#define TIMER_CC4E_POS 12 +#define TIMER_CC4P_POS 13 +//================================ + +typedef union // 0x054 TIM_BDTR +{ + struct + { + uint32_t DTG: 8; // bit[7:0] --- Dead-Time Generator Setup + uint32_t LOCK: 2; // bit[9:8] --- Lock Configuration + uint32_t OSSI: 1; // bit10 --- Off-state Selection for Idle Mode + uint32_t OSSR: 1; // bit11 --- Off-state Selection for Run Mode + uint32_t BKE: 1; // bit12 --- Break Enable + uint32_t BKP: 1; // bit13 --- Break Polarity + uint32_t AOE: 1; // bit14 --- Automatic Output Enable + uint32_t MOE: 1; // bit15 --- Main Output Enable + uint32_t RES: 16; // bit[31:16]--- Reserved + }; + uint32_t Word; +} TIMER_BDTR_Typedef; + + +//================================ +#define TIMER_DTG_LSB 0 +#define TIMER_DTG_WIDTH 8 +#define TIMER_LOCK_LSB 8 +#define TIMER_LOCK_WIDTH 2 +#define TIMER_OSSI_POS 10 +#define TIMER_OSSR_POS 11 +#define TIMER_BKE_POS 12 +#define TIMER_BKP_POS 13 +#define TIMER_AOE_POS 14 +#define TIMER_MOE_POS 15 +//=================================== + + +typedef union // 0x058 TIM_DMAEN +{ + struct + { + uint32_t UDE: 1; // bit0 --- Update DMA Request Enable + uint32_t CC1DE: 1; // bit1 --- Capture/Compare 1 DMA Request Enable + uint32_t CC2DE: 1; // bit2 --- Capture/Compare 2 DMA Request Enable + uint32_t CC3DE: 1; // bit3 --- Capture/Compare 3 DMA Request Enable + uint32_t CC4DE: 1; // bit4 --- Capture/Compare 4 DMA Request Enable + uint32_t COMDE: 1; // bit5 --- COM DMA Request Enable + uint32_t TDE: 1; // bit6 --- Trigger DMA Request Enable + uint32_t RES: 25; // bit[31:7]--- Reserved + }; + uint32_t Word; +} TIMER_DMAEN_Typedef; + + +//================================ +#define TIMER_UDE_POS 0 +#define TIMER_CC1DE_POS 1 +#define TIMER_CC2DE_POS 2 +#define TIMER_CC3DE_POS 3 +#define TIMER_CC4DE_POS 4 +#define TIMER_COMDE_POS 5 +#define TIMER_TDE_POS 6 +//================================ + +typedef struct +{ + __IO TIMER_CR1_Typedef CR1 ; // 0x000 --- Control register 1 + __IO TIMER_CR2_Typedef CR2 ; // 0x004 --- Control register 2 + __IO TIMER_SMCR_Typedef SMCR ; // 0x008 --- Slave mode control register + __O TIMER_INT_Typedef IER ; // 0x00C --- Interrupt Enable register + __O TIMER_INT_Typedef IDR ; // 0x010 --- Interrupt Disable register + __I TIMER_INT_Typedef IVS ; // 0x014 --- Interrupt Valid status register + __I TIMER_INT_Typedef RIF ; // 0x018 --- Interrupt Raw interrupt Flag + __I TIMER_INT_Typedef IFM ; // 0x01C --- Interrupt Masked interrupt Flag + __O TIMER_INT_Typedef ICR ; // 0x020 --- Interrupt Clear status register + __IO TIMER_EGR_Typedef EGR ; // 0x024 --- Event generation register + union { + __IO uint32_t CCMR[2]; + struct { + __IO TIMER_CCMR1_Typedef CCMR1; // 0x028 Capture/compare mode register 1 + __IO TIMER_CCMR2_Typedef CCMR2; // 0x02C Capture/compare mode register 2 + }; + }; + __IO TIMER_CCER_Typedef CCER ; // 0x030 --- Capture/compare enable register + __IO uint32_t CNT ; // 0x034 --- Timer Counter + __IO uint32_t PSC ; // 0x038 --- Prescaler + __IO uint32_t ARR ; // 0x03C --- Auto-reload register + __IO uint32_t RCR ; // 0x040 --- Repetition counter register + union { + __IO uint32_t CCR[4]; + struct { + __IO uint32_t CCR1 ; // 0x044 --- Capture/compare register 1 + __IO uint32_t CCR2 ; // 0x048 --- Capture/compare register 2 + __IO uint32_t CCR3 ; // 0x04C --- Capture/compare register 3 + __IO uint32_t CCR4 ; // 0x050 --- Capture/compare register 4 + }; + }; + __IO TIMER_BDTR_Typedef BDTR ; // 0x054 --- Break and dead-time register + __IO TIMER_DMAEN_Typedef DMAEN; // 0x058 --- DMA trigger event enable +} TIMER_TypeDef; + + +#define CTMR ((TIMER_TypeDef *) CTMR_BASE) +#define ATMR ((TIMER_TypeDef *) ATMR_BASE) + +#endif // _REG_TIMER_H_ diff --git a/core/reg/reg_uart.h b/core/reg/reg_uart.h new file mode 100644 index 0000000..31bdc55 --- /dev/null +++ b/core/reg/reg_uart.h @@ -0,0 +1,426 @@ +#ifndef _REG_UART_H_ +#define _REG_UART_H_ + +#include "reg_base.h" + +//================================ +//BLOCK UART define + +#define UART1_BASE ((uint32_t)0x40023000) +#define UART2_BASE ((uint32_t)0x40024000) +#define UART_RBR_ADDR_OFFSET 0x000 +#define UART_TBR_ADDR_OFFSET 0x004 +#define UART_BRR_ADDR_OFFSET 0x008 +#define UART_LCR_ADDR_OFFSET 0x00c +#define UART_MCR_ADDR_OFFSET 0x010 +#define UART_CR_ADDR_OFFSET 0x014 +#define UART_RTOR_ADDR_OFFSET 0x018 +#define UART_FCR_ADDR_OFFSET 0x01c +#define UART_SR_ADDR_OFFSET 0x020 +#define UART_IER_ADDR_OFFSET 0x024 +#define UART_IDR_ADDR_OFFSET 0x028 +#define UART_IVS_ADDR_OFFSET 0x02c +#define UART_RIF_ADDR_OFFSET 0x030 +#define UART_IFM_ADDR_OFFSET 0x034 +#define UART_ICR_ADDR_OFFSET 0x038 + +//================================ +//BLOCK UART reg struct define +typedef union //0x00c +{ + struct + { + uint32_t DLS: 2; // bit[1:0] --- data length select + uint32_t STOP: 1; // bit2 --- stop bit select + uint32_t PE: 1; // bit3 --- parity enable bit + uint32_t PS: 1; // bit4 --- parity mode select + uint32_t RXEN: 1; // bit5 --- uart receive enable + uint32_t BC: 1; // bit6 --- break control + uint32_t BRWEN: 1; // bit7 --- baud rate write enable + uint32_t RTOEN: 1; // bit8 --- receive time out enable + uint32_t MSBFIRST: 1; // bit9 --- the most significant bit first + uint32_t DATAINV: 1; // bit10 --- binary data inversion + uint32_t RXINV: 1; // bit11 --- rx pin active level inversion + uint32_t TXINV: 1; // bit12 --- tx pin active level inversion + uint32_t SWAP: 1; // bit13 --- swap tx/rx pin + uint32_t RTO_SEL: 1; // bit14 --- receiver timeout mode select: 0:CPU; 1:DMA + uint32_t RSV_END: 17; // bit[31:15] + }; + uint32_t Word; +} UART_LCR_TypeDef; //0x00c + + +//================================ +#define UART_DLS_LSB 0 +#define UART_DLS_WIDTH 2 +#define UART_STOP_POS 2 +#define UART_PE_POS 3 +#define UART_PS_POS 4 +#define UART_RXEN_POS 5 +#define UART_BC_POS 6 +#define UART_BRWEN_POS 7 +#define UART_RTOEN_POS 8 +#define UART_MSBFIRST_POS 9 +#define UART_DATAINV_POS 10 +#define UART_RXINV_POS 11 +#define UART_TXINV_POS 12 +#define UART_SWAP_POS 13 +#define UART_RTO_SEL_POS 14 +//================================ + +typedef union //0x010 +{ + struct + { + uint32_t IREN: 1; // bit0 --- irDA mode enable (only uart) + uint32_t LBEN: 1; // bit1 --- loopback enable + uint32_t AFCEN: 1; // bit2 --- auto flow control enable + uint32_t RTSCTRL: 1; // bit3 --- auto flow RTS + uint32_t AADEN: 1; // bit4 --- 485 auto address en + uint32_t AADNOR: 1; // bit5 --- 485 auto address normal + uint32_t AADDIR: 1; // bit6 --- 485 auto address direction control en + uint32_t AADINV: 1; // bit7 --- 485 auto address RTS invert + uint32_t LINEN: 1; // bit8 --- lin mode en + uint32_t BKREQ: 1; // bit9 --- lin break request + uint32_t LINBDL: 1; // bit10 --- lin break detection length + uint32_t DMAEN: 1; // bit11 --- DMA en + uint32_t ABREN: 1; // bit12 --- auto baud + uint32_t ABRMOD: 2; // bit[14:13] --- auto baud rate + uint32_t ABRRS: 1; // bit15 --- auto baud restart + uint32_t SCEN: 1; // bit16 --- smart en + uint32_t SCNACK: 1; // bit17 --- smart nack + uint32_t SCCNT: 3; // bit[20:18] --- smart error + uint32_t CLKEN: 1; // bit21 --- smart clock + uint32_t HDSEL: 1; // bit22 --- half-duplex seletion + uint32_t RSV_END: 9; // bit[31:23] + }; + uint32_t Word; +} UART_MCR_TypeDef; //0x010 + + +//================================ +#define UART_IREN_POS 0 +#define UART_LBEN_POS 1 +#define UART_AFCEN_POS 2 +#define UART_RTSCTRL_POS 3 +#define UART_AADEN_POS 4 +#define UART_AADNOR_POS 5 +#define UART_AADDIR_POS 6 +#define UART_AADINV_POS 7 +#define UART_LINEN_POS 8 +#define UART_BKREQ_POS 9 +#define UART_LINBDL_POS 10 +#define UART_DMAEN_POS 11 +#define UART_ABREN_POS 12 +#define UART_ABRMOD_LSB 13 +#define UART_ABRMOD_WIDTH 2 +#define UART_ABRRS_POS 15 +#define UART_SCEN_POS 16 +#define UART_SCNACK_POS 17 +#define UART_SCCNT_LSB 18 +#define UART_SCCNT_WIDTH 3 +#define UART_CLKEN_POS 21 +#define UART_HDSEL_POS 22 +//================================ + +typedef union //0x014 +{ + struct + { + uint32_t ADDR: 8; // bit[7:0] --- rs485 address match value + uint32_t DLY: 8; // bit[15:8] --- rs485 delay value + uint32_t PSC: 8; // bit[23:16] --- prescaler value (only uart) + uint32_t GT: 8; // bit[31:24] --- guard time value (only uart) + }; + uint32_t Word; +} UART_CR_TypeDef; //0x014 + + +//================================ +#define UART_ADDR_LSB 0 +#define UART_ADDR_WIDTH 8 +#define UART_DLY_LSB 8 +#define UART_DLY_WIDTH 8 +#define UART_PSC_LSB 16 +#define UART_PSC_WIDTH 8 +#define UART_GT_LSB 24 +#define UART_GT_WIDTH 8 +//================================ + +typedef union //0x018 +{ + struct + { + uint32_t RTO: 24; // bit[23:0] --- receive timeout value + uint32_t BLEN: 8; // bit[31:24] --- block length + }; + uint32_t Word; +} UART_RTOR_TypeDef; //0x018 + + +//================================ +#define UART_RTO_LSB 0 +#define UART_RTO_WIDTH 24 +#define UART_BLEN_LSB 24 +#define UART_BLEN_WIDTH 8 +//================================ + +typedef union //0x01c +{ + struct + { + uint32_t FIFOEN: 1; // bit0 --- fifo enable + uint32_t RFRST: 1; // bit1 --- fifo rx reset data + uint32_t TFRST: 1; // bit2 --- fifo tx reset data + uint32_t RSV_NOUSE1: 1; // bit3 --- Ignore me + uint32_t RXTL: 2; // bit[5:4] --- fifo rx trigger level + uint32_t TXTL: 2; // bit[7:6] --- fifo tx trigger level + uint32_t RXFL: 5; // bit[12:8] --- fifo rx level counter + uint32_t TXFL: 5; // bit[17:13] --- fifo tx level counter + uint32_t RSV_END: 14; // bit[31:18] + }; + uint32_t Word; +} UART_FCR_TypeDef; //0x01c + + +//================================ +#define UART_FIFOEN_POS 0 +#define UART_RFRST_POS 1 +#define UART_TFRST_POS 2 +#define UART_RXTL_LSB 4 +#define UART_RXTL_WIDTH 2 +#define UART_TXTL_LSB 6 +#define UART_TXTL_WIDTH 2 +#define UART_RXFL_LSB 8 +#define UART_RXFL_WIDTH 5 +#define UART_TXFL_LSB 13 +#define UART_TXFL_WIDTH 5 +//================================ + +typedef union //0x020 +{ + struct + { + uint32_t DR: 1; // bit0 --- data ready + uint32_t OE: 1; // bit1 --- overrun error + uint32_t PE: 1; // bit2 --- parity error + uint32_t FE: 1; // bit3 --- framing error + uint32_t BF: 1; // bit4 --- break interrupt + uint32_t TBEM: 1; // bit5 --- transmit buffer register empty + uint32_t TEM: 1; // bit6 --- transmitter empty + uint32_t RFE: 1; // bit7 --- receiver fifo data error + uint32_t BUSY: 1; // bit8 --- uart busy + uint32_t TFNF: 1; // bit9 --- transmit fifo not full + uint32_t TFEM: 1; // bit10 --- transmit fifo empty + uint32_t RFNE: 1; // bit11 --- receive fifo not empty + uint32_t RFF: 1; // bit12 --- receive fifo full + uint32_t DCTS: 1; // bit13 --- delta clear to send + uint32_t CTS: 1; // bit14 --- clear to send + uint32_t RSV_END: 17; // bit[31:15] + }; + uint32_t Word; +} UART_SR_TypeDef; //0x020 + + +//================================ +#define UART_SR_DR_POS 0 +#define UART_SR_OE_POS 1 +#define UART_SR_PE_POS 2 +#define UART_SR_FE_POS 3 +#define UART_SR_BF_POS 4 +#define UART_SR_TBEM_POS 5 +#define UART_SR_TEM_POS 6 +#define UART_SR_RFE_POS 7 +#define UART_SR_BUSY_POS 8 +#define UART_SR_TFNF_POS 9 +#define UART_SR_TFEM_POS 10 +#define UART_SR_RFNE_POS 11 +#define UART_SR_RFF_POS 12 +#define UART_SR_DCTS_POS 13 +#define UART_SR_CTS_POS 14 +//================================ + +typedef union //0x024 +{ + struct + { + uint32_t RXRD: 1; // bit0 --- receive data available interrupt enable status + uint32_t TXS: 1; // bit1 --- thr empty interrupt enable status + uint32_t RXS: 1; // bit2 --- receiver line status interrupt enable status + uint32_t MDS: 1; // bit3 --- modem status interrupt enable status + uint32_t RTO: 1; // bit4 --- receiver timeout enable status + uint32_t BUSY: 1; // bit5 --- busy detect interrupt enable status + uint32_t ABE: 1; // bit6 --- auto baud rate end interrupt enable status + uint32_t ABTO: 1; // bit7 --- auto baud rate timeout interrupt enable status + uint32_t LINBK: 1; // bit8 --- lin break detection interrupt enable status + uint32_t TC: 1; // bit9 --- transmission complete interrupt enable status + uint32_t EOB: 1; // bit10 --- end of block interrupt enable status + uint32_t CM: 1; // bit11 --- character match interrupt enable status + uint32_t RSV_END: 20; // bit[31:12] + }; + uint32_t Word; +} UART_IER_TypeDef; //0x024 + + +//================================ +#define UART_INT_RXRD_POS 0 +#define UART_INT_TXS_POS 1 +#define UART_INT_RXS_POS 2 +#define UART_INT_MDS_POS 3 +#define UART_INT_RTO_POS 4 +#define UART_INT_BUSY_POS 5 +#define UART_INT_ABE_POS 6 +#define UART_INT_ABTO_POS 7 +#define UART_INT_LINBK_POS 8 +#define UART_INT_TC_POS 9 +#define UART_INT_EOB_POS 10 +#define UART_INT_CM_POS 11 +//================================ + +typedef union //0x028 +{ + struct + { + uint32_t RXRD: 1; // bit0 --- receive data available interrupt enable status + uint32_t TXS: 1; // bit1 --- thr empty interrupt enable status + uint32_t RXS: 1; // bit2 --- receiver line status interrupt enable status + uint32_t MDS: 1; // bit3 --- modem status interrupt enable status + uint32_t RTO: 1; // bit4 --- receiver timeout enable status + uint32_t BUSY: 1; // bit5 --- busy detect interrupt enable status + uint32_t ABE: 1; // bit6 --- auto baud rate end interrupt enable status + uint32_t ABTO: 1; // bit7 --- auto baud rate timeout interrupt enable status + uint32_t LINBK: 1; // bit8 --- lin break detection interrupt enable status + uint32_t TC: 1; // bit9 --- transmission complete interrupt enable status + uint32_t EOB: 1; // bit10 --- end of block interrupt enable status + uint32_t CM: 1; // bit11 --- character match interrupt enable status + uint32_t RSV_END: 20; // bit[31:12] + }; + uint32_t Word; +} UART_IDR_TypeDef; //0x028 + +typedef union //0x02c +{ + struct + { + uint32_t RXRD: 1; // bit0 --- receive data available interrupt enable status + uint32_t TXS: 1; // bit1 --- thr empty interrupt enable status + uint32_t RXS: 1; // bit2 --- receiver line status interrupt enable status + uint32_t MDS: 1; // bit3 --- modem status interrupt enable status + uint32_t RTO: 1; // bit4 --- receiver timeout enable status + uint32_t BUSY: 1; // bit5 --- busy detect interrupt enable status + uint32_t ABE: 1; // bit6 --- auto baud rate end interrupt enable status + uint32_t ABTO: 1; // bit7 --- auto baud rate timeout interrupt enable status + uint32_t LINBK: 1; // bit8 --- lin break detection interrupt enable status + uint32_t TC: 1; // bit9 --- transmission complete interrupt enable status + uint32_t EOB: 1; // bit10 --- end of block interrupt enable status + uint32_t CM: 1; // bit11 --- character match interrupt enable status + uint32_t RSV_END: 20; // bit[31:12] + }; + uint32_t Word; +} UART_IVS_TypeDef; //0x02c + +typedef union //0x030 +{ + struct + { + uint32_t RXRD: 1; // bit0 --- receive data available interrupt enable status + uint32_t TXS: 1; // bit1 --- thr empty interrupt enable status + uint32_t RXS: 1; // bit2 --- receiver line status interrupt enable status + uint32_t MDS: 1; // bit3 --- modem status interrupt enable status + uint32_t RTO: 1; // bit4 --- receiver timeout enable status + uint32_t BUSY: 1; // bit5 --- busy detect interrupt enable status + uint32_t ABE: 1; // bit6 --- auto baud rate end interrupt enable status + uint32_t ABTO: 1; // bit7 --- auto baud rate timeout interrupt enable status + uint32_t LINBK: 1; // bit8 --- lin break detection interrupt enable status + uint32_t TC: 1; // bit9 --- transmission complete interrupt enable status + uint32_t EOB: 1; // bit10 --- end of block interrupt enable status + uint32_t CM: 1; // bit11 --- character match interrupt enable status + uint32_t RSV_END: 20; // bit[31:12] + }; + uint32_t Word; +} UART_RIF_TypeDef; //0x030 + +typedef union //0x034 +{ + struct + { + uint32_t RXRD: 1; // bit0 --- receive data available interrupt enable status + uint32_t TXS: 1; // bit1 --- thr empty interrupt enable status + uint32_t RXS: 1; // bit2 --- receiver line status interrupt enable status + uint32_t MDS: 1; // bit3 --- modem status interrupt enable status + uint32_t RTO: 1; // bit4 --- receiver timeout enable status + uint32_t BUSY: 1; // bit5 --- busy detect interrupt enable status + uint32_t ABE: 1; // bit6 --- auto baud rate end interrupt enable status + uint32_t ABTO: 1; // bit7 --- auto baud rate timeout interrupt enable status + uint32_t LINBK: 1; // bit8 --- lin break detection interrupt enable status + uint32_t TC: 1; // bit9 --- transmission complete interrupt enable status + uint32_t EOB: 1; // bit10 --- end of block interrupt enable status + uint32_t CM: 1; // bit11 --- character match interrupt enable status + uint32_t RSV_END: 20; // bit[31:12] + }; + uint32_t Word; +} UART_IFM_TypeDef; //0x034 + +typedef union //0x038 +{ + struct + { + uint32_t RXRD: 1; // bit0 --- receive data available interrupt enable status + uint32_t TXS: 1; // bit1 --- thr empty interrupt enable status + uint32_t RXS: 1; // bit2 --- receiver line status interrupt enable status + uint32_t MDS: 1; // bit3 --- modem status interrupt enable status + uint32_t RTO: 1; // bit4 --- receiver timeout enable status + uint32_t BUSY: 1; // bit5 --- busy detect interrupt enable status + uint32_t ABE: 1; // bit6 --- auto baud rate end interrupt enable status + uint32_t ABTO: 1; // bit7 --- auto baud rate timeout interrupt enable status + uint32_t LINBK: 1; // bit8 --- lin break detection interrupt enable status + uint32_t TC: 1; // bit9 --- transmission complete interrupt enable status + uint32_t EOB: 1; // bit10 --- end of block interrupt enable status + uint32_t CM: 1; // bit11 --- character match interrupt enable status + uint32_t RSV_END: 20; // bit[31:12] + }; + uint32_t Word; +} UART_ICR_TypeDef; //0x038 + + +//================================ +//BLOCK UART top struct define +typedef struct +{ + __IO uint32_t RBR ; // 0x000, + // Receive buffer register + __IO uint32_t TBR ; // 0x004, + // Transmit buffer register + __IO uint32_t BRR ; // 0x008, + // Baud rate register + __IO UART_LCR_TypeDef LCR ; // 0x00c, + // Line control register + __IO UART_MCR_TypeDef MCR ; // 0x010, + // Mode control register + __IO UART_CR_TypeDef CR ; // 0x014, + // Control register + __IO UART_RTOR_TypeDef RTOR; // 0x018, + // Receiver timeout register + __IO UART_FCR_TypeDef FCR ; // 0x01c, + // FIFO control register + __IO UART_SR_TypeDef SR ; // 0x020, + // Status register + __O UART_IER_TypeDef IER ; // 0x024, + // Interrupt enable register + __O UART_IDR_TypeDef IDR ; // 0x028, + // Interrupt disable register + __I UART_IVS_TypeDef IVS ; // 0x02c, + // Interrupt valid status + __I UART_RIF_TypeDef RIF ; // 0x030, + // Raw interrupt flag + __I UART_IFM_TypeDef IFM ; // 0x034, + // Interrupt flag masked + __O UART_ICR_TypeDef ICR ; // 0x038, + // Interrupt clear register +} UART_TypeDef; + + +#define UART1 (( UART_TypeDef *) UART1_BASE) +#define UART2 (( UART_TypeDef *) UART2_BASE) + +#endif diff --git a/core/reg/regs.h b/core/reg/regs.h new file mode 100644 index 0000000..685a82c --- /dev/null +++ b/core/reg/regs.h @@ -0,0 +1,27 @@ +#ifndef _REGS_H_ +#define _REGS_H_ + +#include "reg_aon.h" +#include "reg_apbmisc.h" +#include "reg_btmr.h" +#include "reg_cache.h" +#include "reg_csc.h" +#include "reg_dma.h" +#include "reg_dmachcfg.h" +#include "reg_exti.h" +#include "reg_fshc.h" +#include "reg_gpio.h" +#include "reg_i2c.h" +#include "reg_iwdt.h" +#include "reg_mdm.h" +#include "reg_rcc.h" +#include "reg_rf.h" +#include "reg_sadc.h" +#include "reg_spim.h" +#include "reg_spis.h" +#include "reg_syscfg.h" +#include "reg_timer.h" +#include "reg_uart.h" + + +#endif // _REGS_H_ diff --git a/core/rom.h b/core/rom.h new file mode 100644 index 0000000..6c633ab --- /dev/null +++ b/core/rom.h @@ -0,0 +1,268 @@ +/** + **************************************************************************************** + * + * @file rom.h + * + * @brief Header file - Drivers defined in ROM + * + **************************************************************************************** + */ + +#ifndef _ROM_H_ +#define _ROM_H_ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Address Pointer of APIs +enum ROM_POINTER { + ROM_BOOTLOADER = 0x000001b9, + ROM_PUART_CONF = 0x0000032d, + ROM_PUART_GETC = 0x00000379, + ROM_PUART_PUTC = 0x00000387, + ROM_PUART_WAIT = 0x00000393, + ROM_PUART_INIT = 0x000003a3, + ROM_UARTSYNC = 0x00000469, + ROM_UARTPARSE = 0x000004a9, + ROM_SYSJUMPTO = 0x00000731, + ROM_BTMR_DELAY = 0x00000749, + ROM_XO16M_EN = 0x00000777, + ROM_EXTCLK_EN = 0x0000079b, + ROM_DPLL_EN = 0x000007bd, + ROM_DEEPSLEEP = 0x000007df, + ROM_RSTCLR = 0x00000845, + ROM_RCC_FSHCLK_SET = 0x00000877, + ROM_IWDT_CONF = 0x000008d1, + ROM_RC16M_CALIB = 0x000008fd, + ROM_TRIMVALLOAD = 0x0000097d, + ROM_FSHC_XIP_CONF = 0x00000abd, + ROM_FSHC_SUSPEND_CONF = 0x00000ae1, + ROM_FSHC_HPM_CONF = 0x00000b1f, + ROM_FSHC_EN_CMD = 0x00000b59, + ROM_FSHC_WR_STA = 0x00000b73, + ROM_FSHC_RD_STA = 0x00000b9d, + ROM_FSHC_WR_CFG = 0x00000bcd, + ROM_FSHC_WR_FIFO = 0x00000beb, + ROM_FSHC_RD_CFG = 0x00000c21, + ROM_FSHC_RD_FIFO = 0x00000c41, + ROM_FSHC_ERASE = 0x00000c63, + ROM_FSHC_WRITE = 0x00000cb9, + ROM_FSHC_READ = 0x00000d1d, + ROM_FLASHINIT = 0x00000d6d, + ROM_FSHC_CAPDLY_CFG = 0x00000dc9, + ROM_FSHC_QUAD_MODE = 0x00000e25, + ROM_PUYA_QUADHPMXIPMODE = 0x00000e41, + ROM_PUYA_ENTER_HPM = 0x00000e61, + ROM_PUYA_EXIT_HPM = 0x00000ead, + ROM_XMEMCPY = 0x00000f19, + ROM_XMEMMOVE = 0x00000f59, + ROM_XMEMSET = 0x00000f75, + ROM_XMEMCMP = 0x00000fa3, +}; + +/// Flash Data length type +typedef uint32_t flen_t; + + +/* + * APIs : Memory Operation + **************************************************************************************** + */ + +/// Same as memcpy, direct copy uint32_t if aligned +#define xmemcpy ((void (*)(void *dst, const void *src, uint32_t size))ROM_XMEMCPY) + +/// Same as memmove, reverse copy or inner call xmemcpy +#define xmemmove ((void (*)(void * dst, const void * src, uint32_t size))ROM_XMEMMOVE) + +/// Same as xmemset, fill cccc to uint32_t when address aligned +#define xmemset ((void (*)(void *m, uint8_t c, uint32_t size))ROM_XMEMSET) + +/// Same as memcmp, direct compare uint32_t if aligned +#define xmemcmp ((int (*)(const void *m1, const void *m2, uint32_t size))ROM_XMEMCMP) + + +/* + * APIs : Core Utility + **************************************************************************************** + */ + +/// Core enter deep sleep mode, inner call __wfi +#define deepsleep ((void (*)(void))ROM_DEEPSLEEP) + +/// Clear states of Core reset and wakeup, return the reason and source +/// @see enum rst_src_bfs +#define rstrsn ((uint16_t (*)(void))ROM_RSTCLR) + +/// Jump to the running 'addr' of application, SP PC STACK reinited +#define sysJumpTo ((void (*)(uint32_t addr))ROM_SYSJUMPTO) + +/// Enable xosc16m Oscillator mode, wait 2ms for stable +#define xo16m_en ((void (*)(void))ROM_XO16M_EN) + +/// Enable extarnal clock mode, through XOSC16M_IN PAD into chip +#define extclk_en ((void (*)(void))ROM_EXTCLK_EN) + +/// Enable dpll power and clk, wait 50us for stable +#define dpll_en ((void (*)(void))ROM_DPLL_EN) + +/// Delay via basic timer, wait 'tcnt' count in 'tpsc' prescaler +/// eg. btmr_delay(16, 1000) means delay 1Ms when sysclk is 16MHz +#define btmr_delay ((void (*)(uint16_t tpsc, uint16_t tcnt))ROM_BTMR_DELAY) +/// time must great than 1 +#if (SYS_CLK == 1) + #define bootDelayMs(time) btmr_delay(32000, time) + #define bootDelayUs(time) btmr_delay(32, time) +#elif (SYS_CLK == 2) + #define bootDelayMs(time) btmr_delay(48000, time) + #define bootDelayUs(time) btmr_delay(48, time) +#elif (SYS_CLK == 3) + #define bootDelayMs(time) btmr_delay(64000, time) + #define bootDelayUs(time) btmr_delay(64, time) +#else + #define bootDelayMs(time) btmr_delay(16000, time) + #define bootDelayUs(time) btmr_delay(16, time) +#endif //SYS_CLK + +/// Config IWDT, disable if 'load' equl 0 +#define iwdt_conf ((uint32_t (*)(uint32_t load))ROM_IWDT_CONF) + +/// Calib rc16m, return trim value(range 0~63) +#define rc16m_calib ((uint8_t (*)(void))ROM_RC16M_CALIB) + + +/* + * APIs : Boot Uart(UART1) + **************************************************************************************** + */ + +/// Csc PA6 PA7 as pUart PIN +#define pUart_init ((void (*)(void))ROM_PUART_INIT) + +/// Config pUart params +#define pUart_conf ((void (*)(uint16_t cfg_BRR, uint16_t cfg_LCR))ROM_PUART_CONF) + +/// Get one data from pUart RXD(Blocking) +#define pUart_getc ((uint8_t (*)(void))ROM_PUART_GETC) + +/// Put one byte via pUart TXD(Blocking) +#define pUart_putc ((void (*)(uint8_t ch))ROM_PUART_PUTC) + +/// Wait pUart finished(not busy) +#define pUart_wait ((void (*)(void))ROM_PUART_WAIT) + + +/* + * APIs: Flash Controlor(FSHC) Driver + **************************************************************************************** + */ + +/// Set Fshc Clock Selection @see enum fsh_clk_sel +#define rcc_fshclk_set ((void (*)(uint8_t fclk_sel))ROM_RCC_FSHCLK_SET) + +/// Config XIP mode +#define fshc_xip_conf ((void (*)(uint8_t rdCmd, uint8_t adrBits, uint32_t dlySet))ROM_FSHC_XIP_CONF) + +/// Config HPM mode +#define fshc_hpm_conf ((void (*)(bool en, uint8_t crIdx, uint8_t crCmd))ROM_FSHC_HPM_CONF) + +/// Config Suspend/Resume +#define fshc_suspend_conf ((void (*)(uint8_t susCmd, uint8_t rsmCmd, uint16_t susTime, uint32_t rsmTime))ROM_FSHC_SUSPEND_CONF) + +/** + **************************************************************************************** + * @brief Send control/enable command without value + * + * @param[in] cmd Command opcode(eg. FSH_CMD_RST_EN FSH_CMD_RESET FSH_CMD_EXIT_HMP + * FSH_CMD_WR_EN FSH_CMD_WR_STA_EN) + * + **************************************************************************************** + */ +#define fshc_en_cmd ((void (*)(uint8_t cmd))ROM_FSHC_EN_CMD) + +/** + **************************************************************************************** + * @brief Write value to flash state register + * + * @param[in] cmd Command opcode(eg. FSH_CMD_WR_STA) + * @param[in] len Length of value, range 1~4 Bytes + * @param[in] val State value, valid range 8/16/24/32bits by 'len' + * + **************************************************************************************** + */ +#define fshc_wr_sta ((void (*)(uint8_t cmd, uint8_t len, uint32_t val))ROM_FSHC_WR_STA) + +/** + **************************************************************************************** + * @brief Read value from flash state register + * + * @param[in] cmd Command opcode(eg. FSH_CMD_RD_ID FSH_CMD_RD_STA0 FSH_CMD_RD_STA1) + * @param[in] len Length of value, range 1~4 Bytes + * + * @return value State value, valid range 8/16/24/32bits by 'len' + **************************************************************************************** + */ +#define fshc_rd_sta ((uint32_t (*)(uint8_t cmd, uint8_t len))ROM_FSHC_RD_STA) + +/** + **************************************************************************************** + * @brief Perpare write data to flash + * + * @param[in] cmd fshc access cmd (example read cmd: 0x03) + * @param[in] offset access flash addr offset + * @param[in] len access flash data len, unit is byte + * @param[in] sctrl access flash mode config(example: spi mode, dual mode...) + * @param[in] acbit dummy cycle + * + **************************************************************************************** + */ +#define fshc_wr_cfg ((void (*)(uint8_t cmd, uint32_t offset, flen_t len, uint16_t sctrl, uint16_t acbit))ROM_FSHC_WR_CFG) + +/// Fill 'data'(unit in uint32_t, length='wlen') to Fshc Write-FiFo in 'fcmd' mode +#define fshc_wr_fifo ((flen_t (*)(const uint32_t *data, flen_t wlen, uint16_t fcmd))fshc_wr_fifo) + +/** + **************************************************************************************** + * @brief Perpare read data from flash + * + * @param[in] cmd fshc access cmd (example read cmd: 0x03) + * @param[in] offset access flash addr offset + * @param[in] len access flash data len, unit is byte + * @param[in] sctrl access flash mode config(example: spi mode, dual mode...) + * @param[in] acbit dummy cycle + * + **************************************************************************************** + */ +#define fshc_rd_cfg ((void (*)(uint8_t cmd, uint32_t offset, flen_t len, uint16_t sctrl, uint16_t acbit))ROM_FSHC_RD_CFG) + +/// Get data from Fshc Read-FiFo to 'buff'(unit in uint32_t, length='wlen') in 'fcmd' mode +#define fshc_rd_fifo ((flen_t (*)(uint32_t *buff, flen_t wlen, uint16_t fcmd))ROM_FSHC_RD_FIFO) + +/// Erase Flash in 'fcmd' config, inner call fshc_en_cmd() fshc_wr_cfg() +#define fshc_erase ((void (*)(uint32_t offset, uint16_t fcmd))ROM_FSHC_ERASE) + +/// Read Flash in 'fcmd' config, inner call fshc_rd_cfg() fshc_rd_fifo() +#define fshc_read ((flen_t (*)(uint32_t offset, uint32_t *buff, flen_t wlen, uint16_t fcmd))ROM_FSHC_READ) + +/// Write Flash in 'fcmd' config, inner call fshc_en_cmd() fshc_wr_cfg()fshc_wr_fifo() +#define fshc_write ((flen_t (*)(uint32_t offset, const uint32_t *data, flen_t wlen, uint16_t fcmd))ROM_FSHC_WRITE) + +/// Config Flash Cap Dealy cell(0~7, default 5), auto search if 'dly' > 7 +#define fshc_capdly_cfg ((uint8_t (*)(uint8_t dly))ROM_FSHC_CAPDLY_CFG) + +/// Config Flash Access Mode, enter/exit Quad mode with special 'val' +#define fshc_quad_mode ((void (*)(uint16_t val))ROM_FSHC_QUAD_MODE) + +/// BoYa Flash enter HPM mode +#define boya_enter_hpm ((void (*)(void))ROM_PUYA_ENTER_HPM) + +/// BoYa Flash exit HPM Mode +#define boya_exit_hpm ((void (*)(void))ROM_PUYA_EXIT_HPM) + + +#endif // _ROM_H_ diff --git a/core/string.h b/core/string.h new file mode 100644 index 0000000..c2a9089 --- /dev/null +++ b/core/string.h @@ -0,0 +1,523 @@ +/* string.h: ANSI 'C' (X3J11 Oct 88) library header, section 4.11 */ +/* Copyright (C) Codemist Ltd., 1988-1993. */ +/* Copyright 1991-1993 ARM Limited. All rights reserved. */ +/* version 0.04 */ + +/* + * RCS $Revision$ + * Checkin $Date$ + */ + +/* + * string.h declares one type and several functions, and defines one macro + * useful for manipulating character arrays and other objects treated as + * character arrays. Various methods are used for determining the lengths of + * the arrays, but in all cases a char * or void * argument points to the + * initial (lowest addresses) character of the array. If an array is written + * beyond the end of an object, the behaviour is undefined. + */ + +#ifndef __string_h +#define __string_h + +#define _ARMABI __declspec(__nothrow) + + #ifndef __STRING_DECLS + #define __STRING_DECLS + + #undef __CLIBNS + + #ifdef __cplusplus + namespace std { + #define __CLIBNS std:: + extern "C" { + #else + #define __CLIBNS + #endif /* __cplusplus */ + +#if defined(__cplusplus) || !defined(__STRICT_ANSI__) + /* unconditional in C++ and non-strict C for consistency of debug info */ + #if __sizeof_ptr == 8 + typedef unsigned long size_t; /* see */ + #else + typedef unsigned int size_t; /* see */ + #endif +#elif !defined(__size_t) + #define __size_t 1 + #if __sizeof_ptr == 8 + typedef unsigned long size_t; /* see */ + #else + typedef unsigned int size_t; /* see */ + #endif +#endif + +#undef NULL +#define NULL 0 /* see */ + +#if (MEM_API) +extern _ARMABI void *memcpy(void * __restrict /*s1*/, + const void * __restrict /*s2*/, size_t /*n*/) __attribute__((__nonnull__(1,2))); + /* + * copies n characters from the object pointed to by s2 into the object + * pointed to by s1. If copying takes place between objects that overlap, + * the behaviour is undefined. + * Returns: the value of s1. + */ +extern _ARMABI void *memmove(void * /*s1*/, + const void * /*s2*/, size_t /*n*/) __attribute__((__nonnull__(1,2))); + /* + * copies n characters from the object pointed to by s2 into the object + * pointed to by s1. Copying takes place as if the n characters from the + * object pointed to by s2 are first copied into a temporary array of n + * characters that does not overlap the objects pointed to by s1 and s2, + * and then the n characters from the temporary array are copied into the + * object pointed to by s1. + * Returns: the value of s1. + */ +#else //(ROM_API) +/// Same as memcpy, direct copy uint32_t if aligned +#define memcpy ((void (*)(void *dst, const void *src, unsigned int size))0x00000f19) //ROM_XMEMCPY) + +/// Same as memmove, reverse copy or inner call xmemcpy +#define memmove ((void (*)(void * dst, const void * src, unsigned int size))0x00000f59)//ROM_XMEMMOVE) +#endif //(MEM_API) + +extern _ARMABI char *strcpy(char * __restrict /*s1*/, const char * __restrict /*s2*/) __attribute__((__nonnull__(1,2))); + /* + * copies the string pointed to by s2 (including the terminating nul + * character) into the array pointed to by s1. If copying takes place + * between objects that overlap, the behaviour is undefined. + * Returns: the value of s1. + */ +extern _ARMABI char *strncpy(char * __restrict /*s1*/, const char * __restrict /*s2*/, size_t /*n*/) __attribute__((__nonnull__(1,2))); + /* + * copies not more than n characters (characters that follow a null + * character are not copied) from the array pointed to by s2 into the array + * pointed to by s1. If copying takes place between objects that overlap, + * the behaviour is undefined. + * Returns: the value of s1. + */ + +extern _ARMABI char *strcat(char * __restrict /*s1*/, const char * __restrict /*s2*/) __attribute__((__nonnull__(1,2))); + /* + * appends a copy of the string pointed to by s2 (including the terminating + * null character) to the end of the string pointed to by s1. The initial + * character of s2 overwrites the null character at the end of s1. + * Returns: the value of s1. + */ +extern _ARMABI char *strncat(char * __restrict /*s1*/, const char * __restrict /*s2*/, size_t /*n*/) __attribute__((__nonnull__(1,2))); + /* + * appends not more than n characters (a null character and characters that + * follow it are not appended) from the array pointed to by s2 to the end of + * the string pointed to by s1. The initial character of s2 overwrites the + * null character at the end of s1. A terminating null character is always + * appended to the result. + * Returns: the value of s1. + */ + +/* + * The sign of a nonzero value returned by the comparison functions is + * determined by the sign of the difference between the values of the first + * pair of characters (both interpreted as unsigned char) that differ in the + * objects being compared. + */ +#if (MEM_API) +extern _ARMABI int memcmp(const void * /*s1*/, const void * /*s2*/, size_t /*n*/) __attribute__((__nonnull__(1,2))); +#else //(ROM_API) +/// Same as memcmp, direct compare uint32_t if aligned +#define memcmp ((int (*)(const void *m1, const void *m2, unsigned int size))0x00000fa3) //ROM_XMEMCMP) +#endif //(MEM_API) + /* + * compares the first n characters of the object pointed to by s1 to the + * first n characters of the object pointed to by s2. + * Returns: an integer greater than, equal to, or less than zero, according + * as the object pointed to by s1 is greater than, equal to, or + * less than the object pointed to by s2. + */ +extern _ARMABI int strcmp(const char * /*s1*/, const char * /*s2*/) __attribute__((__nonnull__(1,2))); + /* + * compares the string pointed to by s1 to the string pointed to by s2. + * Returns: an integer greater than, equal to, or less than zero, according + * as the string pointed to by s1 is greater than, equal to, or + * less than the string pointed to by s2. + */ +extern _ARMABI int strncmp(const char * /*s1*/, const char * /*s2*/, size_t /*n*/) __attribute__((__nonnull__(1,2))); + /* + * compares not more than n characters (characters that follow a null + * character are not compared) from the array pointed to by s1 to the array + * pointed to by s2. + * Returns: an integer greater than, equal to, or less than zero, according + * as the string pointed to by s1 is greater than, equal to, or + * less than the string pointed to by s2. + */ +extern _ARMABI int strcasecmp(const char * /*s1*/, const char * /*s2*/) __attribute__((__nonnull__(1,2))); + /* + * compares the string pointed to by s1 to the string pointed to by s2, + * case-insensitively as defined by the current locale. + * Returns: an integer greater than, equal to, or less than zero, according + * as the string pointed to by s1 is greater than, equal to, or + * less than the string pointed to by s2. + */ +extern _ARMABI int strncasecmp(const char * /*s1*/, const char * /*s2*/, size_t /*n*/) __attribute__((__nonnull__(1,2))); + /* + * compares not more than n characters (characters that follow a null + * character are not compared) from the array pointed to by s1 to the array + * pointed to by s2, case-insensitively as defined by the current locale. + * Returns: an integer greater than, equal to, or less than zero, according + * as the string pointed to by s1 is greater than, equal to, or + * less than the string pointed to by s2. + */ +extern _ARMABI int strcoll(const char * /*s1*/, const char * /*s2*/) __attribute__((__nonnull__(1,2))); + /* + * compares the string pointed to by s1 to the string pointed to by s2, both + * interpreted as appropriate to the LC_COLLATE category of the current + * locale. + * Returns: an integer greater than, equal to, or less than zero, according + * as the string pointed to by s1 is greater than, equal to, or + * less than the string pointed to by s2 when both are interpreted + * as appropriate to the current locale. + */ + +extern _ARMABI size_t strxfrm(char * __restrict /*s1*/, const char * __restrict /*s2*/, size_t /*n*/) __attribute__((__nonnull__(2))); + /* + * transforms the string pointed to by s2 and places the resulting string + * into the array pointed to by s1. The transformation function is such that + * if the strcmp function is applied to two transformed strings, it returns + * a value greater than, equal to or less than zero, corresponding to the + * result of the strcoll function applied to the same two original strings. + * No more than n characters are placed into the resulting array pointed to + * by s1, including the terminating null character. If n is zero, s1 is + * permitted to be a null pointer. If copying takes place between objects + * that overlap, the behaviour is undefined. + * Returns: The length of the transformed string is returned (not including + * the terminating null character). If the value returned is n or + * more, the contents of the array pointed to by s1 are + * indeterminate. + */ + + +#ifdef __cplusplus +extern _ARMABI const void *memchr(const void * /*s*/, int /*c*/, size_t /*n*/) __attribute__((__nonnull__(1))); +extern "C++" void *memchr(void * __s, int __c, size_t __n) __attribute__((__nonnull__(1))); +extern "C++" inline void *memchr(void * __s, int __c, size_t __n) + { return const_cast(memchr(const_cast(__s), __c, __n)); } +#else +extern _ARMABI void *memchr(const void * /*s*/, int /*c*/, size_t /*n*/) __attribute__((__nonnull__(1))); +#endif + /* + * locates the first occurence of c (converted to an unsigned char) in the + * initial n characters (each interpreted as unsigned char) of the object + * pointed to by s. + * Returns: a pointer to the located character, or a null pointer if the + * character does not occur in the object. + */ + +#ifdef __cplusplus +extern _ARMABI const char *strchr(const char * /*s*/, int /*c*/) __attribute__((__nonnull__(1))); +extern "C++" char *strchr(char * __s, int __c) __attribute__((__nonnull__(1))); +extern "C++" inline char *strchr(char * __s, int __c) + { return const_cast(strchr(const_cast(__s), __c)); } +#else +extern _ARMABI char *strchr(const char * /*s*/, int /*c*/) __attribute__((__nonnull__(1))); +#endif + /* + * locates the first occurence of c (converted to an char) in the string + * pointed to by s (including the terminating null character). + * Returns: a pointer to the located character, or a null pointer if the + * character does not occur in the string. + */ + +extern _ARMABI size_t strcspn(const char * /*s1*/, const char * /*s2*/) __attribute__((__nonnull__(1,2))); + /* + * computes the length of the initial segment of the string pointed to by s1 + * which consists entirely of characters not from the string pointed to by + * s2. The terminating null character is not considered part of s2. + * Returns: the length of the segment. + */ + +#ifdef __cplusplus +extern _ARMABI const char *strpbrk(const char * /*s1*/, const char * /*s2*/) __attribute__((__nonnull__(1,2))); +extern "C++" char *strpbrk(char * __s1, const char * __s2) __attribute__((__nonnull__(1,2))); +extern "C++" inline char *strpbrk(char * __s1, const char * __s2) + { return const_cast(strpbrk(const_cast(__s1), __s2)); } +#else +extern _ARMABI char *strpbrk(const char * /*s1*/, const char * /*s2*/) __attribute__((__nonnull__(1,2))); +#endif + /* + * locates the first occurence in the string pointed to by s1 of any + * character from the string pointed to by s2. + * Returns: returns a pointer to the character, or a null pointer if no + * character form s2 occurs in s1. + */ + +#ifdef __cplusplus +extern _ARMABI const char *strrchr(const char * /*s*/, int /*c*/) __attribute__((__nonnull__(1))); +extern "C++" char *strrchr(char * __s, int __c) __attribute__((__nonnull__(1))); +extern "C++" inline char *strrchr(char * __s, int __c) + { return const_cast(strrchr(const_cast(__s), __c)); } +#else +extern _ARMABI char *strrchr(const char * /*s*/, int /*c*/) __attribute__((__nonnull__(1))); +#endif + /* + * locates the last occurence of c (converted to a char) in the string + * pointed to by s. The terminating null character is considered part of + * the string. + * Returns: returns a pointer to the character, or a null pointer if c does + * not occur in the string. + */ + +extern _ARMABI size_t strspn(const char * /*s1*/, const char * /*s2*/) __attribute__((__nonnull__(1,2))); + /* + * computes the length of the initial segment of the string pointed to by s1 + * which consists entirely of characters from the string pointed to by S2 + * Returns: the length of the segment. + */ + +#ifdef __cplusplus +extern _ARMABI const char *strstr(const char * /*s1*/, const char * /*s2*/) __attribute__((__nonnull__(1,2))); +extern "C++" char *strstr(char * __s1, const char * __s2) __attribute__((__nonnull__(1,2))); +extern "C++" inline char *strstr(char * __s1, const char * __s2) + { return const_cast(strstr(const_cast(__s1), __s2)); } +#else +extern _ARMABI char *strstr(const char * /*s1*/, const char * /*s2*/) __attribute__((__nonnull__(1,2))); +#endif + /* + * locates the first occurence in the string pointed to by s1 of the + * sequence of characters (excluding the terminating null character) in the + * string pointed to by s2. + * Returns: a pointer to the located string, or a null pointer if the string + * is not found. + */ + +extern _ARMABI char *strtok(char * __restrict /*s1*/, const char * __restrict /*s2*/) __attribute__((__nonnull__(2))); +extern _ARMABI char *_strtok_r(char * /*s1*/, const char * /*s2*/, char ** /*ptr*/) __attribute__((__nonnull__(2,3))); +#ifndef __STRICT_ANSI__ +extern _ARMABI char *strtok_r(char * /*s1*/, const char * /*s2*/, char ** /*ptr*/) __attribute__((__nonnull__(2,3))); +#endif + /* + * A sequence of calls to the strtok function breaks the string pointed to + * by s1 into a sequence of tokens, each of which is delimited by a + * character from the string pointed to by s2. The first call in the + * sequence has s1 as its first argument, and is followed by calls with a + * null pointer as their first argument. The separator string pointed to by + * s2 may be different from call to call. + * The first call in the sequence searches for the first character that is + * not contained in the current separator string s2. If no such character + * is found, then there are no tokens in s1 and the strtok function returns + * a null pointer. If such a character is found, it is the start of the + * first token. + * The strtok function then searches from there for a character that is + * contained in the current separator string. If no such character is found, + * the current token extends to the end of the string pointed to by s1, and + * subsequent searches for a token will fail. If such a character is found, + * it is overwritten by a null character, which terminates the current + * token. The strtok function saves a pointer to the following character, + * from which the next search for a token will start. + * Each subsequent call, with a null pointer as the value for the first + * argument, starts searching from the saved pointer and behaves as + * described above. + * Returns: pointer to the first character of a token, or a null pointer if + * there is no token. + * + * strtok_r() is a common extension which works exactly like + * strtok(), but instead of storing its state in a hidden + * library variable, requires the user to pass in a pointer to a + * char * variable which will be used instead. Any sequence of + * calls to strtok_r() passing the same char ** pointer should + * behave exactly like the corresponding sequence of calls to + * strtok(). This means that strtok_r() can safely be used in + * multi-threaded programs, and also that you can tokenise two + * strings in parallel. + */ +#if (MEM_API) +extern _ARMABI void *memset(void * /*s*/, int /*c*/, size_t /*n*/) __attribute__((__nonnull__(1))); +#else //(ROM_API) +/// Same as xmemset, fill cccc to uint32_t when address aligned +#define memset ((void (*)(void *m, uint8_t c, unsigned int size))0x00000f75) +#endif //(MEM_API) + + /* + * copies the value of c (converted to an unsigned char) into each of the + * first n charactes of the object pointed to by s. + * Returns: the value of s. + */ +extern _ARMABI char *strerror(int /*errnum*/); + /* + * maps the error number in errnum to an error message string. + * Returns: a pointer to the string, the contents of which are + * implementation-defined. The array pointed to shall not be + * modified by the program, but may be overwritten by a + * subsequent call to the strerror function. + */ +extern _ARMABI size_t strlen(const char * /*s*/) __attribute__((__nonnull__(1))); + /* + * computes the length of the string pointed to by s. + * Returns: the number of characters that precede the terminating null + * character. + */ + +extern _ARMABI size_t strlcpy(char * /*dst*/, const char * /*src*/, size_t /*len*/) __attribute__((__nonnull__(1,2))); + /* + * copies the string src into the string dst, using no more than + * len bytes of dst. Always null-terminates dst _within the + * length len (i.e. will copy at most len-1 bytes of string plus + * a NUL), unless len is actually zero. + * + * Return value is the length of the string that _would_ have + * been written, i.e. the length of src. Thus, the operation + * succeeded without truncation if and only if ret < len; + * otherwise, the value in ret tells you how big to make dst if + * you decide to reallocate it. (That value does _not_ include + * the NUL.) + * + * This is a BSD-derived library extension, which we are + * permitted to declare in a standard header because ISO defines + * function names beginning with 'str' as reserved for future + * expansion of . + */ + +extern _ARMABI size_t strlcat(char * /*dst*/, const char * /*src*/, size_t /*len*/) __attribute__((__nonnull__(1,2))); + /* + * concatenates the string src to the string dst, using no more + * than len bytes of dst. Always null-terminates dst _within the + * length len (i.e. will copy at most len-1 bytes of string plus + * a NUL), unless len is actually zero. + * + * Return value is the length of the string that _would_ have + * been written, i.e. the length of src plus the original length + * of dst. Thus, the operation succeeded without truncation if + * and only if ret < len; otherwise, the value in ret tells you + * how big to make dst if you decide to reallocate it. (That + * value does _not_ include the NUL.) + * + * If no NUL is encountered within the first len bytes of dst, + * then the length of dst is considered to have been equal to + * len for the purposes of the return value (as if there were a + * NUL at dst[len]). Thus, the return value in this case is len + * + strlen(src). + * + * This is a BSD-derived library extension, which we are + * permitted to declare in a standard header because ISO defines + * function names beginning with 'str' as reserved for future + * expansion of . + */ + +extern _ARMABI void _membitcpybl(void * /*dest*/, const void * /*src*/, int /*destoffset*/, int /*srcoffset*/, size_t /*nbits*/) __attribute__((__nonnull__(1,2))); +extern _ARMABI void _membitcpybb(void * /*dest*/, const void * /*src*/, int /*destoffset*/, int /*srcoffset*/, size_t /*nbits*/) __attribute__((__nonnull__(1,2))); +extern _ARMABI void _membitcpyhl(void * /*dest*/, const void * /*src*/, int /*destoffset*/, int /*srcoffset*/, size_t /*nbits*/) __attribute__((__nonnull__(1,2))); +extern _ARMABI void _membitcpyhb(void * /*dest*/, const void * /*src*/, int /*destoffset*/, int /*srcoffset*/, size_t /*nbits*/) __attribute__((__nonnull__(1,2))); +extern _ARMABI void _membitcpywl(void * /*dest*/, const void * /*src*/, int /*destoffset*/, int /*srcoffset*/, size_t /*nbits*/) __attribute__((__nonnull__(1,2))); +extern _ARMABI void _membitcpywb(void * /*dest*/, const void * /*src*/, int /*destoffset*/, int /*srcoffset*/, size_t /*nbits*/) __attribute__((__nonnull__(1,2))); +extern _ARMABI void _membitmovebl(void * /*dest*/, const void * /*src*/, int /*destoffset*/, int /*srcoffset*/, size_t /*nbits*/) __attribute__((__nonnull__(1,2))); +extern _ARMABI void _membitmovebb(void * /*dest*/, const void * /*src*/, int /*destoffset*/, int /*srcoffset*/, size_t /*nbits*/) __attribute__((__nonnull__(1,2))); +extern _ARMABI void _membitmovehl(void * /*dest*/, const void * /*src*/, int /*destoffset*/, int /*srcoffset*/, size_t /*nbits*/) __attribute__((__nonnull__(1,2))); +extern _ARMABI void _membitmovehb(void * /*dest*/, const void * /*src*/, int /*destoffset*/, int /*srcoffset*/, size_t /*nbits*/) __attribute__((__nonnull__(1,2))); +extern _ARMABI void _membitmovewl(void * /*dest*/, const void * /*src*/, int /*destoffset*/, int /*srcoffset*/, size_t /*nbits*/) __attribute__((__nonnull__(1,2))); +extern _ARMABI void _membitmovewb(void * /*dest*/, const void * /*src*/, int /*destoffset*/, int /*srcoffset*/, size_t /*nbits*/) __attribute__((__nonnull__(1,2))); + /* + * Copies or moves a piece of memory from one place to another, + * with one-bit granularity. So you can start or finish a copy + * part way through a byte, and you can copy between regions + * with different alignment within a byte. + * + * All these functions have the same prototype: two void * + * pointers for destination and source, then two integers + * giving the bit offset from those pointers, and finally the + * number of bits to copy. + * + * Just like memcpy and memmove, the "cpy" functions copy as + * fast as they can in the assumption that the memory regions + * do not overlap, while the "move" functions cope correctly + * with overlap. + * + * Treating memory as a stream of individual bits requires + * defining a convention about what order those bits are + * considered to be arranged in. The above functions support + * multiple conventions: + * + * - the "bl" functions consider the unit of memory to be the + * byte, and consider the bits within each byte to be + * arranged in little-endian fashion, so that the LSB comes + * first. (For example, membitcpybl(a,b,0,7,1) would copy + * the MSB of the byte at b to the LSB of the byte at a.) + * + * - the "bb" functions consider the unit of memory to be the + * byte, and consider the bits within each byte to be + * arranged in big-endian fashion, so that the MSB comes + * first. + * + * - the "hl" functions consider the unit of memory to be the + * 16-bit halfword, and consider the bits within each word + * to be arranged in little-endian fashion. + * + * - the "hb" functions consider the unit of memory to be the + * 16-bit halfword, and consider the bits within each word + * to be arranged in big-endian fashion. + * + * - the "wl" functions consider the unit of memory to be the + * 32-bit word, and consider the bits within each word to be + * arranged in little-endian fashion. + * + * - the "wb" functions consider the unit of memory to be the + * 32-bit word, and consider the bits within each word to be + * arranged in big-endian fashion. + */ + + #ifdef __cplusplus + } /* extern "C" */ + } /* namespace std */ + #endif /* __cplusplus */ + #endif /* __STRING_DECLS */ + + #ifdef __cplusplus + #ifndef __STRING_NO_EXPORTS + using ::std::size_t; + using ::std::memcpy; + using ::std::memmove; + using ::std::strcpy; + using ::std::strncpy; + using ::std::strcat; + using ::std::strncat; + using ::std::memcmp; + using ::std::strcmp; + using ::std::strncmp; + using ::std::strcasecmp; + using ::std::strncasecmp; + using ::std::strcoll; + using ::std::strxfrm; + using ::std::memchr; + using ::std::strchr; + using ::std::strcspn; + using ::std::strpbrk; + using ::std::strrchr; + using ::std::strspn; + using ::std::strstr; + using ::std::strtok; +#ifndef __STRICT_ANSI__ + using ::std::strtok_r; +#endif + using ::std::_strtok_r; + using ::std::memset; + using ::std::strerror; + using ::std::strlen; + using ::std::strlcpy; + using ::std::strlcat; + using ::std::_membitcpybl; + using ::std::_membitcpybb; + using ::std::_membitcpyhl; + using ::std::_membitcpyhb; + using ::std::_membitcpywl; + using ::std::_membitcpywb; + using ::std::_membitmovebl; + using ::std::_membitmovebb; + using ::std::_membitmovehl; + using ::std::_membitmovehb; + using ::std::_membitmovewl; + using ::std::_membitmovewb; + #endif /* __STRING_NO_EXPORTS */ + #endif /* __cplusplus */ + +#endif + +/* end of string.h */ + diff --git a/doc/APIs/APIs.zip b/doc/APIs/APIs.zip new file mode 100644 index 0000000..0d7d094 Binary files /dev/null and b/doc/APIs/APIs.zip differ diff --git a/doc/B6x BLE兼容性列表.xlsx b/doc/B6x BLE兼容性列表.xlsx new file mode 100644 index 0000000..36a1795 Binary files /dev/null and b/doc/B6x BLE兼容性列表.xlsx differ diff --git a/doc/DataSheet/B6x_DataSheet_v2.3.docx b/doc/DataSheet/B6x_DataSheet_v2.3.docx new file mode 100644 index 0000000..49fab2e Binary files /dev/null and b/doc/DataSheet/B6x_DataSheet_v2.3.docx differ diff --git a/doc/HW_Spec/QFN32/01Developmentboard/2023-07-28/B6_32D_20230728.PcbDoc b/doc/HW_Spec/QFN32/01Developmentboard/2023-07-28/B6_32D_20230728.PcbDoc new file mode 100644 index 0000000..8c59722 Binary files /dev/null and b/doc/HW_Spec/QFN32/01Developmentboard/2023-07-28/B6_32D_20230728.PcbDoc differ diff --git a/doc/HW_Spec/QFN32/01Developmentboard/2023-07-28/B6_32D_20230728.PrjPcb b/doc/HW_Spec/QFN32/01Developmentboard/2023-07-28/B6_32D_20230728.PrjPcb new file mode 100644 index 0000000..d4f24d0 --- /dev/null +++ b/doc/HW_Spec/QFN32/01Developmentboard/2023-07-28/B6_32D_20230728.PrjPcb @@ -0,0 +1,1644 @@ +[Design] +Version=1.0 +HierarchyMode=0 +ChannelRoomNamingStyle=0 +ReleasesFolder= +ChannelDesignatorFormatString=$Component_$RoomName +ChannelRoomLevelSeperator=_ +OpenOutputs=1 +ArchiveProject=0 +TimestampOutput=0 +SeparateFolders=0 +TemplateLocationPath= +PinSwapBy_Netlabel=1 +PinSwapBy_Pin=1 +AllowPortNetNames=0 +AllowSheetEntryNetNames=1 +AppendSheetNumberToLocalNets=0 +NetlistSinglePinNets=0 +DefaultConfiguration=Sources +UserID=0xFFFFFFFF +DefaultPcbProtel=1 +DefaultPcbPcad=0 +ReorderDocumentsOnCompile=1 +NameNetsHierarchically=0 +PowerPortNamesTakePriority=0 +PushECOToAnnotationFile=1 +DItemRevisionGUID= +ReportSuppressedErrorsInMessages=0 +FSMCodingStyle=eFMSDropDownList_OneProcess +FSMEncodingStyle=eFMSDropDownList_OneHot +OutputPath= +LogFolderPath= +ManagedProjectGUID= +IncludeDesignInRelease=0 + +[Preferences] +PrefsVaultGUID= +PrefsRevisionGUID= + +[Document1] +DocumentPath=B6_32D_20230728.PcbDoc +AnnotationEnabled=1 +AnnotateStartValue=1 +AnnotationIndexControlEnabled=0 +AnnotateSuffix= +AnnotateScope=All +AnnotateOrder=-1 +DoLibraryUpdate=1 +DoDatabaseUpdate=1 +ClassGenCCAutoEnabled=1 +ClassGenCCAutoRoomEnabled=1 +ClassGenNCAutoScope=None +DItemRevisionGUID= +GenerateClassCluster=0 +DocumentUniqueId= + +[Document2] +DocumentPath=B6_32D_20230728.SchDoc +AnnotationEnabled=1 +AnnotateStartValue=1 +AnnotationIndexControlEnabled=0 +AnnotateSuffix= +AnnotateScope=All +AnnotateOrder=-1 +DoLibraryUpdate=1 +DoDatabaseUpdate=1 +ClassGenCCAutoEnabled=1 +ClassGenCCAutoRoomEnabled=1 +ClassGenNCAutoScope=None +DItemRevisionGUID= +GenerateClassCluster=0 +DocumentUniqueId=OYNVQPXG + +[Configuration1] +Name=Sources +ParameterCount=0 +ConstraintFileCount=0 +ReleaseItemId= +Variant=[No Variations] +OutputJobsCount=0 +ContentTypeGUID=CB6F2064-E317-11DF-B822-12313F0024A2 +ConfigurationType=Source + +[Generic_SmartPDF] +AutoOpenFile=0 +AutoOpenOutJob=-1 + +[Generic_SmartPDFSettings] +ProjectMode=-1 +ZoomPrecision=50 +AddNetsInformation=-1 +AddNetPins=-1 +AddNetNetLabels=-1 +AddNetPorts=-1 +ShowComponentParameters=-1 +GlobalBookmarks=0 +ExportBOM=-1 +TemplateFilename=BOM Review.XLT +TemplateStoreRelative=-1 +PCB_PrintColor=1 +SCH_PrintColor=0 +PrintQuality=-3 +SCH_ShowNoErc=-1 +SCH_ShowParameter=-1 +SCH_ShowProbes=-1 +SCH_ShowBlankets=-1 +SCH_NoERCSymbolsToShow="Thin Cross","Thick Cross","Small Cross",Checkbox,Triangle +SCH_ShowNote=-1 +SCH_ShowNoteCollapsed=-1 +SCH_ExpandLogicalToPhysical=-1 +SCH_VariantName=[No Variations] +SCH_ExpandComponentDesignators=-1 +SCH_ExpandNetlabels=0 +SCH_ExpandPorts=0 +SCH_ExpandSheetNumber=0 +SCH_ExpandDocumentNumber=0 +SCH_HasExpandLogicalToPhysicalSheets=-1 +SaveSettingsToOutJob=0 + +[Generic_EDE] +OutputDir= + +[OutputGroup1] +Name=Netlist Outputs +Description= +TargetPrinter=Lenovo M7216NWA +PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1 +OutputType1=CadnetixNetlist +OutputName1=Cadnetix Netlist +OutputDocumentPath1= +OutputVariantName1= +OutputDefault1=0 +OutputType2=CalayNetlist +OutputName2=Calay Netlist +OutputDocumentPath2= +OutputVariantName2= +OutputDefault2=0 +OutputType3=EDIF +OutputName3=EDIF for PCB +OutputDocumentPath3= +OutputVariantName3= +OutputDefault3=0 +OutputType4=EESofNetlist +OutputName4=EESof Netlist +OutputDocumentPath4= +OutputVariantName4= +OutputDefault4=0 +OutputType5=IntergraphNetlist +OutputName5=Intergraph Netlist +OutputDocumentPath5= +OutputVariantName5= +OutputDefault5=0 +OutputType6=MentorBoardStationNetlist +OutputName6=Mentor BoardStation Netlist +OutputDocumentPath6= +OutputVariantName6= +OutputDefault6=0 +OutputType7=MultiWire +OutputName7=MultiWire +OutputDocumentPath7= +OutputVariantName7= +OutputDefault7=0 +OutputType8=OrCadPCB2Netlist +OutputName8=Orcad/PCB2 Netlist +OutputDocumentPath8= +OutputVariantName8= +OutputDefault8=0 +OutputType9=PADSNetlist +OutputName9=PADS ASCII Netlist +OutputDocumentPath9= +OutputVariantName9= +OutputDefault9=0 +OutputType10=Pcad +OutputName10=Pcad for PCB +OutputDocumentPath10= +OutputVariantName10= +OutputDefault10=0 +OutputType11=PCADNetlist +OutputName11=PCAD Netlist +OutputDocumentPath11= +OutputVariantName11= +OutputDefault11=0 +OutputType12=PCADnltNetlist +OutputName12=PCADnlt Netlist +OutputDocumentPath12= +OutputVariantName12= +OutputDefault12=0 +OutputType13=Protel2Netlist +OutputName13=Protel2 Netlist +OutputDocumentPath13= +OutputVariantName13= +OutputDefault13=0 +OutputType14=ProtelNetlist +OutputName14=Protel +OutputDocumentPath14= +OutputVariantName14= +OutputDefault14=0 +OutputType15=RacalNetlist +OutputName15=Racal Netlist +OutputDocumentPath15= +OutputVariantName15= +OutputDefault15=0 +OutputType16=RINFNetlist +OutputName16=RINF Netlist +OutputDocumentPath16= +OutputVariantName16= +OutputDefault16=0 +OutputType17=SciCardsNetlist +OutputName17=SciCards Netlist +OutputDocumentPath17= +OutputVariantName17= +OutputDefault17=0 +OutputType18=TangoNetlist +OutputName18=Tango Netlist +OutputDocumentPath18= +OutputVariantName18= +OutputDefault18=0 +OutputType19=TelesisNetlist +OutputName19=Telesis Netlist +OutputDocumentPath19= +OutputVariantName19= +OutputDefault19=0 +OutputType20=WireListNetlist +OutputName20=WireList Netlist +OutputDocumentPath20= +OutputVariantName20= +OutputDefault20=0 + +[OutputGroup2] +Name=Simulator Outputs +Description= +TargetPrinter=Lenovo M7216NWA +PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1 + +[OutputGroup3] +Name=Documentation Outputs +Description= +TargetPrinter=Virtual Printer +PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1 +OutputType1=Composite +OutputName1=Composite Drawing +OutputDocumentPath1= +OutputVariantName1= +OutputDefault1=0 +PageOptions1=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType2=PCB 3D Print +OutputName2=PCB 3D Print +OutputDocumentPath2= +OutputVariantName2=[No Variations] +OutputDefault2=0 +PageOptions2=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType3=PCB 3D Video +OutputName3=PCB 3D Video +OutputDocumentPath3= +OutputVariantName3=[No Variations] +OutputDefault3=0 +PageOptions3=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType4=PCB Print +OutputName4=PCB Prints +OutputDocumentPath4= +OutputVariantName4= +OutputDefault4=0 +PageOptions4=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType5=PCBDrawing +OutputName5=Draftsman +OutputDocumentPath5= +OutputVariantName5=[No Variations] +OutputDefault5=0 +PageOptions5=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType6=PCBLIB Print +OutputName6=PCBLIB Prints +OutputDocumentPath6= +OutputVariantName6= +OutputDefault6=0 +PageOptions6=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType7=PDF3D +OutputName7=PDF3D +OutputDocumentPath7= +OutputVariantName7=[No Variations] +OutputDefault7=0 +PageOptions7=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType8=Report Print +OutputName8=Report Prints +OutputDocumentPath8= +OutputVariantName8= +OutputDefault8=0 +PageOptions8=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType9=Schematic Print +OutputName9=Schematic Prints +OutputDocumentPath9= +OutputVariantName9= +OutputDefault9=0 +PageOptions9=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=0.71|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +Configuration9_Name1=OutputConfigurationParameter1 +Configuration9_Item1=Record=SchPrintView|ShowNoERC=True|ShowParamSet=True|ShowProbe=True|ShowBlanket=True|NoERCSymbolsToShow="Thin Cross","Thick Cross","Small Cross",Checkbox,Triangle|ShowNote=True|ShowNoteCollapsed=True|ShowOpenEnds=True|ExpandDesignator=True|ExpandNetLabel=False|ExpandPort=False|ExpandSheetNum=False|ExpandDocNum=False|PrintArea=0|PrintAreaRect.X1=0|PrintAreaRect.Y1=0|PrintAreaRect.X2=0|PrintAreaRect.Y2=0 +OutputType10=SimView Print +OutputName10=SimView Prints +OutputDocumentPath10= +OutputVariantName10= +OutputDefault10=0 +PageOptions10=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 + +[OutputGroup4] +Name=Assembly Outputs +Description= +TargetPrinter=Lenovo M7216NWA +PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1 +OutputType1=Assembly +OutputName1=Assembly Drawings +OutputDocumentPath1= +OutputVariantName1=[No Variations] +OutputDefault1=0 +PageOptions1=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType2=Pick Place +OutputName2=Generates pick and place files +OutputDocumentPath2= +OutputVariantName2=[No Variations] +OutputDefault2=0 +OutputType3=Test Points For Assembly +OutputName3=Test Point Report +OutputDocumentPath3= +OutputVariantName3=[No Variations] +OutputDefault3=0 + +[OutputGroup5] +Name=Fabrication Outputs +Description= +TargetPrinter=Lenovo M7216NWA +PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1 +OutputType1=Board Stack Report +OutputName1=Report Board Stack +OutputDocumentPath1= +OutputVariantName1= +OutputDefault1=0 +PageOptions1=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType2=CompositeDrill +OutputName2=Composite Drill Drawing +OutputDocumentPath2= +OutputVariantName2= +OutputDefault2=0 +PageOptions2=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType3=Drill +OutputName3=Drill Drawing/Guides +OutputDocumentPath3= +OutputVariantName3= +OutputDefault3=0 +PageOptions3=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType4=Final +OutputName4=Final Artwork Prints +OutputDocumentPath4= +OutputVariantName4=[No Variations] +OutputDefault4=0 +PageOptions4=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType5=Gerber +OutputName5=Gerber Files +OutputDocumentPath5= +OutputVariantName5=[No Variations] +OutputDefault5=0 +OutputType6=Gerber X2 +OutputName6=Gerber X2 Files +OutputDocumentPath6= +OutputVariantName6= +OutputDefault6=0 +OutputType7=IPC2581 +OutputName7=IPC-2581 Files +OutputDocumentPath7= +OutputVariantName7= +OutputDefault7=0 +OutputType8=Mask +OutputName8=Solder/Paste Mask Prints +OutputDocumentPath8= +OutputVariantName8= +OutputDefault8=0 +PageOptions8=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType9=NC Drill +OutputName9=NC Drill Files +OutputDocumentPath9= +OutputVariantName9= +OutputDefault9=0 +OutputType10=ODB +OutputName10=ODB++ Files +OutputDocumentPath10= +OutputVariantName10=[No Variations] +OutputDefault10=0 +OutputType11=Plane +OutputName11=Power-Plane Prints +OutputDocumentPath11= +OutputVariantName11= +OutputDefault11=0 +PageOptions11=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType12=Test Points +OutputName12=Test Point Report +OutputDocumentPath12= +OutputVariantName12= +OutputDefault12=0 + +[OutputGroup6] +Name=Report Outputs +Description= +TargetPrinter=Lenovo M7216NWA +PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1 +OutputType1=Script +OutputName1=Script Output +OutputDocumentPath1= +OutputVariantName1=[No Variations] +OutputDefault1=0 +OutputType2=SimpleBOM +OutputName2=Simple BOM +OutputDocumentPath2= +OutputVariantName2=[No Variations] +OutputDefault2=0 +OutputType3=SinglePinNetReporter +OutputName3=Report Single Pin Nets +OutputDocumentPath3= +OutputVariantName3=[No Variations] +OutputDefault3=0 +OutputType4=BOM_PartType +OutputName4=Bill of Materials +OutputDocumentPath4= +OutputVariantName4=[No Variations] +OutputDefault4=0 +PageOptions4=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +Configuration4_Name1=ColumnNameFormat +Configuration4_Item1=CaptionAsName +Configuration4_Name2=Filter +Configuration4_Item2=545046300E5446696C74657257726170706572000D46696C7465722E416374697665090F46696C7465722E43726974657269610A04000000000000000000 +Configuration4_Name3=General +Configuration4_Item3=OpenExported=False|AddToProject=False|ForceFit=False|NotFitted=False|Database=False|DatabasePriority=False|IncludePCBData=True|IncludeVaultData=False|IncludeAlternatives=False|ShowExportOptions=True|TemplateFilename=|BatchMode=5|FormWidth=1315|FormHeight=1122|SupplierProdQty=1|SupplierAutoQty=False|SupplierUseCachedPricing=False|SupplierCurrency= +Configuration4_Name4=GroupOrder +Configuration4_Item4=Comment=True|Footprint=True +Configuration4_Name5=SortOrder +Configuration4_Item5=Designator=Up|Comment=Up|Footprint=Up +Configuration4_Name6=VisibleOrder +Configuration4_Item6=Comment=80|Description=80|Designator=80|Footprint=80|LibRef=80|Quantity=80 +OutputType5=ComponentCrossReference +OutputName5=Component Cross Reference Report +OutputDocumentPath5= +OutputVariantName5=[No Variations] +OutputDefault5=0 +OutputType6=ReportHierarchy +OutputName6=Report Project Hierarchy +OutputDocumentPath6= +OutputVariantName6=[No Variations] +OutputDefault6=0 + +[OutputGroup7] +Name=Other Outputs +Description= +TargetPrinter=Lenovo M7216NWA +PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1 +OutputType1=Text Print +OutputName1=Text Print +OutputDocumentPath1= +OutputVariantName1= +OutputDefault1=0 +PageOptions1=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType2=Text Print +OutputName2=Text Print +OutputDocumentPath2= +OutputVariantName2= +OutputDefault2=0 +PageOptions2=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType3=Text Print +OutputName3=Text Print +OutputDocumentPath3= +OutputVariantName3= +OutputDefault3=0 +PageOptions3=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType4=Text Print +OutputName4=Text Print +OutputDocumentPath4= +OutputVariantName4= +OutputDefault4=0 +PageOptions4=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType5=Text Print +OutputName5=Text Print +OutputDocumentPath5= +OutputVariantName5= +OutputDefault5=0 +PageOptions5=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType6=Text Print +OutputName6=Text Print +OutputDocumentPath6= +OutputVariantName6= +OutputDefault6=0 +PageOptions6=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType7=Text Print +OutputName7=Text Print +OutputDocumentPath7= +OutputVariantName7= +OutputDefault7=0 +PageOptions7=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType8=Text Print +OutputName8=Text Print +OutputDocumentPath8= +OutputVariantName8= +OutputDefault8=0 +PageOptions8=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType9=Text Print +OutputName9=Text Print +OutputDocumentPath9= +OutputVariantName9= +OutputDefault9=0 +PageOptions9=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType10=Text Print +OutputName10=Text Print +OutputDocumentPath10= +OutputVariantName10= +OutputDefault10=0 +PageOptions10=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType11=Text Print +OutputName11=Text Print +OutputDocumentPath11= +OutputVariantName11= +OutputDefault11=0 +PageOptions11=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType12=Text Print +OutputName12=Text Print +OutputDocumentPath12= +OutputVariantName12= +OutputDefault12=0 +PageOptions12=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType13=Text Print +OutputName13=Text Print +OutputDocumentPath13= +OutputVariantName13= +OutputDefault13=0 +PageOptions13=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType14=Text Print +OutputName14=Text Print +OutputDocumentPath14= +OutputVariantName14= +OutputDefault14=0 +PageOptions14=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType15=Text Print +OutputName15=Text Print +OutputDocumentPath15= +OutputVariantName15= +OutputDefault15=0 +PageOptions15=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType16=Text Print +OutputName16=Text Print +OutputDocumentPath16= +OutputVariantName16= +OutputDefault16=0 +PageOptions16=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType17=Text Print +OutputName17=Text Print +OutputDocumentPath17= +OutputVariantName17= +OutputDefault17=0 +PageOptions17=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType18=Text Print +OutputName18=Text Print +OutputDocumentPath18= +OutputVariantName18= +OutputDefault18=0 +PageOptions18=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType19=Text Print +OutputName19=Text Print +OutputDocumentPath19= +OutputVariantName19= +OutputDefault19=0 +PageOptions19=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType20=Text Print +OutputName20=Text Print +OutputDocumentPath20= +OutputVariantName20= +OutputDefault20=0 +PageOptions20=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType21=Text Print +OutputName21=Text Print +OutputDocumentPath21= +OutputVariantName21= +OutputDefault21=0 +PageOptions21=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType22=Text Print +OutputName22=Text Print +OutputDocumentPath22= +OutputVariantName22= +OutputDefault22=0 +PageOptions22=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType23=Text Print +OutputName23=Text Print +OutputDocumentPath23= +OutputVariantName23= +OutputDefault23=0 +PageOptions23=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType24=Text Print +OutputName24=Text Print +OutputDocumentPath24= +OutputVariantName24= +OutputDefault24=0 +PageOptions24=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType25=Text Print +OutputName25=Text Print +OutputDocumentPath25= +OutputVariantName25= +OutputDefault25=0 +PageOptions25=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType26=Text Print +OutputName26=Text Print +OutputDocumentPath26= +OutputVariantName26= +OutputDefault26=0 +PageOptions26=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType27=Text Print +OutputName27=Text Print +OutputDocumentPath27= +OutputVariantName27= +OutputDefault27=0 +PageOptions27=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType28=Text Print +OutputName28=Text Print +OutputDocumentPath28= +OutputVariantName28= +OutputDefault28=0 +PageOptions28=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType29=Text Print +OutputName29=Text Print +OutputDocumentPath29= +OutputVariantName29= +OutputDefault29=0 +PageOptions29=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 + +[OutputGroup8] +Name=Validation Outputs +Description= +TargetPrinter=Lenovo M7216NWA +PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1 +OutputType1=Component states check +OutputName1=Vault's components states check +OutputDocumentPath1= +OutputVariantName1= +OutputDefault1=0 +OutputType2=Configuration compliance +OutputName2=Environment configuration compliance check +OutputDocumentPath2= +OutputVariantName2= +OutputDefault2=0 +OutputType3=Design Rules Check +OutputName3=Design Rules Check +OutputDocumentPath3= +OutputVariantName3= +OutputDefault3=0 +PageOptions3=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType4=Differences Report +OutputName4=Differences Report +OutputDocumentPath4= +OutputVariantName4= +OutputDefault4=0 +PageOptions4=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType5=Electrical Rules Check +OutputName5=Electrical Rules Check +OutputDocumentPath5= +OutputVariantName5= +OutputDefault5=0 +PageOptions5=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType6=Footprint Comparison Report +OutputName6=Footprint Comparison Report +OutputDocumentPath6= +OutputVariantName6= +OutputDefault6=0 +OutputType7=BOM_Violations +OutputName7=BOM Checks Report +OutputDocumentPath7= +OutputVariantName7= +OutputDefault7=0 + +[OutputGroup9] +Name=Export Outputs +Description= +TargetPrinter=Lenovo M7216NWA +PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1 +OutputType1=AutoCAD dwg/dxf PCB +OutputName1=AutoCAD dwg/dxf File PCB +OutputDocumentPath1= +OutputVariantName1= +OutputDefault1=0 +OutputType2=AutoCAD dwg/dxf Schematic +OutputName2=AutoCAD dwg/dxf File Schematic +OutputDocumentPath2= +OutputVariantName2= +OutputDefault2=0 +OutputType3=ExportIDF +OutputName3=Export IDF +OutputDocumentPath3= +OutputVariantName3= +OutputDefault3=0 +OutputType4=ExportPARASOLID +OutputName4=Export PARASOLID +OutputDocumentPath4= +OutputVariantName4=[No Variations] +OutputDefault4=0 +OutputType5=ExportSTEP +OutputName5=Export STEP +OutputDocumentPath5= +OutputVariantName5=[No Variations] +OutputDefault5=0 +OutputType6=ExportVRML +OutputName6=Export VRML +OutputDocumentPath6= +OutputVariantName6=[No Variations] +OutputDefault6=0 +OutputType7=Save As/Export PCB +OutputName7=Save As/Export PCB +OutputDocumentPath7= +OutputVariantName7= +OutputDefault7=0 +OutputType8=Save As/Export Schematic +OutputName8=Save As/Export Schematic +OutputDocumentPath8= +OutputVariantName8= +OutputDefault8=0 +OutputType9=Specctra Design PCB +OutputName9=Specctra Design PCB +OutputDocumentPath9= +OutputVariantName9= +OutputDefault9=0 + +[OutputGroup10] +Name=PostProcess Outputs +Description= +TargetPrinter=Lenovo M7216NWA +PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1 +OutputType1=Copy Files +OutputName1=Copy Files +OutputDocumentPath1= +OutputVariantName1= +OutputDefault1=0 + +[Modification Levels] +Type1=1 +Type2=1 +Type3=1 +Type4=1 +Type5=1 +Type6=1 +Type7=1 +Type8=1 +Type9=1 +Type10=1 +Type11=1 +Type12=1 +Type13=1 +Type14=1 +Type15=1 +Type16=1 +Type17=1 +Type18=1 +Type19=1 +Type20=1 +Type21=1 +Type22=1 +Type23=1 +Type24=1 +Type25=1 +Type26=1 +Type27=1 +Type28=1 +Type29=1 +Type30=1 +Type31=1 +Type32=1 +Type33=1 +Type34=1 +Type35=1 +Type36=1 +Type37=1 +Type38=1 +Type39=1 +Type40=1 +Type41=1 +Type42=1 +Type43=1 +Type44=1 +Type45=1 +Type46=1 +Type47=1 +Type48=1 +Type49=1 +Type50=1 +Type51=1 +Type52=1 +Type53=1 +Type54=1 +Type55=1 +Type56=1 +Type57=1 +Type58=1 +Type59=1 +Type60=1 +Type61=1 +Type62=1 +Type63=1 +Type64=1 +Type65=1 +Type66=1 +Type67=1 +Type68=1 +Type69=1 +Type70=1 +Type71=1 +Type72=1 +Type73=1 +Type74=1 +Type75=1 +Type76=1 +Type77=1 +Type78=1 +Type79=1 +Type80=1 +Type81=1 +Type82=1 +Type83=1 +Type84=1 +Type85=1 +Type86=1 +Type87=1 +Type88=1 +Type89=1 +Type90=1 +Type91=1 +Type92=1 +Type93=1 +Type94=1 +Type95=1 +Type96=1 +Type97=1 +Type98=1 +Type99=1 +Type100=1 +Type101=1 +Type102=1 +Type103=1 +Type104=1 +Type105=1 +Type106=1 +Type107=1 +Type108=1 +Type109=1 +Type110=1 +Type111=1 +Type112=1 +Type113=1 +Type114=1 +Type115=1 +Type116=1 +Type117=1 + +[Difference Levels] +Type1=1 +Type2=1 +Type3=1 +Type4=1 +Type5=1 +Type6=1 +Type7=1 +Type8=1 +Type9=1 +Type10=1 +Type11=1 +Type12=1 +Type13=1 +Type14=1 +Type15=1 +Type16=1 +Type17=1 +Type18=1 +Type19=1 +Type20=1 +Type21=1 +Type22=1 +Type23=1 +Type24=1 +Type25=1 +Type26=1 +Type27=1 +Type28=1 +Type29=1 +Type30=1 +Type31=1 +Type32=1 +Type33=1 +Type34=1 +Type35=1 +Type36=1 +Type37=1 +Type38=1 +Type39=1 +Type40=1 +Type41=1 +Type42=1 +Type43=1 +Type44=1 +Type45=1 +Type46=1 +Type47=1 +Type48=1 +Type49=1 +Type50=1 +Type51=1 +Type52=1 +Type53=1 +Type54=1 +Type55=1 +Type56=1 +Type57=1 +Type58=1 +Type59=1 +Type60=1 +Type61=1 +Type62=1 +Type63=1 +Type64=1 +Type65=1 +Type66=1 + +[Electrical Rules Check] +Type1=1 +Type2=1 +Type3=2 +Type4=1 +Type5=2 +Type6=2 +Type7=1 +Type8=1 +Type9=1 +Type10=1 +Type11=2 +Type12=2 +Type13=2 +Type14=1 +Type15=1 +Type16=1 +Type17=1 +Type18=1 +Type19=1 +Type20=1 +Type21=1 +Type22=1 +Type23=1 +Type24=1 +Type25=2 +Type26=2 +Type27=2 +Type28=1 +Type29=1 +Type30=1 +Type31=1 +Type32=2 +Type33=2 +Type34=2 +Type35=1 +Type36=2 +Type37=1 +Type38=2 +Type39=2 +Type40=2 +Type41=0 +Type42=2 +Type43=1 +Type44=1 +Type45=2 +Type46=1 +Type47=2 +Type48=2 +Type49=1 +Type50=2 +Type51=1 +Type52=1 +Type53=1 +Type54=1 +Type55=1 +Type56=2 +Type57=1 +Type58=1 +Type59=2 +Type60=1 +Type61=2 +Type62=2 +Type63=1 +Type64=0 +Type65=2 +Type66=3 +Type67=2 +Type68=2 +Type69=2 +Type70=2 +Type71=2 +Type72=2 +Type73=2 +Type74=1 +Type75=2 +Type76=1 +Type77=1 +Type78=1 +Type79=1 +Type80=2 +Type81=3 +Type82=3 +Type83=3 +Type84=3 +Type85=3 +Type86=2 +Type87=2 +Type88=2 +Type89=1 +Type90=1 +Type91=3 +Type92=3 +Type93=2 +Type94=2 +Type95=2 +Type96=2 +Type97=2 +Type98=0 +Type99=1 +Type100=2 +Type101=1 +Type102=2 +Type103=2 +Type104=1 +Type105=2 +Type106=2 +Type107=2 +Type108=2 +Type109=1 +Type110=1 +Type111=1 +Type112=1 +Type113=1 +Type114=2 +Type115=2 +Type116=2 +Type117=3 +Type118=3 +Type119=3 +MultiChannelAlternate=2 +AlternateItemFail=3 +Type122=2 + +[ERC Connection Matrix] +L1=NNNNNNNNNNNWNNNWW +L2=NNWNNNNWWWNWNWNWN +L3=NWEENEEEENEWNEEWN +L4=NNENNNWEENNWNENWN +L5=NNNNNNNNNNNNNNNNN +L6=NNENNNNEENNWNENWN +L7=NNEWNNWEENNWNENWN +L8=NWEENEENEEENNEENN +L9=NWEENEEEENEWNEEWW +L10=NWNNNNNENNEWNNEWN +L11=NNENNNNEEENWNENWN +L12=WWWWNWWNWWWNWWWNN +L13=NNNNNNNNNNNWNNNWW +L14=NWEENEEEENEWNEEWW +L15=NNENNNNEEENWNENWW +L16=WWWWNWWNWWWNWWWNW +L17=WNNNNNNNWNNNWWWWN + +[Annotate] +SortOrder=3 +SortLocation=0 +MatchParameter1=Comment +MatchStrictly1=1 +MatchParameter2=Library Reference +MatchStrictly2=1 +PhysicalNamingFormat=$Component_$RoomName +GlobalIndexSortOrder=3 +GlobalIndexSortLocation=0 + +[PrjClassGen] +CompClassManualEnabled=0 +CompClassManualRoomEnabled=0 +NetClassAutoBusEnabled=1 +NetClassAutoCompEnabled=0 +NetClassAutoNamedHarnessEnabled=0 +NetClassManualEnabled=1 +NetClassSeparateForBusSections=0 + +[LibraryUpdateOptions] +SelectedOnly=0 +UpdateVariants=1 +PartTypes=0 +ComponentLibIdentifierKind0=Library Name And Type +ComponentLibraryIdentifier0=0.1 - --.SchLib +ComponentDesignItemID0=L +ComponentSymbolReference0=L +ComponentUpdate0=0 +ComponentIsDeviceSheet0=0 +ComponentLibIdentifierKind1=Library Name And Type +ComponentLibraryIdentifier1=0.7 - ð-.SchLib +ComponentDesignItemID1=KET 7X7 +ComponentSymbolReference1=KET 7X7 +ComponentUpdate1=0 +ComponentIsDeviceSheet1=0 +ComponentLibIdentifierKind2=Library Name And Type +ComponentLibraryIdentifier2=0.7 - ð-.SchLib +ComponentDesignItemID2=TSW SMD-6x6 +ComponentSymbolReference2=TSW SMD-6x6 +ComponentUpdate2=0 +ComponentIsDeviceSheet2=0 +ComponentLibIdentifierKind3=Library Name And Type +ComponentLibraryIdentifier3=0.8 - ̫-Ƶ-USB.SchLib +ComponentDesignItemID3=USB-5P +ComponentSymbolReference3=USB-5P +ComponentUpdate3=0 +ComponentIsDeviceSheet3=0 +ComponentLibIdentifierKind4=Library Name And Type +ComponentLibraryIdentifier4=1.1 - ԴоƬ.SchLib +ComponentDesignItemID4=AMS1117 +ComponentSymbolReference4=AMS1117 +ComponentUpdate4=0 +ComponentIsDeviceSheet4=0 +ComponentLibIdentifierKind5=Library Name And Type +ComponentLibraryIdentifier5=1.8 - WiFi-SMAƵ.SchLib +ComponentDesignItemID5=SMA +ComponentSymbolReference5=SMA +ComponentUpdate5=0 +ComponentIsDeviceSheet5=0 +ComponentLibIdentifierKind6=Library Name And Type +ComponentLibraryIdentifier6=2.0 - ˿--.SchLib +ComponentDesignItemID6=XTAL-4P +ComponentSymbolReference6=XTAL-4P +ComponentUpdate6=0 +ComponentIsDeviceSheet6=0 +ComponentLibIdentifierKind7=Library Name And Type +ComponentLibraryIdentifier7=4.1 - δ.SchLib +ComponentDesignItemID7=ͭͷС +ComponentSymbolReference7=ͭͷС +ComponentUpdate7=0 +ComponentIsDeviceSheet7=0 +ComponentLibIdentifierKind8=Library Name And Type +ComponentLibraryIdentifier8=5.3 - Ӳ-ž2.54 (100mil) .SchLib +ComponentDesignItemID8=Header 15X2 +ComponentSymbolReference8=Header 15X2 +ComponentUpdate8=0 +ComponentIsDeviceSheet8=0 +ComponentLibIdentifierKind9=Library Name And Type +ComponentLibraryIdentifier9=5.3 - Ӳ-ž2.54 (100mil) .SchLib +ComponentDesignItemID9=Header 2 +ComponentSymbolReference9=Header 2 +ComponentUpdate9=0 +ComponentIsDeviceSheet9=0 +ComponentLibIdentifierKind10=Library Name And Type +ComponentLibraryIdentifier10=5.3 - Ӳ-ž2.54 (100mil) .SchLib +ComponentDesignItemID10=Header 2X2 +ComponentSymbolReference10=Header 2X2 +ComponentUpdate10=0 +ComponentIsDeviceSheet10=0 +ComponentLibIdentifierKind11=Library Name And Type +ComponentLibraryIdentifier11=5.3 - Ӳ-ž2.54 (100mil) .SchLib +ComponentDesignItemID11=Header 4 +ComponentSymbolReference11=Header 4 +ComponentUpdate11=0 +ComponentIsDeviceSheet11=0 +ComponentLibIdentifierKind12=Library Name And Type +ComponentLibraryIdentifier12=5.3 - Ӳ-ž2.54 (100mil) .SchLib +ComponentDesignItemID12=Header 5 +ComponentSymbolReference12=Header 5 +ComponentUpdate12=0 +ComponentIsDeviceSheet12=0 +ComponentLibIdentifierKind13=Library Name And Type +ComponentLibraryIdentifier13=HYBXX_Dragon.IntLib +ComponentDesignItemID13=Cap +ComponentSymbolReference13=Cap +ComponentUpdate13=0 +ComponentIsDeviceSheet13=0 +ComponentLibIdentifierKind14=Library Name And Type +ComponentLibraryIdentifier14=HYBXX_Dragon.IntLib +ComponentDesignItemID14=CP2110-GM_QFN24 +ComponentSymbolReference14=CP2110-GM_QFN24 +ComponentUpdate14=0 +ComponentIsDeviceSheet14=0 +ComponentLibIdentifierKind15=Library Name And Type +ComponentLibraryIdentifier15=HYBXX_Dragon.IntLib +ComponentDesignItemID15=LED +ComponentSymbolReference15=LED +ComponentUpdate15=0 +ComponentIsDeviceSheet15=0 +ComponentLibIdentifierKind16=Library Name And Type +ComponentLibraryIdentifier16=HYBXX_Dragon.IntLib +ComponentDesignItemID16=Res +ComponentSymbolReference16=Res +ComponentUpdate16=0 +ComponentIsDeviceSheet16=0 +ComponentLibIdentifierKind17=Library Name And Type +ComponentLibraryIdentifier17=HYBXX_Dragon.PcbLib +ComponentDesignItemID17=Cap Pol3 +ComponentSymbolReference17=Cap Pol3 +ComponentUpdate17=0 +ComponentIsDeviceSheet17=0 +ComponentLibIdentifierKind18=Library Name And Type +ComponentLibraryIdentifier18=HYBXX_Dragon.SCHLIB +ComponentDesignItemID18=Cap +ComponentSymbolReference18=Cap +ComponentUpdate18=0 +ComponentIsDeviceSheet18=0 +ComponentLibIdentifierKind19=Library Name And Type +ComponentLibraryIdentifier19=HYBXX_Dragon.SchLib +ComponentDesignItemID19=HYB53_RF_GND +ComponentSymbolReference19=HYB53_RF_GND +ComponentUpdate19=0 +ComponentIsDeviceSheet19=0 +ComponentLibIdentifierKind20=Library Name And Type +ComponentLibraryIdentifier20=HYBXX_Dragon.SchLib +ComponentDesignItemID20=PRTR5V0U2X +ComponentSymbolReference20=PRTR5V0U2X +ComponentUpdate20=0 +ComponentIsDeviceSheet20=0 +FullReplace=1 +UpdateDesignatorLock=1 +UpdatePartIDLock=1 +PreserveParameterLocations=1 +PreserveParameterVisibility=1 +DoGraphics=1 +DoParameters=1 +DoModels=1 +AddParameters=0 +RemoveParameters=0 +AddModels=1 +RemoveModels=1 +UpdateCurrentModels=1 +ParameterName0=BOM +ParameterUpdate0=1 +ParameterName1=Comment +ParameterUpdate1=1 +ParameterName2=Component Kind +ParameterUpdate2=1 +ParameterName3=Description +ParameterUpdate3=1 +ParameterName4=LatestRevisionDate +ParameterUpdate4=1 +ParameterName5=LatestRevisionNote +ParameterUpdate5=1 +ParameterName6=Library Reference +ParameterUpdate6=1 +ParameterName7=PackageDescription +ParameterUpdate7=1 +ParameterName8=PackageReference +ParameterUpdate8=1 +ParameterName9=Published +ParameterUpdate9=1 +ParameterName10=Publisher +ParameterUpdate10=1 +ParameterName11=Value +ParameterUpdate11=1 +ParameterName12=Ȩ +ParameterUpdate12=1 +ParameterName13=ӭԱ +ParameterUpdate13=1 +ParameterName14=ԱID +ParameterUpdate14=1 +ParameterName15=Ψһ۵ַ +ParameterUpdate15=1 +ParameterName16=ѧϰԴ +ParameterUpdate16=1 +ModelTypeGroup0=PCBLIB +ModelTypeUpdate0=1 +ModelType0=PCBLIB +ModelName0=C 0603_L +ModelUpdate0=1 +ModelType1=PCBLIB +ModelName1=C1210 +ModelUpdate1=1 +ModelType2=PCBLIB +ModelName2=CAPC_0402 +ModelUpdate2=1 +ModelType3=PCBLIB +ModelName3=CAPC-0603 +ModelUpdate3=1 +ModelType4=PCBLIB +ModelName4=HDR1X5 +ModelUpdate4=1 +ModelType5=PCBLIB +ModelName5=HDR2.54-LI-2P +ModelUpdate5=1 +ModelType6=PCBLIB +ModelName6=HDR2.54-LI-2x15P +ModelUpdate6=1 +ModelType7=PCBLIB +ModelName7=HDR2.54-LI-2x2P +ModelUpdate7=1 +ModelType8=PCBLIB +ModelName8=HDR2.54-LI-4P +ModelUpdate8=1 +ModelType9=PCBLIB +ModelName9=HDR2.54-LI-5P +ModelUpdate9=1 +ModelType10=PCBLIB +ModelName10=HDR2.54-M-LI-4P +ModelUpdate10=1 +ModelType11=PCBLIB +ModelName11=HDR2.54-M-LS-2x15P +ModelUpdate11=1 +ModelType12=PCBLIB +ModelName12=HDR2.54-M-LS-2x2P +ModelUpdate12=1 +ModelType13=PCBLIB +ModelName13=HDR2.54-M-WS-4P +ModelUpdate13=1 +ModelType14=PCBLIB +ModelName14=HDR2.54-WI-2x15P +ModelUpdate14=1 +ModelType15=PCBLIB +ModelName15=HDR2.54-WI-2x2P +ModelUpdate15=1 +ModelType16=PCBLIB +ModelName16=HDR2.54-WI-4P +ModelUpdate16=1 +ModelType17=PCBLIB +ModelName17=HDR2.54-WS-4P +ModelUpdate17=1 +ModelType18=PCBLIB +ModelName18=HDR2.54-Y-LI-4P +ModelUpdate18=1 +ModelType19=PCBLIB +ModelName19=IDC2.54-LI-2x15P +ModelUpdate19=1 +ModelType20=PCBLIB +ModelName20=KF2510-LI-4P +ModelUpdate20=1 +ModelType21=PCBLIB +ModelName21=KF2EDGK-2.54-LI-4P +ModelUpdate21=1 +ModelType22=PCBLIB +ModelName22=KF2EDGK-2.54-WI-4P +ModelUpdate22=1 +ModelType23=PCBLIB +ModelName23=KFT DIP-7X7 +ModelUpdate23=1 +ModelType24=PCBLIB +ModelName24=L 0402 +ModelUpdate24=1 +ModelType25=PCBLIB +ModelName25=L 0603 +ModelUpdate25=1 +ModelType26=PCBLIB +ModelName26=L 0805 +ModelUpdate26=1 +ModelType27=PCBLIB +ModelName27=L 1206 +ModelUpdate27=1 +ModelType28=PCBLIB +ModelName28=L 1210 +ModelUpdate28=1 +ModelType29=PCBLIB +ModelName29=L 1806 +ModelUpdate29=1 +ModelType30=PCBLIB +ModelName30=L 1812 +ModelUpdate30=1 +ModelType31=PCBLIB +ModelName31=LED_0603 +ModelUpdate31=1 +ModelType32=PCBLIB +ModelName32=LED_0805_R +ModelUpdate32=1 +ModelType33=PCBLIB +ModelName33=M3x10+6_L +ModelUpdate33=1 +ModelType34=PCBLIB +ModelName34=M3x11+6_L +ModelUpdate34=1 +ModelType35=PCBLIB +ModelName35=M3x12+6_L +ModelUpdate35=1 +ModelType36=PCBLIB +ModelName36=M3x13+6_L +ModelUpdate36=1 +ModelType37=PCBLIB +ModelName37=M3x14+6_L +ModelUpdate37=1 +ModelType38=PCBLIB +ModelName38=M3x15+6_L +ModelUpdate38=1 +ModelType39=PCBLIB +ModelName39=M3x16+6_L +ModelUpdate39=1 +ModelType40=PCBLIB +ModelName40=M3x17+6_L +ModelUpdate40=1 +ModelType41=PCBLIB +ModelName41=M3x18+6_L +ModelUpdate41=1 +ModelType42=PCBLIB +ModelName42=M3x19+6_L +ModelUpdate42=1 +ModelType43=PCBLIB +ModelName43=M3x20+6_L +ModelUpdate43=1 +ModelType44=PCBLIB +ModelName44=M3x21+6_L +ModelUpdate44=1 +ModelType45=PCBLIB +ModelName45=M3x22+6_L +ModelUpdate45=1 +ModelType46=PCBLIB +ModelName46=M3x23+6_L +ModelUpdate46=1 +ModelType47=PCBLIB +ModelName47=M3x24+6_L +ModelUpdate47=1 +ModelType48=PCBLIB +ModelName48=M3x25+6_L +ModelUpdate48=1 +ModelType49=PCBLIB +ModelName49=M3x26+6_L +ModelUpdate49=1 +ModelType50=PCBLIB +ModelName50=M3x27+6_L +ModelUpdate50=1 +ModelType51=PCBLIB +ModelName51=M3x28+6_L +ModelUpdate51=1 +ModelType52=PCBLIB +ModelName52=M3x30+6_L +ModelUpdate52=1 +ModelType53=PCBLIB +ModelName53=M3x32+6_L +ModelUpdate53=1 +ModelType54=PCBLIB +ModelName54=M3x35+6_L +ModelUpdate54=1 +ModelType55=PCBLIB +ModelName55=M3x4+6_L +ModelUpdate55=1 +ModelType56=PCBLIB +ModelName56=M3x40+6_L +ModelUpdate56=1 +ModelType57=PCBLIB +ModelName57=M3x45+6_L +ModelUpdate57=1 +ModelType58=PCBLIB +ModelName58=M3x5+6_L +ModelUpdate58=1 +ModelType59=PCBLIB +ModelName59=M3x50+6_L +ModelUpdate59=1 +ModelType60=PCBLIB +ModelName60=M3x55+6_L +ModelUpdate60=1 +ModelType61=PCBLIB +ModelName61=M3x6+6_L +ModelUpdate61=1 +ModelType62=PCBLIB +ModelName62=M3x60+6_L +ModelUpdate62=1 +ModelType63=PCBLIB +ModelName63=M3x65+6_L +ModelUpdate63=1 +ModelType64=PCBLIB +ModelName64=M3x7+6_L +ModelUpdate64=1 +ModelType65=PCBLIB +ModelName65=M3x8+6_L +ModelUpdate65=1 +ModelType66=PCBLIB +ModelName66=M3x9+6_L +ModelUpdate66=1 +ModelType67=PCBLIB +ModelName67=OSC 1612-4P +ModelUpdate67=1 +ModelType68=PCBLIB +ModelName68=OSC 2025-4P +ModelUpdate68=1 +ModelType69=PCBLIB +ModelName69=OSC 3225-4P +ModelUpdate69=1 +ModelType70=PCBLIB +ModelName70=OSC 4025-4P +ModelUpdate70=1 +ModelType71=PCBLIB +ModelName71=OSC 5032-4P +ModelUpdate71=1 +ModelType72=PCBLIB +ModelName72=OSC 6035-4P +ModelUpdate72=1 +ModelType73=PCBLIB +ModelName73=OSC 7050-4P +ModelUpdate73=1 +ModelType74=PCBLIB +ModelName74=OSC 8045-4P +ModelUpdate74=1 +ModelType75=PCBLIB +ModelName75=OSC 8045-4P-C +ModelUpdate75=1 +ModelType76=PCBLIB +ModelName76=QFN24_CP2110-GM +ModelUpdate76=1 +ModelType77=PCBLIB +ModelName77=QFN32L_0404x0.75-0.40 +ModelUpdate77=1 +ModelType78=PCBLIB +ModelName78=RESC_0603 +ModelUpdate78=1 +ModelType79=PCBLIB +ModelName79=RESC-0402 +ModelUpdate79=1 +ModelType80=PCBLIB +ModelName80=SMA-KE-LI +ModelUpdate80=1 +ModelType81=PCBLIB +ModelName81=SOT143B +ModelUpdate81=1 +ModelType82=PCBLIB +ModelName82=SOT223_L +ModelUpdate82=1 +ModelType83=PCBLIB +ModelName83=SOT223_M +ModelUpdate83=1 +ModelType84=PCBLIB +ModelName84=SOT223_N +ModelUpdate84=1 +ModelType85=PCBLIB +ModelName85=SOT89_L +ModelUpdate85=1 +ModelType86=PCBLIB +ModelName86=SOT89_M +ModelUpdate86=1 +ModelType87=PCBLIB +ModelName87=SOT89_N +ModelUpdate87=1 +ModelType88=PCBLIB +ModelName88=TSW SMD-6*6*10 +ModelUpdate88=1 +ModelType89=PCBLIB +ModelName89=TSW SMD-6*6*12 +ModelUpdate89=1 +ModelType90=PCBLIB +ModelName90=TSW SMD-6*6*13 +ModelUpdate90=1 +ModelType91=PCBLIB +ModelName91=TSW SMD-6*6*14 +ModelUpdate91=1 +ModelType92=PCBLIB +ModelName92=TSW SMD-6*6*15 +ModelUpdate92=1 +ModelType93=PCBLIB +ModelName93=TSW SMD-6*6*4.3 +ModelUpdate93=1 +ModelType94=PCBLIB +ModelName94=TSW SMD-6*6*5 +ModelUpdate94=1 +ModelType95=PCBLIB +ModelName95=TSW SMD-6*6*6 +ModelUpdate95=1 +ModelType96=PCBLIB +ModelName96=TSW SMD-6*6*7 +ModelUpdate96=1 +ModelType97=PCBLIB +ModelName97=TSW SMD-6*6*8 +ModelUpdate97=1 +ModelType98=PCBLIB +ModelName98=TSW SMD-6*6*9 +ModelUpdate98=1 +ModelType99=PCBLIB +ModelName99=USB-MICRO - duplicate +ModelUpdate99=1 +ModelType100=PCBLIB +ModelName100=USB-MICRO_A +ModelUpdate100=1 +ModelType101=PCBLIB +ModelName101=USB-MICRO_B +ModelUpdate101=1 +ModelType102=PCBLIB +ModelName102=USB-MICRO_C +ModelUpdate102=1 +ModelType103=PCBLIB +ModelName103=USB-MICRO_D +ModelUpdate103=1 +ModelType104=PCBLIB +ModelName104=USB-MICRO_E +ModelUpdate104=1 +ModelType105=PCBLIB +ModelName105=USB-MINI-A +ModelUpdate105=1 +ModelType106=PCBLIB +ModelName106=USB-MINI-B +ModelUpdate106=1 +ModelType107=PCBLIB +ModelName107=USB-MINI-SMD-9.4X9.2-H3.7 +ModelUpdate107=1 +ModelType108=PCBLIB +ModelName108=XH2.54-LI-4P +ModelUpdate108=1 +ModelType109=PCBLIB +ModelName109=XH2.54-LS-4P +ModelUpdate109=1 +ModelType110=PCBLIB +ModelName110=XH2.54-WI-4P +ModelUpdate110=1 +ModelType111=PCBLIB +ModelName111=XH2.54-WS-4P +ModelUpdate111=1 +ModelTypeGroup1=SI +ModelTypeUpdate1=1 +ModelType112=SI +ModelName112=Cap Pol +ModelUpdate112=1 +ModelType113=SI +ModelName113=Connector +ModelUpdate113=1 +ModelTypeGroup2=SIM +ModelTypeUpdate2=1 +ModelType114=SIM +ModelName114=CAP +ModelUpdate114=1 + +[DatabaseUpdateOptions] +SelectedOnly=0 +UpdateVariants=1 +PartTypes=0 + +[Comparison Options] +ComparisonOptions0=Kind=Net|MinPercent=75|MinMatch=3|ShowMatch=-1|Confirm=-1|UseName=-1|InclAllRules=0 +ComparisonOptions1=Kind=Net Class|MinPercent=75|MinMatch=3|ShowMatch=-1|Confirm=-1|UseName=-1|InclAllRules=0 +ComparisonOptions2=Kind=Component Class|MinPercent=75|MinMatch=3|ShowMatch=-1|Confirm=-1|UseName=-1|InclAllRules=0 +ComparisonOptions3=Kind=Rule|MinPercent=75|MinMatch=3|ShowMatch=-1|Confirm=-1|UseName=-1|InclAllRules=0 +ComparisonOptions4=Kind=Differential Pair|MinPercent=50|MinMatch=1|ShowMatch=0|Confirm=0|UseName=0|InclAllRules=0 +ComparisonOptions5=Kind=Structure Class|MinPercent=75|MinMatch=3|ShowMatch=-1|Confirm=-1|UseName=-1|InclAllRules=0 + +[SmartPDF] +PageOptions=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +Configuration_Name1=OutputConfigurationParameter1 +Configuration_Item1=DesignatorDisplayMode=Physical|PrintArea=DesignExtent|PrintAreaLowerLeftCornerX=0|PrintAreaLowerLeftCornerY=0|PrintAreaUpperRightCornerX=0|PrintAreaUpperRightCornerY=0|Record=PcbPrintView +Configuration_Name2=OutputConfigurationParameter2 +Configuration_Item2=IncludeBottomLayerComponents=True|IncludeMultiLayerComponents=True|IncludeTopLayerComponents=True|IncludeViewports=True|Index=0|Mirror=False|Name=Top LayerAssembly Drawing|PadNumberFontSize=14|Record=PcbPrintOut|ShowHoles=False|ShowPadNets=False|ShowPadNumbers=False|SubstituteFonts=False +Configuration_Name3=OutputConfigurationParameter3 +Configuration_Item3=CArc=Hidden|CFill=Hidden|Comment=Full|Coordinate=Hidden|CPad=Hidden|CRegion=Hidden|CText=Full|CTrack=Full|CVia=Hidden|Designator=Full|Dimension=Hidden|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Hidden|FFill=Hidden|FPad=Hidden|FRegion=Hidden|FText=Full|FTrack=Full|FVia=Hidden|Layer=TopOverlay|Polygon=Hidden|PrintOutIndex=0|Record=PcbPrintLayer +Configuration_Name4=OutputConfigurationParameter4 +Configuration_Item4=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Hidden|FFill=Hidden|FPad=Hidden|FRegion=Hidden|FText=Hidden|FTrack=Full|FVia=Hidden|Layer=TopLayer|Polygon=Hidden|PrintOutIndex=0|Record=PcbPrintLayer +Configuration_Name5=OutputConfigurationParameter5 +Configuration_Item5=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Full|FFill=Full|FPad=Full|FRegion=Full|FText=Full|FTrack=Full|FVia=Full|Layer=TopSolder|Polygon=Hidden|PrintOutIndex=0|Record=PcbPrintLayer +Configuration_Name6=OutputConfigurationParameter6 +Configuration_Item6=IncludeBottomLayerComponents=True|IncludeMultiLayerComponents=True|IncludeTopLayerComponents=True|IncludeViewports=True|Index=1|Mirror=True|Name=Bottom LayerAssembly Drawing|PadNumberFontSize=14|Record=PcbPrintOut|ShowHoles=False|ShowPadNets=False|ShowPadNumbers=False|SubstituteFonts=False +Configuration_Name7=OutputConfigurationParameter7 +Configuration_Item7=CArc=Hidden|CFill=Hidden|Comment=Full|Coordinate=Hidden|CPad=Hidden|CRegion=Hidden|CText=Full|CTrack=Full|CVia=Hidden|Designator=Full|Dimension=Hidden|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Hidden|FFill=Hidden|FPad=Hidden|FRegion=Hidden|FText=Full|FTrack=Full|FVia=Hidden|Layer=BottomOverlay|Polygon=Hidden|PrintOutIndex=1|Record=PcbPrintLayer +Configuration_Name8=OutputConfigurationParameter8 +Configuration_Item8=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Hidden|FFill=Hidden|FPad=Hidden|FRegion=Hidden|FText=Hidden|FTrack=Full|FVia=Hidden|Layer=BottomLayer|Polygon=Hidden|PrintOutIndex=1|Record=PcbPrintLayer +Configuration_Name9=OutputConfigurationParameter9 +Configuration_Item9=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Full|FFill=Full|FPad=Full|FRegion=Full|FText=Full|FTrack=Full|FVia=Full|Layer=BottomSolder|Polygon=Hidden|PrintOutIndex=1|Record=PcbPrintLayer + diff --git a/doc/HW_Spec/QFN32/01Developmentboard/2023-07-28/B6_32D_20230728.SchDoc b/doc/HW_Spec/QFN32/01Developmentboard/2023-07-28/B6_32D_20230728.SchDoc new file mode 100644 index 0000000..50a2e86 Binary files /dev/null and b/doc/HW_Spec/QFN32/01Developmentboard/2023-07-28/B6_32D_20230728.SchDoc differ diff --git a/doc/HW_Spec/QFN32/01Developmentboard/2023-07-28/B6_32D_20230728.pdf b/doc/HW_Spec/QFN32/01Developmentboard/2023-07-28/B6_32D_20230728.pdf new file mode 100644 index 0000000..c034179 Binary files /dev/null and b/doc/HW_Spec/QFN32/01Developmentboard/2023-07-28/B6_32D_20230728.pdf differ diff --git a/doc/HW_Spec/QFN32/DataSheet_Reference/Datasheet.SchDoc b/doc/HW_Spec/QFN32/DataSheet_Reference/Datasheet.SchDoc new file mode 100644 index 0000000..13d46e7 Binary files /dev/null and b/doc/HW_Spec/QFN32/DataSheet_Reference/Datasheet.SchDoc differ diff --git a/doc/HW_Spec/QFN32/DataSheet_Reference/Datasheet.pdf b/doc/HW_Spec/QFN32/DataSheet_Reference/Datasheet.pdf new file mode 100644 index 0000000..379af7d Binary files /dev/null and b/doc/HW_Spec/QFN32/DataSheet_Reference/Datasheet.pdf differ diff --git a/doc/HW_Spec/常用天线库.PcbLib b/doc/HW_Spec/常用天线库.PcbLib new file mode 100644 index 0000000..1bff657 Binary files /dev/null and b/doc/HW_Spec/常用天线库.PcbLib differ diff --git a/doc/HW_Spec/文件说明.txt b/doc/HW_Spec/文件说明.txt new file mode 100644 index 0000000..c9ca0e1 --- /dev/null +++ b/doc/HW_Spec/文件说明.txt @@ -0,0 +1,2 @@ +PCB画图软件:Altium Designer + 版本号:19.0.4(Build 130) \ No newline at end of file diff --git a/doc/HW_Spec/硬件设计指导.docx b/doc/HW_Spec/硬件设计指导.docx new file mode 100644 index 0000000..64e20be Binary files /dev/null and b/doc/HW_Spec/硬件设计指导.docx differ diff --git a/doc/MP_Spec/UartTool/CH341SER.zip b/doc/MP_Spec/UartTool/CH341SER.zip new file mode 100644 index 0000000..0850ee3 Binary files /dev/null and b/doc/MP_Spec/UartTool/CH341SER.zip differ diff --git a/doc/MP_Spec/UartTool/XCOM V2.6.exe b/doc/MP_Spec/UartTool/XCOM V2.6.exe new file mode 100644 index 0000000..63d1a5b Binary files /dev/null and b/doc/MP_Spec/UartTool/XCOM V2.6.exe differ diff --git a/doc/MP_Spec/量产软件/ISP Tool.exe b/doc/MP_Spec/量产软件/ISP Tool.exe new file mode 100644 index 0000000..9ae1ee7 Binary files /dev/null and b/doc/MP_Spec/量产软件/ISP Tool.exe differ diff --git a/doc/MP_Spec/量产软件源码/量产软件源码.rar b/doc/MP_Spec/量产软件源码/量产软件源码.rar new file mode 100644 index 0000000..8d0af3d Binary files /dev/null and b/doc/MP_Spec/量产软件源码/量产软件源码.rar differ diff --git a/doc/ReadMe.txt b/doc/ReadMe.txt new file mode 100644 index 0000000..cdc98b4 --- /dev/null +++ b/doc/ReadMe.txt @@ -0,0 +1,15 @@ +HW_Spec: 硬件设计相关文档 + 1.开发板PCB&原理图 + 2.常用天线库 + 3.硬件设计指导 + +MP_Spec: 量产相关文档 + 1.串口工具&驱动 + 2.量产烧录器固件 + 3.量产PC端软件源码 + +SW_Spec: 软件开发相关文档 + 1.芯片使用指南 + 2.IO映射表 + 3.Flash地址映射说明 + 4.Jflash烧录配置说明 \ No newline at end of file diff --git a/doc/SW_Spec/B6x-Flash-Map.xlsx b/doc/SW_Spec/B6x-Flash-Map.xlsx new file mode 100644 index 0000000..6c4a154 Binary files /dev/null and b/doc/SW_Spec/B6x-Flash-Map.xlsx differ diff --git a/doc/SW_Spec/B6x_BLE芯片使用指南_V1.0.0.docx b/doc/SW_Spec/B6x_BLE芯片使用指南_V1.0.0.docx new file mode 100644 index 0000000..e25c1d7 Binary files /dev/null and b/doc/SW_Spec/B6x_BLE芯片使用指南_V1.0.0.docx differ diff --git a/doc/SW_Spec/B6x_IO_MAP.xlsx b/doc/SW_Spec/B6x_IO_MAP.xlsx new file mode 100644 index 0000000..6599af5 Binary files /dev/null and b/doc/SW_Spec/B6x_IO_MAP.xlsx differ diff --git a/doc/SW_Spec/JFlash配置说明.docx b/doc/SW_Spec/JFlash配置说明.docx new file mode 100644 index 0000000..ab73a7f Binary files /dev/null and b/doc/SW_Spec/JFlash配置说明.docx differ diff --git a/drivers/api/btmr.h b/drivers/api/btmr.h new file mode 100644 index 0000000..0de42ca --- /dev/null +++ b/drivers/api/btmr.h @@ -0,0 +1,27 @@ +#ifndef _BTMR_H_ +#define _BTMR_H_ + + +#include "reg_btmr.h" + + +#define TIME_OUT_FLAG (BTMR->RIF) +#define CLR_UI_FLAG() do { BTMR->ICR = 1; } while (0) + +// timeout = arr * 10us +void timeOutMsInit(uint16_t arr); + + +//void btmrConfig(void); + +//void bootDelayUs(uint32_t us); + +//void bootDelayMs(uint32_t ms); +//void btmr_delay(uint16_t tpsc, uint16_t tcnt); +void tick_delay(uint16_t tpsc, uint16_t tcnt); +#include "rom.h" +#define btmrConfig() +#define bootDelayMs(time) btmr_delay(16000, time) + + +#endif diff --git a/drivers/api/core.h b/drivers/api/core.h new file mode 100644 index 0000000..dcad6c6 --- /dev/null +++ b/drivers/api/core.h @@ -0,0 +1,243 @@ +/** + **************************************************************************************** + * + * @file core.h + * + * @brief Header file - Core State and Mode Configuration Driver + * + **************************************************************************************** + */ + +#ifndef _CORE_H_ +#define _CORE_H_ + +#include + +/* + * DEFINES + **************************************************************************************** + */ + +/// Bits field of Reset Source/Reason +enum rst_src_bfs +{ + // Reset Reason + RSN_POR12_BK_BIT = (1 << 0), + RSN_LVD33_OUT_RST_BIT = (1 << 1), + RSN_BOD12_OUT_RST_BIT = (1 << 2), + RSN_PIN_RSTN_BIT = (1 << 3), + RSN_POR12_CORE_BIT = (1 << 4), + RSN_IWDTRST_BIT = (1 << 5), + RSN_CHIPRST_BIT = (1 << 6), + RSN_SYSRST_BIT = (1 << 7), + + // Wakeup Source from poweroff state + RSN_IO_WKUP_BIT = (1 << 8), + RSN_BLE_WKUP_BIT = (1 << 9), + RSN_RTC_WKUP_BIT = (1 << 10), + RSN_INT_WKUP_BIT = (1 << 11), +}; + +/// Exit poweroff via BLE Wakeup +#define RSN_IS_BLE_WKUP(rsn) (((rsn) & (RSN_BLE_WKUP_BIT | RSN_POR12_CORE_BIT)) == (RSN_BLE_WKUP_BIT | RSN_POR12_CORE_BIT)) + +/// clock stable time for exit from deepsleep +#define CFG_PMU_CLK_STB(time) ((time) << APBMISC_CLK_STB_TIME_LSB) +/// default value for pmu contrl +#define CFG_PMU_DFLT_CNTL (CFG_PMU_CLK_STB(0x3F)) + +/// Bits field of Wakeup Control +enum wkup_ctrl_bfs +{ + // BLE SEL - bit[1:0] (deepsleep or poweroff) + WKUP_BLE_SEL_LSB = 0, + WKUP_BLE_SEL_MSK = (0x03 << WKUP_BLE_SEL_LSB), + + // BLE LATCH_N - bit2 (only poweroff) + WKUP_BLE_LATCH_N_POS = 2, + WKUP_BLE_LATCH_N_BIT = (1 << WKUP_BLE_LATCH_N_POS), + + // Wakeup IO EN - bit3 (deepsleep or poweroff) + WKUP_IO_EN_POS = 3, + WKUP_IO_EN_BIT = (1 << WKUP_IO_EN_POS), + + // RTC EN - bit4 (deepsleep or poweroff) + WKUP_RTC_EN_POS = 4, + WKUP_RTC_EN_BIT = (1 << WKUP_RTC_EN_POS), + + // IO LATCH_N - bit5 (only poweroff) + WKUP_IO_LATCH_N_POS = 5, + WKUP_IO_LATCH_N_BIT = (1 << WKUP_IO_LATCH_N_POS), +}; + +#define CFG_WKUP_PWROFF_MSK (0x1B) +#define CFG_WKUP_DEEPSL_MSK (0x1B) + +/// Bits field of Wakeup Status +enum wkup_st_bfs +{ + // IO_WKUP_ST - bit0 (deepsleep or poweroff) + WKUP_ST_IO_POS = 0, + WKUP_ST_IO_BIT = (1 << WKUP_ST_IO_POS), + + // BLE_WKUP_ST - bit1 (deepsleep or poweroff) + WKUP_ST_BLE_POS = 1, + WKUP_ST_BLE_BIT = (1 << WKUP_ST_BLE_POS), + + // RTC_WKUP_ST - bit2 (deepsleep or poweroff) + WKUP_ST_RTC_POS = 2, + WKUP_ST_RTC_BIT = (1 << WKUP_ST_RTC_POS), + + // AON_PMU_INT - bit3 (deepsleep or poweroff) + WKUP_ST_AON_POS = 3, + WKUP_ST_AON_BIT = (1 << WKUP_ST_AON_POS), + + // BOD12_OUT12_ST - bit8 (deepsleep or poweroff) + WKUP_ST_BOD12_POS = 8, + WKUP_ST_BOD12_BIT = (1 << WKUP_ST_BOD12_POS), + + // LVD33_OUT12_ST - bit9 (deepsleep or poweroff) + WKUP_ST_LVD33_POS = 9, + WKUP_ST_LVD33_BIT = (1 << WKUP_ST_LVD33_POS), +}; + +#define CFG_WKUP_ST_MSK (0x030F) +#define CFG_WKUP_ST_CLR_MSK (0xC00000) + +/// BLE as wakeup source +#define CFG_WKUP_BLE_EN (1 << WKUP_BLE_SEL_LSB) +/// RTC as wakeup source +#define CFG_WKUP_RTC_EN (WKUP_RTC_EN_BIT) +/// IO as wakeup source +#define CFG_WKUP_IO_EN (WKUP_IO_EN_BIT) + +/// Bits field of LDO Control +enum ldo_ctrl_bfs +{ + // BOD ctrl - bit[2:0], bit3, bit4 + LDO_BOD_TRIM_LSB = 0, + LDO_BOD_TRIM_MSK = (0x07 << LDO_BOD_TRIM_LSB), + LDO_BOD_EN_POS = 3, + LDO_BOD_EN_BIT = (1 << LDO_BOD_EN_POS), + LDO_BOD_RSTEN_POS = 4, + LDO_BOD_RSTEN_BIT = (1 << LDO_BOD_RSTEN_POS), + + // LDO12 ibsel - bit[9:5] + LDO_IBSEL_LSB = 5, + LDO_IBSEL_MSK = (0x1F << LDO_IBSEL_LSB), + + // LVD ctrl - bit10, bit[13:11], bit14 + LDO_LVD_EN_POS = 10, + LDO_LVD_EN_BIT = (1 << LDO_LVD_EN_POS), + LDO_LVD_SEL_LSB = 11, + LDO_LVD_SEL_MSK = (0x07 << LDO_LVD_SEL_LSB), + LDO_LVD_RSTEN_POS = 14, + LDO_LVD_RSTEN_BIT = (1 << LDO_LVD_RSTEN_POS), + + // ANA resv - bit[24:16] + LDO_ANA_RESV_LSB = 16, + LDO_ANA_RESV_MSK = (0x1FF << LDO_ANA_RESV_LSB), + + // MISC ctrl - bit[29:25] + LDO_TESTA_XO_POS = 25, + LDO_TESTA_XO_BIT = (1 << LDO_TESTA_XO_POS), + LDO_BOD_TESTEN_POS = 26, + LDO_BOD_TESTEN_BIT = (1 << LDO_BOD_TESTEN_POS), + LDO_BOD_INTEN_POS = 27, + LDO_BOD_INTEN_BIT = (1 << LDO_BOD_INTEN_POS), + LDO_LVD_INTEN_POS = 28, + LDO_LVD_INTEN_BIT = (1 << LDO_LVD_INTEN_POS), + LDO_VBK_TESTEN_POS = 29, + LDO_VBK_TESTEN_BIT = (1 << LDO_VBK_TESTEN_POS), + + // Mask for EN bits + LDO_BOD_ENB_MSK = (LDO_BOD_EN_BIT | LDO_BOD_RSTEN_BIT | LDO_BOD_INTEN_BIT), + LDO_LVD_ENB_MSK = (LDO_LVD_EN_BIT | LDO_LVD_RSTEN_BIT | LDO_LVD_INTEN_BIT), +}; + +#define CFG_BOD_TRIM(val) ((val) << LDO_BOD_TRIM_LSB) +#define CFG_BOD_EN(en, rst, irq) \ + (((en) << LDO_BOD_EN_POS) | ((rst) << LDO_BOD_RSTEN_POS) | ((irq) << LDO_BOD_INTEN_POS)) + +#define CFG_LVD_SEL(val) ((val) << LDO_LVD_SEL_LSB) +#define CFG_LVD_EN(en, rst, irq) \ + (((en) << LDO_LVD_EN_POS) | ((rst) << LDO_LVD_RSTEN_POS) | ((irq) << LDO_LVD_INTEN_POS)) + + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Get ldo register value. + * + * @param[in] ctrl PMU_ANA_CTRL[23:0] & ANAMISC_CTRL[29:24]. + **************************************************************************************** + */ +void core_ldoset(uint32_t ctrl); + +/** + **************************************************************************************** + * @brief Get ldo register value. + * + * @return value. PMU_ANA_CTRL[23:0] & ANAMISC_CTRL[29:24]. + **************************************************************************************** + */ +uint32_t core_ldoget(void); + +/** + **************************************************************************************** + * @brief Core Sleep Mode. + * + * @param[in] cfg_wkup Bits field of value @see enum wkup_ctrl_bfs. + * + * @return wake-up status @see wkup_st_bfs. + **************************************************************************************** + */ +uint16_t core_sleep(uint16_t cfg_wkup); + +/** + **************************************************************************************** + * @brief Set IO wake-up sleep or power off. + * + * @param[in] wkup_en IO that supports wake-up(one bit one io). + * @param[in] pad_pu IO that pull-up(one bit one io). + * + * @note pad_pu Corresponding bit 1:Falling edge wake-up, 0: Rising edge wake-up. + **************************************************************************************** + */ +void wakeup_io_sw(uint32_t wkup_en, uint32_t pad_pu); + +/** + **************************************************************************************** + * @brief Core Power Off Mode. + * + * @param[in] cfg_wkup Bits field of value @see enum wkup_ctrl_bfs. + * + * @note PA19 Restore PULL-UP and Input Enable. + **************************************************************************************** + */ +void core_pwroff(uint16_t cfg_wkup); + +/** + **************************************************************************************** + * @brief Release IO Latch. + **************************************************************************************** + */ +void core_release_io_latch(void); + +/** + **************************************************************************************** + * @brief Get IC 128bits Unique ID. + * + * @param[in] size Length of Unique ID Buffer. + * @param[out] unique_id Pointer of Unique ID buffer. + * + * @note size must be less than or equal to 16. + * @note IC Must have Flash. + **************************************************************************************** + */ +void core_unique_id(uint8_t size, uint8_t *unique_id); +#endif // _CORE_H_ diff --git a/drivers/api/dma.h b/drivers/api/dma.h new file mode 100644 index 0000000..d5f423b --- /dev/null +++ b/drivers/api/dma.h @@ -0,0 +1,428 @@ +/** + **************************************************************************************** + * + * @file dma.h + * + * @brief Header file - DMA Driver + * + **************************************************************************************** + */ + +#ifndef _DMA_H_ +#define _DMA_H_ + +#include +#include +#include "reg_dmachcfg.h" + +// warning: #61-D: integer operation result is out of range +#pragma diag_suppress 61 + + +/* + * DEFINES + **************************************************************************************** + */ + +/// DMA Channel Index +enum dma_channel +{ + // Channel primary(CH0 ~ MAX-1) + DMA_CH0 = 0, + DMA_CH1, + DMA_CH2, + DMA_CH3, + DMA_CH4, + DMA_CH5, + DMA_CH6, + DMA_CH7, + DMA_CH_MAX, + + // Channel alternate(CHx + MAX) + DMA_CH_ALT = DMA_CH_MAX, // 0x08 + DMA_CH0_ALT, + DMA_CH1_ALT, + DMA_CH2_ALT, + DMA_CH3_ALT, + DMA_CH4_ALT, + DMA_CH5_ALT, + DMA_CH6_ALT, + DMA_CH7_ALT, +}; + +/// DMA Peripheral Index +enum dma_peripheral +{ + DMA_PID_UART1_RX = 0, + DMA_PID_UART1_TX = 1, + DMA_PID_UART2_RX = 2, + DMA_PID_UART2_TX = 3, + DMA_PID_SADC = 4, + DMA_PID_SPIM_TX = 5, + DMA_PID_SPIM_RX = 6, + DMA_PID_SPIS_TX = 7, + DMA_PID_SPIS_RX = 8, + DMA_PID_CTMR_CH1 = 9, + DMA_PID_CTMR_CH2 = 10, + DMA_PID_CTMR_CH3 = 11, + DMA_PID_CTMR_CH4 = 12, + DMA_PID_CTMR_TRIG = 13, + DMA_PID_CTMR_UP = 14, + DMA_PID_ATMR_CH1 = 15, + DMA_PID_ATMR_CH2 = 16, + DMA_PID_ATMR_CH3 = 17, + DMA_PID_ATMR_CH4 = 18, + DMA_PID_ATMR_TRIG = 19, + DMA_PID_ATMR_UP = 20, + DMA_PID_ATMR_COM = 21, + DMA_PID_BTMR_UP = 22, + DMA_PID_USB = 23, + DMA_PID_MDM_TX = 24, + DMA_PID_MDM_RX = 25, + DMA_PID_MAX, +}; + +/// DMA Pointer of Peripheral Address +enum dma_pointer +{ + DMA_PTR_UART1_RX = 0x40023000, // ((uint32_t)&UART1->RBR), + DMA_PTR_UART1_TX = 0x40023004, // ((uint32_t)&UART1->TBR), + DMA_PTR_UART2_RX = 0x40024000, // ((uint32_t)&UART2->RBR), + DMA_PTR_UART2_TX = 0x40024004, // ((uint32_t)&UART2->TBR), + DMA_PTR_SADC_AUX = 0x40007014, // ((uint32_t)&SADC->AUX_ST), + DMA_PTR_SADC_PCM = 0x40007018, // ((uint32_t)&SADC->PCM_DAT), + DMA_PTR_SPIM_RX = 0x40004000, // ((uint32_t)&SPIM->RX_DATA), + DMA_PTR_SPIM_TX = 0x40004004, // ((uint32_t)&SPIM->TX_DATA), + DMA_PTR_SPIS_TX = 0x4000500C, // ((uint32_t)&SPIS->TX_DAT), + DMA_PTR_SPIS_RX = 0x40005010, // ((uint32_t)&SPIS->RX_DAT), + DMA_PTR_CTMR_CH1 = 0x40021044, // ((uint32_t)&CTMR->CCR1), + DMA_PTR_CTMR_CH2 = 0x40021048, // ((uint32_t)&CTMR->CCR2), + DMA_PTR_CTMR_CH3 = 0x4002104C, // ((uint32_t)&CTMR->CCR3), + DMA_PTR_CTMR_CH4 = 0x40021050, // ((uint32_t)&CTMR->CCR4), + DMA_PTR_CTMR_UP = 0x4002103C, // ((uint32_t)&CTMR->ARR), + DMA_PTR_ATMR_CH1 = 0x40022044, // ((uint32_t)&ATMR->CCR1), + DMA_PTR_ATMR_CH2 = 0x40022048, // ((uint32_t)&ATMR->CCR2), + DMA_PTR_ATMR_CH3 = 0x4002204C, // ((uint32_t)&ATMR->CCR3), + DMA_PTR_ATMR_CH4 = 0x40022050, // ((uint32_t)&ATMR->CCR4), + DMA_PTR_ATMR_UP = 0x4002203C, // ((uint32_t)&ATMR->ARR), + DMA_PTR_BTMR_UP = 0x4002003C, // ((uint32_t)&BTMR->ARR), + DMA_PTR_MDM_TX = 0x40009030, // ((uint32_t)&MDM->EXT_TX_DAT), + DMA_PTR_MDM_RX = 0x40009034, // ((uint32_t)&MDM->EXT_TX_DAT), +}; + +/// DMA State Machine +enum dma_state +{ + DMA_STA_IDLE = 0x0, // Idle + DMA_STA_RD_CTRL = 0x1, // Read control + DMA_STA_RD_SP = 0x2, // Read src pointer + DMA_STA_RD_DP = 0x3, // Read dst pointer + DMA_STA_RD_SRC = 0x4, // Read src data + DMA_STA_WR_DST = 0x5, // Write dst data + DMA_STA_WAIT_CLR = 0x6, // Wait request clear + DMA_STA_WR_CTRL = 0x7, // Write control + DMA_STA_STALLED = 0x8, // Stalled + DMA_STA_DONE = 0x9, // Done + DMA_STA_PER_SGTX = 0xA // Peripheral Scatter-Gather +}; + +/// DMA cycle ctrl mode +enum cycle_ctrl +{ + CCM_STOP = 0x0, + CCM_BASIC = 0x1, + CCM_AUTO_REQ = 0x2, + CCM_PING_PONG = 0x3, + CCM_MEM_SG = 0x4, + CCM_MEM_SG_ALT = 0x5, + CCM_PER_SG = 0x6, + CCM_PER_SG_ALT = 0x7, +}; + +/// DMA unit for data-size and addr-inc +enum unit_size +{ + IN_BYTE = 0x0, + IN_HALF = 0x1, + IN_WORD = 0x2, + IN_NONE = 0x3, +}; + +/// DMA channel control opcode +enum chnl_ctrl +{ + CHNL_DIS, // Disable + CHNL_EN, // Enable + CHNL_DONE, // Enable, Wait done +}; + +/// Bits field of DMA Transfers Configuration +enum dma_trans_bfs +{ + // DMA cycle ctrl mode - bit[2:0] + DMA_TRANS_CCMODE_LSB = 0, + DMA_TRANS_CCMODE_MSK = (0x07 << DMA_TRANS_CCMODE_LSB), + // DMA next useburst - bit3 + DMA_TRANS_NEXTUB_POS = 3, + DMA_TRANS_NEXTUB_BIT = (1 << DMA_TRANS_NEXTUB_POS), + // DMA transfers cycles(1~1024)-1 - bit[13:4] + DMA_TRANS_CYCLES_LSB = 4, + DMA_TRANS_CYCLES_MSK = (0x3FF << DMA_TRANS_CYCLES_LSB), + // DMA transfers can occur before rearbitrates - bit[17:14] + DMA_TRANS_RPOWER_LSB = 14, + DMA_TRANS_RPOWER_MSK = (0xF << DMA_TRANS_RPOWER_LSB), + + // DMA HPROT[3:1] when reads source data - bit[20:18] + DMA_TRANS_SRCPROT_LSB = 18, + DMA_TRANS_SRCPROT_MSK = (0x07 << DMA_TRANS_SRCPROT_LSB), + // DMA HPROT[3:1] when writes destination data - bit[23:21] + DMA_TRANS_DSTPROT_LSB = 21, + DMA_TRANS_DSTPROT_MSK = (0x07 << DMA_TRANS_DSTPROT_LSB), + + // DMA source data size - bit[25:24] + DMA_TRANS_SRCSIZE_LSB = 24, + DMA_TRANS_SRCSIZE_MSK = (0x03 << DMA_TRANS_SRCSIZE_LSB), + // DMA control source address increment - bit[27:26] + DMA_TRANS_SRCINC_LSB = 26, + DMA_TRANS_SRCINC_MSK = (0x03 << DMA_TRANS_SRCINC_LSB), + + // DMA destination data size, must same with source - bit[29:28] + DMA_TRANS_DSTSIZE_LSB = 28, + DMA_TRANS_DSTSIZE_MSK = (0x03 << DMA_TRANS_DSTSIZE_LSB), + // DMA control source address increment - bit[31:30] + DMA_TRANS_DSTINC_LSB = 30, + DMA_TRANS_DSTINC_MSK = (0x03 << DMA_TRANS_DSTINC_LSB), +}; + +/// DMA Transfer Configuration struct +typedef union +{ + struct + { + uint32_t CYCLE_CTRL : 3; // Operating mode of the DMA cycle + uint32_t NEXT_USEBURST : 1; // Next transfer use burst + uint32_t N_MINUS_1 : 10; // Total number of DMA transfers - 1 + uint32_t R_POWER : 4; // How many DMA transfers can occur before controller rearbitrates + uint32_t SRC_PROT_CTRL : 3; // Protect when controller reads the source data + uint32_t DST_PROT_CTRL : 3; // Protect when controller writes the destination data + uint32_t SRC_SIZE : 2; // Size of the source data, 0-byte 1-halfword 2-word + uint32_t SRC_INC : 2; // Source address increment + uint32_t DST_SIZE : 2; // Destination data size, must same with src_size + uint32_t DST_INC : 2; // Destination address increment + }; + uint32_t Word; +} DMA_TRANS_CFG_Typedef; + +/// DMA Channel control data element +typedef struct +{ + // Source data end pointer + uint32_t SRC_DATA_END_PTR; + // Destination data end pointer + uint32_t DST_DATA_END_PTR; + // Control data configuration + DMA_TRANS_CFG_Typedef TRANS_CFG_DATA; + // Configuration reserved for reload + DMA_TRANS_CFG_Typedef TRANS_CFG_RESV; +} DMA_CHNL_CTRL_Typedef; + +/// DMA Channel control data struct +typedef struct +{ + // Channel primary + DMA_CHNL_CTRL_Typedef PRI_CHNL[DMA_CH_MAX]; + // Channel alternate + DMA_CHNL_CTRL_Typedef ALT_CHNL[DMA_CH_MAX]; +} DMA_CHNL_CTRL_STRUCT_Typedef; + +/// Global DMA Channel control data base pointer +extern volatile DMA_CHNL_CTRL_STRUCT_Typedef dma_ctrl_base; + + +/* + * MACROS + **************************************************************************************** + */ + +/// transfers cycle control mode +#define TRANS_CCMODE(m) ((m) << DMA_TRANS_CCMODE_LSB) +/// transfers cycles(1~1024)-1 +#define TRANS_CYCLES(c) ((c) << DMA_TRANS_CYCLES_LSB) +/// transfers occur (before rearbitrates) = (1 << r), r>=10 means no arbitration occurs +#define TRANS_RPOWER(r) ((r) << DMA_TRANS_RPOWER_LSB) + +/// transfers state of HPROT[3:1]: b0-privileged, b1-bufferable, b2-cacheable +#define TRANS_SRCPROT(p) ((p) << DMA_TRANS_SRCPROT_LSB) +#define TRANS_DSTPROT(p) ((p) << DMA_TRANS_DSTPROT_LSB) + +/// transfers unit size: 0-byte, 1-halfword, 2-word +#define TRANS_UNIT(size) (((size) << DMA_TRANS_SRCSIZE_LSB) | ((size) << DMA_TRANS_DSTSIZE_LSB)) +/// transfers address increment: 0-byte, 1-halfword, 2-word, 3-no increment(address remains) +#define TRANS_SRCINC(inc) ((inc) << DMA_TRANS_SRCINC_LSB) +#define TRANS_DSTINC(inc) ((inc) << DMA_TRANS_DSTINC_LSB) + +/// transfers to read Peripheral(as SRC) +#define TRANS_PER_RD(ccm, len, size, inc) \ + (TRANS_CCMODE(ccm) | TRANS_CYCLES((len)-1) | TRANS_UNIT(size) | TRANS_SRCINC(IN_NONE) | TRANS_DSTINC(inc)) + +/// transfers to write Peripheral(as DST) +#define TRANS_PER_WR(ccm, len, size, inc) \ + (TRANS_CCMODE(ccm) | TRANS_CYCLES((len)-1) | TRANS_UNIT(size) | TRANS_SRCINC(inc) | TRANS_DSTINC(IN_NONE)) + +/// DMA Peripheral Configure +// UARTx RX/TX +#define DMA_UARTx_RX_INIT(chidx, x) dma_chnl_init(chidx, DMA_PID_UART##x##_RX) +#define DMA_UARTx_RX_CONF(chidx, x, buff, len, ccm) \ + dma_chnl_conf(chidx, DMA_PTR_UART##x##_RX, (uint32_t)&(buff)[(len)-1], TRANS_PER_RD(ccm, len, IN_BYTE, IN_BYTE)) + +#define DMA_UARTx_TX_INIT(chidx, x) dma_chnl_init(chidx, DMA_PID_UART##x##_TX) +#define DMA_UARTx_TX_CONF(chidx, x, buff, len, ccm) \ + dma_chnl_conf(chidx, (uint32_t)&(buff)[(len)-1], DMA_PTR_UART##x##_TX, TRANS_PER_WR(ccm, len, IN_BYTE, IN_BYTE)) + +// Common Timer CHx +#define DMA_CTMR_CHx_INIT(chidx, x) dma_chnl_init(chidx, DMA_PID_CTMR_CH##x) +#define DMA_CTMR_CHx_CONF(chidx, x, buff, len, ccm) \ + dma_chnl_conf(chidx, (uint32_t)&(buff)[(len)-1], DMA_PTR_CTMR_CH##x, TRANS_PER_WR(ccm, len, IN_WORD, IN_WORD)) +#define DMA_CTMR_IN_CHx_CONF(chidx, x, buff, len, ccm) \ + dma_chnl_conf(chidx, DMA_PTR_CTMR_CH##x, (uint32_t)&(buff)[(len)-1], TRANS_PER_RD(ccm, len, IN_WORD, IN_WORD)) + +// Advance Timer CHx +#define DMA_ATMR_CHx_INIT(chidx, x) dma_chnl_init(chidx, DMA_PID_ATMR_CH##x) +#define DMA_ATMR_CHx_CONF(chidx, x, buff, len, ccm) \ + dma_chnl_conf(chidx, (uint32_t)&(buff)[(len)-1], DMA_PTR_ATMR_CH##x, TRANS_PER_WR(ccm, len, IN_WORD, IN_WORD)) + +// SPI Master Role +#define DMA_SPIM_TX_INIT(chidx) dma_chnl_init(chidx, DMA_PID_SPIM_TX) +#define DMA_SPIM_TX_CONF(chidx, buff, len, ccm) \ + dma_chnl_conf(chidx, (uint32_t)&(buff)[(len)-1], DMA_PTR_SPIM_TX, TRANS_PER_WR(ccm, len, IN_BYTE, IN_BYTE)) + +#define DMA_SPIM_RX_INIT(chidx) dma_chnl_init(chidx, DMA_PID_SPIM_RX) +#define DMA_SPIM_RX_CONF(chidx, buff, len, ccm) \ + dma_chnl_conf(chidx, DMA_PTR_SPIM_RX, (uint32_t)&(buff)[(len)-1], TRANS_PER_RD(ccm, len, IN_BYTE, IN_BYTE)) + +// SPI Slave Role +#define DMA_SPIS_TX_INIT(chidx) dma_chnl_init(chidx, DMA_PID_SPIS_TX) +#define DMA_SPIS_TX_CONF(chidx, buff, len, ccm) \ + dma_chnl_conf(chidx, (uint32_t)&(buff)[(len)-1], DMA_PTR_SPIS_TX, TRANS_PER_WR(ccm, len, IN_BYTE, IN_BYTE)) + +#define DMA_SPIS_RX_INIT(chidx) dma_chnl_init(chidx, DMA_PID_SPIS_RX) +#define DMA_SPIS_RX_CONF(chidx, buff, len, ccm) \ + dma_chnl_conf(chidx, DMA_PTR_SPIS_RX, (uint32_t)&(buff)[(len)-1], TRANS_PER_RD(ccm, len, IN_BYTE, IN_BYTE)) + +// SADC Aux or PCM +#define DMA_SADC_INIT(chidx) dma_chnl_init(chidx, DMA_PID_SADC) +#define DMA_SADC_AUX_CONF(chidx, buff, len, ccm) \ + dma_chnl_conf(chidx, DMA_PTR_SADC_AUX, (uint32_t)&(buff)[(len)-1], TRANS_PER_RD(ccm, len, IN_HALF, IN_HALF)) +#define DMA_SADC_PCM_CONF(chidx, buff, len, ccm) \ + dma_chnl_conf(chidx, DMA_PTR_SADC_PCM, (uint32_t)&(buff)[(len)-1], TRANS_PER_RD(ccm, len, IN_HALF, IN_HALF)) + +// MDM Ext Data +#define DMA_MDM_TX_INIT(chidx) dma_chnl_init(chidx, DMA_PID_MDM_TX) +#define DMA_MDM_TX_CONF(chidx, buff, len, ccm) \ + dma_chnl_conf(chidx, (uint32_t)&(buff)[(len)-1], DMA_PTR_MDM_TX, TRANS_PER_WR(ccm, len, IN_BYTE, IN_BYTE)) + +#define DMA_MDM_RX_INIT(chidx) dma_chnl_init(chidx, DMA_PID_MDM_RX) +#define DMA_MDM_RX_CONF(chidx, buff, len, ccm) \ + dma_chnl_conf(chidx, DMA_PTR_MDM_RX, (uint32_t)&(buff)[(len)-1], TRANS_PER_RD(ccm, len, IN_BYTE, IN_BYTE)) + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Init DMA Module + * + **************************************************************************************** + */ +void dma_init(void); + +/** + **************************************************************************************** + * @brief Deinit DMA Module + * + **************************************************************************************** + */ +void dma_deinit(void); + +/** + **************************************************************************************** + * @brief Init DMA Channel + * + * @param[in] chidx Channel index @see enum dma_channel, *only primary part* + * @param[in] chsel Selected peripheral @see enum dma_peripheral + * + **************************************************************************************** + */ +void dma_chnl_init(uint8_t chidx, uint8_t chsel); + +/** + **************************************************************************************** + * @brief Deinit DMA Channel + * + * @param[in] chidx Channel index @see enum dma_channel, *only primary part* + * + **************************************************************************************** + */ +void dma_chnl_deinit(uint8_t chidx); + +/** + **************************************************************************************** + * @brief Configure DMA Channel Control, then enable + * + * @param[in] chidx Channel index @see enum dma_channel, *incl alternate part* + * @param[in] src_ep Source data end pointer address, eg. (uint32_t)&buff[len-1] + * @param[in] dst_ep Destination data end pointer address + * @param[in] trans Transfer control value @see enum dma_trans_bfs or DMA_TRANS_CFG_Typedef + * + **************************************************************************************** + */ +void dma_chnl_conf(uint8_t chidx, uint32_t src_ep, uint32_t dst_ep, uint32_t trans); + +/** + **************************************************************************************** + * @brief Reload tansfer control value that configured via dma_chnl_conf(), continue run. + * + * @param[in] chidx Channel index @see enum dma_channel, *only primary part* + * + * @return 'true' means auto turned to alt-channel *only ping-pong mode* + **************************************************************************************** + */ +bool dma_chnl_reload(uint8_t chidx); + +/** + **************************************************************************************** + * @brief Read DMA Channel remain cycles + * + * @param[in] chidx Channel index @see enum dma_channel, *incl alternate part* + * + * @return Cycles of wait transfer, 0 means done + **************************************************************************************** + */ +uint16_t dma_chnl_remain(uint8_t chidx); + +/** + **************************************************************************************** + * @brief Enable or disable DMA Channel after configured. + * + * @param[in] chidx Channel index @see enum dma_channel, *only primary part* + * @param[in] ctrl Control opcode @see enum chnl_ctrl + * + **************************************************************************************** + */ +void dma_chnl_ctrl(uint8_t chidx, uint8_t ctrl); + +/** + **************************************************************************************** + * @brief Read DMA Channel done state, auto clear if be done. + * + * @param[in] chidx Channel index @see enum dma_channel, *only primary part* + * + * @return done state, true means done + **************************************************************************************** + */ +bool dma_chnl_done(uint8_t chidx); + + +#endif// _DMA_H_ diff --git a/drivers/api/drvs.h b/drivers/api/drvs.h new file mode 100644 index 0000000..812191f --- /dev/null +++ b/drivers/api/drvs.h @@ -0,0 +1,94 @@ +/** + **************************************************************************************** + * + * @file drvs.h + * + * @brief Header file - B6x drivers wrapper + * + **************************************************************************************** + */ + +#ifndef _DRVS_H_ +#define _DRVS_H_ + +/* + * This macro is for use by other macros to form a fully valid C statement. + * Without this, the if/else conditionals could show unexpected behavior. + * (The while condition below evaluates false without generating a + * constant-controlling-loop type of warning on most compilers.) + */ +#if !defined(dowl) + #define dowl(x) do { x } while(__LINE__ == -1) +#endif + +#if !defined(BIT) + #define BIT(n) (1UL << (n)) +#endif + +#include +#include +#include +#include "string.h" + +#include "b6x.h" +#include "rom.h" + +#include "core.h" +#include "dma.h" +#include "exti.h" +#include "fshc.h" +#include "flash.h" +#include "gpio.h" +#include "i2c.h" +#include "iopad.h" +#include "iwdt.h" +#include "pwm.h" +#include "rcc.h" +#include "rtc.h" +#include "rco.h" +#include "sadc.h" +#include "spi.h" +#include "timer.h" +#include "trim.h" +#include "uart.h" + +// Alter system clock(@see sys_clk_sel 0:16M 1:32M 2:48M 3:64M) +#if (SYS_CLK) +#define SYS_CLK_ALTER() rcc_sysclk_set(SYS_CLK) +#if (SYS_CLK == 1) +#define SYS_GET_CLOCK() (32000000) +#elif (SYS_CLK == 2) +#define SYS_GET_CLOCK() (48000000) +#else +#define SYS_GET_CLOCK() (64000000) +#endif +#else +#define SYS_CLK_ALTER() +#define SYS_GET_CLOCK() (16000000) +#endif + +// RC32K Init with Calibration +// rc32k_conf(RCLK_HSE, 0x1F); // 14ms +// rc32k_conf(RCLK_DPLL, 7); // 3.7ms +// rc32k_conf(RCLK_DPLL128, 3); // 1.8ms +#if !defined(rc32k_init) +#define rc32k_init() dowl(rc32k_conf(RCLK_DPLL, 7); rc32k_calib();) +#endif + +#ifndef __SRAMFN +#define __SRAMFN __attribute__((section("ram_func"))) +#endif + +#ifndef __ATTR_SRAM +#define __ATTR_SRAM __attribute__((section("ram_func"))) +#endif + +#ifndef __DATA_ALIGNED +#define __DATA_ALIGNED(n) __attribute__((aligned (n))) +#endif + +#ifndef __RETENTION +#define __RETENTION __attribute__((section("user_retention"), zero_init)) +#endif + +#endif // _DRVS_H_ diff --git a/drivers/api/exti.h b/drivers/api/exti.h new file mode 100644 index 0000000..e5762d0 --- /dev/null +++ b/drivers/api/exti.h @@ -0,0 +1,84 @@ +/** + **************************************************************************************** + * + * @file exti.h + * + * @brief Header file - EXTI Driver + * + **************************************************************************************** + */ + +#ifndef _EXTI_H_ +#define _EXTI_H_ + +#include +#include "reg_exti.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Debounce for EXTI: 'psc'(prescaler 0~255 clk cycles) * 'cnt'(count 0~7) +#define EXTI_DBC(psc, cnt) (((psc) << 8) | (cnt)) + +/// SourceBit of EXTI: 'pa'(pad PA00~19) +#define EXTI_SRC(pa) (1UL << (pa)) + +/// Type of EXTI local src +enum exti_loca_typ +{ + EXTI_IER = 0, // w interrupt enable + EXTI_IDR = 1, // w interrupt disable + EXTI_IVS = 2, // r interrupt valid status + EXTI_RIF = 3, // r raw interrupt flag status + EXTI_IFM = 4, // r interrupt flag masked status + EXTI_ICR = 5, // w interrupt clear + EXTI_RTS = 6, // rw rising edge trigger selection + EXTI_FTS = 7, // rw falling edge trigger selection + EXTI_SWI = 8, // rw software interrupt event + EXTI_ADTE = 9, // rw ad trigger enable + EXTI_DBE = 10, // rw input debounce enable +}; + + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Init EXTI, enable clk and rst, config debounce + * + * @param[in] dbc debounce for IO, @see EXTI_DBC(psc, cnt) + * + **************************************************************************************** + */ +void exti_init(uint16_t dbc); + +/** + **************************************************************************************** + * @brief Enable Bits Field of BUS Register + * + * @param[in] typ Type of local src @see enum exti_loca_typ + * @param[in] loca Value Bits of local src @see EXTI_SRC(pa) + * + **************************************************************************************** + */ +void exti_set(uint8_t typ, uint32_t loca); + +/** + **************************************************************************************** + * @brief Get EXTI local src value + * + * @param[in] typ Type of local src @see enum exti_loca_typ + * + * @return local src value + **************************************************************************************** + */ +uint32_t exti_get(uint8_t typ); + + +#endif diff --git a/drivers/api/flash.h b/drivers/api/flash.h new file mode 100644 index 0000000..76ecc7b --- /dev/null +++ b/drivers/api/flash.h @@ -0,0 +1,194 @@ +/** + **************************************************************************************** + * + * @file flash.h + * + * @brief Header file - Flash API + * + **************************************************************************************** + */ + +#ifndef _FLASH_H_ +#define _FLASH_H_ + +#include + +/* + * DEFINES + **************************************************************************************** + */ + +enum flash_vendor_id +{ + FSH_VID_PUYA = 0x85, + FSH_VID_WINBOND = 0xEF, + FSH_VID_GD = 0xC8, + FSH_VID_FUDAN = 0xA1, + FSH_VID_SPANSION = 0x01, + FSH_VID_ZBITSEMI = 0x5E, + FSH_VID_XMC = 0x20, + FSH_VID_BOYA = 0x68, +}; + +enum flash_cmd_code +{ + // Reset opcode + FSH_CMD_RST_EN = 0x66, + FSH_CMD_RESET = 0x99, + + // Read flash id + FSH_CMD_RD_ID = 0x9F, + + // State opcode + FSH_CMD_WR_STA_EN = 0x50, + FSH_CMD_WR_STA = 0x01, + FSH_CMD_WR_STA1 = 0x31, // Boya Flash + FSH_CMD_RD_STA0 = 0x05, + FSH_CMD_RD_STA1 = 0x35, + + // Erase opcode + FSH_CMD_ER_CHIP = 0x60, + FSH_CMD_ER_SECTOR = 0x20, + FSH_CMD_ER_PAGE = 0x81, + + // Write opcode + FSH_CMD_WR_EN = 0x06, + FSH_CMD_WR = 0x02, + FSH_CMD_DLWR = 0xA2, + FSH_CMD_QDWR = 0x32, + + // Read opcode + FSH_CMD_RD = 0x03, + FSH_CMD_DLRD = 0x3B, + FSH_CMD_QDRD = 0x6B, + + // HPM opcode + FSH_CMD_DLRD_HMP = 0xBB, + FSH_CMD_QDRD_HMP = 0xEB, + FSH_CMD_EXIT_HMP = 0xFF, + + // Security Region opcode + FSH_CMD_WR_OTP = 0x42, + FSH_CMD_ER_OTP = 0x44, + FSH_CMD_RD_OTP = 0x48, + + // Suspend/Resume when in erase & write + FSH_CMD_SUSPEND = 0x75, + FSH_CMD_RESUME = 0x7A, +}; + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Read flash id. + * + * @return FlashID - 3 octets + **************************************************************************************** + */ +#define flashReadId() \ + fshc_rd_sta(FSH_CMD_RD_ID, 3) + +/** + **************************************************************************************** + * @brief Read Flash Status Register. + * + * @param[in] cmd Flash Read Status Command(FSH_CMD_RD_STA0, FSH_CMD_RD_STA1). + * + * @return Flash Status Register Value - 1 octets + **************************************************************************************** + */ +#define flashReadSta(cmd) fshc_rd_sta(cmd, 1) + +/** + **************************************************************************************** + * @brief Puya Flash Enter Dual Read Mode(2 X IO Read Mod). + **************************************************************************************** + */ +void puya_enter_dual_read(void); + +/** + **************************************************************************************** + * @brief Puya Flash Exti Dual Read Mode. + **************************************************************************************** + */ +void puya_exit_dual_read(void); + +/** + **************************************************************************************** + * @brief Boya Flash Quad Enable bit set 1. + **************************************************************************************** + */ +void boya_flash_quad_mode(void); + +/** + **************************************************************************************** + * @brief Write data to Flash. + * + * @param[in] offset Where offset to write. + * @param[in] data The pointer of data write to flash. + * @param[in] wlen The number of word write to flash. + * + * @note offset Must be 0x100 Aligned. + * @note data address Must be 4-byte Aligned. + * @note if hpm, must exit_hpm. + **************************************************************************************** + */ +void flash_write(uint32_t offset, uint32_t *data, uint32_t wlen); + +/** + **************************************************************************************** + * @brief Read Flash data. + * + * @param[in] offset Where offset to read. + * @param[in] buff The pointer that store data read from flash. + * @param[in] wlen The number of word read from flash. + * + * @note buff address Must be 4-byte Aligned. + * @note if hpm, must exit_hpm. + **************************************************************************************** + */ +void flash_read(uint32_t offset, uint32_t *buff, uint32_t wlen); + +/** + **************************************************************************************** + * @brief Erases the specified FLASH page. + * + * @param[in] offset address of the page to erase. + * + * @note offset Must be 0x100 Aligned. + * @note if hpm, must exit_hpm. + **************************************************************************************** + */ +void flash_page_erase(uint32_t offset); + +/** + **************************************************************************************** + * @brief Write data to Flash. + * + * @param[in] offset Where offset to write. + * @param[in] data The pointer of data write to flash. + * @param[in] blen The number of byte write to flash.(Must be a multiple of 4) + * + * @note offset Must be 0x100 Aligned. + * @note if hpm, must exit_hpm. + **************************************************************************************** + */ +void flash_byte_write(uint32_t offset, uint8_t *data, uint32_t blen); + +/** + **************************************************************************************** + * @brief Read Flash data. + * + * @param[in] offset Where offset to read. + * @param[in] buff The pointer that store data read from flash. + * @param[in] blen The number of byte read from flash. + * + * @note if hpm, must exit_hpm. + **************************************************************************************** + */ +void flash_byte_read(uint32_t offset, uint8_t *buff, uint32_t blen); +#endif //_FLASH_H_ diff --git a/drivers/api/fshc.h b/drivers/api/fshc.h new file mode 100644 index 0000000..42d5e72 --- /dev/null +++ b/drivers/api/fshc.h @@ -0,0 +1,345 @@ +/** + **************************************************************************************** + * + * @file fshc.h + * + * @brief Header file - Flash Controlor(FSHC) Driver + * + **************************************************************************************** + */ + +#ifndef _FSHC_H_ +#define _FSHC_H_ + +#include +#include + + +/* + * DEFINES + **************************************************************************************** + */ + + +typedef uint32_t flen_t; // uint16->32 reduce size 6vp 1118 + +enum cache_region_size +{ + CACHE_RS1K = 0x09, + CACHE_RS2K = 0x0A, + CACHE_RS4K = 0x0B, + CACHE_RS8K = 0x0C, + CACHE_RS16K = 0x0D, + CACHE_RS32K = 0x0E, + CACHE_RS64K = 0x0F, + CACHE_RS128K = 0x10, + CACHE_RS256K = 0x11, + CACHE_RS512K = 0x12, +}; + +enum bit_num_mode +{ + // 0/1: 1 bit spi mode + SPI_MODE = 1, + // 2: 2bits dual mode + DUAL_MODE = 2, + // 3: 4bits quad mode + QUAD_MODE = 3, +}; + +/// Bits field of Cmd and Mode +enum fshc_cmd_mode +{ + // Command Code - bit[7:0] + FCM_CMD_LSB = 0, + FCM_CMD_MSK = 0xFF << FCM_CMD_LSB, + + // Line BitMode - bit[9:8] + FCM_MODE_LSB = 8, + FCM_MODE_MSK = 0x03 << FCM_MODE_LSB, + + // Special Bits - bit[11:10] + // OTP read or write + FCM_RWOTP_BIT = 1 << 10, + // erase chip + FCM_ERCHIP_BIT = 1 << 11, + + // R&W FIFO Type - bit[15:12] + // pkt fill: 1 - next fragment, 0 - first of send-en + FCM_NEXTPKT_BIT = 1 << 12, + // multi-packet transmisson mode + FCM_PACKETS_BIT = 1 << 13, + // not wait complete + FCM_NOTWAIT_BIT = 1 << 14, + // enable suspend mode + FCM_SUSPEND_BIT = 1 << 15, +}; + +// BitMode, default SPI_MODE +#define FCM_MODE_DUAL (DUAL_MODE << FCM_MODE_LSB) +#define FCM_MODE_QUAD (QUAD_MODE << FCM_MODE_LSB) + +// R&W FIFO Type +#define FCM_TYPE_BLOCKING (0) +#define FCM_TYPE_NOTWAIT (FCM_NOTWAIT_BIT) +#define FCM_TYPE_SUSPEND (FCM_SUSPEND_BIT) +#define FCM_TYPE_PKTSTART (FCM_PACKETS_BIT | FCM_NOTWAIT_BIT) +#define FCM_TYPE_PKTNEXT (FCM_PACKETS_BIT | FCM_NEXTPKT_BIT) + +/// SBUS access flash send_ctrl register config + +enum addr_with_arg +{ + // 2'b00/2'b11: address followed by idle + IDLE_ADR_ARG = 0, + // 2'b01: address followed by wdata + SDAT_ADR_ARG = 1, + // 2'b10: address followed by rdata + RDAT_ADR_ARG = 2, +}; + +enum cmd_with_arg +{ + // 3'b011: command followed by address + SADR_CMD_ARG = 3, + // 3'b101: command followed by wdata + SDAT_CMD_ARG = 5, + // 3'b110: command followed by rdata + RDAT_CMD_ARG = 6, + // others: command followed by idle + IDLE_CMD_ARG = 0, +}; + +enum send_ctrl_bfs +{ + // bit[1:0] - MCU transmit data bit number (@see enum bit_num_mode) + SCTRL_DATA_BIT_MODE_LSB = 0, + SCTRL_DATA_BIT_MODE_MSK = (0x03 << SCTRL_DATA_BIT_MODE_LSB), + // bit[3:2] - MCU transmit address bit number (@see enum bit_num_mode) + SCTRL_ADDR_BIT_MODE_LSB = 2, + SCTRL_ADDR_BIT_MODE_MSK = (0x03 << SCTRL_ADDR_BIT_MODE_LSB), + // bit[5:4] - MCU transmit command bit number (most support only 1bit, eg. GD) + SCTRL_CMD_BIT_MODE_LSB = 4, + SCTRL_CMD_BIT_MODE_MSK = (0x03 << SCTRL_CMD_BIT_MODE_LSB), + // bit[7:6] - MCU address argument (@see enum addr_with_arg) + SCTRL_ADDR_WITH_ARG_LSB = 6, + SCTRL_ADDR_WITH_ARG_MSK = (0x03 << SCTRL_ADDR_WITH_ARG_LSB), + // bit[10:8]- MCU command argument (@see enum cmd_with_arg) + SCTRL_CMD_WITH_ARG_LSB = 8, + SCTRL_CMD_WITH_ARG_MSK = (0x07 << SCTRL_CMD_WITH_ARG_LSB), +}; + +#define SEND_CTRL_CONF(datmode, adrmode, cmdarg, adrarg) \ + ( ((datmode) << SCTRL_DATA_BIT_MODE_LSB) | ((adrmode) << SCTRL_ADDR_BIT_MODE_LSB) \ + | (SPI_MODE << SCTRL_CMD_BIT_MODE_LSB) /* command be mostly 1bit mode */ \ + | ((cmdarg) << SCTRL_CMD_WITH_ARG_LSB) | ((adrarg) << SCTRL_ADDR_WITH_ARG_LSB) ) + +// command sent with address for READ, expect receive data. +#define SCTRL_RD_DAT(datmode) SEND_CTRL_CONF(datmode, SPI_MODE, SADR_CMD_ARG, RDAT_ADR_ARG) +// command sent with address and data for WRITE. +#define SCTRL_WR_DAT(datmode) SEND_CTRL_CONF(datmode, SPI_MODE, SADR_CMD_ARG, SDAT_ADR_ARG) + +// SBUS control conf +enum sbus_ctrl_cfg +{ + // command sent without arguments for ENABLE Only. + SCTRL_EN_CMD = SEND_CTRL_CONF(SPI_MODE, SPI_MODE, IDLE_CMD_ARG, IDLE_ADR_ARG), + // command sent without arguments for READ, expect receive state value(l~4Bytes). + SCTRL_RD_STA = SEND_CTRL_CONF(SPI_MODE, SPI_MODE, RDAT_CMD_ARG, IDLE_ADR_ARG), + // command sent with state value(l~4Bytes) for WRITE. + SCTRL_WR_STA = SEND_CTRL_CONF(SPI_MODE, SPI_MODE, SDAT_CMD_ARG, IDLE_ADR_ARG), + // command sent without arguments for ERASE chip all. + SCTRL_ER_CHIP = SEND_CTRL_CONF(SPI_MODE, SPI_MODE, IDLE_CMD_ARG, IDLE_ADR_ARG), + // commnad sent with address for ERASE page/sector/bank part. + SCTRL_ER_PART = SEND_CTRL_CONF(SPI_MODE, SPI_MODE, SADR_CMD_ARG, IDLE_ADR_ARG), + // Read & Write date command in special mode. + SCTRL_SIRD_DAT = SCTRL_RD_DAT(SPI_MODE), + SCTRL_SIWR_DAT = SCTRL_WR_DAT(SPI_MODE), + SCTRL_DLRD_DAT = SCTRL_RD_DAT(DUAL_MODE), + SCTRL_DLWR_DAT = SCTRL_WR_DAT(DUAL_MODE), + SCTRL_QDRD_DAT = SCTRL_RD_DAT(QUAD_MODE), + SCTRL_QDWR_DAT = SCTRL_WR_DAT(QUAD_MODE), +}; + +enum adrcmd_bitlen_bfs +{ + // bit[5:0] --- MCU adr cycle length,include dummy cycle, only 24 bit is valid + ACBIT_ADR_LEN_LSB = 0, + ACBIT_ADR_LEN_MSK = 0x1F << ACBIT_ADR_LEN_LSB, + // bit[11:6] --- MCU cmd cycle length,include dummy cycle, only 8 bit is vaild, + ACBIT_CMD_LEN_LSB = 6, + ACBIT_CMD_LEN_MSK = 0x1F << ACBIT_CMD_LEN_LSB, +}; + +#define ACBIT_ADR_LEN(len) ((len) << ACBIT_ADR_LEN_LSB) +#define ACBIT_CMD_LEN(len) ((len) << ACBIT_CMD_LEN_LSB) + +enum acbit_len_cfg +{ + // 0x1C0 bit: cmd=8-1, adr=0 + ACBIT_SI_IDLE = ACBIT_CMD_LEN(7) | ACBIT_ADR_LEN(0x00), + // 0x1D7 bit: cmd=8-1, adr=24-1, 0dumy=0 + ACBIT_SI_0DUMY = ACBIT_CMD_LEN(7) | ACBIT_ADR_LEN(0x17), + // 0x1DF bit: cmd=8-1, adr=24-1, 1dumy=8 + ACBIT_SI_1DUMY = ACBIT_CMD_LEN(7) | ACBIT_ADR_LEN(0x1F), + // 0x1CF bit: cmd=8-1, adr=24/2-1, 1dumy=4 + ACBIT_DL_1DUMY = ACBIT_CMD_LEN(7) | ACBIT_ADR_LEN(0x0F), +}; + +// SBUS access dummy +enum sbus_dumy_cfg +{ + // adr23 + NDUMY + SBUS_SI_0DUMY = 0x17, + // adr23 + 8(1DUMY) + SBUS_SI_1DUMY = 0x1F, + // adr24/2 - 1 + 4(1DUMY) + SBUS_DL_1DUMY = 0xF, +}; + + +/// IBUS access flash(only support read data) fshc ctrl configure + +enum cmd_len_dumy +{ + // cmd(7) + dumy(0) + CLEN_0DUMY = 7, + // cmd(7) + dumy(8) + CLEN_1DUMY = 15, +}; + +enum delay_set_bfs +{ + // bit[5:0] --- hpm command length, default is 6'h1f, + DLYSET_HPM_CLEN_LSB = 0, + // bit[9:6] --- only use in qpi read cmd, default is 4'h7, + DLYSET_CMD_LEN_LSB = 6, + // bit[13:10]--- use in suspend/resume/exit_hpm cmd, default is 4'h7, + DLYSET_0DUMY_CLEN_LSB = 10, + // bit[15:14]--- CACHE transmit address bit number(@see enum bit_num_mode) + DLYSET_ADDR_BIT_MODE_LSB = 14, + // bit[17:16]--- CACHE transmit command bit number(@see enum bit_num_mode) + DLYSET_CMD_BIT_MODE_LSB = 16, + // bit[19:18]--- CACHE transmit data bit number(@see enum bit_num_mode) + DLYSET_DATA_BIT_MODE_LSB = 18, +}; + +#define IBUS_CTRL_CONF(adrmode, datmode, hlen) \ + ( ((adrmode) << DLYSET_ADDR_BIT_MODE_LSB) | (SPI_MODE << DLYSET_CMD_BIT_MODE_LSB) \ + | ((datmode) << DLYSET_DATA_BIT_MODE_LSB) | (CLEN_0DUMY << DLYSET_CMD_LEN_LSB) \ + | (CLEN_0DUMY << DLYSET_0DUMY_CLEN_LSB) | ((hlen) << DLYSET_HPM_CLEN_LSB) ) + +// IBUS control conf +enum ibus_ctrl_cfg +{ + // spi read data via IBUS + IBUS_SIRD_CFG = IBUS_CTRL_CONF(SPI_MODE, SPI_MODE, CLEN_0DUMY), + //dual read data via IBUS + IBUS_DLRD_CFG = IBUS_CTRL_CONF(SPI_MODE, DUAL_MODE, CLEN_0DUMY), + //quad read data via IBUS + IBUS_QDRD_CFG = IBUS_CTRL_CONF(SPI_MODE, QUAD_MODE, CLEN_0DUMY), + //dual hpm read data via IBUS + IBUS_DLRD_HPM = IBUS_CTRL_CONF(DUAL_MODE, DUAL_MODE, CLEN_1DUMY), + //quad hpm read data via IBUS + IBUS_QDRD_HPM = IBUS_CTRL_CONF(QUAD_MODE, QUAD_MODE, CLEN_1DUMY), +}; + +// IBUS access dummy +enum ibus_dumy_cfg +{ + IBUS_SI_0DUMY = 0x17, + IBUS_SI_1DUMY = 0x1F, + + IBUS_DL_1DUMY = 0xF, + IBUS_QD_1DUMY = 0xB, +}; + + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ + +#if (ROM_UNUSED) +/** + **************************************************************************************** + * @brief Send control/enable command without value + * + * @param[in] cmd Command opcode(eg. FSH_CMD_RST_EN FSH_CMD_RESET FSH_CMD_EXIT_HMP + * FSH_CMD_WR_EN FSH_CMD_WR_STA_EN) + * + **************************************************************************************** + */ +void fshc_en_cmd(uint8_t cmd); + +/** + **************************************************************************************** + * @brief Write value to flash state register + * + * @param[in] cmd Command opcode(eg. FSH_CMD_WR_STA) + * @param[in] len Length of value, range 1~4 Bytes + * @param[in] val State value, valid range 8/16/24/32bits by 'len' + * + **************************************************************************************** + */ +void fshc_wr_sta(uint8_t cmd, uint8_t len, uint32_t val); + +/** + **************************************************************************************** + * @brief Read value from flash state register + * + * @param[in] cmd Command opcode(eg. FSH_CMD_RD_ID FSH_CMD_RD_STA0 FSH_CMD_RD_STA1) + * @param[in] len Length of value, range 1~4 Bytes + * + * @return value State value, valid range 8/16/24/32bits by 'len' + **************************************************************************************** + */ +uint32_t fshc_rd_sta(uint8_t cmd, uint8_t len); + +/** + **************************************************************************************** + * @brief Perpare write data to flash + * + * @param[in] cmd fshc access cmd (example read cmd: 0x03) + * @param[in] offset access flash addr offset + * @param[in] len access flash data len, unit is byte + * @param[in] sctrl access flash mode config(example: spi mode, dual mode...) + * @param[in] acbit dummy cycle + * + **************************************************************************************** + */ +void fshc_wr_cfg(uint8_t cmd, uint32_t offset, flen_t len, uint16_t sctrl, uint16_t acbit); + +flen_t fshc_wr_fifo(const uint32_t *data, flen_t wlen, uint16_t fcmd); + +/** + **************************************************************************************** + * @brief Perpare read data from flash + * + * @param[in] cmd fshc access cmd (example read cmd: 0x03) + * @param[in] offset access flash addr offset + * @param[in] len access flash data len, unit is byte + * @param[in] sctrl access flash mode config(example: spi mode, dual mode...) + * @param[in] acbit dummy cycle + * + **************************************************************************************** + */ +void fshc_rd_cfg(uint8_t cmd, uint32_t offset, flen_t len, uint16_t sctrl, uint16_t acbit); + +flen_t fshc_rd_fifo(uint32_t *buff, flen_t wlen, uint16_t fcmd); + +void fshc_xip_conf(uint8_t rdCmd, uint8_t adrBits, uint32_t dlySet); + +void fshc_hpm_conf(bool en, uint8_t crIdx, uint8_t crCmd); + +void fshc_erase(uint32_t offset, uint16_t fcmd); + +flen_t fshc_read(uint32_t offset, uint32_t *buff, flen_t wlen, uint16_t fcmd); + +flen_t fshc_write(uint32_t offset, const uint32_t *data, flen_t wlen, uint16_t fcmd); + +void fshc_cache_conf(uint32_t base_addr); +void fshc_suspend_conf(uint8_t susCmd, uint8_t rsmCmd, uint16_t susTime, uint32_t rsmTime); +#endif + +#endif // _FSHC_H_ diff --git a/drivers/api/gfsk.h b/drivers/api/gfsk.h new file mode 100644 index 0000000..b6166d6 --- /dev/null +++ b/drivers/api/gfsk.h @@ -0,0 +1,11 @@ +#ifndef RF_GFSK_H_ +#define RF_GFSK_H_ + +#include + +void rf_gfsk_init(void); + +//tx_freq_mhz:2402 ~ 2480(step 2) +void rf_gfsk_tx_freq(uint16_t tx_freq_mhz); + +#endif // RF_GFSK_H_ diff --git a/drivers/api/gpio.h b/drivers/api/gpio.h new file mode 100644 index 0000000..4caf0c7 --- /dev/null +++ b/drivers/api/gpio.h @@ -0,0 +1,183 @@ +/** + **************************************************************************************** + * + * @file gpio.h + * + * @brief Header file - GPIO Driver + * + **************************************************************************************** + */ + +#ifndef _GPIO_H_ +#define _GPIO_H_ + +#include +#include "iopad.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +#if !defined(BIT) + #define BIT(n) (1UL << (n)) +#endif + +/// Index of gpio bits +enum gpio_bits +{ + GPIO00 = (1UL << PA00), + GPIO01 = (1UL << PA01), + GPIO02 = (1UL << PA02), + GPIO03 = (1UL << PA03), + GPIO04 = (1UL << PA04), + GPIO05 = (1UL << PA05), + GPIO06 = (1UL << PA06), + GPIO07 = (1UL << PA07), + GPIO08 = (1UL << PA08), + GPIO09 = (1UL << PA09), + GPIO10 = (1UL << PA10), + GPIO11 = (1UL << PA11), + GPIO12 = (1UL << PA12), + GPIO13 = (1UL << PA13), + GPIO14 = (1UL << PA14), + GPIO15 = (1UL << PA15), + GPIO16 = (1UL << PA16), + GPIO17 = (1UL << PA17), + GPIO18 = (1UL << PA18), + GPIO19 = (1UL << PA19), +}; + +/// Type of gpio output +enum gpio_out_typ +{ + OE_LOW = 0, + OE_HIGH = 1, +}; + +/// Type of gpio input +enum gpio_in_typ +{ + IE_AIR = IOM_INPUT, + IE_DOWN = IOM_INPUT | IOM_PULLDOWN, + IE_UP = IOM_INPUT | IOM_PULLUP, +}; + + +/* + * MACROS DECLARATION + **************************************************************************************** + */ + +#include "reg_gpio.h" + +/// Set gpio data to 1 (output High) - only write 1 effect +#define GPIO_DAT_SET(bits) ( GPIO->DAT_SET = (uint32_t)(bits) ) +/// Clear gpio data to 0 (output Low) - only write 1 effect +#define GPIO_DAT_CLR(bits) ( GPIO->DAT_CLR = (uint32_t)(bits) ) +/// Toggle gpio data (state overturn) - only write 1 effect +#define GPIO_DAT_TOG(bits) ( GPIO->DAT_TOG = (uint32_t)(bits) ) + +/// Mask gpio data operation - write 1: can't set/clear/toggle, 0: normal +#define GPIO_DAT_MSK(bits) ( GPIO->DAT_MSK = (uint32_t)(bits) ) +/// Get gpio data mask - Read 1: mask, 0: not mask +#define GPIO_DAT_MSK_GET() ( GPIO->DAT_MSK ) + +/// Set gpio data all config - write 1: High, 0: Low +#define GPIO_DAT_CFG(bits) ( GPIO->DAT = (uint32_t)(bits) ) +/// Get gpio data all config - Read 1: High, 0: Low +#define GPIO_DAT_GET() ( GPIO->DAT ) + +/// Set gpio dir to 1 (enable output) - only write 1 effect +#define GPIO_DIR_SET(bits) ( GPIO->DIR_SET = (uint32_t)(bits) ) +/// Clear gpio dir to 0 (disable output) - only write 1 effect +#define GPIO_DIR_CLR(bits) ( GPIO->DIR_CLR = (uint32_t)(bits) ) +/// Toggle gpio dir (state overturn) - only write 1 effect +#define GPIO_DIR_TOG(bits) ( GPIO->DIR_TOG = (uint32_t)(bits) ) + +/// Mask gpio dir operation - write 1: can't set/clear/toggle, 0: normal +#define GPIO_DIR_MSK(bits) ( GPIO->DIR_MSK = (uint32_t)(bits) ) +/// Get gpio dir mask - Read 1: mask, 0: not mask +#define GPIO_DIR_MSK_GET() ( GPIO->DIR_MSK ) + +/// Set gpio dir all config - write 1: Enable, 0: Disable +#define GPIO_DIR_CFG(bits) ( GPIO->DIR = (uint32_t)(bits) ) +/// Get gpio dir all config - Read 1: Enable, 0: Disable +#define GPIO_DIR_GET() ( GPIO->DIR ) + +/// Get gpio input state (1: High, 0: Low), enable via iom_ctrl() +#define GPIO_PIN_GET() ( GPIO->PIN ) + +/// gpio output enable, low level +#define GPIO_DIR_SET_LO(bits) dowl( GPIO_DAT_CLR(bits); GPIO_DIR_SET(bits); ) +/// gpio output enable, high level +#define GPIO_DIR_SET_HI(bits) dowl( GPIO_DAT_SET(bits); GPIO_DIR_SET(bits); ) + + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ + +static inline void gpio_set_hiz(uint8_t pad) +{ + // disable output & input + GPIO_DIR_CLR(1UL << pad); + iom_ctrl(pad, IOM_HIZ); +} + +static inline void gpio_dir_output(uint8_t pad, uint8_t oe) +{ + uint32_t bits = 1UL << pad; + + if (oe == OE_HIGH) + { + GPIO_DAT_SET(bits); + } + else + { + GPIO_DAT_CLR(bits); + } + + GPIO_DIR_SET(bits); +} + +static inline void gpio_put(uint8_t pad, uint8_t val) +{ + if (val == OE_HIGH) + { + GPIO_DAT_SET(1UL << pad); + } + else + { + GPIO_DAT_CLR(1UL << pad); + } +} + +static inline void gpio_put_hi(uint8_t pad) +{ + GPIO_DAT_SET(1UL << pad); +} + +static inline void gpio_put_lo(uint8_t pad) +{ + GPIO_DAT_CLR(1UL << pad); +} + +static inline void gpio_dir_input(uint8_t pad, uint16_t ie) +{ + iom_ctrl(pad, ie); +} + +static inline bool gpio_get(uint8_t pad) +{ + return ((GPIO_PIN_GET() >> pad) & 0x01); +} + +static inline uint32_t gpio_get_all(void) +{ + return GPIO_PIN_GET(); +} + +#endif diff --git a/drivers/api/i2c.h b/drivers/api/i2c.h new file mode 100644 index 0000000..ca550c3 --- /dev/null +++ b/drivers/api/i2c.h @@ -0,0 +1,251 @@ +/** + **************************************************************************************** + * + * @file i2c.h + * + * @brief Header file - I2C Driver + * + **************************************************************************************** + */ + +#ifndef _I2C_H_ +#define _I2C_H_ + +#include +#include "reg_i2c.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +/// master status->MS, slave status->SS, General Call Address->GCA, Arbitration lost->ARL +enum i2c_status_def +{ + I2C_MS_BUS_ERROR = 0x00, // Bus error (Master mode only) + I2C_MS_START_OK = 0x08, // Master: start signal + I2C_MS_RESTART_OK = 0x10, // Master: restart signal + I2C_MS_ADDR_W_ACK = 0x18, // Master: addr+write bit send, ACK received + I2C_MS_ADDR_W_NAK = 0x20, // Master: addr+write bit send, Not ACK received + I2C_MS_SEND_DAT_ACK = 0x28, // Master: send data, ACK received OK + I2C_MS_SEND_DAT_NAK = 0x30, // Master: send data, Not ACK received + I2C_MS_TRANS_FAIL = 0x38, // Master: Arbitration lost in address or data byte + I2C_MS_ADDR_R_ACK = 0x40, // Master: addr+read bit send, ACK received + I2C_MS_ADDR_R_NAK = 0x48, // Master: addr+read bit send, Not ACK received + I2C_MS_READ_DAT_ACK = 0x50, // Master: get data, send ACK + I2C_MS_READ_DAT_NAK = 0x58, // Master: get data, No send ACK + I2C_SS_RECV_ADDR_W = 0x60, // Slave: get addr+write, send ACK + I2C_MS_ARL_RECV_ADDR_W = 0x68, // Master: address arbit fail and get addr+write, send ACK + I2C_SS_RECV_GCA_ACK = 0x70, // Slave: get General Call Address and send ACK + I2C_MS_ARL_RECV_GCA_ACK = 0x78, // Master: address arbit fail get radio addresss, send ACK + I2C_SS_RECV_DAT_ACK = 0x80, // Slave: Get address and get data, send ACK + I2C_SS_RECV_DAT_NAK = 0x88, // Slave: Get address and get data, No send ACK + I2C_SS_GCA_RECV_DAT_ACK = 0x90, // Slave: Get General Call Address and get data, send ACK + I2C_SS_GCA_RECV_DAT_NAK = 0x98, // Slave: Get General Call Address and get data, No send ACK + I2C_SS_RECV_STOP_OR_RESTART = 0xA0, // Slave: get stop or restsrt signal + I2C_SS_RECV_ADDR_R_ACK = 0xA8, // Slave: get slave addr+read, send ACK + I2C_MS_ARL_RECV_ADDR_R_ACK = 0xB0, // Master: address arbit error get slave addr+read, send ACK + I2C_SS_SEND_DAT_ACK = 0xB8, // Slave: send data, ACK received + I2C_SS_SEND_DAT_NAK = 0xC0, // Slave: send data, Not ACK received + I2C_SS_SEND_LAST_DAT_ACK = 0xC8, // Slave: send LB, ACK received + I2C_SS_SEND_LAST_DAT_NAK = 0xD0, // Slave: send LB, Not ACK received + I2C_MS_SEND_SECOND_ADDR_ACK = 0xE0, // Master: second address send, ACK received + I2C_MS_SEND_SECOND_ADDR_NAK = 0xE8, // Master: second address send, Not ACK received + I2C_IFLG_IDLE = 0xF8, // No Status information and IFLG =0 +}; + +/// Bits field of I2C Contrl @see I2C_CONSET_TypeDef +enum i2c_ctrl_bfs +{ + I2C_CR_AAK_BIT = (1 << 2), + I2C_CR_IFLG_BIT = (1 << 3), + I2C_CR_STOP_BIT = (1 << 4), + I2C_CR_START_BIT = (1 << 5), + I2C_CR_I2C_EN_BIT = (1 << 6), + I2C_CR_INT_EN_BIT = (1 << 7), +}; + +/// Bits field of I2C Clock @see I2C_CLK_TypeDef +enum i2c_clk_bfs +{ + // bit[3:0] --- i2c master mode scl frequency + I2C_CLK_M_LSB = 0, + I2C_CLK_M_MSK = (0x0F << I2C_CLK_M_LSB), + // bit[6:4] --- i2c samp frequency + I2C_CLK_N_LSB = 4, + I2C_CLK_N_MSK = (0x07 << I2C_CLK_N_LSB), +}; + +#if (SYS_CLK == 1) + #define SCLK_100K (0x27) + #define SCLK_200K (0x23) + #define SCLK_400K (0x21) +#elif (SYS_CLK == 2) + #define SCLK_100K (0x2B) + #define SCLK_200K (0x25) + #define SCLK_400K (0x22) +#elif (SYS_CLK == 3) + #define SCLK_100K (0x2F) + #define SCLK_200K (0x27) + #define SCLK_400K (0x23) +#else + #define SCLK_100K (0x23) + #define SCLK_200K (0x21) + #define SCLK_400K (0x11) +#endif //SYS_CLK + +/// Master RD/WRn bit to be 'OR'ed with Slave address +#define I2C_RD_OP (0x01) + + +/// Enable I2C bus / interrupt +#define I2C_ENABLE() dowl( I2C->CONSET.Word = I2C_CR_I2C_EN_BIT; ) +#define I2C_DISABLE() dowl( I2C->CONCLR.Word = I2C_CR_I2C_EN_BIT; ) +#define I2C_INT_EN() dowl( I2C->CONSET.Word = I2C_CR_INT_EN_BIT; ) +#define I2C_INT_DIS() dowl( I2C->CONCLR.Word = I2C_CR_INT_EN_BIT; ) + +/// Set I2C Ack / NoAck +#define I2C_SET_ACK() dowl( I2C->CONSET.Word = I2C_CR_AAK_BIT; ) +#define I2C_SET_NAK() dowl( I2C->CONCLR.Word = I2C_CR_AAK_BIT; ) + +/// Get/Clear I2C Interrupt Flag +#define I2C_IFLG_CLR() dowl( I2C->CONCLR.Word = I2C_CR_IFLG_BIT; ) +#define I2C_IFLG_GET() (I2C->CONSET.Word & I2C_CR_IFLG_BIT) + +/// Get I2C Status @see enum i2c_status_def +#define I2C_STAT_GET() (I2C->SR.Word) + +/// Get/Put I2C Data +#define I2C_DATA_GET(_X_) dowl( (_X_) = I2C->DATA.Word; ) +#define I2C_DATA_PUT(_X_) dowl( I2C->DATA.Word = (_X_); ) + +// Set I2C Slave Addr +#define I2C_SLV_ADR(addr) dowl( I2C->SADR0.Word = (addr) << 1; ) + +// Configure I2C Clock +#define I2C_CLK_CFG(samp, scl) dowl( I2C->CLK.Word = ((samp) << I2C_CLK_SAMP_N_LSB) | (scl); ) + + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Init I2C Module. + * + * @param[in] io_scl io used for I2C scl @see enum pad_idx. + * @param[in] io_sda io used for I2C sda @see enum pad_idx. + * @param[in] sclk i2c clk. Bits field of I2C Clock @see enumi2c_clk_bfs. + * + * @note sclk = CLK/(2^clk_samp * (clk_scl+1) *10). Macro SCLK_100K/SCLK_200K/SCLK_400K + **************************************************************************************** + */ +void i2c_init(uint8_t io_scl, uint8_t io_sda, uint8_t sclk); + +/** + **************************************************************************************** + * @brief Deinit I2C. Disable I2C Module. + **************************************************************************************** + */ +void i2c_deinit(void); + +/** + **************************************************************************************** + * @brief I2C Send Start. + * + * @param[in] slv_addr device Address. + * + * @return I2C status @see enum i2c_status_def. + **************************************************************************************** + */ +uint8_t i2c_start(uint8_t slv_addr); + +/** + **************************************************************************************** + * @brief I2C Send Stop. + **************************************************************************************** + */ +void i2c_stop(void); + +/** + **************************************************************************************** + * @brief I2C Send data. + * + * @param[in] len data length. + * @param[in] data data pointer. + * + * @return send data cnt. + **************************************************************************************** + */ +uint16_t i2c_send(uint16_t len, const uint8_t *data); + +/** + **************************************************************************************** + * @brief I2C Receive data. + * + * @param[in] len buff length. + * @param[in] buff buff pointer. + * + * @return receive data cnt. + **************************************************************************************** + */ +uint16_t i2c_recv(uint16_t len, uint8_t *buff); + +/** + **************************************************************************************** + * @brief I2C Read data. + * + * @param[in] addr_r device Address. + * @param[in] len buff length. + * @param[in] buff buff pointer. + * + * @return read data cnt. + **************************************************************************************** + */ +uint16_t i2c_read(uint8_t addr_r, uint16_t len, uint8_t *buff); + +/** + **************************************************************************************** + * @brief I2C Write data. + * + * @param[in] addr_w device Address. + * @param[in] len buff length. + * @param[in] buff buff pointer. + * + * @return write data cnt. + **************************************************************************************** + */ +uint16_t i2c_write(uint8_t addr_w, uint16_t len, const uint8_t *data); + +/** + **************************************************************************************** + * @brief I2C Read eeprom data. + * + * @param[in] eep eeprom device Address. + * @param[in] addr Where eeprom addr to read. + * @param[in] len buff length. + * @param[in] buff buff pointer. + * + * @return read data cnt. + **************************************************************************************** + */ +uint16_t eeprom_read(uint8_t eep, uint16_t addr, uint16_t len, uint8_t *buff); + +/** + **************************************************************************************** + * @brief I2C Write eeprom data. + * + * @param[in] eep eeprom device Address. + * @param[in] addr Where eeprom addr to write. + * @param[in] len data length. + * @param[in] data data pointer. + * + * @return write data cnt. + **************************************************************************************** + */ +uint16_t eeprom_write(uint8_t eep, uint16_t addr, uint16_t len, const uint8_t *data); + +#endif // _I2C_H_ diff --git a/drivers/api/iopad.h b/drivers/api/iopad.h new file mode 100644 index 0000000..6b88d13 --- /dev/null +++ b/drivers/api/iopad.h @@ -0,0 +1,355 @@ +/** + **************************************************************************************** + * + * @file iopad.h + * + * @brief Header file - IOPAD with CSC Driver + * + **************************************************************************************** + */ + +#ifndef _IOPAD_H_ +#define _IOPAD_H_ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Indexs of pad +enum pad_idx +{ + // gpio pad + PA00 = 0, + PA01 = 1, + PA02 = 2, + PA03 = 3, + PA04 = 4, + PA05 = 5, + PA06 = 6, + PA07 = 7, + PA08 = 8, + PA09 = 9, + PA10 = 10, + PA11 = 11, + PA12 = 12, + PA13 = 13, + PA14 = 14, + PA15 = 15, + PA16 = 16, + PA17 = 17, + PA18 = 18, + PA19 = 19, + PA_MAX, + + // pad of special func + PA_SWCLK = PA00, + PA_SWDIO = PA01, + PA_CLKOUT = PA05, + PA_RSTPIN = PA19, + + // pad of USB signal + PA_USB_DP = PA06, + PA_USB_DM = PA07, + PA_SOF_SG = PA15, + + // pad of analog func + PA_ADCIN0 = PA00, + PA_ADCIN1 = PA01, + PA_ADCIN2 = PA02, + PA_MICIN = PA03, + PA_ADCIN3 = PA04, + PA_ADCIN4 = PA05, + PA_ADCIN5 = PA06, + PA_ADCIN6 = PA07, + PA_ADCIN7 = PA08, + PA_ADCIN8 = PA09, + PA_ADCIN9 = PA10, + PA_ADCIN0_B = PA11, + PA_ADCIN1_B = PA12, + PA_ADCIN2_B = PA13, + PA_ADCIN4_B = PA14, + PA_ADCIN5_B = PA15, + PA_ADCIN6_B = PA16, + PA_LDOTESTA = PA17, + PA_AT0 = PA18, + PA_AT1 = PA19, +}; + +/// Bits Field of IO Mode @see CSC_IO_CTRL_TypeDef +enum iom_bfs +{ + // set 0 to Hi-Z + IOM_HIZ = 0x00, + + // bit[2:0] -- IO Function Select + IOM_SEL_GPIO = (0 << 0), // default function + IOM_SEL_CSC = (1 << 0), // cross switch connect + IOM_SEL_SPECL = (2 << 0), // swd/clk_out + IOM_SEL_TIMER = (3 << 0), // timer function + IOM_SEL_DEBUG = (4 << 0), + IOM_SEL_RFTEST = (5 << 0), + IOM_SEL_ADC_DBG = (6 << 0), + IOM_SEL_USB = (7 << 0), + + // bit[5] -- IO Drive Strength + IOM_DRV_LVL0 = (0 << 5), // default Driver Strength + IOM_DRV_LVL1 = (1 << 5), // Max Driver Strength + + // bit[11:6] -- IO Enable Mode + IOM_PULLDOWN = (1 << 6), // Pull Down Control + IOM_PULLUP = (1 << 7), // IO Pull Up + IOM_INPUT = (1 << 8), // IO Input Enable + IOM_CURSRC = (1 << 9), // IO 1ma Current Source Enable + IOM_ANALOG = (1 << 10), // IO Analog Enable + IOM_OPENDRAIN = (1 << 11), // IO Open Drain Enable +}; + +/// Selected functions of CSC (I:Input, O:Output) +enum csc_fsel +{ + // Both Output and Input func + CSC_UART1_TXD = 0, // O/I can Swap + CSC_UART1_RXD = 1, // I/O can Swap + CSC_UART2_TXD = 2, // O/I can Swap + CSC_UART2_RXD = 3, // I/O can Swap + CSC_I2C_SCL = 4, // I&O OpenDrain + CSC_I2C_SDA = 5, // I&O OpenDrain + CSC_CTMR_CH1 = 6, // I/O pwc/pwm + CSC_CTMR_CH2 = 7, // I/O pwc/pwm + + // Output func + CSC_UART1_RTS = 8, // O + CSC_UART2_RTS = 9, // O + CSC_UART1_SCK = 10, // O + CSC_UART2_SCK = 11, // O + CSC_SPIM_CLK = 12, // O + CSC_SPIM_MOSI = 13, // O + CSC_SPIS_MISO = 14, // O + + // Input func + CSC_UART1_CTS = 8, // I + CSC_UART2_CTS = 9, // I + CSC_SPIM_MISO = 10, // I + CSC_SPIS_CLK = 11, // I + CSC_SPIS_MOSI = 12, // I + CSC_SPIS_CSN = 13, // I + + // Output global bist indicate + CSC_GLB_BIST_DONE = 15, // O + CSC_GLB_BIST_FAIL = 16, // O + + // Output analog observe func + CSC_OSCEN_FLAG = 17, // O + CSC_RFEN_FLAG = 18, // O + CSC_BLE_SLEEP_FLAG = 19, // O + CSC_CM0P_DEEPSLEEP = 20, // O + CSC_BB_TX_EN = 21, // O + CSC_BB_RX_EN = 22, // O + CSC_MDM_TX_EN = 23, // O + CSC_MDM_RX_EN = 24, // O +}; + +enum clk_out +{ + CLK_OUT_NONE = 0, + CLK_OUT_HSI = 1, + CLK_OUT_XO16M = 2, + CLK_OUT_DPLL = 3, + CLK_OUT_LSI = 4, + CLK_OUT_SYSCLK = 5, + CLK_OUT_AHB = 6, + CLK_OUT_APB1 = 7, + CLK_OUT_APB2 = 8, + CLK_OUT_FSHC = 9, + CLK_OUT_USB = 10, +}; + + +/* + * MACROS DECLARATION + **************************************************************************************** + */ + +#include "reg_csc.h" + +/// CSC peripheral function enable @see CSC_OUTPUT_CTRL_TypeDef & CSC_INPUT_CTRL_TypeDef +#define CSC_FEN_BIT (1UL << 7) /* Note Diff*/ +#define CSC_EN(fsel) ((fsel) | CSC_FEN_BIT) + +/** + **************************************************************************************** + * @brief Base IO Mode Control + * + * @param[in] pad Index of pad used @see enum pad_idx + * @param[in] ctrl value of mode @see enum iom_bfs + * + **************************************************************************************** + */ +#define iom_ctrl(pad, ctrl) CSC->CSC_PIO[pad].Word = ctrl + +/** + **************************************************************************************** + * @brief Base CSC Input Connect + * + * @param[in] pad Index of pad used @see enum pad_idx + * @param[in] fsel value of func @see enum csc_fsel -I + * + **************************************************************************************** + */ +#define csc_input(pad, fsel) CSC->CSC_INPUT[fsel].Word = CSC_EN(pad) + +/** + **************************************************************************************** + * @brief Base CSC Output Connect + * + * @param[in] pad Index of pad used @see enum pad_idx + * @param[in] fsel value of func @see enum csc_fsel -O + * + **************************************************************************************** + */ +#define csc_output(pad, fsel) CSC->CSC_OUTPUT[pad].Word = CSC_EN(fsel) + + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Composite CSC for UART Txd and Rxd + * + * @param[in] port uart port(0-UART1, 1-UART2) + * @param[in] pad_tx pad used for uart txd @see enum pad_idx + * @param[in] pad_rx pad used for uart rxd @see enum pad_idx + * + **************************************************************************************** + */ +void iocsc_uart(uint8_t port, uint8_t pad_tx, uint8_t pad_rx); + +/** + **************************************************************************************** + * @brief Composite CSC for UART HW Flow-Control + * + * @param[in] port uart port(0-UART1, 1-UART2) + * @param[in] pad_rts pad used for uart rts @see enum pad_idx + * @param[in] pad_cts pad used for uart cts @see enum pad_idx + * + **************************************************************************************** + */ +void iocsc_uart_hwfc(uint8_t port, uint8_t pad_rts, uint8_t pad_cts); + +/** + **************************************************************************************** + * @brief Composite CSC for I2C + * + * @param[in] pad_scl pad used for I2C scl @see enum pad_idx + * @param[in] pad_sda pad used for I2C sda @see enum pad_idx + * + **************************************************************************************** + */ +void iocsc_i2c(uint8_t pad_scl, uint8_t pad_sda); + +/** + **************************************************************************************** + * @brief Composite CSC for SPI Master Role + * + * @param[in] pad_clk pad used for SPI clk @see enum pad_idx + * @param[in] pad_miso pad used for SPI miso @see enum pad_idx + * @param[in] pad_mosi pad used for SPI mosi @see enum pad_idx + * + **************************************************************************************** + */ +void iocsc_spim(uint8_t pad_clk, uint8_t pad_miso, uint8_t pad_mosi); + +/** + **************************************************************************************** + * @brief Composite CSC for SPI Slave Role + * + * @param[in] pad_cs pad used for SPI cs @see enum pad_idx + * @param[in] pad_clk pad used for SPI clk @see enum pad_idx + * @param[in] pad_miso pad used for SPI miso @see enum pad_idx + * @param[in] pad_mosi pad used for SPI mosi @see enum pad_idx + * + **************************************************************************************** + */ +void iocsc_spis(uint8_t pad_cs, uint8_t pad_clk, uint8_t pad_miso, uint8_t pad_mosi); + +/** + **************************************************************************************** + * @brief Composite CSC for CTMR PWM/PWC channel + * + * @param[in] pad_ch1 pad used for CTMR CH1 @see enum pad_idx + * @param[in] pad_ch2 pad used for CTMR CH2 @see enum pad_idx + * + **************************************************************************************** + */ +void iocsc_ctmr_chnl(uint8_t pad_ch1, uint8_t pad_ch2); + +/** + **************************************************************************************** + * @brief Analog observe via pad + * + * @param[in] pad pad used for observe @see enum pad_idx + * @param[in] fsel Func of analog @see enum csc_fsel (17~24) + * + **************************************************************************************** + */ +void iocsc_observe(uint8_t pad, uint8_t fsel); + +/** + **************************************************************************************** + * @brief Special Clock output via PA05(Fixed) + * + * @param[in] clk Type of Clock Out @see enum clk_out + * + **************************************************************************************** + */ +void iospc_clkout(uint8_t clk); + +/** + **************************************************************************************** + * @brief Special USB DP/DM via PA06 PA07(Fixed, HiZ mode) + * + **************************************************************************************** + */ +void iospc_usbpin(void); + +/** + **************************************************************************************** + * @brief Special SWCLK SWDIO via PA00 PA01(Fixed, default) + * + **************************************************************************************** + */ +void iospc_swdpin(void); + +/** + **************************************************************************************** + * @brief Special nRESET via PA19(Fixed, default) + * + * @param[in] as_gpio true as GPIO, false as nRESET + * + **************************************************************************************** + */ +void iospc_rstpin(bool as_gpio); + +// Macro for Deprecated Functions { +#define ioSelUartTxRx iocsc_uart +#define ioSelUartRtsCts iocsc_uart_hwfc +#define ioSelI2c iocsc_i2c +#define ioSelSpiMaster iocsc_spim +#define ioSelSpiSlave iocsc_spis +#define ioClkOut(clk) iospc_clkout(clk) +#define ioOscen(pad) iocsc_observe(pad, CSC_OSCEN_FLAG) +#define ioRFen(pad) iocsc_observe(pad, CSC_RFEN_FLAG) +#define ioCoreSleep(pad) iocsc_observe(pad, CSC_CM0P_DEEPSLEEP) +#define ioBleSleep(pad) iocsc_observe(pad, CSC_BLE_SLEEP_FLAG) +#define ioBleTxRx(pad_tx, pad_rx) do{iocsc_observe(pad_tx, CSC_BB_TX_EN);iocsc_observe(pad_rx, CSC_BB_RX_EN);}while(0) +#define ioModemTxRx(pad_tx, pad_rx) do{iocsc_observe(pad_tx, CSC_MDM_TX_EN);iocsc_observe(pad_rx, CSC_MDM_RX_EN);}while(0) +// } + +#endif // _IOPAD_H_ diff --git a/drivers/api/iwdt.h b/drivers/api/iwdt.h new file mode 100644 index 0000000..697bf5e --- /dev/null +++ b/drivers/api/iwdt.h @@ -0,0 +1,68 @@ +/** + **************************************************************************************** + * + * @file iwdt.h + * + * @brief Header file - WatchDog Timer Driver + * + **************************************************************************************** + */ + +#ifndef _IWDT_H_ +#define _IWDT_H_ + +#include +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +enum iwdt_ctrl_bfs +{ + IWDT_EN_BIT = (1 << 0), // enable + IWDT_INTEN_BIT = (1 << 1), // interrupt enable + IWDT_RSTEN_BIT = (1 << 2), // reset enable + IWDT_CLKLSI_BIT = (1 << 3), // clk select lsi +}; + +#define IWDT_CR_DFLT (IWDT_EN_BIT | IWDT_RSTEN_BIT | IWDT_CLKLSI_BIT) + +#define iwdt_disable() iwdt_conf(0) + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ +/** + **************************************************************************************** + * @brief Init Config IWDT. + * + * @param[in] ctrl Bits field of value @see enum iwdt_ctrl_bfs. + **************************************************************************************** + */ +void iwdt_init(uint8_t ctrl); + +/** + **************************************************************************************** + * @brief reload IWDT. + **************************************************************************************** + */ +void iwdt_feed(void); + +#if (ROM_UNUSED) +/** + **************************************************************************************** + * @brief Config IWDT, feed or disable + * + * @param[in] load LOAD to feed watchdog, 0 means disable + * + * @return Timer value + **************************************************************************************** + */ +uint32_t iwdt_conf(uint32_t load); +#endif + +#endif // _IWDT_H_ diff --git a/drivers/api/pwm.h b/drivers/api/pwm.h new file mode 100644 index 0000000..4410b45 --- /dev/null +++ b/drivers/api/pwm.h @@ -0,0 +1,198 @@ +/** + **************************************************************************************** + * + * @file pwm.h + * + * @brief Header file - PWM Driver + * + **************************************************************************************** + */ + +#ifndef _PWM_H_ +#define _PWM_H_ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +enum pwm_timer +{ + // timer for Common Timer + PWM_CTMR = 0, + // timer for Advance Timer + PWM_ATMR = 1, +}; + +enum pwm_channel +{ + // Channels of Common Timer + PWM_CTMR_CH1 = 0, + PWM_CTMR_CH2 = 1, + PWM_CTMR_CH3 = 2, + PWM_CTMR_CH4 = 3, + + // Channels of Advance Timer + PWM_ATMR_CH1P = 4, + PWM_ATMR_CH2P = 5, + PWM_ATMR_CH3P = 6, + PWM_ATMR_CH4P = 7, + PWM_ATMR_CH1N = 8, + PWM_ATMR_CH2N = 9, + PWM_ATMR_CH3N = 10, +}; + +enum pwc_psc +{ + PWC_PSC0 = 0, + PWC_PSC2 = 1, + PWC_PSC4 = 2, + PWC_PSC8 = 3, +}; + +/// Bits field of Capture/Compare enable register +enum pwm_ccer_bfs +{ + // PWM Enable Bit + PWM_CCxE_POS = 0, + PWM_CCxE_BIT = (1 << PWM_CCxE_POS), + // PWM Polar Bit (0-high, 1-low) + PWM_CCxP_POS = 1, + PWM_CCxP_BIT = (1 << PWM_CCxP_POS), + // PWM Complementary Enable Bit + PWM_CCxNE_POS = 2, + PWM_CCxNE_BIT = (1 << PWM_CCxNE_POS), + // PWM Complementary Polar Bit + PWM_CCxNP_POS = 3, + PWM_CCxNP_BIT = (1 << PWM_CCxNP_POS), + // PWM DMA request enable + PWM_CCxDE_POS = 4, + PWM_CCxDE_BIT = (1 << PWM_CCxDE_POS), +}; + +#define PWM_CCER_SIPH (PWM_CCxE_BIT) +#define PWM_CCER_SIPL (PWM_CCxE_BIT | PWM_CCxP_BIT) + +#define PWC_CCER_POSEDGE (PWM_CCxE_BIT) // rising-edge +#define PWC_CCER_NEGEDGE (PWM_CCxE_BIT | PWM_CCxP_BIT) // falling-edge + +/// Bits field of Capture/Compare mode register +enum pwm_ccmr_bfs +{ + // Capture/Compare selection - bit[1:0] + PWM_CCxS_LSB = 0, + PWM_CCxS_MSK = (0x03 << PWM_CCxS_LSB), + + // Output Compare fast enable - bit2 + PWM_OCxFE_POS = 2, + PWM_OCxFE_BIT = (1 << PWM_OCxFE_POS), + // Output Compare preload enable - bit3 + PWM_OCxPE_POS = 3, + PWM_OCxPE_BIT = (1 << PWM_OCxPE_POS), + // Output Compare mode - bit[6:4] + PWM_OCxM_LSB = 4, + PWM_OCxM_MSK = (0x07 << PWM_OCxM_LSB), + // Output Compare clear enable - bit7 + PWM_OCxCE_POS = 7, + PWM_OCxCE_BIT = (1 << PWM_OCxCE_POS), + + // Input capture prescaler - bit[3:2] + PWM_ICxPSC_LSB = 2, + PWM_ICxPSC_MSK = (0x03 << PWM_ICxPSC_LSB), + // Input capture filter - bit[7:4] + PWM_ICxF_LSB = 4, + PWM_ICxF_MSK = (0x0F << PWM_ICxF_LSB), +}; + +#define PWM_CCxS(sel) (((sel) & 0x03) << PWM_CCxS_LSB) +#define PWM_OCxM(mod) (((mod) & 0x07) << PWM_OCxM_LSB) +#define PWM_ICxPSC(psc) (((psc) & 0x03) << PWM_ICxPSC_LSB) +#define PWM_ICxF(flt) (((flt) & 0x0F) << PWM_ICxF_LSB) + +#define PWM_CCMR_MODE1 (PWM_OCxPE_BIT | PWM_OCxM(6)) +#define PWM_CCMR_MODE2 (PWM_OCxPE_BIT | PWM_OCxM(7)) + +#define PWC_CCMR_MODE(sel, flt, psc) \ + (PWM_CCxS(sel) | PWM_ICxF(flt) | PWM_ICxPSC(psc)) + +typedef struct pwm_channel_cfg +{ + // Capture/Compare mode + uint8_t ccmr; + // Capture/Compare enable + uint8_t ccer; + // Duty ratio = duty / arr + uint16_t duty; +} pwm_chnl_cfg_t; + + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Init Timer(Source) for PWM Capture/Compare + * + * @param[in] tmr Timer ID @see enum pwm_timer + * @param[in] psc PWM configure prescaler + * @param[in] arr PWM configure Auto-reload + * + **************************************************************************************** + */ +void pwm_init(uint8_t tmr, uint16_t psc, uint16_t arr); + +/** + **************************************************************************************** + * @brief Config Timer(Source) for PWC(PWM Capture) + * + * @param[in] tmr Timer ID @see enum pwm_timer + * @param[in] smcr PWM Slave mode control + * @param[in] intr PWM Interrupt configure + * + **************************************************************************************** + */ +void pwm_conf(uint8_t tmr, uint16_t smcr, uint16_t intr); + +/** + **************************************************************************************** + * @brief Start/Enable Timer(Source) for PWM Capture/Compare + * + * @param[in] tmr Timer ID @see enum pwm_timer + * + **************************************************************************************** + */ +void pwm_start(uint8_t tmr); + +/** + **************************************************************************************** + * @brief Config special channel for PWM Capture/Compare + * + * @param[in] chnl Timer ID @see enum pwm_timer + * @param[in] conf Pointer of channel configure @see struct pwm_channel_cfg + * Channel stop when conf is NULL, else start. + * + **************************************************************************************** + */ +void pwm_chnl_set(uint8_t chnl, const pwm_chnl_cfg_t *conf); + +/// Macro for Channel stop +#define pwm_chnl_stop(chnl) pwm_chnl_set(chnl, NULL) + +/** + **************************************************************************************** + * @brief Update special channel's duty for PWM Capture/Compare + * + * @param[in] chnl Timer ID @see enum pwm_timer + * @param[in] duty Value of Duty, ratio = duty / arr + * + **************************************************************************************** + */ +void pwm_duty_upd(uint8_t chnl, uint16_t duty); + + +#endif // _PWM_H_ diff --git a/drivers/api/rcc.h b/drivers/api/rcc.h new file mode 100644 index 0000000..eabc764 --- /dev/null +++ b/drivers/api/rcc.h @@ -0,0 +1,280 @@ +/** + **************************************************************************************** + * + * @file rcc.h + * + * @brief Header file - Reset and clock control(RCC) Driver + * + **************************************************************************************** + */ + +#ifndef _RCC_H_ +#define _RCC_H_ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Clock Selection of Core System +enum sys_clk_sel +{ + SYS_CLK_16M = 0, // XO16M + SYS_CLK_32M = 1, // DPLL64M/2 + SYS_CLK_48M = 2, // DPLL48M + SYS_CLK_64M = 3, // DPLL64 + SYS_CLK_HSI = 4, // RC16M + SYS_CLK_LSI = 5, // RC32K +}; + +/// Clock Frequency of SYS_CLK +enum sys_clk_freq +{ + SYS_FREQ_32K = 32000, + SYS_FREQ_16M = 16000000, + SYS_FREQ_32M = 32000000, + SYS_FREQ_48M = 48000000, + SYS_FREQ_64M = 64000000, +}; + +/// Clock Selection of Flash Controlor +enum fsh_clk_sel +{ + FSH_CLK_HSI16 = 1, // RC16M + FSH_CLK_HSE16 = 2, // XO16M + FSH_CLK_DPLL = 4, // DPLL + FSH_CLK_DPLL128 = 8, // DPLL128M + + // prescale from DPLL128M + FSH_CLK_DPSC64 = FSH_CLK_DPLL128 + 1, // psc2 + FSH_CLK_DPSC42 = FSH_CLK_DPLL128 + 2, // psc3 + FSH_CLK_DPSC32 = FSH_CLK_DPLL128 + 3, // psc4 + FSH_CLK_DPSC25 = FSH_CLK_DPLL128 + 4, // psc5 +}; + +/// Clock Frequency of fSH_CLK, unit in MHz +enum fsh_clk_freq +{ + FSH_FREQ_16MHz = 16, // RC16M or XO16M + FSH_FREQ_48MHz = 48, // DPLL + FSH_FREQ_64MHz = 64, // DPLL + FSH_FREQ_PSC64 = 64, // DPLL128 / psc2 + FSH_FREQ_PSC42 = 42, // DPLL128 / psc3 + FSH_FREQ_PSC32 = 32, // DPLL128 / psc4 + FSH_FREQ_PSC25 = 25, // DPLL128 / psc5 +}; + +/// BUS Operation Index +enum rcc_bus_idx +{ + AHB_RST_CTRL, + APB_RST_CTRL, + AHB_CLK_RUN, + APB_CLK_RUN, + AHB_CLK_SLEEP, + APB_CLK_SLEEP, + AHB_CLK_DEEPSL, + APB_CLK_DEEPSL, +}; + +/// Bits Field of AHB-BUS +enum rcc_ahb_bfs +{ + AHB_RCC_BIT = (1UL << 0), // CLK + AHB_SYSCFG_BIT = (1UL << 1), // CLK RST + AHB_CSC_RST_BIT = (1UL << 2), // RST + AHB_SPIM_BIT = (1UL << 4), // CLK RST + AHB_SPIS_BIT = (1UL << 5), // CLK RST + AHB_FSHC_BIT = (1UL << 6), // CLK RST + AHB_ADC_BIT = (1UL << 7), // CLK RST + AHB_GPIOA_RST_BIT = (1UL << 8), // RST + AHB_AHB2P1_BIT = (1UL << 9), // CLK RST + AHB_AHB2P2_BIT = (1UL << 10), // CLK RST + AHB_CACHE_BIT = (1UL << 11), // CLK RST + AHB_USB_BIT = (1UL << 12), // CLK RST +}; + +/// Bits Field of APB-BUS +enum rcc_apb_bfs +{ + APB_BTMR_BIT = (1UL << 0), // CLK RST + APB_CTMR_BIT = (1UL << 1), // CLK RST + APB_ATMR_BIT = (1UL << 2), // CLK RST + APB_UART1_BIT = (1UL << 3), // CLK RST + APB_UART2_BIT = (1UL << 4), // CLK RST + + APB_DMAC_BIT = (1UL << 6), // CLK RST + + APB_EXTI_BIT = (1UL << 8), // CLK RST + APB_I2C_BIT = (1UL << 9), // CLK RST + APB_IWDT_BIT = (1UL << 10), // CLK + APB_MDM_BIT = (1UL << 11), // CLK RST + APB_RF_BIT = (1UL << 12), // CLK RST + APB_AON_BIT = (1UL << 16), // CLK + APB_APBMISC_BIT = (1UL << 17), // CLK + + APB_PLLCAL_RST_BIT = (1UL << 13), // RST + APB_RCCALIB_RST_BIT = (1UL << 14), // RST + APB_RC16MCNT_RST_BIT = (1UL << 15), // RST + APB_BLELTMR_RST_BIT = (1UL << 16), // RST + APB_RTCSOFT_RST_BIT = (1UL << 17), // RST +}; + + +/* + * MACROS DECLARATION + **************************************************************************************** + */ + +#include "reg_rcc.h" + +#define RCC_AHBCLK_EN(bfs) dowl( RCC->AHBCLK_EN_RUN.Word |= (bfs); ) +#define RCC_APBCLK_EN(bfs) dowl( RCC->APBCLK_EN_RUN.Word |= (bfs); ) +#define RCC_AHBCLK_DIS(bfs) dowl( RCC->AHBCLK_EN_RUN.Word &= ~(bfs); ) +#define RCC_APBCLK_DIS(bfs) dowl( RCC->APBCLK_EN_RUN.Word &= ~(bfs); ) +#define RCC_AHBRST_REQ(bfs) dowl( RCC->AHBRST_CTRL.Word |= (bfs);RCC->AHBRST_CTRL.Word &= ~(bfs); ) +#define RCC_APBRST_REQ(bfs) dowl( RCC->APBRST_CTRL.Word |= (bfs);RCC->APBRST_CTRL.Word &= ~(bfs); ) + + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Get BUS Register's value + * + * @param[in] idx Index of register @see enum rcc_bus_idx + * + * @return value + **************************************************************************************** + */ +uint32_t rcc_bus_get(uint8_t idx); + +/** + **************************************************************************************** + * @brief Enable Bits Field of BUS Register + * + * @param[in] idx Index of register @see enum rcc_bus_idx + * @param[in] bfs Bits field of value @see enum rcc_ahb_bfs OR rcc_apb_bfs + * + **************************************************************************************** + */ +void rcc_bus_enb(uint8_t idx, uint32_t bfs); + +/** + **************************************************************************************** + * @brief Disable Bits Field of BUS Register + * + * @param[in] idx Index of register @see enum rcc_bus_idx + * @param[in] bfs Bits field of value @see enum rcc_ahb_bfs OR rcc_apb_bfs + * + **************************************************************************************** + */ +void rcc_bus_dis(uint8_t idx, uint32_t bfs); + +/** + **************************************************************************************** + * @brief Reset Bits Field of BUS Register (Combine rcc_bus_enb & rcc_bus_dis) + * + * @param[in] idx Index of register @see enum rcc_bus_idx + * @param[in] bfs Bits field of value @see enum rcc_ahb_bfs OR rcc_apb_bfs + * + **************************************************************************************** + */ +void rcc_bus_rst(uint8_t idx, uint32_t bfs); + + +/** + **************************************************************************************** + * @brief Enable ADC Clock Configure + * + **************************************************************************************** + */ +void rcc_adc_en(void); + +/** + **************************************************************************************** + * @brief Enable BLE Clock Configure + * + **************************************************************************************** + */ +void rcc_ble_en(void); + +/** + **************************************************************************************** + * @brief Enable USB Clock/Pad Configure + * + **************************************************************************************** + */ +void rcc_usb_en(void); + +/** + **************************************************************************************** + * @brief Set system clock selection + * + * @param[in] sys_clk Index of Clock Selected @see enum sys_clk_sel + * + **************************************************************************************** + */ +void rcc_sysclk_set(uint8_t sys_clk); + +/** + **************************************************************************************** + * @brief Get system clock selection + * + * @return Clock Selected @see enum sys_clk_sel + **************************************************************************************** + */ +uint8_t rcc_sysclk_get(void); + +/** + **************************************************************************************** + * @brief Get clock frequency of core system, unit in Hz + * + * @return frequency @see enum sys_clk_freq + **************************************************************************************** + */ +uint32_t rcc_sysclk_freq(void); + +/** + **************************************************************************************** + * @brief Get flash controlor clock selection + * + * @return Clock Selected @see enum fsh_clk_sel + **************************************************************************************** + */ +uint8_t rcc_fshclk_get(void); + +/** + **************************************************************************************** + * @brief Get clock frequency of flash controlor, unit in MHz. + * + * @return freq in MHz @see enum fsh_clk_freq + **************************************************************************************** + */ +uint8_t rcc_fshclk_mhz(void); + +#if (ROM_UNUSED) +/** + **************************************************************************************** + * @brief Set flash controlor clock selection + * + * @param[in] fclk_sel Index of Clock Selected @see enum fsh_clk_sel + * + **************************************************************************************** + */ +void rcc_fshclk_set(uint8_t fsh_clk); +#endif + + +// Macro for Deprecated Functions { +#define rccGetSysClk() rcc_sysclk_freq() +// } + + +#endif // _RCC_H_ diff --git a/drivers/api/rco.h b/drivers/api/rco.h new file mode 100644 index 0000000..5da80d5 --- /dev/null +++ b/drivers/api/rco.h @@ -0,0 +1,130 @@ +/** + **************************************************************************************** + * + * @file rco.h + * + * @brief Header file - RCO(32k, 16M) Driver + * + **************************************************************************************** + */ + +#ifndef _RCO_H_ +#define _RCO_H_ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Reference Clock for rc32k calibration +enum rc32k_ref_clk +{ + RCLK_HSE = 0, // XOSC16M + RCLK_DPLL = 1, + RCLK_DPLL128 = 2, +}; + +/// Config Control for rc32k calibration +enum rc32k_cal_ctrl +{ + RCAL_CYCLES_LSB = 0, + RCAL_CYCLES_MSK = 0x1F, + RCAL_SCALE_EN = (1 << 5), + RCAL_DELAY_EN = (1 << 6), +}; + +#define RCAL_CYCLES(n) ((n) << RCAL_CYCLES_LSB) + +/// Trimming value for rc32k calibration +typedef union +{ + struct + { + uint16_t msb_val: 4; + uint16_t lsb_val: 10; + uint16_t reserve: 2; + }; + uint16_t value; +} rc32k_trim_val; + + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Enable and Config rc32k + * + * @param[in] ref_clk reference clock for calibration @see enum rc32k_ref_clk + * @param[in] cal_ctrl config control for calibration @see enum rc32k_cal_ctrl + * + **************************************************************************************** + */ +void rc32k_conf(uint8_t ref_clk, uint8_t cal_ctrl); + +/** + **************************************************************************************** + * @brief Start rc32k calibration, after rc32k_conf(). + * + * @return rc32k trim value + **************************************************************************************** + */ +uint16_t rc32k_calib(void); + +/** + **************************************************************************************** + * @brief Direct Set trim value to calibrate rc32k. + * + * @param[in] value calib-target value + * + **************************************************************************************** + */ +void rc32k_trim_set(uint16_t value); + +/** + **************************************************************************************** + * @brief Get current value of rc32k calibrated or used. + * + * @return calib-target value + * + **************************************************************************************** + */ +uint16_t rc32k_trim_get(void); + +/** + **************************************************************************************** + * @brief Direct Set trim value to calibrate rc16m. + * + * @param[in] value calib-target value 0~63 + * + **************************************************************************************** + */ +void rc16m_trim_set(uint8_t value); + +/** + **************************************************************************************** + * @brief Get current value of rc16m calibrated or used. + * + * @return calib-target value 0~63 + * + **************************************************************************************** + */ +uint8_t rc16m_trim_get(void); + +#if (ROM_UNUSED) +/** + **************************************************************************************** + * @brief Start rc16m calibration in dichotomy. + * + * @return rc16m trim value (0~63) + **************************************************************************************** + */ +uint8_t rc16m_calib(void); +#endif + +#endif // _RCO_H_ diff --git a/drivers/api/rtc.h b/drivers/api/rtc.h new file mode 100644 index 0000000..3685814 --- /dev/null +++ b/drivers/api/rtc.h @@ -0,0 +1,153 @@ +/** + **************************************************************************************** + * + * @file rtc.h + * + * @brief Header file - RTC Driver + * + **************************************************************************************** + */ + +#ifndef _RTC_H_ +#define _RTC_H_ + +#include +#include +#include "reg_apbmisc.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Time information +typedef struct { + // Second part of the time + uint32_t sec; + // Millisecond part of the time (range: 0~999ms) + uint32_t ms; +} rtc_time_t; + + +/* + * MACROS DECLARATION + **************************************************************************************** + */ + +/// Add 'ms/1000' into 'sec', 'ms' is 0~999 +#define SEC_MS_ADD(sec, ms) while (ms >= 1000) { ms -= 1000; sec++; } + + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Config rtc module, enabled after 1ms if set True. + * + * @param[in] en True to enable, False to disable + * + **************************************************************************************** + */ +void rtc_conf(bool en); + +/** + **************************************************************************************** + * @brief Get current rtc-time. + * + * @return rtc-time value + **************************************************************************************** + */ +rtc_time_t rtc_time_get(void); + +/** + **************************************************************************************** + * @brief Set/Change current time + * + * @param[in] sec second time + * @param[in] ms millisecond time (range: 0~999ms) + * + **************************************************************************************** + */ +void rtc_time_set(uint32_t sec, uint32_t ms); + +/** + **************************************************************************************** + * @brief Renew alarm time, used in RTC_IRQHandler() for periodic calls + * + * @param[in] ms_time time(unit in ms) to alarm again + * + **************************************************************************************** + */ +static inline void rtc_alarm_renew(uint32_t ms_time) +{ + //APBMISC->RTCINT_CTRL.RTC_INT_EN = 0; + APBMISC->RTCINT_CTRL.RTC_INT_CLR = 1; + + //if (!APBMISC->RTCINT_CTRL.RTC_SET_BUSY) + { + // Read current alarm time, add ms_time to renew it. + uint32_t alm_sec = APBMISC->RTC_ALARM_SEC; + uint32_t alm_ms = APBMISC->RTC_ALARM_MS + ms_time; + + SEC_MS_ADD(alm_sec, alm_ms); + APBMISC->RTC_ALARM_SEC = alm_sec; + APBMISC->RTC_ALARM_MS = alm_ms; + } + + //APBMISC->RTCINT_CTRL.RTC_INT_EN = 1; +} + +/** + **************************************************************************************** + * @brief Set alarm time + * + * @param[in] ms_time time(unit in ms) to alarm + * + **************************************************************************************** + */ +void rtc_alarm_set(uint32_t ms_time); + +/** + **************************************************************************************** + * @brief Get configured alarm rtc-time. + * + * @return rtc-time value + **************************************************************************************** + */ +rtc_time_t rtc_alarm_get(void); + +/** + **************************************************************************************** + * @brief Judge alarm time reached or not, auto clear if reached. + * + * @return True if time reached, else False + **************************************************************************************** + */ +bool rtc_is_alarm(void); + +/** + **************************************************************************************** + * @brief Set rtc interrupt mode + * + * @param[in] en True to interrupt enable, False to disable + * + **************************************************************************************** + */ +void rtc_irq_set(bool en); + +/** + **************************************************************************************** + * @brief Set rtc wakeup mode + * + * @param[in] en True to enable wakeup, False to disable + * + **************************************************************************************** + */ +void rtc_wkup_set(bool en); + + +#endif // _RTC_H_ diff --git a/drivers/api/sadc.h b/drivers/api/sadc.h new file mode 100644 index 0000000..2cf459d --- /dev/null +++ b/drivers/api/sadc.h @@ -0,0 +1,293 @@ +/** + **************************************************************************************** + * + * @file sadc.h + * + * @brief Header file - SADC(ADC) Driver + * + **************************************************************************************** + */ + +#ifndef _SADC_H_ +#define _SADC_H_ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +enum sadc_chnl_set +{ + // 0~4: Special Power Pads + SADC_CH_VDD33 = 0, // VDD33/2 + SADC_CH_VBK = 1, // PAD_VBK + SADC_CH_VDD12 = 2, // PAD_VDD12 + SADC_CH_PGAOUT = 3, + SADC_CH_MICIN = 4, + + // 5~14: ADCIN0 ~ ADCIN9(Single ended channel) + SADC_CH_AIN0 = 5, // PA00 or PA11 + SADC_CH_AIN1 = 6, // PA01 or PA12 + SADC_CH_AIN2 = 7, // PA02 or PA13 + SADC_CH_AIN3 = 8, // PA04 + SADC_CH_AIN4 = 9, // PA05 or PA14 + SADC_CH_AIN5 = 10, // PA06 or PA15 + SADC_CH_AIN6 = 11, // PA07 or PA16 + SADC_CH_AIN7 = 12, // PA08 + SADC_CH_AIN8 = 13, // PA09 + SADC_CH_AIN9 = 14, // PA10 + + // 15: RF RSSI sample + SADC_CH_RFRSV = 15, // RF.RF_RSV[3:0] +}; + +enum sadc_rf_rsv +{ + SADC_RF_TEMP = 0x1, // 4'b0001 + SADC_RF_BANDGAP = 0x2, // 4'b0010 + SADC_RF_RSSI = 0x4, // 4'b0100 + SADC_RF_VDDIF = 0x8, // 4'b1000 +}; + +enum sadc_ana_ctrl +{ + // bit0 - SADC Enable + SADC_EN_POS = 0, + SADC_EN_BIT = (1 << SADC_EN_POS), + + // bit[2:1] - Vref Trim + SADC_VREF_TRIM_LSB = 1, + SADC_VREF_TRIM_1V2 = (0 << SADC_VREF_TRIM_LSB), + SADC_VREF_TRIM_1V8 = (1 << SADC_VREF_TRIM_LSB), + SADC_VREF_TRIM_2V4 = (2 << SADC_VREF_TRIM_LSB), + SADC_VREF_TRIM_3V0 = (3 << SADC_VREF_TRIM_LSB), + + // bit[5:3] - ibsel cmp 15uA~105uA, step in 15uA + SADC_IBSEL_CMP_LSB = 3, + SADC_IBSEL_CMP_015UA = (0 << SADC_IBSEL_CMP_LSB), + SADC_IBSEL_CMP_105UA = (7 << SADC_IBSEL_CMP_LSB), + // bit[8:6] - ibsel vcm 15uA~105uA, step in 15uA + SADC_IBSEL_VCM_LSB = 6, + SADC_IBSEL_VCM_015UA = (0 << SADC_IBSEL_VCM_LSB), + SADC_IBSEL_VCM_105UA = (7 << SADC_IBSEL_VCM_LSB), + // bit[11:9] - ibsel Vref 15uA~105uA, step in 15uA + SADC_IBSEL_VREF_LSB = 9, + SADC_IBSEL_VREF_015UA = (0 << SADC_IBSEL_VREF_LSB), + SADC_IBSEL_VREF_105UA = (7 << SADC_IBSEL_VREF_LSB), + // bit[14:12] - ibsel buf 15uA~105uA, step in 15uA + SADC_IBSEL_BUF_LSB = 12, + SADC_IBSEL_BUF_015UA = (0 << SADC_IBSEL_BUF_LSB), + SADC_IBSEL_BUF_105UA = (7 << SADC_IBSEL_BUF_LSB), + + // bit15 - SADC Vref gen from VBG or VDDA + SADC_VREF_POS = 15, + SADC_VREF_VDD = (0 << SADC_VREF_POS), + SADC_VREF_VBG = (1 << SADC_VREF_POS), + + // bit[17:16] - SADC precision or range + SADC_CALCAP_LSB = 16, + SADC_CALCAP_PRECISION = (1 << SADC_CALCAP_LSB), + SADC_CALCAP_RANGE = (3 << SADC_CALCAP_LSB), + // bit[19:18] - SADC single ended tie to GND or VREF + SADC_CALOS_POS = 18, + SADC_CALOS_GND = (0 << SADC_CALOS_POS), + SADC_CALOS_VREF = (1 << SADC_CALOS_POS), + + // bit20 - SADC bypass input buffer + SADC_INBUF_BYPSS_POS = 20, + SADC_INBUF_BYPSS_BIT = (1 << SADC_INBUF_BYPSS_POS), +}; + +#define SADC_IBSEL_CMP(sel) ((sel) << SADC_IBSEL_CMP_LSB) +#define SADC_IBSEL_VCM(sel) ((sel) << SADC_IBSEL_VCM_LSB) +#define SADC_IBSEL_VREF(sel) ((sel) << SADC_IBSEL_VREF_LSB) +#define SADC_IBSEL_BUF(sel) ((sel) << SADC_IBSEL_BUF_LSB) + +#define SADC_ANA_DFLT (SADC_VREF_VBG | SADC_CALCAP_PRECISION | SADC_IBSEL_BUF(3) | SADC_IBSEL_VREF(3) \ + | SADC_IBSEL_VCM(3) | SADC_IBSEL_CMP(3) | SADC_VREF_TRIM_2V4 | SADC_EN_BIT) + +#define SADC_ANA_VREF_1V2 (SADC_VREF_VBG | SADC_CALCAP_PRECISION | SADC_IBSEL_BUF(3) | SADC_IBSEL_VREF(3) \ + | SADC_IBSEL_VCM(3) | SADC_IBSEL_CMP(3) | SADC_VREF_TRIM_1V2 | SADC_EN_BIT) + +#define SADC_ANA_VREF_2V4 (SADC_VREF_VBG | SADC_CALCAP_PRECISION | SADC_IBSEL_BUF(3) | SADC_IBSEL_VREF(3) \ + | SADC_IBSEL_VCM(3) | SADC_IBSEL_CMP(3) | SADC_VREF_TRIM_2V4 | SADC_EN_BIT) + +#define SADC_ANA_VREF_VDD (SADC_VREF_VDD | SADC_CALCAP_PRECISION | SADC_IBSEL_BUF(3) | SADC_IBSEL_VREF(3) \ + | SADC_IBSEL_VCM(3) | SADC_IBSEL_CMP(3) | SADC_EN_BIT) + +enum sadc_mic_sel +{ + // bit0 - Analog microphone connect mode + SADC_MIC_MODE_POS = 0, + SADC_MIC_MODE_CAP = (0 << SADC_MIC_MODE_POS), + SADC_MIC_MODE_NO_CAP = (1 << SADC_MIC_MODE_POS), + // bit1 - Micbias powerdown signal + SADC_MIC_PWD_POS = 1, + SADC_MIC_PWD_BIT = (1 << SADC_MIC_PWD_POS), + + // bit[8:2] - Micbias output voltage trimming signal + SADC_MIC_TRIM_LSB = 2, + SADC_MIC_TRIM_MSK = (0x7F << SADC_MIC_TRIM_LSB), + // bit9 - Micbias Internal voltage reference(0:750mV, 1:1.5V) + SADC_MIC_VREF_POS = 9, + SADC_MIC_VREF_750MV = (0 << SADC_MIC_VREF_POS), + SADC_MIC_VREF_1V5 = (1 << SADC_MIC_VREF_POS), + + // bit[11:10] - pga voltage trimming signal + SADC_PGA_BIAS_LSB = 10, + SADC_PGA_BIAS_MSK = (0x03 << SADC_PGA_BIAS_LSB), + // bit12 - pga enable signal + SADC_PGA_EN_POS = 12, + SADC_PGA_EN_BIT = (1 << SADC_PGA_EN_POS), + // bit[17:13] - pga voltage trimming signal + SADC_PGA_VOL_LSB = 13, + SADC_PGA_VOL_MSK = (0x1F << SADC_PGA_VOL_LSB), + // bit18 - pga Internal voltage reference(0:750mV, 1:1.5V) + SADC_PGA_VREF_POS = 18, + SADC_PGA_VREF_750MV = (0 << SADC_PGA_VREF_POS), + SADC_PGA_VREF_1V5 = (1 << SADC_PGA_VREF_POS), +}; + +#define SADC_MIC_TRIM(val) ((val) << SADC_MIC_TRIM_LSB) +#define SADC_PGA_BIAS(val) ((val) << SADC_PGA_BIAS_LSB) +#define SADC_PGA_VOL(val) ((val) << SADC_PGA_VOL_LSB) + +// .MIC_PD=0, .MIC_VREF_SEL=1, .PGA_BIAS_SEL=1, .PGA_EN=1 +#define SADC_MIC_DFLT (SADC_PGA_VOL(0x1B) | SADC_PGA_BIAS(1) | SADC_MIC_TRIM(0x40) \ + | SADC_PGA_EN_BIT | SADC_PGA_VREF_1V5 | SADC_MIC_VREF_1V5) // 0x36502->0x77700 + +enum sadc_ctrl_bfs +{ + // bit0 - start of conversion + SADC_CR_SOC_POS = 0, + SADC_CR_SOC_BIT = (1 << SADC_CR_SOC_POS), + // bit1 - calibration mode + SADC_CR_CALIB_POS = 1, + SADC_CR_CALIB_BIT = (1 << SADC_CR_CALIB_POS), + + // bit2 - conversion mode(0-single, 1-continue) + SADC_CR_CONV_MODE_POS = 2, + SADC_CR_CONV_MODE_BIT = (1 << SADC_CR_CONV_MODE_POS), + SADC_CR_CONV_SINGLE = (0 << SADC_CR_CONV_MODE_POS), + SADC_CR_CONV_CONTINUE = (1 << SADC_CR_CONV_MODE_POS), + + // bit3 - DMA enable + SADC_CR_DMAEN_POS = 3, + SADC_CR_DMAEN_BIT = (1 << SADC_CR_DMAEN_POS), + + // bit4 - conversion at clk phase(0-negedge, 1-posedge) + SADC_CR_CLKPH_POS = 4, + SADC_CR_CLKPH_NEGEDGE = (0 << SADC_CR_CLKPH_POS), + SADC_CR_CLKPH_POSEDGE = (1 << SADC_CR_CLKPH_POS), + + // bit[6:5] - Sample mode + SADC_CR_SAMP_MODE_LSB = 5, + SADC_CR_SAMP_MODE_MSK = (0x03 << SADC_CR_SAMP_MODE_LSB), + SADC_CR_SAMP_SOFT = (0 << SADC_CR_SAMP_MODE_LSB), // software mode(normal mode) + SADC_CR_SAMP_RSSI = (1 << SADC_CR_SAMP_MODE_LSB), // RSSI sample mode( ADC controlled by BB) + SADC_CR_SAMP_PCM = (2 << SADC_CR_SAMP_MODE_LSB), // sample vioce data, must enable DMA + SADC_CR_SAMP_ADTMR = (3 << SADC_CR_SAMP_MODE_LSB), // SOC is from ADTIM adctrg + + // bit7 - write as 1 to stop decimation filter + SADC_CR_PCMEND_POS = 7, + SADC_CR_PCMEND_BIT = (1 << SADC_CR_PCMEND_POS), + + // bit[13:8] - delay time from rssi_req to SADC sample RSSI + SADC_CR_RSSI_DLY_LSB = 8, + SADC_CR_RSSI_DLY_MSK = (0x3F << SADC_CR_RSSI_DLY_LSB), + + // bit14 - DBG enable, configed as SADC analog IP + SADC_CR_DBGEN_POS = 14, + SADC_CR_DBGEN_BIT = (1 << SADC_CR_DBGEN_POS), + + // bit[19:16] - decimation filter high pass filter coef + SADC_CR_HPF_COEF_LSB = 16, + SADC_CR_HPF_COEF_MSK = (0x0F << SADC_CR_HPF_COEF_LSB), + // bit[29:20] - adc function clock = hclk / (sadc_aux_clk_div + 1) + SADC_CR_CLK_DIV_LSB = 20, + SADC_CR_CLK_DIV_MSK = (0x3FF << SADC_CR_CLK_DIV_LSB), +}; + +#define SADC_CR_HPF(coef) ((coef) << SADC_CR_HPF_COEF_LSB) +#define SADC_CR_CLK(div) ((div) << SADC_CR_CLK_DIV_LSB) + +#define SADC_CR_DFLT (SADC_CR_CLK(3) | SADC_CR_HPF(11) | SADC_CR_CLKPH_POSEDGE \ + | SADC_CR_SAMP_SOFT | SADC_CR_CONV_SINGLE) // 0x3B0010 + + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Init SADC Module. + * + * @param[in] ana_ctrl Bits field of value @see enum sadc_ana_ctrl. + **************************************************************************************** + */ +void sadc_init(uint32_t ana_ctrl); + +/** + **************************************************************************************** + * @brief Config SADC Module. + * + * @param[in] ctrl Bits field of value @see enum sadc_ctrl_bfs. + **************************************************************************************** + */ +void sadc_conf(uint32_t ctrl); + +/** + **************************************************************************************** + * @brief SADC read data. + * + * @param[in] chset Bits field of value @see enum sadc_chnl_set. + * @param[in] times Number of times sadc read. + * + * @return Multiple(times) averages. + **************************************************************************************** + */ +uint16_t sadc_read(uint8_t chset, uint16_t times); + +/** + **************************************************************************************** + * @brief Config SADC Support DMA. + * + * @param[in] sw_auto SADC auto chnl. + * @param[in] ch_ctrl Bits field of value @see enum sadc_chnl_set. + **************************************************************************************** + */ +void sadc_dma(uint8_t sw_auto, uint32_t ch_ctrl); + +/** + **************************************************************************************** + * @brief Config SADC Support PCM. + * + * @param[in] mic_sel Bits field of value @see enum sadc_mic_sel. + **************************************************************************************** + */ +void sadc_pcm(uint32_t mic_sel); + +/** + **************************************************************************************** + * @brief Config SADC Support ATMR. + * + * @param[in] sw_auto SADC auto chnl. + * @param[in] ch_ctrl Bits field of value @see enum sadc_chnl_set. + **************************************************************************************** + */ +void sadc_atmr(uint8_t sw_auto, uint32_t ch_ctrl); + +/** + **************************************************************************************** + * @brief Random Number Generated by SADC. + * + * @return Random Number. + **************************************************************************************** + */ +uint32_t sadc_rand_num(void); +#endif // _SADC_H_ diff --git a/drivers/api/spi.h b/drivers/api/spi.h new file mode 100644 index 0000000..514585d --- /dev/null +++ b/drivers/api/spi.h @@ -0,0 +1,239 @@ +/** + **************************************************************************************** + * + * @file spi.h + * + * @brief Header file - SPI Driver + * + **************************************************************************************** + */ + +#ifndef _SPI_H_ +#define _SPI_H_ + +#include +#include +#include "gpio.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Bits field of SPI master control @see SPIM_CTRL_TypeDef +enum spim_ctrl_bfs +{ + // clock rate = clk/2^(crat+1), 0-11 is supported + SPIM_CR_CLK_RATE_LSB = 0, + SPIM_CR_CLK_RATE_MSK = (0x0F << SPIM_CR_CLK_RATE_LSB), + + // clock phase -- 0: sck sample in 1st edge, 1: sck sample in 2nd edge + SPIM_CR_CLK_PHASE_BIT = (1 << 4), + // clock polarity -- 0: sck low in idle, 1: sck high in idle + SPIM_CR_CLK_POLAR_BIT = (1 << 5), + + // work mode -- 0: as mcu, 1: as dma mode + SPIM_CR_TX_DMA_BIT = (1 << 6), + SPIM_CR_RX_DMA_BIT = (1 << 7), + + // transfer mode -- 0: disable, 1: enable + SPIM_CR_INT_EN_BIT = (1 << 8), + SPIM_CR_TX_EN_BIT = (1 << 9), + SPIM_CR_RX_EN_BIT = (1 << 10), + + // bits order -- 0: LSB first, 1: MSB first + SPIM_CR_MSB_FST_BIT = (1 << 11), +}; + +#define SPIM_CR_DFLT (SPIM_CR_MSB_FST_BIT | SPIM_CR_RX_EN_BIT | SPIM_CR_TX_EN_BIT) + +enum spim_staclr_bfs +{ + SPIM_TXDAT_CLR_BIT = (1 << 0), + SPIM_RXDAT_CLR_BIT = (1 << 1), + SPIM_INTFLG_CLR_BIT = (1 << 2), + + SPIM_STATUS_CLR_ALL = 0x07, +}; + +#define SPIM_CS_H(pad) GPIO_DAT_SET(1UL << (pad)) +#define SPIM_CS_L(pad) GPIO_DAT_CLR(1UL << (pad)) + +#define SPIM_CS_INIT(pad) \ + dowl( \ + GPIO_DAT_SET(1UL << (pad)); \ + GPIO_DIR_SET(1UL << (pad)); \ + iom_ctrl(pad, IOM_SEL_GPIO); \ + ) + +/// Bits field of SPI slave control @see SPIS_CTRL_TypeDef +enum spis_ctrl_bfs +{ + // bits order -- 0: MSB first, 1: LSB first + SPIS_CR_LSB_FST_BIT = (1 << 0), + // clock polarity -- 0: sck low in idle, 1: sck high in idle + SPIS_CR_CLK_POLAR_BIT = (1 << 1), + // clock phase -- 0: sck sample in 1st edge, 1: sck sample in 2nd edge + SPIS_CR_CLK_PHASE_BIT = (1 << 2), + // transfer mode -- 0: disable, 1: enable + SPIS_CR_RX_EN_BIT = (1 << 3), + SPIS_CR_RXINT_EN_BIT = (1 << 4), + // work mode -- 0: as mcu, 1: as mode + SPIS_CR_TX_DMA_BIT = (1 << 5), + SPIS_CR_RX_DMA_BIT = (1 << 6), + // work enable -- 0: disable(spis lsbfst spol and spha can be configured only when it is 0) + SPIS_CR_RUN_EN_BIT = (1 << 7), + + // overtime window -- unit in bit width time + SPIS_CR_OT_WIN_LSB = 8, + SPIS_CR_OT_WIN_MSK = (0xFF << SPIS_CR_OT_WIN_LSB), + SPIS_CR_OT_EN_BIT = (1 << 16), + SPIS_CR_OTINT_EN_BIT = (1 << 17), +}; + +#define SPIS_CR_DFLT (SPIS_CR_RX_EN_BIT | SPIS_CR_RUN_EN_BIT) + +enum spis_infclr_bfs +{ + SPIS_RXOVER_CLR_BIT = (1 << 0), + SPIS_TXDAT_CLR_BIT = (1 << 1), + SPIS_RXDAT_CLR_BIT = (1 << 2), + SPIS_RXINT_CLR_BIT = (1 << 3), + SPIS_OTINT_CLR_BIT = (1 << 4), + + SPIS_INFO_CLR_ALL = 0x1F, +}; + + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Init SPI Master Module. + * + * @param[in] io_clk io used for SPI clk @see enum pad_idx. + * @param[in] io_miso io used for SPI miso @see enum pad_idx. + * @param[in] io_mosi io used for SPI mosi @see enum pad_idx. + * + * @note User Control CS IO. Macro SPIM_CS_H & SPIM_CS_L + **************************************************************************************** + */ +void spim_init(uint8_t io_clk, uint8_t io_miso, uint8_t io_mosi); + +/** + **************************************************************************************** + * @brief Config SPI Master. + * + * @param[in] ctrl Bits field of value @see enum spim_ctrl_bfs. + **************************************************************************************** + */ +void spim_conf(uint32_t ctrl); + +/** + **************************************************************************************** + * @brief SPI Master Begin. + * + * @param[in] data_len The number of byte transimit/receive from SPI. + **************************************************************************************** + */ +void spim_begin(uint16_t data_len); + +/** + **************************************************************************************** + * @brief SPI Master Wait Idle. + **************************************************************************************** + */ +void spim_wait(void); + +/** + **************************************************************************************** + * @brief SPI Master Duplex. + * + * @param[in] tx_data SPI transimit data pointer. + * @param[in] rx_buff SPI receive buff pointer. + * @param[in] data_len The number of byte receive from SPI. + **************************************************************************************** + */ +void spim_duplex(const uint8_t *tx_data, uint8_t *rx_buff, uint16_t data_len); + +/** + **************************************************************************************** + * @brief SPI Master transimit data. + * + * @param[in] tx_data SPI transimit data pointer. + * @param[in] data_len The number of byte transimit to SPI. + **************************************************************************************** + */ +void spim_transimit(const uint8_t *tx_data, uint16_t length); + +/** + **************************************************************************************** + * @brief SPI Master receive data. + * + * @param[in] rx_buff SPI receive buff pointer. + * @param[in] data_len The number of byte receive from SPI. + **************************************************************************************** + */ +void spim_receive(uint8_t *rx_buff, uint16_t length); + +/** + **************************************************************************************** + * @brief SPI Master Half-Duplex. + * + * @param[in] cmd SPI transimit data pointer. + * @param[in] clen The number of byte transimit to SPI. + * @param[in] rsp SPI receive buff pointer. + * @param[in] rlen The number of byte receive from SPI. + **************************************************************************************** + */ +void spim_halfdx(const uint8_t *cmd, uint16_t clen, uint8_t *rsp, uint16_t rlen); + + + +/** + **************************************************************************************** + * @brief Init SPI Slave Module. + * + * @param[in] io_cs io used for SPI cs @see enum pad_idx. + * @param[in] io_clk io used for SPI clk @see enum pad_idx. + * @param[in] io_miso io used for SPI miso @see enum pad_idx. + * @param[in] io_mosi io used for SPI mosi @see enum pad_idx. + **************************************************************************************** + */ +void spis_init(uint8_t io_cs, uint8_t io_clk, uint8_t io_miso, uint8_t io_mosi); + +/** + **************************************************************************************** + * @brief Config SPI Slave. + * + * @param[in] ctrl Bits field of value @see enum spis_ctrl_bfs. + **************************************************************************************** + */ +void spis_conf(uint32_t ctrl); + +/** + **************************************************************************************** + * @brief SPI Slave get the received data. + * + * @param[in] ch received data. + * + * @return true received data success. false received data failed. + **************************************************************************************** + */ +bool spis_getc(uint8_t *ch); + +/** + **************************************************************************************** + * @brief SPI Slave Transmits one byte data. + * + * @param[in] ch the data transmited + * + **************************************************************************************** + */ +void spis_putc(uint8_t ch); + +#endif // _SPI_H_ diff --git a/drivers/api/sysdbg.h b/drivers/api/sysdbg.h new file mode 100644 index 0000000..d5c0a64 --- /dev/null +++ b/drivers/api/sysdbg.h @@ -0,0 +1,189 @@ +/** + **************************************************************************************** + * + * @file sysdbg.h + * + * @brief Header file - system debug observation. + * + **************************************************************************************** + */ + +#ifndef _SYSDBG_H_ +#define _SYSDBG_H_ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +/// sysdbg[0:15] map PA02~05,PA08~19 +enum sysdbg_pio +{ + SYS_DBG_PIO00 = (1UL << 2), + SYS_DBG_PIO01 = (1UL << 3), + SYS_DBG_PIO02 = (1UL << 4), + SYS_DBG_PIO03 = (1UL << 5), + SYS_DBG_PIO04 = (1UL << 8), + SYS_DBG_PIO05 = (1UL << 9), + SYS_DBG_PIO06 = (1UL << 10), + SYS_DBG_PIO07 = (1UL << 11), + SYS_DBG_PIO08 = (1UL << 12), + SYS_DBG_PIO09 = (1UL << 13), + SYS_DBG_PIO10 = (1UL << 14), + SYS_DBG_PIO11 = (1UL << 15), + SYS_DBG_PIO12 = (1UL << 16), + SYS_DBG_PIO13 = (1UL << 17), + SYS_DBG_PIO14 = (1UL << 18), + SYS_DBG_PIO15 = (1UL << 19), + SYS_DBG_PIO_ALL = 0xFFF3C, + SYS_DBG_PIO_MSK = 0xFFF3C, +}; + +/// sysdbg selection +enum sysdbg_sel +{ + SYS_DBG_RF = 0, + SYS_DBG_BLE = 1, + SYS_DBG_MDM = 2, + SYS_DBG_USB = 3, +}; + +/// RF debug port +enum rf_dbg +{ + RF_DBG_TX = 1, + RF_DBG_RX = 2, + RF_DBG_CAL = 3, +}; + +/// Ble debug diagnose +enum ble_dbg +{ + BLE_DBG_TX = 0x0083, + BLE_DBG_RX = 0x8300, + BLE_DBG_TXRX = 0x8383, +}; + +/// Modem debug mode +enum mdm_dbg +{ + MDM_DBG1 = 1, + MDM_DBG2 = 2, + MDM_DBG3 = 3, + MDM_DBG_EXT_TX = 4, + MDM_DBG_EXT_RX = 5, +}; + +/// USB debug diagnose +enum usb_dbg +{ + USB_DBG1 = 1, + USB_DBG2 = 2, +}; + +/// Analog test en +enum ana_tst_en +{ + ATEN_AT0_BIT = 0x01, + ATEN_AT1_BIT = 0x02, + ATEN_AT0_AT1 = (ATEN_AT0_BIT | ATEN_AT1_BIT), + + ATEN_CBPF_BIT = 0x04, + ATEN_RSSI_BIT = 0x08, +}; + +/// AT0 AT1 selection +enum ana_tst_sel +{ + // AT0 Mux - bit[3:0] + AT0_SEL_LSB = 0, + AT0_VDD_IF = (0 << AT0_SEL_LSB), + AT0_BPF_IOP = (1 << AT0_SEL_LSB), + AT0_BPF_QOP = (2 << AT0_SEL_LSB), + AT0_VDD_PLL = (5 << AT0_SEL_LSB), + AT0_PLL_VCTRL = (6 << AT0_SEL_LSB), + AT0_LMT_OUTI = (10 << AT0_SEL_LSB), + AT0_PLL_FBCLK_DIV2 = (12 << AT0_SEL_LSB), + AT0_BPF_CAL_DONE = (14 << AT0_SEL_LSB), + AT0_SEL_MSK = (0x0F << AT0_SEL_LSB), + // AT1 Mux - bit[7:4] + AT1_SEL_LSB = 4, + AT1_VDD_TX = (0 << AT1_SEL_LSB), + AT1_BPF_ION = (1 << AT1_SEL_LSB), + AT1_BPF_QON = (2 << AT1_SEL_LSB), + AT1_VDD_RX = (5 << AT1_SEL_LSB), + AT1_VDD_VCO = (6 << AT1_SEL_LSB), + AT1_RSSI_OUT = (7 << AT1_SEL_LSB), + AT1_LMT_OUTQ = (10 << AT1_SEL_LSB), + AT1_PLL_LOCK = (13 << AT1_SEL_LSB), + AT1_AGC_POWER_DET = (15 << AT1_SEL_LSB), + AT1_SEL_MSK = (0x0F << AT1_SEL_LSB), +}; + + +/* + * MACRO ALIAS + **************************************************************************************** + */ + +// Init all debug pio +#define sys_dbg_init() sysdbg_iomap(SYS_DBG_PIO_ALL) + +// RF debug select, 'txrx' @see enum rf_dbg +#define rf_dbg_sel(txrx) sysdbg_select(SYS_DBG_RF, txrx) + +// BLE debug select, 'diag' @see enum ble_dbg +#define ble_dbg_sel(diag) sysdbg_select(SYS_DBG_BLE, diag) + +// Modem debug select, 'mode' @see enum mdm_dbg +#define mdm_dbg_sel(mode) sysdbg_select(SYS_DBG_MDM, mode) + +// AT0 AT1 enable CBPF observation +#define at0_at1_cbpf_out() sysdbg_anatst(ATEN_AT0_AT1|ATEN_CBPF_BIT, AT0_BPF_IOP|AT1_BPF_ION) + +// AT0 AT1 enable RSSI observation +#define at0_at1_rssi_out() sysdbg_anatst(ATEN_AT0_AT1|ATEN_RSSI_BIT, AT1_RSSI_OUT) + + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Map iopads for debug observation. + * + * @param[in] pio Bits of PAxx @see enum sysdbg_pio + * + **************************************************************************************** + */ +void sysdbg_iomap(uint32_t pio); + +/** + **************************************************************************************** + * @brief Select debug module to observe. + * + * @param[in] dbgsel Debug Selected @see enum sysdbg_sel + * @param[in] diag Mode Value @see enum rf_dbg or ble_dbg or mdm_dbg + * + **************************************************************************************** + */ +void sysdbg_select(uint8_t dbgsel, uint32_t diag); + +/** + **************************************************************************************** + * @brief Config AT0 AT1 for RF debug observation. + * + * @param[in] tsten Analog test bits @see enum ana_tst_en + * @param[in] atsel Selected func @see enum ana_tst_sel + * + **************************************************************************************** + */ +void sysdbg_anatst(uint8_t tsten, uint8_t atsel); + + +#endif // _SYSDBG_H_ diff --git a/drivers/api/timer.h b/drivers/api/timer.h new file mode 100644 index 0000000..799f922 --- /dev/null +++ b/drivers/api/timer.h @@ -0,0 +1,113 @@ +/** + **************************************************************************************** + * + * @file timer.h + * + * @brief Header file - Timers Driver + * + **************************************************************************************** + */ + +#ifndef _TIMER_H_ +#define _TIMER_H_ + +#include +#include "reg_timer.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +enum tmr_ctrl_bfs +{ + TMR_CR_CEN_BIT = (1 << 0), // Counter Enable + TMR_CR_UDIS_BIT = (1 << 1), // Update Disable + TMR_CR_URS_BIT = (1 << 2), // Update Request Source + TMR_CR_OPM_BIT = (1 << 3), // One Pluse Mode + TMR_CR_DIR_BIT = (1 << 4), // Direction + TMR_CR_CMS_LSB = 5, // Center-aligned Mode Select - bit[6:5] + TMR_CR_CMS_MSK = (0x3 << TMR_CR_CMS_LSB), + TMR_CR_ARPE_BIT = (1 << 7), // Auto-Reload Preload Enable + TMR_CR_CKD_LSB = 8, // Clock Division - bit[9:8] + TMR_CR_CKD_MSK = (0x3 << TMR_CR_CKD_LSB), + TMR_CR_CMPSEL_LSB = 10, // Compare input Select (Only ADTMR) - bit[11:10] + TMR_CR_CMPSEL_MSK = (0x3 << TMR_CR_CMPSEL_LSB), +}; + +enum tmr_intr_bfs +{ + TMR_IR_NONE = 0, + TMR_IR_UI_BIT = (1 << 0), // Update Interrupt + TMR_IR_CC1_BIT = (1 << 1), // Capture/Compare 1 Interrupt + TMR_IR_CC2_BIT = (1 << 2), // Capture/Compare 2 Interrupt + TMR_IR_CC3_BIT = (1 << 3), // Capture/Compare 3 Interrupt + TMR_IR_CC4_BIT = (1 << 4), // Capture/Compare 4 Interrupt + TMR_IR_COM_BIT = (1 << 5), // COM Interrupt + TMR_IR_TI_BIT = (1 << 6), // Trigger Interrupt + TMR_IR_BI_BIT = (1 << 7), // Break Interrupt + + TMR_IR_CC1O_BIT = (1 << 9), // Capture/Compare 1 Overcapture + TMR_IR_CC2O_BIT = (1 << 10), // Capture/Compare 2 Overcapture + TMR_IR_CC3O_BIT = (1 << 11), // Capture/Compare 3 Overcapture + TMR_IR_CC4O_BIT = (1 << 12), // Capture/Compare 4 Overcapture +}; + +enum tmr_mode_def +{ + TMR_DISABLE = 0, + TMR_1PULSE_MODE = (TMR_CR_CEN_BIT | TMR_CR_URS_BIT | TMR_CR_OPM_BIT), + TMR_PERIOD_MODE = (TMR_CR_CEN_BIT | TMR_CR_ARPE_BIT), +}; + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Init Common Timer + * + * @param[in] psc configure prescaler + * @param[in] arr configure Auto-reload + * + **************************************************************************************** + */ +void ctmr_init(uint16_t psc, uint16_t arr); + +/** + **************************************************************************************** + * @brief Common Timer control + * + * @param[in] mode Work Mode configure @see enum tmr_mode_def + * @param[in] intr Interrupt configure @see enum tmr_intr_bfs + * + **************************************************************************************** + */ +void ctmr_ctrl(uint16_t mode, uint16_t intr); + +/** + **************************************************************************************** + * @brief Init Advance Timer + * + * @param[in] psc configure prescaler + * @param[in] arr configure Auto-reload + * + **************************************************************************************** + */ +void adtmr_init(uint16_t psc, uint16_t arr); + +/** + **************************************************************************************** + * @brief Advance Timer control + * + * @param[in] mode Work Mode configure @see enum tmr_mode_def + * @param[in] intr Interrupt configure @see enum tmr_intr_bfs + * + **************************************************************************************** + */ +void adtmr_ctrl(uint16_t mode, uint16_t intr); + +#endif // _TIMER_H_ diff --git a/drivers/api/trim.h b/drivers/api/trim.h new file mode 100644 index 0000000..de7a304 --- /dev/null +++ b/drivers/api/trim.h @@ -0,0 +1,33 @@ +#ifndef TRIM_H_ +#define TRIM_H_ + +#include + +/** + **************************************************************************************** + * @brief Load FT Trim. + * + **************************************************************************************** + */ +void trim_load(void); + +/** + **************************************************************************************** + * @brief Get RC16M Freq. + * + * @return rc16m freq(unit:Hz). + * @note 0 is invalid freq. + **************************************************************************************** + */ +uint32_t get_trim_rc16m_freq(void); + +/** + **************************************************************************************** + * @brief Get VDD12 Voltage. + * + * @return vdd12 voltage(unit:mv). + * @note 0 is invalid voltage. + **************************************************************************************** + */ +uint32_t get_trim_vdd12_voltage(void); +#endif // TRIM_H_ diff --git a/drivers/api/uart.h b/drivers/api/uart.h new file mode 100644 index 0000000..007515e --- /dev/null +++ b/drivers/api/uart.h @@ -0,0 +1,277 @@ +/** + **************************************************************************************** + * + * @file uart.h + * + * @brief Header file - UART Driver + * + **************************************************************************************** + */ + +#ifndef _UART_H_ +#define _UART_H_ + +#include +#include "rcc.h" +#include "reg_uart.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Number of Uart port +enum uart_port +{ + UART1_PORT = 0, + UART2_PORT = 1, +}; + +/// Bits field of line control @see UART_LCR_TypeDef +enum uart_lcr_bfs +{ + // data length select - bit[1:0] + LCR_DATA_BITS_LSB = 0, + LCD_DATA_BITS_8 = (0x03 << LCR_DATA_BITS_LSB), + LCD_DATA_BITS_7 = (0x02 << LCR_DATA_BITS_LSB), + LCD_DATA_BITS_6 = (0x01 << LCR_DATA_BITS_LSB), + LCD_DATA_BITS_5 = (0x00 << LCR_DATA_BITS_LSB), + + // stop bits select - bit[2] + LCR_STOP_BITS_LSB = 2, + LCR_STOP_BITS_1 = (0x00 << LCR_STOP_BITS_LSB), + LCR_STOP_BITS_2 = (0x01 << LCR_STOP_BITS_LSB), + + // parity mode select - bit[4:3] + LCR_PARITY_BITS_LSB = 3, + LCR_PARITY_none = (0x00 << LCR_PARITY_BITS_LSB), + LCR_PARITY_odd = (0x01 << LCR_PARITY_BITS_LSB), + LCR_PARITY_even = (0x03 << LCR_PARITY_BITS_LSB), + + // uart receive enable - bit5 + LCR_RXEN_BIT = (1 << 5), + // receive time out enable - bit8 + LCR_RTOEN_BIT = (1 << 8), +}; + +/// Bits field of fifo control @see UART_FCR_TypeDef +enum uart_fcr_bfs +{ + // fifo enable - bit0 + FCR_FIFOEN_BIT = (1 << 0), + // rx fifo reset - bit1 + FCR_RFRST_BIT = (1 << 1), + // tx fifo reset - bit2 + FCR_TFRST_BIT = (1 << 2), + + // rx fifo trigger level - bit[5:4] + FCR_RXTL_LSB = 4, + FCR_RXTL_1BYTE = (0 << FCR_RXTL_LSB), + FCR_RXTL_4BYTE = (1 << FCR_RXTL_LSB), + FCR_RXTL_8BYTE = (2 << FCR_RXTL_LSB), + FCR_RXTL_14BYTE = (3 << FCR_RXTL_LSB), + + // tx fifo trigger level - bit[7:6] + FCR_TXTL_LSB = 6, + FCR_TXTL_1BYTE = (0 << FCR_TXTL_LSB), + FCR_TXTL_4BYTE = (1 << FCR_TXTL_LSB), + FCR_TXTL_8BYTE = (2 << FCR_TXTL_LSB), + FCR_TXTL_14BBYTE = (3 << FCR_TXTL_LSB), +}; + +/// Bits field of uart status @see UART_SR_TypeDef +enum uart_sr_bfs +{ + UART_SR_DR_BIT = (1 << 0), // data ready + UART_SR_OE_BIT = (1 << 1), // overrun error + UART_SR_PE_BIT = (1 << 2), // parity error + UART_SR_FE_BIT = (1 << 3), // framing error + UART_SR_BF_BIT = (1 << 4), // break interrupt + UART_SR_TBEM_BIT = (1 << 5), // transmit buffer register empty + UART_SR_TEM_BIT = (1 << 6), // transmitter empty + UART_SR_RFE_BIT = (1 << 7), // receiver fifo data error + UART_SR_BUSY_BIT = (1 << 8), // uart busy + UART_SR_TFNF_BIT = (1 << 9), // transmit fifo not full + UART_SR_TFEM_BIT = (1 << 10), // transmit fifo empty + UART_SR_RFNE_BIT = (1 << 11), // receive fifo not empty + UART_SR_RFF_BIT = (1 << 12), // receive fifo full + UART_SR_DCTS_BIT = (1 << 13), // delta clear to send + UART_SR_CTS_BIT = (1 << 14), // clear to send + + UART_SR_ALL_MSK = (0x7FFF), // bit[14:0] +}; + +/// Bits field of uart interrupt @see UART_IER_TypeDef +enum uart_intr_bfs +{ + UART_IR_RXRD_BIT = (1 << 0), // receive data available interrupt enable status + UART_IR_TXS_BIT = (1 << 1), // thr empty interrupt enable status + UART_IR_RXS_BIT = (1 << 2), // receiver line status interrupt enable status + UART_IR_MDS_BIT = (1 << 3), // modem status interrupt enable status + UART_IR_RTO_BIT = (1 << 4), // receiver timeout enable status + UART_IR_BUSY_BIT = (1 << 5), // busy detect interrupt enable status + UART_IR_ABE_BIT = (1 << 6), // auto baud rate end interrupt enable status + UART_IR_ABTO_BIT = (1 << 7), // auto baud rate timeout interrupt enable status + UART_IR_LINBK_BIT = (1 << 8), // lin break detection interrupt enable status + UART_IR_TC_BIT = (1 << 9), // transmission complete interrupt enable status + UART_IR_EOB_BIT = (1 << 10), // end of block interrupt enable status + UART_IR_CM_BIT = (1 << 11), // character match interrupt enable status + + UART_IR_ALL_MSK = (0x0FFF), // bit[11:0] +}; + + +/* + * MACROS DECLARATION + **************************************************************************************** + */ + +/// Macro for uart line-control bits configure +/// @param[in] _dbit data bits value in[8, 7, 6, 5] +/// @param[in] _sbit stop bits value in[1, 2] +/// @param[in] _pbit parity mode value in[none, odd, even] +/// @return the value of the line-control bits @see enum uart_lcr_bfs +#define LCR_BITS(_dbit, _sbit, _pbit) \ + ((uint16_t)(LCD_DATA_BITS_##_dbit | LCR_STOP_BITS_##_sbit | LCR_PARITY_##_pbit)) + +/// Macro for uart baudrate divider configure (manual input sysclk_freq) +/// @param[in] _baud baudrate value, eg. 115200 +/// @param[in] _freq sysclk freq name in[16M, 32M, 48M, 64M] @see enum sys_clk_freq +/// @return the value of the BRR +#define BRR_DIV(_baud, _freq) \ + ((uint16_t)((SYS_FREQ_##_freq + ((_baud) >> 1)) / (_baud))) + +/// Macro for uart baudrate divider configure (auto get sysclk_freq, more size) +/// @param[in] _baud baudrate value, eg. 115200 +/// @return the value of the BRR +#define BRR_BAUD(_baud) \ + ((uint16_t)((rcc_sysclk_freq() + ((_baud) >> 1)) / (_baud))) + +/// Common uart params to easy call +#define LCR_BITS_DFLT LCR_BITS(8, 1, none) // default: 8 DataBits, 1 StopBits, None Parity + +#if (SYS_CLK == 1) +#define BRR_115200 BRR_DIV(115200, 32M) // default use SYS_FREQ_32M +#define BRR_921600 BRR_DIV(921600, 32M) // default use SYS_FREQ_32M +#elif (SYS_CLK == 2) +#define BRR_115200 BRR_DIV(115200, 48M) // default use SYS_FREQ_48M +#define BRR_921600 BRR_DIV(921600, 48M) // default use SYS_FREQ_48M +#elif (SYS_CLK == 3) +#define BRR_115200 BRR_DIV(115200, 64M) // default use SYS_FREQ_64M +#define BRR_921600 BRR_DIV(921600, 64M) // default use SYS_FREQ_64M +#else +#define BRR_115200 BRR_DIV(115200, 16M) // default use SYS_FREQ_16M +#define BRR_921600 BRR_DIV(921600, 16M) // default use SYS_FREQ_16M +#endif //SYS_CLK + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Init uart port (enable clock, reset, IO func map) + * + * @param[in] port uart port @see enum uart_port + * @param[in] io_tx iopad of TXD @see enum pad_idx + * @param[in] io_rx iopad of RXD @see enum pad_idx + * + **************************************************************************************** + */ +void uart_init(uint8_t port, uint8_t io_tx, uint8_t io_rx); + +/** + **************************************************************************************** + * @brief Config uart hardware flow control (IO func map, enable auto RTS) + * + * @param[in] port uart port @see enum uart_port + * @param[in] io_rts iopad of RTS @see enum pad_idx + * @param[in] io_cts iopad of CTS @see enum pad_idx + * + **************************************************************************************** + */ +void uart_hwfc(uint8_t port, uint8_t io_rts, uint8_t io_cts); + +/** + **************************************************************************************** + * @brief Config uart params, baudrate and ctrl bits + * + * @param[in] port index of port @see enum uart_port + * @param[in] cfg_BRR baudrate divider @see BRR_DIV() or BRR_BAUD() + * @param[in] cfg_LCR line-control bits @see LCR_BITS() + * + **************************************************************************************** + */ +void uart_conf(uint8_t port, uint16_t cfg_BRR, uint16_t cfg_LCR); + +/** + **************************************************************************************** + * @brief Config uart fifo level and receive timeout + * + * @param[in] port index of port @see enum uart_port + * @param[in] fifo_ctl fifo control @see enum uart_fcr_bfs + * @param[in] bits_rto rx timeout (unit in bits) + * @param[in] intr_en interrupt enable @see enum uart_intr_bfs + * + **************************************************************************************** + */ +void uart_fctl(uint8_t port, uint8_t fifo_ctl, uint16_t bits_rto, uint16_t intr_en); + +/** + **************************************************************************************** + * @brief Config uart mode control + * + * @param[in] port index of port @see enum uart_port + * @param[in] dma enable DMA or not + * + **************************************************************************************** + */ +void uart_mctl(uint8_t port, uint8_t dma); + +/** + **************************************************************************************** + * @brief Transmits one byte data through the UART port + * + * @param[in] port index of port @see enum uart_port + * @param[in] ch the data transmited + * + **************************************************************************************** + */ +void uart_putc(uint8_t port, uint8_t ch); + +/** + **************************************************************************************** + * @brief Get the most recent received data by UART port + * + * @param[in] port index of port @see enum uart_port + * + * @return received data + **************************************************************************************** + */ +uint8_t uart_getc(uint8_t port); + +/** + **************************************************************************************** + * @brief Wait uart transmit finish, in idle state + * + * @param[in] port index of port @see enum uart_port + * + **************************************************************************************** + */ +void uart_wait(uint8_t port); + +/** + **************************************************************************************** + * @brief Transmits bytes data through the UART port(Blocking Mode) + * + * @param[in] port index of port @see enum uart_port + * @param[in] len data length + * @param[in] data data pointer + * + **************************************************************************************** + */ +void uart_send(uint8_t port, uint16_t len, const uint8_t *data); + +#endif //_UART_H_ diff --git a/drivers/lib/drvs.lib b/drivers/lib/drvs.lib new file mode 100644 index 0000000..0c25c01 Binary files /dev/null and b/drivers/lib/drvs.lib differ diff --git a/drivers/src/btmr.c b/drivers/src/btmr.c new file mode 100644 index 0000000..912e293 --- /dev/null +++ b/drivers/src/btmr.c @@ -0,0 +1,113 @@ +#include "btmr.h" +#include "reg_rcc.h" + + +#define CR1_ONE_MODE (0x0C) // one-time mode .URS=1(bit2), .OPM=1(bit3) + + +// timeout = arr * 1ms +void timeOutMsInit(uint16_t arr) +{ + RCC->APBCLK_EN_RUN.BSTIM1_CLKEN_RUN = 1; + BTMR->CR1.CEN = 0; // Add Disable BSTIM + BTMR->PSC = 15999; // + BTMR->ARR = (uint32_t)arr; + BTMR->CR1.OPM = 1; + BTMR->CR1.ARPE = 1; + BTMR->EGR = 1; + BTMR->CR1.CEN = 1; + BTMR->ICR = 1; +} + + +#if 0 +void btmrConfig(void) +{ + RCC->APBCLK_EN_RUN.BSTIM1_CLKEN_RUN = 1; + + BTMR->CR1.Word = 0; + //BTMR->PSC = 15; + BTMR->ARR = 65535; + // update enable + BTMR->CR1.URS = 1; + BTMR->CR1.OPM = 1; + //BTMR->CR1.UDIS = 1; + // interrupt enable + //BTMR->IER.Word = 1; + //BTMR->ICR.Word = 1; + //__enable_irq(); + //NVIC_EnableIRQ(BTMR_IRQn); +} + +#if 0 +uint32_t ustime = 0; +void BTMR_IRQHandler(void) +{ + // clear interrupt + BTMR->IDR.Word = 1; + BTMR->ICR.Word = 1; + if (ustime > 0) + ustime--; + BTMR->IER.Word = 1; +} +#endif +void bootDelayUs(uint32_t us) +{ + BTMR->PSC = 15; + BTMR->EGR = 1; + BTMR->CNT = 65535-us+1; + BTMR->CR1.CEN = 1; + while(!BTMR->RIF); + BTMR->ICR = 1; + BTMR->CR1.CEN = 0; +} + +void bootDelayMs(uint32_t ms) +{ + BTMR->PSC = 15999; + BTMR->EGR = 1; + BTMR->CNT = 65535-ms+1; + BTMR->CR1.CEN = 1; + while(!BTMR->RIF); + BTMR->ICR = 1; + BTMR->CR1.CEN = 0; +} + +#endif + +void btmr_delay(uint16_t tpsc, uint16_t tcnt) +{ + // config Params + BTMR->CR1.Word = CR1_ONE_MODE; + BTMR->PSC = tpsc - 1; + BTMR->ARR = tcnt - 1; + BTMR->CNT = 0; + BTMR->EGR = 1; + + // enable CEN, wait Time-Reach + BTMR->CR1.CEN = 1; + while(!BTMR->RIF && BTMR->CR1.CEN); + BTMR->ICR = 1; + + // clear Mode + BTMR->CR1.Word = 0; +} + +#include "b6x.h" + +void tick_delay(uint16_t tpsc, uint16_t tcnt) +{ + uint32_t temp; + + SysTick->LOAD = tcnt * tpsc - 1; + SysTick->VAL = 0x00; + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk; + + do + { + temp = SysTick->CTRL; + } while((temp & SysTick_CTRL_ENABLE_Msk) && !(temp & SysTick_CTRL_COUNTFLAG_Msk)); + + SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk; + SysTick->VAL = 0x00; +} diff --git a/drivers/src/dma.c b/drivers/src/dma.c new file mode 100644 index 0000000..bef3805 --- /dev/null +++ b/drivers/src/dma.c @@ -0,0 +1,192 @@ +/** + **************************************************************************************** + * + * @file dma.c + * + * @brief Direct Memory Access(DMA) Driver + * + **************************************************************************************** + */ + +#include "dma.h" +#include "rcc.h" +#include "reg_dma.h" +#include "reg_dmachcfg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +#define DMA_CFG_EN_BIT (1 << 0) // bit0 master_enable +#define DMA_CFG_HPROT(bits) ((bits) << 5) // bit[7:5] chnl_prot_ctrl + +#define DMA_CHNL_CTRL(chidx) (DMA_CHNL_CTRL_Typedef *)(DMA->CTRLBASE_POINTER.Word + ((chidx) * sizeof(DMA_CHNL_CTRL_Typedef))) + + +/// The amount of system memory that you must assign to the controller depends on the +/// number of DMA channels and whether you configure it to use the alternate data structure. +/// Contains: 1ch-0x20, 2chs-0x40, 3~4chs-0x80, 5~8chs-0x100, 9~16chs-0x200, 17~32chs-0x400 +__attribute__((section("DMA_ALIGN"), aligned(0x100), zero_init)) +volatile DMA_CHNL_CTRL_STRUCT_Typedef dma_ctrl_base; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +void dma_init(void) +{ + // clk_en rst_req + RCC_APBCLK_EN(APB_DMAC_BIT); + RCC_APBRST_REQ(APB_DMAC_BIT); + + // dma base addr + DMA->CTRLBASE_POINTER.Word = (uint32_t)&dma_ctrl_base; + + // dma enable + DMA->CFG.Word = DMA_CFG_HPROT(7) | DMA_CFG_EN_BIT; +} + +void dma_deinit(void) +{ + // dma disable + DMA->CFG.Word = 0; + DMA->CTRLBASE_POINTER.Word = 0; +} + +void dma_chnl_init(uint8_t chidx, uint8_t chsel) +{ + // Channel primary set, select function + if (chidx < DMA_CH_MAX) + { + // dma disable signal translation + DMA->USEBURST_SET = (1UL << chidx); + // close the mask of request for channel + DMA->REQMSK_CLR = (1UL << chidx); + + // config dma reuse function + uint8_t arr = (chidx / 4); + uint8_t lsh = (chidx % 4) * 8; // 6 of 8bit + DMACHCFG->CHSEL[arr] = (DMACHCFG->CHSEL[arr] & ~(0x3FUL << lsh)) | ((uint32_t)chsel << lsh); + } +} + +void dma_chnl_deinit(uint8_t chidx) +{ + uint32_t chbit = 1UL << (chidx % DMA_CH_MAX); + + DMA->CHNL_EN_CLR = chbit; + // dma disable signal translation + DMA->USEBURST_SET = (1UL << chidx); + // close the mask of request for channel + DMA->REQMSK_CLR = (1UL << chidx); +} + +void dma_chnl_conf(uint8_t chidx, uint32_t src_ep, uint32_t dst_ep, uint32_t trans) +{ + DMA_CHNL_CTRL_Typedef *chnl_cur = DMA_CHNL_CTRL(chidx); + + // Channel primary set, select function + // done in dma_chnl_init(chidx, chsel); + + // Channel control fill + chnl_cur->SRC_DATA_END_PTR = src_ep; + chnl_cur->DST_DATA_END_PTR = dst_ep; + chnl_cur->TRANS_CFG_DATA.Word = trans; + chnl_cur->TRANS_CFG_RESV.Word = trans; + + DMA->CHNL_EN_SET = 1UL << (chidx % DMA_CH_MAX); +} + +bool dma_chnl_reload(uint8_t chidx) +{ + DMA_CHNL_CTRL_Typedef *chnl_cur; + + chidx = chidx % DMA_CH_MAX; // Pri Channel + + bool alter = (DMA->PRIALT_SET & (1UL << chidx)) ? true : false; + + chnl_cur = DMA_CHNL_CTRL(chidx); + + if (chnl_cur->TRANS_CFG_RESV.CYCLE_CTRL != CCM_PING_PONG) + { + chnl_cur->TRANS_CFG_DATA = chnl_cur->TRANS_CFG_RESV; + } + else + { + #if (1) + if (chnl_cur->TRANS_CFG_DATA.CYCLE_CTRL == CCM_STOP) + { + chnl_cur->TRANS_CFG_DATA = chnl_cur->TRANS_CFG_RESV; + } + + chnl_cur = DMA_CHNL_CTRL(chidx | DMA_CH_ALT); + if (chnl_cur->TRANS_CFG_DATA.CYCLE_CTRL == CCM_STOP) + { + chnl_cur->TRANS_CFG_DATA = chnl_cur->TRANS_CFG_RESV; + } + #else + if (DMA->PRIALT_SET & (1UL << chidx)) + { + chnl_cur->TRANS_CFG_DATA = chnl_cur->TRANS_CFG_RESV; + } + else + { + DMA_CHNL_CTRL_Typedef *chnl_alt = DMA_CHNL_CTRL(chidx | DMA_CH_ALT); + chnl_alt->TRANS_CFG_DATA = chnl_alt->TRANS_CFG_RESV; + } + #endif + } + + DMA->CHNL_EN_SET = (1UL << chidx); + return alter; +} + +uint16_t dma_chnl_remain(uint8_t chidx) +{ + DMA_CHNL_CTRL_Typedef *chnl_cur = DMA_CHNL_CTRL(chidx); + + if (chnl_cur->TRANS_CFG_DATA.CYCLE_CTRL) + return (chnl_cur->TRANS_CFG_DATA.N_MINUS_1 + 1); + else + return 0; +} + +void dma_chnl_ctrl(uint8_t chidx, uint8_t ctrl) +{ + uint32_t chbit = 1UL << (chidx % DMA_CH_MAX); + + if (ctrl) + { + DMA->CHNL_EN_SET = chbit; + + if (ctrl == CHNL_DONE) + { + while ((DMACHCFG->IFLAG0 & chbit) == 0); + DMACHCFG->ICFR0 = chbit; + } + } + else + { + DMA->CHNL_EN_CLR = chbit; + } +} + +bool dma_chnl_done(uint8_t chidx) +{ + uint32_t chbit = 1UL << (chidx % DMA_CH_MAX); + + if (DMACHCFG->IFLAG0 & chbit) + { + // clear done, *DMA->CHNL_EN auto be cleared* + DMACHCFG->ICFR0 = chbit; + return true; + } + else + { + return false; + } +} diff --git a/drivers/src/exti.c b/drivers/src/exti.c new file mode 100644 index 0000000..498f8a7 --- /dev/null +++ b/drivers/src/exti.c @@ -0,0 +1,31 @@ +/** + **************************************************************************************** + * + * @file exti.c + * + * @brief EXTI Config + * + **************************************************************************************** + */ + +#include "exti.h" +#include "rcc.h" +#include "reg_exti.h" + +void exti_init(uint16_t debounce) +{ + RCC_APBCLK_EN(APB_EXTI_BIT); + RCC_APBRST_REQ(APB_EXTI_BIT); + + EXTI->DBC.Word = debounce; +} + +void exti_set(uint8_t typ, uint32_t loca) +{ + (*(volatile uint32_t*)(EXTI_BASE + typ * 4)) = loca; +} + +uint32_t exti_get(uint8_t typ) +{ + return (*(volatile uint32_t*)(EXTI_BASE + typ * 4)); +} diff --git a/drivers/src/fshc.c b/drivers/src/fshc.c new file mode 100644 index 0000000..5237da4 --- /dev/null +++ b/drivers/src/fshc.c @@ -0,0 +1,274 @@ +/** + **************************************************************************************** + * + * @file flash.c + * + * @brief flash Driver + * + **************************************************************************************** + */ +#include "drvs.h" +#include "regs.h" + +/* + * DEFINES + **************************************************************************************** + */ +#ifdef __SRAMFN +#undef __SRAMFN +#endif +#define __SRAMFN(line) __attribute__((section("ram_func.fshc." #line))) + +#define FLASH_PAGE_SIZE 256 +/// PUYA wait complete +#define FSH_CMD_RD_STA0 0x05 +#define FSH_FLAG_WEL_WIP 0x03 // bit0: WEL, bit1: WIP + +#define FSHC_WAIT_COMPLETE() while (fshc_rd_sta(FSH_CMD_RD_STA0, 1) & FSH_FLAG_WEL_WIP) + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ +__SRAMFN(33) +void puya_enter_dual_read(void) +{ + if (FSHC->BYPASS_HPM == 0) + return; + + bool cache_en = (CACHE->CCR.Word); + CACHE->CCR.Word = 0; + CACHE->CIR.INV_ALL = 1; + + GLOBAL_INT_DISABLE(); + + fshc_xip_conf(FSH_CMD_DLRD_HMP, IBUS_DL_1DUMY, IBUS_DLRD_HPM); + fshc_hpm_conf(true, 0x20, 0x10); + + GLOBAL_INT_RESTORE(); + + if (cache_en) + { + CACHE->CCR.Word = 1; + } +} + +__SRAMFN(56) +void puya_exit_dual_read(void) +{ + if (FSHC->BYPASS_HPM == 1) + return; + + bool cache_en = (CACHE->CCR.Word); + CACHE->CCR.Word = 0; + CACHE->CIR.INV_ALL = 1; + + GLOBAL_INT_DISABLE(); + fshc_hpm_conf(false, 0x01, 0x10); + fshc_xip_conf(FSH_CMD_RD, IBUS_SI_0DUMY, IBUS_SIRD_CFG); + GLOBAL_INT_RESTORE(); + + if (cache_en) + { + CACHE->CCR.Word = 1; + } +} + +__SRAMFN(77) +void boya_flash_quad_mode(void) +{ + uint8_t sta_reg1 = fshc_rd_sta(FSH_CMD_RD_STA1, 1); + + if ((sta_reg1 & 0x02) != 0x02) + { + uint8_t sys_clk = (rcc_sysclk_get() + 1) << 4; + + sta_reg1 |= 0x02; + + // write en singal + fshc_en_cmd(FSH_CMD_WR_EN); + + // send write sta cmd + fshc_wr_sta(0x31/*FSH_CMD_WR_STA*/, 1, sta_reg1); + + // Write Status Register Cycle Time, Max=12ms + btmr_delay(sys_clk, 12000); + } +} + +__SRAMFN(99) +void flash_write(uint32_t offset, uint32_t *data, uint32_t wlen) +{ + GLOBAL_INT_DISABLE(); + + while (SYSCFG->ACC_CCR_BUSY); + + fshc_write(offset, data, wlen, FSH_CMD_WR); + + GLOBAL_INT_RESTORE(); +} + +__SRAMFN(111) +void flash_page_erase(uint32_t offset) +{ + GLOBAL_INT_DISABLE(); + + while (SYSCFG->ACC_CCR_BUSY); + + fshc_erase(offset, FSH_CMD_ER_PAGE); + + GLOBAL_INT_RESTORE(); +} + +__SRAMFN(123) +void flash_byte_write(uint32_t offset, uint8_t *data, uint32_t blen) +{ + flen_t wrcnt = 0; + uint32_t wr_val = 0; + + GLOBAL_INT_DISABLE(); + + while (SYSCFG->ACC_CCR_BUSY); + +#if (0) +/// fshc cmd mode +#define FCM_GET_CMD(fcmd) (((fcmd) & FCM_CMD_MSK) >> FCM_CMD_LSB) +#define FCM_GET_MODE(fcmd) (((fcmd) & FCM_MODE_MSK) >> FCM_MODE_LSB) + uint8_t wr_cmd = FCM_GET_CMD(FSH_CMD_WR); + uint8_t ln_mod = FCM_GET_MODE(FSH_CMD_WR); + uint16_t wr_ctrl = SCTRL_WR_DAT(ln_mod); + + fshc_en_cmd(FSH_CMD_WR_EN); + fshc_wr_cfg(wr_cmd, offset, len, wr_ctrl, ACBIT_SI_0DUMY); +#else + fshc_en_cmd(FSH_CMD_WR_EN); + fshc_wr_cfg(FSH_CMD_WR, offset, FLASH_PAGE_SIZE, 0x0354, ACBIT_SI_0DUMY); +#endif + + // first fill word, then enable send + while (FSHC->FIFO_STATUS.TXFIFO_FULL); + xmemcpy((uint8_t *)&wr_val, data + wrcnt, 4); + FSHC->SPDR_WR = wr_val; + FSHC->SEND_EN = 1; + wrcnt += 4; + + // fill next data + while (wrcnt < blen) + { + if (!FSHC->FIFO_STATUS.TXFIFO_FULL) + { + xmemcpy((uint8_t *)&wr_val, data + wrcnt, 4); + FSHC->SPDR_WR = wr_val; + wrcnt += 4; + } + } + + while (wrcnt < FLASH_PAGE_SIZE) + { + if (!FSHC->FIFO_STATUS.TXFIFO_FULL) + { + FSHC->SPDR_WR = 0xFFFFFFFF; + wrcnt += 4; + } + } + + FSHC_WAIT_COMPLETE(); + + GLOBAL_INT_RESTORE(); +} + +__SRAMFN(180) +void flash_byte_read(uint32_t offset, uint8_t *buff, uint32_t blen) +{ + flen_t rdcnt = 0; + uint32_t rd_val = 0, algned4_len = ((blen >> 2) << 2); + uint32_t remain_len = (blen - algned4_len); + + GLOBAL_INT_DISABLE(); + + // wait cache idle + while (SYSCFG->ACC_CCR_BUSY); + +#if (0) +/// fshc cmd mode +#define FCM_GET_CMD(fcmd) (((fcmd) & FCM_CMD_MSK) >> FCM_CMD_LSB) +#define FCM_GET_MODE(fcmd) (((fcmd) & FCM_MODE_MSK) >> FCM_MODE_LSB) + uint8_t rd_cmd = FCM_GET_CMD(FSH_CMD_RD); + uint8_t ln_mod = FCM_GET_MODE(FSH_CMD_RD); + + uint16_t rd_ctrl = SCTRL_RD_DAT(ln_mod); + // OTP | (Dual or Quad) use 1DUMY + uint16_t rd_acbit = (FSH_CMD_RD & (FCM_RWOTP_BIT | (2 << FCM_MODE_LSB))) ? ACBIT_SI_1DUMY : ACBIT_SI_0DUMY; + + fshc_rd_cfg(rd_cmd, offset, len, rd_ctrl, rd_acbit); +#else + fshc_rd_cfg(FSH_CMD_RD, offset, blen, 0x0394, 0x01D7); +#endif + + while (rdcnt < algned4_len) + { + if (!FSHC->FIFO_STATUS.RXFIFO_EMPTY) + { + rd_val = FSHC->SPDR_RD; + + xmemcpy(buff + rdcnt, &rd_val, 4); + + rdcnt += 4; + } + } + + if ((remain_len) && (!FSHC->FIFO_STATUS.RXFIFO_EMPTY)) + { + rd_val = FSHC->SPDR_RD; + + xmemcpy(buff + rdcnt, &rd_val, remain_len); + + rdcnt += remain_len; + } + + GLOBAL_INT_RESTORE(); +} + +__SRAMFN(232) +void flash_read(uint32_t offset, uint32_t *buff, uint32_t wlen) +{ + GLOBAL_INT_DISABLE(); + + while (SYSCFG->ACC_CCR_BUSY); + + fshc_read(offset, buff, wlen, FSH_CMD_RD); + + GLOBAL_INT_RESTORE(); +} + +#if (0) +#define ERASE_MODE_MAX 4 +const uint8_t ERASE_CMD[ERASE_MODE_MAX] = +{ + /*ERASE_PAGE = */0x81, + /*ERASE_SECTOR = */0x20, + /*ERASE_BLOCK32 = */0x52, + /*ERASE_BLOCK64 = */0xD8, +}; + +const uint8_t PER_SIZE[ERASE_MODE_MAX] = +{ + 8, // Page Size 256Bytes + 12, // Sector Size 4KBytes + 15, // Block Size 32KBytes + 16, // Block Size 64KBytes +}; + +__SRAMFN(262) +void flash_multi_erase(uint8_t erase_mode, uint32_t idx, uint32_t cnt) +{ + while (SYSCFG->ACC_CCR_BUSY); + + for (uint16_t i = 0; i < cnt; i++) + { + fshc_erase((idx << PER_SIZE[erase_mode]), ERASE_CMD[erase_mode]); + + ++idx; + } +} +#endif diff --git a/drivers/src/gfsk.c b/drivers/src/gfsk.c new file mode 100644 index 0000000..50d338f --- /dev/null +++ b/drivers/src/gfsk.c @@ -0,0 +1,56 @@ +#include "regs.h" +#include "rom.h" +#include "gfsk.h" + +#if (DBG_GFSK) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + +void rf_gfsk_init(void) +{ + RF->FSM_DLY_CTRL0.Word = 0x0045E311; + RF->FSM_DLY_CTRL1.Word = 0x07120628; + RF->DATA_DLY_CTRL.Word = 0x0000238B; + RF->BPFMIX_CTRL.Word = 0x00437D90; + RF->AGC_CTRL0.Word = 0x050BD572; + RF->AGC_CTRL1.Word = 0x000966B2; + RF->AGC_CTRL2.Word = 0x00E0331A; + + //.BG_RES_TRIM = 0x14 + RF->ANA_TRIM.Word = 0x07DA9351; + RF->ANAMISC_CTRL1.Word = 0x00000880; + RF->ANA_PWR_CTRL.Word = 0x07FF7F08; + RF->ANA_EN_CTRL.Word = 0x00072000; + RF->PLL_ANA_CTRL.Word = 0x3180FE00; + RF->RF_RSV = 0x0000B800; + + RF->DIG_CTRL.Word = 0x000092DB; +} + +// 2400M(dis=21, frach=0)Ϊ׼м +// tx_freq_mhz:2402 ~ 2480 +void rf_gfsk_tx_freq(uint16_t tx_freq_mhz) +{ + if (tx_freq_mhz > 2480) + tx_freq_mhz = 2480; + else if (tx_freq_mhz < 2402) + tx_freq_mhz = 2402; + + uint8_t pll_dis = ((tx_freq_mhz - 2400) >> 4) + 0x15; + uint8_t pll_frach = ((tx_freq_mhz - 2400) & 0x0F); + + pll_frach += (pll_frach & 0x01); + + + RF->PLL_DYM_CTRL.Word = (0x0F << RF_SW_PA_GAIN_TARGET_LSB); + btmr_delay(16, 200); + + RF->PLL_FREQ_CTRL.SW_PLL_DI_S = (pll_dis & 0x1F); + RF->PLL_FREQ_CTRL.SW_PLL_FRAC = (uint32_t)((pll_frach & 0x0F) << 20); + RF->PLL_DYM_CTRL.Word = ((0x01 << RF_SW_TX_EN_POS) | (0x0F << RF_SW_PA_GAIN_TARGET_LSB)); // soft cfg en + btmr_delay(16, 400); +} diff --git a/drivers/src/i2c.c b/drivers/src/i2c.c new file mode 100644 index 0000000..db32570 --- /dev/null +++ b/drivers/src/i2c.c @@ -0,0 +1,286 @@ +/** + **************************************************************************************** + * + * @file i2c.c + * + * @brief IIC(I2C) Driver + * + **************************************************************************************** + */ + +#include "i2c.h" +#include "rcc.h" +#include "iopad.h" +#include "reg_i2c.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +// Must clear SI before setting STA and then STA must be manually cleared. +#define I2C_START() \ + dowl( \ + I2C->CONCLR.Word = I2C_CR_IFLG_BIT; \ + I2C->CONSET.Word = I2C_CR_START_BIT; \ + while ((I2C->CONSET.Word & I2C_CR_IFLG_BIT) == 0); \ + I2C->CONCLR.Word = I2C_CR_START_BIT; \ + ) + +// Must set STO before clearing SI. +#define I2C_STOP() \ + dowl( \ + I2C->CONSET.Word = I2C_CR_STOP_BIT; \ + I2C->CONCLR.Word = I2C_CR_IFLG_BIT; \ + while ((I2C->CONSET.Word & I2C_CR_STOP_BIT) != 0); \ + ) + +// Stop clock-stretching and then read when it arrives. +#define I2C_GETC(_X_) \ + dowl( \ + I2C->CONCLR.Word = I2C_CR_IFLG_BIT; \ + while ((I2C->CONSET.Word & I2C_CR_IFLG_BIT) == 0); \ + (_X_) = I2C->DATA.Word; \ + ) + +// First write new data and then stop clock-stretching. +#define I2C_PUTC(_X_) \ + dowl( \ + I2C->DATA.Word = (_X_); \ + I2C->CONCLR.Word = I2C_CR_IFLG_BIT; \ + while ((I2C->CONSET.Word & I2C_CR_IFLG_BIT) == 0); \ + ) + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +void i2c_init(uint8_t io_scl, uint8_t io_sda, uint8_t sclk) +{ + // i2c_clk_en rst_req or soft_reset + RCC_APBCLK_EN(APB_I2C_BIT); + //RCC_APBRST_REQ(APB_I2C_BIT); + I2C->SRST = 0x07; + + // iocsc_i2c(io_scl, io_sda); + csc_output(io_scl, CSC_I2C_SCL); + csc_input(io_scl, CSC_I2C_SCL); + csc_output(io_sda, CSC_I2C_SDA); + csc_input(io_sda, CSC_I2C_SDA); + + iom_ctrl(io_scl, IOM_SEL_CSC | IOM_DRV_LVL1 | IOM_PULLUP | IOM_INPUT | IOM_OPENDRAIN); + iom_ctrl(io_sda, IOM_SEL_CSC | IOM_DRV_LVL1 | IOM_PULLUP | IOM_INPUT | IOM_OPENDRAIN); + + // SCL clock = PCLK/(2^clk_samp * (clk_scl+1) *10) + I2C->CLK.Word = sclk; + I2C_ENABLE(); +} + +void i2c_deinit(void) +{ + I2C_DISABLE(); + RCC_APBCLK_DIS(1 << (RCC_I2C_CLKEN_RUN_POS)); +} + +uint8_t i2c_start(uint8_t slv_addr) +{ + I2C_START(); + + // A start condition has been transmitted + if ((I2C_STAT_GET() == I2C_MS_START_OK) || (I2C_STAT_GET() == I2C_MS_RESTART_OK)) + { + I2C_PUTC(slv_addr); + } + + return I2C_STAT_GET(); +} + +void i2c_stop(void) +{ + I2C_STOP(); +} + +uint16_t i2c_send(uint16_t len, const uint8_t *data) +{ + uint16_t cnt; + + for (cnt = 0; cnt < len; cnt++) + { + I2C_PUTC(*data++); + + if (I2C_STAT_GET() != I2C_MS_SEND_DAT_ACK) + { + if (I2C_STAT_GET() == I2C_MS_SEND_DAT_NAK) + { + cnt += 1; // last byte + } + break; + } + } + + return cnt; +} + +uint16_t i2c_recv(uint16_t len, uint8_t *buff) +{ + uint16_t cnt; + + // All bytes are ACK'd except for the last one which is NACK'd. If only + // 1 byte is being read, a single NACK will be sent. Thus, we only want + // to enable ACK if more than 1 byte is going to be read. + if (len > 1) + { + I2C_SET_ACK(); + } + + for (cnt = 0; cnt < len; cnt++) + { + // slave devices require NACK to be sent after reading last byte + if (cnt + 1 == len) + { + I2C_SET_NAK(); + } + + // read a byte from the I2C interface + I2C_GETC(*buff++); + + if (I2C_STAT_GET() != I2C_MS_READ_DAT_ACK) + { + if (I2C_STAT_GET() == I2C_MS_READ_DAT_NAK) + { + cnt += 1; // count last byte + } + break; + } + } + + return cnt; +} + +uint16_t i2c_read(uint8_t addr_r, uint16_t len, uint8_t *buff) +{ + uint16_t cnt = 0; + + if (i2c_start(addr_r) == I2C_MS_ADDR_R_ACK) + { + cnt = i2c_recv(len, buff); + } + + i2c_stop(); + return cnt; +} + +uint16_t i2c_write(uint8_t addr_w, uint16_t len, const uint8_t *data) +{ + uint16_t cnt = 0; + + if (i2c_start(addr_w) == I2C_MS_ADDR_W_ACK) + { + cnt = i2c_send(len, data); + } + + i2c_stop(); + return cnt; +} + +uint16_t eeprom_write(uint8_t eep, uint16_t addr, uint16_t len, const uint8_t *data) +{ + uint16_t cnt = 0; + + if (i2c_start(eep) == I2C_MS_ADDR_W_ACK) + { + #if (OPTM_FAST) + do { + I2C_PUTC((addr >> 8) & 0xff); // address High byte + if (I2C_STAT_GET() != I2C_MS_SEND_DAT_ACK) break; + + I2C_PUTC(addr & 0xff); // address High byte + if (I2C_STAT_GET() != I2C_MS_SEND_DAT_ACK) break; + + for (; cnt < len; cnt++) + { + I2C_PUTC(*data++); + + if (I2C_STAT_GET() != I2C_MS_SEND_DAT_ACK) + { + if (I2C_STAT_GET() == I2C_MS_SEND_DAT_NAK) + { + cnt += 1; // last byte + } + break; + } + } + } while (0); + #else + addr = (addr >> 8) | (addr << 8); // send address in MSB + if (i2c_send(2, (uint8_t *)&addr) == 2) + { + cnt = i2c_send(len, data); + } + #endif + } + + i2c_stop(); + return cnt; +} + +uint16_t eeprom_read(uint8_t eep, uint16_t addr, uint16_t len, uint8_t *buff) +{ + uint16_t cnt = 0; + + if (i2c_start(eep) == I2C_MS_ADDR_W_ACK) + { + #if (OPTM_FAST) + do { + I2C_PUTC((addr >> 8) & 0xff); // address High byte + if (I2C_STAT_GET() != I2C_MS_SEND_DAT_ACK) break; + + I2C_PUTC(addr & 0xff); // address High byte + if (I2C_STAT_GET() != I2C_MS_SEND_DAT_ACK) break; + + if (i2c_start(eep | I2C_RD_OP) != I2C_MS_ADDR_R_ACK) break; + + if (len > 1) + { + I2C_SET_ACK(); + } + + for (; cnt < len; cnt++) + { + // slave devices require NACK to be sent after reading last byte + if (cnt + 1 == len) + { + I2C_SET_NAK(); + } + + // read a byte from the I2C interface + I2C_GETC(buff[cnt]); + + if (I2C_STAT_GET() != I2C_MS_READ_DAT_ACK) + { + if (I2C_STAT_GET() == I2C_MS_READ_DAT_NAK) + { + cnt += 1; // count last byte + } + break; + } + } + } while (0); + #else + addr = (addr >> 8) | (addr << 8); // send address in MSB + if (i2c_send(2, (uint8_t *)&addr) == 2) + { + if (i2c_start(eep | I2C_RD_OP) == I2C_MS_ADDR_R_ACK) + { + cnt = i2c_recv(len, buff); + } + } + #endif + } + + i2c_stop(); + return cnt; +} diff --git a/drivers/src/iopad.c b/drivers/src/iopad.c new file mode 100644 index 0000000..6f9c947 --- /dev/null +++ b/drivers/src/iopad.c @@ -0,0 +1,306 @@ +/** + **************************************************************************************** + * + * @file iopad.c + * + * @brief IOPAD with Cross Switch Connect(CSC) Driver + * + **************************************************************************************** + */ + +#include "iopad.h" +#include "reg_csc.h" +#include "reg_rcc.h" // for clkout +#include "reg_aon.h" +#include "reg_gpio.h" +#include "reg_apbmisc.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +#if (OPTM_SIZE) + +/// CSC Ctrl: peripheral function enable +#define CSC_FEN_BIT (1UL << 7) /* Note Diff*/ +#define CSC_EN(fsel) ((fsel) | CSC_FEN_BIT) + +/// CSC Input func select : 'pad' @see enum pad_idx, 'fsel' @see enum csc_fsel -I +#define CSC_INPUT(pad, fsel) CSC->CSC_INPUT[fsel].Word = CSC_EN(pad) +/// CSC Output func select: 'pad' @see enum pad_idx, 'fsel' @see enum csc_fsel -O +#define CSC_OUTPUT(pad, fsel) CSC->CSC_OUTPUT[pad].Word = CSC_EN(fsel) +/// Config IO mode: 'pad' @see enum pad_idx, 'ctrl' @see enum iom_bfs +#define IOM_CTRL(pad, ctrl) CSC->CSC_PIO[pad].Word = ctrl + +/** + **************************************************************************************** + * @brief Base IO Mode Control + * + * @param[in] pad Index of pad used @see enum pad_idx + * @param[in] ctrl value of mode @see enum iom_bfs + * + **************************************************************************************** + */ +void iom_ctrl(uint8_t pad, uint16_t ctrl) +{ + IOM_CTRL(pad, ctrl); +} + +/** + **************************************************************************************** + * @brief Base CSC Input Connect + * + * @param[in] pad Index of pad used @see enum pad_idx + * @param[in] fsel value of func @see enum csc_fsel + * + **************************************************************************************** + */ +void csc_input(uint8_t pad, uint8_t fsel) +{ + CSC_INPUT(pad, fsel); +} + +/** + **************************************************************************************** + * @brief Base CSC Output Connect + * + * @param[in] pad Index of pad used @see enum pad_idx + * @param[in] fsel value of func @see enum csc_fsel + * + **************************************************************************************** + */ +void csc_output(uint8_t pad, uint8_t fsel) +{ + CSC_OUTPUT(pad, fsel); +} +#endif + + +/** + **************************************************************************************** + * @brief Composite CSC for UART Txd and Rxd + * + * @param[in] port uart port(0-UART1, 1-UART2) + * @param[in] pad_tx pad used for uart txd @see enum pad_idx + * @param[in] pad_rx pad used for uart rxd @see enum pad_idx + * + **************************************************************************************** + */ +void iocsc_uart(uint8_t port, uint8_t pad_tx, uint8_t pad_rx) +{ + uint8_t fsel_add = port * 2; //(port == 1) ? 2 : 0; + + // csc output and input + csc_output(pad_tx, CSC_UART1_TXD + fsel_add); + csc_input(pad_rx, CSC_UART1_RXD + fsel_add); + + // iomode control + iom_ctrl(pad_tx, IOM_SEL_CSC | IOM_PULLUP | IOM_DRV_LVL1); + iom_ctrl(pad_rx, IOM_SEL_CSC | IOM_PULLUP | IOM_INPUT); +} + +/** + **************************************************************************************** + * @brief Composite CSC for UART HW Flow-Control + * + * @param[in] port uart port(0-UART1, 1-UART2) + * @param[in] pad_rts pad used for uart rts @see enum pad_idx + * @param[in] pad_cts pad used for uart cts @see enum pad_idx + * + **************************************************************************************** + */ +void iocsc_uart_hwfc(uint8_t port, uint8_t pad_rts, uint8_t pad_cts) +{ + uint8_t fsel_add = port; //(port == 1) ? 1 : 0; + + // csc output and input + csc_output(pad_rts, CSC_UART1_RTS + fsel_add); + csc_input(pad_cts, CSC_UART1_CTS + fsel_add); + + // iomode control + iom_ctrl(pad_rts, IOM_SEL_CSC | IOM_DRV_LVL1 | IOM_PULLUP); + iom_ctrl(pad_cts, IOM_SEL_CSC | IOM_PULLUP | IOM_INPUT); +} + +/** + **************************************************************************************** + * @brief Composite CSC for I2C + * + * @param[in] pad_scl pad used for I2C scl @see enum pad_idx + * @param[in] pad_sda pad used for I2C sda @see enum pad_idx + * + **************************************************************************************** + */ +void iocsc_i2c(uint8_t pad_scl, uint8_t pad_sda) +{ + // csc output and input + csc_output(pad_scl, CSC_I2C_SCL); + csc_input(pad_scl, CSC_I2C_SCL); + csc_output(pad_sda, CSC_I2C_SDA); + csc_input(pad_sda, CSC_I2C_SDA); + + // iomode control + iom_ctrl(pad_scl, IOM_SEL_CSC | IOM_DRV_LVL1 | IOM_PULLUP | IOM_INPUT | IOM_OPENDRAIN); + iom_ctrl(pad_sda, IOM_SEL_CSC | IOM_DRV_LVL1 | IOM_PULLUP | IOM_INPUT | IOM_OPENDRAIN); +} + +/** + **************************************************************************************** + * @brief Composite CSC for SPI Master Role + * + * @param[in] pad_clk pad used for SPI clk @see enum pad_idx + * @param[in] pad_miso pad used for SPI miso @see enum pad_idx + * @param[in] pad_mosi pad used for SPI mosi @see enum pad_idx + * + **************************************************************************************** + */ +void iocsc_spim(uint8_t pad_clk, uint8_t pad_miso, uint8_t pad_mosi) +{ + // csc connect + csc_output(pad_clk, CSC_SPIM_CLK); + csc_input(pad_miso, CSC_SPIM_MISO); + csc_output(pad_mosi, CSC_SPIM_MOSI); + + // iomode control + iom_ctrl(pad_clk, IOM_SEL_CSC | IOM_DRV_LVL1 | IOM_PULLUP); + iom_ctrl(pad_miso, IOM_SEL_CSC | IOM_PULLUP | IOM_INPUT); + iom_ctrl(pad_mosi, IOM_SEL_CSC | IOM_DRV_LVL1 | IOM_PULLUP); +} + +/** + **************************************************************************************** + * @brief Composite CSC for SPI Slave Role + * + * @param[in] pad_cs pad used for SPI cs @see enum pad_idx + * @param[in] pad_clk pad used for SPI clk @see enum pad_idx + * @param[in] pad_miso pad used for SPI miso @see enum pad_idx + * @param[in] pad_mosi pad used for SPI mosi @see enum pad_idx + * + **************************************************************************************** + */ +void iocsc_spis(uint8_t pad_cs, uint8_t pad_clk, uint8_t pad_miso, uint8_t pad_mosi) +{ + // csc connect + csc_input(pad_cs, CSC_SPIS_CSN); + csc_input(pad_clk, CSC_SPIS_CLK); + csc_output(pad_miso, CSC_SPIS_MISO); + csc_input(pad_mosi, CSC_SPIS_MOSI); + + // iomode control + iom_ctrl(pad_cs, IOM_SEL_CSC | IOM_PULLUP | IOM_INPUT); + iom_ctrl(pad_clk, IOM_SEL_CSC | IOM_PULLUP | IOM_INPUT); + iom_ctrl(pad_miso, IOM_SEL_CSC | IOM_DRV_LVL1 | IOM_PULLUP); + iom_ctrl(pad_mosi, IOM_SEL_CSC | IOM_PULLUP | IOM_INPUT); +} + +/** + **************************************************************************************** + * @brief Composite CSC for CTMR PWM/PWC channel + * + * @param[in] pad_ch1 pad used for CTMR CH1 @see enum pad_idx + * @param[in] pad_ch2 pad used for CTMR CH2 @see enum pad_idx + * + **************************************************************************************** + */ +void iocsc_ctmr_chnl(uint8_t pad_ch1, uint8_t pad_ch2) +{ + if (pad_ch1 < PA_MAX) + { + // csc output and input + csc_output(pad_ch1, CSC_CTMR_CH1); + csc_input(pad_ch1, CSC_CTMR_CH1); + // iomode control + iom_ctrl(pad_ch1, IOM_SEL_CSC | IOM_DRV_LVL1 | IOM_PULLUP | IOM_INPUT); + } + + if (pad_ch2 < PA_MAX) + { + csc_output(pad_ch2, CSC_CTMR_CH2); + csc_input(pad_ch2, CSC_CTMR_CH2); + iom_ctrl(pad_ch2, IOM_SEL_CSC | IOM_DRV_LVL1 | IOM_PULLUP | IOM_INPUT); + } +} + +/** + **************************************************************************************** + * @brief Select analog observe + * + * @param[in] pad Index of pad used + * @param[in] fsel Func of analog @see enum csc_fsel (17~24) + * + **************************************************************************************** + */ +void iocsc_observe(uint8_t pad, uint8_t fsel) +{ + csc_output(pad, fsel); + iom_ctrl(pad, IOM_SEL_CSC | IOM_DRV_LVL1); +} + +/** + **************************************************************************************** + * @brief Select Clock output via PA05(Fixed) + * + * @param[in] clk Type of Selected-Clock @see enum clk_out + * + **************************************************************************************** + */ +void iospc_clkout(uint8_t clk) +{ + if (APBMISC->DPLL_CTRL.DPLL2_EN) + { + APBMISC->DPLL_CTRL.DPLL2_EN_CLK48M = 1; + } + + RCC->CFG.MCO_SW = clk; + iom_ctrl(PA_CLKOUT, IOM_SEL_SPECL | IOM_DRV_LVL1); +} + +/** + **************************************************************************************** + * @brief Special USB DP/DM via PA06 PA07(Fixed, HiZ mode) + * + **************************************************************************************** + */ +void iospc_usbpin(void) +{ + GPIO->DIR_CLR = (1UL << PA_USB_DP) | (1UL << PA_USB_DM); + + iom_ctrl(PA_USB_DP, IOM_HIZ); + iom_ctrl(PA_USB_DM, IOM_HIZ); +} + +/** + **************************************************************************************** + * @brief Special SWCLK SWDIO via PA00 PA01(Fixed, default) + * + * @param[in] as_gpio True as GPIO, Flase as SWD + * + **************************************************************************************** + */ +void iospc_swdpin(void) +{ + iom_ctrl(PA_SWCLK, IOM_SEL_SPECL | IOM_INPUT | IOM_PULLDOWN); + iom_ctrl(PA_SWDIO, IOM_SEL_SPECL | IOM_INPUT | IOM_PULLUP); +} + +/** + **************************************************************************************** + * @brief Special nRESET via PA19(Fixed, default) + * + * @param[in] as_gpio True as GPIO, Flase as nRESET + * + **************************************************************************************** + */ +void iospc_rstpin(bool as_gpio) +{ + AON->BKHOLD_CTRL.PIOA19_FUNC_SEL = as_gpio; +} diff --git a/drivers/src/iwdt.c b/drivers/src/iwdt.c new file mode 100644 index 0000000..f2d6b7d --- /dev/null +++ b/drivers/src/iwdt.c @@ -0,0 +1,70 @@ +/** + **************************************************************************************** + * + * @file iwdt.c + * + * @brief WatchDog Timer Driver + * + **************************************************************************************** + */ + +#include "iwdt.h" +#include "rcc.h" +#include "reg_iwdt.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +void iwdt_init(uint8_t ctrl) +{ + RCC_APBCLK_EN(APB_IWDT_BIT); + + IWDT->LOCK = 0x1ACCE551; // unlock iwdt + IWDT->CTRL.EN = 0; + IWDT->INTCLR = 1; // clear int + + IWDT->CTRL.Word = ctrl; + IWDT->LOCK = 0; // lock iwdt +} + +void iwdt_feed(void) +{ + IWDT->LOCK = 0x1ACCE551; // unlock iwdt + IWDT->INTCLR = 1; // clear to reload + IWDT->LOCK = 0; // lock iwdt +} + +#if (ROM_UNUSED) +uint32_t iwdt_conf(uint32_t load) // add 6vp 1125 +{ + uint32_t value; + + IWDT->LOCK = 0x1ACCE551; // unlock iwdt + IWDT->INTCLR = 1; // clear int + + value = IWDT->VALUE; + if (load > 0) + { + IWDT->LOAD = load; // feed dog + IWDT->CTRL.EN = 1; + } + else + { + IWDT->CTRL.EN = 0; // disable dog + } + + IWDT->LOCK = 0; // lock iwdt + + return value; +} +#endif // (ROM_UNUSED) diff --git a/drivers/src/pwm.c b/drivers/src/pwm.c new file mode 100644 index 0000000..1158f63 --- /dev/null +++ b/drivers/src/pwm.c @@ -0,0 +1,133 @@ +/** + **************************************************************************************** + * + * @file pwm.c + * + * @brief Pulse Width Modulation(PWM) Driver + * + **************************************************************************************** + */ + +#include "pwm.h" +#include "rcc.h" +#include "reg_timer.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +#if defined(CTMR_BASE) +#define TMR_USED(tmr) ((TIMER_TypeDef* )(CTMR_BASE + (tmr) * 0x1000)) +#else +#define TMR_USED(tmr) (((tmr) == PWM_CTMR) ? CTMR : ATMR) +#endif + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +//void pwm_init(uint8_t tmr, const pwm_tmr_cfg_t *conf) +void pwm_init(uint8_t tmr, uint16_t psc, uint16_t arr) +{ + TIMER_TypeDef* TIMx = TMR_USED(tmr); + uint32_t tmr_bit = 1UL << (1 + tmr); //APB_CTMR_BIT APB_ATMR_BIT + + //enable clock, init PSC & Freq + RCC_APBCLK_EN(tmr_bit); + TIMx->CR1.CEN = 0; + + //if (conf != NULL) + { + TIMx->CNT = 0; + TIMx->PSC = psc; //conf->psc; + TIMx->ARR = arr; //conf->arr; + } + + TIMx->CR1.DIR = 0; //Counter used as upcounter + TIMx->CR1.CMS = 0; //Edge-aligned mode +} + +void pwm_conf(uint8_t tmr, uint16_t smcr, uint16_t intr) +{ + TIMER_TypeDef* TIMx = TMR_USED(tmr); + + TIMx->SMCR.Word = smcr; + TIMx->IER.Word = intr; + TIMx->ICR.Word = intr; +} + +void pwm_start(uint8_t tmr) +{ + TIMER_TypeDef* TIMx = TMR_USED(tmr); + + if (tmr == PWM_ATMR) + { + TIMx->BDTR.MOE = 1; + } + + TIMx->CR1.ARPE = 1; + TIMx->CR1.CEN = 1; + TIMx->EGR.UG = 1; +} + +#if (0) +void pwm_chnl_set(uint8_t chnl, const pwm_chnl_cfg_t *conf) +{ + uint8_t cidx = chnl % 4; + TIMER_TypeDef* TIMx = TMR_USED(chnl / 4); + + // CCER&CCMR Clear + TIMx->CCER.Word &= ~(0x0F << (cidx * 4)); // bit[3:0] + TIMx->DMAEN.Word &= ~(0x01 << (cidx + 1)); // bit1 - CC1DE + TIMx->CCMR[cidx/2] &= ~(0xFF << ((cidx % 2) * 8)); // bit[7:0] + + if (conf != NULL) + { + // CCR value + TIMx->CCR[cidx] = conf->duty; + // CCMR conf + TIMx->CCMR[cidx/2] |= (conf->ccmr << ((cidx % 2) * 8)); + // CCER enable + TIMx->DMAEN.Word |= (((conf->ccer & PWM_CCxDE_BIT) >> PWM_CCxDE_POS) << (cidx + 1)); + TIMx->CCER.Word |= ((conf->ccer & 0x0F) << (cidx * 4)); + } +} +#else + +void pwm_chnl_set(uint8_t chnl, const pwm_chnl_cfg_t *conf) +{ + uint8_t used_nchnl = (chnl > PWM_ATMR_CH4P) ? 2 : 0; + uint8_t cidx = chnl % 4; + TIMER_TypeDef* TIMx = TMR_USED(chnl > PWM_CTMR_CH4); + + // CCER&CCMR Clear +// TIMx->CCER.Word &= ~(0x0F << (cidx * 4)); // bit[3:0] + TIMx->CCER.Word &= ~(0x03 << ((cidx * 4) + used_nchnl)); // p chnl --- bit[1:0], n - chnl --- bit[3:2] + TIMx->DMAEN.Word &= ~(0x01 << (cidx + 1)); // bit1 - CC1DE +// TIMx->CCMR[cidx/2] &= ~(0xFF << ((cidx % 2) * 8)); // bit[7:0] + + if (conf != NULL) + { + // CCR value + TIMx->CCR[cidx] = conf->duty; + // CCMR conf + TIMx->CCMR[cidx/2] &= ~(0xFF << ((cidx % 2) * 8)); // bit[7:0] + TIMx->CCMR[cidx/2] |= (conf->ccmr << ((cidx % 2) * 8)); + // CCER enable + TIMx->DMAEN.Word |= (((conf->ccer & PWM_CCxDE_BIT) >> PWM_CCxDE_POS) << (cidx + 1)); +// TIMx->CCER.Word |= ((conf->ccer & 0x0F) << (cidx * 4)); + TIMx->CCER.Word |= ((conf->ccer & 0x03) << ((cidx * 4) + used_nchnl)); + } +} +#endif + +void pwm_duty_upd(uint8_t chnl, uint16_t duty) +{ + uint8_t cidx = chnl % 4; + TIMER_TypeDef* TIMx = TMR_USED(chnl / 4); + TIMx->CCR[cidx] = duty; +} diff --git a/drivers/src/rcc.c b/drivers/src/rcc.c new file mode 100644 index 0000000..120898f --- /dev/null +++ b/drivers/src/rcc.c @@ -0,0 +1,304 @@ +/** + **************************************************************************************** + * + * @file rcc.c + * + * @brief Reset and clock control(RCC) Driver + * + **************************************************************************************** + */ + +#include "rcc.h" +#include "reg_rcc.h" +#include "reg_rf.h" +#include "reg_aon.h" +#include "reg_apbmisc.h" +#include "gpio.h" // for USB pad +#include "reg_syscfg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Value of CFG.SYSCLK_SW +enum sysclk_sw +{ + SCLK_HSI = 1, + SCLK_HSE = 2, + SCLK_PLL = 4, + SCLK_LSI = 8, +}; + +/// BLE_CLK(16M fixed) prescale from SYS_CLK_16M~64M --> psc0~3 same order +#define BLE_CLK_PSC(sclk) (((sclk) <= SYS_CLK_64M) ? (sclk) : 0) + +/// Select DPLL_EN 64M or DPLL2_EN 48M +#define DPLL_IS_48M() (RCC->CFG.DPLL_CLK_SW) + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +uint32_t rcc_bus_get(uint8_t idx) +{ + uint32_t reg_addr = RCC_BASE + RCC_AHBRST_CTRL_ADDR_OFFSET + (idx * 4); + + return (*(volatile uint32_t *)reg_addr); +} + +void rcc_bus_enb(uint8_t idx, uint32_t bfs) +{ + uint32_t reg_addr = RCC_BASE + RCC_AHBRST_CTRL_ADDR_OFFSET + (idx * 4); + + (*(volatile uint32_t *)reg_addr) |= bfs; +} + +void rcc_bus_dis(uint8_t idx, uint32_t bfs) +{ + uint32_t reg_addr = RCC_BASE + RCC_AHBRST_CTRL_ADDR_OFFSET + (idx * 4); + + (*(volatile uint32_t *)reg_addr) &= ~bfs; +} + +void rcc_bus_rst(uint8_t idx, uint32_t bfs) +{ + uint32_t reg_addr = RCC_BASE + RCC_AHBRST_CTRL_ADDR_OFFSET + (idx * 4); + + (*(volatile uint32_t *)reg_addr) |= bfs; + (*(volatile uint32_t *)reg_addr) &= ~bfs; +} + +void rcc_adc_en(void) +{ + // ADC reset: clk=0, rst=1, rst=0, clk=1 + RCC->AHBCLK_EN_RUN.ADC_CLKEN_RUN = 0; + RCC->AHBRST_CTRL.ADC_RSTREQ = 1; + RCC->AHBRST_CTRL.ADC_RSTREQ = 0; + RCC->AHBCLK_EN_RUN.ADC_CLKEN_RUN = 1; +} + +void rcc_ble_en(void) +{ + // modem&rf clk enable + //RCC->APBCLK_EN_RUN.Word |= (APB_MDM_BIT | APB_RF_BIT); + RCC_APBCLK_EN(APB_MDM_BIT | APB_RF_BIT); + + // ble clk enable + RCC->BLE_CLKRST_CTRL.BLE_AHBEN = 1; + + // ble reg reset + RCC->BLE_CLKRST_CTRL.BLE_AHB_RSTREQ = 1; + RCC->BLE_CLKRST_CTRL.BLE_AHB_RSTREQ = 0; + + #if (EM_PWOFF) + // em power enable + AON->PWOFF_CTRL.EM_PD_EN = 0; + AON->PWOFF_CTRL.EM_ACCESS_EN = 1; + // wait em power stable + while (AON->PWOFF_CTRL.EM_PD_ACK); + #endif + + // ble signal latch release - move to ble_init() / ble_resume() + //AON->PMU_WKUP_CTRL.BLE_LATCH_N = 1; + // ble low power source select lsi + AON->BLE_RTC_CTL.BLELOWCLK_SEL = 0; + // ble low power enable + AON->BLE_RTC_CTL.BLELOWCLK_EN = 1; +} + +void rcc_usb_en(void) +{ + // clk rst enable + RCC_AHBCLK_EN(AHB_USB_BIT); + RCC_AHBRST_REQ(AHB_USB_BIT); + + // iopad to hiz + GPIO_DIR_CLR((1UL << PA_USB_DP) | (1UL << PA_USB_DM)); + iom_ctrl(PA_USB_DP, IOM_HIZ); + iom_ctrl(PA_USB_DM, IOM_HIZ); + + // 1.5k pull-up(.USB_PHY_MOD=0, .DIG_USB_PU=3, .DIG_USB_RXEN=1,) + //SYSCFG->USB_CTRL.DIG_USB_PU = 3; // FIB result 1 --> 3 + //SYSCFG->USB_CTRL.DIG_USB_RXEN = 1; + SYSCFG->USB_CTRL.Word = 0x1C; +} + +void rcc_sysclk_set(uint8_t sclk_sel) +{ + uint8_t clk_sw = RCC->CFG.SYSCLK_SW; // curr sclk + uint8_t clk_div = 0; // default RCC->AHBCLK_DIV = 0 + uint8_t ble_div = 0; // default RCC->BLE_CLKRST_CTRL.BLECLK_DIV = 0 + + // sysclk switch, bypass if already* + switch (sclk_sel) + { + case SYS_CLK_16M: + { + if (clk_sw == SCLK_HSE) return; + + clk_sw = SCLK_HSE; + // use xo16m_en() as clock src + //AON->PMU_CTRL.OSC_EN_RUN = 1; + //APBMISC->XOSC16M_CTRL.EN_XO16MBUF = 1; + RCC->CLK_EN_ST.HSE_DIG_EN = 1; + } break; + + case SYS_CLK_HSI: + { + if (clk_sw == SCLK_HSI) return; + + clk_sw = SCLK_HSI; + // use rc16m as clock src + //APBMISC->AON_PMU_CTRL.HSI_EN_RUN = 1; + RCC->CLK_EN_ST.HSI_DIG_EN = 1; + } break; + + case SYS_CLK_LSI: + { + if (clk_sw == SCLK_LSI) return; + + clk_sw = SCLK_LSI; + // use rc32k as clock src + AON->PMU_CTRL.RC32K_EN_RUN = 1; + RCC->CLK_EN_ST.LSI_DIG_EN = 1; + } break; + + default: + { + clk_sw = SCLK_PLL; + ble_div = (sclk_sel - SYS_CLK_16M); + + // use dpll as clock src + if (sclk_sel == SYS_CLK_48M) + { + RCC->CFG.DPLL_CLK_SW = 1; // 48M + } + else + { + clk_div = (sclk_sel == SYS_CLK_32M) ? 1 : 0; + RCC->CFG.DPLL_CLK_SW = 0; // 64M + } + + APBMISC->DPLL_CTRL.DPLL2_EN = 1; + RCC->CLK_EN_ST.DPLL_DIG_EN = 1; + } break; + } + + RCC->BLE_CLKRST_CTRL.BLECLK_DIV = ble_div; //BLE Must 16M + RCC->AHBCLK_DIV = clk_div; + RCC->CFG.SYSCLK_SW = clk_sw; +} + +uint8_t rcc_sysclk_get(void) +{ + uint8_t sclk_cur; + uint8_t clk_sw = RCC->CFG.SYSCLK_SW; + + if (clk_sw == SCLK_HSE) + { + sclk_cur = SYS_CLK_16M; + } + else if (clk_sw == SCLK_PLL) + { + sclk_cur = DPLL_IS_48M() ? SYS_CLK_48M : ((RCC->AHBCLK_DIV == 1) ? SYS_CLK_32M : SYS_CLK_64M); + } + else if (clk_sw == SCLK_LSI) + { + sclk_cur = SYS_CLK_LSI; + } + else /*SCLK_HSI*/ + { + sclk_cur = SYS_CLK_HSI; + } + + return sclk_cur; +} + +uint32_t rcc_sysclk_freq(void) +{ + uint32_t clk_freq; + uint8_t clk_sw = RCC->CFG.SYSCLK_SW; + + if (clk_sw == SCLK_PLL) + { + clk_freq = DPLL_IS_48M() ? SYS_FREQ_48M : SYS_FREQ_64M; + } + else if (clk_sw == SCLK_LSI) + { + clk_freq = SYS_FREQ_32K; + } + else // SCLK_HSE SCLK_HSI + { + clk_freq = SYS_FREQ_16M; + } + + // prescale clock + uint8_t clk_div = (RCC->AHBCLK_DIV & 0xFF); + if (clk_div > 0) + { + clk_freq /= (clk_div + 1); + } + + return clk_freq; +} + +uint8_t rcc_fshclk_get(void) +{ + uint8_t fclk_sel = RCC->CLK_EN_ST.FSHCCLK_SEL; + + if (fclk_sel == FSH_CLK_DPLL128) + { + fclk_sel += (RCC->CLK_EN_ST.FSHCCLK_DIV_NUM); + } + + return fclk_sel; +} + +uint8_t rcc_fshclk_mhz(void) +{ + uint8_t fclk_mhz; + uint8_t fclk_sel = RCC->CLK_EN_ST.FSHCCLK_SEL; + + if (fclk_sel == FSH_CLK_DPLL128) + { + fclk_mhz = 128 / (RCC->CLK_EN_ST.FSHCCLK_DIV_NUM + 1); // FSH_FREQ_PSCxx + } + else if (fclk_sel == FSH_CLK_DPLL) + { + fclk_mhz = (DPLL_IS_48M() ? FSH_FREQ_48MHz : FSH_FREQ_64MHz); + } + else // FSH_CLK_HSE16 FSH_CLK_HSI16 + { + fclk_mhz = FSH_FREQ_16MHz; + } + + return fclk_mhz; +} + +#if (ROM_UNUSED) +void rcc_fshclk_set(uint8_t fclk_sel) +{ + if (fclk_sel >= FSH_CLK_DPLL128) + { + // note fshcclk_div_num must be larger than 0, so defalut 2(psc3=42M) + uint8_t clk_div = (fclk_sel > FSH_CLK_DPLL128) ? (fclk_sel - FSH_CLK_DPLL128) : 2; + + RCC->CLK_EN_ST.FSHCCLK_SEL = FSH_CLK_HSI16; + + RCC->CLK_EN_ST.FSHCCLK_DIVEN = 0; + RCC->CLK_EN_ST.FSHCCLK_DIV_NUM = clk_div; + // fshcclk_diven must be set as 1 before fshcclk_sel + RCC->CLK_EN_ST.FSHCCLK_DIVEN = 1; + + RCC->CLK_EN_ST.FSHCCLK_SEL = FSH_CLK_DPLL128; + } + else + { + RCC->CLK_EN_ST.FSHCCLK_SEL = fclk_sel; + } +} +#endif diff --git a/drivers/src/rco.c b/drivers/src/rco.c new file mode 100644 index 0000000..620f9a6 --- /dev/null +++ b/drivers/src/rco.c @@ -0,0 +1,233 @@ +/** + **************************************************************************************** + * + * @file rco.c + * + * @brief RCO(32k, 16M) Driver + * + **************************************************************************************** + */ + +#include "rco.h" +#include "reg_rcc.h" +#include "reg_aon.h" +#include "reg_apbmisc.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +#define HSE_CALIB_MULTI 500 // 16M/32K +#define DPLL_CAKLIB_MULTI 2000 // 64M/32K + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Enable and Config rc32k + * + * @param[in] ref_clk reference clock for calibration @see enum rc32k_ref_clk + * @param[in] cal_ctrl config control for calibration @see enum rc32k_cal_ctrl + * + **************************************************************************************** + */ +void rc32k_conf(uint8_t ref_clk, uint8_t cal_ctrl) +{ + uint16_t target = 0; // bit[15:0] + uint8_t cycle = (cal_ctrl & 0x1F); // bit[20:16] + + #if (ROM_UNUSED) + // clock enable (keep enabled in rom) + // RCC->APBCLK_EN_RUN.AON_CLKEN_RUN = 1; + // RCC->APBCLK_EN_RUN.APBMISC_CLKEN_RUN = 1; + RCC_APBCLK_EN(APB_APBMISC_BIT | APB_AON_BIT); + #endif + + RCC->CLK_EN_ST.RCCALIB_CLKEN = 1; + RCC->CLK_EN_ST.RCCALIB_CLKSEL = ref_clk; + + if (ref_clk == RCLK_HSE/*0*/) + { + target = HSE_CALIB_MULTI * (cycle + 1); + } + else //if ((ref_clk == RCLK_DPLL64/*1*/) || (ref_clk == RCLK_DPLL128/*2*/)) + { + target = DPLL_CAKLIB_MULTI * ref_clk * (cycle + 1); + } + + // bit[15:0]--rccalib_target, bit[20:16]--cycle, bit21--SCAL_EN, bit22--DLY + APBMISC->RCCALIB_CTRL.Word = target | ((uint32_t)cal_ctrl << APBMISC_RCCALIB_CYCLES_LSB) | (1UL << APBMISC_RCCALIB_DLY_POS); +} + +/** + **************************************************************************************** + * @brief Start rc32k calibration, after rc32k_conf(). + * + * @return rc32k trim value + **************************************************************************************** + */ +uint16_t rc32k_calib(void) +{ + uint16_t trim_val = 0; + + // use rc calib result control rc32k + AON->PMU_WKUP_CTRL.RC32K_TRIM_SEL = 1; + + // rc calib start + APBMISC->RCCALIB_START = 1; + + // wait done, thenclear + while(!APBMISC->RCCALIB_STCLR.RCCALIB_DONE); + APBMISC->RCCALIB_STCLR.RCCALIB_DONE_CLR = 1; + + // rc32k calib trim val get + //AON->BKHOLD_CTRL.RC32K_MSB_TRIM_CFG = APBMISC->RC32K_CALIB_ST.RC32K_MSB_CALIB; + //AON->BKHOLD_CTRL.RC32K_LSB_TRIM_CFG = APBMISC->RC32K_CALIB_ST.RC32K_LSB_CALIB; + //uint16_t value = APBMISC->RC32K_CALIB_ST.RC32K_MSB_CALIB | (APBMISC->RC32K_CALIB_ST.RC32K_LSB_CALIB << 4); + trim_val = (APBMISC->RC32K_CALIB_ST.Word & 0xF/*MSB*/) | (((APBMISC->RC32K_CALIB_ST.Word >> 16) & 0x3FF) << 4/*LSB*/); + + AON->BKHOLD_CTRL.Word = (AON->BKHOLD_CTRL.Word & ~(0x3FFF << 0)) | (((uint32_t)trim_val & 0x3FFF) << 0); + + // use AON's trim val control rc32k + AON->PMU_WKUP_CTRL.RC32K_TRIM_SEL = 0; + + return trim_val; +} + +/** + **************************************************************************************** + * @brief Direct Set trim value to calibrate rc32k. + * + * @param[in] value calib-target value + * + **************************************************************************************** + */ +void rc32k_trim_set(uint16_t value) +{ + #if (ROM_UNUSED) + // clock enable (keep enabled in rom) + // RCC->APBCLK_EN_RUN.AON_CLKEN_RUN = 1; + RCC_APBCLK_EN(APB_AON_BIT); + #endif + + //AON->BKHOLD_CTRL.RC32K_MSB_TRIM_CFG = value & 0xF; // bit[3:0] + //AON->BKHOLD_CTRL.RC32K_LSB_TRIM_CFG = (value >> 4) & 0x3FF; // bit[13:4] + AON->BKHOLD_CTRL.Word = (AON->BKHOLD_CTRL.Word & ~(0x3FFF << 0)) | (((uint32_t)value & 0x3FFF) << 0); + + // use AON's trim val control rc32k + AON->PMU_WKUP_CTRL.RC32K_TRIM_SEL = 0; +} + +/** + **************************************************************************************** + * @brief Get current value of rc32k calibrated or used. + * + * @return calib-target value + * + **************************************************************************************** + */ +uint16_t rc32k_trim_get(void) +{ + uint16_t value; + + #if (ROM_UNUSED) + // RCC->APBCLK_EN_RUN.AON_CLKEN_RUN = 1; + RCC_APBCLK_EN(APB_AON_BIT); + #endif + + if (AON->PMU_WKUP_CTRL.RC32K_TRIM_SEL == 0) + value = (AON->BKHOLD_CTRL.Word >> 0) & 0x3FFF; // 0=AON_RC32K_MSB_TRIM_CFG_LSB + else + value = (APBMISC->RC32K_CALIB_ST.Word & 0xF/*MSB*/) | (((APBMISC->RC32K_CALIB_ST.Word >> 16) & 0x3FF) << 4/*LSB*/); + + return value; +} + +/** + **************************************************************************************** + * @brief Direct Set trim value to calibrate rc16m. + * + * @param[in] value calib-target value 0~63 + * + **************************************************************************************** + */ +void rc16m_trim_set(uint8_t value) +{ + #if (ROM_UNUSED) + // clock enable (keep enabled in rom) + // RCC->APBCLK_EN_RUN.APBMISC_CLKEN_RUN = 1; + RCC_APBCLK_EN(APB_APBMISC_BIT); + #endif + + APBMISC->RC16M_FREQ_TRIM = value; +} + +/** + **************************************************************************************** + * @brief Get current value of rc16m calibrated or used. + * + * @return calib-target value 0~63 + * + **************************************************************************************** + */ +uint8_t rc16m_trim_get(void) +{ + uint8_t value; + + #if (ROM_UNUSED) + // RCC->APBCLK_EN_RUN.APBMISC_CLKEN_RUN = 1; + RCC_APBCLK_EN(APB_APBMISC_BIT); + #endif + + value = APBMISC->RC16M_FREQ_TRIM; + + return value; +} + +#if (ROM_UNUSED) +#include "utils.h" // call co_abs() + +/** + **************************************************************************************** + * @brief Start rc16m calibration in dichotomy. + * + * @return rc16m trim value (0~63) + **************************************************************************************** + */ +uint8_t rc16m_calib(void) +{ + uint8_t trim_val = 0x20; // bit[5:0] + int win_cnt = 0; + int win_set = APBMISC->RC16M_CNT_CTRL.RC16M_WIN_SET; + + RCC->CLK_EN_ST.RC16M_CNT_CLKEN = 1; + + for (uint8_t step = 0x20; step > 0; step >>= 1) + { + RCC->APBRST_CTRL.RC16M_CNT_RSTREQ = 1; + RCC->APBRST_CTRL.RC16M_CNT_RSTREQ = 0; + + APBMISC->RC16M_FREQ_TRIM = trim_val; + APBMISC->RC16M_CNT_CTRL.RC16M_CNT_START = 1; + + while (!APBMISC->RC16M_CNT_CTRL.RC16M_CNT_DONE); + win_cnt = APBMISC->RC16M_CNT_CTRL.RC16M_WIN_CNT; + + //if ((win_cnt > (win_set - 100)) && (win_cnt < (win_set + 100))) + if (co_abs(win_cnt - win_set) <= 100) + break; + + trim_val = trim_val + (step >> 1) - ((win_cnt > win_set) ? step : 0); + } + + //RCC->CLK_EN_ST.RC16M_CNT_CLKEN = 0; + + return trim_val; +} +#endif diff --git a/drivers/src/rtc.c b/drivers/src/rtc.c new file mode 100644 index 0000000..00c220a --- /dev/null +++ b/drivers/src/rtc.c @@ -0,0 +1,197 @@ +/** + **************************************************************************************** + * + * @file rtc.c + * + * @brief Real Time Clock(RTC) Driver + * + **************************************************************************************** + */ + +#include "rtc.h" +#include "reg_aon.h" +#include "reg_apbmisc.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Config rtc module + * + * @param[in] en True to enable, False to disable + * + **************************************************************************************** + */ +void rtc_conf(bool en) +{ + #if (ROM_UNUSED) + // clock enable (keep enabled in rom) + // RCC->APBCLK_EN_RUN.AON_CLKEN_RUN = 1; + // RCC->APBCLK_EN_RUN.APBMISC_CLKEN_RUN = 1; + RCC_APBCLK_EN(APB_APBMISC_BIT | APB_AON_BIT); + #endif + + // rtc interrupt disable and status clear + APBMISC->RTCINT_CTRL.Word = 0x02; // .RTC_INT_EN = 0, .RTC_INT_CLR = 1 + + // rtc enable or disable + AON->BLE_RTC_CTL.RTC_EN = en; +} + +/** + **************************************************************************************** + * @brief Get current rtc-time. + * + * @return rtc-time value + **************************************************************************************** + */ +rtc_time_t rtc_time_get(void) +{ + rtc_time_t time; + + time.sec = APBMISC->RTC_SEC_SHD; + time.ms = APBMISC->RTC_MS_SHD; + + if (time.sec != APBMISC->RTC_SEC_SHD) + { + // just past to next second + time.sec = APBMISC->RTC_SEC_SHD; + time.ms = APBMISC->RTC_MS_SHD; + } + + return time; +} + +/** + **************************************************************************************** + * @brief Set/Change current time + * + * @param[in] sec second time + * @param[in] ms millisecond time (range: 0~999ms) + * + **************************************************************************************** + */ +void rtc_time_set(uint32_t sec, uint32_t ms) +{ + APBMISC->RTC_SEC = sec; + APBMISC->RTC_MS = ms; + + // wait rtc current time reg write finish + while(APBMISC->RTCINT_CTRL.RTC_SET_BUSY); +} + +/** + **************************************************************************************** + * @brief Set alarm time + * + * @param[in] ms_time time(unit in ms) to alarm + * + **************************************************************************************** + */ +void rtc_alarm_set(uint32_t ms_time) +{ + // Disable Interrupt, clear last + APBMISC->RTCINT_CTRL.RTC_INT_EN = 0; + APBMISC->RTCINT_CTRL.RTC_INT_CLR = 1; + + if (ms_time) + { + rtc_time_t time; + + // Wait rtc alarm time reg write finish + while(APBMISC->RTCINT_CTRL.RTC_SET_BUSY); + + // time = rtc_time_get(); + time.sec = APBMISC->RTC_SEC_SHD; + time.ms = APBMISC->RTC_MS_SHD; + + if (time.sec != APBMISC->RTC_SEC_SHD) + { + // just past to next second + time.sec = APBMISC->RTC_SEC_SHD; + time.ms = APBMISC->RTC_MS_SHD; + } + + // Add time, then set alarm + ms_time += time.ms; + APBMISC->RTC_ALARM_SEC = time.sec + (ms_time / 1000); + APBMISC->RTC_ALARM_MS = ms_time % 1000; + + // Enable Interrupt + APBMISC->RTCINT_CTRL.RTC_INT_EN = 1; + } +} + +/** + **************************************************************************************** + * @brief Get configured alarm rtc-time. + * + * @return rtc-time value + **************************************************************************************** + */ +rtc_time_t rtc_alarm_get(void) +{ + rtc_time_t time; + + time.sec = APBMISC->RTC_ALARM_SEC; + time.ms = APBMISC->RTC_ALARM_MS; + return time; +} + +/** + **************************************************************************************** + * @brief Judge alarm time reached or not, auto clear if reached. + * + * @return True if time reached, else False + **************************************************************************************** + */ +bool rtc_is_alarm(void) +{ + bool ret = APBMISC->RTCINT_CTRL.RTC_INT_ST; + + if (ret) + { + APBMISC->RTCINT_CTRL.RTC_INT_CLR = 1; + } + + return ret; +} + +/** + **************************************************************************************** + * @brief Set rtc interrupt mode + * + * @param[in] en True to interrupt enable, False to disable + * + **************************************************************************************** + */ +void rtc_irq_set(bool en) +{ + APBMISC->RTCINT_CTRL.RTC_INT_EN = en; + APBMISC->RTCINT_CTRL.RTC_INT_CLR = 1; +} + +/** + **************************************************************************************** + * @brief Set rtc wakeup mode + * + * @param[in] en True to enable wakeup, False to disable + * + **************************************************************************************** + */ +void rtc_wkup_set(bool en) +{ + AON->PMU_WKUP_CTRL.RTC_WKUP_EN = en; + APBMISC->AON_PMU_CTRL.WKUP_ST_CLR = 1; +} diff --git a/drivers/src/sadc.c b/drivers/src/sadc.c new file mode 100644 index 0000000..f0410d3 --- /dev/null +++ b/drivers/src/sadc.c @@ -0,0 +1,296 @@ +/** + **************************************************************************************** + * + * @file sadc.c + * + * @brief Successive Approximation A/D Converter (SADC) Driver + * + **************************************************************************************** + */ + +#include "reg_sadc.h" +#include "sadc.h" +#include "rcc.h" +#include "gpio.h" +#include "iopad.h" +#include "reg_rf.h" +#include "reg_timer.h" + +/* + * DEFINES + **************************************************************************************** + */ + + +// clear last flag, start conversion +#define SADC_START() \ + dowl( \ + SADC->STCTRL.SADC_AUX_FLG_CLR = 1; \ + SADC->CTRL.SADC_SOC = 1; \ + ) + +// wait aux_flag is 1 (conversion done), clear flag +#define SADC_AFLG_CLR() dowl( SADC->STCTRL.SADC_AUX_FLG_CLR = 1; ) +#define SADC_AFLG_WAIT() dowl( while (!(SADC->STCTRL.SADC_AUX_FLG)); ) + +#define SADC_CALIB_CNT (8) +#define SADC_CTRL_MSK (SADC_CR_CALIB_BIT | SADC_CR_CONV_MODE_BIT | SADC_CR_DMAEN_BIT \ + | SADC_CR_SAMP_MODE_MSK | SADC_CR_DBGEN_BIT) + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +static void sadc_calib(void) +{ +// uint32_t sel; + + // .SADC_EN=1 +// SADC->SADC_ANA_CTRL.SADC_EN = 1; + // .MIC_PD=1, .PGA_EN=0 + SADC->MIC_CTRL.Word = SADC_MIC_PWD_BIT; + + // .Calib_mode=1, .samp_mod=0 .Dbg_ctrl=0 + SADC->CTRL.Word = (SADC->CTRL.Word & ~SADC_CTRL_MSK) | (SADC_CR_CALIB_BIT | SADC_CR_SAMP_SOFT); + //debug("1-SADC(CR:%X,ANA:%X,MIC:%X,ST:%X)\r\n", SADC->CTRL.Word, SADC->SADC_ANA_CTRL.Word, SADC->MIC_CTRL.Word, SADC->STCTRL.Word); + + // SADC_START(); + SADC->CTRL.SADC_SOC = 1; + SADC_AFLG_WAIT(); + +// for (sel = 0; sel < SADC_CALIB_CNT; sel++)// --20230601 +// { +// SADC->SADC_CALIB_DATSEL = sel; +// SADC->SADC_CALIB_DATOUT; // read +// //debug("CALIB DATOUT:%X\r\n", SADC->SADC_CALIB_DATOUT); +// } + + SADC_AFLG_CLR(); + + // disable calibration + SADC->CTRL.Word &= ~SADC_CR_CALIB_BIT; +} + +void sadc_init(uint32_t ana_ctrl) +{ + RCC_AHBCLK_DIS(AHB_ADC_BIT); + RCC_AHBRST_REQ(AHB_ADC_BIT); + RCC_AHBCLK_EN(AHB_ADC_BIT); + + SADC->SADC_ANA_CTRL.Word = ana_ctrl; + + sadc_calib(); +} + +void sadc_conf(uint32_t ctrl) +{ + SADC->STCTRL.SADC_AUX_FLG_CLR = 1; + SADC->CTRL.Word = ctrl; +} + +uint16_t sadc_read(uint8_t chset, uint16_t times) +{ + uint16_t dout; + + // .SADC_EN=1 +// SADC->SADC_ANA_CTRL.SADC_EN = 1; + // .MIC_PD=1, .PGA_EN=0 + SADC->MIC_CTRL.Word = SADC_MIC_PWD_BIT; + + // .Calib_mode=0, .conv_mode=1 or 0, .sadc_dmac_en=0, .samp_mod=0 .Dbg_ctrl=0 + uint16_t cr_val = (times > 0) ? (SADC_CR_CONV_CONTINUE | SADC_CR_SAMP_SOFT) : (SADC_CR_CONV_SINGLE | SADC_CR_SAMP_SOFT); + SADC->CTRL.Word = (SADC->CTRL.Word & ~SADC_CTRL_MSK) | cr_val; + // .auto_sw_ch=0, Set sadc_ch_set0 + SADC->AUTO_SW_CTRL.Word = 0; + SADC->CH_CTRL.SADC_CH_SET0 = chset; + + //Clear + SADC_AFLG_CLR(); + + // SADC_START(); + SADC->CTRL.SADC_SOC = 1; + SADC_AFLG_WAIT(); + dout = SADC->AUX_ST.SADC_AUX_DOUT; + SADC_AFLG_CLR(); + + if (times > 0) + { + for (uint16_t i = 1; i < times; i++) + { +// SADC_AFLG_WAIT(); + dout += SADC->AUX_ST.SADC_AUX_DOUT; +// SADC_AFLG_CLR(); + } + + dout /= times; + // Stop continuous mode .conv_mode=0 .sadc_soc=1 + SADC->CTRL.SADC_CONV_MODE = 0; + SADC->CTRL.SADC_SOC = 1; + SADC_AFLG_CLR(); + } + + return dout; +} + +void sadc_stop(void) +{ + // Stop continuous mode .conv_mode=0 .sadc_soc=1 + SADC->CTRL.SADC_CONV_MODE = 0; + SADC->CTRL.SADC_SOC = 1; + SADC_AFLG_CLR(); +} + +void sadc_dma(uint8_t sw_auto, uint32_t ch_ctrl) +{ + if (sw_auto < 0x10) + { + // .SADC_EN=1 +// SADC->SADC_ANA_CTRL.SADC_EN = 1; + // .MIC_PD=1, .PGA_EN=0 + SADC->MIC_CTRL.Word = SADC_MIC_PWD_BIT; + + // .Calib_mode=0, .conv_mode=1, .sadc_dmac_en=1, .samp_mod=0 .Dbg_ctrl=0 + SADC->CTRL.Word = (SADC->CTRL.Word & ~SADC_CTRL_MSK) | (SADC_CR_CONV_CONTINUE | SADC_CR_DMAEN_BIT | SADC_CR_SAMP_SOFT); + // .auto_sw_ch=0 or 1, Set sadc_ch_set0 + SADC->AUTO_SW_CTRL.Word = sw_auto; + SADC->CH_CTRL.SADC_CH_SET0 = ch_ctrl; + + // SADC_START(); + SADC->CTRL.SADC_SOC = 1; + } + else + { + // Stop continuous mode .conv_mode=0 .sadc_soc=1 + SADC->CTRL.SADC_CONV_MODE = 0; + SADC->CTRL.SADC_SOC = 1; + } +} + +void sadc_rssi(uint8_t rf_rsv) +{ + // .SADC_EN=1 +// SADC->SADC_ANA_CTRL.SADC_EN = 1; + // .MIC_PD=1, .PGA_EN=0 + SADC->MIC_CTRL.Word = SADC_MIC_PWD_BIT; + + // .Calib_mode=0, .conv_mode=0, .sadc_dmac_en=0, .samp_mod=1 .Dbg_ctrl=0 + SADC->CTRL.Word = (SADC->CTRL.Word & ~SADC_CTRL_MSK) | (SADC_CR_SAMP_RSSI); + // .auto_sw_ch=0, .sadc_ch_set0=15 + SADC->AUTO_SW_CTRL.Word = 0; + SADC->CH_CTRL.SADC_CH_SET0 = SADC_CH_RFRSV; + RF->RF_RSV = rf_rsv; + + // Set sadc_rssi_samp_dly sadc_aux_clk_div=16M + // no need software set sadc_soc to start +} + +void sadc_pcm(uint32_t mic_sel) +{ + if (mic_sel) + { + // micbias and micin io configure + GPIO_DIR_CLR(GPIO02 | GPIO03); + iom_ctrl(PA02, IOM_HIZ); + iom_ctrl(PA03, IOM_ANALOG); + + // .SADC_EN=1 +// SADC->SADC_ANA_CTRL.SADC_EN = 1; + // .MIC_PD=0, .PGA_EN=1; Set PGA_VOL + SADC->MIC_CTRL.Word = mic_sel; + SADC->DC_OFFSET = 0x200; + + // .Calib_mode=0, .conv_mode=0, .sadc_dmac_en=1, .samp_mod=2 .Dbg_ctrl=0 + SADC->CTRL.Word = (SADC->CTRL.Word & ~SADC_CTRL_MSK) | (SADC_CR_DMAEN_BIT | SADC_CR_SAMP_PCM); + + // .auto_sw_ch=0, .sadc_ch_set0=4 + SADC->AUTO_SW_CTRL.Word = 0; + SADC->CH_CTRL.SADC_CH_SET0 = SADC_CH_PGAOUT; + + // SADC_START(); + SADC->CTRL.SADC_SOC = 1; + } + else + { + // Stop decimation filter mode + SADC->CTRL.SADC_DECIM_END = 1; + } +} + +void sadc_atmr(uint8_t sw_auto, uint32_t ch_ctrl) +{ + // Set ADTIM work as basic timer and trigger source is uevent (mms = 3'b010) + ATMR->CR2.MMS = 2; + + // .SADC_EN=1 +// SADC->SADC_ANA_CTRL.SADC_EN = 1; + // .MIC_PD=1, .PGA_EN=0 + SADC->MIC_CTRL.Word = SADC_MIC_PWD_BIT; + + // .Calib_mode=0, .conv_mode=0, .sadc_dmac_en=1, .samp_mod=3 .Dbg_ctrl=0 .sadc_aux_clk_div=0 + SADC->CTRL.Word = (SADC->CTRL.Word & ~(SADC_CTRL_MSK | SADC_CR_CLK_DIV_MSK)) | (SADC_CR_DMAEN_BIT | SADC_CR_SAMP_ADTMR); + // .auto_sw_ch=0 or 1, Set sadc_ch_set0 + SADC->AUTO_SW_CTRL.Word = sw_auto; + SADC->CH_CTRL.SADC_CH_SET0 = ch_ctrl; + + // SADC_START(); + SADC->CTRL.SADC_SOC = 1; +} + +uint32_t sadc_rand_num(void) +{ + uint32_t random_num = 0; + uint32_t sadc_bak[5] = {0}; + + if (SADC->SADC_ANA_CTRL.Word & SADC_EN_BIT) + { + sadc_bak[0] = SADC->SADC_ANA_CTRL.Word; + sadc_bak[1] = SADC->CTRL.Word; + sadc_bak[2] = SADC->SADC_ANA_CTRL.Word; + sadc_bak[3] = SADC->AUTO_SW_CTRL.Word; + sadc_bak[4] = SADC->CH_CTRL.Word; + } + + // .EN_BG + RF->ANA_EN_CTRL.Word = 0x00070000; + // bit0:rf_temp + RF->RF_RSV = 0x0000B801; + + SADC->SADC_ANA_CTRL.Word = 0x0011B6D9; + SADC->CTRL.Word = 0x09FB0010; + SADC->CH_CTRL.Word = 0x0F; + + for (uint8_t cnt = 0; cnt < 32; cnt++) + { + SADC->CTRL.SADC_AUX_CLK_DIV = cnt; + + SADC->SADC_ANA_CTRL.Word = ((cnt & 0x07) << SADC_IBSEL_CMP_LSB) | ((cnt & 0x07) << SADC_IBSEL_VCM_LSB) + | ((cnt & 0x07) << SADC_IBSEL_VREF_LSB) | ((cnt & 0x07) << SADC_IBSEL_BUF_LSB) + | ((cnt & 0x03) << SADC_CALCAP_LSB) | SADC_INBUF_BYPSS_BIT | SADC_VREF_VBG | SADC_EN_BIT; + // start conversion + SADC->CTRL.SADC_SOC = 1; + + SADC_AFLG_WAIT(); + + // clear flag + SADC->STCTRL.SADC_AUX_FLG_CLR = 1; + + random_num |= ((((SADC->AUX_ST.Word) & 0x01)) << (cnt)); + } + + RF->RF_RSV = 0x0000B800; + + if (sadc_bak[0] & SADC_EN_BIT) + { + SADC->SADC_ANA_CTRL.Word = sadc_bak[2]; + SADC->AUTO_SW_CTRL.Word = sadc_bak[3]; + SADC->CH_CTRL.Word = sadc_bak[4]; + SADC->SADC_ANA_CTRL.Word = sadc_bak[0]; + SADC->CTRL.Word = sadc_bak[1]; + + sadc_calib(); + } + + return random_num; +} diff --git a/drivers/src/spi.c b/drivers/src/spi.c new file mode 100644 index 0000000..acaf02c --- /dev/null +++ b/drivers/src/spi.c @@ -0,0 +1,231 @@ +/** + **************************************************************************************** + * + * @file spi.c + * + * @brief Serial Peripheral Interface(SPI) Master/Slave Role Driver + * + **************************************************************************************** + */ + +#include "spi.h" +#include "rcc.h" +#include "iopad.h" +#include "reg_spim.h" +#include "reg_spis.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +#define NSG_BYTE (0xFF) // Non-significant data + +#define SPIM_BGN(len) dowl( SPIM->DAT_LEN = (len); SPIM->TXRX_BGN = 1; ) +#define SPIM_WAIT() dowl( while (SPIM->STATUS.SPIM_BUSY); SPIM->STATUS_CLR.Word = SPIM_STATUS_CLR_ALL; ) + + +/* + * FUNCTIONS - SPI Master + **************************************************************************************** + */ + +void spim_init(uint8_t io_clk, uint8_t io_miso, uint8_t io_mosi) +{ + // i2c_clk_en rst_req or soft_reset + RCC_AHBCLK_EN(AHB_SPIM_BIT); + RCC_AHBRST_REQ(AHB_SPIM_BIT); + + // csc connect + csc_output(io_clk, CSC_SPIM_CLK); + csc_input(io_miso, CSC_SPIM_MISO); + csc_output(io_mosi, CSC_SPIM_MOSI); + + // iomode control + iom_ctrl(io_clk, IOM_SEL_CSC | IOM_DRV_LVL1 | IOM_PULLUP); + iom_ctrl(io_miso, IOM_SEL_CSC | IOM_PULLUP | IOM_INPUT); + iom_ctrl(io_mosi, IOM_SEL_CSC | IOM_DRV_LVL1 | IOM_PULLUP); +} + +void spim_conf(uint32_t ctrl) +{ + // clear FiFo and inner counter + SPIM->STATUS_CLR.Word = SPIM_STATUS_CLR_ALL; + + // config ctrl + SPIM->CTRL.Word = ctrl; +} + +void spim_begin(uint16_t data_len) +{ + //if (SPIM->STATUS.SPIM_BUSY == 0) - rm, dma mode not fit + SPIM_BGN(data_len); +} + +void spim_wait(void) +{ + SPIM_WAIT(); +} + +void spim_duplex(const uint8_t *tx_data, uint8_t *rx_buff, uint16_t length) +{ + uint32_t tidx, ridx; + + SPIM_BGN(length); + + for (tidx = 0, ridx = 0; ridx < length; ) + { + if ((tidx < length) && (SPIM->STATUS.SPIM_TX_FFULL == 0)) + { + SPIM->TX_DATA = tx_data[tidx++]; + } + + if (SPIM->STATUS.SPIM_RX_FEMPTY == 0) + { + rx_buff[ridx++] = SPIM->RX_DATA; + } + } + + SPIM_WAIT(); +} + +void spim_transimit(const uint8_t *tx_data, uint16_t length) +{ + uint32_t tidx, ridx;; + + SPIM_BGN(length); + + // send cmd + for (tidx = 0, ridx = 0; ridx < length; ) + { + if ((tidx < length) && (SPIM->STATUS.SPIM_TX_FFULL == 0)) + { + SPIM->TX_DATA = tx_data[tidx++]; + } + + if (SPIM->STATUS.SPIM_RX_FEMPTY == 0) + { + SPIM->RX_DATA; // drop + ridx++; + } + } + + SPIM_WAIT(); +} + +void spim_receive(uint8_t *rx_buff, uint16_t length) +{ + uint32_t tidx, ridx; + + SPIM_BGN(length); + + // recv rsp + for (tidx = 0, ridx = 0; ridx < length; ) + { + if ((tidx < length) && (SPIM->STATUS.SPIM_TX_FFULL == 0)) + { + SPIM->TX_DATA = NSG_BYTE; + tidx++; + } + + if (SPIM->STATUS.SPIM_RX_FEMPTY == 0) + { + rx_buff[ridx++] = SPIM->RX_DATA; + } + } + + SPIM_WAIT(); +} + +void spim_halfdx(const uint8_t *cmd, uint16_t clen, uint8_t *rsp, uint16_t rlen) +{ + uint32_t tidx, ridx; + + SPIM_BGN(clen + rlen); + + // send cmd + for (tidx = 0, ridx = 0; ridx < clen; ) + { + if ((tidx < clen) && (SPIM->STATUS.SPIM_TX_FFULL == 0)) + { + SPIM->TX_DATA = cmd[tidx++]; + } + + if (SPIM->STATUS.SPIM_RX_FEMPTY == 0) + { + SPIM->RX_DATA; // drop + ridx++; + } + } + + // recv rsp + for (tidx = 0, ridx = 0; ridx < rlen; ) + { + if ((tidx < rlen) && (SPIM->STATUS.SPIM_TX_FFULL == 0)) + { + SPIM->TX_DATA = NSG_BYTE; + tidx++; + } + + if (SPIM->STATUS.SPIM_RX_FEMPTY == 0) + { + rsp[ridx++] = SPIM->RX_DATA; + } + } + + SPIM_WAIT(); +} + +/* + * FUNCTIONS - SPI Slave + **************************************************************************************** + */ + +void spis_init(uint8_t io_cs, uint8_t io_clk, uint8_t io_miso, uint8_t io_mosi) +{ + // i2c_clk_en rst_req or soft_reset + RCC_AHBCLK_EN(AHB_SPIS_BIT); + RCC_AHBRST_REQ(AHB_SPIS_BIT); + + // csc connect + csc_input(io_cs, CSC_SPIS_CSN); + csc_input(io_clk, CSC_SPIS_CLK); + csc_output(io_miso, CSC_SPIS_MISO); + csc_input(io_mosi, CSC_SPIS_MOSI); + + // iomode control + iom_ctrl(io_cs, IOM_SEL_CSC | IOM_PULLUP | IOM_INPUT); + iom_ctrl(io_clk, IOM_SEL_CSC | IOM_PULLUP | IOM_INPUT); + iom_ctrl(io_miso, IOM_SEL_CSC | IOM_DRV_LVL1 | IOM_PULLUP); + iom_ctrl(io_mosi, IOM_SEL_CSC | IOM_PULLUP | IOM_INPUT); +} + +void spis_conf(uint32_t ctrl) +{ + // disable run + SPIS->CTRL.Word = 0; + // clear FiFo and Interrupt + SPIS->INFO_CLR.Word = SPIS_INFO_CLR_ALL; + + // config ctrl + SPIS->CTRL.Word = ctrl; +} + +bool spis_getc(uint8_t *ch) +{ + if (SPIS->STATUS.SPIS_RXFIFO_EMPTY == 0) + { + *ch = SPIS->RX_DAT; + //SPIS->INFO_CLR.Word = SPIS_RXINT_CLR_BIT; + return true; + } + + return false; +} + +void spis_putc(uint8_t ch) +{ + while (SPIS->STATUS.SPIS_TXFIFO_FULL); + SPIS->TX_DAT = ch; +} diff --git a/drivers/src/sysdbg.c b/drivers/src/sysdbg.c new file mode 100644 index 0000000..b49bcb6 --- /dev/null +++ b/drivers/src/sysdbg.c @@ -0,0 +1,186 @@ +/** + **************************************************************************************** + * + * @file sysdbg.c + * + * @brief System Debug Observation + * + **************************************************************************************** + */ + +#include "sysdbg.h" +#include "gpio.h" +#include "reg_csc.h" +#include "reg_mdm.h" +#include "reg_rf.h" +#include "reg_syscfg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +void sysdbg_iomap(uint32_t pio) +{ + pio &= SYS_DBG_PIO_MSK; + + for (uint8_t i = 2; i < 20; i++) + { + if (pio & (1UL << i)) + { + iom_ctrl(i, IOM_SEL_DEBUG);//CSC->CSC_PIO[i].Word = IOM_SEL_DEBUG; + } + else if (CSC->CSC_PIO[i].Word == IOM_SEL_DEBUG) + { + iom_ctrl(i, IOM_SEL_GPIO); //CSC->CSC_PIO[i].Word = IOM_SEL_GPIO; + } + } +} + +void sysdbg_anatst(uint8_t tsten, uint8_t atsel) +{ + // Note: pu, pd, oe, ie dsiable, gpio mode + if (tsten & ATEN_AT0_BIT) + { + GPIO_DIR_CLR(1UL << PA_AT0); + iom_ctrl(PA_AT0, IOM_ANALOG); + + RF->ANAMISC_CTRL1.AT0_SEL = atsel & 0x0F; + } + + if (tsten & ATEN_AT1_BIT) + { + GPIO_DIR_CLR(1UL << PA_AT1); + iom_ctrl(PA_AT1, IOM_ANALOG); + + RF->ANAMISC_CTRL1.AT1_SEL = (atsel >> 4) & 0x0F; + } + + RF->ANAMISC_CTRL1.TSTEN_CBPF = (tsten & ATEN_CBPF_BIT) ? 1 : 0; + RF->ANAMISC_CTRL1.TSTEN_RSSI = (tsten & ATEN_RSSI_BIT) ? 1 : 0; +} + +void sysdbg_select(uint8_t dbgsel, uint32_t diag) +{ + if (dbgsel == SYS_DBG_RF) + { + // 2'b01: tx debug port, 2'b10: rx debug port, 2'b11: calib_cnt_debug + RF->DIG_CTRL.RF_DBG_SEL = (diag & 0x03); + } + else if (dbgsel == SYS_DBG_BLE) + { + // BB DIAG1 0x83, 0x8300, 0x8383 + (*(volatile uint32_t *)0x50000050) = diag; + } + else if (dbgsel == SYS_DBG_MDM) + { + MDM->REG0.DEBUG_MODE = diag; + } + else if (dbgsel == SYS_DBG_USB) + { + SYSCFG->DBG_CTRL.USB_DBG_SEL = diag; + } + else + { + return; // not support + } + + SYSCFG->DBG_CTRL.SYS_DEBUG_SEL = dbgsel; +} + +#if 0 + +/***********************************************************/ +// tx debug map +// IO | Debug +// 3:0 fsm_pa_gain_vb[3:0] +// 4 fast_lock_done +// 5 pll_lock +// 6 fsm_out_tx_en +// 7 fsm_cal_clken +// 8 fsm_gain_cal_en +// 9 fsm_afc_en +// 10 fsm_tx_ldo_en +// 11 fsm_en_pll +// 12 fsm_in_tx_en + +// rx debug map +// IO | Debug +// 0 fsm_en_agc +// 1 fsm_cal_clken +// 2 fsm_en_pa +// 3 fsm_en_lna +// 4 fast_lock_done +// 5 pll_lock +// 6 fsm_bpf_cal_en +// 7 fsm_out_rx_en +// 8 fsm_afc_en +// 9 fsm_rx_ldo_en +// 10 fsm_en_pll +// 11 fsm_in_rx_en +/***********************************************************/ +void sysdbg_sel_rf(uint8_t txrx) +{ + // 2'b01: tx debug port, 2'b10: rx debug port + RF->DIG_CTRL.RF_DBG_SEL = (txrx & 0x03); + + SYSCFG->DBG_CTRL.SYS_DEBUG_SEL = SYS_DBG_RF; +} + +/***********************************************************/ +// Modem debug(debug_mode = 1) bit Map +// IO | func +// 0 mclk +// 1 reset_n +// 3:2 rate +// 4 tx_en +// 5 tx_data +// 6 tx_valid +// 7 receive_start +// 8 vb_decoder_flush +// 9 sync_pulse +// 10 rx_valid +// 11 rx_data +// 12 tx_invert +// 13 rx_invert +// 14 acc_invert +// 15 iq_invert +/***********************************************************/ +// Modem debug(debug_mode = 3) bit Map +// IO | func +// 0 mclk +// 2:1 rate +// 3 receive_start +// 4 vb_decoder_flush +// 5 i_in +// 6 q_in +// 7 sync_pulse +// 8 rx_valid +// 9 rx_data +// 10 demod_ready +// 11 demod_clk +// 12 demod_data +/***********************************************************/ +void sysdbg_sel_mdm(uint8_t mode) +{ + MDM->REG0.DEBUG_MODE = mode; + + SYSCFG->DBG_CTRL.SYS_DEBUG_SEL = SYS_DBG_MDM; +} + +void sysdbg_sel_ble(uint32_t diag) +{ + // BB DIAG1 0x83, 0x8300, 0x8383 + (*(volatile uint32_t *)0x50000050) = diag; + + SYSCFG->DBG_CTRL.SYS_DEBUG_SEL = SYS_DBG_BLE; +} + +#endif diff --git a/drivers/src/timer.c b/drivers/src/timer.c new file mode 100644 index 0000000..d37791a --- /dev/null +++ b/drivers/src/timer.c @@ -0,0 +1,97 @@ +/** + **************************************************************************************** + * + * @file timer.c + * + * @brief Base/Common/Advance Timer Driver + * + **************************************************************************************** + */ + +#include "timer.h" +#include "rcc.h" +#include "reg_timer.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +#if defined(CTMR_BASE) +#define TMR_USED(tmr) ((TIMER_TypeDef* )(CTMR_BASE + (tmr) * 0x1000)) +#else +#define TMR_USED(tmr) (((tmr) == PWM_CTMR) ? CTMR : ATMR) +#endif + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +#if 0 +void btmr_delay(uint16_t tpsc, uint16_t tcnt) +{ + // config Params + BTMR->CR1.Word = CR1_ONE_MODE; + BTMR->PSC = tpsc - 1; + BTMR->ARR = tcnt - 1; + BTMR->CNT = 0; + BTMR->EGR = 1; + + // enable CEN, wait Time-Reach + BTMR->CR1.CEN = 1; + while(!BTMR->RIF && BTMR->CR1.CEN); + BTMR->ICR = 1; + + // clear Mode + BTMR->CR1.Word = 0; +} +#endif + +void ctmr_init(uint16_t psc, uint16_t arr) +{ + RCC_APBCLK_EN(APB_CTMR_BIT); + RCC_APBRST_REQ(APB_CTMR_BIT); + + CTMR->CR1.Word = 0; //.CEN = 0; + CTMR->PSC = psc; + CTMR->ARR = arr; +} + +void ctmr_ctrl(uint16_t mode, uint16_t intr) +{ + // clear interrupt, then enable + CTMR->ICR.Word = intr; + CTMR->IER.Word = intr; + // event generation + CTMR->EGR.Word = intr | 0x01/*.UG*/; + + // conf control (counter start from 0) + CTMR->CNT = 0; + CTMR->CR1.Word = mode; +} + +void adtmr_init(uint16_t psc, uint16_t arr) +{ + RCC_APBCLK_EN(APB_ATMR_BIT); + RCC_APBRST_REQ(APB_ATMR_BIT); + + ATMR->CR1.Word = 0; // .CEN = 0; + ATMR->PSC = psc; + ATMR->ARR = arr; +} + +void adtmr_ctrl(uint16_t mode, uint16_t intr) +{ + // clear interrupt, then enable + ATMR->ICR.Word = intr; + ATMR->IER.Word = intr; + // event generation + ATMR->EGR.Word = intr | 0x01/*.UG*/; + + // conf control (counter start from 0) + ATMR->CNT = 0; + ATMR->CR1.Word = mode; +} diff --git a/drivers/src/trim.c b/drivers/src/trim.c new file mode 100644 index 0000000..f07bb26 --- /dev/null +++ b/drivers/src/trim.c @@ -0,0 +1,199 @@ +#include "b6x.h" +#include "regs.h" +#include "trim.h" + +//first sector(4k Bytes) use to keep trim info +//#define FSH_TRIM_ADDR 0x18000FDC +#define FSH_TRIM_ADDR 0x18000F00 +#define TRIM_VAL_NUM 7 // vdd12_vol + VAL00~VAL05 + +#define TRIM_VALID_IDX 6 // TRIM_VAL05 +#define TRIM_VALID_VALUE 0xC8F5D5B6 +#define TRIM_VALID_OFFSET (TRIM_VALID_IDX * sizeof(uint32_t)) // 0x14 +#define TRIM_TOTAL_SIZE (TRIM_VAL_NUM * sizeof(uint32_t)) // 0x18 + +// TRIM 0A: Flash XorKey +typedef union +{ + struct + { + uint32_t XOSC16M_CAP_TRIM_VAILD: 4; // bit[3:0] + uint32_t XOSC16M_CAP_TRIM: 6; // bit[9:4] + uint32_t Reserved: 22; // bit[31:10] + }; + uint32_t Word; +} TRIM_VAL00_Typedef; + +typedef union +{ + struct + { + uint32_t RANDOM_SEED; // bit[31:0] + }; + uint32_t Word; +} TRIM_VAL01_Typedef; + +typedef union +{ + struct + { + uint32_t LDO_TX_TRIM: 3; // bit[2:0] + uint32_t LDO_RX_TRIM: 3; // bit[5:3] + uint32_t BPF_CAL_CODE_EXT: 6; // bit[11:6] + uint32_t BG_RES_TRIM: 5; // bit[16:12] + uint32_t BG_BIAS_TRIM: 2; // bit[18:17] + uint32_t MIC_TRIM: 7; // bit[25:19] + uint32_t Reserved: 6; // bit[31:26] add 6vp 1118 + }; + uint32_t Word; +} TRIM_VAL02_Typedef; + +typedef union +{ + struct + { + uint32_t RC16M_FREQ_TRIM_VAILD: 4; // bit[3:0] + uint32_t RC16M_FREQ_TRIM: 6; // bit[9:4] + uint32_t RC16M_FREQ_VALUE: 12; // bit[21:10] // rc16m freq value + // [21:17] integer(8~24MHz), [16:10] decimal((0~99)*10KHz) + uint32_t Reserved: 2; // bit[23:22] + uint32_t LDO_XOSC_TR_VAILD: 4; // bit[27:24] + uint32_t LDO_XOSC_TR: 4; // bit[31:28] + }; + uint32_t Word; +} TRIM_VAL03_Typedef; + +typedef union +{ + struct + { + uint32_t VOLTAGE_TRIM_VALID: 4; // bit[3:0] + uint32_t CORELDO_TRIM_RUN: 5; // bit[8:4] + uint32_t CORELDO_TRIM_DP: 5; // bit[13:9] + uint32_t AONLDO_TRIM_RUN: 4; // bit[17:14] + uint32_t AONLDO_TRIM_OFF: 4; // bit[21:18] + uint32_t Reserved: 4; // bit[25:22] + uint32_t BK_BOD_TRIM: 3; // bit[28:26] + uint32_t LDO_LVD_SEL: 3; // bit[31:29] + }; + uint32_t Word; +} TRIM_VAL04_Typedef; + +typedef union +{ + struct + { + uint32_t TRIM_VALID_FLAG; // bit[31:0] + }; + uint32_t Word; +} TRIM_VAL05_Typedef; + +typedef struct +{ + TRIM_VAL00_Typedef VAL00; + TRIM_VAL01_Typedef VAL01; + TRIM_VAL02_Typedef VAL02; + TRIM_VAL03_Typedef VAL03; + TRIM_VAL04_Typedef VAL04; + TRIM_VAL05_Typedef VAL05; +} TRIM_Typedef; + +void trim_load(void) +{ + // adjust coreldo and aonldo voltage to 1.2v + // AONLDO VOL > CORELDO VOL, BKHOLD_CTRL defult:0x2008 +// AON->BKHOLD_CTRL.CORELDO_TRIM_RUN = 0x1B; +// AON->BKHOLD_CTRL.AONLDO_TRIM_RUN = 0x01; + AON->BKHOLD_CTRL.Word = (0x01B1UL << AON_AONLDO_TRIM_RUN_LSB) | (AON->BKHOLD_CTRL.Word & 0xFFFFUL); + + // LDO_UD_CTRL default:0x100 + // deepsleep mode, coreldo auto undertension to 1.0v +// APBMISC->LDO_UD_CTRL.CORELDO_TRIM_DP = 0x14; +// APBMISC->LDO_UD_CTRL.CORELDO_TRIM_STEP = 0x03; + + // poweroff mode, aonldo auto undertension to 1.0v +// APBMISC->LDO_UD_CTRL.AONLDO_TRIM_OFF = 0x04; +// APBMISC->LDO_UD_CTRL.AONLDO_UD_STEP = 0x07; + APBMISC->LDO_UD_CTRL.Word = 0x00740314; + + // DBG_CTRL default:0x00 +// SYSCFG->DBG_CTRL.IWDT_DEBUG = 1; + SYSCFG->DBG_CTRL.Word = (0x01UL << SYSCFG_IWDT_DEBUG_POS); + + // flash trim vaild judge + if (RD_32(FSH_TRIM_ADDR + 0x18) != TRIM_VALID_VALUE) + { + return ; // trim invaild + } + + uint32_t i, values[TRIM_VAL_NUM]; // 'i' reduce size, 6vp 1118 + + // values[0]: VDD12 Voltage + TRIM_Typedef *trim = (TRIM_Typedef *)(values + 1); + + for (i = 0; i < (TRIM_VAL_NUM - 1); i++) + { + values[i] = RD_32(FSH_TRIM_ADDR + (i << 2)); + } + + // val04 +// AON->PMU_ANA_CTRL.BK_BOD_TRIM = trim->VAL04.BK_BOD_TRIM; +// AON->PMU_ANA_CTRL.LDO_LVD_SEL = trim->VAL04.LDO_LVD_SEL; + + if ((trim->VAL04.Word != 0xFFFFFFFF) && (trim->VAL04.Word & 0x0A) == 0x0A) + { + // coreldo + AON->BKHOLD_CTRL.CORELDO_TRIM_RUN = trim->VAL04.CORELDO_TRIM_RUN; + APBMISC->LDO_UD_CTRL.CORELDO_TRIM_DP = trim->VAL04.CORELDO_TRIM_DP; + + // aonldo + AON->BKHOLD_CTRL.AONLDO_TRIM_RUN = trim->VAL04.AONLDO_TRIM_RUN; + APBMISC->LDO_UD_CTRL.AONLDO_TRIM_OFF = trim->VAL04.AONLDO_TRIM_OFF; + } + + if ((trim->VAL03.Word != 0xFFFFFFFF) && (trim->VAL03.Word & 0x0A) == 0x0A) + { + APBMISC->RC16M_FREQ_TRIM = trim->VAL03.RC16M_FREQ_TRIM; + } + + if ((trim->VAL00.Word != 0xFFFFFFFF) && (trim->VAL00.Word & 0x0A) == 0x0A) + { + APBMISC->XOSC16M_CTRL.XOSC16M_CAP_TR = trim->VAL00.XOSC16M_CAP_TRIM; + } + + if ((trim->VAL02.Word != 0xFFFFFFFF) && (trim->VAL02.Word != 0x00)) + { + RF->ANA_TRIM.BG_RES_TRIM = (trim->VAL02.Word & 0x0001F000) >> 12; + } + + // no used +// if ((trim->VAL03.Word & 0x0A000000) == 0x0A000000) +// { +// APBMISC->XOSC16M_CTRL.LDO_XOSC_TR = trim->VAL03.LDO_XOSC_TR; +// } +} + +uint32_t get_trim_rc16m_freq(void) +{ + uint32_t val = RD_32(FSH_TRIM_ADDR + 0x10); //0x001F35BA + uint32_t rc16m_freq = 0; + + if ((val != 0xFFFFFFFF) && (val & 0x0A) == 0x0A) + { + rc16m_freq = (((val & 0x003E0000) >> 17) * 1000000) + (((val & 0x0001FC00) >> 10) * 10000); + } + + return rc16m_freq; +} + +uint32_t get_trim_vdd12_voltage(void) +{ + uint32_t val = RD_32(FSH_TRIM_ADDR + 0x00); + + return ((val == 0xFFFFFFFF) ? 0 : (val - 4)); +} + +//uint32_t get_trim_rand_seed(void) +//{ +// return RD_32(FSH_TRIM_ADDR + 0x08); +//} diff --git a/drivers/src/uart.c b/drivers/src/uart.c new file mode 100644 index 0000000..edb09b2 --- /dev/null +++ b/drivers/src/uart.c @@ -0,0 +1,146 @@ +/** + **************************************************************************************** + * + * @file uart.c + * + * @brief UART Driver + * + **************************************************************************************** + */ +#include "reg_uart.h" +#include "reg_gpio.h" +#include "uart.h" +#include "iopad.h" +#include "rcc.h" + +/* + * DEFINES + **************************************************************************************** + */ + +/// Get UARTx Pointer, 'port' : 0-UART1, 1-UART2 +#if defined(UART1_BASE) +#define UART_PTR(port) ((UART_TypeDef *)(UART1_BASE + (port) * 0x1000)) +#else +#define UART_PTR(port) ((port == 0) ? UART1 : UART2) +#endif + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +void uart_init(uint8_t port, uint8_t io_tx, uint8_t io_rx) +{ + iom_ctrl(io_rx, IOM_SEL_CSC | IOM_PULLUP | IOM_INPUT); + iom_ctrl(io_tx, IOM_SEL_CSC | IOM_PULLUP | IOM_DRV_LVL1); + + //iocsc_uart(port, io_tx, io_rx); + csc_output(io_tx, CSC_UART1_TXD + port * 2); + csc_input(io_rx, CSC_UART1_RXD + port * 2); + + // uart_clk_en rst_req + RCC_APBCLK_EN(1 << (RCC_UART1_CLKEN_RUN_POS + port)); + RCC_APBRST_REQ(1 << (RCC_UART1_RSTREQ_POS + port)); + + uint8_t delay_cnt = 0x09; + // Delay for Uart busy + while (delay_cnt--) //220ns/cnt(64Mhz test need delay 906ns) --20231204 WHL + { + if ((GPIO->PIN >> io_rx) & 0x01) + return; + } +} + +void uart_hwfc(uint8_t port, uint8_t io_rts, uint8_t io_cts) +{ + UART_TypeDef* uart = UART_PTR(port); + + //iocsc_uart_hwfc(port, io_rts, io_cts); + csc_output(io_rts, CSC_UART1_RTS + port); + csc_input(io_cts, CSC_UART1_CTS + port); + + iom_ctrl(io_rts, IOM_SEL_CSC | IOM_DRV_LVL1 | IOM_PULLUP); + iom_ctrl(io_cts, IOM_SEL_CSC | IOM_PULLUP | IOM_INPUT); + + // enable auto ctrl bit[3:2] (.AFCEN=1, .RTSCTRL=1) + uart->MCR.Word |= 0x0C; +} + +void uart_conf(uint8_t port, uint16_t cfg_BRR, uint16_t cfg_LCR) +{ + UART_TypeDef* uart = UART_PTR(port); + + // clear en + uart->LCR.Word = 0; + + // update BaudRate + uart->LCR.BRWEN = 1; + uart->BRR = cfg_BRR; // (rcc_sysclk_get() + (baud >> 1)) / baud + uart->LCR.BRWEN = 0; + + // enable fifo mode, reset + uart->FCR.Word |= 0x07; // FIFOEN RFRST TFRST + + // config params, enable + uart->LCR.Word = cfg_LCR | LCR_RXEN_BIT; +} + +void uart_fctl(uint8_t port, uint8_t fifo_ctl, uint16_t bits_rto, uint16_t intr_en) +{ + UART_TypeDef* uart = UART_PTR(port); + + uart->FCR.Word = fifo_ctl; // | FCR_FIFOEN_BIT; // set bit[7:0] + uart->RTOR.Word = bits_rto; // .RTO bit[23:0] + uart->LCR.RTOEN = (bits_rto) ? 1 : 0; + + uart->IDR.Word = UART_IR_ALL_MSK; + uart->IER.Word = intr_en; +} + +void uart_mctl(uint8_t port, uint8_t dma) +{ + UART_TypeDef *uart = UART_PTR(port); + + uart->MCR.DMAEN = dma; + uart->LCR.RTO_SEL = dma; +} + +void uart_putc(uint8_t port, uint8_t ch) +{ + UART_TypeDef *uart = UART_PTR(port); + + while (!(uart->SR.TBEM)); + uart->TBR = ch; +} + +uint8_t uart_getc(uint8_t port) +{ + UART_TypeDef *uart = UART_PTR(port); + + while (!(uart->SR.DR)); + return (uint8_t)(uart->RBR); +} + +void uart_wait(uint8_t port) +{ + UART_TypeDef *uart = UART_PTR(port); + + while (!(uart->SR.TBEM)); // wait tx finish + while (uart->SR.BUSY); // wait idle state +} + +void uart_send(uint8_t port, uint16_t len, const uint8_t *data) +{ + UART_TypeDef *uart = UART_PTR(port); + + while (len--) + { + while (!(uart->SR.TBEM)); + uart->TBR = *data++; + } + + while (!(uart->SR.TBEM)); // wait tx finish + while (uart->SR.BUSY); // wait idle state +} diff --git a/drivers/src/utils.h b/drivers/src/utils.h new file mode 100644 index 0000000..89e168c --- /dev/null +++ b/drivers/src/utils.h @@ -0,0 +1,461 @@ +/** + **************************************************************************************** + * + * @file utils.h + * + * @brief Common Utilities definitions (functions and macros). + * + **************************************************************************************** + */ + +#ifndef _UTILS_H_ +#define _UTILS_H_ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include +#include +#include + +#ifndef __INLINE__ +#define __INLINE__ __forceinline static +#endif + +#ifndef ASSERT_ERR +/// Assertions showing a critical error +#define ASSERT_ERR(cond) + +/// Assertions showing a critical info +#define ASSERT_INFO(cond, param0, param1) + +/// Assertions showing a non-critical problem +#define ASSERT_WARN(cond, param0, param1) + +/// DUMP data array present in the SW. +#define DUMP_DATA(data, length) +#endif + + +/* + * MACRO + **************************************************************************************** + */ + +/// Value with one bit set +#define BIT(pos) (1UL<<(pos)) + +/// Number of '1' bits in a byte, used to fasten bit counting +extern const unsigned char one_bits[]; //{0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4}; +#define ONE_BITS(byte) (one_bits[byte & 0x0F] + one_bits[byte >> 4]) + +/// Get the number of elements within an array +#define ARRAY_LEN(array) (sizeof((array))/sizeof((array)[0])) + +/// maroc to Get a structure from one of its structure field +#define CONTAINER_OF(ptr, type, member) ((type *)((char *)ptr - offsetof(type,member))) + +/// Bit checking +#define CHKF(flag, mask) (((flag)&(mask)) == mask) + +/// Get a field from a value containing several fields +/// @param[in] __r bit field value +/// @param[in] __f field name(_MASK & _LSB) +/// @return the value of the register masked and shifted +#define GETF(__r, __f) (( (__r) & (__f##_MASK) ) >> (__f##_LSB)) + +/// Set a field value into a value containing several fields. +/// @param[in] __r bit field value +/// @param[in] __f field name(_MASK & _LSB) +/// @param[in] __v value to put in field +#define SETF(__r, __f, __v) \ + do { \ + ASSERT_ERR( ( ( ( (__v) << (__f##_LSB) ) & ( ~(__f##_MASK) ) ) ) == 0); \ + __r = (((__r) & ~(__f##_MASK)) | (__v) << (__f##_LSB)); \ + } while (0) + +/// Get a bit field from a value containing several fields +/// @param[in] __r bit field value +/// @param[in] __b bit field name(_BIT & _POS) +/// @return the value of the register masked and shifted +#define GETB(__r, __b) (( (__r) & (__b##_BIT) ) >> (__b##_POS)) + +/// set a bit field value into a value containing several fields. +/// @param[in] __r bit field value +/// @param[in] __b bit field name +/// @param[in] __v value to put in field +#define SETB(__r, __b, __v) \ + do { \ + ASSERT_ERR( ( ( ( (__v) << (__b##_POS) ) & ( ~(__b##_BIT) ) ) ) == 0 ); \ + __r = (((__r) & ~(__b##_BIT)) | (__v) << (__b##_POS)); \ + } while (0) + + +/// Align value on the multiple of 4 equal or nearest higher. +/// @param[in] val Value to align. +#define ALIGN4_HI(_val) (((_val) + 3) & ~3) + +/// Align value on the multiple of 4 equal or nearest lower. +/// * @param[in] _val Value to align. +#define ALIGN4_LO(_val) ((_val) & ~3) + +/// @brief Align value on the multiple of 2 equal or nearest higher. +/// * @param[in] _val Value to align. +#define ALIGN2_HI(_val) (((_val) + 1) & ~1) + +/// @brief Align value on the multiple of 2 equal or nearest lower. +/// * @param[in] _val Value to align. +#define ALIGN2_LO(_val) ((_val) & ~1) + + +/// Perform a modulo(%) operation +/// @param[in] _val Dividend +/// @param[in] _div Divisor +#define MOD(_val, _div) ((_val) % (_div)) + +/// Perform a division and ceil up the result +/// * @param[in] _val Value to divide +/// * @param[in] _div Divide value +#define DIV_CEIL(_val, _div) (((_val) + ((_div) - 1))/ (_div)) + +/// Perform a division and round the result +/// @param[in] _val Value to divide +/// @param[in] _div Divide value +#define DIV_ROUND(_val, _div) (((_val) + ((_div) >> 1))/ (_div)) + +/// Increment value (wrap to 0 if reach max) +/// * @param[in] _val Value to inc +/// * @param[in] _max Max Range +#define VAL_INC(_val, _max) \ + (_val) = (_val) + 1; \ + if ((_val) >= (_max)) (_val) = 0 + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Function to initialize the random seed. + * @param[in] seed The seed number to use to generate the random sequence. + **************************************************************************************** + */ +__INLINE__ void rand_init(uint32_t seed) +{ + srand(seed); +} + +/** + **************************************************************************************** + * @brief Function to get an 8 bit random number. + * @return Random byte value. + **************************************************************************************** + */ +__INLINE__ uint8_t rand_byte(void) +{ + return (uint8_t)(rand() & 0xFF); +} + +/** + **************************************************************************************** + * @brief Function to get an 16 bit random number. + * @return Random half word value. + **************************************************************************************** + */ +__INLINE__ uint16_t rand_hword(void) +{ + return (uint16_t)(rand() & 0xFFFF); +} + +/** + **************************************************************************************** + * @brief Function to get an 32 bit random number. + * @return Random word value. + **************************************************************************************** + */ +__INLINE__ uint32_t rand_word(void) +{ + return (uint32_t)rand(); +} + + +/** + **************************************************************************************** + * @brief Read an aligned 32 bit word. + * @param[in] ptr32 The address of the first byte of the 32 bit word. + * @return The 32 bit value. + **************************************************************************************** + */ +__INLINE__ uint32_t read32(const void *ptr32) +{ + return *((uint32_t*)ptr32); +} + +/** + **************************************************************************************** + * @brief Read an aligned 16 bits word. + * @param[in] ptr16 The address of the first byte of the 16 bits word. + * @return The 16 bits value. + **************************************************************************************** + */ +__INLINE__ uint16_t read16(const void *ptr16) +{ + return *((uint16_t*)ptr16); +} + +/** + **************************************************************************************** + * @brief Write an aligned 32 bits word. + * @param[in] ptr32 The address of the first byte of the 32 bits word. + * @param[in] value The value to write. + **************************************************************************************** + */ +__INLINE__ void write32(const void *ptr32, uint32_t value) +{ + *(uint32_t*)ptr32 = value; +} + +/** + **************************************************************************************** + * @brief Write an aligned 16 bits word. + * @param[in] ptr16 The address of the first byte of the 16 bits word. + * @param[in] value The value to write. + **************************************************************************************** + */ +__INLINE__ void write16(const void *ptr16, uint32_t value) +{ + *(uint16_t*)ptr16 = value; +} + +/** + **************************************************************************************** + * @brief Write a 8 bits word. + * @param[in] ptr8 The address of the first byte of the 8 bits word. + * @param[in] value The value to write. + **************************************************************************************** + */ +__INLINE__ void write8(const void *ptr8, uint32_t value) +{ + *(uint8_t*)ptr8 = value; +} + +/** + **************************************************************************************** + * @brief Read a packed 16 bits word. + * @param[in] ptr16 The address of the first byte of the 16 bits word. + * @return The 16 bits value. + **************************************************************************************** + */ +__INLINE__ uint16_t read16p(const void *ptr16) +{ + uint16_t value = ((uint8_t *)ptr16)[0] | ((uint8_t *)ptr16)[1] << 8; + return value; +} + +/** + **************************************************************************************** + * @brief Write a packed 16 bits word. + * @param[in] ptr16 The address of the first byte of the 16 bits word. + * @param[in] value The value to write. + **************************************************************************************** + */ +__INLINE__ void write16p(const void *ptr16, uint16_t value) +{ + uint8_t *ptr=(uint8_t*)ptr16; + + *ptr++ = value&0xff; + *ptr = (value&0xff00)>>8; +} + +/** + **************************************************************************************** + * @brief Read a packed 24 bits word. + * @param[in] ptr24 The address of the first byte of the 24 bits word. + * @return The 24 bits value. + **************************************************************************************** + */ +__INLINE__ uint32_t read24p(const void *ptr24) +{ + uint16_t addr_l, addr_h; + addr_l = read16p(ptr24); + addr_h = *((uint8_t *)ptr24 + 2) & 0x00FF; + return ((uint32_t)addr_l | (uint32_t)addr_h << 16); +} + +/** + **************************************************************************************** + * @brief Write a packed 24 bits word. + * @param[in] ptr24 The address of the first byte of the 24 bits word. + * @param[in] value The value to write. + **************************************************************************************** + */ +__INLINE__ void write24p(const void *ptr24, uint32_t value) +{ + uint8_t *ptr=(uint8_t*)ptr24; + + *ptr++ = (uint8_t)(value&0xff); + *ptr++ = (uint8_t)((value&0xff00)>>8); + *ptr++ = (uint8_t)((value&0xff0000)>>16); +} + +/** + **************************************************************************************** + * @brief Read a packed 32 bits word. + * @param[in] ptr32 The address of the first byte of the 32 bits word. + * @return The 32 bits value. + **************************************************************************************** + */ +__INLINE__ uint32_t read32p(const void *ptr32) +{ + uint16_t addr_l, addr_h; + addr_l = read16p(ptr32); + addr_h = read16p((uint8_t *)ptr32 + 2); + return ((uint32_t)addr_l | (uint32_t)addr_h << 16); +} + +/** + **************************************************************************************** + * @brief Write a packed 32 bits word. + * @param[in] ptr32 The address of the first byte of the 32 bits word. + * @param[in] value The value to write. + **************************************************************************************** + */ +__INLINE__ void write32p(const void *ptr32, uint32_t value) +{ + uint8_t *ptr=(uint8_t*)ptr32; + + *ptr++ = (uint8_t)(value&0xff); + *ptr++ = (uint8_t)((value&0xff00)>>8); + *ptr++ = (uint8_t)((value&0xff0000)>>16); + *ptr = (uint8_t)((value&0xff000000)>>24); +} + + +/** + **************************************************************************************** + * @brief Count leading zeros. + * @param[in] val Value to count the number of leading zeros on. + * @return Number of leading zeros when value is written as 32 bits. + **************************************************************************************** + */ +__INLINE__ uint32_t co_clz(uint32_t val) +{ + #if defined(__arm__) + return __builtin_clz(val); + #elif defined(__GNUC__) + if (val == 0) + { + return 32; + } + return __builtin_clz(val); + #else + uint32_t i; + for (i = 0; i < 32; i++) + { + if (val & BIT(31 - i)) + break; + } + return i; + #endif // defined(__arm__) +} + +/** + **************************************************************************************** + * @brief Count trailing zeros. + * @param[in] val Value to count the number of trailing zeros on. + * @return Number of trailing zeros when value is written as 32 bits. + **************************************************************************************** + */ +__INLINE__ uint32_t co_ctz(uint32_t val) +{ + #if defined(__arm__) + return __builtin_ctz(val); + #elif defined(__GNUC__) + if (val == 0) + { + return 32; + } + return __builtin_ctz(val); + #else + uint32_t i; + for (i = 0; i < 32; i++) + { + if (val & BIT(i)) + break; + } + return i; + #endif // defined(__arm__) +} + +/** + **************************************************************************************** + * @brief Count binary ones. + * @param[in] val Value to count the number of ones in the binary representation. + * @return Number of ones when value is written as 32 bits. + **************************************************************************************** + */ +__INLINE__ uint32_t co_ones(uint32_t val) +{ + #if defined(__arm__) || defined(__GNUC__) + return __builtin_popcount(val); + #else + uint32_t i, ones=0; + for (i = 0; i < 32; i++) + { + if (val & BIT(i)) + ones++; + } + return ones; + #endif // defined(__arm__) +} + +/** + **************************************************************************************** + * @brief Function to return the smallest of 2 unsigned 32 bits words. + * @return The smallest value. + **************************************************************************************** + */ +__INLINE__ uint32_t co_min(uint32_t a, uint32_t b) +{ + return a < b ? a : b; +} + +/** + **************************************************************************************** + * @brief Function to return the smallest of 2 signed 32 bits words. + * @return The smallest value. + **************************************************************************************** + */ +__INLINE__ int32_t co_min_s(int32_t a, int32_t b) +{ + return a < b ? a : b; +} + +/** + **************************************************************************************** + * @brief Function to return the greatest of 2 unsigned 32 bits words. + * @return The greatest value. + **************************************************************************************** + */ +__INLINE__ uint32_t co_max(uint32_t a, uint32_t b) +{ + return a > b ? a : b; +} + +/** + **************************************************************************************** + * @brief Function to return the absolute value of a signed integer. + * @return The absolute value. + **************************************************************************************** + */ +__INLINE__ int co_abs(int val) +{ + return val < 0 ? val*(-1) : val; +} + + +#endif // _UTILS_H_ diff --git a/examples/_blank/mdk/JLinkSettings.ini b/examples/_blank/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/examples/_blank/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/examples/_blank/mdk/blank.uvoptx b/examples/_blank/mdk/blank.uvoptx new file mode 100644 index 0000000..28af3c9 --- /dev/null +++ b/examples/_blank/mdk/blank.uvoptx @@ -0,0 +1,345 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + blank + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC5000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + DLGUARM + + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 0 + 1 + gBleSleep + + + + + 1 + 10 + 0x20005000 + 0 + + + + + 2 + 1 + 0x50000000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + System Viewer\CSC + 35904 + + + System Viewer\GPIO + 35905 + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 4 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 5 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 4 + 6 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/examples/_blank/mdk/blank.uvprojx b/examples/_blank/mdk/blank.uvprojx new file mode 100644 index 0000000..acd18b8 --- /dev/null +++ b/examples/_blank/mdk/blank.uvprojx @@ -0,0 +1,440 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + blank + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + blank + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\mdk;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/examples/_blank/mdk/clean.bat b/examples/_blank/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/examples/_blank/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/examples/_blank/src/cfg.h b/examples/_blank/src/cfg.h new file mode 100644 index 0000000..03a2546 --- /dev/null +++ b/examples/_blank/src/cfg.h @@ -0,0 +1,20 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// System Clock(0=16MHz, 1=32MHz, 2=48MHz, 3=64MHz) +#define SYS_CLK (0) + +/// Debug Mode: 0=Disable, 1=via UART, 2=RTT Viewer +#define DBG_MODE (0) + +#endif //_APP_CFG_H_ diff --git a/examples/_blank/src/main.c b/examples/_blank/src/main.c new file mode 100644 index 0000000..b3d66e5 --- /dev/null +++ b/examples/_blank/src/main.c @@ -0,0 +1,60 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +static void sysInit(void) +{ + // Todo config, if need + +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + iwdt_disable(); + + dbgInit(); + debug("Start(rsn:0x%X)...\r\n", rsn); +} + + +static void userProc(void) +{ + // Todo user procedure + +} + +int main(void) +{ + sysInit(); + devInit(); + + while (1) + { + userProc(); + } +} diff --git a/examples/adpcm/mdk/JLinkSettings.ini b/examples/adpcm/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/examples/adpcm/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/examples/adpcm/mdk/adpcm.uvoptx b/examples/adpcm/mdk/adpcm.uvoptx new file mode 100644 index 0000000..577bfeb --- /dev/null +++ b/examples/adpcm/mdk/adpcm.uvoptx @@ -0,0 +1,347 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + adpcm + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC5000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + DLGUARM + + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 0 + 1 + gBleSleep + + + + + 1 + 10 + 0x20005000 + 0 + + + + + 2 + 1 + 0x50000000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\src\adpcm.c + adpcm.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 5 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 6 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 4 + 7 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/examples/adpcm/mdk/adpcm.uvprojx b/examples/adpcm/mdk/adpcm.uvprojx new file mode 100644 index 0000000..53bc766 --- /dev/null +++ b/examples/adpcm/mdk/adpcm.uvprojx @@ -0,0 +1,445 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + adpcm + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + adpcm + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\mdk;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + adpcm.c + 1 + ..\src\adpcm.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/examples/adpcm/mdk/clean.bat b/examples/adpcm/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/examples/adpcm/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/examples/adpcm/src/adpcm.c b/examples/adpcm/src/adpcm.c new file mode 100644 index 0000000..73507d4 --- /dev/null +++ b/examples/adpcm/src/adpcm.c @@ -0,0 +1,312 @@ +/* +** Intel/DVI ADPCM coder/decoder. +** +** The algorithm for this coder was taken from the IMA Compatability Project +** proceedings, Vol 2, Number 2; May 1992. +** +** Version 1.2, 18-Dec-92. +** +** Change log: +** - Fixed a stupid bug, where the delta was computed as +** stepsize*code/4 in stead of stepsize*(code+0.5)/4. +** - There was an off-by-one error causing it to pick +** an incorrect delta once in a blue moon. +** - The NODIVMUL define has been removed. Computations are now always done +** using shifts, adds and subtracts. It turned out that, because the standard +** is defined using shift/add/subtract, you needed bits of fixup code +** (because the div/mul simulation using shift/add/sub made some rounding +** errors that real div/mul don't make) and all together the resultant code +** ran slower than just using the shifts all the time. +** - Changed some of the variable names to be more meaningful. +*/ + +#include "adpcm.h" +#include "stdint.h" + +/* Intel ADPCM step variation table */ +const int8_t indexTable[16] = { + -1, -1, -1, -1, 2, 4, 6, 8, + -1, -1, -1, -1, 2, 4, 6, 8, +}; + +const uint16_t stepsizeTable[89] = { + 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, + 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, + 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, + 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, + 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, + 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, + 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358, + 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, + 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767 +}; + + +int adpcm_coder(short* indata, char* outdata, int len, struct adpcm_state* state) +{ + int val; /* Current input sample value */ + unsigned int delta; /* Current adpcm output value */ + int diff; /* Difference between val and valprev */ + int step; /* Stepsize */ + int valpred; /* Predicted output value */ + int vpdiff; /* Current change to valpred */ + int index; /* Current step change index */ + unsigned int outputbuffer = 0;/* place to keep previous 4-bit value */ + int count = 0; /* the number of bytes encoded */ + + valpred = state->valprev; + index = (int)state->index; + step = stepsizeTable[index]; + + while (len > 0) { + /* Step 1 - compute difference with previous value */ + val = *indata++; + diff = val - valpred; + if (diff < 0) + { + delta = 8; + diff = (-diff); + } + else + { + delta = 0; + } + + /* Step 2 - Divide and clamp */ + /* Note: + ** This code *approximately* computes: + ** delta = diff*4/step; + ** vpdiff = (delta+0.5)*step/4; + ** but in shift step bits are dropped. The net result of this is + ** that even if you have fast mul/div hardware you cannot put it to + ** good use since the fixup would be too expensive. + */ + vpdiff = (step >> 3); + + if (diff >= step) { + delta |= 4; + diff -= step; + vpdiff += step; + } + step >>= 1; + if (diff >= step) { + delta |= 2; + diff -= step; + vpdiff += step; + } + step >>= 1; + if (diff >= step) { + delta |= 1; + vpdiff += step; + } + + /* Phil Frisbie combined steps 3 and 4 */ + /* Step 3 - Update previous value */ + /* Step 4 - Clamp previous value to 16 bits */ + if ((delta & 8) != 0) + { + valpred -= vpdiff; + if (valpred < -32768) + valpred = -32768; + } + else + { + valpred += vpdiff; + if (valpred > 32767) + valpred = 32767; + } + + /* Step 5 - Assemble value, update index and step values */ + index += indexTable[delta]; + if (index < 0) index = 0; + else if (index > 88) index = 88; + step = stepsizeTable[index]; + + /* Step 6 - Output value */ + outputbuffer = (delta << 4); + + /* Step 1 - compute difference with previous value */ + val = *indata++; + diff = val - valpred; + if (diff < 0) + { + delta = 8; + diff = (-diff); + } + else + { + delta = 0; + } + + /* Step 2 - Divide and clamp */ + /* Note: + ** This code *approximately* computes: + ** delta = diff*4/step; + ** vpdiff = (delta+0.5)*step/4; + ** but in shift step bits are dropped. The net result of this is + ** that even if you have fast mul/div hardware you cannot put it to + ** good use since the fixup would be too expensive. + */ + vpdiff = (step >> 3); + + if (diff >= step) { + delta |= 4; + diff -= step; + vpdiff += step; + } + step >>= 1; + if (diff >= step) { + delta |= 2; + diff -= step; + vpdiff += step; + } + step >>= 1; + if (diff >= step) { + delta |= 1; + vpdiff += step; + } + + /* Phil Frisbie combined steps 3 and 4 */ + /* Step 3 - Update previous value */ + /* Step 4 - Clamp previous value to 16 bits */ + if ((delta & 8) != 0) + { + valpred -= vpdiff; + if (valpred < -32768) + valpred = -32768; + } + else + { + valpred += vpdiff; + if (valpred > 32767) + valpred = 32767; + } + + /* Step 5 - Assemble value, update index and step values */ + index += indexTable[delta]; + if (index < 0) index = 0; + else if (index > 88) index = 88; + step = stepsizeTable[index]; + + /* Step 6 - Output value */ + *outdata++ = (unsigned char)(delta | outputbuffer); + count++; + len -= 2; + } + + state->valprev = (short)valpred; + state->index = (char)index; + + return count; +} + +// 解码 +int adpcm_decoder(char* indata, short* outdata, int len, struct adpcm_state* state) +{ + unsigned int delta; /* Current adpcm output value */ + int step; /* Stepsize */ + int valpred; /* Predicted value */ + int vpdiff; /* Current change to valpred */ + int index; /* Current step change index */ + unsigned int inputbuffer = 0;/* place to keep next 4-bit value */ + int count = 0; + + valpred = state->valprev; + index = (int)state->index; + step = stepsizeTable[index]; + + /* Loop unrolling by Phil Frisbie */ + /* This assumes there are ALWAYS an even number of samples */ + while (len-- > 0) { + + /* Step 1 - get the delta value */ + inputbuffer = (unsigned int)*indata++; + delta = (inputbuffer >> 4) & 0xf;// &0xf 防止溢出 + + /* Step 2 - Find new index value (for later) */ + + index += indexTable[delta]; + if (index < 0) index = 0; + else if (index > 88) index = 88; + + + + /* Phil Frisbie combined steps 3, 4, and 5 */ + /* Step 3 - Separate sign and magnitude */ + /* Step 4 - Compute difference and new predicted value */ + /* Step 5 - clamp output value */ + /* + ** Computes 'vpdiff = (delta+0.5)*step/4', but see comment + ** in adpcm_coder. + */ + vpdiff = step >> 3; + if ((delta & 4) != 0) vpdiff += step; + if ((delta & 2) != 0) vpdiff += step >> 1; + if ((delta & 1) != 0) vpdiff += step >> 2; + + if ((delta & 8) != 0) + { + valpred -= vpdiff; + if (valpred < -32768) + valpred = -32768; + } + else + { + valpred += vpdiff; + if (valpred > 32767) + valpred = 32767; + } + + /* Step 6 - Update step value */ + step = stepsizeTable[index]; + + /* Step 7 - Output value */ + *outdata++ = (short)valpred; + + /* Step 1 - get the delta value */ + delta = inputbuffer & 0xf; + + /* Step 2 - Find new index value (for later) */ + index += indexTable[delta]; + if (index < 0) index = 0; + else if (index > 88) index = 88; + + /* Phil Frisbie combined steps 3, 4, and 5 */ + /* Step 3 - Separate sign and magnitude */ + /* Step 4 - Compute difference and new predicted value */ + /* Step 5 - clamp output value */ + /* + ** Computes 'vpdiff = (delta+0.5)*step/4', but see comment + ** in adpcm_coder. + */ + vpdiff = step >> 3; + if ((delta & 4) != 0) vpdiff += step; + if ((delta & 2) != 0) vpdiff += step >> 1; + if ((delta & 1) != 0) vpdiff += step >> 2; + + if ((delta & 8) != 0) + { + valpred -= vpdiff; + if (valpred < -32768) + valpred = -32768; + } + else + { + valpred += vpdiff; + if (valpred > 32767) + valpred = 32767; + } + + /* Step 6 - Update step value */ + step = stepsizeTable[index]; + + /* Step 7 - Output value */ + *outdata++ = (short)valpred; + count += 2; + } + + state->valprev = (short)valpred; + state->index = (char)index; + + return count; +} diff --git a/examples/adpcm/src/adpcm.h b/examples/adpcm/src/adpcm.h new file mode 100644 index 0000000..8790994 --- /dev/null +++ b/examples/adpcm/src/adpcm.h @@ -0,0 +1,27 @@ +/* +** adpcm.h - include file for adpcm coder. +** +** Version 1.0, 7-Jul-92. +*/ + +#ifndef ADPCM_H +#define ADPCM_H + +#ifdef __cplusplus +extern "C" { +#endif + +struct adpcm_state { + short valprev; /* Previous output value */ + char index; /* Index into stepsize table */ +}; + +//len 是采样点的个数,不是字节大小 +int adpcm_coder(short* indata, char* outdata, int len, struct adpcm_state* state); +int adpcm_decoder(char* indata, short* outdata, int len, struct adpcm_state* state); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* ADPCM_H*/ diff --git a/examples/adpcm/src/cfg.h b/examples/adpcm/src/cfg.h new file mode 100644 index 0000000..e961157 --- /dev/null +++ b/examples/adpcm/src/cfg.h @@ -0,0 +1,17 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// Debug Mode: 0=Disable, 1=via UART, 2=RTT Viewer +#define DBG_MODE (1) + +#endif //_APP_CFG_H_ diff --git a/examples/adpcm/src/main.c b/examples/adpcm/src/main.c new file mode 100644 index 0000000..c5321e7 --- /dev/null +++ b/examples/adpcm/src/main.c @@ -0,0 +1,96 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "adpcm.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +static void sysInit(void) +{ + // Todo config, if need + +} + +static void devInit(void) +{ + iwdt_disable(); + + dbgInit(); + + debug("ADPCM Test...\r"); +} + +static void adpcmTest(void) +{ + struct adpcm_state state; + int iRead = 128; + uint16_t rawBuff[128] = {0}; + uint8_t wavBuff[64] = {0}; + + GPIO_DIR_SET_LO(GPIO08); + for (uint16_t i = 0; i < 128; i++) + { + rawBuff[i] = 0x08*i; + } + debug("RAW0:\r\n"); + debugHex(rawBuff, 128); + + state.index = 0; + state.valprev = 0; + GPIO_DAT_SET(GPIO08); + adpcm_coder((short*)rawBuff, (char*)wavBuff, (iRead), &state); + GPIO_DAT_CLR(GPIO08); + debug("WAV0(%d,%d):\r\n", state.index, state.valprev); + debugHex(wavBuff, 64); + + state.index = 0; + state.valprev = 0; + memset(rawBuff, 0, sizeof(rawBuff)); + GPIO_DAT_SET(GPIO08); + adpcm_decoder((char*)wavBuff, (short*)rawBuff, (iRead), &state); + GPIO_DAT_CLR(GPIO08); + debug("RAW1(%d,%d):\r\n", state.index, state.valprev); + debugHex(rawBuff, 128); + + state.index = 0; + state.valprev = 0; + GPIO_DAT_SET(GPIO08); + adpcm_coder((short*)rawBuff, (char*)wavBuff, (iRead), &state); + GPIO_DAT_CLR(GPIO08); + debug("WAV1(%d,%d):\r\n", state.index, state.valprev); + debugHex(wavBuff, 64); +} + +int main(void) +{ + sysInit(); + devInit(); + + adpcmTest(); + + while(1) + { + + } +} diff --git a/examples/clrAll.bat b/examples/clrAll.bat new file mode 100644 index 0000000..233e9fb --- /dev/null +++ b/examples/clrAll.bat @@ -0,0 +1,7 @@ +@echo off +echo @ Clean All Project's target... +echo. +for /f "delims=" %%i in ('dir /a-d/b /s "clean.bat"') do (call "%%i") +echo @ Cleaned. +echo. +#pause \ No newline at end of file diff --git a/examples/dmaTest/mdk/JLinkSettings.ini b/examples/dmaTest/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/examples/dmaTest/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/examples/dmaTest/mdk/clean.bat b/examples/dmaTest/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/examples/dmaTest/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/examples/dmaTest/mdk/dmaTest.uvoptx b/examples/dmaTest/mdk/dmaTest.uvoptx new file mode 100644 index 0000000..062926a --- /dev/null +++ b/examples/dmaTest/mdk/dmaTest.uvoptx @@ -0,0 +1,358 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + dmaTest + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC5000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + DLGUARM + + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 0 + 1 + gBleSleep + + + 1 + 1 + DMA_RX_BUFF + + + + + 1 + 10 + 0x20005000 + 0 + + + + + 2 + 1 + 0x50000000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + System Viewer\UART1 + 35905 + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\src\dma_test.c + dma_test.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 5 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 6 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 4 + 7 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/examples/dmaTest/mdk/dmaTest.uvprojx b/examples/dmaTest/mdk/dmaTest.uvprojx new file mode 100644 index 0000000..3ea5b95 --- /dev/null +++ b/examples/dmaTest/mdk/dmaTest.uvprojx @@ -0,0 +1,445 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + dmaTest + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + dmaTest + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\mdk;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + dma_test.c + 1 + ..\src\dma_test.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/examples/dmaTest/src/cfg.h b/examples/dmaTest/src/cfg.h new file mode 100644 index 0000000..e961157 --- /dev/null +++ b/examples/dmaTest/src/cfg.h @@ -0,0 +1,17 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// Debug Mode: 0=Disable, 1=via UART, 2=RTT Viewer +#define DBG_MODE (1) + +#endif //_APP_CFG_H_ diff --git a/examples/dmaTest/src/dma_test.c b/examples/dmaTest/src/dma_test.c new file mode 100644 index 0000000..b88572c --- /dev/null +++ b/examples/dmaTest/src/dma_test.c @@ -0,0 +1,292 @@ +/** + **************************************************************************************** + * + * @file dma_test.c + * + * @brief DMA demo for UART Rx Tx. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +#define DMA_IRQ_MODE (1) // 1-Interrupt, 0-Polling + +/// DMA chnl & ccm +#define DMA_CH_UART_RX DMA_CH0 // Ping-Pong mode +#define DMA_CH_UART_TX DMA_CH1 // Basic mode + +/// Uart Port and Params +#define TEST_PORT UART1_PORT +#define TEST_BAUD BRR_DIV(115200, 16M) +#define TEST_LCRS LCR_BITS(8, 1, none) + +#define TEST_RTOR (100) // Timeout (n)SYM=(n/10)Bytes +#define TEST_FCTL (FCR_FIFOEN_BIT | FCR_RXTL_1BYTE) +#define TEST_INTR (UART_IR_RTO_BIT) + +/// Avoid conflict GPIOs of UART_DBG if diff port +#define PA_UART_TX (6) +#define PA_UART_RX (7) + +/// GPIOs for watching +#define GPIO_RUN GPIO08 +#define GPIO_TX_DONE GPIO09 +#define GPIO_RX_PING GPIO10 +#define GPIO_RX_PONG GPIO11 +#define GPIO_RX_RTOR GPIO12 + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +/// *************** UART Buffer Func *************** +#define TXD_BUFF_SIZE (0x10) +#define RXD_BUFF_SIZE (0x200) +#define RXD_BUFF_HALF (RXD_BUFF_SIZE / 2) // Ping-Pong half + +volatile uint16_t rxdHead; +volatile uint16_t rxdTail; +uint8_t rxdBuffer[RXD_BUFF_SIZE]; // __attribute__((aligned(4))) +uint8_t txdBuffer[TXD_BUFF_SIZE]; + +uint16_t uart_size(void) +{ + return ((rxdHead + RXD_BUFF_SIZE - rxdTail) % RXD_BUFF_SIZE); +} + +uint16_t uart_read(uint8_t *buff, uint16_t max) +{ + uint16_t head = rxdHead; + uint16_t tail = rxdTail; + uint16_t tlen, len; + if ((max == 0) || (head == tail)) + { + return 0; // empty + } + + len = (head + RXD_BUFF_SIZE - tail) % RXD_BUFF_SIZE; + if (len > max) len = max; + + if ((head > tail) || (tail + len <= RXD_BUFF_SIZE)) + { + memcpy(&buff[0], (const void *)&rxdBuffer[tail], len); + } + else + { + tlen = RXD_BUFF_SIZE - tail; + + memcpy(&buff[0], (const void *)&rxdBuffer[tail], tlen); // tail_len + memcpy(&buff[tlen], (const void *)&rxdBuffer[0], len - tlen); // head_len + } + rxdTail = (tail + len) % RXD_BUFF_SIZE; + + return len; // count +} + +/// *************** DMA Event Func *************** +volatile bool rxChnlAlt = false; +volatile bool txChnlBusy = false; + +static void dmaUartRxDone(void) +{ + rxChnlAlt = dma_chnl_reload(DMA_CH_UART_RX); + if (rxChnlAlt) + { + // head to Pong + rxdHead = RXD_BUFF_HALF; + // Ping done pulse + GPIO_DAT_SET(GPIO_RX_PING); + GPIO_DAT_CLR(GPIO_RX_PING); + } + else + { + // head to Ping + rxdHead = 0; + // Pong done pulse + GPIO_DAT_SET(GPIO_RX_PONG); + GPIO_DAT_CLR(GPIO_RX_PONG); + } +} + +static void dmaUartRxRtor(void) +{ + uint32_t iflag = UART1->IFM.Word; // UART1->RIF.Word; + + if (iflag & UART_IR_RTO_BIT) + { + GPIO_DAT_SET(GPIO_RX_RTOR); + + // clear rto + UART1->ICR.Word = UART_IR_RTO_BIT; + + // update head to middle + if (rxChnlAlt) + { + rxdHead = RXD_BUFF_HALF + (RXD_BUFF_HALF - dma_chnl_remain(DMA_CH_UART_RX | DMA_CH_ALT)); + } + else + { + rxdHead = 0 + (RXD_BUFF_HALF - dma_chnl_remain(DMA_CH_UART_RX)); + } + + GPIO_DAT_CLR(GPIO_RX_RTOR); + } +} + +#if (DMA_IRQ_MODE) +void DMAC_IRQHandler(void) +{ + uint32_t iflag = DMACHCFG->IFLAG0; + + GPIO_DAT_SET(GPIO_RUN); + + // disable intr + DMACHCFG->IEFR0 &= ~iflag; + // clear intr flag + DMACHCFG->ICFR0 = iflag; + + if (iflag & (1UL << DMA_CH_UART_RX)) + { + dmaUartRxDone(); + } + + if (iflag & (1UL << DMA_CH_UART_TX)) + { + txChnlBusy = false; + GPIO_DAT_SET(GPIO_TX_DONE); + GPIO_DAT_CLR(GPIO_TX_DONE); + } + + // re-enable intr + DMACHCFG->IEFR0 |= iflag; + + GPIO_DAT_CLR(GPIO_RUN); +} + +void UART1_IRQHandler(void) +{ + dmaUartRxRtor(); +} + +static void dmaUartLoop(void) +{ + uint16_t len; + + if (txChnlBusy) + { + return; + } + + len = uart_read(txdBuffer, TXD_BUFF_SIZE); + if (len > 0) + { + txChnlBusy = true; + DMA_UARTx_TX_CONF(DMA_CH_UART_TX, 1, txdBuffer, len, CCM_BASIC); + } +} + +void dmaUartSend(const uint8_t *data, uint16_t len) +{ + txChnlBusy = true; + DMA_UARTx_TX_CONF(DMA_CH_UART_TX, 1, data, len, CCM_BASIC); + + while (txChnlBusy); // wait done + //while (!(UART1->SR.TEM)); //Wait Transmitter Empty +} +#else +static void dmaPolling(void) +{ + if (dma_chnl_done(DMA_CH_UART_RX)) + { + GPIO_DAT_SET(GPIO_RUN); + dmaUartRxDone(); + GPIO_DAT_CLR(GPIO_RUN); + } + else + { + dmaUartRxRtor(); + } +} + +static void dmaUartLoop(void) +{ + uint16_t len; + + if (txChnlBusy) + { + if (!dma_chnl_done(DMA_CH_UART_TX)) + { + return; // wait done + } + + txChnlBusy = false; + GPIO_DAT_SET(GPIO_TX_DONE); + GPIO_DAT_CLR(GPIO_TX_DONE); + } + + len = uart_read(txdBuffer, TXD_BUFF_SIZE); + if (len > 0) + { + txChnlBusy = true; + DMA_UARTx_TX_CONF(DMA_CH_UART_TX, 1, txdBuffer, len, CCM_BASIC); + } +} + +void dmaUartSend(const uint8_t *data, uint16_t len) +{ + DMA_UARTx_TX_CONF(DMA_CH_UART_TX, 1, data, len, CCM_BASIC); + + while (!dma_chnl_done(DMA_CH_UART_TX)); // wait done + //while (!(UART1->SR.TEM)); //Wait Transmitter Empty +} +#endif + +void dmaTest(void) +{ + GPIO_DIR_SET_LO(GPIO_RUN | GPIO_TX_DONE | GPIO_RX_PING | GPIO_RX_PONG | GPIO_RX_RTOR); + + dma_init(); + + // init dma chnl + DMA_UARTx_TX_INIT(DMA_CH_UART_TX, 1); + DMA_UARTx_RX_INIT(DMA_CH_UART_RX, 1); + // config RX chnl + DMA_UARTx_RX_CONF(DMA_CH_UART_RX, 1, &rxdBuffer[0], RXD_BUFF_HALF, CCM_PING_PONG); + DMA_UARTx_RX_CONF(DMA_CH_UART_RX | DMA_CH_ALT, 1, &rxdBuffer[RXD_BUFF_HALF], RXD_BUFF_HALF, CCM_PING_PONG); + + #if !((DBG_MODE == 1) && (TEST_PORT == UART1_PORT)) + // init uart param + uart_init(TEST_PORT, PA_UART_TX, PA_UART_RX); + uart_conf(TEST_PORT, TEST_BAUD, TEST_LCRS); + #endif + + uart_fctl(TEST_PORT, TEST_FCTL, TEST_RTOR, TEST_INTR); // RTO_EN + uart_mctl(TEST_PORT, 1); // DMA_EN + + #if (DMA_IRQ_MODE) + // enable irq + DMACHCFG->IEFR0 = (1UL << DMA_CH_UART_RX) | (1UL << DMA_CH_UART_TX); + NVIC_EnableIRQ(DMAC_IRQn); + NVIC_EnableIRQ(UART1_IRQn); + __enable_irq(); + #endif + + while (1) + { + #if !(DMA_IRQ_MODE) + dmaPolling(); + #endif + dmaUartLoop(); + } +} diff --git a/examples/dmaTest/src/main.c b/examples/dmaTest/src/main.c new file mode 100644 index 0000000..3756375 --- /dev/null +++ b/examples/dmaTest/src/main.c @@ -0,0 +1,52 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +static void sysInit(void) +{ + // Todo config, if need + +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + iwdt_disable(); + + dbgInit(); + debug("Start(rsn:0x%X)...\r\n", rsn); +} + +extern void dmaTest(void); + +int main(void) +{ + sysInit(); + devInit(); + + dmaTest(); +} diff --git a/examples/extiTest/mdk/JLinkLog.txt b/examples/extiTest/mdk/JLinkLog.txt new file mode 100644 index 0000000..646e4af --- /dev/null +++ b/examples/extiTest/mdk/JLinkLog.txt @@ -0,0 +1,1188 @@ +T2C9C 000:065.576 SEGGER J-Link V7.96b Log File +T2C9C 000:065.724 DLL Compiled: Mar 20 2024 16:53:15 +T2C9C 000:065.730 Logging started @ 2024-03-29 03:52 +T2C9C 000:065.734 Process: C:\Keil_v5\UV4\UV4.exe +T2C9C 000:065.740 - 65.739ms +T2C9C 000:065.765 JLINK_SetWarnOutHandler(...) +T2C9C 000:065.770 - 0.006ms +T2C9C 000:065.776 JLINK_OpenEx(...) +T2C9C 000:068.971 Firmware: J-Link V9 compiled May 7 2021 16:26:12 +T2C9C 000:069.829 Firmware: J-Link V9 compiled May 7 2021 16:26:12 +T2C9C 000:069.954 Decompressing FW timestamp took 105 us +T2C9C 000:076.146 Hardware: V9.40 +T2C9C 000:076.157 S/N: 59410384 +T2C9C 000:076.164 OEM: SEGGER +T2C9C 000:076.171 Feature(s): RDI, GDB, FlashDL, FlashBP, JFlash +T2C9C 000:076.949 Bootloader: (Could not read) +T2C9C 000:077.805 TELNET listener socket opened on port 19021 +T2C9C 000:077.886 WEBSRV WEBSRV_Init(): Starting webserver thread(s) +T2C9C 000:077.972 WEBSRV Webserver running on local port 19080 +T2C9C 000:078.064 Looking for J-Link GUI Server exe at: C:\Keil_v5\ARM\Segger\JLinkGUIServer.exe +T2C9C 000:078.100 Looking for J-Link GUI Server exe at: C:\Program Files\SEGGER\JLink_V796b\JLinkGUIServer.exe +T2C9C 000:078.127 Forking J-Link GUI Server: C:\Program Files\SEGGER\JLink_V796b\JLinkGUIServer.exe +T2C9C 000:081.675 J-Link GUI Server info: "J-Link GUI server V7.96b " +T2C9C 000:082.057 - 16.274ms returns "O.K." +T2C9C 000:082.086 JLINK_SetErrorOutHandler(...) +T2C9C 000:082.106 - 0.019ms +T2C9C 000:082.132 JLINK_ExecCommand("ProjectFile = "C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\examples\extiTest\mdk\JLinkSettings.ini"", ...). +T2C9C 000:096.632 Ref file found at: C:\Keil_v5\ARM\Segger\JLinkDevices.ref +T2C9C 000:096.703 REF file references invalid XML file: C:\Program Files\SEGGER\JLink_V796b\JLinkDevices.xml +T2C9C 000:102.952 Device "CORTEX-M0" selected. +T2C9C 000:103.260 - 21.126ms returns 0x00 +T2C9C 000:105.816 JLINK_ExecCommand("Device = B6x", ...). +T2C9C 000:108.180 Device "CORTEX-M0" selected. +T2C9C 000:108.414 - 2.587ms returns 0x00 +T2C9C 000:108.426 JLINK_ExecCommand("DisableConnectionTimeout", ...). +T2C9C 000:108.435 - 0.002ms returns 0x01 +T2C9C 000:108.442 JLINK_GetHardwareVersion() +T2C9C 000:108.449 - 0.004ms returns 94000 +T2C9C 000:108.455 JLINK_GetDLLVersion() +T2C9C 000:108.460 - 0.004ms returns 79602 +T2C9C 000:108.466 JLINK_GetOEMString(...) +T2C9C 000:108.473 JLINK_GetFirmwareString(...) +T2C9C 000:108.477 - 0.004ms +T2C9C 000:114.616 JLINK_GetDLLVersion() +T2C9C 000:114.626 - 0.009ms returns 79602 +T2C9C 000:114.632 JLINK_GetCompileDateTime() +T2C9C 000:114.637 - 0.004ms +T2C9C 000:116.990 JLINK_GetFirmwareString(...) +T2C9C 000:117.004 - 0.013ms +T2C9C 000:118.815 JLINK_GetHardwareVersion() +T2C9C 000:118.827 - 0.011ms returns 94000 +T2C9C 000:120.484 JLINK_GetSN() +T2C9C 000:120.492 - 0.008ms returns 59410384 +T2C9C 000:122.204 JLINK_GetOEMString(...) +T2C9C 000:125.936 JLINK_TIF_Select(JLINKARM_TIF_SWD) +T2C9C 000:126.740 - 0.803ms returns 0x00 +T2C9C 000:126.751 JLINK_HasError() +T2C9C 000:126.762 JLINK_SetSpeed(1000) +T2C9C 000:126.856 - 0.095ms +T2C9C 000:126.867 JLINK_GetId() +T2C9C 000:129.726 Found SW-DP with ID 0x0BC11477 +T2C9C 000:135.403 DPIDR: 0x0BC11477 +T2C9C 000:137.098 CoreSight SoC-400 or earlier +T2C9C 000:138.868 Scanning AP map to find all available APs +T2C9C 000:141.743 AP[1]: Stopped AP scan as end of AP map has been reached +T2C9C 000:143.443 AP[0]: AHB-AP (IDR: 0x04770031) +T2C9C 000:145.223 Iterating through AP map to find AHB-AP to use +T2C9C 000:148.889 AP[0]: Core found +T2C9C 000:152.382 AP[0]: AHB-AP ROM base: 0xE00FF000 +T2C9C 000:154.939 CPUID register: 0x410CC601. Implementer code: 0x41 (ARM) +T2C9C 000:156.631 Found Cortex-M0 r0p1, Little endian. +T2C9C 000:157.127 -- Max. mem block: 0x00010C40 +T2C9C 000:157.705 CPU_ReadMem(4 bytes @ 0xE000EDF0) +T2C9C 000:158.401 CPU_WriteMem(4 bytes @ 0xE000EDF0) +T2C9C 000:159.003 CPU_ReadMem(4 bytes @ 0xE0002000) +T2C9C 000:161.495 FPUnit: 4 code (BP) slots and 0 literal slots +T2C9C 000:161.543 CPU_ReadMem(4 bytes @ 0xE000EDFC) +T2C9C 000:162.203 CPU_WriteMem(4 bytes @ 0xE000EDFC) +T2C9C 000:162.884 CPU_ReadMem(4 bytes @ 0xE0001000) +T2C9C 000:163.489 CPU_WriteMem(4 bytes @ 0xE0001000) +T2C9C 000:166.844 CoreSight components: +T2C9C 000:168.928 ROMTbl[0] @ E00FF000 +T2C9C 000:168.943 CPU_ReadMem(64 bytes @ 0xE00FF000) +T2C9C 000:170.317 CPU_ReadMem(32 bytes @ 0xE000EFE0) +T2C9C 000:173.086 [0][0]: E000E000 CID B105E00D PID 000BB008 SCS +T2C9C 000:173.098 CPU_ReadMem(32 bytes @ 0xE0001FE0) +T2C9C 000:175.875 [0][1]: E0001000 CID B105E00D PID 000BB00A DWT +T2C9C 000:175.887 CPU_ReadMem(32 bytes @ 0xE0002FE0) +T2C9C 000:178.672 [0][2]: E0002000 CID B105E00D PID 000BB00B FPB +T2C9C 000:179.070 - 52.201ms returns 0x0BC11477 +T2C9C 000:179.084 JLINK_GetDLLVersion() +T2C9C 000:179.089 - 0.005ms returns 79602 +T2C9C 000:179.095 JLINK_CORE_GetFound() +T2C9C 000:179.100 - 0.004ms returns 0x60000FF +T2C9C 000:179.107 JLINK_GetDebugInfo(0x100 = JLINKARM_ROM_TABLE_ADDR_INDEX) +T2C9C 000:179.112 Value=0xE00FF000 +T2C9C 000:179.119 - 0.012ms returns 0 +T2C9C 000:180.873 JLINK_ReadMem(0xE00FF000, 0x20 Bytes, ...) +T2C9C 000:180.894 CPU_ReadMem(32 bytes @ 0xE00FF000) +T2C9C 000:181.813 Data: 03 F0 F0 FF 03 20 F0 FF 03 30 F0 FF 00 00 00 00 ... +T2C9C 000:181.830 - 0.956ms returns 0 +T2C9C 000:181.843 JLINK_ReadMem(0xE000EFF0, 0x10 Bytes, ...) +T2C9C 000:181.853 CPU_ReadMem(16 bytes @ 0xE000EFF0) +T2C9C 000:182.551 Data: 0D 00 00 00 E0 00 00 00 05 00 00 00 B1 00 00 00 +T2C9C 000:182.562 - 0.718ms returns 0 +T2C9C 000:182.570 JLINK_ReadMem(0xE000EFD0, 0x20 Bytes, ...) +T2C9C 000:182.579 CPU_ReadMem(32 bytes @ 0xE000EFD0) +T2C9C 000:183.570 Data: 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +T2C9C 000:183.581 - 1.011ms returns 0 +T2C9C 000:183.590 JLINK_ReadMem(0xE0001FF0, 0x10 Bytes, ...) +T2C9C 000:183.598 CPU_ReadMem(16 bytes @ 0xE0001FF0) +T2C9C 000:184.347 Data: 0D 00 00 00 E0 00 00 00 05 00 00 00 B1 00 00 00 +T2C9C 000:184.358 - 0.767ms returns 0 +T2C9C 000:184.366 JLINK_ReadMem(0xE0001FD0, 0x20 Bytes, ...) +T2C9C 000:184.375 CPU_ReadMem(32 bytes @ 0xE0001FD0) +T2C9C 000:185.338 Data: 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +T2C9C 000:185.348 - 0.982ms returns 0 +T2C9C 000:185.356 JLINK_ReadMem(0xE0002FF0, 0x10 Bytes, ...) +T2C9C 000:185.363 CPU_ReadMem(16 bytes @ 0xE0002FF0) +T2C9C 000:186.166 Data: 0D 00 00 00 E0 00 00 00 05 00 00 00 B1 00 00 00 +T2C9C 000:186.175 - 0.819ms returns 0 +T2C9C 000:186.183 JLINK_ReadMem(0xE0002FD0, 0x20 Bytes, ...) +T2C9C 000:186.191 CPU_ReadMem(32 bytes @ 0xE0002FD0) +T2C9C 000:187.205 Data: 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +T2C9C 000:187.217 - 1.033ms returns 0 +T2C9C 000:187.227 JLINK_ReadMemU32(0xE000ED00, 0x1 Items) +T2C9C 000:187.234 CPU_ReadMem(4 bytes @ 0xE000ED00) +T2C9C 000:187.875 Data: 01 C6 0C 41 +T2C9C 000:187.889 Debug reg: CPUID +T2C9C 000:187.896 - 0.670ms returns 1 (0x1) +T2C9C 000:187.904 JLINK_HasError() +T2C9C 000:187.911 JLINK_SetResetType(JLINKARM_CM3_RESET_TYPE_NORMAL) +T2C9C 000:187.916 - 0.005ms returns JLINKARM_CM3_RESET_TYPE_NORMAL +T2C9C 000:187.922 JLINK_Reset() +T2C9C 000:187.933 CPU is running +T2C9C 000:187.940 CPU_WriteMem(4 bytes @ 0xE000EDF0) +T2C9C 000:188.564 CPU is running +T2C9C 000:188.575 CPU_WriteMem(4 bytes @ 0xE000EDFC) +T2C9C 000:191.224 Reset: Halt core after reset via DEMCR.VC_CORERESET. +T2C9C 000:193.580 Reset: Reset device via AIRCR.SYSRESETREQ. +T2C9C 000:193.591 CPU is running +T2C9C 000:193.600 CPU_WriteMem(4 bytes @ 0xE000ED0C) +T2C9C 000:247.575 CPU_ReadMem(4 bytes @ 0xE000EDF0) +T2C9C 000:248.239 CPU_ReadMem(4 bytes @ 0xE000EDF0) +T2C9C 000:254.897 CPU_WriteMem(4 bytes @ 0xE000EDFC) +T2C9C 000:261.864 CPU_ReadMem(4 bytes @ 0xE000EDF0) +T2C9C 000:268.516 CPU_WriteMem(4 bytes @ 0xE0002000) +T2C9C 000:269.347 CPU_ReadMem(4 bytes @ 0xE000EDFC) +T2C9C 000:270.228 CPU_ReadMem(4 bytes @ 0xE0001000) +T2C9C 000:271.115 CPU_WriteMem(4 bytes @ 0xE0001000) +T2C9C 000:272.039 - 84.114ms +T2C9C 000:272.115 JLINK_Halt() +T2C9C 000:272.150 - 0.034ms returns 0x00 +T2C9C 000:272.185 JLINK_IsHalted() +T2C9C 000:272.227 - 0.040ms returns TRUE +T2C9C 000:272.290 JLINK_ReadMemU32(0xE000EDF0, 0x1 Items) +T2C9C 000:272.354 CPU_ReadMem(4 bytes @ 0xE000EDF0) +T2C9C 000:273.039 Data: 03 00 03 00 +T2C9C 000:273.087 Debug reg: DHCSR +T2C9C 000:273.120 - 0.837ms returns 1 (0x1) +T2C9C 000:273.323 JLINK_WriteU32_64(0xE000EDF0, 0xA05F0003) +T2C9C 000:273.357 Debug reg: DHCSR +T2C9C 000:275.072 CPU_WriteMem(4 bytes @ 0xE000EDF0) +T2C9C 000:275.829 - 2.514ms returns 0 (0x00000000) +T2C9C 000:275.880 JLINK_WriteU32_64(0xE000EDFC, 0x01000000) +T2C9C 000:275.904 Debug reg: DEMCR +T2C9C 000:275.998 CPU_WriteMem(4 bytes @ 0xE000EDFC) +T2C9C 000:276.797 - 0.915ms returns 0 (0x00000000) +T2C9C 000:296.555 JLINK_GetHWStatus(...) +T2C9C 000:296.798 - 0.242ms returns 0 +T2C9C 000:302.573 JLINK_GetNumBPUnits(Type = 0xFFFFFF00) +T2C9C 000:302.593 - 0.020ms returns 0x04 +T2C9C 000:302.600 JLINK_GetNumBPUnits(Type = 0xF0) +T2C9C 000:302.605 - 0.004ms returns 0x2000 +T2C9C 000:302.610 JLINK_GetNumWPUnits() +T2C9C 000:302.615 - 0.004ms returns 1 +T2C9C 000:309.034 JLINK_GetSpeed() +T2C9C 000:309.052 - 0.017ms returns 1000 +T2C9C 000:312.316 JLINK_ReadMemU32(0xE000E004, 0x1 Items) +T2C9C 000:312.335 CPU_ReadMem(4 bytes @ 0xE000E004) +T2C9C 000:313.122 Data: 00 00 00 00 +T2C9C 000:313.145 - 0.829ms returns 1 (0x1) +T2C9C 000:313.165 JLINK_Halt() +T2C9C 000:313.171 - 0.005ms returns 0x00 +T2C9C 000:313.176 JLINK_IsHalted() +T2C9C 000:313.182 - 0.005ms returns TRUE +T2C9C 000:316.831 JLINK_WriteMem(0x20003000, 0x9D4 Bytes, ...) +T2C9C 000:316.843 Data: 00 BE 0A E0 0D 78 2D 06 68 40 08 24 40 00 00 D3 ... +T2C9C 000:317.301 CPU_WriteMem(2516 bytes @ 0x20003000) +T2C9C 000:349.323 - 32.492ms returns 0x9D4 +T2C9C 000:349.383 JLINK_HasError() +T2C9C 000:349.397 JLINK_WriteReg(R0, 0x18000000) +T2C9C 000:349.417 - 0.024ms returns 0 +T2C9C 000:349.423 JLINK_WriteReg(R1, 0x00F42400) +T2C9C 000:349.429 - 0.005ms returns 0 +T2C9C 000:349.435 JLINK_WriteReg(R2, 0x00000001) +T2C9C 000:349.440 - 0.005ms returns 0 +T2C9C 000:349.446 JLINK_WriteReg(R3, 0x00000000) +T2C9C 000:349.451 - 0.005ms returns 0 +T2C9C 000:349.458 JLINK_WriteReg(R4, 0x00000000) +T2C9C 000:349.463 - 0.005ms returns 0 +T2C9C 000:349.470 JLINK_WriteReg(R5, 0x00000000) +T2C9C 000:349.475 - 0.005ms returns 0 +T2C9C 000:349.547 JLINK_WriteReg(R6, 0x00000000) +T2C9C 000:349.559 - 0.011ms returns 0 +T2C9C 000:349.566 JLINK_WriteReg(R7, 0x00000000) +T2C9C 000:349.571 - 0.005ms returns 0 +T2C9C 000:349.578 JLINK_WriteReg(R8, 0x00000000) +T2C9C 000:349.583 - 0.005ms returns 0 +T2C9C 000:349.589 JLINK_WriteReg(R9, 0x200039B4) +T2C9C 000:349.594 - 0.005ms returns 0 +T2C9C 000:349.601 JLINK_WriteReg(R10, 0x00000000) +T2C9C 000:349.606 - 0.005ms returns 0 +T2C9C 000:349.612 JLINK_WriteReg(R11, 0x00000000) +T2C9C 000:349.618 - 0.005ms returns 0 +T2C9C 000:349.624 JLINK_WriteReg(R12, 0x00000000) +T2C9C 000:349.629 - 0.005ms returns 0 +T2C9C 000:349.635 JLINK_WriteReg(R13 (SP), 0x20008000) +T2C9C 000:349.641 - 0.005ms returns 0 +T2C9C 000:349.647 JLINK_WriteReg(R14, 0x20003001) +T2C9C 000:349.652 - 0.005ms returns 0 +T2C9C 000:349.661 JLINK_WriteReg(R15 (PC), 0x200030E2) +T2C9C 000:349.667 - 0.008ms returns 0 +T2C9C 000:349.673 JLINK_WriteReg(XPSR, 0x01000000) +T2C9C 000:349.678 - 0.005ms returns 0 +T2C9C 000:349.684 JLINK_WriteReg(MSP, 0x20008000) +T2C9C 000:349.689 - 0.005ms returns 0 +T2C9C 000:349.695 JLINK_WriteReg(PSP, 0x20008000) +T2C9C 000:349.700 - 0.005ms returns 0 +T2C9C 000:349.706 JLINK_WriteReg(CFBP, 0x00000000) +T2C9C 000:349.711 - 0.005ms returns 0 +T2C9C 000:349.720 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T2C9C 000:349.742 CPU_ReadMem(4 bytes @ 0x20003000) +T2C9C 000:350.424 CPU_WriteMem(4 bytes @ 0x20003000) +T2C9C 000:351.136 CPU_ReadMem(4 bytes @ 0x20003000) +T2C9C 000:351.771 CPU_WriteMem(4 bytes @ 0x20003000) +T2C9C 000:352.370 CPU_ReadMem(2 bytes @ 0x20003000) +T2C9C 000:353.040 - 3.320ms returns 0x00000001 +T2C9C 000:353.052 JLINK_Go() +T2C9C 000:353.065 CPU_WriteMem(2 bytes @ 0x20003000) +T2C9C 000:353.782 CPU_ReadMem(4 bytes @ 0xE0001000) +T2C9C 000:354.318 CPU_WriteMem(4 bytes @ 0xE0001000) +T2C9C 000:355.010 CPU_WriteMem(4 bytes @ 0xE0002008) +T2C9C 000:355.021 CPU_WriteMem(4 bytes @ 0xE000200C) +T2C9C 000:355.029 CPU_WriteMem(4 bytes @ 0xE0002010) +T2C9C 000:355.035 CPU_WriteMem(4 bytes @ 0xE0002014) +T2C9C 000:356.781 CPU_WriteMem(4 bytes @ 0xE0001004) +T2C9C 000:364.986 Memory map 'after startup completion point' is active +T2C9C 000:365.004 - 11.951ms +T2C9C 000:365.017 JLINK_IsHalted() +T2C9C 000:371.100 CPU_ReadMem(2 bytes @ 0x20003000) +T2C9C 000:371.668 - 6.651ms returns TRUE +T2C9C 000:371.682 JLINK_ReadReg(R15 (PC)) +T2C9C 000:371.691 - 0.009ms returns 0x20003000 +T2C9C 000:371.698 JLINK_ClrBPEx(BPHandle = 0x00000001) +T2C9C 000:371.704 - 0.006ms returns 0x00 +T2C9C 000:371.710 JLINK_ReadReg(R0) +T2C9C 000:371.716 - 0.005ms returns 0x00000000 +T2C9C 000:372.134 JLINK_HasError() +T2C9C 000:372.144 JLINK_WriteReg(R0, 0x18004000) +T2C9C 000:372.151 - 0.007ms returns 0 +T2C9C 000:372.158 JLINK_WriteReg(R1, 0x00001000) +T2C9C 000:372.163 - 0.005ms returns 0 +T2C9C 000:372.169 JLINK_WriteReg(R2, 0x000000FF) +T2C9C 000:372.174 - 0.005ms returns 0 +T2C9C 000:372.179 JLINK_WriteReg(R3, 0x00000000) +T2C9C 000:372.184 - 0.005ms returns 0 +T2C9C 000:372.190 JLINK_WriteReg(R4, 0x00000000) +T2C9C 000:372.195 - 0.004ms returns 0 +T2C9C 000:372.201 JLINK_WriteReg(R5, 0x00000000) +T2C9C 000:372.206 - 0.005ms returns 0 +T2C9C 000:372.214 JLINK_WriteReg(R6, 0x00000000) +T2C9C 000:372.219 - 0.005ms returns 0 +T2C9C 000:372.224 JLINK_WriteReg(R7, 0x00000000) +T2C9C 000:372.229 - 0.004ms returns 0 +T2C9C 000:372.235 JLINK_WriteReg(R8, 0x00000000) +T2C9C 000:372.240 - 0.005ms returns 0 +T2C9C 000:372.246 JLINK_WriteReg(R9, 0x200039B4) +T2C9C 000:372.250 - 0.004ms returns 0 +T2C9C 000:372.256 JLINK_WriteReg(R10, 0x00000000) +T2C9C 000:372.261 - 0.005ms returns 0 +T2C9C 000:372.267 JLINK_WriteReg(R11, 0x00000000) +T2C9C 000:372.272 - 0.004ms returns 0 +T2C9C 000:372.277 JLINK_WriteReg(R12, 0x00000000) +T2C9C 000:372.282 - 0.004ms returns 0 +T2C9C 000:372.288 JLINK_WriteReg(R13 (SP), 0x20008000) +T2C9C 000:372.293 - 0.005ms returns 0 +T2C9C 000:372.299 JLINK_WriteReg(R14, 0x20003001) +T2C9C 000:372.304 - 0.004ms returns 0 +T2C9C 000:372.310 JLINK_WriteReg(R15 (PC), 0x20003020) +T2C9C 000:372.315 - 0.005ms returns 0 +T2C9C 000:372.321 JLINK_WriteReg(XPSR, 0x01000000) +T2C9C 000:372.326 - 0.005ms returns 0 +T2C9C 000:372.331 JLINK_WriteReg(MSP, 0x20008000) +T2C9C 000:372.336 - 0.004ms returns 0 +T2C9C 000:372.342 JLINK_WriteReg(PSP, 0x20008000) +T2C9C 000:372.347 - 0.004ms returns 0 +T2C9C 000:372.353 JLINK_WriteReg(CFBP, 0x00000000) +T2C9C 000:372.358 - 0.004ms returns 0 +T2C9C 000:372.364 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T2C9C 000:372.370 - 0.006ms returns 0x00000002 +T2C9C 000:372.376 JLINK_Go() +T2C9C 000:372.386 CPU_ReadMem(4 bytes @ 0xE0001000) +T2C9C 000:378.344 - 5.967ms +T2C9C 000:378.366 JLINK_IsHalted() +T2C9C 000:384.384 CPU_ReadMem(2 bytes @ 0x20003000) +T2C9C 000:385.088 - 6.721ms returns TRUE +T2C9C 000:385.103 JLINK_ReadReg(R15 (PC)) +T2C9C 000:385.113 - 0.009ms returns 0x20003000 +T2C9C 000:385.120 JLINK_ClrBPEx(BPHandle = 0x00000002) +T2C9C 000:385.126 - 0.005ms returns 0x00 +T2C9C 000:385.134 JLINK_ReadReg(R0) +T2C9C 000:385.140 - 0.005ms returns 0x00000001 +T2C9C 000:385.147 JLINK_HasError() +T2C9C 000:385.216 JLINK_WriteReg(R0, 0x18004000) +T2C9C 000:385.227 - 0.011ms returns 0 +T2C9C 000:385.233 JLINK_WriteReg(R1, 0x00001000) +T2C9C 000:385.239 - 0.005ms returns 0 +T2C9C 000:385.245 JLINK_WriteReg(R2, 0x000000FF) +T2C9C 000:385.250 - 0.005ms returns 0 +T2C9C 000:385.257 JLINK_WriteReg(R3, 0x00000000) +T2C9C 000:385.262 - 0.005ms returns 0 +T2C9C 000:385.268 JLINK_WriteReg(R4, 0x00000000) +T2C9C 000:385.273 - 0.005ms returns 0 +T2C9C 000:385.279 JLINK_WriteReg(R5, 0x00000000) +T2C9C 000:385.284 - 0.005ms returns 0 +T2C9C 000:385.290 JLINK_WriteReg(R6, 0x00000000) +T2C9C 000:385.295 - 0.005ms returns 0 +T2C9C 000:385.302 JLINK_WriteReg(R7, 0x00000000) +T2C9C 000:385.344 - 0.041ms returns 0 +T2C9C 000:385.350 JLINK_WriteReg(R8, 0x00000000) +T2C9C 000:385.355 - 0.005ms returns 0 +T2C9C 000:385.361 JLINK_WriteReg(R9, 0x200039B4) +T2C9C 000:385.366 - 0.005ms returns 0 +T2C9C 000:385.372 JLINK_WriteReg(R10, 0x00000000) +T2C9C 000:385.377 - 0.005ms returns 0 +T2C9C 000:385.383 JLINK_WriteReg(R11, 0x00000000) +T2C9C 000:385.389 - 0.005ms returns 0 +T2C9C 000:385.394 JLINK_WriteReg(R12, 0x00000000) +T2C9C 000:385.400 - 0.005ms returns 0 +T2C9C 000:385.406 JLINK_WriteReg(R13 (SP), 0x20008000) +T2C9C 000:385.411 - 0.005ms returns 0 +T2C9C 000:385.417 JLINK_WriteReg(R14, 0x20003001) +T2C9C 000:385.422 - 0.005ms returns 0 +T2C9C 000:385.428 JLINK_WriteReg(R15 (PC), 0x200032CA) +T2C9C 000:385.433 - 0.005ms returns 0 +T2C9C 000:385.439 JLINK_WriteReg(XPSR, 0x01000000) +T2C9C 000:385.444 - 0.005ms returns 0 +T2C9C 000:385.450 JLINK_WriteReg(MSP, 0x20008000) +T2C9C 000:385.455 - 0.005ms returns 0 +T2C9C 000:385.461 JLINK_WriteReg(PSP, 0x20008000) +T2C9C 000:385.466 - 0.004ms returns 0 +T2C9C 000:385.472 JLINK_WriteReg(CFBP, 0x00000000) +T2C9C 000:385.477 - 0.005ms returns 0 +T2C9C 000:385.484 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T2C9C 000:385.490 - 0.006ms returns 0x00000003 +T2C9C 000:385.496 JLINK_Go() +T2C9C 000:385.506 CPU_ReadMem(4 bytes @ 0xE0001000) +T2C9C 000:391.494 - 5.998ms +T2C9C 000:391.505 JLINK_IsHalted() +T2C9C 000:392.098 - 0.592ms returns FALSE +T2C9C 000:392.108 JLINK_HasError() +T2C9C 000:405.567 JLINK_IsHalted() +T2C9C 000:411.671 CPU_ReadMem(2 bytes @ 0x20003000) +T2C9C 000:412.486 - 6.917ms returns TRUE +T2C9C 000:412.511 JLINK_ReadReg(R15 (PC)) +T2C9C 000:412.522 - 0.010ms returns 0x20003000 +T2C9C 000:412.529 JLINK_ClrBPEx(BPHandle = 0x00000003) +T2C9C 000:412.535 - 0.006ms returns 0x00 +T2C9C 000:412.543 JLINK_ReadReg(R0) +T2C9C 000:412.548 - 0.005ms returns 0x00000000 +T2C9C 000:412.950 JLINK_HasError() +T2C9C 000:412.966 JLINK_WriteReg(R0, 0x00000001) +T2C9C 000:412.987 - 0.021ms returns 0 +T2C9C 000:412.997 JLINK_WriteReg(R1, 0x00001000) +T2C9C 000:413.002 - 0.006ms returns 0 +T2C9C 000:413.009 JLINK_WriteReg(R2, 0x000000FF) +T2C9C 000:413.014 - 0.005ms returns 0 +T2C9C 000:413.020 JLINK_WriteReg(R3, 0x00000000) +T2C9C 000:413.025 - 0.005ms returns 0 +T2C9C 000:413.031 JLINK_WriteReg(R4, 0x00000000) +T2C9C 000:413.036 - 0.005ms returns 0 +T2C9C 000:413.042 JLINK_WriteReg(R5, 0x00000000) +T2C9C 000:413.047 - 0.005ms returns 0 +T2C9C 000:413.053 JLINK_WriteReg(R6, 0x00000000) +T2C9C 000:413.058 - 0.005ms returns 0 +T2C9C 000:413.064 JLINK_WriteReg(R7, 0x00000000) +T2C9C 000:413.069 - 0.005ms returns 0 +T2C9C 000:413.075 JLINK_WriteReg(R8, 0x00000000) +T2C9C 000:413.081 - 0.005ms returns 0 +T2C9C 000:413.087 JLINK_WriteReg(R9, 0x200039B4) +T2C9C 000:413.092 - 0.005ms returns 0 +T2C9C 000:413.098 JLINK_WriteReg(R10, 0x00000000) +T2C9C 000:413.103 - 0.005ms returns 0 +T2C9C 000:413.109 JLINK_WriteReg(R11, 0x00000000) +T2C9C 000:413.114 - 0.005ms returns 0 +T2C9C 000:413.120 JLINK_WriteReg(R12, 0x00000000) +T2C9C 000:413.125 - 0.005ms returns 0 +T2C9C 000:413.132 JLINK_WriteReg(R13 (SP), 0x20008000) +T2C9C 000:413.137 - 0.005ms returns 0 +T2C9C 000:413.143 JLINK_WriteReg(R14, 0x20003001) +T2C9C 000:413.149 - 0.005ms returns 0 +T2C9C 000:413.155 JLINK_WriteReg(R15 (PC), 0x20003218) +T2C9C 000:413.160 - 0.005ms returns 0 +T2C9C 000:413.166 JLINK_WriteReg(XPSR, 0x01000000) +T2C9C 000:413.171 - 0.005ms returns 0 +T2C9C 000:413.177 JLINK_WriteReg(MSP, 0x20008000) +T2C9C 000:413.182 - 0.005ms returns 0 +T2C9C 000:413.188 JLINK_WriteReg(PSP, 0x20008000) +T2C9C 000:413.194 - 0.005ms returns 0 +T2C9C 000:413.200 JLINK_WriteReg(CFBP, 0x00000000) +T2C9C 000:413.205 - 0.005ms returns 0 +T2C9C 000:413.211 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T2C9C 000:413.218 - 0.006ms returns 0x00000004 +T2C9C 000:413.224 JLINK_Go() +T2C9C 000:413.236 CPU_ReadMem(4 bytes @ 0xE0001000) +T2C9C 000:419.363 - 6.138ms +T2C9C 000:419.389 JLINK_IsHalted() +T2C9C 000:425.391 CPU_ReadMem(2 bytes @ 0x20003000) +T2C9C 000:426.156 - 6.766ms returns TRUE +T2C9C 000:426.184 JLINK_ReadReg(R15 (PC)) +T2C9C 000:426.200 - 0.015ms returns 0x20003000 +T2C9C 000:426.207 JLINK_ClrBPEx(BPHandle = 0x00000004) +T2C9C 000:426.213 - 0.006ms returns 0x00 +T2C9C 000:426.220 JLINK_ReadReg(R0) +T2C9C 000:426.226 - 0.005ms returns 0x00000000 +T2C9C 000:490.879 JLINK_WriteMem(0x20003000, 0x9D4 Bytes, ...) +T2C9C 000:490.903 Data: 00 BE 0A E0 0D 78 2D 06 68 40 08 24 40 00 00 D3 ... +T2C9C 000:490.941 CPU_WriteMem(2516 bytes @ 0x20003000) +T2C9C 000:522.825 - 31.946ms returns 0x9D4 +T2C9C 000:522.987 JLINK_HasError() +T2C9C 000:523.012 JLINK_WriteReg(R0, 0x18000000) +T2C9C 000:523.034 - 0.023ms returns 0 +T2C9C 000:523.041 JLINK_WriteReg(R1, 0x00F42400) +T2C9C 000:523.047 - 0.005ms returns 0 +T2C9C 000:523.054 JLINK_WriteReg(R2, 0x00000002) +T2C9C 000:523.059 - 0.005ms returns 0 +T2C9C 000:523.065 JLINK_WriteReg(R3, 0x00000000) +T2C9C 000:523.071 - 0.005ms returns 0 +T2C9C 000:523.077 JLINK_WriteReg(R4, 0x00000000) +T2C9C 000:523.082 - 0.005ms returns 0 +T2C9C 000:523.089 JLINK_WriteReg(R5, 0x00000000) +T2C9C 000:523.094 - 0.005ms returns 0 +T2C9C 000:523.100 JLINK_WriteReg(R6, 0x00000000) +T2C9C 000:523.106 - 0.005ms returns 0 +T2C9C 000:523.112 JLINK_WriteReg(R7, 0x00000000) +T2C9C 000:523.117 - 0.005ms returns 0 +T2C9C 000:523.124 JLINK_WriteReg(R8, 0x00000000) +T2C9C 000:523.129 - 0.005ms returns 0 +T2C9C 000:523.135 JLINK_WriteReg(R9, 0x200039B4) +T2C9C 000:523.141 - 0.005ms returns 0 +T2C9C 000:523.147 JLINK_WriteReg(R10, 0x00000000) +T2C9C 000:523.152 - 0.005ms returns 0 +T2C9C 000:523.159 JLINK_WriteReg(R11, 0x00000000) +T2C9C 000:523.164 - 0.005ms returns 0 +T2C9C 000:523.170 JLINK_WriteReg(R12, 0x00000000) +T2C9C 000:523.176 - 0.005ms returns 0 +T2C9C 000:523.182 JLINK_WriteReg(R13 (SP), 0x20008000) +T2C9C 000:523.188 - 0.005ms returns 0 +T2C9C 000:523.194 JLINK_WriteReg(R14, 0x20003001) +T2C9C 000:523.199 - 0.005ms returns 0 +T2C9C 000:523.206 JLINK_WriteReg(R15 (PC), 0x200030E2) +T2C9C 000:523.211 - 0.005ms returns 0 +T2C9C 000:523.218 JLINK_WriteReg(XPSR, 0x01000000) +T2C9C 000:523.223 - 0.005ms returns 0 +T2C9C 000:523.229 JLINK_WriteReg(MSP, 0x20008000) +T2C9C 000:523.234 - 0.005ms returns 0 +T2C9C 000:523.241 JLINK_WriteReg(PSP, 0x20008000) +T2C9C 000:523.246 - 0.005ms returns 0 +T2C9C 000:523.252 JLINK_WriteReg(CFBP, 0x00000000) +T2C9C 000:523.257 - 0.005ms returns 0 +T2C9C 000:523.264 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T2C9C 000:523.275 CPU_ReadMem(4 bytes @ 0x20003000) +T2C9C 000:523.915 CPU_WriteMem(4 bytes @ 0x20003000) +T2C9C 000:524.482 CPU_ReadMem(4 bytes @ 0x20003000) +T2C9C 000:525.040 CPU_WriteMem(4 bytes @ 0x20003000) +T2C9C 000:525.617 CPU_ReadMem(2 bytes @ 0x20003000) +T2C9C 000:526.205 - 2.940ms returns 0x00000005 +T2C9C 000:526.217 JLINK_Go() +T2C9C 000:526.228 CPU_WriteMem(2 bytes @ 0x20003000) +T2C9C 000:526.806 CPU_ReadMem(4 bytes @ 0xE0001000) +T2C9C 000:532.692 - 6.474ms +T2C9C 000:532.720 JLINK_IsHalted() +T2C9C 000:538.669 CPU_ReadMem(2 bytes @ 0x20003000) +T2C9C 000:539.265 - 6.545ms returns TRUE +T2C9C 000:539.279 JLINK_ReadReg(R15 (PC)) +T2C9C 000:539.289 - 0.009ms returns 0x20003000 +T2C9C 000:539.296 JLINK_ClrBPEx(BPHandle = 0x00000005) +T2C9C 000:539.302 - 0.006ms returns 0x00 +T2C9C 000:539.309 JLINK_ReadReg(R0) +T2C9C 000:539.314 - 0.005ms returns 0x00000000 +T2C9C 000:539.601 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T2C9C 000:539.610 Data: 00 80 00 20 AD 40 00 18 D3 40 00 18 D5 40 00 18 ... +T2C9C 000:539.624 CPU_WriteMem(256 bytes @ 0x200039D4) +T2C9C 000:543.657 - 4.054ms returns 0x100 +T2C9C 000:543.681 JLINK_HasError() +T2C9C 000:543.690 JLINK_WriteReg(R0, 0x18004000) +T2C9C 000:543.701 - 0.011ms returns 0 +T2C9C 000:543.708 JLINK_WriteReg(R1, 0x00000100) +T2C9C 000:543.714 - 0.006ms returns 0 +T2C9C 000:543.720 JLINK_WriteReg(R2, 0x200039D4) +T2C9C 000:543.726 - 0.005ms returns 0 +T2C9C 000:543.732 JLINK_WriteReg(R3, 0x00000000) +T2C9C 000:543.738 - 0.005ms returns 0 +T2C9C 000:543.745 JLINK_WriteReg(R4, 0x00000000) +T2C9C 000:543.751 - 0.005ms returns 0 +T2C9C 000:543.760 JLINK_WriteReg(R5, 0x00000000) +T2C9C 000:543.767 - 0.007ms returns 0 +T2C9C 000:543.774 JLINK_WriteReg(R6, 0x00000000) +T2C9C 000:543.779 - 0.005ms returns 0 +T2C9C 000:543.786 JLINK_WriteReg(R7, 0x00000000) +T2C9C 000:543.791 - 0.005ms returns 0 +T2C9C 000:543.799 JLINK_WriteReg(R8, 0x00000000) +T2C9C 000:543.805 - 0.006ms returns 0 +T2C9C 000:543.811 JLINK_WriteReg(R9, 0x200039B4) +T2C9C 000:543.816 - 0.005ms returns 0 +T2C9C 000:543.823 JLINK_WriteReg(R10, 0x00000000) +T2C9C 000:543.831 - 0.007ms returns 0 +T2C9C 000:543.837 JLINK_WriteReg(R11, 0x00000000) +T2C9C 000:543.843 - 0.005ms returns 0 +T2C9C 000:543.849 JLINK_WriteReg(R12, 0x00000000) +T2C9C 000:543.854 - 0.005ms returns 0 +T2C9C 000:543.861 JLINK_WriteReg(R13 (SP), 0x20008000) +T2C9C 000:543.866 - 0.005ms returns 0 +T2C9C 000:543.873 JLINK_WriteReg(R14, 0x20003001) +T2C9C 000:543.878 - 0.005ms returns 0 +T2C9C 000:543.886 JLINK_WriteReg(R15 (PC), 0x200032FC) +T2C9C 000:543.893 - 0.007ms returns 0 +T2C9C 000:543.900 JLINK_WriteReg(XPSR, 0x01000000) +T2C9C 000:543.905 - 0.005ms returns 0 +T2C9C 000:543.911 JLINK_WriteReg(MSP, 0x20008000) +T2C9C 000:543.916 - 0.005ms returns 0 +T2C9C 000:543.923 JLINK_WriteReg(PSP, 0x20008000) +T2C9C 000:543.928 - 0.005ms returns 0 +T2C9C 000:543.936 JLINK_WriteReg(CFBP, 0x00000000) +T2C9C 000:543.942 - 0.006ms returns 0 +T2C9C 000:543.949 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T2C9C 000:543.956 - 0.007ms returns 0x00000006 +T2C9C 000:543.963 JLINK_Go() +T2C9C 000:543.976 CPU_ReadMem(4 bytes @ 0xE0001000) +T2C9C 000:550.157 - 6.193ms +T2C9C 000:550.182 JLINK_IsHalted() +T2C9C 000:550.867 - 0.685ms returns FALSE +T2C9C 000:550.879 JLINK_HasError() +T2C9C 000:557.372 JLINK_IsHalted() +T2C9C 000:563.545 CPU_ReadMem(2 bytes @ 0x20003000) +T2C9C 000:564.321 - 6.949ms returns TRUE +T2C9C 000:564.344 JLINK_ReadReg(R15 (PC)) +T2C9C 000:564.356 - 0.011ms returns 0x20003000 +T2C9C 000:564.363 JLINK_ClrBPEx(BPHandle = 0x00000006) +T2C9C 000:564.369 - 0.006ms returns 0x00 +T2C9C 000:564.376 JLINK_ReadReg(R0) +T2C9C 000:564.381 - 0.005ms returns 0x00000000 +T2C9C 000:564.838 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T2C9C 000:564.849 Data: 55 46 00 18 99 40 00 18 F0 B5 1F B4 06 46 00 20 ... +T2C9C 000:564.868 CPU_WriteMem(256 bytes @ 0x200039D4) +T2C9C 000:568.940 - 4.100ms returns 0x100 +T2C9C 000:568.972 JLINK_HasError() +T2C9C 000:568.982 JLINK_WriteReg(R0, 0x18004100) +T2C9C 000:568.996 - 0.013ms returns 0 +T2C9C 000:569.006 JLINK_WriteReg(R1, 0x00000100) +T2C9C 000:569.014 - 0.007ms returns 0 +T2C9C 000:569.023 JLINK_WriteReg(R2, 0x200039D4) +T2C9C 000:569.030 - 0.007ms returns 0 +T2C9C 000:569.038 JLINK_WriteReg(R3, 0x00000000) +T2C9C 000:569.044 - 0.006ms returns 0 +T2C9C 000:569.051 JLINK_WriteReg(R4, 0x00000000) +T2C9C 000:569.056 - 0.005ms returns 0 +T2C9C 000:569.062 JLINK_WriteReg(R5, 0x00000000) +T2C9C 000:569.067 - 0.005ms returns 0 +T2C9C 000:569.074 JLINK_WriteReg(R6, 0x00000000) +T2C9C 000:569.079 - 0.005ms returns 0 +T2C9C 000:569.085 JLINK_WriteReg(R7, 0x00000000) +T2C9C 000:569.091 - 0.005ms returns 0 +T2C9C 000:569.097 JLINK_WriteReg(R8, 0x00000000) +T2C9C 000:569.102 - 0.005ms returns 0 +T2C9C 000:569.108 JLINK_WriteReg(R9, 0x200039B4) +T2C9C 000:569.113 - 0.005ms returns 0 +T2C9C 000:569.120 JLINK_WriteReg(R10, 0x00000000) +T2C9C 000:569.125 - 0.005ms returns 0 +T2C9C 000:569.131 JLINK_WriteReg(R11, 0x00000000) +T2C9C 000:569.137 - 0.005ms returns 0 +T2C9C 000:569.143 JLINK_WriteReg(R12, 0x00000000) +T2C9C 000:569.150 - 0.006ms returns 0 +T2C9C 000:569.157 JLINK_WriteReg(R13 (SP), 0x20008000) +T2C9C 000:569.163 - 0.006ms returns 0 +T2C9C 000:569.169 JLINK_WriteReg(R14, 0x20003001) +T2C9C 000:569.175 - 0.005ms returns 0 +T2C9C 000:569.181 JLINK_WriteReg(R15 (PC), 0x200032FC) +T2C9C 000:569.187 - 0.005ms returns 0 +T2C9C 000:569.193 JLINK_WriteReg(XPSR, 0x01000000) +T2C9C 000:569.198 - 0.005ms returns 0 +T2C9C 000:569.205 JLINK_WriteReg(MSP, 0x20008000) +T2C9C 000:569.210 - 0.005ms returns 0 +T2C9C 000:569.217 JLINK_WriteReg(PSP, 0x20008000) +T2C9C 000:569.222 - 0.005ms returns 0 +T2C9C 000:569.232 JLINK_WriteReg(CFBP, 0x00000000) +T2C9C 000:569.239 - 0.007ms returns 0 +T2C9C 000:569.246 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T2C9C 000:569.253 - 0.006ms returns 0x00000007 +T2C9C 000:569.259 JLINK_Go() +T2C9C 000:569.273 CPU_ReadMem(4 bytes @ 0xE0001000) +T2C9C 000:575.843 - 6.583ms +T2C9C 000:575.872 JLINK_IsHalted() +T2C9C 000:576.704 - 0.831ms returns FALSE +T2C9C 000:576.733 JLINK_HasError() +T2C9C 000:579.927 JLINK_IsHalted() +T2C9C 000:586.171 CPU_ReadMem(2 bytes @ 0x20003000) +T2C9C 000:586.948 - 7.020ms returns TRUE +T2C9C 000:586.974 JLINK_ReadReg(R15 (PC)) +T2C9C 000:586.984 - 0.010ms returns 0x20003000 +T2C9C 000:586.991 JLINK_ClrBPEx(BPHandle = 0x00000007) +T2C9C 000:586.997 - 0.006ms returns 0x00 +T2C9C 000:587.004 JLINK_ReadReg(R0) +T2C9C 000:587.010 - 0.005ms returns 0x00000000 +T2C9C 000:587.502 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T2C9C 000:587.514 Data: 10 43 08 70 63 60 70 BD 00 80 02 40 9C 30 00 20 ... +T2C9C 000:587.530 CPU_WriteMem(256 bytes @ 0x200039D4) +T2C9C 000:591.537 - 4.034ms returns 0x100 +T2C9C 000:591.557 JLINK_HasError() +T2C9C 000:591.566 JLINK_WriteReg(R0, 0x18004200) +T2C9C 000:591.576 - 0.010ms returns 0 +T2C9C 000:591.583 JLINK_WriteReg(R1, 0x00000100) +T2C9C 000:591.589 - 0.006ms returns 0 +T2C9C 000:591.595 JLINK_WriteReg(R2, 0x200039D4) +T2C9C 000:591.601 - 0.005ms returns 0 +T2C9C 000:591.607 JLINK_WriteReg(R3, 0x00000000) +T2C9C 000:591.613 - 0.005ms returns 0 +T2C9C 000:591.619 JLINK_WriteReg(R4, 0x00000000) +T2C9C 000:591.624 - 0.005ms returns 0 +T2C9C 000:591.631 JLINK_WriteReg(R5, 0x00000000) +T2C9C 000:591.636 - 0.005ms returns 0 +T2C9C 000:591.643 JLINK_WriteReg(R6, 0x00000000) +T2C9C 000:591.648 - 0.005ms returns 0 +T2C9C 000:591.654 JLINK_WriteReg(R7, 0x00000000) +T2C9C 000:591.659 - 0.005ms returns 0 +T2C9C 000:591.666 JLINK_WriteReg(R8, 0x00000000) +T2C9C 000:591.671 - 0.005ms returns 0 +T2C9C 000:591.677 JLINK_WriteReg(R9, 0x200039B4) +T2C9C 000:591.683 - 0.005ms returns 0 +T2C9C 000:591.689 JLINK_WriteReg(R10, 0x00000000) +T2C9C 000:591.694 - 0.005ms returns 0 +T2C9C 000:591.701 JLINK_WriteReg(R11, 0x00000000) +T2C9C 000:591.706 - 0.005ms returns 0 +T2C9C 000:591.712 JLINK_WriteReg(R12, 0x00000000) +T2C9C 000:591.717 - 0.005ms returns 0 +T2C9C 000:591.724 JLINK_WriteReg(R13 (SP), 0x20008000) +T2C9C 000:591.730 - 0.006ms returns 0 +T2C9C 000:591.736 JLINK_WriteReg(R14, 0x20003001) +T2C9C 000:591.741 - 0.005ms returns 0 +T2C9C 000:591.748 JLINK_WriteReg(R15 (PC), 0x200032FC) +T2C9C 000:591.753 - 0.005ms returns 0 +T2C9C 000:591.760 JLINK_WriteReg(XPSR, 0x01000000) +T2C9C 000:591.765 - 0.005ms returns 0 +T2C9C 000:591.771 JLINK_WriteReg(MSP, 0x20008000) +T2C9C 000:591.777 - 0.005ms returns 0 +T2C9C 000:591.783 JLINK_WriteReg(PSP, 0x20008000) +T2C9C 000:591.788 - 0.005ms returns 0 +T2C9C 000:591.794 JLINK_WriteReg(CFBP, 0x00000000) +T2C9C 000:591.800 - 0.005ms returns 0 +T2C9C 000:591.807 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T2C9C 000:591.814 - 0.008ms returns 0x00000008 +T2C9C 000:591.821 JLINK_Go() +T2C9C 000:591.833 CPU_ReadMem(4 bytes @ 0xE0001000) +T2C9C 000:598.019 - 6.197ms +T2C9C 000:598.030 JLINK_IsHalted() +T2C9C 000:598.662 - 0.631ms returns FALSE +T2C9C 000:598.675 JLINK_HasError() +T2C9C 000:600.969 JLINK_IsHalted() +T2C9C 000:607.100 CPU_ReadMem(2 bytes @ 0x20003000) +T2C9C 000:607.726 - 6.756ms returns TRUE +T2C9C 000:607.738 JLINK_ReadReg(R15 (PC)) +T2C9C 000:607.746 - 0.007ms returns 0x20003000 +T2C9C 000:607.753 JLINK_ClrBPEx(BPHandle = 0x00000008) +T2C9C 000:607.759 - 0.006ms returns 0x00 +T2C9C 000:607.765 JLINK_ReadReg(R0) +T2C9C 000:607.771 - 0.005ms returns 0x00000000 +T2C9C 000:608.319 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T2C9C 000:608.329 Data: 69 28 4A D0 08 DC 00 28 B4 D0 58 28 6D D0 63 28 ... +T2C9C 000:608.343 CPU_WriteMem(256 bytes @ 0x200039D4) +T2C9C 000:612.302 - 3.982ms returns 0x100 +T2C9C 000:612.315 JLINK_HasError() +T2C9C 000:612.323 JLINK_WriteReg(R0, 0x18004300) +T2C9C 000:612.331 - 0.008ms returns 0 +T2C9C 000:612.338 JLINK_WriteReg(R1, 0x00000100) +T2C9C 000:612.391 - 0.052ms returns 0 +T2C9C 000:612.400 JLINK_WriteReg(R2, 0x200039D4) +T2C9C 000:612.406 - 0.006ms returns 0 +T2C9C 000:612.413 JLINK_WriteReg(R3, 0x00000000) +T2C9C 000:612.418 - 0.005ms returns 0 +T2C9C 000:612.425 JLINK_WriteReg(R4, 0x00000000) +T2C9C 000:612.430 - 0.005ms returns 0 +T2C9C 000:612.437 JLINK_WriteReg(R5, 0x00000000) +T2C9C 000:612.443 - 0.005ms returns 0 +T2C9C 000:612.449 JLINK_WriteReg(R6, 0x00000000) +T2C9C 000:612.455 - 0.005ms returns 0 +T2C9C 000:612.461 JLINK_WriteReg(R7, 0x00000000) +T2C9C 000:612.467 - 0.005ms returns 0 +T2C9C 000:612.473 JLINK_WriteReg(R8, 0x00000000) +T2C9C 000:612.479 - 0.005ms returns 0 +T2C9C 000:612.485 JLINK_WriteReg(R9, 0x200039B4) +T2C9C 000:612.491 - 0.005ms returns 0 +T2C9C 000:612.498 JLINK_WriteReg(R10, 0x00000000) +T2C9C 000:612.503 - 0.005ms returns 0 +T2C9C 000:612.510 JLINK_WriteReg(R11, 0x00000000) +T2C9C 000:612.515 - 0.005ms returns 0 +T2C9C 000:612.522 JLINK_WriteReg(R12, 0x00000000) +T2C9C 000:612.527 - 0.005ms returns 0 +T2C9C 000:612.534 JLINK_WriteReg(R13 (SP), 0x20008000) +T2C9C 000:612.540 - 0.006ms returns 0 +T2C9C 000:612.547 JLINK_WriteReg(R14, 0x20003001) +T2C9C 000:612.552 - 0.005ms returns 0 +T2C9C 000:612.559 JLINK_WriteReg(R15 (PC), 0x200032FC) +T2C9C 000:612.564 - 0.005ms returns 0 +T2C9C 000:612.571 JLINK_WriteReg(XPSR, 0x01000000) +T2C9C 000:612.577 - 0.005ms returns 0 +T2C9C 000:612.583 JLINK_WriteReg(MSP, 0x20008000) +T2C9C 000:612.589 - 0.005ms returns 0 +T2C9C 000:612.595 JLINK_WriteReg(PSP, 0x20008000) +T2C9C 000:612.601 - 0.005ms returns 0 +T2C9C 000:612.607 JLINK_WriteReg(CFBP, 0x00000000) +T2C9C 000:612.613 - 0.005ms returns 0 +T2C9C 000:612.620 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T2C9C 000:612.626 - 0.006ms returns 0x00000009 +T2C9C 000:612.633 JLINK_Go() +T2C9C 000:612.643 CPU_ReadMem(4 bytes @ 0xE0001000) +T2C9C 000:618.888 - 6.253ms +T2C9C 000:618.926 JLINK_IsHalted() +T2C9C 000:619.503 - 0.576ms returns FALSE +T2C9C 000:619.514 JLINK_HasError() +T2C9C 000:622.260 JLINK_IsHalted() +T2C9C 000:628.407 CPU_ReadMem(2 bytes @ 0x20003000) +T2C9C 000:629.073 - 6.813ms returns TRUE +T2C9C 000:629.085 JLINK_ReadReg(R15 (PC)) +T2C9C 000:629.094 - 0.008ms returns 0x20003000 +T2C9C 000:629.101 JLINK_ClrBPEx(BPHandle = 0x00000009) +T2C9C 000:629.108 - 0.006ms returns 0x00 +T2C9C 000:629.115 JLINK_ReadReg(R0) +T2C9C 000:629.121 - 0.005ms returns 0x00000000 +T2C9C 000:629.538 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T2C9C 000:629.547 Data: 03 91 00 90 68 02 40 0F 02 28 10 D0 01 CF 00 21 ... +T2C9C 000:629.560 CPU_WriteMem(256 bytes @ 0x200039D4) +T2C9C 000:633.484 - 3.945ms returns 0x100 +T2C9C 000:633.503 JLINK_HasError() +T2C9C 000:633.511 JLINK_WriteReg(R0, 0x18004400) +T2C9C 000:633.521 - 0.009ms returns 0 +T2C9C 000:633.528 JLINK_WriteReg(R1, 0x00000100) +T2C9C 000:633.535 - 0.006ms returns 0 +T2C9C 000:633.544 JLINK_WriteReg(R2, 0x200039D4) +T2C9C 000:633.550 - 0.006ms returns 0 +T2C9C 000:633.621 JLINK_WriteReg(R3, 0x00000000) +T2C9C 000:633.634 - 0.013ms returns 0 +T2C9C 000:633.643 JLINK_WriteReg(R4, 0x00000000) +T2C9C 000:633.649 - 0.006ms returns 0 +T2C9C 000:633.657 JLINK_WriteReg(R5, 0x00000000) +T2C9C 000:633.663 - 0.006ms returns 0 +T2C9C 000:633.670 JLINK_WriteReg(R6, 0x00000000) +T2C9C 000:633.677 - 0.006ms returns 0 +T2C9C 000:633.684 JLINK_WriteReg(R7, 0x00000000) +T2C9C 000:633.690 - 0.006ms returns 0 +T2C9C 000:633.697 JLINK_WriteReg(R8, 0x00000000) +T2C9C 000:633.703 - 0.006ms returns 0 +T2C9C 000:633.710 JLINK_WriteReg(R9, 0x200039B4) +T2C9C 000:633.716 - 0.006ms returns 0 +T2C9C 000:633.724 JLINK_WriteReg(R10, 0x00000000) +T2C9C 000:633.730 - 0.006ms returns 0 +T2C9C 000:633.737 JLINK_WriteReg(R11, 0x00000000) +T2C9C 000:633.743 - 0.006ms returns 0 +T2C9C 000:633.750 JLINK_WriteReg(R12, 0x00000000) +T2C9C 000:633.756 - 0.006ms returns 0 +T2C9C 000:633.764 JLINK_WriteReg(R13 (SP), 0x20008000) +T2C9C 000:633.770 - 0.006ms returns 0 +T2C9C 000:633.777 JLINK_WriteReg(R14, 0x20003001) +T2C9C 000:633.783 - 0.006ms returns 0 +T2C9C 000:633.791 JLINK_WriteReg(R15 (PC), 0x200032FC) +T2C9C 000:633.800 - 0.009ms returns 0 +T2C9C 000:633.808 JLINK_WriteReg(XPSR, 0x01000000) +T2C9C 000:633.815 - 0.006ms returns 0 +T2C9C 000:633.822 JLINK_WriteReg(MSP, 0x20008000) +T2C9C 000:633.828 - 0.006ms returns 0 +T2C9C 000:633.835 JLINK_WriteReg(PSP, 0x20008000) +T2C9C 000:633.841 - 0.006ms returns 0 +T2C9C 000:633.848 JLINK_WriteReg(CFBP, 0x00000000) +T2C9C 000:633.855 - 0.006ms returns 0 +T2C9C 000:633.863 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T2C9C 000:633.871 - 0.008ms returns 0x0000000A +T2C9C 000:633.878 JLINK_Go() +T2C9C 000:633.890 CPU_ReadMem(4 bytes @ 0xE0001000) +T2C9C 000:639.970 - 6.091ms +T2C9C 000:639.984 JLINK_IsHalted() +T2C9C 000:640.574 - 0.590ms returns FALSE +T2C9C 000:640.588 JLINK_HasError() +T2C9C 000:643.539 JLINK_IsHalted() +T2C9C 000:649.456 CPU_ReadMem(2 bytes @ 0x20003000) +T2C9C 000:650.098 - 6.558ms returns TRUE +T2C9C 000:650.116 JLINK_ReadReg(R15 (PC)) +T2C9C 000:650.129 - 0.012ms returns 0x20003000 +T2C9C 000:650.139 JLINK_ClrBPEx(BPHandle = 0x0000000A) +T2C9C 000:650.149 - 0.009ms returns 0x00 +T2C9C 000:650.159 JLINK_ReadReg(R0) +T2C9C 000:650.168 - 0.008ms returns 0x00000000 +T2C9C 000:651.224 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T2C9C 000:651.239 Data: 64 1C B4 E6 09 28 01 00 30 31 32 33 34 35 36 37 ... +T2C9C 000:651.259 CPU_WriteMem(256 bytes @ 0x200039D4) +T2C9C 000:655.193 - 3.968ms returns 0x100 +T2C9C 000:655.204 JLINK_HasError() +T2C9C 000:655.211 JLINK_WriteReg(R0, 0x18004500) +T2C9C 000:655.218 - 0.007ms returns 0 +T2C9C 000:655.224 JLINK_WriteReg(R1, 0x00000100) +T2C9C 000:655.229 - 0.005ms returns 0 +T2C9C 000:655.235 JLINK_WriteReg(R2, 0x200039D4) +T2C9C 000:655.241 - 0.005ms returns 0 +T2C9C 000:655.247 JLINK_WriteReg(R3, 0x00000000) +T2C9C 000:655.252 - 0.005ms returns 0 +T2C9C 000:655.259 JLINK_WriteReg(R4, 0x00000000) +T2C9C 000:655.264 - 0.005ms returns 0 +T2C9C 000:655.270 JLINK_WriteReg(R5, 0x00000000) +T2C9C 000:655.275 - 0.005ms returns 0 +T2C9C 000:655.281 JLINK_WriteReg(R6, 0x00000000) +T2C9C 000:655.286 - 0.005ms returns 0 +T2C9C 000:655.292 JLINK_WriteReg(R7, 0x00000000) +T2C9C 000:655.297 - 0.005ms returns 0 +T2C9C 000:655.303 JLINK_WriteReg(R8, 0x00000000) +T2C9C 000:655.308 - 0.005ms returns 0 +T2C9C 000:655.314 JLINK_WriteReg(R9, 0x200039B4) +T2C9C 000:655.319 - 0.005ms returns 0 +T2C9C 000:655.325 JLINK_WriteReg(R10, 0x00000000) +T2C9C 000:655.330 - 0.005ms returns 0 +T2C9C 000:655.336 JLINK_WriteReg(R11, 0x00000000) +T2C9C 000:655.341 - 0.005ms returns 0 +T2C9C 000:655.347 JLINK_WriteReg(R12, 0x00000000) +T2C9C 000:655.352 - 0.005ms returns 0 +T2C9C 000:655.359 JLINK_WriteReg(R13 (SP), 0x20008000) +T2C9C 000:655.364 - 0.005ms returns 0 +T2C9C 000:655.370 JLINK_WriteReg(R14, 0x20003001) +T2C9C 000:655.375 - 0.005ms returns 0 +T2C9C 000:655.381 JLINK_WriteReg(R15 (PC), 0x200032FC) +T2C9C 000:655.387 - 0.006ms returns 0 +T2C9C 000:655.393 JLINK_WriteReg(XPSR, 0x01000000) +T2C9C 000:655.398 - 0.005ms returns 0 +T2C9C 000:655.420 JLINK_WriteReg(MSP, 0x20008000) +T2C9C 000:655.425 - 0.005ms returns 0 +T2C9C 000:655.444 JLINK_WriteReg(PSP, 0x20008000) +T2C9C 000:655.449 - 0.005ms returns 0 +T2C9C 000:655.455 JLINK_WriteReg(CFBP, 0x00000000) +T2C9C 000:655.459 - 0.005ms returns 0 +T2C9C 000:655.466 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T2C9C 000:655.472 - 0.006ms returns 0x0000000B +T2C9C 000:655.478 JLINK_Go() +T2C9C 000:655.494 CPU_ReadMem(4 bytes @ 0xE0001000) +T2C9C 000:661.485 - 6.007ms +T2C9C 000:661.511 JLINK_IsHalted() +T2C9C 000:662.223 - 0.711ms returns FALSE +T2C9C 000:662.235 JLINK_HasError() +T2C9C 000:665.368 JLINK_IsHalted() +T2C9C 000:671.438 CPU_ReadMem(2 bytes @ 0x20003000) +T2C9C 000:672.046 - 6.677ms returns TRUE +T2C9C 000:672.057 JLINK_ReadReg(R15 (PC)) +T2C9C 000:672.065 - 0.007ms returns 0x20003000 +T2C9C 000:672.071 JLINK_ClrBPEx(BPHandle = 0x0000000B) +T2C9C 000:672.077 - 0.005ms returns 0x00 +T2C9C 000:672.083 JLINK_ReadReg(R0) +T2C9C 000:672.088 - 0.005ms returns 0x00000000 +T2C9C 000:672.501 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T2C9C 000:672.510 Data: 01 49 C8 62 70 47 00 00 00 80 02 40 02 4A 80 00 ... +T2C9C 000:672.527 CPU_WriteMem(256 bytes @ 0x200039D4) +T2C9C 000:676.621 - 4.119ms returns 0x100 +T2C9C 000:676.646 JLINK_HasError() +T2C9C 000:676.655 JLINK_WriteReg(R0, 0x18004600) +T2C9C 000:676.667 - 0.011ms returns 0 +T2C9C 000:676.673 JLINK_WriteReg(R1, 0x00000100) +T2C9C 000:676.679 - 0.006ms returns 0 +T2C9C 000:676.686 JLINK_WriteReg(R2, 0x200039D4) +T2C9C 000:676.692 - 0.005ms returns 0 +T2C9C 000:676.698 JLINK_WriteReg(R3, 0x00000000) +T2C9C 000:676.704 - 0.005ms returns 0 +T2C9C 000:676.710 JLINK_WriteReg(R4, 0x00000000) +T2C9C 000:676.716 - 0.005ms returns 0 +T2C9C 000:676.722 JLINK_WriteReg(R5, 0x00000000) +T2C9C 000:676.728 - 0.005ms returns 0 +T2C9C 000:676.735 JLINK_WriteReg(R6, 0x00000000) +T2C9C 000:676.740 - 0.005ms returns 0 +T2C9C 000:676.747 JLINK_WriteReg(R7, 0x00000000) +T2C9C 000:676.752 - 0.005ms returns 0 +T2C9C 000:676.759 JLINK_WriteReg(R8, 0x00000000) +T2C9C 000:676.764 - 0.005ms returns 0 +T2C9C 000:676.770 JLINK_WriteReg(R9, 0x200039B4) +T2C9C 000:676.776 - 0.005ms returns 0 +T2C9C 000:676.782 JLINK_WriteReg(R10, 0x00000000) +T2C9C 000:676.788 - 0.005ms returns 0 +T2C9C 000:676.794 JLINK_WriteReg(R11, 0x00000000) +T2C9C 000:676.800 - 0.005ms returns 0 +T2C9C 000:676.806 JLINK_WriteReg(R12, 0x00000000) +T2C9C 000:676.812 - 0.005ms returns 0 +T2C9C 000:676.818 JLINK_WriteReg(R13 (SP), 0x20008000) +T2C9C 000:676.824 - 0.006ms returns 0 +T2C9C 000:676.831 JLINK_WriteReg(R14, 0x20003001) +T2C9C 000:676.836 - 0.005ms returns 0 +T2C9C 000:676.843 JLINK_WriteReg(R15 (PC), 0x200032FC) +T2C9C 000:676.848 - 0.005ms returns 0 +T2C9C 000:676.855 JLINK_WriteReg(XPSR, 0x01000000) +T2C9C 000:676.860 - 0.005ms returns 0 +T2C9C 000:676.867 JLINK_WriteReg(MSP, 0x20008000) +T2C9C 000:676.872 - 0.005ms returns 0 +T2C9C 000:676.879 JLINK_WriteReg(PSP, 0x20008000) +T2C9C 000:676.884 - 0.005ms returns 0 +T2C9C 000:676.891 JLINK_WriteReg(CFBP, 0x00000000) +T2C9C 000:676.896 - 0.005ms returns 0 +T2C9C 000:676.903 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T2C9C 000:676.910 - 0.007ms returns 0x0000000C +T2C9C 000:676.916 JLINK_Go() +T2C9C 000:676.929 CPU_ReadMem(4 bytes @ 0xE0001000) +T2C9C 000:683.067 - 6.149ms +T2C9C 000:683.087 JLINK_IsHalted() +T2C9C 000:683.727 - 0.639ms returns FALSE +T2C9C 000:683.736 JLINK_HasError() +T2C9C 000:686.345 JLINK_IsHalted() +T2C9C 000:692.480 CPU_ReadMem(2 bytes @ 0x20003000) +T2C9C 000:693.114 - 6.769ms returns TRUE +T2C9C 000:693.129 JLINK_ReadReg(R15 (PC)) +T2C9C 000:693.139 - 0.010ms returns 0x20003000 +T2C9C 000:693.147 JLINK_ClrBPEx(BPHandle = 0x0000000C) +T2C9C 000:693.154 - 0.006ms returns 0x00 +T2C9C 000:693.232 JLINK_ReadReg(R0) +T2C9C 000:693.245 - 0.013ms returns 0x00000000 +T2C9C 000:693.694 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T2C9C 000:693.704 Data: 06 D1 5A 69 80 05 92 09 92 01 80 0E 02 43 5A 61 ... +T2C9C 000:693.718 CPU_WriteMem(256 bytes @ 0x200039D4) +T2C9C 000:697.587 - 3.892ms returns 0x100 +T2C9C 000:697.602 JLINK_HasError() +T2C9C 000:697.610 JLINK_WriteReg(R0, 0x18004700) +T2C9C 000:697.619 - 0.008ms returns 0 +T2C9C 000:697.626 JLINK_WriteReg(R1, 0x00000100) +T2C9C 000:697.633 - 0.006ms returns 0 +T2C9C 000:697.640 JLINK_WriteReg(R2, 0x200039D4) +T2C9C 000:697.646 - 0.006ms returns 0 +T2C9C 000:697.653 JLINK_WriteReg(R3, 0x00000000) +T2C9C 000:697.659 - 0.006ms returns 0 +T2C9C 000:697.666 JLINK_WriteReg(R4, 0x00000000) +T2C9C 000:697.672 - 0.006ms returns 0 +T2C9C 000:697.679 JLINK_WriteReg(R5, 0x00000000) +T2C9C 000:697.685 - 0.006ms returns 0 +T2C9C 000:697.692 JLINK_WriteReg(R6, 0x00000000) +T2C9C 000:697.698 - 0.006ms returns 0 +T2C9C 000:697.705 JLINK_WriteReg(R7, 0x00000000) +T2C9C 000:697.711 - 0.006ms returns 0 +T2C9C 000:697.718 JLINK_WriteReg(R8, 0x00000000) +T2C9C 000:697.724 - 0.006ms returns 0 +T2C9C 000:697.731 JLINK_WriteReg(R9, 0x200039B4) +T2C9C 000:697.737 - 0.006ms returns 0 +T2C9C 000:697.744 JLINK_WriteReg(R10, 0x00000000) +T2C9C 000:697.762 - 0.018ms returns 0 +T2C9C 000:697.768 JLINK_WriteReg(R11, 0x00000000) +T2C9C 000:697.773 - 0.005ms returns 0 +T2C9C 000:697.782 JLINK_WriteReg(R12, 0x00000000) +T2C9C 000:697.788 - 0.006ms returns 0 +T2C9C 000:697.794 JLINK_WriteReg(R13 (SP), 0x20008000) +T2C9C 000:697.799 - 0.005ms returns 0 +T2C9C 000:697.805 JLINK_WriteReg(R14, 0x20003001) +T2C9C 000:697.810 - 0.004ms returns 0 +T2C9C 000:697.816 JLINK_WriteReg(R15 (PC), 0x200032FC) +T2C9C 000:697.821 - 0.005ms returns 0 +T2C9C 000:697.827 JLINK_WriteReg(XPSR, 0x01000000) +T2C9C 000:697.831 - 0.005ms returns 0 +T2C9C 000:697.837 JLINK_WriteReg(MSP, 0x20008000) +T2C9C 000:697.842 - 0.004ms returns 0 +T2C9C 000:697.848 JLINK_WriteReg(PSP, 0x20008000) +T2C9C 000:697.853 - 0.004ms returns 0 +T2C9C 000:697.858 JLINK_WriteReg(CFBP, 0x00000000) +T2C9C 000:697.863 - 0.004ms returns 0 +T2C9C 000:697.870 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T2C9C 000:697.876 - 0.006ms returns 0x0000000D +T2C9C 000:697.882 JLINK_Go() +T2C9C 000:697.892 CPU_ReadMem(4 bytes @ 0xE0001000) +T2C9C 000:703.732 - 5.849ms +T2C9C 000:703.744 JLINK_IsHalted() +T2C9C 000:704.402 - 0.657ms returns FALSE +T2C9C 000:704.414 JLINK_HasError() +T2C9C 000:706.816 JLINK_IsHalted() +T2C9C 000:712.834 CPU_ReadMem(2 bytes @ 0x20003000) +T2C9C 000:713.420 - 6.604ms returns TRUE +T2C9C 000:713.430 JLINK_ReadReg(R15 (PC)) +T2C9C 000:713.438 - 0.007ms returns 0x20003000 +T2C9C 000:713.444 JLINK_ClrBPEx(BPHandle = 0x0000000D) +T2C9C 000:713.450 - 0.005ms returns 0x00 +T2C9C 000:713.456 JLINK_ReadReg(R0) +T2C9C 000:713.462 - 0.005ms returns 0x00000000 +T2C9C 000:714.002 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T2C9C 000:714.010 Data: 41 60 70 47 00 30 02 40 28 48 00 18 98 30 00 20 ... +T2C9C 000:714.021 CPU_WriteMem(256 bytes @ 0x200039D4) +T2C9C 000:717.885 - 3.883ms returns 0x100 +T2C9C 000:717.898 JLINK_HasError() +T2C9C 000:717.905 JLINK_WriteReg(R0, 0x18004800) +T2C9C 000:717.912 - 0.007ms returns 0 +T2C9C 000:717.919 JLINK_WriteReg(R1, 0x0000002C) +T2C9C 000:717.924 - 0.005ms returns 0 +T2C9C 000:717.930 JLINK_WriteReg(R2, 0x200039D4) +T2C9C 000:717.935 - 0.005ms returns 0 +T2C9C 000:717.942 JLINK_WriteReg(R3, 0x00000000) +T2C9C 000:717.948 - 0.005ms returns 0 +T2C9C 000:717.954 JLINK_WriteReg(R4, 0x00000000) +T2C9C 000:717.959 - 0.005ms returns 0 +T2C9C 000:717.966 JLINK_WriteReg(R5, 0x00000000) +T2C9C 000:717.971 - 0.005ms returns 0 +T2C9C 000:717.977 JLINK_WriteReg(R6, 0x00000000) +T2C9C 000:717.982 - 0.005ms returns 0 +T2C9C 000:717.988 JLINK_WriteReg(R7, 0x00000000) +T2C9C 000:717.993 - 0.005ms returns 0 +T2C9C 000:717.999 JLINK_WriteReg(R8, 0x00000000) +T2C9C 000:718.004 - 0.005ms returns 0 +T2C9C 000:718.011 JLINK_WriteReg(R9, 0x200039B4) +T2C9C 000:718.016 - 0.005ms returns 0 +T2C9C 000:718.022 JLINK_WriteReg(R10, 0x00000000) +T2C9C 000:718.027 - 0.005ms returns 0 +T2C9C 000:718.033 JLINK_WriteReg(R11, 0x00000000) +T2C9C 000:718.038 - 0.005ms returns 0 +T2C9C 000:718.044 JLINK_WriteReg(R12, 0x00000000) +T2C9C 000:718.049 - 0.005ms returns 0 +T2C9C 000:718.056 JLINK_WriteReg(R13 (SP), 0x20008000) +T2C9C 000:718.061 - 0.005ms returns 0 +T2C9C 000:718.068 JLINK_WriteReg(R14, 0x20003001) +T2C9C 000:718.073 - 0.005ms returns 0 +T2C9C 000:718.080 JLINK_WriteReg(R15 (PC), 0x200032FC) +T2C9C 000:718.085 - 0.005ms returns 0 +T2C9C 000:718.091 JLINK_WriteReg(XPSR, 0x01000000) +T2C9C 000:718.096 - 0.005ms returns 0 +T2C9C 000:718.102 JLINK_WriteReg(MSP, 0x20008000) +T2C9C 000:718.107 - 0.005ms returns 0 +T2C9C 000:718.113 JLINK_WriteReg(PSP, 0x20008000) +T2C9C 000:718.118 - 0.005ms returns 0 +T2C9C 000:718.125 JLINK_WriteReg(CFBP, 0x00000000) +T2C9C 000:718.131 - 0.005ms returns 0 +T2C9C 000:718.138 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T2C9C 000:718.144 - 0.006ms returns 0x0000000E +T2C9C 000:718.151 JLINK_Go() +T2C9C 000:718.160 CPU_ReadMem(4 bytes @ 0xE0001000) +T2C9C 000:724.223 - 6.070ms +T2C9C 000:724.278 JLINK_IsHalted() +T2C9C 000:725.042 - 0.761ms returns FALSE +T2C9C 000:725.096 JLINK_HasError() +T2C9C 000:744.893 JLINK_IsHalted() +T2C9C 000:751.070 CPU_ReadMem(2 bytes @ 0x20003000) +T2C9C 000:751.733 - 6.839ms returns TRUE +T2C9C 000:751.767 JLINK_ReadReg(R15 (PC)) +T2C9C 000:751.789 - 0.022ms returns 0x20003000 +T2C9C 000:751.808 JLINK_ClrBPEx(BPHandle = 0x0000000E) +T2C9C 000:751.822 - 0.014ms returns 0x00 +T2C9C 000:751.839 JLINK_ReadReg(R0) +T2C9C 000:751.852 - 0.012ms returns 0x00000000 +T2C9C 000:751.868 JLINK_HasError() +T2C9C 000:751.887 JLINK_WriteReg(R0, 0x00000002) +T2C9C 000:751.901 - 0.014ms returns 0 +T2C9C 000:751.916 JLINK_WriteReg(R1, 0x0000002C) +T2C9C 000:751.929 - 0.012ms returns 0 +T2C9C 000:751.947 JLINK_WriteReg(R2, 0x200039D4) +T2C9C 000:751.959 - 0.012ms returns 0 +T2C9C 000:751.977 JLINK_WriteReg(R3, 0x00000000) +T2C9C 000:751.989 - 0.012ms returns 0 +T2C9C 000:752.007 JLINK_WriteReg(R4, 0x00000000) +T2C9C 000:752.019 - 0.012ms returns 0 +T2C9C 000:752.034 JLINK_WriteReg(R5, 0x00000000) +T2C9C 000:752.046 - 0.012ms returns 0 +T2C9C 000:752.063 JLINK_WriteReg(R6, 0x00000000) +T2C9C 000:752.076 - 0.012ms returns 0 +T2C9C 000:752.093 JLINK_WriteReg(R7, 0x00000000) +T2C9C 000:752.105 - 0.012ms returns 0 +T2C9C 000:752.123 JLINK_WriteReg(R8, 0x00000000) +T2C9C 000:752.135 - 0.012ms returns 0 +T2C9C 000:752.152 JLINK_WriteReg(R9, 0x200039B4) +T2C9C 000:752.164 - 0.012ms returns 0 +T2C9C 000:752.182 JLINK_WriteReg(R10, 0x00000000) +T2C9C 000:752.195 - 0.012ms returns 0 +T2C9C 000:752.211 JLINK_WriteReg(R11, 0x00000000) +T2C9C 000:752.224 - 0.012ms returns 0 +T2C9C 000:752.241 JLINK_WriteReg(R12, 0x00000000) +T2C9C 000:752.253 - 0.012ms returns 0 +T2C9C 000:752.270 JLINK_WriteReg(R13 (SP), 0x20008000) +T2C9C 000:752.283 - 0.013ms returns 0 +T2C9C 000:752.300 JLINK_WriteReg(R14, 0x20003001) +T2C9C 000:752.312 - 0.012ms returns 0 +T2C9C 000:752.329 JLINK_WriteReg(R15 (PC), 0x20003218) +T2C9C 000:752.342 - 0.012ms returns 0 +T2C9C 000:752.359 JLINK_WriteReg(XPSR, 0x01000000) +T2C9C 000:752.371 - 0.012ms returns 0 +T2C9C 000:752.389 JLINK_WriteReg(MSP, 0x20008000) +T2C9C 000:752.401 - 0.012ms returns 0 +T2C9C 000:752.419 JLINK_WriteReg(PSP, 0x20008000) +T2C9C 000:752.431 - 0.012ms returns 0 +T2C9C 000:752.448 JLINK_WriteReg(CFBP, 0x00000000) +T2C9C 000:752.460 - 0.012ms returns 0 +T2C9C 000:752.478 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T2C9C 000:752.492 - 0.014ms returns 0x0000000F +T2C9C 000:752.509 JLINK_Go() +T2C9C 000:752.530 CPU_ReadMem(4 bytes @ 0xE0001000) +T2C9C 000:758.694 - 6.184ms +T2C9C 000:758.724 JLINK_IsHalted() +T2C9C 000:759.419 - 0.694ms returns FALSE +T2C9C 000:759.448 JLINK_HasError() +T2C9C 000:764.891 JLINK_IsHalted() +T2C9C 000:765.550 - 0.658ms returns FALSE +T2C9C 000:765.577 JLINK_HasError() +T2C9C 000:766.881 JLINK_IsHalted() +T2C9C 000:767.582 - 0.699ms returns FALSE +T2C9C 000:767.608 JLINK_HasError() +T2C9C 000:768.851 JLINK_IsHalted() +T2C9C 000:769.522 - 0.670ms returns FALSE +T2C9C 000:769.549 JLINK_HasError() +T2C9C 000:772.837 JLINK_IsHalted() +T2C9C 000:773.517 - 0.679ms returns FALSE +T2C9C 000:773.544 JLINK_HasError() +T2C9C 000:774.834 JLINK_IsHalted() +T2C9C 000:775.505 - 0.671ms returns FALSE +T2C9C 000:775.532 JLINK_HasError() +T2C9C 000:776.839 JLINK_IsHalted() +T2C9C 000:777.513 - 0.673ms returns FALSE +T2C9C 000:777.537 JLINK_HasError() +T2C9C 000:780.812 JLINK_IsHalted() +T2C9C 000:781.446 - 0.632ms returns FALSE +T2C9C 000:781.467 JLINK_HasError() +T2C9C 000:782.812 JLINK_IsHalted() +T2C9C 000:783.467 - 0.654ms returns FALSE +T2C9C 000:783.485 JLINK_HasError() +T2C9C 000:784.845 JLINK_IsHalted() +T2C9C 000:785.513 - 0.667ms returns FALSE +T2C9C 000:785.530 JLINK_HasError() +T2C9C 000:787.792 JLINK_IsHalted() +T2C9C 000:788.392 - 0.599ms returns FALSE +T2C9C 000:788.408 JLINK_HasError() +T2C9C 000:790.774 JLINK_IsHalted() +T2C9C 000:791.392 - 0.617ms returns FALSE +T2C9C 000:791.406 JLINK_HasError() +T2C9C 000:792.771 JLINK_IsHalted() +T2C9C 000:798.641 CPU_ReadMem(2 bytes @ 0x20003000) +T2C9C 000:799.290 - 6.518ms returns TRUE +T2C9C 000:799.303 JLINK_ReadReg(R15 (PC)) +T2C9C 000:799.312 - 0.009ms returns 0x20003000 +T2C9C 000:799.319 JLINK_ClrBPEx(BPHandle = 0x0000000F) +T2C9C 000:799.326 - 0.006ms returns 0x00 +T2C9C 000:799.333 JLINK_ReadReg(R0) +T2C9C 000:799.338 - 0.005ms returns 0x00000000 +T2C9C 000:853.761 JLINK_WriteMem(0x20003000, 0x2 Bytes, ...) +T2C9C 000:853.798 Data: FE E7 +T2C9C 000:853.849 CPU_WriteMem(2 bytes @ 0x20003000) +T2C9C 000:854.480 - 0.719ms returns 0x2 +T2C9C 000:854.496 JLINK_HasError() +T2C9C 000:854.504 JLINK_HasError() +T2C9C 000:854.511 JLINK_SetResetType(JLINKARM_CM3_RESET_TYPE_NORMAL) +T2C9C 000:854.517 - 0.005ms returns JLINKARM_CM3_RESET_TYPE_NORMAL +T2C9C 000:854.523 JLINK_Reset() +T2C9C 000:854.534 CPU_ReadMem(4 bytes @ 0x200039D4) +T2C9C 000:855.106 CPU_WriteMem(4 bytes @ 0x200039D4) +T2C9C 000:857.655 Memory map 'before startup completion point' is active +T2C9C 000:857.671 CPU_WriteMem(4 bytes @ 0xE000EDF0) +T2C9C 000:858.313 CPU_WriteMem(4 bytes @ 0xE000EDFC) +T2C9C 000:860.844 Reset: Halt core after reset via DEMCR.VC_CORERESET. +T2C9C 000:863.317 Reset: Reset device via AIRCR.SYSRESETREQ. +T2C9C 000:863.335 CPU_WriteMem(4 bytes @ 0xE000ED0C) +T2C9C 000:916.452 CPU_ReadMem(4 bytes @ 0xE000EDF0) +T2C9C 000:916.969 CPU_ReadMem(4 bytes @ 0xE000EDF0) +T2C9C 000:917.500 CPU_WriteMem(4 bytes @ 0xE000EDFC) +T2C9C 000:923.506 CPU_ReadMem(4 bytes @ 0xE000EDF0) +T2C9C 000:930.015 CPU_WriteMem(4 bytes @ 0xE0002000) +T2C9C 000:930.604 CPU_ReadMem(4 bytes @ 0xE000EDFC) +T2C9C 000:931.226 CPU_ReadMem(4 bytes @ 0xE0001000) +T2C9C 000:931.725 CPU_WriteMem(4 bytes @ 0xE0001000) +T2C9C 000:932.390 - 77.866ms +T2C9C 000:932.405 JLINK_Go() +T2C9C 000:932.418 CPU_ReadMem(4 bytes @ 0xE0001000) +T2C9C 000:933.000 CPU_WriteMem(4 bytes @ 0xE0001000) +T2C9C 000:933.636 CPU_WriteMem(4 bytes @ 0xE0002008) +T2C9C 000:933.646 CPU_WriteMem(4 bytes @ 0xE000200C) +T2C9C 000:933.653 CPU_WriteMem(4 bytes @ 0xE0002010) +T2C9C 000:933.661 CPU_WriteMem(4 bytes @ 0xE0002014) +T2C9C 000:935.374 CPU_WriteMem(4 bytes @ 0xE0001004) +T2C9C 000:938.873 Memory map 'after startup completion point' is active +T2C9C 000:938.904 - 6.499ms +T2C9C 000:946.675 JLINK_Close() +T2C9C 000:947.063 CPU is running +T2C9C 000:947.079 CPU_WriteMem(4 bytes @ 0xE0002008) +T2C9C 000:947.678 CPU is running +T2C9C 000:947.690 CPU_WriteMem(4 bytes @ 0xE000200C) +T2C9C 000:948.290 CPU is running +T2C9C 000:948.308 CPU_WriteMem(4 bytes @ 0xE0002010) +T2C9C 000:948.901 CPU is running +T2C9C 000:948.913 CPU_WriteMem(4 bytes @ 0xE0002014) +T2C9C 000:960.606 - 13.929ms +T2C9C 000:960.641 +T2C9C 000:960.646 Closed diff --git a/examples/extiTest/mdk/JLinkSettings.ini b/examples/extiTest/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/examples/extiTest/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/examples/extiTest/mdk/clean.bat b/examples/extiTest/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/examples/extiTest/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/examples/extiTest/mdk/extiTest.uvguix.Administrator b/examples/extiTest/mdk/extiTest.uvguix.Administrator new file mode 100644 index 0000000..7843374 --- /dev/null +++ b/examples/extiTest/mdk/extiTest.uvguix.Administrator @@ -0,0 +1,1360 @@ + + + + -5.1 + +
### uVision Project, (C) Keil Software
+ + + + + + 38003 + Registers + 115 115 + + + 346 + Code Coverage + 1010 160 + + + 204 + Performance Analyzer + 1170 + + + + + + 1506 + Symbols + + 80 80 80 + + + 1936 + Watch 1 + + 80 80 80 + + + 1937 + Watch 2 + + 80 80 80 + + + 1935 + Call Stack + Locals + + 80 80 80 + + + 2506 + Trace Data + + 75 135 130 95 70 230 200 150 + + + + + + 1 + 1 + 0 + 0 + -1 + + + + + + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + -8 + 1030 + 742 + + + + 0 + + 288 + 0100000004000000010000000100000001000000010000000000000002000000000000000100000001000000000000002800000028000000010000000100000000000000010000005C433A5C55736572735C41646D696E6973747261746F725C4465736B746F705CB9A4D7F7CFEEC4BF5CD6D0BFD8CFEEC4BF5C626C6553444B365F76312E342E315C6578616D706C65735C65787469546573745C7372635C6D61696E2E6300000000066D61696E2E6300000000FFDC7800FFFFFFFF0100000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD500010000000000000002000000B50400006E0000007F07000068030000 + + + + 0 + Build + + -1 + -1 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + F40000004F00000090050000DF000000 + + + 16 + F40000006600000090050000F6000000 + + + + 1005 + 1005 + 1 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 0300000066000000ED00000030030000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 109 + 109 + 1 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 0300000066000000ED00000030030000 + + + 16 + D8000000EF000000F40100002F030000 + + + + 1465 + 1465 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000300200008D050000A4020000 + + + 16 + D8000000EF000000A00300007F010000 + + + + 1466 + 1466 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000300200008D050000A4020000 + + + 16 + D8000000EF000000A00300007F010000 + + + + 1467 + 1467 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000300200008D050000A4020000 + + + 16 + D8000000EF000000A00300007F010000 + + + + 1468 + 1468 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000300200008D050000A4020000 + + + 16 + D8000000EF000000A00300007F010000 + + + + 1506 + 1506 + 0 + 0 + 0 + 0 + 32767 + 0 + 16384 + 0 + + 16 + A3040000660000008D05000010020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 1913 + 1913 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + F7000000660000008D050000C6000000 + + + 16 + D8000000EF000000A00300007F010000 + + + + 1935 + 1935 + 0 + 0 + 0 + 0 + 32767 + 0 + 32768 + 0 + + 16 + 03000000300200008D050000A4020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 1936 + 1936 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000300200008D050000A4020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 1937 + 1937 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000300200008D050000A4020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 1939 + 1939 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000300200008D050000A4020000 + + + 16 + D8000000EF000000A00300007F010000 + + + + 1940 + 1940 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000300200008D050000A4020000 + + + 16 + D8000000EF000000A00300007F010000 + + + + 1941 + 1941 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000300200008D050000A4020000 + + + 16 + D8000000EF000000A00300007F010000 + + + + 1942 + 1942 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000300200008D050000A4020000 + + + 16 + D8000000EF000000A00300007F010000 + + + + 195 + 195 + 1 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 0300000066000000ED00000030030000 + + + 16 + D8000000EF000000F40100002F030000 + + + + 196 + 196 + 1 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 0300000066000000ED00000030030000 + + + 16 + D8000000EF000000F40100002F030000 + + + + 197 + 197 + 1 + 0 + 0 + 0 + 32767 + 0 + 32768 + 0 + + 16 + 0000000061030000BE030000DD030000 + + + 16 + D8000000EF000000A00300007F010000 + + + + 198 + 198 + 0 + 0 + 0 + 0 + 32767 + 0 + 32768 + 0 + + 16 + 000000001902000090050000BD020000 + + + 16 + D8000000EF000000A00300007F010000 + + + + 199 + 199 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000640300007D070000C4030000 + + + 16 + D8000000EF000000A00300007F010000 + + + + 203 + 203 + 0 + 0 + 0 + 0 + 32767 + 0 + 8192 + 0 + + 16 + F7000000660000008D050000C6000000 + + + 16 + D8000000EF000000A00300007F010000 + + + + 204 + 204 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + F7000000660000008D050000C6000000 + + + 16 + D8000000EF000000A00300007F010000 + + + + 221 + 221 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 00000000000000000000000000000000 + + + 16 + 0A0000000A0000006E0000006E000000 + + + + 2506 + 2506 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D05000010020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 2507 + 2507 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000300200008D050000A4020000 + + + 16 + D8000000EF000000A00300007F010000 + + + + 343 + 343 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + F7000000660000008D050000C6000000 + + + 16 + D8000000EF000000A00300007F010000 + + + + 346 + 346 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + F7000000660000008D050000C6000000 + + + 16 + D8000000EF000000A00300007F010000 + + + + 35824 + 35824 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + F7000000660000008D050000C6000000 + + + 16 + D8000000EF000000A00300007F010000 + + + + 35885 + 35885 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D05000010020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 35886 + 35886 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D05000010020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 35887 + 35887 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D05000010020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 35888 + 35888 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D05000010020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 35889 + 35889 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D05000010020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 35890 + 35890 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D05000010020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 35891 + 35891 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D05000010020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 35892 + 35892 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D05000010020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 35893 + 35893 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D05000010020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 35894 + 35894 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D05000010020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 35895 + 35895 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D05000010020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 35896 + 35896 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D05000010020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 35897 + 35897 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D05000010020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 35898 + 35898 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D05000010020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 35899 + 35899 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D05000010020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 35900 + 35900 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D05000010020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 35901 + 35901 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D05000010020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 35902 + 35902 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D05000010020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 35903 + 35903 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D05000010020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 35904 + 35904 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D05000010020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 35905 + 35905 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D05000010020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 38003 + 38003 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 0300000066000000ED00000039030000 + + + 16 + D8000000EF000000F40100002F030000 + + + + 38007 + 38007 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000640300007D070000C4030000 + + + 16 + D8000000EF000000A00300007F010000 + + + + 436 + 436 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000640300007D070000C4030000 + + + 16 + D8000000EF000000F40100002F030000 + + + + 437 + 437 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000300200008D050000A4020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 440 + 440 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000300200008D050000A4020000 + + + 16 + D8000000EF000000C8010000BA010000 + + + + 59392 + 59392 + 1 + 0 + 0 + 0 + 940 + 0 + 8192 + 0 + + 16 + 0000000000000000B70300001C000000 + + + 16 + 0A0000000A0000006E0000006E000000 + + + + 59393 + 0 + 1 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 00000000DD030000BE030000F0030000 + + + 16 + 0A0000000A0000006E0000006E000000 + + + + 59399 + 59399 + 1 + 0 + 0 + 0 + 463 + 0 + 8192 + 1 + + 16 + 000000001C000000DA01000038000000 + + + 16 + 0A0000000A0000006E0000006E000000 + + + + 59400 + 59400 + 0 + 0 + 0 + 0 + 612 + 0 + 8192 + 2 + + 16 + 00000000380000006F02000054000000 + + + 16 + 0A0000000A0000006E0000006E000000 + + + + 2619 + 000000000B000000000000000020000000000000FFFFFFFFFFFFFFFFF4000000DF00000090050000E3000000000000000100000004000000010000000000000000000000FFFFFFFF06000000CB00000057010000CC000000F08B00005A01000079070000FFFF02000B004354616262656450616E650020000000000000F40000006600000090050000F6000000F40000004F00000090050000DF0000000000000040280046060000000B446973617373656D626C7900000000CB00000001000000FFFFFFFFFFFFFFFF14506572666F726D616E636520416E616C797A6572000000005701000001000000FFFFFFFFFFFFFFFF14506572666F726D616E636520416E616C797A657200000000CC00000001000000FFFFFFFFFFFFFFFF0E4C6F67696320416E616C797A657200000000F08B000001000000FFFFFFFFFFFFFFFF0D436F646520436F766572616765000000005A01000001000000FFFFFFFFFFFFFFFF11496E737472756374696F6E205472616365000000007907000001000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000001000000FFFFFFFFCB00000001000000FFFFFFFFCB000000000000000040000000000000FFFFFFFFFFFFFFFF9C0400004F000000A004000029020000000000000200000004000000010000000000000000000000FFFFFFFF17000000E2050000CA0900002D8C00002E8C00002F8C0000308C0000318C0000328C0000338C0000348C0000358C0000368C0000378C0000388C0000398C00003A8C00003B8C00003C8C00003D8C00003E8C00003F8C0000408C0000418C000001800040000000000000A0040000660000009005000040020000A00400004F00000090050000290200000000000040410046170000000753796D626F6C7300000000E205000001000000FFFFFFFFFFFFFFFF0A5472616365204461746100000000CA09000001000000FFFFFFFFFFFFFFFF00000000002D8C000001000000FFFFFFFFFFFFFFFF00000000002E8C000001000000FFFFFFFFFFFFFFFF00000000002F8C000001000000FFFFFFFFFFFFFFFF0000000000308C000001000000FFFFFFFFFFFFFFFF0000000000318C000001000000FFFFFFFFFFFFFFFF0000000000328C000001000000FFFFFFFFFFFFFFFF0000000000338C000001000000FFFFFFFFFFFFFFFF0000000000348C000001000000FFFFFFFFFFFFFFFF0000000000358C000001000000FFFFFFFFFFFFFFFF0000000000368C000001000000FFFFFFFFFFFFFFFF0000000000378C000001000000FFFFFFFFFFFFFFFF0000000000388C000001000000FFFFFFFFFFFFFFFF0000000000398C000001000000FFFFFFFFFFFFFFFF00000000003A8C000001000000FFFFFFFFFFFFFFFF00000000003B8C000001000000FFFFFFFFFFFFFFFF00000000003C8C000001000000FFFFFFFFFFFFFFFF00000000003D8C000001000000FFFFFFFFFFFFFFFF00000000003E8C000001000000FFFFFFFFFFFFFFFF00000000003F8C000001000000FFFFFFFFFFFFFFFF0000000000408C000001000000FFFFFFFFFFFFFFFF0000000000418C000001000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000001000000FFFFFFFFE205000001000000FFFFFFFFE2050000000000000010000001000000FFFFFFFFFFFFFFFFF00000004F000000F400000049030000010000000200001004000000010000000000000000000000FFFFFFFF05000000ED0300006D000000C3000000C400000073940000018000100000010000000000000066000000F000000069030000000000004F000000F0000000490300000000000040410056050000000750726F6A65637401000000ED03000001000000FFFFFFFFFFFFFFFF05426F6F6B73010000006D00000001000000FFFFFFFFFFFFFFFF0946756E6374696F6E7301000000C300000001000000FFFFFFFFFFFFFFFF0954656D706C6174657301000000C400000001000000FFFFFFFFFFFFFFFF09526567697374657273000000007394000001000000FFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000001000000FFFFFFFFED03000001000000FFFFFFFFED030000000000000080000000000000FFFFFFFFFFFFFFFF0000000015020000900500001902000000000000010000000400000001000000000000000000000000000000000000000000000001000000C6000000FFFFFFFF0E0000008F070000930700009407000095070000960700009007000091070000B5010000B8010000B9050000BA050000BB050000BC050000CB09000001800080000000000000000000003002000090050000D4020000000000001902000090050000BD02000000000000404100460E0000001343616C6C20537461636B202B204C6F63616C73000000008F07000001000000FFFFFFFFFFFFFFFF0755415254202331000000009307000001000000FFFFFFFFFFFFFFFF0755415254202332000000009407000001000000FFFFFFFFFFFFFFFF0755415254202333000000009507000001000000FFFFFFFFFFFFFFFF15446562756720287072696E74662920566965776572000000009607000001000000FFFFFFFFFFFFFFFF0757617463682031000000009007000001000000FFFFFFFFFFFFFFFF0757617463682032000000009107000001000000FFFFFFFFFFFFFFFF10547261636520457863657074696F6E7300000000B501000001000000FFFFFFFFFFFFFFFF0E4576656E7420436F756E7465727300000000B801000001000000FFFFFFFFFFFFFFFF084D656D6F7279203100000000B905000001000000FFFFFFFFFFFFFFFF084D656D6F7279203200000000BA05000001000000FFFFFFFFFFFFFFFF084D656D6F7279203300000000BB05000001000000FFFFFFFFFFFFFFFF084D656D6F7279203400000000BC05000001000000FFFFFFFFFFFFFFFF105472616365204E617669676174696F6E00000000CB09000001000000FFFFFFFFFFFFFFFFFFFFFFFF0000000001000000000000000000000001000000FFFFFFFFC802000019020000CC020000BD02000000000000020000000400000000000000000000000000000000000000000000000000000002000000C6000000FFFFFFFF8F07000001000000FFFFFFFF8F07000001000000C6000000000000000080000001000000FFFFFFFFFFFFFFFF0000000049030000BE0300004D030000010000000100001004000000010000000000000000000000FFFFFFFF04000000C5000000C7000000B40100007794000001800080000001000000000000006D03000080070000FD030000000000004D030000BE030000DD0300000000000040820056040000000C4275696C64204F757470757401000000C500000001000000FFFFFFFFFFFFFFFF0D46696E6420496E2046696C657300000000C700000001000000FFFFFFFFFFFFFFFF0A4572726F72204C69737400000000B401000001000000FFFFFFFFFFFFFFFF0742726F77736572000000007794000001000000FFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000001000000FFFFFFFFC500000001000000FFFFFFFFC5000000000000000000000000000000 + + + 59392 + File + + 2131 + 00200000010000002800FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000000000000000000000000000000000000000100000001000000018001E100000000000001000000000000000000000000000000000100000001000000018003E1000000000000020000000000000000000000000000000001000000010000000180CD7F0000000000000300000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018023E100000000040004000000000000000000000000000000000100000001000000018022E100000000040005000000000000000000000000000000000100000001000000018025E10000000000000600000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001802BE10000000000000700000000000000000000000000000000010000000100000001802CE10000000004000800000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001807A8A0000000000000900000000000000000000000000000000010000000100000001807B8A0000000004000A00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180D3B00000000000000B000000000000000000000000000000000100000001000000018015B10000000004000C0000000000000000000000000000000001000000010000000180F4B00000000004000D000000000000000000000000000000000100000001000000018036B10000000004000E00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FF88000000000400460000000000000000000000000000000001000000010000000180FE880000000004004500000000000000000000000000000000010000000100000001800B810000000004001300000000000000000000000000000000010000000100000001800C810000000004001400000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180F0880000020000000F000000000000000000000000000000000100000001000000FFFF0100120043555646696E64436F6D626F427574746F6EE80300000000000000000000000000000000000000000000000100000001000000960000000200205000000000106D625F636D645F706F7765725F6F666696000000000000000500106D625F636D645F706F7765725F6F66660F6D625F636D645F706F7765725F6F6E1276696F5F726561645F686F6C645F726567731E746573745F6D6F646275735F7274755F736C6176655F63616C6C6261636B09736D625F736C6176650000000000000000000000000000000000000000018024E10000000000001100000000000000000000000000000000010000000100000001800A810000000000001200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018022800000020000001500000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180C488000000000000160000000000000000000000000000000001000000010000000180C988000000000400180000000000000000000000000000000001000000010000000180C788000000000000190000000000000000000000000000000001000000010000000180C8880000000000001700000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000FFFF01001500434D4643546F6F6C4261724D656E75427574746F6E4C010000020001001A0000000F50726F6A6563742057696E646F7773000000000000000000000000010000000100000000000000000000000100000008002880DD880000000000001A0000000750726F6A656374000000000000000000000000010000000100000000000000000000000100000000002880DC8B0000000000003A00000005426F6F6B73000000000000000000000000010000000100000000000000000000000100000000002880E18B0000000000003B0000000946756E6374696F6E73000000000000000000000000010000000100000000000000000000000100000000002880E28B000000000000400000000954656D706C6174657300000000000000000000000001000000010000000000000000000000010000000000288018890000000000003D0000000E536F757263652042726F777365720000000000000000000000000100000001000000000000000000000001000000000028800000000000000400FFFFFFFF00000000000000000001000000000000000100000000000000000000000100000000002880D988000000000000390000000C4275696C64204F7574707574000000000000000000000000010000000100000000000000000000000100000000002880E38B000000000000410000000B46696E64204F75747075740000000000000000000000000100000001000000000000000000000001000000000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FB7F0000000000001B000000000000000000000000000000000100000001000000000000000446696C65AC030000 + + + 1423 + 2800FFFF01001100434D4643546F6F6C426172427574746F6E00E1000000000000FFFFFFFF000100000000000000010000000000000001000000018001E1000000000000FFFFFFFF000100000000000000010000000000000001000000018003E1000000000000FFFFFFFF0001000000000000000100000000000000010000000180CD7F000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF000000000000000000010000000000000001000000018023E1000000000000FFFFFFFF000100000000000000010000000000000001000000018022E1000000000000FFFFFFFF000100000000000000010000000000000001000000018025E1000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF00000000000000000001000000000000000100000001802BE1000000000000FFFFFFFF00010000000000000001000000000000000100000001802CE1000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF00000000000000000001000000000000000100000001807A8A000000000000FFFFFFFF00010000000000000001000000000000000100000001807B8A000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF0000000000000000000100000000000000010000000180D3B0000000000000FFFFFFFF000100000000000000010000000000000001000000018015B1000000000000FFFFFFFF0001000000000000000100000000000000010000000180F4B0000000000000FFFFFFFF000100000000000000010000000000000001000000018036B1000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF0000000000000000000100000000000000010000000180FF88000000000000FFFFFFFF0001000000000000000100000000000000010000000180FE88000000000000FFFFFFFF00010000000000000001000000000000000100000001800B81000000000000FFFFFFFF00010000000000000001000000000000000100000001800C81000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF0000000000000000000100000000000000010000000180F088000000000000FFFFFFFF0001000000000000000100000000000000010000000180EE7F000000000000FFFFFFFF000100000000000000010000000000000001000000018024E1000000000000FFFFFFFF00010000000000000001000000000000000100000001800A81000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF00000000000000000001000000000000000100000001802280000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF0000000000000000000100000000000000010000000180C488000000000000FFFFFFFF0001000000000000000100000000000000010000000180C988000000000000FFFFFFFF0001000000000000000100000000000000010000000180C788000000000000FFFFFFFF0001000000000000000100000000000000010000000180C888000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF0000000000000000000100000000000000010000000180DD88000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF0000000000000000000100000000000000010000000180FB7F000000000000FFFFFFFF000100000000000000010000000000000001000000 + + + 1423 + 2800FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000000000000000000000000000000000000000100000001000000018001E100000000000001000000000000000000000000000000000100000001000000018003E1000000000000020000000000000000000000000000000001000000010000000180CD7F0000000000000300000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018023E100000000000004000000000000000000000000000000000100000001000000018022E100000000000005000000000000000000000000000000000100000001000000018025E10000000000000600000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001802BE10000000000000700000000000000000000000000000000010000000100000001802CE10000000000000800000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001807A8A0000000000000900000000000000000000000000000000010000000100000001807B8A0000000000000A00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180D3B00000000000000B000000000000000000000000000000000100000001000000018015B10000000000000C0000000000000000000000000000000001000000010000000180F4B00000000000000D000000000000000000000000000000000100000001000000018036B10000000000000E00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FF880000000000000F0000000000000000000000000000000001000000010000000180FE880000000000001000000000000000000000000000000000010000000100000001800B810000000000001100000000000000000000000000000000010000000100000001800C810000000000001200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180F088000000000000130000000000000000000000000000000001000000010000000180EE7F00000000000014000000000000000000000000000000000100000001000000018024E10000000000001500000000000000000000000000000000010000000100000001800A810000000000001600000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018022800000000000001700000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180C488000000000000180000000000000000000000000000000001000000010000000180C988000000000000190000000000000000000000000000000001000000010000000180C7880000000000001A0000000000000000000000000000000001000000010000000180C8880000000000001B00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180DD880000000000001C00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FB7F0000000000001D000000000000000000000000000000000100000001000000 + + + + 59399 + Build + + 678 + 00200000010000001000FFFF01001100434D4643546F6F6C426172427574746F6ECF7F0000000000001C0000000000000000000000000000000001000000010000000180D07F0000000000001D000000000000000000000000000000000100000001000000018030800000000000001E00000000000000000000000000000000010000000100000001809E8A0000000000001F0000000000000000000000000000000001000000010000000180D17F0000000004002000000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001804C8A0000000000002100000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000FFFF01001900434D4643546F6F6C426172436F6D626F426F78427574746F6EBA000000000000000000000000000000000000000000000000010000000100000096000000030020500000000008657874695465737496000000000000000100086578746954657374000000000180EB880000000000002200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180C07F000000000000230000000000000000000000000000000001000000010000000180B08A000000000400240000000000000000000000000000000001000000010000000180A8010000000000004E00000000000000000000000000000000010000000100000001807202000000000000530000000000000000000000000000000001000000010000000180BE010000000000005000000000000000000000000000000000010000000100000000000000054275696C64CF010000 + + + 583 + 1000FFFF01001100434D4643546F6F6C426172427574746F6ECF7F000000000000FFFFFFFF0001000000000000000100000000000000010000000180D07F000000000000FFFFFFFF00010000000000000001000000000000000100000001803080000000000000FFFFFFFF00010000000000000001000000000000000100000001809E8A000000000000FFFFFFFF0001000000000000000100000000000000010000000180D17F000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF00000000000000000001000000000000000100000001804C8A000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF00000000000000000001000000000000000100000001806680000000000000FFFFFFFF0001000000000000000100000000000000010000000180EB88000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF0000000000000000000100000000000000010000000180C07F000000000000FFFFFFFF0001000000000000000100000000000000010000000180B08A000000000000FFFFFFFF0001000000000000000100000000000000010000000180A801000000000000FFFFFFFF00010000000000000001000000000000000100000001807202000000000000FFFFFFFF0001000000000000000100000000000000010000000180BE01000000000000FFFFFFFF000100000000000000010000000000000001000000 + + + 583 + 1000FFFF01001100434D4643546F6F6C426172427574746F6ECF7F000000000000000000000000000000000000000000000001000000010000000180D07F00000000000001000000000000000000000000000000000100000001000000018030800000000000000200000000000000000000000000000000010000000100000001809E8A000000000000030000000000000000000000000000000001000000010000000180D17F0000000000000400000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001804C8A0000000000000500000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001806680000000000000060000000000000000000000000000000001000000010000000180EB880000000000000700000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180C07F000000000000080000000000000000000000000000000001000000010000000180B08A000000000000090000000000000000000000000000000001000000010000000180A8010000000000000A000000000000000000000000000000000100000001000000018072020000000000000B0000000000000000000000000000000001000000010000000180BE010000000000000C000000000000000000000000000000000100000001000000 + + + + 59400 + Debug + + 2220 + 00200000000000001900FFFF01001100434D4643546F6F6C426172427574746F6ECC880000000000002500000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018017800000000000002600000000000000000000000000000000010000000100000001801D800000000000002700000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001801A800000000000002800000000000000000000000000000000010000000100000001801B80000000000000290000000000000000000000000000000001000000010000000180E57F0000000000002A00000000000000000000000000000000010000000100000001801C800000000000002B00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018000890000000000002C00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180E48B0000000000002D0000000000000000000000000000000001000000010000000180F07F0000000000002E0000000000000000000000000000000001000000010000000180E8880000000000003700000000000000000000000000000000010000000100000001803B010000000000002F0000000000000000000000000000000001000000010000000180BB8A00000000000030000000000000000000000000000000000100000001000000FFFF01001500434D4643546F6F6C4261724D656E75427574746F6E0E01000000000000310000000D57617463682057696E646F7773000000000000000000000000010000000100000000000000000000000100000002001380D88B000000000000310000000757617463682031000000000000000000000000010000000100000000000000000000000100000000001380D98B0000000000003100000007576174636820320000000000000000000000000100000001000000000000000000000001000000000013800F01000000000000320000000E4D656D6F72792057696E646F7773000000000000000000000000010000000100000000000000000000000100000004001380D28B00000000000032000000084D656D6F72792031000000000000000000000000010000000100000000000000000000000100000000001380D38B00000000000032000000084D656D6F72792032000000000000000000000000010000000100000000000000000000000100000000001380D48B00000000000032000000084D656D6F72792033000000000000000000000000010000000100000000000000000000000100000000001380D58B00000000000032000000084D656D6F727920340000000000000000000000000100000001000000000000000000000001000000000013801001000000000000330000000E53657269616C2057696E646F77730000000000000000000000000100000001000000000000000000000001000000040013809307000000000000330000000755415254202331000000000000000000000000010000000100000000000000000000000100000000001380940700000000000033000000075541525420233200000000000000000000000001000000010000000000000000000000010000000000138095070000000000003300000007554152542023330000000000000000000000000100000001000000000000000000000001000000000013809607000000000000330000000E49544D2F525441205669657765720000000000000000000000000100000001000000000000000000000001000000000013803C010000000000003400000010416E616C797369732057696E646F7773000000000000000000000000010000000100000000000000000000000100000003001380658A000000000000340000000E4C6F67696320416E616C797A6572000000000000000000000000010000000100000000000000000000000100000000001380DC7F0000000000003E00000014506572666F726D616E636520416E616C797A6572000000000000000000000000010000000100000000000000000000000100000000001380E788000000000000380000000D436F646520436F76657261676500000000000000000000000001000000010000000000000000000000010000000000138053010000000000003F0000000D54726163652057696E646F77730000000000000000000000000100000001000000000000000000000001000000010013805401000000000000FFFFFFFF115472616365204D656E7520416E63686F720000000000000000010000000000000001000000000000000000000001000000000013802901000000000000350000001553797374656D205669657765722057696E646F77730000000000000000000000000100000001000000000000000000000001000000010013804B01000000000000FFFFFFFF1453797374656D2056696577657220416E63686F720000000000000000010000000000000001000000000000000000000001000000000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000138001890000000000003600000007546F6F6C626F7800000000000000000000000001000000010000000000000000000000010000000300138044C5000000000000FFFFFFFF0E5570646174652057696E646F77730000000000000000010000000000000001000000000000000000000001000000000013800000000000000400FFFFFFFF000000000000000000010000000000000001000000000000000000000001000000000013805B01000000000000FFFFFFFF12546F6F6C626F78204D656E75416E63686F72000000000000000001000000000000000100000000000000000000000100000000000000000005446562756764020000 + + + 898 + 1900FFFF01001100434D4643546F6F6C426172427574746F6ECC88000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF00000000000000000001000000000000000100000001801780000000000000FFFFFFFF00010000000000000001000000000000000100000001801D80000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF00000000000000000001000000000000000100000001801A80000000000000FFFFFFFF00010000000000000001000000000000000100000001801B80000000000000FFFFFFFF0001000000000000000100000000000000010000000180E57F000000000000FFFFFFFF00010000000000000001000000000000000100000001801C80000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF00000000000000000001000000000000000100000001800089000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF0000000000000000000100000000000000010000000180E48B000000000000FFFFFFFF0001000000000000000100000000000000010000000180F07F000000000000FFFFFFFF0001000000000000000100000000000000010000000180E888000000000000FFFFFFFF00010000000000000001000000000000000100000001803B01000000000000FFFFFFFF0001000000000000000100000000000000010000000180BB8A000000000000FFFFFFFF0001000000000000000100000000000000010000000180D88B000000000000FFFFFFFF0001000000000000000100000000000000010000000180D28B000000000000FFFFFFFF00010000000000000001000000000000000100000001809307000000000000FFFFFFFF0001000000000000000100000000000000010000000180658A000000000000FFFFFFFF0001000000000000000100000000000000010000000180C18A000000000000FFFFFFFF0001000000000000000100000000000000010000000180EE8B000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF00000000000000000001000000000000000100000001800189000000000000FFFFFFFF000100000000000000010000000000000001000000 + + + 898 + 1900FFFF01001100434D4643546F6F6C426172427574746F6ECC880000000000000000000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018017800000000000000100000000000000000000000000000000010000000100000001801D800000000000000200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001801A800000000000000300000000000000000000000000000000010000000100000001801B80000000000000040000000000000000000000000000000001000000010000000180E57F0000000000000500000000000000000000000000000000010000000100000001801C800000000000000600000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018000890000000000000700000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180E48B000000000000080000000000000000000000000000000001000000010000000180F07F000000000000090000000000000000000000000000000001000000010000000180E8880000000000000A00000000000000000000000000000000010000000100000001803B010000000000000B0000000000000000000000000000000001000000010000000180BB8A0000000000000C0000000000000000000000000000000001000000010000000180D88B0000000000000D0000000000000000000000000000000001000000010000000180D28B0000000000000E000000000000000000000000000000000100000001000000018093070000000000000F0000000000000000000000000000000001000000010000000180658A000000000000100000000000000000000000000000000001000000010000000180C18A000000000000110000000000000000000000000000000001000000010000000180EE8B0000000000001200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180018900000000000013000000000000000000000000000000000100000001000000 + + + + 0 + 1920 + 1080 + + + + + + 1 + 0 + + 100 + 0 + + ..\src\main.c + 5 + 61 + 82 + 1 + + 0 + + + + +
diff --git a/examples/extiTest/mdk/extiTest.uvoptx b/examples/extiTest/mdk/extiTest.uvoptx new file mode 100644 index 0000000..f49f1f3 --- /dev/null +++ b/examples/extiTest/mdk/extiTest.uvoptx @@ -0,0 +1,328 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + extiTest + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 6 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC5000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + DLGUARM + (106=-1,-1,-1,-1,0)(107=-1,-1,-1,-1,0) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 0 + 1 + gBleSleep + + + + + 1 + 10 + 0x20005000 + 0 + + + + + 2 + 1 + 0x50000000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 1 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 1 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 1 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 4 + 5 + 0 + 1 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 5 + 4 + 0 + 1 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 4 + 6 + 1 + 0 + 1 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/examples/extiTest/mdk/extiTest.uvprojx b/examples/extiTest/mdk/extiTest.uvprojx new file mode 100644 index 0000000..e8e1024 --- /dev/null +++ b/examples/extiTest/mdk/extiTest.uvprojx @@ -0,0 +1,465 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + extiTest + 0x4 + ARM-ADS + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + extiTest + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + + + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + + 0 + 6 + + + + + + + + + + + + + + Segger\JL2CM3.dll + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20003000 + 0x5000 + + + 1 + 0x0 + 0x1000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 0 + 1 + 1 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\mdk;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + +
diff --git a/examples/extiTest/mdk/output/debug.crf b/examples/extiTest/mdk/output/debug.crf new file mode 100644 index 0000000..0740a44 Binary files /dev/null and b/examples/extiTest/mdk/output/debug.crf differ diff --git a/examples/extiTest/mdk/output/debug.d b/examples/extiTest/mdk/output/debug.d new file mode 100644 index 0000000..91d3c80 --- /dev/null +++ b/examples/extiTest/mdk/output/debug.d @@ -0,0 +1,12 @@ +.\output\debug.o: ..\..\..\modules\src\debug.c +.\output\debug.o: ..\src\cfg.h +.\output\debug.o: ..\..\..\modules\api\dbg.h +.\output\debug.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h +.\output\debug.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h +.\output\debug.o: ..\..\..\drivers\api\uart.h +.\output\debug.o: ..\..\..\drivers\api\rcc.h +.\output\debug.o: ..\..\..\core\reg\reg_rcc.h +.\output\debug.o: ..\..\..\core\reg\reg_base.h +.\output\debug.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stddef.h +.\output\debug.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h +.\output\debug.o: ..\..\..\core\reg\reg_uart.h diff --git a/examples/extiTest/mdk/output/debug.o b/examples/extiTest/mdk/output/debug.o new file mode 100644 index 0000000..bb642f3 Binary files /dev/null and b/examples/extiTest/mdk/output/debug.o differ diff --git a/examples/extiTest/mdk/output/extiTest.axf b/examples/extiTest/mdk/output/extiTest.axf new file mode 100644 index 0000000..869f1ba Binary files /dev/null and b/examples/extiTest/mdk/output/extiTest.axf differ diff --git a/examples/extiTest/mdk/output/extiTest.bin b/examples/extiTest/mdk/output/extiTest.bin new file mode 100644 index 0000000..c9670d2 Binary files /dev/null and b/examples/extiTest/mdk/output/extiTest.bin differ diff --git a/examples/extiTest/mdk/output/extiTest.build_log.htm b/examples/extiTest/mdk/output/extiTest.build_log.htm new file mode 100644 index 0000000..43ed541 --- /dev/null +++ b/examples/extiTest/mdk/output/extiTest.build_log.htm @@ -0,0 +1,43 @@ + + +
+

Vision Build Log

+

Tool Versions:

+IDE-Version: Vision V5.15 +Copyright (C) 2015 ARM Ltd and ARM Germany GmbH. All rights reserved. +License Information: 1 Administrator, 1, LIC=9N0X7-E849S-C02N2-9LSNA-DAAN9-S9DGQ + +Tool Versions: +Toolchain: MDK-ARM Professional Version: 5.15.0 +Toolchain Path: C:\Keil_v5\ARM\ARMCC\Bin +C Compiler: Armcc.exe V5.05 update 2 (build 169) +Assembler: Armasm.exe V5.05 update 2 (build 169) +Linker/Locator: ArmLink.exe V5.05 update 2 (build 169) +Library Manager: ArmAr.exe V5.05 update 2 (build 169) +Hex Converter: FromElf.exe V5.05 update 2 (build 169) +CPU DLL: SARMCM3.DLL V5.15.0 +Dialog DLL: DARMCM1.DLL V1.12.0.0 +Target DLL: Segger\JL2CM3.dll V2.99.15.0 +Dialog DLL: TARMCM1.DLL V1.9.0.0 + +

Project:

+C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\examples\extiTest\mdk\extiTest.uvprojx +Project File Date: 03/29/2024 + +

Output:

+*** Using Compiler 'V5.05 update 2 (build 169)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin' +Build target 'extiTest' +compiling main.c... +linking... +Program Size: Code=1904 RO-data=184 RW-data=4 ZI-data=1692 +FromELF: creating hex file... +After Build - User command #1: fromelf.exe --bin -o "C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\examples\extiTest\mdk\output\extiTest.bin" "C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\examples\extiTest\mdk\output\extiTest.axf" +".\output\extiTest.axf" - 0 Error(s), 0 Warning(s). + +

Collection of Component include folders:

+ C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\examples\extiTest\mdk\RTE + +

Collection of Component Files used:

+
+ + diff --git a/examples/extiTest/mdk/output/extiTest.hex b/examples/extiTest/mdk/output/extiTest.hex new file mode 100644 index 0000000..8e56ed7 --- /dev/null +++ b/examples/extiTest/mdk/output/extiTest.hex @@ -0,0 +1,134 @@ +:020000041800E2 +:1040000000800020AD400018D3400018D5400018B3 +:1040100000000000000000000000000000000000A0 +:10402000000000000000000000000000D740001861 +:104030000000000000000000D9400018DB4000181C +:10404000D1410018DD400018DD400018DD400018A7 +:10405000DD400018DD400018DD400018DD4000188C +:10406000DD400018DD400018DD400018DD4000187C +:10407000DD400018DD400018DD400018DD4000186C +:10408000DD400018DD400018DD400018DD4000185C +:10409000DD400018DD4000180348854600F064F854 +:1040A000004800472D4600180080002000200C49E1 +:1040B00008600C480C49086001200C4908600C4855 +:1040C0000C4988470C480D4908600D4988470D4840 +:1040D0000047FEE7FEE7FEE7FEE7FEE7FEE700003B +:1040E0002C100040254000180C0000190000001999 +:1040F0000040001831450018944801005410034056 +:104100005546001899400018F0B51FB40646002027 +:1041100082B005464024019100901BE0019922469F +:104120000F46304600F042F8049A059B801A9941E8 +:1041300010D310461946224600F028F8361A8F414F +:104140000197224601200021009F00F01FF8381837 +:104150004D4100902046641E0028DFDC019B009842 +:104160002946324607B0F0BD064C0125064E05E053 +:10417000E36807CC2B430C3C98471034B442F7D388 +:10418000FFF78EFF084800182848001810B5202AAD +:1041900004DB0146203A9140002010BD91402023CD +:1041A0009C1A0346E3401943904010BD10B5202AE5 +:1041B00004DB0846203AD040002110BD0B46D34016 +:1041C000D0402024A21A91400843194610BD000097 +:1041D00070B50D4AD0680D4900230B7001260C4CB8 +:1041E00093142360850504D5551555610D78354325 +:1041F0000D70400506D5012080025061087802222A +:1042000010430870636070BD008002409C30002045 +:10421000000001400FB410B503A9044B044A0298F2 +:1042200000F018F810BC08BC04B018471D46001870 +:104230009830002002E008C8121F08C1002AFAD1F5 +:1042400070477047002001E001C1121F002AFBD116 +:1042500070470000FFB58FB00F460446002606E009 +:1042600025280AD0129A11999047641C761C207850 +:104270000028F5D1304613B0F0BD00250121A14A38 +:10428000009500E00543641C23780846203B9840D5 +:104290001042F7D120782E2815D1042005436078EC +:1042A000641C2A280AD101CF641C00900BE00099FD +:1042B0000A22514330394018641C0090207801468E +:1042C00030390929F3D920786C280ED004DC4C2829 +:1042D00013D06A2812D104E074280ED07A280DD1A8 +:1042E0000BE001204005054307E001210905627844 +:1042F0000D43824201D16D18641C641C20788646EF +:1043000069284AD008DC0028B4D058286DD063282A +:1043100010D0642808D140E070286BD0732812D0E8 +:10432000752860D0782860D0129A7046119990470D +:10433000761CE5E03878694608720020487202A8C9 +:104340000190012003E0386801900020C0433F1D28 +:1043500069070CD5002500E06D1C00998D420FDA2D +:104360008542F9DB0199495D0029F5D108E0002576 +:1043700000E06D1C8542FCDB0199495D0029F8D104 +:10438000761907E0019801990078491C0191129A69 +:10439000119990476D1EF5D2B2E00A2002900021DB +:1043A0006802400F039102280CD001CFC117844648 +:1043B00000290DDA624608465242002181419446A6 +:1043C0002D2008E0FF1DFF08FF0003CF8446EFE724 +:1043D000280504D52B206A46107401203CE0E8072C +:1043E0003AD02020F7E70A2000E0102000210391B6 +:1043F000029007E0102002900021042005430820CD +:10440000039100906802400F022810D001CF0021D4 +:10441000844600200D9028071FD5704670280CD0C8 +:10442000029A1020039B42401A430CD015E0FF1D56 +:10443000FF08FF0003CF8446EBE740206A46107474 +:1044400001200D900CE06046084306D030206A46FB +:1044500010747046507402200D907046582804D095 +:1044600029A001900DA80E900DE02CA0F9E7604660 +:10447000039B029AFFF748FE019B84469B5C0E9AC1 +:10448000521E0E92137060460843F0D10E9805A993 +:10449000081A20300190680701D5009801E001203A +:1044A00000900199884203DD01460198081A00E056 +:1044B00000200025009006E004A8129A405D1199A2 +:1044C00090476D1C761C0D988542F5DB04E0129A2E +:1044D000302011999047761C0099481E00900029C1 +:1044E000F5DC08E00E980E990078491C0E91129A9E +:1044F00011999047761C0199481E01900029F1DC22 +:10450000641CB4E6092801003031323334353637C3 +:10451000383961626364656600000000303132330F +:1045200034353637383941424344454600000000AF +:1045300010B5084B00218A008458D2181460491C19 +:104540002629F8D3BFF35F8F03488360BFF34F8FF3 +:1045500010BD00000030002000ED00E010B5072283 +:104560000621002000F00EF903228B21002000F02C +:10457000F1F810BD01241449200348600862FF20AF +:10458000124981300860091D0860114800F02CF8BC +:1045900003256D022946072000F038F829460A2035 +:1045A00000F034F82946002000F030F809480025D2 +:1045B000046062B6084C20780028FCD0217807A05F +:1045C000FFF728FE2570F6E7000001402421004097 +:1045D000040F000000E100E09C3000205472696785 +:1045E0003A2025580D0A000001218907CB6A8A1557 +:1045F0001343CB624B6A13434B624B6A93434B6248 +:104600000149C8627047000000800240024A8000F1 +:1046100080180160704700000080024010B5044619 +:10462000C1B2002000F0E6F8204610BD0449002089 +:104630008847FFF793FF03A0FFF7ECFDFFF79AFF12 +:10464000D10800004558544920546573742E2E2E0D +:104650000D0A0000F0B5364C87B0A06881B235482D +:104660000818A060354D3448E8633549102088604B +:10467000344FB8693449884257D16E46002001A9A9 +:104680008200D3191B68401CB3500628F8D3086970 +:104690000A22431C002B25D01346834322D1A36852 +:1046A0001F263605C005C00EB34300050343A360B3 +:1046B000E86B0B8A400940019B04DB0E1843E8635A +:1046C000A0680E690F231B04B603360F9843360407 +:1046D0003043A060E86B98430B699B021B0F1B04DF +:1046E0001843E863C868194B441C05D0144684433A +:1046F00002D18005800E18610868441C08D08243EE +:1047000006D15A69800592099201800E02435A61CE +:104710008868411C09D0002807D00D4BD9697C223C +:10472000800A914310400143D96107B0F0BD0000F9 +:10473000000003400000B1011403740000100340A6 +:1047400000100040000F0018B6D5F5C84010034017 +:1047500040C002400A4B000310B5C0180023C360DC +:10476000C36880242343C3608160C168A143C160E2 +:10477000C16907231943C16120210A43C26010BDEA +:104780000030024030B5FF24174B82349500ED18FD +:104790002C60A1248900CB181C6043008024134D99 +:1047A000234349190B60114621430F4CC300803C41 +:1047B0001B195960E105CC6A0123C01C83401C43CE +:1047C000CC62486A18434862486A984348620920A4 +:1047D000074B03E05969D140C90704D10146401E87 +:1047E000C0B20029F6D130BD0021004000200040B9 +:1047F00000000140034A00038018026A9206FCD5BB +:10480000416070470030024028480018983000206E +:1048100004000000344200182C4800189C3000208E +:0C482000040000004442001800000000EA +:040000051800409906 +:00000001FF diff --git a/examples/extiTest/mdk/output/extiTest.lnp b/examples/extiTest/mdk/output/extiTest.lnp new file mode 100644 index 0000000..055cf33 --- /dev/null +++ b/examples/extiTest/mdk/output/extiTest.lnp @@ -0,0 +1,9 @@ +--cpu Cortex-M0 +".\output\startup.o" +".\output\main.o" +"..\..\..\drivers\lib\drvs.lib" +".\output\debug.o" +--library_type=microlib --strict --scatter "..\..\..\core\mdk\link_xip.sct" +--diag_suppress=L6312,L6314,L6329 --summary_stderr --info summarysizes --map --symbols +--info sizes --info totals +--list ".\output\extiTest.map" -o .\output\extiTest.axf \ No newline at end of file diff --git a/examples/extiTest/mdk/output/extiTest.map b/examples/extiTest/mdk/output/extiTest.map new file mode 100644 index 0000000..f6b5dd6 --- /dev/null +++ b/examples/extiTest/mdk/output/extiTest.map @@ -0,0 +1,368 @@ +Component: ARM Compiler 5.05 update 2 (build 169) Tool: armlink [4d0f33] + +============================================================================== + +Image Symbol Table + + Local Symbols + + Symbol Name Value Ov Type Size Object(Section) + + ../clib/microlib/division.c 0x00000000 Number 0 uidiv.o ABSOLUTE + ../clib/microlib/division.c 0x00000000 Number 0 uldiv.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry10a.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry10b.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry2.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry8a.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry7b.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry9b.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry7a.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry8b.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry11b.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry9a.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry11a.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry5.o ABSOLUTE + ../clib/microlib/longlong.c 0x00000000 Number 0 llshl.o ABSOLUTE + ../clib/microlib/longlong.c 0x00000000 Number 0 llushr.o ABSOLUTE + ../clib/microlib/longlong.c 0x00000000 Number 0 llsshr.o ABSOLUTE + ../clib/microlib/printf/printf.c 0x00000000 Number 0 printf2.o ABSOLUTE + ../clib/microlib/printf/printf.c 0x00000000 Number 0 printf4.o ABSOLUTE + ../clib/microlib/printf/printf.c 0x00000000 Number 0 printfa.o ABSOLUTE + ../clib/microlib/printf/printf.c 0x00000000 Number 0 printf5.o ABSOLUTE + ../clib/microlib/printf/printf.c 0x00000000 Number 0 printf8.o ABSOLUTE + ../clib/microlib/printf/printf.c 0x00000000 Number 0 printf7.o ABSOLUTE + ../clib/microlib/printf/printf.c 0x00000000 Number 0 printf6.o ABSOLUTE + ../clib/microlib/printf/printf.c 0x00000000 Number 0 printf3.o ABSOLUTE + ../clib/microlib/printf/printf.c 0x00000000 Number 0 printfb.o ABSOLUTE + ../clib/microlib/printf/printf.c 0x00000000 Number 0 printf0.o ABSOLUTE + ../clib/microlib/printf/printf.c 0x00000000 Number 0 printf1.o ABSOLUTE + ../clib/microlib/printf/stubs.s 0x00000000 Number 0 stubs.o ABSOLUTE + ../clib/microlib/stdio/streams.c 0x00000000 Number 0 stdout.o ABSOLUTE + ../clib/microlib/stubs.s 0x00000000 Number 0 iusefp.o ABSOLUTE + ../fplib/microlib/fpadd.c 0x00000000 Number 0 dadd.o ABSOLUTE + ../fplib/microlib/fpdiv.c 0x00000000 Number 0 ddiv.o ABSOLUTE + ../fplib/microlib/fpepilogue.c 0x00000000 Number 0 depilogue.o ABSOLUTE + ../fplib/microlib/fpfix.c 0x00000000 Number 0 dfixul.o ABSOLUTE + ../fplib/microlib/fpmul.c 0x00000000 Number 0 dmul.o ABSOLUTE + ..\..\..\core\mdk\startup.s 0x00000000 Number 0 startup.o ABSOLUTE + ..\..\..\modules\src\debug.c 0x00000000 Number 0 debug.o ABSOLUTE + ..\\src\\main.c 0x00000000 Number 0 main.o ABSOLUTE + ..\src\core.c 0x00000000 Number 0 core.o ABSOLUTE + ..\src\exti.c 0x00000000 Number 0 exti.o ABSOLUTE + ..\src\main.c 0x00000000 Number 0 main.o ABSOLUTE + ..\src\trim.c 0x00000000 Number 0 trim.o ABSOLUTE + ..\src\uart.c 0x00000000 Number 0 uart.o ABSOLUTE + cdrcmple.s 0x00000000 Number 0 cdrcmple.o ABSOLUTE + dc.s 0x00000000 Number 0 dc.o ABSOLUTE + handlers.s 0x00000000 Number 0 handlers.o ABSOLUTE + init.s 0x00000000 Number 0 init.o ABSOLUTE + RESET 0x18004000 Section 152 startup.o(RESET) + .ARM.Collect$$$$00000000 0x18004098 Section 0 entry.o(.ARM.Collect$$$$00000000) + .ARM.Collect$$$$00000001 0x18004098 Section 4 entry2.o(.ARM.Collect$$$$00000001) + .ARM.Collect$$$$00000004 0x1800409c Section 4 entry5.o(.ARM.Collect$$$$00000004) + .ARM.Collect$$$$00000008 0x180040a0 Section 0 entry7b.o(.ARM.Collect$$$$00000008) + .ARM.Collect$$$$0000000A 0x180040a0 Section 0 entry8b.o(.ARM.Collect$$$$0000000A) + .ARM.Collect$$$$0000000B 0x180040a0 Section 8 entry9a.o(.ARM.Collect$$$$0000000B) + .ARM.Collect$$$$0000000D 0x180040a8 Section 0 entry10a.o(.ARM.Collect$$$$0000000D) + .ARM.Collect$$$$0000000F 0x180040a8 Section 0 entry11a.o(.ARM.Collect$$$$0000000F) + .ARM.Collect$$$$00002712 0x180040a8 Section 4 entry2.o(.ARM.Collect$$$$00002712) + __lit__00000000 0x180040a8 Data 4 entry2.o(.ARM.Collect$$$$00002712) + .INT 0x180040ac Section 92 startup.o(.INT) + .text 0x18004108 Section 0 uldiv.o(.text) + .text 0x18004168 Section 36 init.o(.text) + .text 0x1800418c Section 0 llshl.o(.text) + .text 0x180041ac Section 0 llushr.o(.text) + i.EXTI_IRQHandler 0x180041d0 Section 0 main.o(i.EXTI_IRQHandler) + i.__0printf$5 0x18004214 Section 0 printf5.o(i.__0printf$5) + i.__scatterload_copy 0x18004234 Section 14 handlers.o(i.__scatterload_copy) + i.__scatterload_null 0x18004242 Section 2 handlers.o(i.__scatterload_null) + i.__scatterload_zeroinit 0x18004244 Section 14 handlers.o(i.__scatterload_zeroinit) + i._printf_core 0x18004254 Section 0 printf5.o(i._printf_core) + _printf_core 0x18004255 Thumb Code 688 printf5.o(i._printf_core) + i.core_vector 0x18004530 Section 0 core.o(i.core_vector) + i.dbgInit 0x1800455c Section 0 debug.o(i.dbgInit) + i.extiTest 0x18004574 Section 0 main.o(i.extiTest) + extiTest 0x18004575 Thumb Code 84 main.o(i.extiTest) + i.exti_init 0x180045e8 Section 0 exti.o(i.exti_init) + i.exti_set 0x1800460c Section 0 exti.o(i.exti_set) + i.fputc 0x1800461c Section 0 debug.o(i.fputc) + i.main 0x1800462c Section 0 main.o(i.main) + i.trim_load 0x18004654 Section 0 trim.o(i.trim_load) + i.uart_conf 0x18004754 Section 0 uart.o(i.uart_conf) + i.uart_init 0x18004784 Section 0 uart.o(i.uart_init) + i.uart_putc 0x180047f4 Section 0 uart.o(i.uart_putc) + .data 0x20003098 Section 4 stdout.o(.data) + .bss 0x2000309c Section 1 main.o(.bss) + STACK 0x20007a00 Section 1536 startup.o(STACK) + + Global Symbols + + Symbol Name Value Ov Type Size Object(Section) + + BuildAttributes$$THM_ISAv3M$S$PE$A:L22$X:L11$S22$IEEE1$IW$USESV6$~STKCKD$USESV7$~SHL$OSPACE$ROPI$EBA8$MICROLIB$REQ8$PRES8$EABIv2 0x00000000 Number 0 anon$$obj.o ABSOLUTE + __ARM_use_no_argv 0x00000000 Number 0 main.o ABSOLUTE + _printf_a 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_c 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_charcount 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_d 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_e 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_f 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_flags 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_fp_dec 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_fp_hex 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_g 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_i 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_int_dec 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_l 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_lc 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_ll 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_lld 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_lli 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_llo 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_llu 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_llx 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_longlong_dec 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_longlong_hex 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_longlong_oct 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_ls 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_mbtowc 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_n 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_o 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_p 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_percent 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_pre_padding 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_return_value 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_s 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_sizespec 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_str 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_truncate_signed 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_truncate_unsigned 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_u 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_wc 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_wctomb 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_widthprec 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_x 0x00000000 Number 0 stubs.o ABSOLUTE + __cpp_initialize__aeabi_ - Undefined Weak Reference + __cxa_finalize - Undefined Weak Reference + __decompress - Undefined Weak Reference + _clock_init - Undefined Weak Reference + _microlib_exit - Undefined Weak Reference + __Vectors 0x18004000 Data 4 startup.o(RESET) + __main 0x18004099 Thumb Code 0 entry.o(.ARM.Collect$$$$00000000) + _main_stk 0x18004099 Thumb Code 0 entry2.o(.ARM.Collect$$$$00000001) + _main_scatterload 0x1800409d Thumb Code 0 entry5.o(.ARM.Collect$$$$00000004) + __main_after_scatterload 0x180040a1 Thumb Code 0 entry5.o(.ARM.Collect$$$$00000004) + _main_clock 0x180040a1 Thumb Code 0 entry7b.o(.ARM.Collect$$$$00000008) + _main_cpp_init 0x180040a1 Thumb Code 0 entry8b.o(.ARM.Collect$$$$0000000A) + _main_init 0x180040a1 Thumb Code 0 entry9a.o(.ARM.Collect$$$$0000000B) + __rt_final_cpp 0x180040a9 Thumb Code 0 entry10a.o(.ARM.Collect$$$$0000000D) + __rt_final_exit 0x180040a9 Thumb Code 0 entry11a.o(.ARM.Collect$$$$0000000F) + Reset_Handler 0x180040ad Thumb Code 38 startup.o(.INT) + NMI_Handler 0x180040d3 Thumb Code 2 startup.o(.INT) + HardFault_Handler 0x180040d5 Thumb Code 2 startup.o(.INT) + SVCall_Handler 0x180040d7 Thumb Code 2 startup.o(.INT) + PendSV_Handler 0x180040d9 Thumb Code 2 startup.o(.INT) + SysTick_Handler 0x180040db Thumb Code 2 startup.o(.INT) + AON_PMU_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + ATMR_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + BB_LP_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + BLE_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + BOD12_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + BTMR_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + CTMR_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + DMAC_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + FSHC_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + I2C_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + IWDT_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + LVD33_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + MDM_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + RF_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + RTC_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + SPIM_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + SPIS_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + UART1_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + UART2_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + USB_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + USB_SOF_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + __aeabi_uldivmod 0x18004109 Thumb Code 96 uldiv.o(.text) + __scatterload 0x18004169 Thumb Code 28 init.o(.text) + __scatterload_rt2 0x18004169 Thumb Code 0 init.o(.text) + __aeabi_llsl 0x1800418d Thumb Code 32 llshl.o(.text) + _ll_shift_l 0x1800418d Thumb Code 0 llshl.o(.text) + __aeabi_llsr 0x180041ad Thumb Code 34 llushr.o(.text) + _ll_ushift_r 0x180041ad Thumb Code 0 llushr.o(.text) + EXTI_IRQHandler 0x180041d1 Thumb Code 56 main.o(i.EXTI_IRQHandler) + __0printf$5 0x18004215 Thumb Code 24 printf5.o(i.__0printf$5) + __1printf$5 0x18004215 Thumb Code 0 printf5.o(i.__0printf$5) + __2printf 0x18004215 Thumb Code 0 printf5.o(i.__0printf$5) + __scatterload_copy 0x18004235 Thumb Code 14 handlers.o(i.__scatterload_copy) + __scatterload_null 0x18004243 Thumb Code 2 handlers.o(i.__scatterload_null) + __scatterload_zeroinit 0x18004245 Thumb Code 14 handlers.o(i.__scatterload_zeroinit) + core_vector 0x18004531 Thumb Code 34 core.o(i.core_vector) + dbgInit 0x1800455d Thumb Code 24 debug.o(i.dbgInit) + exti_init 0x180045e9 Thumb Code 30 exti.o(i.exti_init) + exti_set 0x1800460d Thumb Code 10 exti.o(i.exti_set) + fputc 0x1800461d Thumb Code 16 debug.o(i.fputc) + main 0x1800462d Thumb Code 20 main.o(i.main) + trim_load 0x18004655 Thumb Code 218 trim.o(i.trim_load) + uart_conf 0x18004755 Thumb Code 44 uart.o(i.uart_conf) + uart_init 0x18004785 Thumb Code 100 uart.o(i.uart_init) + uart_putc 0x180047f5 Thumb Code 16 uart.o(i.uart_putc) + Region$$Table$$Base 0x18004808 Number 0 anon$$obj.o(Region$$Table) + Region$$Table$$Limit 0x18004828 Number 0 anon$$obj.o(Region$$Table) + __stdout 0x20003098 Data 4 stdout.o(.data) + gExtiIrqFlag 0x2000309c Data 1 main.o(.bss) + __initial_sp 0x20008000 Data 0 startup.o(STACK) + + + +============================================================================== + +Memory Map of the image + + Image Entry point : 0x18004099 + + Load Region LR_IROM1 (Base: 0x18004000, Size: 0x0000082c, Max: 0x0001c000, ABSOLUTE) + + Execution Region ER_IROM1 (Base: 0x18004000, Size: 0x00000828, Max: 0x0001c000, ABSOLUTE) + + Base Addr Size Type Attr Idx E Section Name Object + + 0x18004000 0x00000098 Data RO 4 RESET startup.o + 0x18004098 0x00000000 Code RO 262 * .ARM.Collect$$$$00000000 mc_p.l(entry.o) + 0x18004098 0x00000004 Code RO 526 .ARM.Collect$$$$00000001 mc_p.l(entry2.o) + 0x1800409c 0x00000004 Code RO 529 .ARM.Collect$$$$00000004 mc_p.l(entry5.o) + 0x180040a0 0x00000000 Code RO 531 .ARM.Collect$$$$00000008 mc_p.l(entry7b.o) + 0x180040a0 0x00000000 Code RO 533 .ARM.Collect$$$$0000000A mc_p.l(entry8b.o) + 0x180040a0 0x00000008 Code RO 534 .ARM.Collect$$$$0000000B mc_p.l(entry9a.o) + 0x180040a8 0x00000000 Code RO 536 .ARM.Collect$$$$0000000D mc_p.l(entry10a.o) + 0x180040a8 0x00000000 Code RO 538 .ARM.Collect$$$$0000000F mc_p.l(entry11a.o) + 0x180040a8 0x00000004 Code RO 527 .ARM.Collect$$$$00002712 mc_p.l(entry2.o) + 0x180040ac 0x0000005c Code RO 5 .INT startup.o + 0x18004108 0x00000060 Code RO 543 .text mc_p.l(uldiv.o) + 0x18004168 0x00000024 Code RO 556 .text mc_p.l(init.o) + 0x1800418c 0x00000020 Code RO 558 .text mc_p.l(llshl.o) + 0x180041ac 0x00000022 Code RO 560 .text mc_p.l(llushr.o) + 0x180041ce 0x00000002 PAD + 0x180041d0 0x00000044 Code RO 13 i.EXTI_IRQHandler main.o + 0x18004214 0x00000020 Code RO 398 i.__0printf$5 mc_p.l(printf5.o) + 0x18004234 0x0000000e Code RO 570 i.__scatterload_copy mc_p.l(handlers.o) + 0x18004242 0x00000002 Code RO 571 i.__scatterload_null mc_p.l(handlers.o) + 0x18004244 0x0000000e Code RO 572 i.__scatterload_zeroinit mc_p.l(handlers.o) + 0x18004252 0x00000002 PAD + 0x18004254 0x000002dc Code RO 405 i._printf_core mc_p.l(printf5.o) + 0x18004530 0x0000002c Code RO 210 i.core_vector drvs.lib(core.o) + 0x1800455c 0x00000018 Code RO 171 i.dbgInit debug.o + 0x18004574 0x00000074 Code RO 14 i.extiTest main.o + 0x180045e8 0x00000024 Code RO 233 i.exti_init drvs.lib(exti.o) + 0x1800460c 0x00000010 Code RO 234 i.exti_set drvs.lib(exti.o) + 0x1800461c 0x00000010 Code RO 172 i.fputc debug.o + 0x1800462c 0x00000028 Code RO 15 i.main main.o + 0x18004654 0x00000100 Code RO 258 i.trim_load drvs.lib(trim.o) + 0x18004754 0x00000030 Code RO 238 i.uart_conf drvs.lib(uart.o) + 0x18004784 0x00000070 Code RO 242 i.uart_init drvs.lib(uart.o) + 0x180047f4 0x00000014 Code RO 244 i.uart_putc drvs.lib(uart.o) + 0x18004808 0x00000020 Data RO 568 Region$$Table anon$$obj.o + + + Execution Region RW_IRAM_VECT (Base: 0x20003000, Size: 0x00000098, Max: 0x00000098, ABSOLUTE) + + Base Addr Size Type Attr Idx E Section Name Object + + 0x20003000 0x00000098 Zero RW 1 RW_IRAM_VECT.bss anon$$obj.o + + + Execution Region RW_IRAM_USER (Base: 0x20003098, Size: 0x00000008, Max: 0xffffffff, ABSOLUTE) + + Base Addr Size Type Attr Idx E Section Name Object + + 0x20003098 0x00000004 Data RW 540 .data mc_p.l(stdout.o) + 0x2000309c 0x00000001 Zero RW 16 .bss main.o + + + Execution Region RW_IRAM_STACK (Base: 0x20007a00, Size: 0x00000600, Max: 0x00000600, ABSOLUTE, UNINIT) + + Base Addr Size Type Attr Idx E Section Name Object + + 0x20007a00 0x00000600 Zero RW 2 STACK startup.o + + + Execution Region RW_IRAM_RETN (Base: 0x20008000, Size: 0x00000000, Max: 0x00002000, ABSOLUTE, UNINIT) + + **** No section assigned to this execution region **** + + +============================================================================== + +Image component sizes + + + Code (inc. data) RO Data RW Data ZI Data Debug Object Name + + 40 0 0 0 0 2846 debug.o + 224 64 0 0 1 16528 main.o + 92 42 152 0 1536 692 startup.o + + ---------------------------------------------------------------------- + 356 106 184 0 1692 20066 Object Totals + 0 0 32 0 152 0 (incl. Generated) + 0 0 0 0 3 0 (incl. Padding) + + ---------------------------------------------------------------------- + + Code (inc. data) RO Data RW Data ZI Data Debug Library Member Name + + 44 10 0 0 0 68 core.o + 52 12 0 0 0 120 exti.o + 256 38 0 0 0 80 trim.o + 180 20 0 0 0 200 uart.o + 0 0 0 0 0 0 entry.o + 0 0 0 0 0 0 entry10a.o + 0 0 0 0 0 0 entry11a.o + 8 4 0 0 0 0 entry2.o + 4 0 0 0 0 0 entry5.o + 0 0 0 0 0 0 entry7b.o + 0 0 0 0 0 0 entry8b.o + 8 4 0 0 0 0 entry9a.o + 30 0 0 0 0 0 handlers.o + 36 8 0 0 0 68 init.o + 32 0 0 0 0 68 llshl.o + 34 0 0 0 0 68 llushr.o + 764 52 0 0 0 168 printf5.o + 0 0 0 4 0 0 stdout.o + 96 0 0 0 0 84 uldiv.o + + ---------------------------------------------------------------------- + 1548 148 0 4 0 924 Library Totals + 4 0 0 0 0 0 (incl. Padding) + + ---------------------------------------------------------------------- + + Code (inc. data) RO Data RW Data ZI Data Debug Library Name + + 532 80 0 0 0 468 drvs.lib + 1012 68 0 4 0 456 mc_p.l + + ---------------------------------------------------------------------- + 1548 148 0 4 0 924 Library Totals + + ---------------------------------------------------------------------- + +============================================================================== + + + Code (inc. data) RO Data RW Data ZI Data Debug + + 1904 254 184 4 1692 20526 Grand Totals + 1904 254 184 4 1692 20526 ELF Image Totals + 1904 254 184 4 0 0 ROM Totals + +============================================================================== + + Total RO Size (Code + RO Data) 2088 ( 2.04kB) + Total RW Size (RW Data + ZI Data) 1696 ( 1.66kB) + Total ROM Size (Code + RO Data + RW Data) 2092 ( 2.04kB) + +============================================================================== + diff --git a/examples/extiTest/mdk/output/extiTest_extiTest.dep b/examples/extiTest/mdk/output/extiTest_extiTest.dep new file mode 100644 index 0000000..7097807 --- /dev/null +++ b/examples/extiTest/mdk/output/extiTest_extiTest.dep @@ -0,0 +1,59 @@ +Dependencies for Project 'extiTest', Target 'extiTest': (DO NOT MODIFY !) +F (..\..\..\core\mdk\startup.s)(0x66063421)(--cpu Cortex-M0 -g --16 --apcs=interwork --pd "__MICROLIB SETA 1" --thumb -I C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\examples\extiTest\mdk\RTE -I C:\Keil_v5\ARM\CMSIS\Include --pd "__UVISION_VERSION SETA 515" -o .\output\startup.o --depend .\output\startup.d) +F (..\src\cfg.h)(0x66063421)() +F (..\src\main.c)(0x66063B16)(--c99 -c --cpu Cortex-M0 -D__MICROLIB -g -O2 --apcs=interwork --split_sections -I..\src -I..\..\..\core -I..\..\..\core\mdk -I..\..\..\core\reg -I..\..\..\drivers\api -I..\..\..\modules\api -I..\..\..\ble\api -I..\..\..\ble\app -I..\..\..\ble\prf --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h -I C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\examples\extiTest\mdk\RTE -I C:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="515" -o .\output\main.o --omf_browse .\output\main.crf --depend .\output\main.d) +I (..\src\cfg.h)(0x66063421) +I (..\..\..\core\b6x.h)(0x66063421) +I (..\..\..\core\core_cm0plus.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdint.h)(0x54C245B8) +I (..\..\..\core\core_cmInstr.h)(0x66063421) +I (..\..\..\core\core_cmFunc.h)(0x66063421) +I (..\..\..\core\rom.h)(0x66063421) +I (..\..\..\drivers\api\drvs.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stddef.h)(0x54C245B8) +I (C:\Keil_v5\ARM\ARMCC\include\stdbool.h)(0x54C245B8) +I (..\..\..\core\string.h)(0x66063421) +I (..\..\..\drivers\api\core.h)(0x66063421) +I (..\..\..\drivers\api\dma.h)(0x66063421) +I (..\..\..\core\reg\reg_dmachcfg.h)(0x66063421) +I (..\..\..\core\reg\reg_base.h)(0x66063421) +I (..\..\..\drivers\api\exti.h)(0x66063421) +I (..\..\..\core\reg\reg_exti.h)(0x66063421) +I (..\..\..\drivers\api\fshc.h)(0x66063421) +I (..\..\..\drivers\api\flash.h)(0x66063421) +I (..\..\..\drivers\api\gpio.h)(0x66063421) +I (..\..\..\drivers\api\iopad.h)(0x66063421) +I (..\..\..\core\reg\reg_csc.h)(0x66063421) +I (..\..\..\core\reg\reg_gpio.h)(0x66063421) +I (..\..\..\drivers\api\i2c.h)(0x66063421) +I (..\..\..\core\reg\reg_i2c.h)(0x66063421) +I (..\..\..\drivers\api\iwdt.h)(0x66063421) +I (..\..\..\drivers\api\pwm.h)(0x66063421) +I (..\..\..\drivers\api\rcc.h)(0x66063421) +I (..\..\..\core\reg\reg_rcc.h)(0x66063421) +I (..\..\..\drivers\api\rtc.h)(0x66063421) +I (..\..\..\core\reg\reg_apbmisc.h)(0x66063421) +I (..\..\..\drivers\api\rco.h)(0x66063421) +I (..\..\..\drivers\api\sadc.h)(0x66063421) +I (..\..\..\drivers\api\spi.h)(0x66063421) +I (..\..\..\drivers\api\timer.h)(0x66063421) +I (..\..\..\core\reg\reg_timer.h)(0x66063421) +I (..\..\..\drivers\api\trim.h)(0x66063421) +I (..\..\..\drivers\api\uart.h)(0x66063421) +I (..\..\..\core\reg\reg_uart.h)(0x66063421) +I (..\..\..\modules\api\dbg.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdio.h)(0x54C245B8) +F (..\..\..\drivers\api\drvs.h)(0x66063421)() +F (..\..\..\drivers\lib\drvs.lib)(0x66063421)() +F (..\..\..\modules\src\debug.c)(0x66063421)(--c99 -c --cpu Cortex-M0 -D__MICROLIB -g -O2 --apcs=interwork --split_sections -I..\src -I..\..\..\core -I..\..\..\core\mdk -I..\..\..\core\reg -I..\..\..\drivers\api -I..\..\..\modules\api -I..\..\..\ble\api -I..\..\..\ble\app -I..\..\..\ble\prf --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h -I C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\examples\extiTest\mdk\RTE -I C:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="515" -o .\output\debug.o --omf_browse .\output\debug.crf --depend .\output\debug.d) +I (..\src\cfg.h)(0x66063421) +I (..\..\..\modules\api\dbg.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdint.h)(0x54C245B8) +I (C:\Keil_v5\ARM\ARMCC\include\stdio.h)(0x54C245B8) +I (..\..\..\drivers\api\uart.h)(0x66063421) +I (..\..\..\drivers\api\rcc.h)(0x66063421) +I (..\..\..\core\reg\reg_rcc.h)(0x66063421) +I (..\..\..\core\reg\reg_base.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stddef.h)(0x54C245B8) +I (C:\Keil_v5\ARM\ARMCC\include\stdbool.h)(0x54C245B8) +I (..\..\..\core\reg\reg_uart.h)(0x66063421) diff --git a/examples/extiTest/mdk/output/main.crf b/examples/extiTest/mdk/output/main.crf new file mode 100644 index 0000000..cf06eaa Binary files /dev/null and b/examples/extiTest/mdk/output/main.crf differ diff --git a/examples/extiTest/mdk/output/main.d b/examples/extiTest/mdk/output/main.d new file mode 100644 index 0000000..cf866c6 --- /dev/null +++ b/examples/extiTest/mdk/output/main.d @@ -0,0 +1,42 @@ +.\output\main.o: ..\src\main.c +.\output\main.o: ..\src\cfg.h +.\output\main.o: ..\..\..\core\b6x.h +.\output\main.o: ..\..\..\core\core_cm0plus.h +.\output\main.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h +.\output\main.o: ..\..\..\core\core_cmInstr.h +.\output\main.o: ..\..\..\core\core_cmFunc.h +.\output\main.o: ..\..\..\core\rom.h +.\output\main.o: ..\..\..\drivers\api\drvs.h +.\output\main.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stddef.h +.\output\main.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h +.\output\main.o: ..\..\..\core\string.h +.\output\main.o: ..\..\..\drivers\api\core.h +.\output\main.o: ..\..\..\drivers\api\dma.h +.\output\main.o: ..\..\..\core\reg\reg_dmachcfg.h +.\output\main.o: ..\..\..\core\reg\reg_base.h +.\output\main.o: ..\..\..\drivers\api\exti.h +.\output\main.o: ..\..\..\core\reg\reg_exti.h +.\output\main.o: ..\..\..\drivers\api\fshc.h +.\output\main.o: ..\..\..\drivers\api\flash.h +.\output\main.o: ..\..\..\drivers\api\gpio.h +.\output\main.o: ..\..\..\drivers\api\iopad.h +.\output\main.o: ..\..\..\core\reg\reg_csc.h +.\output\main.o: ..\..\..\core\reg\reg_gpio.h +.\output\main.o: ..\..\..\drivers\api\i2c.h +.\output\main.o: ..\..\..\core\reg\reg_i2c.h +.\output\main.o: ..\..\..\drivers\api\iwdt.h +.\output\main.o: ..\..\..\drivers\api\pwm.h +.\output\main.o: ..\..\..\drivers\api\rcc.h +.\output\main.o: ..\..\..\core\reg\reg_rcc.h +.\output\main.o: ..\..\..\drivers\api\rtc.h +.\output\main.o: ..\..\..\core\reg\reg_apbmisc.h +.\output\main.o: ..\..\..\drivers\api\rco.h +.\output\main.o: ..\..\..\drivers\api\sadc.h +.\output\main.o: ..\..\..\drivers\api\spi.h +.\output\main.o: ..\..\..\drivers\api\timer.h +.\output\main.o: ..\..\..\core\reg\reg_timer.h +.\output\main.o: ..\..\..\drivers\api\trim.h +.\output\main.o: ..\..\..\drivers\api\uart.h +.\output\main.o: ..\..\..\core\reg\reg_uart.h +.\output\main.o: ..\..\..\modules\api\dbg.h +.\output\main.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h diff --git a/examples/extiTest/mdk/output/main.o b/examples/extiTest/mdk/output/main.o new file mode 100644 index 0000000..879d866 Binary files /dev/null and b/examples/extiTest/mdk/output/main.o differ diff --git a/examples/extiTest/mdk/output/startup.d b/examples/extiTest/mdk/output/startup.d new file mode 100644 index 0000000..2a861ea --- /dev/null +++ b/examples/extiTest/mdk/output/startup.d @@ -0,0 +1 @@ +.\output\startup.o: ..\..\..\core\mdk\startup.s diff --git a/examples/extiTest/mdk/output/startup.o b/examples/extiTest/mdk/output/startup.o new file mode 100644 index 0000000..21aa776 Binary files /dev/null and b/examples/extiTest/mdk/output/startup.o differ diff --git a/examples/extiTest/src/cfg.h b/examples/extiTest/src/cfg.h new file mode 100644 index 0000000..924f8cd --- /dev/null +++ b/examples/extiTest/src/cfg.h @@ -0,0 +1,16 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// Debug Mode: 0=Disable, 1=via UART, 2=RTT Viewer +#define DBG_MODE (1) +#endif //_APP_CFG_H_ diff --git a/examples/extiTest/src/main.c b/examples/extiTest/src/main.c new file mode 100644 index 0000000..04ebc80 --- /dev/null +++ b/examples/extiTest/src/main.c @@ -0,0 +1,112 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +#define PA_RET_SEE (12) +#define PA_EXTI0 (9) +#define PA_EXTI1 (10) + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +volatile uint8_t gExtiIrqFlag = 0; + +void EXTI_IRQHandler(void) +{ + uint32_t irq_sta = EXTI->RIF.Word; + + gExtiIrqFlag = 0; + + //GPIO_DAT_SET(1 << PA_RET_SEE); + gpio_put_hi(PA_RET_SEE); + + if (irq_sta & EXTI_SRC(PA_EXTI0)) + { + //EXTI->IDR.Word = EXTI_SRC(PA_EXTI0)); + EXTI->ICR.Word = EXTI_SRC(PA_EXTI0); + gExtiIrqFlag |= 0x01; + //EXTI->IER.Word = EXTI_SRC(PA_EXTI0); + } + + if (irq_sta & EXTI_SRC(PA_EXTI1)) + { + //EXTI->IDR.Word = EXTI_SRC(PA_EXTI1); + EXTI->ICR.Word = EXTI_SRC(PA_EXTI1); + gExtiIrqFlag |= 0x02; + //EXTI->IER.Word = EXTI_SRC(PA_EXTI1); + } + + //GPIO_DAT_CLR(1 << PA_RET_SEE); + gpio_put_lo(PA_RET_SEE); +} + +static void extiTest(void) +{ + // IO config + gpio_dir_output(PA_RET_SEE, OE_LOW); + + gpio_dir_input(PA_EXTI0, IE_UP); + gpio_dir_input(PA_EXTI1, IE_UP); + + // EXTI config + exti_init(EXTI_DBC(15, 4)); + exti_set(EXTI_FTS, EXTI_SRC(PA_EXTI0)|EXTI_SRC(PA_EXTI1)); // falling + //exti_set(EXTI_RTS, EXTI_SRC(PA_EXTI1)); // rising + exti_set(EXTI_DBE, EXTI_SRC(PA_EXTI0) | EXTI_SRC(PA_EXTI1)); + exti_set(EXTI_IER, EXTI_SRC(PA_EXTI0) | EXTI_SRC(PA_EXTI1)); + + // IRQ enable + NVIC_EnableIRQ(EXTI_IRQn); + __enable_irq(); + + while (1) + { + if (gExtiIrqFlag) + { + debug("Trig: %X\r\n", gExtiIrqFlag); + gExtiIrqFlag = 0; + } + } +} + +static void sysInit(void) +{ + // Todo config, if need + +} + +static void devInit(void) +{ + iwdt_disable(); + + dbgInit(); + debug("EXTI Test...\r\n"); +} + +int main(void) +{ + sysInit(); + devInit(); + + extiTest(); + while (1); +} diff --git a/examples/faultTest/mdk/JLinkSettings.ini b/examples/faultTest/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/examples/faultTest/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/examples/faultTest/mdk/clean.bat b/examples/faultTest/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/examples/faultTest/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/examples/faultTest/mdk/faultTest.uvoptx b/examples/faultTest/mdk/faultTest.uvoptx new file mode 100644 index 0000000..ebed233 --- /dev/null +++ b/examples/faultTest/mdk/faultTest.uvoptx @@ -0,0 +1,330 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + faultTest + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC5000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 0 + 1 + gBleSleep + + + + + 1 + 10 + 0x20005000 + 0 + + + + + 2 + 1 + 0x50000000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 4 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 5 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 4 + 6 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/examples/faultTest/mdk/faultTest.uvprojx b/examples/faultTest/mdk/faultTest.uvprojx new file mode 100644 index 0000000..81a04b3 --- /dev/null +++ b/examples/faultTest/mdk/faultTest.uvprojx @@ -0,0 +1,440 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + faultTest + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + faultTest + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\mdk;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/examples/faultTest/src/cfg.h b/examples/faultTest/src/cfg.h new file mode 100644 index 0000000..924f8cd --- /dev/null +++ b/examples/faultTest/src/cfg.h @@ -0,0 +1,16 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// Debug Mode: 0=Disable, 1=via UART, 2=RTT Viewer +#define DBG_MODE (1) +#endif //_APP_CFG_H_ diff --git a/examples/faultTest/src/main.c b/examples/faultTest/src/main.c new file mode 100644 index 0000000..0446934 --- /dev/null +++ b/examples/faultTest/src/main.c @@ -0,0 +1,89 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +#if (DBG_MODE != DBG_VIA_UART) +#error "Trace info output by printf()." +#endif + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +static void sysInit(void) +{ + // Todo config, if need + +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + iwdt_disable(); + + dbgInit(); + uint32_t fault_lr = __return_address(); + uint32_t fault_sp = __current_sp(); + debug("Start(rsn:0x%X)...\r\n", rsn); + + debug("%x, %x...\r\n", fault_lr, fault_sp); +} + +static void userProc(void) +{ + // Todo user procedure + +} + +void faultTest(void) +{ + // init trace + trace_init(); + + // HardFault - unalign read + volatile int * p; + volatile int value; + + p = (int *) 0x00; + value = *p; + debug("addr:0x%02X value:0x%08X\r\n", (int) p, value); + + p = (int *) 0x04; + value = *p; + debug("addr:0x%02X value:0x%08X\r\n", (int) p, value); + + p = (int *) 0x03; + value = *p; + debug("addr:0x%02X value:0x%08X\r\n", (int) p, value); +} + +int main(void) +{ + sysInit(); + devInit(); + + faultTest(); + while (1) + { + userProc(); + } +} diff --git a/examples/gfskTest/ReadMe.txt b/examples/gfskTest/ReadMe.txt new file mode 100644 index 0000000..7372b44 --- /dev/null +++ b/examples/gfskTest/ReadMe.txt @@ -0,0 +1,6 @@ +rf tx 定频测试&调频偏, 默认2440MHz + +uart指令说明 +A0 xx: 调晶振频偏(xx: 00 ~ 3F) +A1 : 获取当前晶振频偏配置值 +B0 xx: 调rf tx频率(xx: 00 ~ 27)(00 ~ 27对应tx频率2402 ~ 2480) \ No newline at end of file diff --git a/examples/gfskTest/mdk/JLinkSettings.ini b/examples/gfskTest/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/examples/gfskTest/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/examples/gfskTest/mdk/clean.bat b/examples/gfskTest/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/examples/gfskTest/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/examples/gfskTest/mdk/gfskTest.uvoptx b/examples/gfskTest/mdk/gfskTest.uvoptx new file mode 100644 index 0000000..f7d3cc7 --- /dev/null +++ b/examples/gfskTest/mdk/gfskTest.uvoptx @@ -0,0 +1,373 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + gfskTest + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + DLGUARM + + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC5000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 0 + 1 + gBleSleep + + + + + 1 + 10 + 0x20005000 + 0 + + + + + 2 + 1 + 0x50000000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + System Viewer\RCC + 35905 + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\src\proc.c + proc.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 5 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 6 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + modules + 1 + 0 + 0 + 0 + + 4 + 7 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\uart1Rb.c + uart1Rb.c + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 5 + 8 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/examples/gfskTest/mdk/gfskTest.uvprojx b/examples/gfskTest/mdk/gfskTest.uvprojx new file mode 100644 index 0000000..04170ab --- /dev/null +++ b/examples/gfskTest/mdk/gfskTest.uvprojx @@ -0,0 +1,455 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + gfskTest + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + gfskTest + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\mdk;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + proc.c + 1 + ..\src\proc.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + modules + + + uart1Rb.c + 1 + ..\..\..\modules\src\uart1Rb.c + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/examples/gfskTest/src/cfg.h b/examples/gfskTest/src/cfg.h new file mode 100644 index 0000000..f4aaaf0 --- /dev/null +++ b/examples/gfskTest/src/cfg.h @@ -0,0 +1,22 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// Debug Mode: 0=Disable, 1=via UART, 2=RTT Viewer +#define DBG_MODE (1) + +/// Debug Configure +#if (DBG_MODE) + #define DBG_PROC (1) +#endif + +#endif //_APP_CFG_H_ diff --git a/examples/gfskTest/src/main.c b/examples/gfskTest/src/main.c new file mode 100644 index 0000000..e654ed7 --- /dev/null +++ b/examples/gfskTest/src/main.c @@ -0,0 +1,52 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "uartRb.h" +#include "gfsk.h" +#include "dbg.h" + +void uart_proc(void); + +static void sysInit(void) +{ + rcc_adc_en(); + rcc_ble_en(); + + rcc_fshclk_set(FSH_CLK_DPSC42); +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + iwdt_disable(); + + uart1Rb_Init(); + debug("Start(rsn:0x%X)...\r\n", rsn); + + rf_gfsk_init(); + rf_gfsk_tx_freq(2440); +} + +int main(void) +{ + sysInit(); + devInit(); + + // Global Interrupt Enable + GLOBAL_INT_START(); + + while (1) + { + uart_proc(); + } +} diff --git a/examples/gfskTest/src/proc.c b/examples/gfskTest/src/proc.c new file mode 100644 index 0000000..bdc715a --- /dev/null +++ b/examples/gfskTest/src/proc.c @@ -0,0 +1,111 @@ +/** + **************************************************************************************** + * + * @file proc.c + * + * @brief user procedure. + * + **************************************************************************************** + */ +#include "regs.h" +#include "drvs.h" + +#include "uartRb.h" +#include "gfsk.h" + +#if (DBG_PROC) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +enum uart_cmd +{ + CMD_SET_XOSC16_TR = 0xA0, + CMD_GET_XOSC16_TR, + + CMD_TX_FREQ = 0xB0, +}; + +#define CMD_MAX_LEN 20 +#define NULL_CNT 20 + +static uint8_t buff[CMD_MAX_LEN]; +static uint16_t buff_len = 0; + +/* + * FUNCTIONS + **************************************************************************************** + */ +void uart_proc(void) +{ + static uint8_t null_cnt = 0; + uint16_t len; + bool finish = true; + + len = uart1Rb_Read(&buff[buff_len], CMD_MAX_LEN - buff_len); + if (len > 0) + { + buff_len += len; + if (buff_len < CMD_MAX_LEN) + { + return; // wait full + } + } + else + { + if ((buff_len > 0) && (null_cnt++ > NULL_CNT)) + { + //finish = true; + null_cnt = 0; + } + else + { + return; // wait again + } + } + + switch(buff[0]) + { + case CMD_SET_XOSC16_TR: + { + if (buff_len > 1) + { + DEBUG("SET_XOSC_TR:0x%02x", buff[1]); + APBMISC->XOSC16M_CTRL.XOSC16M_CAP_TR = buff[1]; + } + } break; + + case CMD_GET_XOSC16_TR: + { + DEBUG("GET_XOSC_TR:0x%02x", APBMISC->XOSC16M_CTRL.XOSC16M_CAP_TR); + } break; + + case CMD_TX_FREQ: + { + if (buff_len > 1) + { + uint16_t tx_freq_mhz = 2402 + (buff[1] << 1); + DEBUG("TX_FREQ:%d", tx_freq_mhz); + rf_gfsk_tx_freq(tx_freq_mhz); + } + } break; + + default: + { + } break; + } + + if (finish) + { + buff_len = 0; + } +} diff --git a/examples/gpioTest/mdk/JLinkSettings.ini b/examples/gpioTest/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/examples/gpioTest/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/examples/gpioTest/mdk/clean.bat b/examples/gpioTest/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/examples/gpioTest/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/examples/gpioTest/mdk/gpioTest.uvoptx b/examples/gpioTest/mdk/gpioTest.uvoptx new file mode 100644 index 0000000..61c9891 --- /dev/null +++ b/examples/gpioTest/mdk/gpioTest.uvoptx @@ -0,0 +1,345 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + gpioTest + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC5000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + DLGUARM + + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 0 + 1 + gBleSleep + + + + + 1 + 10 + 0x20005000 + 0 + + + + + 2 + 1 + 0x50000000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + System Viewer\CSC + 35904 + + + System Viewer\GPIO + 35905 + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 4 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 5 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 4 + 6 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/examples/gpioTest/mdk/gpioTest.uvprojx b/examples/gpioTest/mdk/gpioTest.uvprojx new file mode 100644 index 0000000..aa35e7e --- /dev/null +++ b/examples/gpioTest/mdk/gpioTest.uvprojx @@ -0,0 +1,440 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + gpioTest + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + gpioTest + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\mdk;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/examples/gpioTest/src/cfg.h b/examples/gpioTest/src/cfg.h new file mode 100644 index 0000000..5707a20 --- /dev/null +++ b/examples/gpioTest/src/cfg.h @@ -0,0 +1,20 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// Debug Mode: 0=Disable, 1=via UART, 2=RTT Viewer +#define DBG_MODE (1) + +#define DBG_UART_TXD (17) // PA17 +#define DBG_UART_RXD (18) // PA18 + +#endif //_APP_CFG_H_ diff --git a/examples/gpioTest/src/main.c b/examples/gpioTest/src/main.c new file mode 100644 index 0000000..abd8260 --- /dev/null +++ b/examples/gpioTest/src/main.c @@ -0,0 +1,157 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +enum test_pad +{ + // en output + PA_OUT00 = PA02, + PA_OUT01 = PA03, + PA_OUT10 = PA04, + PA_OUT11 = PA05, + // en input + PA_IN00 = PA08, + PA_IN01 = PA09, + PA_IN10 = PA10, + PA_IN11 = PA11, +}; + +#define GPIO_OUT0 (BIT(PA_OUT00) | BIT(PA_OUT01)) +#define GPIO_OUT1 (BIT(PA_OUT10) | BIT(PA_OUT11)) +#define GPIO_IN0 (BIT(PA_IN00) | BIT(PA_IN01)) +#define GPIO_IN1 (BIT(PA_IN10) | BIT(PA_IN11)) + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +static uint32_t pin_val; // io value +static uint32_t pin_chg; // io change +static bool io_rst; // 0-nReset, 1-GPIO + +static uint32_t padIn2Out(uint32_t val) +{ + uint32_t out = 0; + + // map gpio input to output + if (val & BIT(PA_IN00)) out |= BIT(PA_OUT00); + if (val & BIT(PA_IN01)) out |= BIT(PA_OUT01); + if (val & BIT(PA_IN10)) out |= BIT(PA_OUT10); + if (val & BIT(PA_IN11)) out |= BIT(PA_OUT11); + + return out; +} + +static void gpioTest(void) +{ + uint32_t tmp_val; + + // recover nRESET + io_rst = 0; + iospc_rstpin(0); + + // Init GPIO + debug("0-gpio(dir:0x%X,dat:0x%X,pin:0x%X)\r\n", + GPIO_DIR_GET(), GPIO_DAT_GET(), GPIO_PIN_GET()); + GPIO_DAT_CLR(GPIO_OUT0); // Low level + GPIO_DAT_SET(GPIO_OUT1); // High level + GPIO_DIR_SET(GPIO_OUT0 | GPIO_OUT1); // Output enable + + GPIO_DIR_CLR(GPIO_IN0 | GPIO_IN1); // OE disable + gpio_dir_input(PA_IN00, IE_DOWN); // Input enable, pull-down + gpio_dir_input(PA_IN01, IE_DOWN); + gpio_dir_input(PA_IN10, IE_UP); // Input enable, pull-up + gpio_dir_input(PA_IN11, IE_UP); + debug("1-gpio(dir:0x%X,dat:0x%X,pin:0x%X)\r\n", + GPIO_DIR_GET(), GPIO_DAT_GET(), GPIO_PIN_GET()); + + // Init value(pull-up) + pin_val = GPIO_IN1; + + while (1) + { + // pin scan + tmp_val = gpio_get_all() & (GPIO_IN0 | GPIO_IN1); // get input value + pin_chg = tmp_val ^ pin_val; + pin_val = tmp_val; + + // pin func + if (pin_chg) + { + uint32_t posedge = pin_val & pin_chg; + uint32_t negedge = ~pin_val & pin_chg; + + if (posedge) + { + GPIO_DAT_SET(padIn2Out(posedge)); // relate output + } + + if (negedge) + { + GPIO_DAT_CLR(padIn2Out(negedge)); // relate output + + if (negedge & BIT(PA_IN11)) + { + // toggle rst_pin mode + io_rst = !io_rst; + iospc_rstpin(io_rst); + + if (io_rst) + { + GPIO_DIR_SET_LO(BIT(PA_RSTPIN)); + } + } + } + + if (io_rst) + { + GPIO_DAT_TOG(BIT(PA_RSTPIN)); // toggle dat + } + + debug("pin trg(val:0x%X,chg:0x%X,pos:0x%X,neg:0x%X)\r\n", + pin_val, pin_chg, posedge, negedge); + } + } +} + +static void sysInit(void) +{ + // Todo config, if need + +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + iwdt_disable(); + + dbgInit(); + debug("Start(rsn:0x%X)...\r\n", rsn); +} + +int main(void) +{ + sysInit(); + devInit(); + + gpioTest(); +} diff --git a/examples/i2cTest/mdk/JLinkSettings.ini b/examples/i2cTest/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/examples/i2cTest/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/examples/i2cTest/mdk/clean.bat b/examples/i2cTest/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/examples/i2cTest/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/examples/i2cTest/mdk/i2cTest.uvoptx b/examples/i2cTest/mdk/i2cTest.uvoptx new file mode 100644 index 0000000..8f3c9db --- /dev/null +++ b/examples/i2cTest/mdk/i2cTest.uvoptx @@ -0,0 +1,352 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + i2cTest + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 1 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC5000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + DLGUARM + + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 0 + 1 + gBleSleep + + + 1 + 1 + dataBuff + + + + + 1 + 1 + 0x19000000 + 0 + + + + + 2 + 1 + 0x40029000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\src\i2c_test.c + i2c_test.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 5 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 6 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 4 + 7 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/examples/i2cTest/mdk/i2cTest.uvprojx b/examples/i2cTest/mdk/i2cTest.uvprojx new file mode 100644 index 0000000..4984d8b --- /dev/null +++ b/examples/i2cTest/mdk/i2cTest.uvprojx @@ -0,0 +1,445 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + i2cTest + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + i2cTest + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\mdk;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + i2c_test.c + 1 + ..\src\i2c_test.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/examples/i2cTest/src/cfg.h b/examples/i2cTest/src/cfg.h new file mode 100644 index 0000000..9b38707 --- /dev/null +++ b/examples/i2cTest/src/cfg.h @@ -0,0 +1,21 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// System Clock(0=16MHz, 1=32MHz, 2=48MHz, 3=64MHz) +#define SYS_CLK (0) + +/// Debug Mode: 0=Disable, 1=via UART, 2=RTT Viewer +#define DBG_MODE (1) +#define I2C_ROLE_SLAVE (0) + +#endif //_APP_CFG_H_ diff --git a/examples/i2cTest/src/i2c_test.c b/examples/i2cTest/src/i2c_test.c new file mode 100644 index 0000000..bdca6e3 --- /dev/null +++ b/examples/i2cTest/src/i2c_test.c @@ -0,0 +1,198 @@ +/** + **************************************************************************************** + * + * @file i2c_test.c + * + * @brief Demo of I2C Master/Slave Usage. + * + **************************************************************************************** + */ + +#include "string.h" +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +#define PIN_I2C_SCL PA11 +#define PIN_I2C_SDA PA12 +#define GPIO_I2C_TEST GPIO02 + +#define I2C_SLV_ADDR 0x57 // AT24C64 Eeprom +#define I2C_SLV_WRITE ((I2C_SLV_ADDR << 1) | 0x0) +#define I2C_SLV_READ ((I2C_SLV_ADDR << 1) | 0x1) + +#define AT24C64_EEP ((I2C_SLV_ADDR << 1)) + +#define AT24C64_DATA_ADDR 0x20 + +#define DATA_BUFF_LEN 16 + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +#if (I2C_ROLE_SLAVE) + +#define MEM_ADDR_BASE 0x20008000 + +uint8_t dataBuff[258] = {0}; +uint16_t buff_pos = 0; +uint32_t mem_addr = 0; + +static void i2c_isr(void) +{ + if (I2C_IFLG_GET() == 0) + { + return; + } + + debug("I2C status:0x%02X\r\n", I2C_STAT_GET()); + + switch (I2C_STAT_GET()) + { + case I2C_SS_RECV_ADDR_W: + { + + } break; + + case I2C_SS_RECV_DAT_ACK: + { + I2C_DATA_GET(dataBuff[buff_pos++]); + } break; + + case I2C_SS_RECV_STOP_OR_RESTART: + { + mem_addr = (MEM_ADDR_BASE + (dataBuff[0]<<8|dataBuff[1])); + + if (buff_pos > 2) + { + memcpy((uint8_t *)(mem_addr), &dataBuff[2], buff_pos-2); + } + buff_pos = 0; + } break; + + case I2C_SS_RECV_ADDR_R_ACK: + case I2C_SS_SEND_DAT_ACK: + { + I2C_DATA_PUT(*(uint8_t *)(mem_addr++)); + } break; + } + + I2C_IFLG_CLR(); + + NVIC_ClearPendingIRQ(I2C_IRQn); + NVIC_EnableIRQ(I2C_IRQn); +} + +void I2C_IRQHandler(void) +{ + NVIC_DisableIRQ(I2C_IRQn); + + //i2c_isr(); +} + +static void i2cProc(void) +{ + while (1) + { + i2c_isr(); // polling + } +} + +#else // (I2C_ROLE_MASTER) + +static void i2cProc(void) +{ + uint16_t cnt; + uint8_t buff_tx[DATA_BUFF_LEN]; + uint8_t buff_rx[DATA_BUFF_LEN]; + + // I2C access as eeprom + debug("** I2C Master RD(0x%02X)/WR(0x%02X) 1B \r\n", I2C_SLV_READ, I2C_SLV_WRITE); + + buff_tx[0] = (AT24C64_DATA_ADDR >> 8) & 0xFF; + buff_tx[1] = AT24C64_DATA_ADDR & 0xFF; // data addr MSB + buff_tx[2] = 0x5A; // 1B data + + i2c_write(I2C_SLV_WRITE, 3, buff_tx); // write 1byte (3len-2addr) + debug("I2C WR_E2(ByteVal=0x5A)...\r\n"); + bootDelayMs(60); + + i2c_write(I2C_SLV_WRITE, 2, buff_tx); // data addr MSB + cnt = i2c_read(I2C_SLV_READ, 1, buff_rx); + debug("I2C RD_E2(len=%d, ByteVal=0x%02X) -> %s\r\n", cnt, buff_rx[0], (buff_rx[0]==0x5A)?"OK":"FAIL"); + + // Eeprom Test + debug("** Eeprom(0x%02X) RD/WR at_0x%04X \r\n", AT24C64_EEP, AT24C64_DATA_ADDR); + + cnt = eeprom_read(AT24C64_EEP, AT24C64_DATA_ADDR, DATA_BUFF_LEN, buff_rx); + debug("Read(len=%d) before:\r\n", cnt); + debugHex(buff_rx, cnt); + + for (uint16_t i = 0; i < DATA_BUFF_LEN; i++) + { + buff_tx[i] = buff_rx[i] + 2; // autoInc + } + + cnt = eeprom_write(AT24C64_EEP, AT24C64_DATA_ADDR, DATA_BUFF_LEN, buff_tx); + debug("Write(len=%d), autoInc 2...\r\n", cnt); + bootDelayMs(60); // delay 10ms, wait write complete + + cnt = eeprom_read(AT24C64_EEP, AT24C64_DATA_ADDR, DATA_BUFF_LEN, buff_rx); + debug("Read(len=%d) after:\r\n", cnt); + debugHex(buff_rx, cnt); + + if ((cnt == DATA_BUFF_LEN) && (memcmp(buff_tx, buff_rx, DATA_BUFF_LEN) == 0)) + { + debug("** I2C-Master Test End -> OK\r\n\r\n"); + } + else + { + debug("** I2C-Master Test End -> FAIL\r\n\r\n"); + } + + while (1) + { + // empty + }; +} +#endif + +static void i2cInit(void) +{ + i2c_init(PIN_I2C_SCL, PIN_I2C_SDA, SCLK_100K); + + #if (I2C_ROLE_SLAVE) + I2C_SET_ACK(); + I2C_SLV_ADR(0x57); + + // Enable interrupt + I2C_INT_EN(); + + NVIC_ClearPendingIRQ(I2C_IRQn); + NVIC_EnableIRQ(I2C_IRQn); + __enable_irq(); + #endif +} + +void i2cTest(void) +{ + #if (FPGA_TEST) + // FPGA 48M need use 24M 20221119 --whl + RCC->APB1CLK_DIV = 1; + #endif + + debug("i2cTest Start...\r\n"); + + i2cInit(); + + i2cProc(); +} diff --git a/examples/i2cTest/src/main.c b/examples/i2cTest/src/main.c new file mode 100644 index 0000000..541f412 --- /dev/null +++ b/examples/i2cTest/src/main.c @@ -0,0 +1,51 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +static void sysInit(void) +{ + // Todo config, if need + rcc_sysclk_set(SYS_CLK); +} + +static void devInit(void) +{ + iwdt_disable(); + + // Init debug + dbgInit(); +} + +extern void i2cTest(void); + +int main(void) +{ + sysInit(); + + devInit(); + + i2cTest(); +} diff --git a/examples/iwdtTest/mdk/JLinkSettings.ini b/examples/iwdtTest/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/examples/iwdtTest/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/examples/iwdtTest/mdk/clean.bat b/examples/iwdtTest/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/examples/iwdtTest/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/examples/iwdtTest/mdk/iwdtTest.uvoptx b/examples/iwdtTest/mdk/iwdtTest.uvoptx new file mode 100644 index 0000000..22756fe --- /dev/null +++ b/examples/iwdtTest/mdk/iwdtTest.uvoptx @@ -0,0 +1,335 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + iwdtTest + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC5000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + DLGUARM + (106=-1,-1,-1,-1,0)(107=-1,-1,-1,-1,0) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 0 + 1 + gBleSleep + + + + + 1 + 10 + 0x20005000 + 0 + + + + + 2 + 1 + 0x50000000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 4 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 5 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 4 + 6 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/examples/iwdtTest/mdk/iwdtTest.uvprojx b/examples/iwdtTest/mdk/iwdtTest.uvprojx new file mode 100644 index 0000000..0287709 --- /dev/null +++ b/examples/iwdtTest/mdk/iwdtTest.uvprojx @@ -0,0 +1,440 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + iwdtTest + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + iwdtTest + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\mdk;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/examples/iwdtTest/src/cfg.h b/examples/iwdtTest/src/cfg.h new file mode 100644 index 0000000..e961157 --- /dev/null +++ b/examples/iwdtTest/src/cfg.h @@ -0,0 +1,17 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// Debug Mode: 0=Disable, 1=via UART, 2=RTT Viewer +#define DBG_MODE (1) + +#endif //_APP_CFG_H_ diff --git a/examples/iwdtTest/src/main.c b/examples/iwdtTest/src/main.c new file mode 100644 index 0000000..8570ab9 --- /dev/null +++ b/examples/iwdtTest/src/main.c @@ -0,0 +1,77 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +#define IWDT_WINDOW (32768) //32.768KHz 1S + + +/* + * FUNCTIONS + **************************************************************************************** + */ +volatile bool irq_evt = false; +volatile uint16_t irq_cnt = 0; + +void IWDT_IRQHandler(void) +{ + iwdt_feed(); + irq_evt = true; + irq_cnt++; +} + +static void iwdtInit(void) +{ + iwdt_init(IWDT_INTEN_BIT | IWDT_CR_DFLT); + iwdt_conf(IWDT_WINDOW); + + NVIC_EnableIRQ(IWDT_IRQn); + __enable_irq(); +} + +static void sysInit(void) +{ + // Todo config, if need + +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + dbgInit(); + + debug("Start(rsn:0x%X)...\r\n", rsn); + + iwdtInit(); +} + +int main(void) +{ + sysInit(); + devInit(); + + while (1) + { + if (irq_evt) + { + irq_evt = false; + debug("iwdt irq:%d\r\n", irq_cnt); + } + } +} diff --git a/examples/ldoTest/mdk/JLinkSettings.ini b/examples/ldoTest/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/examples/ldoTest/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/examples/ldoTest/mdk/clean.bat b/examples/ldoTest/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/examples/ldoTest/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/examples/ldoTest/mdk/ldoTest.uvoptx b/examples/ldoTest/mdk/ldoTest.uvoptx new file mode 100644 index 0000000..7289843 --- /dev/null +++ b/examples/ldoTest/mdk/ldoTest.uvoptx @@ -0,0 +1,357 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + ldoTest + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC5000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + DLGUARM + + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 0 + 1 + gBleSleep + + + + + 1 + 10 + 0x20005000 + 0 + + + + + 2 + 1 + 0x50000000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + System Viewer\CSC + 35904 + + + System Viewer\GPIO + 35905 + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\src\ldo_test.c + ldo_test.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 5 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 6 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 4 + 7 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/examples/ldoTest/mdk/ldoTest.uvprojx b/examples/ldoTest/mdk/ldoTest.uvprojx new file mode 100644 index 0000000..32b9ff0 --- /dev/null +++ b/examples/ldoTest/mdk/ldoTest.uvprojx @@ -0,0 +1,445 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + ldoTest + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + ldoTest + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\mdk;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + ldo_test.c + 1 + ..\src\ldo_test.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/examples/ldoTest/src/cfg.h b/examples/ldoTest/src/cfg.h new file mode 100644 index 0000000..9a23989 --- /dev/null +++ b/examples/ldoTest/src/cfg.h @@ -0,0 +1,20 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// Debug Mode: 0=Disable, 1=via UART, 2=RTT Viewer +#define DBG_MODE (1) + +#define BOD_TEST (1) +#define LVD_TEST (1) + +#endif //_APP_CFG_H_ diff --git a/examples/ldoTest/src/ldo_test.c b/examples/ldoTest/src/ldo_test.c new file mode 100644 index 0000000..49a48e3 --- /dev/null +++ b/examples/ldoTest/src/ldo_test.c @@ -0,0 +1,138 @@ +/** + **************************************************************************************** + * + * @file ldo.c + * + * @brief LDO for Power on Reset, include BOD LVD. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "regs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +#define GPIO_BOD GPIO04 +#define GPIO_LVD GPIO05 +#define GPIO_RUN GPIO15 + +#define LDO_BOD_MSK (LDO_BOD_ENB_MSK | LDO_BOD_TRIM_MSK) +#define LDO_BOD_CFG (CFG_BOD_EN(1/*en*/, 1/*rst*/, 0/*irq*/) | CFG_BOD_TRIM(0)) + +#define LDO_LVD_MSK (LDO_LVD_ENB_MSK | LDO_LVD_SEL_MSK) +#define LDO_LVD_CFG (CFG_LVD_EN(1/*en*/, 1/*rst*/, 0/*irq*/) | CFG_LVD_SEL(7)) + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +#if (BOD_TEST) +volatile bool bodFlg = false; +volatile uint8_t bodCnt = 0; + +void BOD12_IRQHandler(void) +{ + GPIO_DAT_SET(GPIO_BOD); + + bodFlg = true; + bodCnt++; + + GPIO_DAT_CLR(GPIO_BOD); +} + +static void bodEvent(void) +{ + if (bodFlg) + { + bodFlg = false; + debug("BOD IRQ:%d\r\n", bodCnt); + } +} +#endif + +#if (LVD_TEST) +volatile bool lvdFlg = false; +volatile uint8_t lvdCnt = 0; + +void LVD33_IRQHandler(void) +{ + GPIO_DAT_SET(GPIO_LVD); + + lvdFlg = true; + lvdCnt++; + + GPIO_DAT_CLR(GPIO_LVD); +} + +static void lvdEvent(void) +{ + if (lvdFlg) + { + lvdFlg = false; + debug("LVD IRQ:%d\r\n", lvdCnt); + } +} +#endif + +static void ldoInit(void) +{ + uint32_t ldoCfg = core_ldoget(); + debug("LDO Get:0x%X\r\n", ldoCfg); + + #if (BOD_TEST) + // extern 1.2V + APBMISC->AON_PMU_CTRL.AON_PWR_SEL_RUN = 0; + AON->PMU_CTRL.CORELDO_EN_RUN = 0; + + ldoCfg = (ldoCfg & ~LDO_BOD_MSK) | LDO_BOD_CFG; + NVIC_EnableIRQ(BOD12_IRQn); + #endif + + #if (LVD_TEST) + ldoCfg = (ldoCfg & ~LDO_LVD_MSK) | LDO_LVD_CFG; + NVIC_EnableIRQ(LVD33_IRQn); + #endif + + core_ldoset(ldoCfg); + bootDelayMs(15); // must wait + + debug("LDO Set:0x%X\r\n", ldoCfg); +} + +void ldoTest(void) +{ + GPIO_DIR_SET_LO(GPIO_BOD | GPIO_LVD | GPIO_RUN); + + // init BOD LVD + GPIO_DAT_SET(GPIO_RUN); + ldoInit(); + GPIO_DAT_CLR(GPIO_RUN); + + __enable_irq(); + + while (1) + { + // event proc + #if (BOD_TEST) + bodEvent(); + #endif + + #if (LVD_TEST) + lvdEvent(); + #endif + + // heart pulse + GPIO_DAT_SET(GPIO_RUN); + bootDelayMs(2); + GPIO_DAT_CLR(GPIO_RUN); + } +} diff --git a/examples/ldoTest/src/main.c b/examples/ldoTest/src/main.c new file mode 100644 index 0000000..d1fe5a2 --- /dev/null +++ b/examples/ldoTest/src/main.c @@ -0,0 +1,52 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +static void sysInit(void) +{ + // Todo config, if need + +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + iwdt_disable(); + + dbgInit(); + debug("Start(rsn:0x%X)...\r\n", rsn); +} + +extern void ldoTest(void); + +int main(void) +{ + sysInit(); + devInit(); + + ldoTest(); +} diff --git a/examples/loader/mdk/JLinkSettings.ini b/examples/loader/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/examples/loader/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/examples/loader/mdk/clean.bat b/examples/loader/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/examples/loader/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/examples/loader/mdk/link_ld.sct b/examples/loader/mdk/link_ld.sct new file mode 100644 index 0000000..e7b379d --- /dev/null +++ b/examples/loader/mdk/link_ld.sct @@ -0,0 +1,21 @@ +; ************************************************************* +; *** Scatter-Loading Description File generated by uVision *** +; ************************************************************* + +LR_IROM1 0x20003600 0x4A00 +{ + ER_IROM1 +0 + { + *.o (RESET, +First) + *(InRoot$$Sections) + startup*.o (+RO) + + .ANY (+RO) + .ANY (+RW +ZI) + } + + RW_IRAM_STACK 0x20003600-0x600 UNINIT 0x600 + { + .ANY (STACK) + } +} \ No newline at end of file diff --git a/examples/loader/mdk/loader.uvoptx b/examples/loader/mdk/loader.uvoptx new file mode 100644 index 0000000..6da1fff --- /dev/null +++ b/examples/loader/mdk/loader.uvoptx @@ -0,0 +1,327 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + loader + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + JL2CM3 + -U59701305 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC5000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS020000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + DLGUARM + d + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 0 + 1 + gBleSleep + + + + + 1 + 2 + 0x18008000 + 0 + + + + + 2 + 1 + 0x50000000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + src + 1 + 0 + 0 + 0 + + 1 + 1 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 1 + 2 + 2 + 0 + 0 + 0 + .\startup_ld.s + startup_ld.s + 0 + 0 + + + 1 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + + + sct + 1 + 0 + 0 + 0 + + 2 + 4 + 5 + 0 + 0 + 0 + .\link_ld.sct + link_ld.sct + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 5 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 6 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + +
diff --git a/examples/loader/mdk/loader.uvprojx b/examples/loader/mdk/loader.uvprojx new file mode 100644 index 0000000..270fa03 --- /dev/null +++ b/examples/loader/mdk/loader.uvprojx @@ -0,0 +1,435 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + loader + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + loader + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + fromelf --text -a -c --output "$L@L.asm" "#L" + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + __NO_EMBEDDED_ASM + + ..\src;..\..\..\core;..\..\..\core\mdk;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + .\link_ld.sct + + + --diag_suppress=L6312,L6314,L6329 --entry=__main + + + + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + startup_ld.s + 2 + .\startup_ld.s + + + main.c + 1 + ..\src\main.c + + + + + sct + + + link_ld.sct + 5 + .\link_ld.sct + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + + + + + + + + + +
diff --git a/examples/loader/mdk/startup_ld.s b/examples/loader/mdk/startup_ld.s new file mode 100644 index 0000000..9da1dbc --- /dev/null +++ b/examples/loader/mdk/startup_ld.s @@ -0,0 +1,85 @@ +;ChipId: B6x + +;Stack Configuration------------------------------------------------------------ +Stack_Size EQU 0x600 + AREA STACK, NOINIT, READWRITE, ALIGN=3 +Stack_Mem SPACE Stack_Size +__initial_sp +;------------------------------------------------------------------------------- + +;Heap Configuration------------------------------------------------------------- +;Heap_Size EQU 0x200 +; AREA HEAP, NOINIT, READWRITE, ALIGN=3 +;__heap_base +;Heap_Mem SPACE Heap_Size +;__heap_limit +;------------------------------------------------------------------------------- + PRESERVE8 + THUMB + +; Vector Table Mapped to Address 0 at Reset------------------------------------- + AREA RESET, DATA, READONLY + EXPORT __Vectors + +__Vectors DCD __initial_sp ; 0, load top of stack + DCD Reset_Handler ; 1, Reset Handler + DCD NMI_Handler ; 2, NMI Handler + DCD HardFault_Handler ; 3, Hard Fault Handler + DCD 0x18004000 ; LDR_RUN_ADDR + DCD 0x18020000 ; LDR_INFO_ADDR + +__Vectors_End + +__Vectors_Size EQU __Vectors_End - __Vectors + +;------------------------------------------------------------------------------- + AREA |.INT|, CODE, READONLY + +;Reset Handler------------------------------------------------------------------ +Reset_Handler PROC + EXPORT Reset_Handler [WEAK] + IMPORT __main + + LDR R0, =__main + BX R0 + ENDP + +; Dummy Exception Handlers (infinite loops here, can be modified) + +NMI_Handler PROC + EXPORT NMI_Handler [WEAK] + B . + ENDP + +HardFault_Handler\ + PROC + EXPORT HardFault_Handler [WEAK] + B . + ENDP + + ALIGN +;******************************************************************************* +; User Stack and Heap initialization +;******************************************************************************* + IF :DEF:__MICROLIB + + EXPORT __initial_sp + ;EXPORT __heap_base + ;EXPORT __heap_limit + + ELSE + + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, = Heap_Mem + LDR R1, = (Stack_Mem + Stack_Size) + LDR R2, = (Heap_Mem + Heap_Size) + LDR R3, = Stack_Mem + BX LR + + ALIGN + + ENDIF + + END diff --git a/examples/loader/ota_firmware.bat b/examples/loader/ota_firmware.bat new file mode 100644 index 0000000..8f88028 --- /dev/null +++ b/examples/loader/ota_firmware.bat @@ -0,0 +1,27 @@ +@Echo off & setlocal EnableDelayedExpansion + +SET AppFile=bleUart.bin +SET OutFile=OTA.bin + +SET OTA_ADDR=0x18020100 +SET LDR_TYPE_COPY=0x55AA5AA5 + +SET InfoFile=.\info.bin +SET SREC_CAT=..\..\tools\srec_cat.exe + +if not exist %InfoFile% ( + fsutil file createNew %InfoFile% 256 +) + +for %%i in (%AppFile%) do ( + SET app_bin_size=%%~zi +) +::echo %app_bin_size% + +%SREC_CAT% -generate 0x00 0x04 -constant-l-e %LDR_TYPE_COPY% 4 %InfoFile% -binary -exclude 0x00 0x04 -o %InfoFile% -binary +%SREC_CAT% -generate 0x04 0x08 -constant-l-e %app_bin_size% 4 %InfoFile% -binary -exclude 0x04 0x08 -o %InfoFile% -binary +%SREC_CAT% -generate 0x08 0x0C -constant-l-e %OTA_ADDR% 4 %InfoFile% -binary -exclude 0x08 0x0C -o %InfoFile% -binary + +%SREC_CAT% %InfoFile% -binary %AppFile% -binary -offset 0x100 -o %OutFile% -binary + +::pause diff --git a/examples/loader/src/cfg.h b/examples/loader/src/cfg.h new file mode 100644 index 0000000..5b2f749 --- /dev/null +++ b/examples/loader/src/cfg.h @@ -0,0 +1,21 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// System Clock(0=16MHz, 1=32MHz, 2=48MHz, 3=64MHz) +#define SYS_CLK (0) + +/// Flash Address of Loader's Information, *KEEP UP with startup_ld.s +#define LDR_RUN_ADDR 0x18004000 +#define LDR_INFO_ADDR 0x18020000 // INFO_ADDR + 0x100 = otaAddr(0x18020100) + +#endif //_APP_CFG_H_ diff --git a/examples/loader/src/main.c b/examples/loader/src/main.c new file mode 100644 index 0000000..b69cfd9 --- /dev/null +++ b/examples/loader/src/main.c @@ -0,0 +1,170 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the Loader. + * + **************************************************************************************** + */ + +#include "regs.h" +#include "drvs.h" +#include "dbg.h" + +/* + * DEFINES + **************************************************************************************** + */ + +/****************** FLASH STORAGE AREAS ******************* + +LDR_ADDR(0x1800000): + _________________________________________________________ + | | + | Loader(APROM) | + |_______________________________________________________| + +LDR_RUN_ADDR(Align 0x100): + _________________________________________________________ + | | + | APP (Code and Data) | + | | + |_______________________________________________________| + +LDR_INFO_ADDR(Align 0x100): + _________________________________________________________ + | | + | page+0: ldr_info_t | + |_______________________________________________________| + | | + | page+1: code start (otaAddr = INFO_ADDR + 0x100) | + | page+n: code end (otaLen = end - start) | + |_______________________________________________________| + +***********************************************************/ + +#ifndef PAGE_SIZE +#define PAGE_SIZE 0x100 +#endif + +#define PAGE_SIZE_WLEN (PAGE_SIZE >> 2) + +/// Loader type +#define LDR_TYPE_NONE 0xFFFFFFFF +#define LDR_TYPE_COPY 0x55AA5AA5 + +/// Loader's Info +typedef struct +{ + // Loader type - TYPE_COPY or TYPE_NONE + uint32_t ldrType; + // Code length - copy code from INFO_ADDR to RUN_ADDR + uint32_t otaLen; + // Code Address - suggest at LDR_INFO_ADDR + 0x100 + uint32_t otaAddr; + + /* add other info if need */ + +} ldr_info_t; + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +static bool app_is_ok(uint32_t run_addr) +{ + // Judge app is right at LDR_RUN_ADDR if need. + #if (0) + uint32_t stack_top = RD_32(run_addr + 0); + uint32_t reset_hdl = RD_32(run_addr + 4); + + if (((reset_hdl >> 24) != 0x18) || (stack_top < 0x20003000) || (stack_top > 0x2000B000)) + return false; + #endif + + return true; +} + +static void ota_copy(uint32_t run_addr, uint32_t cpy_addr, uint32_t cpy_len) +{ + uint32_t tmp_data[PAGE_SIZE_WLEN]; + uint32_t wr_page = (run_addr & 0x00FFFF00) / PAGE_SIZE; + uint32_t rd_page = (cpy_addr & 0x00FFFF00) / PAGE_SIZE; + uint32_t nb_pages = (cpy_len + (PAGE_SIZE - 1)) / PAGE_SIZE; + + // Copy Flash page by page + //for (uint32_t pg_idx = 0; pg_idx < nb_pages; pg_idx++) + while (nb_pages--) + { + // Read out + uint32_t offset = rd_page * PAGE_SIZE; + fshc_read(offset, tmp_data, PAGE_SIZE_WLEN, FSH_CMD_RD); + + // Erase, Write in + offset = wr_page * PAGE_SIZE; + fshc_erase(offset, FSH_CMD_ER_PAGE); + fshc_write(offset, tmp_data, PAGE_SIZE_WLEN, FSH_CMD_WR); + + // Next Page + wr_page++; + rd_page++; + } +} + +/// Override __main - remove complier func, eg. __scatterload +int __main(void) +{ + ldr_info_t ldr_info; + + // LDR_XXX_ADDR fixed after __Vectors(Entry at 0x20003600 Size=0x10) + // for easy to external modify. @see link_ld.sct and startup_ld.s + uint32_t ldr_run_addr = RD_32(0x20003610); + uint32_t ldr_info_addr = RD_32(0x20003614); + + // AONLDO VOL > CORELDO VOL + //AON->BKHOLD_CTRL.CORELDO_TRIM_RUN = 0x1B; + //AON->BKHOLD_CTRL.AONLDO_TRIM_RUN = 0x01; + AON->BKHOLD_CTRL.Word = 0x01B12008; + + // Close interrupt, already + //__disable_irq(); + + // Read Loader's Info + //memcpy(&ldr_info, (ldr_info_t *)(ldr_info_addr), sizeof(ldr_info_t)); + ldr_info.ldrType = RD_32(ldr_info_addr + 0); + + // Judge Loader Type + if (ldr_info.ldrType == LDR_TYPE_COPY) + { + ldr_info.otaLen = RD_32(ldr_info_addr + 4); + ldr_info.otaAddr = RD_32(ldr_info_addr + 8); + + // Check Validity, eg. Fixed (otaAddr = INFO_ADDR + 0x100) + //if (ldr_info.otaAddr == ldr_info_addr + PAGE_SIZE) + { + // Disable WatchDog + iwdt_disable(); + + // Copy code from INFO_ADDR to RUN_ADDR. + ota_copy(ldr_run_addr, ldr_info.otaAddr, ldr_info.otaLen); + + // Erase Loader's Info to avoid copy again + fshc_erase((ldr_info_addr & 0x00FFFF00), FSH_CMD_ER_PAGE); + + // Re-enable WatchDog + iwdt_conf(0x20000); + } + } + + // Jump to run + if (app_is_ok(ldr_run_addr)) + { + sysJumpTo(ldr_run_addr); + } + + // Never + while (1); +} diff --git a/examples/pwcTest/mdk/JLinkSettings.ini b/examples/pwcTest/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/examples/pwcTest/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/examples/pwcTest/mdk/clean.bat b/examples/pwcTest/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/examples/pwcTest/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/examples/pwcTest/mdk/pwcTest.uvoptx b/examples/pwcTest/mdk/pwcTest.uvoptx new file mode 100644 index 0000000..3bc8cc0 --- /dev/null +++ b/examples/pwcTest/mdk/pwcTest.uvoptx @@ -0,0 +1,373 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + pwcTest + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + DLGUARM + + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000) + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC5000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + 0 + 0 + 169 + 1 +
402686278
+ 0 + 0 + 0 + 0 + 0 + 1 + ..\src\main.c + + \\myapp\../src/main.c\169 +
+ + 1 + 0 + 162 + 1 +
0
+ 0 + 0 + 0 + 0 + 0 + 0 + ..\src\main.c + + +
+
+ + + 0 + 1 + gBleSleep + + + + + 1 + 10 + 0x20005000 + 0 + + + + + 2 + 1 + 0x50000000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + +
+
+ + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 4 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 5 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 4 + 6 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/examples/pwcTest/mdk/pwcTest.uvprojx b/examples/pwcTest/mdk/pwcTest.uvprojx new file mode 100644 index 0000000..154451f --- /dev/null +++ b/examples/pwcTest/mdk/pwcTest.uvprojx @@ -0,0 +1,440 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + pwcTest + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + pwcTest + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\mdk;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/examples/pwcTest/src/cfg.h b/examples/pwcTest/src/cfg.h new file mode 100644 index 0000000..908806f --- /dev/null +++ b/examples/pwcTest/src/cfg.h @@ -0,0 +1,19 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// Debug Mode: 0=Disable, 1=via UART, 2=RTT Viewer +#define DBG_MODE (1) + +#define CTMR_USED (1) // 1-CTMR, 0-ATMR + +#endif //_APP_CFG_H_ diff --git a/examples/pwcTest/src/main.c b/examples/pwcTest/src/main.c new file mode 100644 index 0000000..c143863 --- /dev/null +++ b/examples/pwcTest/src/main.c @@ -0,0 +1,145 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "regs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +#define PA_RET_SEE1 (2) +#define PA_RET_SEE2 (3) +#define PA_SOFT_PWM (4) + +#if (CTMR_USED) +#define PWC_TMR (PWM_CTMR) +#define PWC_TMR_CH(n) (PWM_CTMR_CH##n) +#define PWC_IRQc (CTMR_IRQn) +#define PA_PWC_CH1 (15) +#define PA_PWC_CH2 (16) +#else +#define PWC_TMR (PWM_ATMR) +#define PWC_TMR_CH(n) (PWM_ATMR_CH##n##P) +#define PWC_IRQc (ATMR_IRQn) +#define PA_PWC_CH1 (7) +#define PA_PWC_CH2 (8) +#endif + + +#define TIMER_INT_CH1_BIT (0x02U) +#define TIMER_INT_CH2_BIT (0x04U) +#define TIMER_INT_CH3_BIT (0x08U) +#define TIMER_INT_CH4_BIT (0x10U) +/* + * FUNCTIONS + **************************************************************************************** + */ + +#if (CTMR_USED) +void CTMR_IRQHandler(void) +{ + uint32_t iflg = CTMR->IFM.Word; + + if (iflg & TIMER_INT_CH1_BIT) // ch1 interrupt + { + GPIO_DAT_SET(1 << PA_RET_SEE1); + CTMR->ICR.CC1I = 1; + GPIO_DAT_CLR(1 << PA_RET_SEE1 | (1 << PA_SOFT_PWM)); + } + + if (iflg & TIMER_INT_CH2_BIT) // ch2 interrupt + { + GPIO_DAT_SET(1 << PA_RET_SEE2 | (1 << PA_SOFT_PWM)); + CTMR->ICR.CC2I = 1; + GPIO_DAT_CLR(1 << PA_RET_SEE2); + } + +} +#else +void ATMR_IRQHandler(void) +{ + uint32_t iflg = ATMR->IFM.Word; + + if (iflg & TIMER_INT_CH1_BIT) // ch1 interrupt + { + GPIO_DAT_SET(1 << PA_RET_SEE1); + ATMR->ICR.CC1I = 1; + GPIO_DAT_CLR(1 << PA_RET_SEE1 | (1 << PA_SOFT_PWM)); + } + + if (iflg & TIMER_INT_CH2_BIT) // ch2 interrupt + { + GPIO_DAT_SET(1 << PA_RET_SEE2 | (1 << PA_SOFT_PWM)); + ATMR->ICR.CC2I = 1; + GPIO_DAT_CLR(1 << PA_RET_SEE2); + } +} +#endif + +static void pwcTest(void) +{ + // init PADs + GPIO_DAT_CLR((1 << PA_RET_SEE1) | (1 << PA_RET_SEE2) | (1 << PA_SOFT_PWM) | (1 << PA_PWC_CH1) | (1 << PA_PWC_CH2)); + GPIO_DIR_SET((1 << PA_RET_SEE1) | (1 << PA_RET_SEE2) | (1 << PA_SOFT_PWM)); + GPIO_DIR_CLR((1 << PA_PWC_CH1) | (1 << PA_PWC_CH2)); + + iom_ctrl(PA_PWC_CH1, IOM_PULLDOWN | IOM_INPUT | IOM_SEL_TIMER); + iom_ctrl(PA_PWC_CH2, IOM_PULLDOWN | IOM_INPUT | IOM_SEL_TIMER); + + // init pwm timer + pwm_init(PWC_TMR, 0, UINT16_MAX); + + // pwc_chnl config + pwm_chnl_cfg_t chnl_cfg; + + chnl_cfg.duty = 0; + chnl_cfg.ccmr = PWC_CCMR_MODE(1, 3, PWC_PSC0); + chnl_cfg.ccer = PWC_CCER_NEGEDGE; + pwm_chnl_set(PWC_TMR_CH(1), &chnl_cfg); + chnl_cfg.ccer = PWC_CCER_POSEDGE; + pwm_chnl_set(PWC_TMR_CH(2), &chnl_cfg); + + // start with SMCR.TS=5(TI1FP1), SMCR.SMS=4(reset mode) + pwm_conf(PWC_TMR, 0x54, TIMER_INT_CH1_BIT | TIMER_INT_CH2_BIT); + pwm_start(PWC_TMR); + + // interrupt enable + NVIC_EnableIRQ(PWC_IRQc); + __enable_irq(); +} + +static void sysInit(void) +{ + // Todo config, if need + +} + +static void devInit(void) +{ + iwdt_disable(); + + dbgInit(); + debug("PWC Test...\r\n"); +} + +int main(void) +{ + sysInit(); + devInit(); + + pwcTest(); + + while (1); +} diff --git a/examples/pwmTest/mdk/JLinkSettings.ini b/examples/pwmTest/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/examples/pwmTest/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/examples/pwmTest/mdk/clean.bat b/examples/pwmTest/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/examples/pwmTest/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/examples/pwmTest/mdk/pwmTest.uvoptx b/examples/pwmTest/mdk/pwmTest.uvoptx new file mode 100644 index 0000000..3fd0f8a --- /dev/null +++ b/examples/pwmTest/mdk/pwmTest.uvoptx @@ -0,0 +1,335 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + pwmTest + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000) + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC5000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 0 + 1 + gBleSleep + + + + + 1 + 10 + 0x20005000 + 0 + + + + + 2 + 1 + 0x50000000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 4 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 5 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 4 + 6 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/examples/pwmTest/mdk/pwmTest.uvprojx b/examples/pwmTest/mdk/pwmTest.uvprojx new file mode 100644 index 0000000..fcfc9a1 --- /dev/null +++ b/examples/pwmTest/mdk/pwmTest.uvprojx @@ -0,0 +1,440 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + pwmTest + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + pwmTest + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\mdk;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/examples/pwmTest/src/cfg.h b/examples/pwmTest/src/cfg.h new file mode 100644 index 0000000..3ebd3a8 --- /dev/null +++ b/examples/pwmTest/src/cfg.h @@ -0,0 +1,21 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// Debug Mode: 0=Disable, 1=via UART, 2=RTT Viewer +#define DBG_MODE (1) + +#define DMA_USED (0) + +#define CTMR_USED (1) // 1-CTMR, 0-ATMR + +#endif //_APP_CFG_H_ diff --git a/examples/pwmTest/src/main.c b/examples/pwmTest/src/main.c new file mode 100644 index 0000000..8d5cd36 --- /dev/null +++ b/examples/pwmTest/src/main.c @@ -0,0 +1,214 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +#define PWM_TMR_PSC (16 - 1) // 16MHz +#define PWM_TMR_ARR (100 - 1) + +#if (CTMR_USED) +#define PA_CTMR_CH1 (15) +#define PA_CTMR_CH2 (16) +#define PA_CTMR_CH3 (17) +#define PA_CTMR_CH4 (18) +#else +#define PA_ATMR_CH1P (7) +#define PA_ATMR_CH2P (8) +#define PA_ATMR_CH3P (9) +#define PA_ATMR_CH4P (10) +#define PA_ATMR_CH1N (11) +#define PA_ATMR_CH2N (12) +#define PA_ATMR_CH3N (13) +#endif + +#if (DMA_USED) +#if (CTMR_USED) +#define PWM_CTMR_DMA_CHNL (DMA_CH0) +#else +#define PWM_ATMR_DMA_CHNL (DMA_CH1) +#endif +#define PWM_DUTY_CNT (10) + +uint32_t pwm_duty_buff0[PWM_DUTY_CNT]; +uint32_t pwm_duty_buff1[PWM_DUTY_CNT]; + +#define PA_DONE_SEE (2) +#endif + +#if (DMA_USED) +#define CFG_PWM_CCER_SIPH (PWM_CCER_SIPH | PWM_CCxDE_BIT) +#define CFG_PWM_CCER_SIPL (PWM_CCER_SIPL | PWM_CCxDE_BIT) +#else +#define CFG_PWM_CCER_SIPH (PWM_CCER_SIPH) +#define CFG_PWM_CCER_SIPL (PWM_CCER_SIPL) +#endif + +/* + * FUNCTIONS + **************************************************************************************** + */ + +static void pwmTest(void) +{ + #if (DMA_USED) + uint16_t idx = 0; + + GPIO_DIR_SET_LO(1 << PA_DONE_SEE); + dma_init(); + + for (idx = 0; idx < PWM_DUTY_CNT; idx++) + { + pwm_duty_buff0[idx] = (idx + 1) * 10 - 1; + pwm_duty_buff1[idx] = (PWM_DUTY_CNT - idx) * 10 - 1; + } + #endif + + #if (CTMR_USED) + iom_ctrl(PA_CTMR_CH1, IOM_SEL_TIMER); + iom_ctrl(PA_CTMR_CH2, IOM_SEL_TIMER); + iom_ctrl(PA_CTMR_CH3, IOM_SEL_TIMER); + iom_ctrl(PA_CTMR_CH4, IOM_SEL_TIMER); + #else + iom_ctrl(PA_ATMR_CH1P, IOM_SEL_TIMER); + iom_ctrl(PA_ATMR_CH2P, IOM_SEL_TIMER); + iom_ctrl(PA_ATMR_CH3P, IOM_SEL_TIMER); + iom_ctrl(PA_ATMR_CH4P, IOM_SEL_TIMER); + iom_ctrl(PA_ATMR_CH1N, IOM_SEL_TIMER); + iom_ctrl(PA_ATMR_CH2N, IOM_SEL_TIMER); + iom_ctrl(PA_ATMR_CH3N, IOM_SEL_TIMER); + #endif + + pwm_chnl_cfg_t chnl_conf; + + chnl_conf.ccmr = PWM_CCMR_MODE1; + + #if (CTMR_USED) + // CTMR + pwm_init(PWM_CTMR, PWM_TMR_PSC, PWM_TMR_ARR); + + chnl_conf.duty = 15; + // 15% high, 85% low + chnl_conf.ccer = CFG_PWM_CCER_SIPH; + pwm_chnl_set(PWM_CTMR_CH1, &chnl_conf); + + chnl_conf.duty = 25; + // 25% low, 75% high + chnl_conf.ccer = CFG_PWM_CCER_SIPL; + pwm_chnl_set(PWM_CTMR_CH2, &chnl_conf); + + chnl_conf.duty = 35; + // 35% high, 65% low + chnl_conf.ccer = CFG_PWM_CCER_SIPH; + pwm_chnl_set(PWM_CTMR_CH3, &chnl_conf); + + chnl_conf.duty = 45; + // 45% low, 55% high + chnl_conf.ccer = CFG_PWM_CCER_SIPL; + pwm_chnl_set(PWM_CTMR_CH4, &chnl_conf); + + pwm_start(PWM_CTMR); + #else + // ADTMR + pwm_init(PWM_ATMR, PWM_TMR_PSC, PWM_TMR_ARR); + + chnl_conf.duty = 10; + chnl_conf.ccer = CFG_PWM_CCER_SIPH; + // 10% high, 90% low + pwm_chnl_set(PWM_ATMR_CH1P, &chnl_conf); + // 10% low, 90% high + pwm_chnl_set(PWM_ATMR_CH1N, &chnl_conf); + + chnl_conf.duty = 20; + chnl_conf.ccer = CFG_PWM_CCER_SIPL; + // 20% low, 80% high + pwm_chnl_set(PWM_ATMR_CH2P, &chnl_conf); + // 20% high, 80% low + pwm_chnl_set(PWM_ATMR_CH2N, &chnl_conf); + + chnl_conf.duty = 30; + chnl_conf.ccer = CFG_PWM_CCER_SIPH; + // 30% high, 70% low + pwm_chnl_set(PWM_ATMR_CH3P, &chnl_conf); + // 30% low, 70% high + pwm_chnl_set(PWM_ATMR_CH3N, &chnl_conf); + + chnl_conf.duty = 40; + // 40% low, 60% high + chnl_conf.ccer = CFG_PWM_CCER_SIPL; + pwm_chnl_set(PWM_ATMR_CH4P, &chnl_conf); + + pwm_start(PWM_ATMR); + #endif + + #if (DMA_USED) + #if (CTMR_USED) + DMA_CTMR_CHx_INIT(PWM_CTMR_DMA_CHNL, 1); + DMA_CTMR_CHx_CONF(PWM_CTMR_DMA_CHNL, 1, pwm_duty_buff0, PWM_DUTY_CNT, CCM_PING_PONG); + DMA_CTMR_CHx_CONF(PWM_CTMR_DMA_CHNL | DMA_CH_ALT, 1, pwm_duty_buff1, PWM_DUTY_CNT, CCM_PING_PONG); + #else + DMA_ATMR_CHx_INIT(PWM_ATMR_DMA_CHNL, 1); + DMA_ATMR_CHx_CONF(PWM_ATMR_DMA_CHNL, 1, pwm_duty_buff0, PWM_DUTY_CNT, CCM_PING_PONG); + DMA_ATMR_CHx_CONF(PWM_ATMR_DMA_CHNL | DMA_CH_ALT, 1, pwm_duty_buff1, PWM_DUTY_CNT, CCM_PING_PONG); + #endif + + while (1) + { + #if (CFG_CTMR_TEST) + if (dma_chnl_done(PWM_CTMR_DMA_CHNL)) + { + GPIO_DAT_SET(1 << PA_DONE_SEE); + dma_chnl_reload(PWM_CTMR_DMA_CHNL); + GPIO_DAT_CLR(1 << PA_DONE_SEE); + } + #else + if (dma_chnl_done(PWM_ATMR_DMA_CHNL)) + { + GPIO_DAT_SET(1 << PA_DONE_SEE); + dma_chnl_reload(PWM_ATMR_DMA_CHNL); + GPIO_DAT_CLR(1 << PA_DONE_SEE); + } + #endif + + //idx = (1 + idx) % PWM_DUTY_CNT; + //pwm_duty_upd(PWM_CTMR_CH1, pwm_duty_buff0[idx]); + } + #endif +} + +static void sysInit(void) +{ + // Todo config, if need + +} + +static void devInit(void) +{ + iwdt_disable(); + + dbgInit(); + debug("PWM Test...\r\n"); +} + +int main(void) +{ + sysInit(); + devInit(); + + pwmTest(); + while (1); +} diff --git a/examples/rcoTest/mdk/JLinkSettings.ini b/examples/rcoTest/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/examples/rcoTest/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/examples/rcoTest/mdk/clean.bat b/examples/rcoTest/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/examples/rcoTest/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/examples/rcoTest/mdk/rcoTest.uvoptx b/examples/rcoTest/mdk/rcoTest.uvoptx new file mode 100644 index 0000000..44c2c43 --- /dev/null +++ b/examples/rcoTest/mdk/rcoTest.uvoptx @@ -0,0 +1,347 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + rcoTest + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000) + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI192.168.1.72 -JP1902 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC5000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 0 + 1 + gBleSleep + + + + + 1 + 10 + 0x20005000 + 0 + + + + + 2 + 1 + 0x50000000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\src\rco_test.c + rco_test.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 5 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 6 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 4 + 7 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/examples/rcoTest/mdk/rcoTest.uvprojx b/examples/rcoTest/mdk/rcoTest.uvprojx new file mode 100644 index 0000000..5faac49 --- /dev/null +++ b/examples/rcoTest/mdk/rcoTest.uvprojx @@ -0,0 +1,445 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + rcoTest + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + rcoTest + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\mdk;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + rco_test.c + 1 + ..\src\rco_test.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/examples/rcoTest/src/cfg.h b/examples/rcoTest/src/cfg.h new file mode 100644 index 0000000..81e7315 --- /dev/null +++ b/examples/rcoTest/src/cfg.h @@ -0,0 +1,20 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// Debug Mode: 0=Disable, 1=via UART, 2=RTT Viewer +#define DBG_MODE (1) + +#define RC16M_TEST (1) +#define RC32K_TEST (1) + +#endif //_APP_CFG_H_ diff --git a/examples/rcoTest/src/main.c b/examples/rcoTest/src/main.c new file mode 100644 index 0000000..78fe930 --- /dev/null +++ b/examples/rcoTest/src/main.c @@ -0,0 +1,52 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +static void sysInit(void) +{ + // Todo config, if need + +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + iwdt_disable(); + + dbgInit(); + debug("Start(rsn:0x%X)...\r\n", rsn); +} + +extern void rcoTest(void); + +int main(void) +{ + sysInit(); + devInit(); + + rcoTest(); +} diff --git a/examples/rcoTest/src/rco_test.c b/examples/rcoTest/src/rco_test.c new file mode 100644 index 0000000..de2e63c --- /dev/null +++ b/examples/rcoTest/src/rco_test.c @@ -0,0 +1,155 @@ +/** + **************************************************************************************** + * + * @file rco_test.c + * + * @brief RC32K/RC16M clkout and calib. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +#define GPIO_32K GPIO11 +#define GPIO_16M GPIO12 +#define GPIO_RUN GPIO13 + +#define RC32K_REF_CLK RCLK_DPLL +#define RC32K_CAL_CTL RCAL_CYCLES(4) +#define RC32K_CAL_NB 8 +#define RC32K_CAL_DIFF 2 + +/* + * FUNCTIONS + **************************************************************************************** + */ + +#if (RC32K_TEST) + +uint16_t rc32kCal; + +static __forceinline int co_abs(int val) +{ + return val < 0 ? val*(-1) : val; +} + +static void rc32kInit(void) +{ + // clk watch, rc32k calib + iospc_clkout(CLK_OUT_LSI); + + rc32k_conf(RC32K_REF_CLK, RC32K_CAL_CTL); + + for (uint8_t i = 0; i < RC32K_CAL_NB; i++) + { + GPIO_DAT_SET(GPIO_32K); + rc32kCal = rc32k_calib(); + GPIO_DAT_CLR(GPIO_32K); + + debug("RC32K Cal%d(msb:0x%X,lsb:0x%X)\r\n", i, rc32kCal&0xF, rc32kCal>>4); + } +} + +static bool rc32kChgd(void) +{ + uint16_t curcal; + + GPIO_DAT_SET(GPIO_32K); + curcal = rc32k_calib(); + GPIO_DAT_CLR(GPIO_32K); + + if (((curcal&0xF) != (rc32kCal&0xF))/*MSB*/ + || (co_abs((curcal>>4)-(rc32kCal>>4)) > RC32K_CAL_DIFF)/*LSB*/) + { + debug("RC32K Changed(msb:0x%X,lsb:0x%X)\r\n", rc32kCal&0xF, rc32kCal>>4); + return true; + } + return false; +} +#endif + +#if (RC16M_TEST) + +uint8_t rc16mCal; + +static void rc16mInit(void) +{ + uint8_t curtrim; + + iospc_clkout(CLK_OUT_HSI); + + curtrim = rc16m_trim_get(); + GPIO_DAT_SET(GPIO_16M); + rc16mCal = rc16m_calib(); + GPIO_DAT_CLR(GPIO_16M); + + debug("RC16M Cal(%d->%d)\r\n", curtrim, rc16mCal); +} + +static bool rc16mChgd(void) +{ + uint8_t curcal; + + GPIO_DAT_SET(GPIO_16M); + curcal = rc16m_calib(); + GPIO_DAT_CLR(GPIO_16M); + + if (curcal != rc16mCal) + { + debug("RC16M Changed(%d->%d)\r\n", rc16mCal, curcal); + rc16mCal = curcal; + return true; + } + return false; +} +#endif + +void rcoTest(void) +{ + bool chgd = false; + rtc_time_t time; + + GPIO_DIR_SET_LO(GPIO_32K | GPIO_16M | GPIO_RUN); + + #if (RC16M_TEST) + rc16mInit(); + #endif + + #if (RC32K_TEST) + rc32kInit(); + #endif + + rtc_conf(true); + time = rtc_time_get(); + debug("RTC Time:%d.%03d\r\n", time.sec, time.ms); + + while (1) + { + GPIO_DAT_SET(GPIO_RUN); + #if (RC16M_TEST) + if (rc16mChgd()) chgd = true; + #endif + + #if (RC32K_TEST) + if (rc32kChgd()) chgd = true; + #endif + + if (chgd) + { + chgd = false; + + time = rtc_time_get(); + debug("at RTC Time:%d.%03d\r\n", time.sec, time.ms); + } + + GPIO_DAT_CLR(GPIO_RUN); + } +} diff --git a/examples/rtcTest/mdk/JLinkSettings.ini b/examples/rtcTest/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/examples/rtcTest/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/examples/rtcTest/mdk/clean.bat b/examples/rtcTest/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/examples/rtcTest/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/examples/rtcTest/mdk/rtcTest.uvoptx b/examples/rtcTest/mdk/rtcTest.uvoptx new file mode 100644 index 0000000..2c98916 --- /dev/null +++ b/examples/rtcTest/mdk/rtcTest.uvoptx @@ -0,0 +1,347 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + rtcTest + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000) + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI192.168.1.72 -JP1902 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC5000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 0 + 1 + gBleSleep + + + + + 1 + 10 + 0x20005000 + 0 + + + + + 2 + 1 + 0x50000000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\src\rtc_test.c + rtc_test.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 5 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 6 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 4 + 7 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/examples/rtcTest/mdk/rtcTest.uvprojx b/examples/rtcTest/mdk/rtcTest.uvprojx new file mode 100644 index 0000000..bd7b5de --- /dev/null +++ b/examples/rtcTest/mdk/rtcTest.uvprojx @@ -0,0 +1,445 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + rtcTest + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + rtcTest + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\mdk;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + rtc_test.c + 1 + ..\src\rtc_test.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/examples/rtcTest/src/cfg.h b/examples/rtcTest/src/cfg.h new file mode 100644 index 0000000..e961157 --- /dev/null +++ b/examples/rtcTest/src/cfg.h @@ -0,0 +1,17 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// Debug Mode: 0=Disable, 1=via UART, 2=RTT Viewer +#define DBG_MODE (1) + +#endif //_APP_CFG_H_ diff --git a/examples/rtcTest/src/main.c b/examples/rtcTest/src/main.c new file mode 100644 index 0000000..576db74 --- /dev/null +++ b/examples/rtcTest/src/main.c @@ -0,0 +1,52 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +static void sysInit(void) +{ + // Todo config, if need + +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + iwdt_disable(); + + dbgInit(); + debug("Start(rsn:0x%X)...\r\n", rsn); +} + +extern void rtcTest(void); + +int main(void) +{ + sysInit(); + devInit(); + + rtcTest(); +} diff --git a/examples/rtcTest/src/rtc_test.c b/examples/rtcTest/src/rtc_test.c new file mode 100644 index 0000000..3529240 --- /dev/null +++ b/examples/rtcTest/src/rtc_test.c @@ -0,0 +1,135 @@ +/** + **************************************************************************************** + * + * @file rtc_test.c + * + * @brief RTC Time Alarm to ADTMR compare. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +#define GPIO_RTC GPIO11 +#define GPIO_TMR GPIO12 +#define GPIO_RUN GPIO13 + +#define RTC_ALARM_TIME 1000 // unit in ms + +#define RC32K_CAL_NB 8 + +#define TMR_PSC (48 - 1) // 1us sysclk=(n)MHz +#define TMR_ARR 0xFFFF + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +volatile bool rtcFlg; +volatile uint16_t tmrCnt; +volatile uint32_t tmrVal; + +void RTC_IRQHandler(void) +{ + GPIO_DAT_SET(GPIO_RTC); + + rtcFlg = true; + + // Once mode - disable + //rtc_irq_set(0); or rtc_alarm_set(0); + + // Period mode - reload + rtc_alarm_set(RTC_ALARM_TIME); + + // Record ADTMR value to compare + tmrVal = ATMR->CNT + ((uint32_t)tmrCnt << 16); // unit in us + // the counter start from 0 + ATMR->CNT = 0; + tmrCnt = 0; + + GPIO_DAT_CLR(GPIO_RTC); +} + +void ADMR1_IRQHandler(void) +{ + GPIO_DAT_SET(GPIO_TMR); + + uint32_t irq_stat = ATMR->RIF.Word; + + // Each tick Interrupt is 10ms + if (irq_stat & 0x01/*TIMER_UI_BIT*/) + { + ATMR->IDR.UI = 1; // Disable UI Interrupt + + tmrCnt++; + + ATMR->ICR.UI = 1; //Clear Interrupt Flag + ATMR->IER.UI = 1; // Enable UI Interrupt + } + + GPIO_DAT_CLR(GPIO_TMR); +} + +void rtcTest(void) +{ + uint16_t rc32cal; + rtc_time_t time, alarm; + + GPIO_DIR_SET_LO(GPIO_RTC | GPIO_TMR | GPIO_RUN); + + // clk watch, rc32k calib + iospc_clkout(CLK_OUT_LSI); + + rc32k_conf(RCLK_HSE, RCAL_CYCLES(0x1F)); + for (uint8_t i = 0; i < RC32K_CAL_NB; i++) + { + GPIO_DAT_SET(GPIO_RUN); + rc32cal = rc32k_calib(); + GPIO_DAT_CLR(GPIO_RUN); + + debug("RC32K Cal%d:0x%X\r\n", i, rc32cal); + } + + // rtc enable, set alarm + rtc_conf(true); + rtc_alarm_set(RTC_ALARM_TIME); + NVIC_EnableIRQ(RTC_IRQn); + + // tmr enable + adtmr_init(TMR_PSC, TMR_ARR); + adtmr_ctrl(TMR_PERIOD_MODE, TMR_IR_UI_BIT); + NVIC_EnableIRQ(ATMR_IRQn); + + __enable_irq(); + + time = rtc_time_get(); + alarm = rtc_alarm_get(); + debug("0-RTC(Time:%d.%03d,Alarm:%d.%03d)\r\n", time.sec, time.ms, alarm.sec, alarm.ms); + + while (1) + { + GPIO_DAT_SET(GPIO_RUN); + + if (rtcFlg) + { + rtcFlg = false; + debug("TMR(Cnt:%03d,Val:0x%X)\r\n", tmrCnt, tmrVal); + + time = rtc_time_get(); + alarm = rtc_alarm_get(); + debug("1-RTC(Time:%d.%03d,Alarm:%d.%03d)\r\n", time.sec, time.ms, alarm.sec, alarm.ms); + } + + GPIO_DAT_CLR(GPIO_RUN); + } +} diff --git a/examples/sadcTest/mdk/JLinkSettings.ini b/examples/sadcTest/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/examples/sadcTest/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/examples/sadcTest/mdk/clean.bat b/examples/sadcTest/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/examples/sadcTest/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/examples/sadcTest/mdk/sadcTest.uvoptx b/examples/sadcTest/mdk/sadcTest.uvoptx new file mode 100644 index 0000000..29f6094 --- /dev/null +++ b/examples/sadcTest/mdk/sadcTest.uvoptx @@ -0,0 +1,352 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + sadcTest + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + DLGUARM + + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000) + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC5000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 0 + 1 + gBleSleep + + + + + 1 + 10 + 0x20005000 + 0 + + + + + 2 + 1 + 0x50000000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\src\sadc_test.c + sadc_test.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 5 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 6 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 4 + 7 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/examples/sadcTest/mdk/sadcTest.uvprojx b/examples/sadcTest/mdk/sadcTest.uvprojx new file mode 100644 index 0000000..60a01ed --- /dev/null +++ b/examples/sadcTest/mdk/sadcTest.uvprojx @@ -0,0 +1,445 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + sadcTest + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + sadcTest + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\mdk;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + sadc_test.c + 1 + ..\src\sadc_test.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/examples/sadcTest/src/cfg.h b/examples/sadcTest/src/cfg.h new file mode 100644 index 0000000..1c45b3d --- /dev/null +++ b/examples/sadcTest/src/cfg.h @@ -0,0 +1,25 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// Debug Mode: 0=Disable, 1=via UART, 2=RTT Viewer +#define DBG_MODE (1) +#define DBG_UART_BAUD (BRR_921600) + +#define DMA_USED (1) + +#if (DMA_USED) +#define SAMP_ADTMR (0) +#define SAMP_PCM (1) +#endif + +#endif //_APP_CFG_H_ diff --git a/examples/sadcTest/src/main.c b/examples/sadcTest/src/main.c new file mode 100644 index 0000000..3d6b472 --- /dev/null +++ b/examples/sadcTest/src/main.c @@ -0,0 +1,51 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +static void sysInit(void) +{ + // Todo config, if need + +} + +static void devInit(void) +{ + iwdt_disable(); + + dbgInit(); + + debug("SADC Test...\r"); +} + +extern void sadcTest(void); + +int main(void) +{ + sysInit(); + devInit(); + + sadcTest(); +} diff --git a/examples/sadcTest/src/sadc_test.c b/examples/sadcTest/src/sadc_test.c new file mode 100644 index 0000000..e678178 --- /dev/null +++ b/examples/sadcTest/src/sadc_test.c @@ -0,0 +1,147 @@ +/** + **************************************************************************************** + * + * @file sadc_test.c + * + * @brief SADC API usage demo. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +#if (DMA_USED) + #define DMA_CH_SADC (0) + #define ADC_SW_AUTO (0) // 0 - single, ((2 << 1) | 0x01) - 3ch switch + #define ADC_CH_CTRL ((SADC_CH_AIN7<<0) | (SADC_CH_AIN8<<4) | (SADC_CH_AIN9<<8)) + + #define GPIO_RX_PING GPIO12 + #define GPIO_RX_PONG GPIO13 + #if (SAMP_ADTMR) + #define PWM_TMR_PSC (0) + #define PWM_TMR_ARR (250 - 1) //249 64K, 999 16K + #define PA_ADTMR_CH0 (PA14) + #define PA_ADTMR_CH1 (PA15) + #endif + + #if (SAMP_PCM) + #define SAMP_NUM (128) + int16_t pcm_buff[SAMP_NUM*2]; // ping-pong + #else + #define SAMP_NUM (64) + uint16_t adc_buff[SAMP_NUM]; + #endif +#endif //(DMA_USED) + +void uartTxSend(const uint8_t *data, uint16_t len) +{ + while(len--) + { + uart_putc(0, *data++); + } +} +/* + * FUNCTIONS + **************************************************************************************** + */ + +#if (SAMP_ADTMR) +static void adtmr_pwm(void) +{ + RCC_APBCLK_EN(APB_ADTMR1_BIT); + iom_ctrl(PA_ADTMR_CH0, IOM_SEL_TIMER); + + pwm_init(PWM_ADTMR, PWM_TMR_PSC, PWM_TMR_ARR); + + pwm_chnl_cfg_t chnl_conf; + chnl_conf.duty = 50; + chnl_conf.ccer = PWM_CCER_SIPH | PWM_CCxDE_BIT; + chnl_conf.ccmr = PWM_CCMR_MODE1; + pwm_chnl_set(PWM_ADTMR_CH0, &chnl_conf); + + pwm_start(PWM_CTMR); +} +#endif + +void sadcTest(void) +{ + // Analog Enable + GPIO_DIR_CLR(GPIO08 | GPIO09 | GPIO10); + + // ADC + iom_ctrl(PA08, IOM_ANALOG); + iom_ctrl(PA09, IOM_ANALOG); + iom_ctrl(PA10, IOM_ANALOG); + + // sadc init + #if (SAMP_PCM) + sadc_init(SADC_ANA_DFLT | SADC_INBUF_BYPSS_BIT); + #else + sadc_init(SADC_ANA_DFLT); + #endif + +#if (DMA_USED) + GPIO_DIR_SET_LO(GPIO_RX_PING | GPIO_RX_PONG); + + dma_init(); + + DMA_SADC_INIT(DMA_CH_SADC); + #if (SAMP_PCM) + DMA_SADC_PCM_CONF(DMA_CH_SADC, pcm_buff, SAMP_NUM, CCM_PING_PONG); + DMA_SADC_PCM_CONF(DMA_CH_SADC | DMA_CH_ALT, pcm_buff+SAMP_NUM, SAMP_NUM, CCM_PING_PONG); + // .SADC_CLK_PH=1, .SADC_HPF_COEF=3, .SADC_AUX_CLK_DIV=0, .SADC_CONV_MODE=0 + sadc_conf((SADC_CR_DFLT & ~(SADC_CR_HPF_COEF_MSK|SADC_CR_CLK_DIV_MSK)) | SADC_CR_HPF(3) | SADC_CR_CLK(0)); + sadc_pcm(SADC_MIC_DFLT & (~SADC_PGA_VOL_MSK | SADC_PGA_VOL(0))); + #elif (SAMP_ADTMR) + DMA_SADC_AUX_CONF(DMA_CH_SADC, adc_buff, SAMP_NUM, CCM_BASIC); + sadc_adtmr(ADC_SW_AUTO, ADC_CH_CTRL); + #else + DMA_SADC_AUX_CONF(DMA_CH_SADC, adc_buff, SAMP_NUM, CCM_BASIC); + sadc_dma(ADC_SW_AUTO, ADC_CH_CTRL); + #endif + + while (1) + { + if (dma_chnl_done(DMA_CH_SADC)) + { + #if (SAMP_PCM) + if (dma_chnl_reload(DMA_CH_SADC)) + { + // Ping done pulse + GPIO_DAT_SET(GPIO_RX_PING); +// debug("PCM-Ping:\r\n"); + uartTxSend((uint8_t *)&pcm_buff, SAMP_NUM*2); + GPIO_DAT_CLR(GPIO_RX_PING); + } + else + { + // Pong done pulse + GPIO_DAT_SET(GPIO_RX_PONG); +// debug("PCM-Pong:\r\n"); + uartTxSend((uint8_t *)&pcm_buff[SAMP_NUM], SAMP_NUM*2); + GPIO_DAT_CLR(GPIO_RX_PONG); + } + #else + debug("DMA-Read:\r\n"); + debugHex(adc_buff, SAMP_NUM); + #endif + } + } +#else // !(DMA_USED) + for (uint8_t i = 0; i < 10; i++) + { + uint16_t adc_data = sadc_read(SADC_CH_AIN8, 0); + debug("adc_data:0x%x\r\n", adc_data); + } + + while (1); +#endif +} diff --git a/examples/spiMaster/mdk/JLinkSettings.ini b/examples/spiMaster/mdk/JLinkSettings.ini new file mode 100644 index 0000000..41e70d4 --- /dev/null +++ b/examples/spiMaster/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="CORTEX-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/examples/spiMaster/mdk/clean.bat b/examples/spiMaster/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/examples/spiMaster/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/examples/spiMaster/mdk/spiMst.uvoptx b/examples/spiMaster/mdk/spiMst.uvoptx new file mode 100644 index 0000000..1500af7 --- /dev/null +++ b/examples/spiMaster/mdk/spiMst.uvoptx @@ -0,0 +1,388 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + spiMst + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + DLGUARM + (106=-1,-1,-1,-1,0)(107=-1,-1,-1,-1,0) + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000) + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC5000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 0 + 1 + gBleSleep + + + 1 + 1 + IData + + + 2 + 1 + spim_rxd + + + 3 + 1 + SPIM + + + + + 0 + 2 + SPIM_TX_BUFF + + + + + 1 + 2 + 0x20003700 + 0 + + + + + 2 + 1 + 0x40004000 + 0 + + + + + 3 + 2 + 0x20003604 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + System Viewer\DMA + 35904 + + + System Viewer\DMACHCFG + 35905 + + + System Viewer\SPIM + 35903 + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\src\spim_test.c + spim_test.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 5 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 6 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 4 + 7 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/examples/spiMaster/mdk/spiMst.uvprojx b/examples/spiMaster/mdk/spiMst.uvprojx new file mode 100644 index 0000000..38051ec --- /dev/null +++ b/examples/spiMaster/mdk/spiMst.uvprojx @@ -0,0 +1,445 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + spiMst + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + spiMst + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\mdk;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + spim_test.c + 1 + ..\src\spim_test.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/examples/spiMaster/src/cfg.h b/examples/spiMaster/src/cfg.h new file mode 100644 index 0000000..abdec9b --- /dev/null +++ b/examples/spiMaster/src/cfg.h @@ -0,0 +1,25 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// Debug Mode: 0=Disable, 1=via UART, 2=RTT Viewer +#define DBG_MODE (1) + +#define SPI_DMA_MODE (1) // 1=DMA, 0=MCU +#define SPI_FLASH_OP (0) // 1=Flash, 0=Custom + +#define SPI_CS_PAD (10) +#define SPI_CLK_PAD (11) +#define SPI_MOSI_PAD (12) +#define SPI_MISO_PAD (13) + +#endif //_APP_CFG_H_ diff --git a/examples/spiMaster/src/main.c b/examples/spiMaster/src/main.c new file mode 100644 index 0000000..41d31ea --- /dev/null +++ b/examples/spiMaster/src/main.c @@ -0,0 +1,51 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +static void sysInit(void) +{ + // Todo config, if need + +} + +static void devInit(void) +{ + iwdt_disable(); + + // Init debug + dbgInit(); +} + +extern void spimTest(void); + +int main(void) +{ + sysInit(); + + devInit(); + + spimTest(); +} diff --git a/examples/spiMaster/src/spim_test.c b/examples/spiMaster/src/spim_test.c new file mode 100644 index 0000000..434afee --- /dev/null +++ b/examples/spiMaster/src/spim_test.c @@ -0,0 +1,267 @@ +/** + **************************************************************************************** + * + * @file spim_test.c + * + * @brief Demo of SPI Master Usage. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "regs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +#define BUFF_SIZE 16 + +uint8_t tx_buff[BUFF_SIZE]; +uint8_t rx_buff[BUFF_SIZE]; + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +#if (SPI_DMA_MODE) + +#define DMA_CHNL_TX 0 +#define DMA_CHNL_RX 1 + +#if (SPI_FLASH_OP) +static void spimProc(void) +{ + // spim test + debug("Read FlashID(cmd:0x9F, rxlen:3)\r\n"); + tx_buff[0] = 0x9F; + DMA_SPIM_TX_CONF(DMA_CHNL_TX, tx_buff, 1+3, CCM_BASIC); + DMA_SPIM_RX_CONF(DMA_CHNL_RX, rx_buff, 1+3, CCM_BASIC); + SPIM_CS_L(SPI_CS_PAD); + //spim_transimit(tx_buff, 1 + 3); + spim_begin(1+3); spim_wait(); + SPIM_CS_H(SPI_CS_PAD); + debugHex(rx_buff, BUFF_SIZE); + + debug("Flash Status(cmd:0x05, rxlen:1)\r\n"); + tx_buff[0] = 0x05; + DMA_SPIM_TX_CONF(DMA_CHNL_TX, tx_buff, 1+1, CCM_BASIC); + DMA_SPIM_RX_CONF(DMA_CHNL_RX, rx_buff, 1+1, CCM_BASIC); + SPIM_CS_L(SPI_CS_PAD); + //spim_transimit(tx_buff, 1 + 1); + spim_begin(1+1); spim_wait(); + SPIM_CS_H(SPI_CS_PAD); + debugHex(rx_buff, BUFF_SIZE); + + debug("Flash RD(cmd:0x03, adr:0x000000, datlen:8)\r\n"); + tx_buff[0] = 0x03; + tx_buff[1] = 0x00; + tx_buff[2] = 0x00; + tx_buff[3] = 0x00; + DMA_SPIM_TX_CONF(DMA_CHNL_TX, tx_buff, 1+3+8, CCM_BASIC); + DMA_SPIM_RX_CONF(DMA_CHNL_RX, rx_buff, 1+3+8, CCM_BASIC); + SPIM_CS_L(SPI_CS_PAD); + //spim_transimit(tx_buff, 1+3+8); + spim_begin(1+3+8); spim_wait(); + SPIM_CS_H(SPI_CS_PAD); + debugHex(rx_buff, BUFF_SIZE); + + while (1) + { + // empty + }; +} +#else +void spimProc(void) +{ + uint8_t tx_data = 0xFF; // 0xFF,0x00~0xFE + uint8_t rx_data = 0xFF; // 0xFF,0x00~0xFE + + while (1) + { + for (uint8_t i = 0; i < BUFF_SIZE; i++) + { + tx_buff[i] = tx_data++; + } + + DMA_SPIM_TX_CONF(DMA_CHNL_TX, tx_buff, BUFF_SIZE, CCM_BASIC); + DMA_SPIM_RX_CONF(DMA_CHNL_RX, rx_buff, BUFF_SIZE, CCM_BASIC); + SPIM_CS_L(SPI_CS_PAD); + spim_begin(BUFF_SIZE); spim_wait(); + SPIM_CS_H(SPI_CS_PAD); + + debug("TX: %02X ~ %02X, RX:\r\n", tx_buff[0], tx_buff[BUFF_SIZE-1]); + debugHex(rx_buff, BUFF_SIZE); + + for (uint8_t i = 0; i < BUFF_SIZE; i++) + { + if (rx_buff[i] != rx_data) + { + debug("RX Wrong(curr:%02X, expt:%02X)\r\n", rx_buff[i], rx_data); + while(1); + } + rx_data++; + } + } +} +#endif + +static void spimInit(void) +{ + dma_init(); + + // spim init + SPIM_CS_INIT(SPI_CS_PAD); + spim_init(SPI_CLK_PAD, SPI_MISO_PAD, SPI_MOSI_PAD); + // spim conf(dma mode) + spim_conf(SPIM_CR_DFLT | SPIM_CR_RX_DMA_BIT | SPIM_CR_TX_DMA_BIT); + + // dma channel + DMA_SPIM_TX_INIT(DMA_CHNL_TX); + DMA_SPIM_RX_INIT(DMA_CHNL_RX); +} + +#else //(SPIM_MCU_MODE) + +#if (SPI_FLASH_OP) +#define HALF_DUPLEX 1 + +static void spimProc(void) +{ + // spim test + debug("Read FlashID(cmd:0x9F, rxlen:3)\r\n"); + tx_buff[0] = 0x9F; + SPIM_CS_L(SPI_CS_PAD); + #if (HALF_DUPLEX) + spim_halfdx(tx_buff, 1, rx_buff, 3); + #else + spim_duplex(tx_buff, rx_buff, 1 + 3); + #endif + SPIM_CS_H(SPI_CS_PAD); + debugHex(rx_buff, 4); + + #if (SPIM_FSH_WR) + debug("Flash WR_EN(cmd:0x06, rxlen:0)\r\n"); + tx_buff[0] = 0x06; + SPIM_CS_L(SPI_CS_PAD); + #if (HALF_DUPLEX) + spim_halfdx(tx_buff, 1, rx_buff, 0); + #else + spim_duplex(tx_buff, rx_buff, 1); + #endif + SPIM_CS_H(SPI_CS_PAD); + debugHex(rx_buff, 1); + + debug("Flash WR(cmd:0x02, adr:0x000000, datlen:4)\r\n"); + tx_buff[0] = 0x02; + tx_buff[1] = 0x04; + tx_buff[2] = 0x00; + tx_buff[3] = 0x00; + SPIM_CS_L(SPI_CS_PAD); + #if (HALF_DUPLEX) + spim_halfdx(tx_buff, 8, rx_buff, 0); + #else + spim_duplex(tx_buff, rx_buff, 1+3+4); + #endif + SPIM_CS_H(SPI_CS_PAD); + debugHex(rx_buff, 8); + + bootDelayMs(10); + #endif + + debug("Flash Status(cmd:0x05, rxlen:1)\r\n"); + tx_buff[0] = 0x05; + SPIM_CS_L(SPI_CS_PAD); + #if (HALF_DUPLEX) + spim_halfdx(tx_buff, 1, rx_buff, 1); + #else + spim_duplex(tx_buff, rx_buff, 1 + 1); + #endif + SPIM_CS_H(SPI_CS_PAD); + debugHex(rx_buff, 2); + + debug("Flash RD(cmd:0x03, adr:0x000000, datlen:8)\r\n"); + tx_buff[0] = 0x03; + tx_buff[1] = 0x00; + tx_buff[2] = 0x00; + tx_buff[3] = 0x00; + SPIM_CS_L(SPI_CS_PAD); + #if (HALF_DUPLEX) + spim_halfdx(tx_buff, 4, rx_buff, 8); + #else + spim_duplex(tx_buff, rx_buff, 1+3+8); + #endif + SPIM_CS_H(SPI_CS_PAD); + debugHex(rx_buff, 8); + + while (1) + { + // empty + }; +} +#else +void spimProc(void) +{ + uint8_t tx_data = 0xFF; // 0xFF,0x00~0xFE + uint8_t rx_data = 0xFF; // 0xFF,0x00~0xFE + + while (1) + { + for (uint8_t i = 0; i < BUFF_SIZE; i++) + { + tx_buff[i] = tx_data++; + } + + SPIM_CS_L(SPI_CS_PAD); + spim_duplex(tx_buff, rx_buff, BUFF_SIZE); + SPIM_CS_H(SPI_CS_PAD); + + debug("TX: %02X ~ %02X, RX:\r\n", tx_buff[0], tx_buff[BUFF_SIZE-1]); + debugHex(rx_buff, BUFF_SIZE); + + for (uint8_t i = 0; i < BUFF_SIZE; i++) + { + if (rx_buff[i] != rx_data) + { + debug("RX Wrong(curr:%02X, expt:%02X)\r\n", rx_buff[i], rx_data); + while(1); + } + rx_data++; + } + } +} +#endif + +static void spimInit(void) +{ + // spim init + SPIM_CS_INIT(SPI_CS_PAD); + spim_init(SPI_CLK_PAD, SPI_MISO_PAD, SPI_MOSI_PAD); + + // spim conf + spim_conf(SPIM_CR_DFLT); +} + +#endif + +void spimTest(void) +{ + debug("spimTest Start...\r\n"); + + // init buff + for (uint8_t idx = 0; idx < BUFF_SIZE; idx++) + { + tx_buff[idx] = 0xFF; + rx_buff[idx] = 0x00; + } + + spimInit(); + + spimProc(); +} diff --git a/examples/spiSlave/mdk/JLinkSettings.ini b/examples/spiSlave/mdk/JLinkSettings.ini new file mode 100644 index 0000000..41e70d4 --- /dev/null +++ b/examples/spiSlave/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="CORTEX-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/examples/spiSlave/mdk/clean.bat b/examples/spiSlave/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/examples/spiSlave/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/examples/spiSlave/mdk/spiSlv.uvoptx b/examples/spiSlave/mdk/spiSlv.uvoptx new file mode 100644 index 0000000..6dba655 --- /dev/null +++ b/examples/spiSlave/mdk/spiSlv.uvoptx @@ -0,0 +1,388 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + spiSlv + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + DLGUARM + (106=-1,-1,-1,-1,0)(107=-1,-1,-1,-1,0) + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000) + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC5000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 0 + 1 + gBleSleep + + + 1 + 1 + IData + + + 2 + 1 + spim_rxd + + + 3 + 1 + SPIM + + + + + 0 + 2 + SPIM_TX_BUFF + + + + + 1 + 2 + 0x20003700 + 0 + + + + + 2 + 1 + 0x40004000 + 0 + + + + + 3 + 2 + 0x20003604 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + System Viewer\DMA + 35904 + + + System Viewer\DMACHCFG + 35905 + + + System Viewer\SPIM + 35903 + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\src\spis_test.c + spis_test.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 5 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 6 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 4 + 7 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/examples/spiSlave/mdk/spiSlv.uvprojx b/examples/spiSlave/mdk/spiSlv.uvprojx new file mode 100644 index 0000000..c4914bd --- /dev/null +++ b/examples/spiSlave/mdk/spiSlv.uvprojx @@ -0,0 +1,445 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + spiSlv + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + spiSlv + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\mdk;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + spis_test.c + 1 + ..\src\spis_test.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/examples/spiSlave/src/cfg.h b/examples/spiSlave/src/cfg.h new file mode 100644 index 0000000..27d136f --- /dev/null +++ b/examples/spiSlave/src/cfg.h @@ -0,0 +1,24 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// Debug Mode: 0=Disable, 1=via UART, 2=RTT Viewer +#define DBG_MODE (1) + +#define SPI_DMA_MODE (0) // 1=DMA, 0=MCU + +#define SPI_CS_PAD (10) +#define SPI_CLK_PAD (11) +#define SPI_MOSI_PAD (12) +#define SPI_MISO_PAD (13) + +#endif //_APP_CFG_H_ diff --git a/examples/spiSlave/src/main.c b/examples/spiSlave/src/main.c new file mode 100644 index 0000000..e84e3f8 --- /dev/null +++ b/examples/spiSlave/src/main.c @@ -0,0 +1,51 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +static void sysInit(void) +{ + // Todo config, if need + +} + +static void devInit(void) +{ + iwdt_disable(); + + // Init debug + dbgInit(); +} + +extern void spisTest(void); + +int main(void) +{ + sysInit(); + + devInit(); + + spisTest(); +} diff --git a/examples/spiSlave/src/spis_test.c b/examples/spiSlave/src/spis_test.c new file mode 100644 index 0000000..ab3f0fa --- /dev/null +++ b/examples/spiSlave/src/spis_test.c @@ -0,0 +1,134 @@ +/** + **************************************************************************************** + * + * @file spis_test.c + * + * @brief Demo of SPI Slave Usage. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" + + +#if (SPI_DMA_MODE) + +/// Channel of DMA +#define DMA_CHNL_TX 0 +#define DMA_CHNL_RX 1 + +#define BUFF_SIZE 16 + +uint8_t tx_buff[BUFF_SIZE]; +uint8_t rx_buff[BUFF_SIZE]; + +static void spisProc(void) +{ + // slave auto-send 0xFF when connect, so master send 0xFF first, then TX/RX 0x00~0xFF keep same! + uint8_t tx_data = 0x00; + uint8_t rx_data = 0xFF; + + for (uint8_t i = 0; i < BUFF_SIZE; i++) + { + tx_buff[i] = tx_data++; + } + + DMA_SPIS_RX_CONF(DMA_CHNL_RX, rx_buff, BUFF_SIZE, CCM_BASIC); + DMA_SPIS_TX_CONF(DMA_CHNL_TX, tx_buff, BUFF_SIZE, CCM_BASIC); + + debug("DMA Remain(TX:%d,RX:%d)\r\n", dma_chnl_remain(DMA_CHNL_TX), dma_chnl_remain(DMA_CHNL_RX)); + + while (1) + { + if (dma_chnl_done(DMA_CHNL_RX)) + { + for (uint8_t i = 0; i < BUFF_SIZE; i++) + { + if (rx_buff[i] != rx_data) + { + debug("RX Wrong(curr:%02X, expt:%02X)\r\n", rx_buff[i], rx_data); + debugHex(rx_buff, BUFF_SIZE); + while (1); + } + rx_data++; + } + + dma_chnl_reload(DMA_CHNL_RX); + } + + if (dma_chnl_done(DMA_CHNL_TX)) + { + for (uint8_t i = 0; i < BUFF_SIZE; i++) + { + tx_buff[i] = tx_data++; + } + + dma_chnl_reload(DMA_CHNL_TX); + } + } +} + +static void spisInit(void) +{ + dma_init(); + + // spis init + spis_init(SPI_CS_PAD, SPI_CLK_PAD, SPI_MISO_PAD, SPI_MOSI_PAD); + + // spis conf + spis_conf(SPIS_CR_DFLT | SPIS_CR_TX_DMA_BIT | SPIS_CR_RX_DMA_BIT); + + // dma channel + DMA_SPIS_TX_INIT(DMA_CHNL_TX); + DMA_SPIS_RX_INIT(DMA_CHNL_RX); +} + +#else //(SPIM_MCU_MODE) + +static void spisProc(void) +{ + // slave auto-send 0xFF when connect, so master send 0xFF first, then TX/RX 0x00~0xFF keep same! + uint8_t tx_data = 0x00; + uint8_t rx_data = 0xFF; + uint8_t rx_curr; + + debug("SPI getc & putc\r\n"); + + while (1) + { + if (spis_getc(&rx_curr)) + { + if (rx_curr != rx_data) + { + debug("RX Wrong(curr:%02X, expt:%02X), TX:%02X\r\n", rx_curr, rx_data, tx_data); + while (1); + } + + rx_data++; + } + + spis_putc(tx_data++); + } +} + +static void spisInit(void) +{ + // spis init + spis_init(SPI_CS_PAD, SPI_CLK_PAD, SPI_MISO_PAD, SPI_MOSI_PAD); + + // spis conf + spis_conf(SPIS_CR_DFLT); +} + +#endif + +void spisTest(void) +{ + debug("spisTest Start...\r\n"); + + spisInit(); + + spisProc(); +} diff --git a/examples/uartTest/mdk/JLinkSettings.ini b/examples/uartTest/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/examples/uartTest/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/examples/uartTest/mdk/clean.bat b/examples/uartTest/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/examples/uartTest/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/examples/uartTest/mdk/uartTest.uvoptx b/examples/uartTest/mdk/uartTest.uvoptx new file mode 100644 index 0000000..1f42120 --- /dev/null +++ b/examples/uartTest/mdk/uartTest.uvoptx @@ -0,0 +1,363 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + uartTest + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + DLGUARM + + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000) + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC5000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 0 + 1 + gBleSleep + + + 1 + 1 + DMA_RX_BUFF + + + + + 1 + 10 + 0x20005000 + 0 + + + + + 2 + 1 + 0x50000000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + System Viewer\UART1 + 35905 + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\src\uart_test.c + uart_test.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 5 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 6 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 4 + 7 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/examples/uartTest/mdk/uartTest.uvprojx b/examples/uartTest/mdk/uartTest.uvprojx new file mode 100644 index 0000000..35fb528 --- /dev/null +++ b/examples/uartTest/mdk/uartTest.uvprojx @@ -0,0 +1,445 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + uartTest + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + uartTest + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\mdk;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + uart_test.c + 1 + ..\src\uart_test.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/examples/uartTest/src/cfg.h b/examples/uartTest/src/cfg.h new file mode 100644 index 0000000..5344d87 --- /dev/null +++ b/examples/uartTest/src/cfg.h @@ -0,0 +1,20 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// Debug Mode: 0=Disable, 1=via UART, 2=RTT Viewer +#define DBG_MODE (1) + +#define UART_IRQ_MODE (0) +#define UART_RTS_CTRL (1) + +#endif //_APP_CFG_H_ diff --git a/examples/uartTest/src/main.c b/examples/uartTest/src/main.c new file mode 100644 index 0000000..5d844db --- /dev/null +++ b/examples/uartTest/src/main.c @@ -0,0 +1,52 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +static void sysInit(void) +{ + // Todo config, if need + +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + iwdt_disable(); + + dbgInit(); + debug("Start(rsn:0x%X)...\r\n", rsn); +} + +extern void uartTest(void); + +int main(void) +{ + sysInit(); + devInit(); + + uartTest(); +} diff --git a/examples/uartTest/src/uart_test.c b/examples/uartTest/src/uart_test.c new file mode 100644 index 0000000..74eee36 --- /dev/null +++ b/examples/uartTest/src/uart_test.c @@ -0,0 +1,66 @@ +/** + **************************************************************************************** + * + * @file uart_test.c + * + * @brief Demo of uart usage. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Uart Port and Params +#define TEST_PORT UART1_PORT +#define TEST_BAUD BRR_DIV(115200, 16M) +#define TEST_LCRS LCR_BITS(8, 1, none) + +/// Avoid conflict GPIOs of UART_DBG if diff port +#define PA_UART_TX (6) +#define PA_UART_RX (7) +#define PA_UART_RTS (14) +#define PA_UART_CTS (15) + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +static void uartInit(void) +{ + #if !((DBG_MODE == 1) && (TEST_PORT == UART1_PORT)) + uart_init(TEST_PORT, PA_UART_TX, PA_UART_RX); + uart_conf(TEST_PORT, TEST_BAUD, TEST_LCRS); + #endif + + #if (UART_IRQ_MODE) + uart_fctl(TEST_PORT, FCR_FIFOEN_BIT | FCR_RXTL_8BYTE, 20, UART_IR_RXRD_BIT | UART_IR_RTO_BIT); + #endif + + #if (UART_RTS_CTRL) + uart_hwfc(TEST_PORT, PA_UART_RTS, PA_UART_CTS); + #endif +} + +void uartTest(void) +{ + uint8_t rx_data; + + uartInit(); + + while (1) + { + // loopback Test + rx_data = uart_getc(TEST_PORT); + uart_putc(TEST_PORT, rx_data); + } +} diff --git a/examples/usb2hid/mdk/JLinkSettings.ini b/examples/usb2hid/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/examples/usb2hid/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/examples/usb2hid/mdk/clean.bat b/examples/usb2hid/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/examples/usb2hid/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/examples/usb2hid/mdk/usb2hid.uvoptx b/examples/usb2hid/mdk/usb2hid.uvoptx new file mode 100644 index 0000000..00bf637 --- /dev/null +++ b/examples/usb2hid/mdk/usb2hid.uvoptx @@ -0,0 +1,349 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + usb2hid + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC5000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS020003600 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000) + + + + + 0 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\src\hid_boot.c + hid_boot.c + 0 + 0 + + + 2 + 5 + 1 + 0 + 0 + 0 + ..\src\hid_custom.c + hid_custom.c + 0 + 0 + + + + + usbd + 1 + 0 + 0 + 0 + + 3 + 6 + 5 + 0 + 0 + 0 + ..\..\..\usb\api\usbd.h + usbd.h + 0 + 0 + + + 3 + 7 + 4 + 0 + 0 + 0 + ..\..\..\usb\lib\usbd.lib + usbd.lib + 0 + 0 + + + 3 + 8 + 1 + 0 + 0 + 0 + ..\..\..\usb\class\hid\usbd_hid.c + usbd_hid.c + 0 + 0 + + + + + drivers + 0 + 0 + 0 + 0 + + 4 + 9 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 4 + 10 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + debug + 0 + 0 + 0 + 0 + + 5 + 11 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/examples/usb2hid/mdk/usb2hid.uvprojx b/examples/usb2hid/mdk/usb2hid.uvprojx new file mode 100644 index 0000000..d252ce0 --- /dev/null +++ b/examples/usb2hid/mdk/usb2hid.uvprojx @@ -0,0 +1,470 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + usb2hid + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + usb2hid + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\usb\api;..\..\..\usb\class\hid + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_sram.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + hid_boot.c + 1 + ..\src\hid_boot.c + + + hid_custom.c + 1 + ..\src\hid_custom.c + + + + + usbd + + + usbd.h + 5 + ..\..\..\usb\api\usbd.h + + + usbd.lib + 4 + ..\..\..\usb\lib\usbd.lib + + + usbd_hid.c + 1 + ..\..\..\usb\class\hid\usbd_hid.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/examples/usb2hid/src/cfg.h b/examples/usb2hid/src/cfg.h new file mode 100644 index 0000000..594a477 --- /dev/null +++ b/examples/usb2hid/src/cfg.h @@ -0,0 +1,39 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +#define DEMO_HID_BOOT (1) +#define DEMO_HID_CUSTOM (0) + +#if (DEMO_HID_BOOT + DEMO_HID_CUSTOM != 1) +#error "Select only 1 demo to test!" +#endif + +/// System Clock(0=16MHz, 1=32MHz, 2=48MHz, 3=64MHz) +#define SYS_CLK (2) + +/// Debug Mode: 0=Disable, 1=via UART, 2=RTT Viewer +#define DBG_MODE (1) + +#define DBG_UART_TXD (17) // PA17 +#define DBG_UART_RXD (18) // PA18 + +/// USB Debug Level: 0=Disable, 1=Error, 2=Warning +#if (DBG_MODE) +#define USB_DBG_LEVEL (1) +#endif + +#if (DEMO_HID_BOOT) +#define USE_KEYS (0) +#endif + +#endif //_APP_CFG_H_ diff --git a/examples/usb2hid/src/hid_boot.c b/examples/usb2hid/src/hid_boot.c new file mode 100644 index 0000000..958fa14 --- /dev/null +++ b/examples/usb2hid/src/hid_boot.c @@ -0,0 +1,453 @@ +#include "usbd.h" +#include "usbd_hid.h" +#include "keys.h" +#include "drvs.h" + +#if (DEMO_HID_BOOT) + +#define USBD_BCD USB_1_1 // Version +#define USBD_VID 0xFFFF // Vendor ID +#define USBD_PID 0xFFF0 // Product ID +#define USBD_MAX_POWER 100 // unit in mA +#define USBD_LANGID_STRING 0x0409 // English(US) + +#define ENB_KEYBD 0 +#define ENB_MOUSE 1 + +#if ((ENB_KEYBD > 1) || (ENB_MOUSE > 1) || (ENB_KEYBD+ENB_MOUSE == 0)) +#error "The Count of HID Interface be 1 or 2." +#endif + + +/* + * Descriptor + **************************************************************************** + */ + +/*!< count of hid interface descriptor */ +#define USB_HID_INTF_CNT (ENB_KEYBD + ENB_MOUSE) +#define USB_HID_INTF_END (USB_HID_INTF_CNT - 1) + +/*!< config descriptor size (only in endpoint) */ +#define USB_HID_CONFIG_SIZE (9+(18+7)*USB_HID_INTF_CNT) + +#if (ENB_KEYBD) +/*!< keyboard interface config */ +#define KEYBD_INTF_NUM 0 +#define KEYBD_IN_EP 0x82 // USB_FIFO_BUG - avoid 0x81 +#define KEYBD_IN_EP_SIZE 8 +#define KEYBD_IN_EP_INTERVAL 10 +#define KEYBD_REPORT_DESC_SIZE sizeof(hid_keybd_report_desc) + +/*!< keyboard report descriptor */ +static const uint8_t hid_keybd_report_desc[] = { + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x06, // USAGE (Keyboard) + 0xa1, 0x01, // COLLECTION (Application) + 0x05, 0x07, // USAGE_PAGE (Keyboard) + 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl) + 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0x01, // LOGICAL_MAXIMUM (1) + 0x75, 0x01, // REPORT_SIZE (1) + 0x95, 0x08, // REPORT_COUNT (8) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0x95, 0x01, // REPORT_COUNT (1) + 0x75, 0x08, // REPORT_SIZE (8) + 0x81, 0x03, // INPUT (Cnst,Var,Abs) + 0x95, 0x05, // REPORT_COUNT (5) + 0x75, 0x01, // REPORT_SIZE (1) + 0x05, 0x08, // USAGE_PAGE (LEDs) + 0x19, 0x01, // USAGE_MINIMUM (Num Lock) + 0x29, 0x05, // USAGE_MAXIMUM (Kana) + 0x91, 0x02, // OUTPUT (Data,Var,Abs) + 0x95, 0x01, // REPORT_COUNT (1) + 0x75, 0x03, // REPORT_SIZE (3) + 0x91, 0x03, // OUTPUT (Cnst,Var,Abs) + 0x95, 0x06, // REPORT_COUNT (6) + 0x75, 0x08, // REPORT_SIZE (8) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0xFF, // LOGICAL_MAXIMUM (255) + 0x05, 0x07, // USAGE_PAGE (Keyboard) + 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated)) + 0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application) + 0x81, 0x00, // INPUT (Data,Ary,Abs) + 0xc0 // END_COLLECTION +}; +#endif + +#if (ENB_MOUSE) +/*!< mouse interface config */ +#define MOUSE_INTF_NUM (0 + ENB_KEYBD) +#define MOUSE_IN_EP (0x82 + ENB_KEYBD) // USB_FIFO_BUG - avoid 0x81 +#define MOUSE_IN_EP_SIZE 4 +#define MOUSE_IN_EP_INTERVAL 1 //10 +#define MOUSE_REPORT_DESC_SIZE sizeof(hid_mouse_report_desc) + +/*!< mouse report descriptor */ +static const uint8_t hid_mouse_report_desc[] = { + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x02, // USAGE (Mouse) + 0xA1, 0x01, // COLLECTION (Application) + 0x09, 0x01, // USAGE (Pointer) + 0xA1, 0x00, // COLLECTION (Physical) + 0x05, 0x09, // USAGE_PAGE (Button) + 0x19, 0x01, // USAGE_MINIMUM (Button 1) + 0x29, 0x03, // USAGE_MAXIMUM (Button 3) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0x01, // LOGICAL_MAXIMUM (1) + 0x95, 0x03, // REPORT_COUNT (3) + 0x75, 0x01, // REPORT_SIZE (1) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0x95, 0x01, // REPORT_COUNT (1) + 0x75, 0x05, // REPORT_SIZE (5) + 0x81, 0x01, // INPUT (Cnst,Var,Abs) + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x30, // USAGE (X) + 0x09, 0x31, // USAGE (Y) + 0x09, 0x38, + 0x15, 0x81, // LOGICAL_MINIMUM (-127) + 0x25, 0x7F, // LOGICAL_MAXIMUM (127) + 0x75, 0x08, // REPORT_SIZE (8) + 0x95, 0x03, // REPORT_COUNT (2) + 0x81, 0x06, // INPUT (Data,Var,Rel) + 0xC0, + 0x09, 0x3c, + 0x05, 0xff, + 0x09, 0x01, + 0x15, 0x00, + 0x25, 0x01, + 0x75, 0x01, + 0x95, 0x02, + 0xb1, 0x22, + 0x75, 0x06, + 0x95, 0x01, + 0xb1, 0x01, + 0xc0 // END_COLLECTION +}; + +#if (COPY_MOUSE) +static const uint8_t hid_mouse_report_desc[] = { + 0x05, 0x01, + 0x09, 0x02, + 0xA1, 0x01, + 0x09, 0x01, + 0xA1, 0x00, + 0x05, 0x09, + 0x19, 0x01, + 0x29, 0x03, + 0x15, 0x00, + 0x25, 0x01, + 0x75, 0x01, + 0x95, 0x03, + 0x81, 0x02, + 0x75, 0x05, + 0x95, 0x01, + 0x81, 0x01, + 0x05, 0x01, + 0x09, 0x30, + 0x09, 0x31, + 0x09, 0x38, + 0x15, 0x81, + 0x25, 0x7F, + 0x75, 0x08, + 0x95, 0x03, + 0x81, 0x06, + 0xC0, + 0xC0 +}; + +static const uint8_t hid_descriptor[] = { + 0x12, 0x01, 0x10, 0x01, 0x00, 0x00, 0x00, 0x08, 0x3A, 0x09, 0x12, 0x25, 0x00, 0x01, 0x01, 0x02, 0x00, 0x01, + 0x09, 0x02, 0x22, 0x00, 0x01, 0x01, 0x00, 0xE0, 0x32, 0x09, 0x04, 0x00, 0x00, 0x01, 0x03, 0x01, 0x02, 0x00, 0x09, 0x21, 0x11, 0x01, 0x00, 0x01, 0x22, 0x34, 0x00, 0x07, 0x05, 0x81, 0x03, 0x04, 0x00, 0x0A, + 0x04, 0x03, 0x09, 0x04, + 0x0E, 0x03, 0x50, 0x00, 0x69, 0x00, 0x78, 0x00, 0x41, 0x00, 0x72, 0x00, 0x74, 0x00, + 0x24, 0x03, 0x55, 0x00, 0x53, 0x00, 0x42, 0x00, 0x20, 0x00, 0x4F, 0x00, 0x70, 0x00, 0x74, 0x00, 0x69, 0x00, 0x63, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x20, 0x00, 0x4D, 0x00, 0x6F, 0x00, 0x75, 0x00, 0x73, 0x00, 0x65, 0x00, + /* Descriptor - EOF */ + 0x00 +}; +#endif + +#endif + +/*!< hid device descriptor */ +static const uint8_t hid_descriptor[] = { + /* Descriptor - Device (Size:18) */ + USB_DEVICE_DESCRIPTOR_INIT(USBD_BCD, 0x00, 0x00, 0x00, USBD_VID, USBD_PID, 0x0002, 0x01), + + /* Descriptor - Configuration (Total Size:9+Intf_Size) */ + USB_CONFIG_DESCRIPTOR_INIT(USB_HID_CONFIG_SIZE, USB_HID_INTF_CNT, + 0x01, USB_CONFIG_BUS_POWERED | USB_CONFIG_REMOTE_WAKEUP, USBD_MAX_POWER), + + #if (ENB_KEYBD) + /* Descriptor - Keyboard Interface (Size:18+7*1) */ + HID_INTERFACE_INIT(KEYBD_INTF_NUM, 1, HID_SUBCLASS_BOOTIF, HID_PROTOCOL_KEYBOARD, 0, KEYBD_REPORT_DESC_SIZE), + HID_ENDPOINT_DESC(KEYBD_IN_EP, KEYBD_IN_EP_SIZE, KEYBD_IN_EP_INTERVAL), + #endif + + #if (ENB_MOUSE) + /* Descriptor - Mouse Interface (Size:18+7*1) */ + HID_INTERFACE_INIT(MOUSE_INTF_NUM, 1, HID_SUBCLASS_BOOTIF, HID_PROTOCOL_MOUSE, 0, MOUSE_REPORT_DESC_SIZE), + HID_ENDPOINT_DESC(MOUSE_IN_EP, MOUSE_IN_EP_SIZE, MOUSE_IN_EP_INTERVAL), + #endif + + /* Descriptor - String */ + // String0 - Language ID (Size:4) + USB_LANGID_INIT(USBD_LANGID_STRING), + + // String1 - iManufacturer + 0x02, /* bLength */ + USB_DESC_TYPE_STRING, /* bDescriptorType */ + + // String2 - iProduct + 0x16, /* bLength */ + USB_DESC_TYPE_STRING, /* bDescriptorType */ + WCHAR('U'), + WCHAR('S'), + WCHAR('B'), + WCHAR('2'), + WCHAR('.'), + WCHAR('0'), + WCHAR(' '), + WCHAR('H'), + WCHAR('I'), + WCHAR('D'), + + // String3 - iSerialNumber +// 0x10, /* bLength */ +// USB_DESC_TYPE_STRING, /* bDescriptorType */ +// WCHAR('6'), +// WCHAR('.'), +// WCHAR('2'), +// WCHAR('2'), +// WCHAR('.'), +// WCHAR('0'), +// WCHAR('7'), + + /* Descriptor - Device Qualifier (Size:10) */ + #if (USBD_BCD == USB_2_0) + USB_QUALIFIER_INIT(0x01), + #endif + + /* Descriptor - EOF */ + 0x00 +}; + + +/* + * Configuration + **************************************************************************** + */ + +/*!< table of hid interface */ +static const hid_intf_t hid_interface[] = { + #if (ENB_KEYBD) + HID_INTF_T(KEYBD_INTF_NUM, KEYBD_IN_EP, hid_keybd_report_desc), + #endif + #if (ENB_MOUSE) + HID_INTF_T(MOUSE_INTF_NUM, MOUSE_IN_EP, hid_mouse_report_desc), + #endif +}; + +/*!< table of endpoints */ +static const usbd_ep_t endpoint_tab[] = { + #if (ENB_KEYBD) + USBD_EP_T(KEYBD_IN_EP, USB_EP_TYPE_INTERRUPT, KEYBD_IN_EP_SIZE, &usbd_hid_ep_in_handler), + #endif + #if (ENB_MOUSE) + USBD_EP_T(MOUSE_IN_EP, USB_EP_TYPE_INTERRUPT, MOUSE_IN_EP_SIZE, &usbd_hid_ep_in_handler), + #endif +}; + +/*!< table of class */ +static const usbd_class_t class_tab[] = { + USBD_CLASS_T(0, USB_HID_INTF_END, &usbd_hid_class_handler), +}; + +/*!< USBD Configuration */ +static const usbd_config_t hid_configuration[] = { + USBD_CONFIG_T(1, USB_HID_INTF_CNT, class_tab, endpoint_tab) +}; + + +/* + * Handlers + **************************************************************************** + */ + +bool suspend = false; + +__USBIRQ void usbd_notify_handler(uint8_t event, void *arg) +{ + switch (event) { + case USBD_EVENT_RESET: + suspend = false; + usbd_hid_reset(); + break; + case USBD_EVENT_RESUME: + case USBD_EVENT_CLR_REMOTE_WAKEUP: + suspend = false; + break; + case USBD_EVENT_SUSPEND: + suspend = true; + break; + + default: + break; + } +} + + +/* + * Test Functions + **************************************************************************** + */ + +uint8_t hid_keybd_send_report(uint8_t code) +{ + uint8_t ret = 0; + + #if (ENB_KEYBD) + uint8_t kyebd_report[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; //A + + kyebd_report[2] = code; + + ret = usbd_hid_send_report(KEYBD_IN_EP, 8, kyebd_report); + USB_LOG_RAW("keybd(k:%d,ret:%d)\r\n", code, ret); + #endif + + return ret; +} + +uint8_t hid_mouse_send_report(int8_t x) +{ + uint8_t ret = 0; + + #if (ENB_MOUSE) + uint8_t mouse_report[4] = {0x00/*btns*/, 0/*x*/, 0/*y*/, 0/*wheel*/}; + + mouse_report[1] = x; + ret = usbd_hid_send_report(MOUSE_IN_EP, 4, mouse_report); + USB_LOG_RAW("mouse(x:%d,ret:%d)\r\n", mouse_report[1],ret); + #endif + + return ret; +} + +#if (USE_KEYS) +void hid_wakeup(void) +{ + if (suspend && usbd_resume(1)) + { + btmr_delay(48000, 30); + usbd_resume(0); + } +} + +void usbd_hid_leds(uint8_t leds) +{ + if (leds & 0x02/*CAPS_LOCK*/) + GPIO_DAT_CLR(LED2); + else + GPIO_DAT_SET(LED2); +} + +void usbdTest(void) +{ + // keys_scan to send report + static uint16_t btn_lvl = BTNS; + uint8_t ret = 0; + uint16_t value = GPIO_PIN_GET() & BTNS; + uint16_t chng = btn_lvl ^ value; + btn_lvl = value; + + if (chng) { + uint8_t code = 0; + + hid_wakeup(); + + if ((chng & BTN1) && ((value & BTN1) == 0)) { + code = 4;//HID_KEY_A; //code = 40;//HID_KEY_ENTER; + } + if ((chng & BTN2) && ((value & BTN2) == 0)) { + code = 5;//HID_KEY_B; //code = 82;//HID_KEY_UP; + } + if ((chng & BTN3) && ((value & BTN3) == 0)) { + code = 6;//HID_KEY_C; //code = 81;//HID_KEY_DOWN; + } + + debug("keys(val:%X,chng:%X,code:%d)\r\n", btn_lvl, chng, code); + ret = hid_keybd_send_report(code); + if (ret != 0) { + debug("keys Fail(sta:%d)\r\n", ret); + } + + if (code) { + GPIO_DAT_CLR(LED1); + hid_mouse_send_report(10); + } + else { + GPIO_DAT_SET(LED1); + hid_mouse_send_report(-10); + } + } +} +#else +void usbdTest(void) +{ + // circle polling to send report + static uint8_t keynum = 0; + uint8_t ret; + + if (!usbd_is_configured()) + return; + + #if (ENB_KEYBD) + /*!< keyboard test */ + { + uint8_t kyebd_report[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; //A + if ((keynum % 2) == 0) + kyebd_report[2] = HID_KEY_A + keynum/2; + + ret = usbd_hid_send_report(KEYBD_IN_EP, 8, kyebd_report); + USB_LOG_RAW("hid_keybd(key:%d,ret:%d)\r\n", keynum, ret); + } + #endif + #if (ENB_MOUSE) + /*!< mouse test */ + { + uint8_t mouse_report[4] = {0x00/*btns*/, 0/*x*/, 0/*y*/, 0/*wheel*/}; + //if ((keynum % 2) == 0) + // mouse_report[1] = 8; + //else + // mouse_report[1] = -8; + mouse_report[1] = keynum; + mouse_report[2] = keynum; + ret = usbd_hid_send_report(MOUSE_IN_EP, 4, mouse_report); + USB_LOG_RAW("hid_mouse(x:%d,ret:%d)\r\n", mouse_report[1],ret); + } + #endif + + if (ret == USBD_OK) { + //if (++keynum > 94*2) keynum = 0; + GPIO_DAT_SET(GPIO17); + ++keynum; + GPIO_DAT_CLR(GPIO17); + } +} +#endif + +void usbdInit(void) +{ + usbd_init(); + usbd_register(hid_descriptor, hid_configuration); + + for (uint8_t idx = 0; idx < USB_HID_INTF_CNT; idx++) { + usbd_hid_init(idx, &hid_interface[idx]); + } + + keys_init(); + GPIO_DIR_SET_LO(GPIO17 | GPIO18); +} + +#endif // (DEMO_HID_BOOT) diff --git a/examples/usb2hid/src/hid_custom.c b/examples/usb2hid/src/hid_custom.c new file mode 100644 index 0000000..53b0aa9 --- /dev/null +++ b/examples/usb2hid/src/hid_custom.c @@ -0,0 +1,292 @@ +#include "usbd.h" +#include "usbd_hid.h" +#include "drvs.h" + +#if (DEMO_HID_CUSTOM) + +#define USBD_BCD USB_2_0 // Version +#define USBD_VID 0xFFFF // Vendor ID +#define USBD_PID 0xFFFF // Product ID +#define USBD_MAX_POWER 100 // unit in mA +#define USBD_LANGID_STRING 0x0409 // English(US) + + +/* + * Descriptor + **************************************************************************** + */ + +/*!< count of hid interface descriptor */ +#define USB_HID_INTF_CNT 2 +#define USB_HID_INTF_END (USB_HID_INTF_CNT - 1) + +/*!< config descriptor size (in & out endpoints) */ +#define USB_HID_CONFIG_SIZE (9+(18+7+7)*USB_HID_INTF_CNT) + +/*!< keyboard interface config */ +#define KBD_INTF_NUM 0 /*!< interfaceNumber */ +#define KBD_IN_EP 0x81 /*!< address */ +#define KBD_IN_EP_SIZE 8 /*!< max packet length */ +#define KBD_IN_EP_INTERVAL 10 /*!< polling time */ +#define KBD_OUT_EP 0x01 +#define KBD_OUT_EP_SIZE 1 +#define KBD_OUT_EP_INTERVAL 10 +#define KBD_REPORT_DESC_SIZE sizeof(hid_kbd_report_desc) + +/*!< custom-raw interface config */ +#define RAW_INTF_NUM 1 +#define RAW_IN_EP 0x82 +#define RAW_IN_EP_SIZE 64 +#define RAW_IN_EP_INTERVAL 10 +#define RAW_OUT_EP 0x02 +#define RAW_OUT_EP_SIZE 64 +#define RAW_OUT_EP_INTERVAL 10 +#define RAW_REPORT_DESC_SIZE sizeof(hid_raw_report_desc) + +/*!< Declaration of endpoint Handlers */ +void usbd_hid_kbd_out_handler(uint8_t ep); +void usbd_hid_raw_out_handler(uint8_t ep); + +/*!< hid keyboard report descriptor */ +static const uint8_t hid_kbd_report_desc[] = { + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x06, // USAGE (Keyboard) + 0xa1, 0x01, // COLLECTION (Application) + 0x05, 0x07, // USAGE_PAGE (Keyboard) + 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl) + 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0x01, // LOGICAL_MAXIMUM (1) + 0x75, 0x01, // REPORT_SIZE (1) + 0x95, 0x08, // REPORT_COUNT (8) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0x95, 0x01, // REPORT_COUNT (1) + 0x75, 0x08, // REPORT_SIZE (8) + 0x81, 0x03, // INPUT (Cnst,Var,Abs) + 0x95, 0x05, // REPORT_COUNT (5) + 0x75, 0x01, // REPORT_SIZE (1) + 0x05, 0x08, // USAGE_PAGE (LEDs) + 0x19, 0x01, // USAGE_MINIMUM (Num Lock) + 0x29, 0x05, // USAGE_MAXIMUM (Kana) + 0x91, 0x02, // OUTPUT (Data,Var,Abs) + 0x95, 0x01, // REPORT_COUNT (1) + 0x75, 0x03, // REPORT_SIZE (3) + 0x91, 0x03, // OUTPUT (Cnst,Var,Abs) + 0x95, 0x06, // REPORT_COUNT (6) + 0x75, 0x08, // REPORT_SIZE (8) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0xFF, // LOGICAL_MAXIMUM (255) + 0x05, 0x07, // USAGE_PAGE (Keyboard) + 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated)) + 0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application) + 0x81, 0x00, // INPUT (Data,Ary,Abs) + 0xc0 // END_COLLECTION +}; + +/*!< hid custom-raw report descriptor */ +static const uint8_t hid_raw_report_desc[] = { + 0x06, 0x00, 0xff, // USAGE_PAGE (Vendor Defined Page 1) + 0x09, 0x01, // USAGE (Vendor Usage 1) + 0xa1, 0x01, // COLLECTION (Application) + 0x09, 0x01, // USAGE (Vendor Usage 1) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) + 0x95, 0x40, // REPORT_COUNT (64) + 0x75, 0x08, // REPORT_SIZE (8) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0x09, 0x01, // USAGE (Vendor Usage 1) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) + 0x95, 0x40, // REPORT_COUNT (64) + 0x75, 0x08, // REPORT_SIZE (8) + 0x91, 0x02, // OUTPUT (Data,Var,Abs) + 0xC0 // END_COLLECTION +}; + +/*!< hid device descriptor */ +static const uint8_t hid_descriptor[] = { + /* Descriptor - Device (Size:18) */ + USB_DEVICE_DESCRIPTOR_INIT(USBD_BCD, 0x00, 0x00, 0x00, USBD_VID, USBD_PID, 0x0002, 0x01), + + /* Descriptor - Configuration (Total Size:9+Intf_Size) */ + USB_CONFIG_DESCRIPTOR_INIT(USB_HID_CONFIG_SIZE, USB_HID_INTF_CNT, + 0x01, USB_CONFIG_BUS_POWERED, USBD_MAX_POWER), + + /* Descriptor - Keyboard Interface (Size:18+7*2) */ + HID_INTERFACE_INIT(KBD_INTF_NUM, 2, HID_SUBCLASS_BOOTIF, HID_PROTOCOL_KEYBOARD, 0, KBD_REPORT_DESC_SIZE), + HID_ENDPOINT_DESC(KBD_IN_EP, KBD_IN_EP_SIZE, KBD_IN_EP_INTERVAL), + HID_ENDPOINT_DESC(KBD_OUT_EP, KBD_OUT_EP_SIZE, KBD_OUT_EP_INTERVAL), + + /* Descriptor - Custom-Raw Interface (Size:18+7*2) */ + HID_INTERFACE_INIT(RAW_INTF_NUM, 2, HID_SUBCLASS_BOOTIF, HID_PROTOCOL_NONE, 0, RAW_REPORT_DESC_SIZE), + HID_ENDPOINT_DESC(RAW_IN_EP, RAW_IN_EP_SIZE, RAW_IN_EP_INTERVAL), + HID_ENDPOINT_DESC(RAW_OUT_EP, RAW_OUT_EP_SIZE, RAW_OUT_EP_INTERVAL), + + /* Descriptor - String */ + // String0 - Language ID (Size:4) + USB_LANGID_INIT(USBD_LANGID_STRING), + + // String1 - iManufacturer + 0x02, /* bLength */ + USB_DESC_TYPE_STRING, /* bDescriptorType */ + + // String2 - iProduct + 0x16, /* bLength */ + USB_DESC_TYPE_STRING, /* bDescriptorType */ + WCHAR('U'), + WCHAR('S'), + WCHAR('B'), + WCHAR(' '), + WCHAR('R'), + WCHAR('a'), + WCHAR('w'), + WCHAR('H'), + WCHAR('I'), + WCHAR('D'), + + // String3 - iSerialNumber +// 0x10, /* bLength */ +// USB_DESC_TYPE_STRING, /* bDescriptorType */ +// WCHAR('6'), +// WCHAR('.'), +// WCHAR('2'), +// WCHAR('2'), +// WCHAR('.'), +// WCHAR('0'), +// WCHAR('8'), + + /* Descriptor - Device Qualifier (Size:10) */ + #if (USBD_BCD == USB_2_0) + USB_QUALIFIER_INIT(0x01), + #endif + + /* Descriptor - EOF */ + 0x00 +}; + + +/* + * Configuration + **************************************************************************** + */ + +/*!< table of hid interface */ +static const hid_intf_t hid_interface[] = { + HID_INTF_T(KBD_INTF_NUM, KBD_IN_EP, hid_kbd_report_desc), + HID_INTF_T(RAW_INTF_NUM, RAW_IN_EP, hid_raw_report_desc), +}; + +/*!< table of endpoints */ +static const usbd_ep_t endpoint_tab[] = { + USBD_EP_T(KBD_IN_EP, USB_EP_TYPE_INTERRUPT, KBD_IN_EP_SIZE, &usbd_hid_ep_in_handler), + USBD_EP_T(KBD_OUT_EP, USB_EP_TYPE_INTERRUPT, KBD_OUT_EP_SIZE, &usbd_hid_kbd_out_handler), + + USBD_EP_T(RAW_IN_EP, USB_EP_TYPE_INTERRUPT, RAW_IN_EP_SIZE, &usbd_hid_ep_in_handler), + USBD_EP_T(RAW_OUT_EP, USB_EP_TYPE_INTERRUPT, RAW_OUT_EP_SIZE, &usbd_hid_raw_out_handler), +}; + +/*!< table of class */ +static const usbd_class_t class_tab[] = { + USBD_CLASS_T(0, USB_HID_INTF_END, &usbd_hid_class_handler), +}; + +/*!< USBD Configuration */ +static const usbd_config_t hid_configuration[] = { + USBD_CONFIG_T(1, USB_HID_INTF_CNT, class_tab, endpoint_tab) +}; + + +/* + * Handlers + **************************************************************************** + */ + +void usbd_hid_kbd_out_handler(uint8_t ep) +{ + uint8_t led_state; + + /*!< read the led data from host send */ + usbd_ep_read(ep, KBD_OUT_EP_SIZE, &led_state); + USB_LOG_RAW("led_state:%02X\r\n", led_state); + + /*!< here you can write the LED processing from the host */ + usbd_hid_leds(led_state); +} + +void usbd_hid_raw_out_handler(uint8_t ep) +{ + uint8_t custom_data[RAW_OUT_EP_SIZE]; + + /*!< read the data from host send */ + usbd_ep_read(RAW_OUT_EP, RAW_OUT_EP_SIZE, custom_data); + + /*!< you can use the data do some thing you like */ +} + +__USBIRQ void usbd_notify_handler(uint8_t event, void *arg) +{ + switch (event) { + case USBD_EVENT_RESET: + usbd_hid_reset(); + break; + case USBD_EVENT_RESUME: + break; + case USBD_EVENT_SUSPEND: + break; + + default: + break; + } +} + + +/* + * Test Functions + **************************************************************************** + */ + +void usbdInit(void) +{ + usbd_init(); + usbd_register(hid_descriptor, hid_configuration); + + for (uint8_t idx = 0; idx < USB_HID_INTF_CNT; idx++) { + usbd_hid_init(idx, &hid_interface[idx]); + } +} + +void usbdTest(void) +{ + // circle polling to send report + static uint8_t keynum = 0; + + if (!usbd_is_configured()) + return; + + /*!< keyboard test */ + { + uint8_t sendbuffer1[KBD_IN_EP_SIZE] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; //A + + sendbuffer1[2] = HID_KEY_A + keynum; + usbd_hid_send_report(KBD_IN_EP, KBD_IN_EP_SIZE, sendbuffer1); + /*!< delay 10ms */ + bootDelayMs(10); + /*!< send button up */ + sendbuffer1[2] = 0; + usbd_hid_send_report(KBD_IN_EP, KBD_IN_EP_SIZE, sendbuffer1); + } + + /*!< delay 100ms the custom test */ + { + bootDelayMs(100); + /*!< custom test */ + uint8_t sendbuffer2[RAW_IN_EP_SIZE]; + + memset(sendbuffer2, keynum, RAW_IN_EP_SIZE); + usbd_hid_send_report(RAW_IN_EP, RAW_IN_EP_SIZE, sendbuffer2); + } + + if (++keynum > 94) keynum = 0; +} + +#endif // (DEMO_HID_CUSTOM) diff --git a/examples/usb2hid/src/keys.h b/examples/usb2hid/src/keys.h new file mode 100644 index 0000000..7e92f8a --- /dev/null +++ b/examples/usb2hid/src/keys.h @@ -0,0 +1,35 @@ +#ifndef KEYS_H_ +#define KEYS_H_ + +#if (USE_KEYS) +#include "drvs.h" +#include "dbg.h" + +#define LED1 (1 << 13) +#define LED2 (1 << 14) +#define LEDS (LED2 | LED1) + +#define PA_BTN1 10 +#define BTN1 (1 << PA_BTN1) +#define PA_BTN2 11 +#define BTN2 (1 << PA_BTN2) +#define PA_BTN3 12 +#define BTN3 (1 << PA_BTN3) +#define BTNS (BTN1 | BTN2 | BTN3) + +static __inline void keys_init(void) +{ + GPIO_DIR_CLR(BTNS); + iom_ctrl(PA_BTN1, IOM_INPUT | IOM_PULLUP | IOM_SEL_GPIO); + iom_ctrl(PA_BTN2, IOM_INPUT | IOM_PULLUP | IOM_SEL_GPIO); + iom_ctrl(PA_BTN3, IOM_INPUT | IOM_PULLUP | IOM_SEL_GPIO); + + GPIO_DIR_SET_HI(LEDS); +} +#else + +#define keys_init() // empty + +#endif // (USE_KEYS) + +#endif // KEYS_H_ diff --git a/examples/usb2hid/src/main.c b/examples/usb2hid/src/main.c new file mode 100644 index 0000000..26926fe --- /dev/null +++ b/examples/usb2hid/src/main.c @@ -0,0 +1,64 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +extern void usbdInit(void); +extern void usbdTest(void); + +static void sysInit(void) +{ + // switch syclk to 48M for USB + rcc_sysclk_set(SYS_CLK_48M); + + // enable USB clk and iopad + rcc_usb_en(); +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + iwdt_disable(); + + dbgInit(); + debug("Start(rsn:0x%X)...\r\n", rsn); + + usbdInit(); +} + +int main(void) +{ + sysInit(); + devInit(); + + NVIC_EnableIRQ(USB_IRQn); + __enable_irq(); + + while (1) + { + usbdTest(); + } +} diff --git a/examples/usb2uart/mdk/JLinkSettings.ini b/examples/usb2uart/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/examples/usb2uart/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/examples/usb2uart/mdk/clean.bat b/examples/usb2uart/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/examples/usb2uart/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/examples/usb2uart/mdk/usb2uart.uvoptx b/examples/usb2uart/mdk/usb2uart.uvoptx new file mode 100644 index 0000000..69682e2 --- /dev/null +++ b/examples/usb2uart/mdk/usb2uart.uvoptx @@ -0,0 +1,396 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + usb2uart + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + DLGUARM + (106=-1,-1,-1,-1,0)(107=-1,-1,-1,-1,0) + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000) + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC5000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS020003600 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 0 + 1 + gBleSleep + + + + + 1 + 10 + 0x20005000 + 0 + + + + + 2 + 1 + 0x50000000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\src\cdc_uart.c + cdc_uart.c + 0 + 0 + + + + + usbd + 1 + 0 + 0 + 0 + + 3 + 5 + 5 + 0 + 0 + 0 + ..\..\..\usb\api\usbd.h + usbd.h + 0 + 0 + + + 3 + 6 + 4 + 0 + 0 + 0 + ..\..\..\usb\lib\usbd.lib + usbd.lib + 0 + 0 + + + 3 + 7 + 1 + 0 + 0 + 0 + ..\..\..\usb\class\cdc\usbd_cdc.c + usbd_cdc.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 4 + 8 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 4 + 9 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 5 + 10 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/examples/usb2uart/mdk/usb2uart.uvprojx b/examples/usb2uart/mdk/usb2uart.uvprojx new file mode 100644 index 0000000..12081c3 --- /dev/null +++ b/examples/usb2uart/mdk/usb2uart.uvprojx @@ -0,0 +1,465 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + usb2uart + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + usb2uart + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\usb\api;..\..\..\usb\class\hid;..\..\..\usb\class\cdc + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_sram.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + cdc_uart.c + 1 + ..\src\cdc_uart.c + + + + + usbd + + + usbd.h + 5 + ..\..\..\usb\api\usbd.h + + + usbd.lib + 4 + ..\..\..\usb\lib\usbd.lib + + + usbd_cdc.c + 1 + ..\..\..\usb\class\cdc\usbd_cdc.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/examples/usb2uart/src/cdc_uart.c b/examples/usb2uart/src/cdc_uart.c new file mode 100644 index 0000000..9c67e3d --- /dev/null +++ b/examples/usb2uart/src/cdc_uart.c @@ -0,0 +1,231 @@ +#include "usbd.h" +#include "usbd_cdc.h" +#include "uart.h" + +#define USBD_BCD USB_2_0 // Version +#define USBD_VID 0xFFFF // Vendor ID +#define USBD_PID 0xFFFF // Product ID +#define USBD_MAX_POWER 100 // unit in mA +#define USBD_LANGID_STRING 0x0409 // English(US) + + +#define ENB_CDC_CNT 1 + +#if (ENB_CDC_CNT == 0 || ENB_CDC_CNT > 3) +#error "The count of USB-Serial be 1 ~ 3." +#endif + + +/* + * Descriptor + **************************************************************************** + */ + +#define CDC0_IN_EP 0x81 +#define CDC0_OUT_EP 0x01 +#define CDC0_INT_EP 0x81+ENB_CDC_CNT +#define CDC0_INTF_NUM 0 + +#if (ENB_CDC_CNT > 1) +#define CDC1_IN_EP 0x82 +#define CDC1_OUT_EP 0x02 +#define CDC1_INT_EP 0x82+ENB_CDC_CNT +#define CDC1_INTF_NUM 2 +#endif + +#if (ENB_CDC_CNT > 2) +#define CDC2_IN_EP 0x83 +#define CDC2_OUT_EP 0x03 +#define CDC2_INT_EP 0x83+ENB_CDC_CNT +#define CDC2_INTF_NUM 4 +#endif + +#define USB_CDC_INTF_CNT (2 * ENB_CDC_CNT) // Cmd Intf + Data Intf +#define USB_CDC_INTF_END (USB_CDC_INTF_CNT - 1) +#define USB_CDC_CONFIG_SIZE (9 + CDC_ACM_DESCRIPTOR_LEN * ENB_CDC_CNT) + +/*!< cdc device descriptor */ +static const uint8_t cdc_descriptor[] = { + /* Descriptor - Device (Size:18) */ + USB_DEVICE_DESCRIPTOR_INIT(USBD_BCD, 0xEF, 0x02, 0x01, USBD_VID, USBD_PID, 0x0100, 0x01), + + /* Descriptor - Configuration (Total Size:9+Intf_Size) */ + USB_CONFIG_DESCRIPTOR_INIT(USB_CDC_CONFIG_SIZE, USB_CDC_INTF_CNT, 0x01, USB_CONFIG_BUS_POWERED, USBD_MAX_POWER), + + /* Descriptor - CDC Interface (Size:66) */ + CDC_ACM_DESCRIPTOR_INIT(0x00, CDC0_INT_EP, CDC0_OUT_EP, CDC0_IN_EP, 0x02), + #if (ENB_CDC_CNT > 1) + CDC_ACM_DESCRIPTOR_INIT(0x02, CDC1_INT_EP, CDC1_OUT_EP, CDC1_IN_EP, 0x02), + #endif + #if (ENB_CDC_CNT > 2) + CDC_ACM_DESCRIPTOR_INIT(0x04, CDC2_INT_EP, CDC2_OUT_EP, CDC2_IN_EP, 0x02), + #endif + + /* Descriptor - String */ + // String0 - Language ID (Size:4) + USB_LANGID_INIT(USBD_LANGID_STRING), + + // String1 - iManufacturer + 0x02, /* bLength */ + USB_DESC_TYPE_STRING, /* bDescriptorType */ + + // String2 - iProduct + 0x16, /* bLength */ + USB_DESC_TYPE_STRING, /* bDescriptorType */ + WCHAR('U'), + WCHAR('S'), + WCHAR('B'), + WCHAR('-'), + WCHAR('S'), + WCHAR('e'), + WCHAR('r'), + WCHAR('i'), + WCHAR('a'), + WCHAR('l'), + + // String3 - iSerialNumber +// 0x10, /* bLength */ +// USB_DESC_TYPE_STRING, /* bDescriptorType */ +// WCHAR('6'), +// WCHAR('.'), +// WCHAR('2'), +// WCHAR('2'), +// WCHAR('.'), +// WCHAR('0'), +// WCHAR('7'), + + /* Descriptor - Device Qualifier (Size:10) */ + #if (USBD_BCD == USB_2_0) + USB_QUALIFIER_INIT(0x01), + #endif + + /* Descriptor - EOF */ + 0x00 +}; + + +/* + * Configuration + **************************************************************************** + */ + +static const usbd_ep_t endpoint_tab[] = { + USBD_EP_T(CDC0_INT_EP, USB_EP_TYPE_INTERRUPT, CDC_INT_EP_MPS, NULL), + USBD_EP_T(CDC0_OUT_EP, USB_EP_TYPE_BULK, CDC_BULK_EP_MPS, &usbd_cdc_bulk_out_handler), + USBD_EP_T(CDC0_IN_EP, USB_EP_TYPE_BULK, CDC_BULK_EP_MPS, &usbd_cdc_bulk_in_handler), + #if (ENB_CDC_CNT > 1) + USBD_EP_T(CDC1_INT_EP, USB_EP_TYPE_INTERRUPT, CDC_INT_EP_MPS, NULL), + USBD_EP_T(CDC1_OUT_EP, USB_EP_TYPE_BULK, CDC_BULK_EP_MPS, &usbd_cdc_bulk_out_handler), + USBD_EP_T(CDC1_IN_EP, USB_EP_TYPE_BULK, CDC_BULK_EP_MPS, &usbd_cdc_bulk_in_handler), + #endif + #if (ENB_CDC_CNT > 2) + USBD_EP_T(CDC2_INT_EP, USB_EP_TYPE_INTERRUPT, CDC_INT_EP_MPS, NULL), + USBD_EP_T(CDC2_OUT_EP, USB_EP_TYPE_BULK, CDC_BULK_EP_MPS, &usbd_cdc_bulk_out_handler), + USBD_EP_T(CDC2_IN_EP, USB_EP_TYPE_BULK, CDC_BULK_EP_MPS, &usbd_cdc_bulk_in_handler), + #endif +}; + +static const usbd_class_t class_tab[] = { + USBD_CLASS_T(0, USB_CDC_INTF_END, &usbd_cdc_class_handler), +}; + +static const usbd_config_t cdc_configuration[] = { + USBD_CONFIG_T(1, USB_CDC_INTF_CNT, class_tab, endpoint_tab) +}; + + +/* + * Handlers + **************************************************************************** + */ + +volatile uint8_t dtr_enable = 0; + +void usbd_cdc_updated(usbd_cdc_t *cdc, uint8_t type) +{ + if (type == CDC_LINE_STATE) { + USB_LOG_RAW("CDC Update(ep:0x%02X,)\r\n", cdc->ep_in, (cdc->line_state & 0x01), (cdc->line_state & 0x02)); + + dtr_enable = cdc->line_state; + } else { + USB_LOG_RAW("CDC Update(ep:0x%02X,)\r\n", cdc->ep_in, + cdc->line_coding.dwDTERate, cdc->line_coding.bDataBits, + cdc->line_coding.bParityType, cdc->line_coding.bCharFormat); + } +} + +void usbd_cdc_bulk_out_handler(uint8_t ep) +{ + uint16_t read_byte; + uint8_t data[CDC_BULK_EP_MPS]; + + read_byte = usbd_ep_read(ep, CDC_BULK_EP_MPS, data); + USB_LOG_RAW("CDC Bulk Out(ep:%d,len:%d)\r\n", ep, read_byte); + + /*!< here you can output data to hardware */ + for (uint8_t i = 0; i < read_byte; i++) { + uart_putc(0, data[i]); + } +} + +__USBIRQ void usbd_notify_handler(uint8_t event, void *arg) +{ + switch (event) { + case USBD_EVENT_RESET: + usbd_cdc_reset(); + break; + + default: + break; + } +} + + +/* + * Test Functions + **************************************************************************** + */ + +#define CDC_BULK_TX_SIZE (CDC_BULK_EP_MPS-1) + +uint8_t cdc_bulk_buff[CDC_BULK_TX_SIZE]; + +void usbdInit(void) +{ + usbd_init(); + usbd_register(cdc_descriptor, cdc_configuration); + + usbd_cdc_init(0, CDC0_INTF_NUM, CDC0_IN_EP); + #if (ENB_CDC_CNT > 1) + usbd_cdc_init(1, CDC1_INTF_NUM, CDC1_IN_EP); + #endif + #if (ENB_CDC_CNT > 2) + usbd_cdc_init(2, CDC2_INTF_NUM, CDC2_IN_EP); + #endif + + for (uint8_t i = 0; i < CDC_BULK_TX_SIZE; i++) { + cdc_bulk_buff[i] = '0' + i; + } +} + +void usbdTest(void) +{ + if (!usbd_is_configured()) + return; + + if (dtr_enable) + { + uint8_t status; + + status = usbd_cdc_ep_send(CDC0_IN_EP, CDC_BULK_TX_SIZE, cdc_bulk_buff); + USB_LOG_RAW("CDC0 Send(sta:%d,len:%d)\r\n", status, CDC_BULK_TX_SIZE); + #if (ENB_CDC_CNT > 1) + status = usbd_cdc_ep_send(CDC1_IN_EP, CDC_BULK_TX_SIZE, cdc_bulk_buff); + USB_LOG_RAW("CDC1 Send(sta:%d,len:%d)\r\n", status, CDC_BULK_TX_SIZE); + #endif + #if (ENB_CDC_CNT > 2) + status = usbd_cdc_ep_send(CDC2_IN_EP, CDC_BULK_TX_SIZE, cdc_bulk_buff); + USB_LOG_RAW("CDC2 Send(sta:%d,len:%d)\r\n", status, CDC_BULK_TX_SIZE); + #endif + } +} diff --git a/examples/usb2uart/src/cfg.h b/examples/usb2uart/src/cfg.h new file mode 100644 index 0000000..bbce972 --- /dev/null +++ b/examples/usb2uart/src/cfg.h @@ -0,0 +1,28 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// System Clock(0=16MHz, 1=32MHz, 2=48MHz, 3=64MHz) +#define SYS_CLK (2) + +/// Debug Mode: 0=Disable, 1=via UART, 2=RTT Viewer +#define DBG_MODE (1) + +#define DBG_UART_TXD (8) // PA17 +#define DBG_UART_RXD (9) // PA18 + +/// USB Debug Level: 0=Disable, 1=Error, 2=Warning +#if (DBG_MODE) +#define USB_DBG_LEVEL (1) +#endif + +#endif //_APP_CFG_H_ diff --git a/examples/usb2uart/src/main.c b/examples/usb2uart/src/main.c new file mode 100644 index 0000000..26926fe --- /dev/null +++ b/examples/usb2uart/src/main.c @@ -0,0 +1,64 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +extern void usbdInit(void); +extern void usbdTest(void); + +static void sysInit(void) +{ + // switch syclk to 48M for USB + rcc_sysclk_set(SYS_CLK_48M); + + // enable USB clk and iopad + rcc_usb_en(); +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + iwdt_disable(); + + dbgInit(); + debug("Start(rsn:0x%X)...\r\n", rsn); + + usbdInit(); +} + +int main(void) +{ + sysInit(); + devInit(); + + NVIC_EnableIRQ(USB_IRQn); + __enable_irq(); + + while (1) + { + usbdTest(); + } +} diff --git a/mesh/api/mesh.h b/mesh/api/mesh.h new file mode 100644 index 0000000..2855ba0 --- /dev/null +++ b/mesh/api/mesh.h @@ -0,0 +1,480 @@ +/** + **************************************************************************************** + * + * @file mesh.h + * + * @brief Header file for Mesh Application Interface + * + **************************************************************************************** + */ + +#ifndef _MESH_H_ +#define _MESH_H_ + +/** + **************************************************************************************** + * @defgroup MESH_API Mesh Application Interface + * @ingroup MESH + * @brief Mesh Application Interface + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mesh_cfg.h" +#include "mesh_err.h" +#include "mesh_msg.h" +#include "mesh_def.h" +#include "mm_def.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Size of environment part in buffer provided by the Buffer Manager +#define MESH_BUF_ENV_SIZE (32) +/// Block ID value for a dynamically allocated buffer +#define MESH_BUF_DYN_ALLOC (0xFF) + + +/* + * MACROS + **************************************************************************************** + */ + +/// Macro to get pointer to data part of a provided buffer +#define MESH_BUF_DATA(p_buf) (&(p_buf)->buf[0] + (p_buf)->head_len) + +/// Macro to get a structure from one of its structure field +#define MESH_TMR2ENV(ptr, env_type, tmr_member) \ + ((env_type *)((uint8_t *)(ptr) - offsetof(env_type, tmr_member))) + +/// Macro to get a structure from one of its structure field +#define MESH_DJOB2ENV(ptr, env_type, djob_member) \ + ((env_type *)((uint8_t *)(ptr) - offsetof(env_type, djob_member))) + + +/* + * TYPES FOR MESH STACK + **************************************************************************************** + */ + +/// Pointer to callback function called when djob execute +typedef void (*mesh_djob_cb)(void* p_djob); + +/// Pointer to callback function called when timer expires +typedef void (*mesh_timer_cb)(void *p_timer); + +/// Job delayed element structure +typedef struct mesh_djob +{ + /// List element header + list_hdr_t hdr; + /// Callback to execute in background context + mesh_djob_cb cb; +} mesh_djob_t; + +/// Structure defining the properties of a timer +typedef struct +{ + /// List element for chaining + list_hdr_t hdr; + /// Function to be called upon timer expiration + mesh_timer_cb cb; + /// Expiration time in milliseconds + uint32_t time_ms; + /// Number of wraps + uint16_t nb_wrap; + /// Not used by timer module but by client, this variable is used to save timer period information. + /// There is no unity to let client use it with any kind of timing step. + /// It is recommended to use it only to keep period an not other information + uint16_t period; +} mesh_timer_t; + +/// Buffer information structure +typedef struct mesh_buf +{ + /// List header for chaining + list_hdr_t hdr; + /// Length of the head part + uint16_t head_len; + /// Length of the tail part + uint16_t tail_len; + /// Length of the data part + uint16_t data_len; + /// Total size of the buffer array + uint16_t buf_len; + /// Index of block the buffer belongs to + /// Set to @see MESH_BUF_DYN_ALLOC if dynamically allocated + uint8_t block_id; + /// Index of the buffer in the block if buffer belongs to a block + uint8_t buf_id; + /// Acquire counter + uint8_t acq_cnt; + /// Dummy Tag that can be used to inform a layer about type of buffer. + /// Value should not be kept along several layers + uint8_t dummy_tag; + /// Environment variable that can be used for multiple purposes + uint8_t env[MESH_BUF_ENV_SIZE]; + /// Data buffer containing the PDU + /// Length is head_len + tail_len + data_len + uint8_t buf[]; +} mesh_buf_t; + + +/* + * TYPES FOR MESH SERVICE + **************************************************************************************** + */ + +typedef struct ms_prov_param +{ + /// Device UUID + uint8_t dev_uuid[MESH_DEV_UUID_LEN]; + /// URI hash + uint32_t uri_hash; + /// OOB information + uint16_t oob_info; + /// Public key OOB information available + uint8_t pub_key_oob; + /// Static OOB information available + uint8_t static_oob; + /// Maximum size of Output OOB supported + uint8_t out_oob_size; + /// Maximum size in octets of Input OOB supported + uint8_t in_oob_size; + /// Supported Output OOB Actions (@see enum mesh_prov_out_oob) + uint16_t out_oob_action; + /// Supported Input OOB Actions (@see enum mesh_prov_in_oob) + uint16_t in_oob_action; + /// Bit field providing additional information (@see enum mesh_prov_info) + uint8_t info; +} ms_prov_param_t; + +/// Low Power Node feature Configuration Structure +typedef struct ms_lpn_conf +{ + /// Initial value of PollTimeout timer (in multiple of 100ms) + uint32_t poll_timeout; + /// Poll interval (in milliseconds) + uint32_t poll_intv_ms; + /// Unicast address of the primary element of the previous friend + uint16_t prev_addr; + /// Receive delay + uint8_t rx_delay; + /// RSSI factor + uint8_t rssi_factor; + /// Receive window factor + uint8_t rx_window_factor; + /// Minimum queue size (log value) + uint8_t min_queue_size_log; +} ms_lpn_conf_t; + +/// Structure containing information about a friendship established as Low Power Node +typedef struct ms_lpn_info +{ + /// Poll interval in milliseconds + uint32_t poll_intv_ms; + /// LPN Counter + uint16_t lpn_cnt; + /// Address of Friend node + uint16_t frd_addr; + /// Friend Counter + uint16_t frd_cnt; + /// Receive delay in milliseconds + uint8_t rx_delay_ms; + /// Receive window in milliseconds + uint8_t rx_window_ms; + /// Friend subscription list size + uint8_t subs_list_size; + /// Friend Sequence Number + uint8_t fsn; +} ms_lpn_info_t; + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/**************************************************************************************** + * APIs - Mesh Stack + ****************************************************************************************/ + +/** + **************************************************************************************** + * @brief Init Mesh Stack (Create task and Init environment). + * + * @param[in] feats Feature supported (@see enum mesh_feat), 0 mean default value + **************************************************************************************** + */ +void mesh_init(uint32_t feats); + +/** + **************************************************************************************** + * @brief Start Mesh Profile, enable bearer layer. + * + * @return Status (@see enum mesh_err) + **************************************************************************************** + */ +uint8_t mesh_enable(void); + +/** + **************************************************************************************** + * @brief Get current time value, duration elapsed since device up time in milliseconds. + * + * @param[out] p_time_ms Pointer to current time (ms part) + * @param[out] p_nb_wrap Pointer to current time (wrap part) + **************************************************************************************** + */ +void mesh_clock_get(uint32_t *p_clock_ms, uint16_t *p_nb_wrap); + +/** + **************************************************************************************** + * @brief Set mesh clock, duration elapsed since device up time in milliseconds. + * + * @param[in] clock_ms Current clock (ms part) + * @param[in] nb_wrap Number of wrap (wrap part) + **************************************************************************************** + */ +void mesh_clock_set(uint32_t clock_ms, uint16_t nb_wrap); + +/** + **************************************************************************************** + * @brief Allocate a buffer and specify initial length of head, data and tail parts. + * + * @param[in] head_len Initial Head Length. + * @param[in] data_len Initial Data Length. + * @param[in] tail_len Initial Tail Length. + * + * @return Pointer to buffer if it can be allocated, NULL if no more buffers are available. + **************************************************************************************** + */ +mesh_buf_t* mesh_buf_alloc(uint16_t head_len, uint16_t data_len, uint16_t tail_len); + +/** + **************************************************************************************** + * @brief Request to release previously acquired buffer. The acquire counter for this buffer + * is decremented. If the acquire counter value becomes zero, the buffer is freed as no more + * entity is using the buffer anymore. + * + * @param[in] p_buf Pointer to acquired buffer. + * + * @return MESH_ERR_NO_ERROR if buffer has been released. + * MESH_ERR_COMMAND_DISALLOWED if buffer was free. + **************************************************************************************** + */ +uint8_t mesh_buf_release(mesh_buf_t *p_buf); + +/** + **************************************************************************************** + * @brief Copy content of a buffer to another buffer. + * + * @param[in] dst Pointer to the buffer that will contain content of input buffer. + * @param[in] src Pointer to the buffer to copy. + * @param[in] length Length of data to copy + * @param[in] copy_env Indicate if environment has to be copied. + **************************************************************************************** + */ +void mesh_buf_copy(mesh_buf_t *dst, mesh_buf_t *src, uint16_t length, bool copy_env); + +/// Copy data of a buffer to another buffer. +__INLINE__ void mesh_buf_copy_data(mesh_buf_t *dst, mesh_buf_t *src, uint16_t length) +{ + mesh_buf_copy(dst, src, length, false); +} + +/// Copy env[] of a buffer to another buffer +__INLINE__ void mesh_buf_copy_env(mesh_buf_t *dst, mesh_buf_t *src) +{ + mesh_buf_copy(dst, src, 0, true); +} + +/** + **************************************************************************************** + * @brief Register to execute a job delayed in background + * + * @param[in] p_djob Pointer to the delayed job structure + **************************************************************************************** + */ +void mesh_djob_reg(mesh_djob_t* p_djob); + +/** + **************************************************************************************** + * @brief Program a timer to be scheduled in the future. + * + * @param[in] p_timer Pointer to the timer structure. + * @param[in] delay Duration before expiration of the timer (in milliseconds) + **************************************************************************************** + */ +void mesh_timer_set(mesh_timer_t *p_timer, uint32_t delay_ms); + +/** + **************************************************************************************** + * @brief Clear a programmed timer. + * This function searches for the timer passed as parameter in the list of programmed + * timers and extract it from the list. + * + * @param[in] p_timer Pointer to the timer to be cleared + **************************************************************************************** + */ +void mesh_timer_clear(mesh_timer_t *p_timer); + + +/**************************************************************************************** + * APIs - Mesh Service + ****************************************************************************************/ + +/** + **************************************************************************************** + * @brief Set Mesh profile SSID(service set identifier) + * + * @param[in] cid 16-bit company identifier assigned by the Bluetooth SIG + * @param[in] pid 16-bit vendor-assigned product identifier + * @param[in] vid 16-bit vendor-assigned product version identifier + * @param[in] loc Localization descriptor + **************************************************************************************** + */ +void ms_set_ssid(uint16_t cid, uint16_t pid, uint16_t vid, uint16_t loc); + +/** + **************************************************************************************** + * @brief Set Mesh default TTL value + * + * @param[in] dflt_ttl Default TTL value (ttl <= MESH_TTL_MAX && ttl != 1 ) + * + * @return Error status + **************************************************************************************** + */ +uint8_t ms_set_dflt_ttl(uint8_t dflt_ttl); + +/** + **************************************************************************************** + * @brief Provide provisioning parameters to the provisioning module + * + * @param[in] p_param Provisioning parameters + **************************************************************************************** + */ +void ms_prov_param_rsp(ms_prov_param_t *p_param); + +/** + **************************************************************************************** + * @brief Provide authentication data to the provisioning module + * + * @param[in] accept True, Accept pairing request, False reject + * @param[in] auth_size Authentication data size (<= requested size else pairing rejected) + * @param[in] p_auth_data Authentication data (LSB for a number or array of bytes) + **************************************************************************************** + */ +void ms_prov_auth_rsp(bool accept, uint8_t auth_size, const uint8_t* p_auth_data); + +/** + **************************************************************************************** + * @brief Provide a page of Composition Data to the provisioning module + * + * @param[in] page Page number + * @param[in] length Length of composition data page + * @param[in] p_data Pointer to data + **************************************************************************************** + */ +void ms_compo_data_rsp(uint8_t page, uint8_t length, uint8_t *p_data); + +/** + **************************************************************************************** + * @brief Provide Registered Fault state for primary element to the hlths module. + * + * @param[in] comp_id Company ID + * @param[in] test_id Test ID + * @param[in] length Length of fault array + * @param[in] p_fault Pointer to fault array content + **************************************************************************************** + */ +void ms_fndh_fault_rsp(bool accept, uint16_t comp_id, uint8_t test_id, uint8_t length, uint8_t *p_fault); + +/** + **************************************************************************************** + * @brief Control if Proxy service should start / stop advertising it's capabilities + * + * @param[in] enable True to enable advertising for 60s, + * False to stop (@see enum mesh_proxy_adv_ctl) + * + * @return Execution status code + **************************************************************************************** + */ +uint8_t ms_proxy_ctrl(uint8_t enable); + + +/**************************************************************************************** + * APIs - Mesh Models + ****************************************************************************************/ + +/** + **************************************************************************************** + * @brief Set state value + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] state_id State identifier (@see enum mm_state_id) + * @param[in] state State value + * + * @return An error status + **************************************************************************************** + */ +uint8_t mm_state_srv_set(m_lid_t mdl_lid, uint16_t state_id, uint32_t state); + +/** + **************************************************************************************** + * @brief Get value of a state + * + * @param[in] mdl_lid Local index for the client model used to get the needed state value + * @param[in] dst Element address to which the get message must be sent + * @param[in] get_info Get information + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +uint8_t mm_state_cli_get(m_lid_t mdl_lid, m_lid_t app_key_lid, uint16_t dst, uint16_t get_info); + +/** + **************************************************************************************** + * @brief Set value of a state + * + * @param[in] mdl_lid Local index for the client model used to set the needed state value + * @param[in] dst Element address to which the set message must be sent + * @param[in] state_1 State value 1 + * @param[in] state_2 State value 2 + * @param[in] set_info Set information (@see enum mm_set_info) + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +uint8_t mm_state_cli_set(m_lid_t mdl_lid, m_lid_t app_key_lid, uint16_t dst, uint32_t state_1, + uint32_t state_2, uint16_t set_info); + +/** + **************************************************************************************** + * @brief Set value of a state using a transition + * + * @param[in] mdl_lid Local index for the client model used to set the needed state value + * @param[in] dst Element address to which the set message must be sent + * @param[in] state_1 State value 1 + * @param[in] state_2 State value 2 + * @param[in] trans_time_ms Transition Time in milliseconds + * @param[in] delay_ms Delay in milliseconds + * @param[in] trans_info Transition Information (@see mm_trans_info) + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +uint8_t mm_state_cli_trans(m_lid_t mdl_lid, m_lid_t app_key_lid, uint16_t dst, uint32_t state_1, + uint32_t state_2, uint32_t trans_time_ms, uint16_t delay_ms, + uint16_t trans_info); + +/// @} MESH_API + +#endif /* _MESH_H_ */ diff --git a/mesh/api/mesh_cfg.h b/mesh/api/mesh_cfg.h new file mode 100644 index 0000000..2d39ab3 --- /dev/null +++ b/mesh/api/mesh_cfg.h @@ -0,0 +1,88 @@ +/** + **************************************************************************************** + * + * @file mesh_cfg.h + * + * @brief Header file for Mesh Stack Configuration + * + **************************************************************************************** + */ + +#ifndef MESH_CFG_H_ +#define MESH_CFG_H_ + +/* + * LIB FLAGS + **************************************************************************************** + */ + +#if (MESH_LIB_FULL) +/// Support of GATT Proxy feature +#define BLE_MESH_GATT_PROXY (1) + +/// Support of GATT Provisioning feature +#define BLE_MESH_GATT_PROV (1) + +/// Support of Relay feature +#define BLE_MESH_RELAY (1) + +/// Support of Friend feature +#define BLE_MESH_FRIEND (1) + +/// Support of Low Power Node feature +#define BLE_MESH_LPN (1) + +#else //(MESH_LIB_LITE) +/// Support of GATT Proxy feature +#define BLE_MESH_GATT_PROXY (1) + +/// Support of GATT Provisioning feature +#define BLE_MESH_GATT_PROV (1) + +/// Support of Relay feature +#define BLE_MESH_RELAY (0) + +/// Support of Friend feature +#define BLE_MESH_FRIEND (0) + +/// Support of Low Power Node feature +#define BLE_MESH_LPN (0) + +#endif //(MESH_LIB_FULL) + + +/* + * ENUMERATIONS + **************************************************************************************** + */ + +/// Mesh Supported Features +enum mesh_feat +{ + /// Relay Node + MESH_FEAT_RELAY_NODE_SUP = (1 << 0), + /// Proxy Node + MESH_FEAT_PROXY_NODE_SUP = (1 << 1), + /// Friend Node + MESH_FEAT_FRIEND_NODE_SUP = (1 << 2), + /// Low Power Node + MESH_FEAT_LOW_POWER_NODE_SUP = (1 << 3), + + /// Provisioning over GATT + MESH_FEAT_PB_GATT_SUP = (1 << 14), + /// Dynamic beacon interval supported + MESH_FEAT_DYN_BCN_INTV_SUP = (1 << 15), +}; + +/// Used to know if GATT Bearer is present +#define BLE_MESH_GATT_BEARER (BLE_MESH_GATT_PROXY || BLE_MESH_GATT_PROV) + +/// Supported feature mask +#define BLE_MESH_FEAT_MASK ( (BLE_MESH_RELAY * MESH_FEAT_RELAY_NODE_SUP ) \ + | (BLE_MESH_GATT_PROXY * MESH_FEAT_PROXY_NODE_SUP ) \ + | (BLE_MESH_FRIEND * MESH_FEAT_FRIEND_NODE_SUP ) \ + | (BLE_MESH_LPN * MESH_FEAT_LOW_POWER_NODE_SUP ) \ + | (BLE_MESH_GATT_PROV * MESH_FEAT_PB_GATT_SUP ) ) + + +#endif /* MESH_CFG_H_ */ diff --git a/mesh/api/mesh_def.h b/mesh/api/mesh_def.h new file mode 100644 index 0000000..df1fd23 --- /dev/null +++ b/mesh/api/mesh_def.h @@ -0,0 +1,257 @@ +/** + **************************************************************************************** + * + * @file mesh_def.h + * + * @brief Header file for Mesh Stack Defines + * + **************************************************************************************** + */ + +#ifndef _MESH_DEF_H_ +#define _MESH_DEF_H_ + +/** + **************************************************************************************** + * @defgroup MESH_DEFINES Mesh Defines + * @ingroup MESH + * @brief Mesh Defines + * @{ + **************************************************************************************** + */ + +/* + * INCLUDES FILES + **************************************************************************************** + */ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Unassigned address value +#define MESH_UNASSIGNED_ADDR (0x0000) + +/// Fixed group address - All proxies +#define MESH_PROXIES_ADDR (0xFFFC) +/// Fixed group address - All friends +#define MESH_FRIENDS_ADDR (0xFFFD) +/// Fixed group address - All relays +#define MESH_RELAYS_ADDR (0xFFFE) +/// Fixed group address - All nodes +#define MESH_NODES_ADDR (0xFFFF) + +/// Size of a key +#define MESH_KEY_LEN (16) +/// Size of value block when encrypting +#define MESH_ENC_VAL_LEN (16) +/// Public Key X coordinate length +#define MESH_PUB_KEY_X_LEN (32) +/// Public Key Y coordinate length +#define MESH_PUB_KEY_Y_LEN (32) +/// Size of Device UUID +#define MESH_DEV_UUID_LEN (16) +/// Length of the Private P-256 key +#define MESH_PRIVATE_KEY_LEN (32) +/// ECDH Secret size length +#define MESH_ECDH_SECRET_LEN (32) +/// Size of K1 result length value +#define MESH_K1_RES_LEN (16) +/// Size of K2 result length value - (263 bits) +#define MESH_K2_RES_LEN (33) +/// Size of K3 result length value - (64 bits) +#define MESH_K3_RES_LEN (8) +/// Size of K4 result length value - (6 bits) +#define MESH_K4_RES_LEN (1) +/// Size of the Nonce used for AES-CCM +#define MESH_NONCE_LEN (13) + +/// Network identifier length +#define MESH_NET_ID_LEN (8) +/// Packet sequence number length +#define MESH_SEQ_LEN (3) +/// Address length +#define MESH_ADDR_LEN (2) +/// Key IDs length +#define MESH_KEY_ID_LEN (2) +/// Size of Label UUID +#define MESH_LABEL_UUID_LEN (16) +/// Length of Network MIC for an Access Message +#define MESH_NMIC_ACC_LEN (4) +/// Length of Network MIC for a Control Message +#define MESH_NMIC_CTL_LEN (8) +/// Authentication data OOB length +#define MESH_OOB_AUTH_DATA_LEN (16) +/// 64 bit random value +#define MESH_PROXY_RANDOM_LEN (8) +/// 64 bit HASH value +#define MESH_PROXY_HASH_LEN (8) + +/// Perform Connectable Advertising during 60s +#define MESH_PROXY_CON_ADV_DUR (60000) + +/// Maximum Publish TTL value +#define MESH_TTL_MAX (0x7F) +/// Publish TTL value indicating that Default TTL value must be used +#define MESH_TTL_USE_DEFAULT (0xFF) + +/// Maximum number of subnets the node can belong to +#define MESH_SUBNET_NB_MAX (5) +/// Maximum number of models that can be registered on the node +#define MESH_MODEL_NB_MAX (8) + +/// Invalid Local identifier - m_lid_t +#define MESH_INVALID_LID (0xFF) + + +/* + * MACROS + **************************************************************************************** + */ + +/// Check if access opcode is a 1 octet value +#define MESH_IS_1_OCT_OPCODE(opcode) (((opcode) & 0x80) == 0) +/// Check if access opcode is a 2 octets value +#define MESH_IS_2_OCT_OPCODE(opcode) (((opcode) & 0xC0) == 0x80) +/// Check if access opcode is a 3 octets value +#define MESH_IS_3_OCT_OPCODE(opcode) (((opcode) & 0xC0) == 0xC0) + +/// Macro returning if a Model ID is a vendor Model ID +#define MESH_IS_VENDOR_MODEL(model_id) ((model_id & 0xFFFF0000) != 0) + + +/* + * ENUMERATIONS + **************************************************************************************** + */ + +/// Connection packet type +enum mesh_bearer_con_type +{ + /// Network Message + MS_BEARER_CON_TYPE_NET = (0x00), + /// Mesh Beacon message + MS_BEARER_CON_TYPE_BEACON = (0x01), + /// Proxy configuration message + MS_BEARER_CON_TYPE_PROXY = (0x02), + /// Provisioning PDU message + MS_BEARER_CON_TYPE_PROV = (0x03), +}; + +/// Proxy connectable advertising control values +enum mesh_proxy_adv_ctl +{ + /// Stop connectable advertising + MS_PROXY_ADV_CTL_STOP = 0, + /// Start connectable advertising with Node Identity (duration = 60s) + MS_PROXY_ADV_CTL_START_NODE, + /// Start connectable advertising with Network ID (duration = 60s) + MS_PROXY_ADV_CTL_START_NET, +}; + +/// Proxy connectable advertising state update types +enum mesh_proxy_adv_upd +{ + /// Advertising with Node Identity stopped + MS_PROXY_ADV_NODE_STOP = 0, + /// Advertising with Node Identity started + MS_PROXY_ADV_NODE_START, + /// Advertising with Network ID stopped + MS_PROXY_ADV_NET_STOP, + /// Advertising with Node Identity started + MS_PROXY_ADV_NET_START, +}; + +/// Proxy connectable advertising state update reasons +enum mesh_proxy_adv_upd_reason +{ + /// Stopped due to timeout (60s) + MS_PROXY_ADV_UPD_REASON_TIMEOUT = 0, + /// Stopped due to state update + MS_PROXY_ADV_UPD_REASON_STATE, + /// User request + MS_PROXY_ADV_UPD_REASON_USER, + /// Peer request + MS_PROXY_ADV_UPD_REASON_PEER, + /// Started due to provisioning using PB-GATT + MS_PROXY_ADV_UPD_REASON_PROV, + /// Disconnection + MS_PROXY_ADV_UPD_REASON_DISC, +}; + +/// State of the provisioning +enum mesh_prov_state +{ + /// Provisioning started - procedure started by a provisioner + MS_PROV_STARTED, + /// Provisioning succeed + MS_PROV_SUCCEED, + /// Provisioning failed + MS_PROV_FAILED, +}; + +/// Authentication Method field values +enum mesh_prov_auth_method +{ + /// No OOB authentication is used + MS_PROV_AUTH_NO_OOB, + /// Static OOB authentication is used + MS_PROV_AUTH_STATIC_OOB, + /// Output OOB authentication is used + MS_PROV_AUTH_OUTPUT_OOB, + /// Input OOB authentication is used + MS_PROV_AUTH_INPUT_OOB, +}; + +/// Output OOB Action field values +enum mesh_prov_out_oob +{ + /// Bit[0]: Blink + MS_PROV_OUT_OOB_BLINK = 0x0001, + /// Bit[1]: Beep + MS_PROV_OUT_OOB_BEEP = 0x0002, + /// Bit[2]: Vibrate + MS_PROV_OUT_OOB_VIBRATE = 0x0004, + /// Bit[3]: Output Numeric + MS_PROV_OUT_OOB_NUMERIC = 0x0008, + /// Bit[4]: Output Alphanumeric + MS_PROV_OUT_OOB_ALPHANUMERIC = 0x0010, + /// Bit[5-15]: Reserved for Future Use +}; + +/// Input OOB Action field values +enum mesh_prov_in_oob +{ + /// Bit[0]: Push + MS_PROV_IN_OOB_PUSH = 0x0001, + /// Bit[1]: Twist + MS_PROV_IN_OOB_TWIST = 0x0002, + /// Bit[2]: Input Numeric + MS_PROV_IN_OOB_NUMERIC = 0x0004, + /// Bit[3]: Input Alphanumeric + MS_PROV_IN_OOB_ALPHANUMERIC = 0x0008, + /// Bit[4-15]: Reserved for Future Use +}; + +enum mesh_prov_info +{ + /// URI Hash present or not in the unprovisioned device beacon + MS_PROV_INFO_URI_HASH_PRESENT = (1 << 0), +}; + +/* + * TYPES + **************************************************************************************** + */ + +/// Local Identifier +typedef uint8_t m_lid_t; + + +/// @} MESH_DEFINES + +#endif /* _MESH_DEF_H_ */ diff --git a/mesh/api/mesh_err.h b/mesh/api/mesh_err.h new file mode 100644 index 0000000..055ccd9 --- /dev/null +++ b/mesh/api/mesh_err.h @@ -0,0 +1,231 @@ +/** + **************************************************************************************** + * + * @file mesh_err.h + * + * @brief Header file for Mesh Error Defines + * + **************************************************************************************** + */ + +#ifndef _MESH_ERR_H_ +#define _MESH_ERR_H_ + +/** + **************************************************************************************** + * @defgroup MESH_DEFINES Mesh Defines + * @ingroup MESH + * @brief Mesh Defines + * @{ + **************************************************************************************** + */ + +/* + * INCLUDES FILES + **************************************************************************************** + */ + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Mesh Error Protocol Group Code - bit[7:5] +#define MESH_ERR_PROTOCOL_CODE (0x01) +/// Mesh Error Provisioning Group Code +#define MESH_ERR_PROVISIONING_CODE (0x02) +/// Mesh Error Internal Group Code +#define MESH_ERR_INTERNAL_CODE (0x03) +/// Mesh Error Low Power Node Group Code +#define MESH_ERR_LPN_CODE (0x04) +/// Mesh Error Model Group Code +#define MESH_ERR_MDL_CODE (0x05) + +/* + * MACROS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Macros returning the mesh error code for a given mesh sub-error code. + * + * @param[in] grp Mesh group code + * @param[in] suberror Mesh sub-error code + * + * @return Mesh error code - bit[7:5] grp code, bit[4:0] sub code + **************************************************************************************** + */ +#define MESH_ERR_(grp, suberror) (((MESH_ERR_##grp##_CODE) << 5) | (suberror & 0x1F)) + +/** + **************************************************************************************** + * @brief Macros returning the mesh sub-error code for a given mesh error code. + * + * @param[in] error Mesh error code + * + * @return Mesh sub-error code + **************************************************************************************** + */ +#define MESH_SUBERR(error) ((error) & 0x1F) + +/** + **************************************************************************************** + * @brief Macros returning the mesh group code for a given mesh error code. + * + * @param[in] error Mesh error code + * + * @return Mesh group error code + **************************************************************************************** + */ +#define MESH_ERR_GRP(error) ((error) >> 5) + +/* + * ENUMERATIONS + **************************************************************************************** + */ + +/// Mesh Error Codes +enum mesh_error +{ + /// No Error + MESH_ERR_NO_ERROR = 0x0000, + + /* **************************************************************** */ + /* * PROTOCOL ERROR CODES * */ + /* **************************************************************** */ + + /// Invalid Address + MESH_ERR_INVALID_ADDR = MESH_ERR_(PROTOCOL, 0x01), + /// Invalid_Model + MESH_ERR_INVALID_MODEL = MESH_ERR_(PROTOCOL, 0x02), + /// Invalid AppKey Index + MESH_ERR_INVALID_APPKEY_ID = MESH_ERR_(PROTOCOL, 0x03), + /// Invalid NetKey Index + MESH_ERR_INVALID_NETKEY_ID = MESH_ERR_(PROTOCOL, 0x04), + /// Insufficient_Resources + MESH_ERR_INSUFFICIENT_RESOURCES = MESH_ERR_(PROTOCOL, 0x05), + /// Key Index Already Stored + MESH_ERR_KEY_ID_ALREADY_STORED = MESH_ERR_(PROTOCOL, 0x06), + /// Invalid Publish Parameters + MESH_ERR_INVALID_PUBLISH_PARAMS = MESH_ERR_(PROTOCOL, 0x07), + /// Not a Subscribe Model + MESH_ERR_NOT_A_SUBSCRIBE_MODEL = MESH_ERR_(PROTOCOL, 0x08), + /// Storage Failure + MESH_ERR_STORAGE_FAILURE = MESH_ERR_(PROTOCOL, 0x09), + /// Feature Not Supported + MESH_ERR_NOT_SUPPORTED = MESH_ERR_(PROTOCOL, 0x0A), + /// Cannot Update + MESH_ERR_CANNOT_UPDATE = MESH_ERR_(PROTOCOL, 0x0B), + /// Cannot Remove + MESH_ERR_CANNOT_REMOVE = MESH_ERR_(PROTOCOL, 0x0C), + /// Cannot Bind + MESH_ERR_CANNOT_BIND = MESH_ERR_(PROTOCOL, 0x0D), + /// Temporarily Unable to Change State + MESH_ERR_UNABLE_TO_CHANGE_STATE = MESH_ERR_(PROTOCOL, 0x0E), + /// Cannot Set + MESH_ERR_CANNOT_SET = MESH_ERR_(PROTOCOL, 0x0F), + /// Unspecified Error + MESH_ERR_UNSPECIFIED_ERROR = MESH_ERR_(PROTOCOL, 0x10), + /// Invalid Binding + MESH_ERR_INVALID_BINDING = MESH_ERR_(PROTOCOL, 0x11), + + /* **************************************************************** */ + /* * PROVISIONING ERROR CODES * */ + /* **************************************************************** */ + + /// Prohibited + MESH_ERR_PROV_PROHIBITED = MESH_ERR_(PROVISIONING, 0x00), + /// The provisioning protocol PDU is not recognized by the device + MESH_ERR_PROV_INVALID_PDU = MESH_ERR_(PROVISIONING, 0x01), + /// The arguments of the protocol PDUs are outside expected values or the length of the PDU is + /// different than expected + MESH_ERR_PROV_INVALID_FORMAT = MESH_ERR_(PROVISIONING, 0x02), + /// The PDU received was not expected at this moment of the procedure + MESH_ERR_PROV_UNEXPECTED_PDU = MESH_ERR_(PROVISIONING, 0x03), + /// The computed confirmation value was not successfully verified + MESH_ERR_PROV_CONFIRMATION_FAILED = MESH_ERR_(PROVISIONING, 0x04), + /// The provisioning protocol cannot be continued due to insufficient resources in the device + MESH_ERR_PROV_OUT_OF_RESOURCES = MESH_ERR_(PROVISIONING, 0x05), + /// The Data block was not successfully decrypted + MESH_ERR_PROV_DECRYPTION_FAILED = MESH_ERR_(PROVISIONING, 0x06), + /// An unexpected error occurred that may not be recoverable + MESH_ERR_PROV_UNEXPECTED = MESH_ERR_(PROVISIONING, 0x07), + /// The device cannot assign consecutive unicast addresses to all elements + MESH_ERR_PROV_CANNOT_ASSIGN_ADDR = MESH_ERR_(PROVISIONING, 0x08), + + /* **************************************************************** */ + /* * INTERNAL ERROR CODES * */ + /* **************************************************************** */ + /// Invalid Parameter + MESH_ERR_INVALID_PARAM = MESH_ERR_(INTERNAL, 0x01), + /// Command Disallowed + MESH_ERR_COMMAND_DISALLOWED = MESH_ERR_(INTERNAL, 0x02), + /// MIC Error + MESH_ERR_MIC_ERROR = MESH_ERR_(INTERNAL, 0x03), + /// Resource requested is busy + MESH_ERR_BUSY = MESH_ERR_(INTERNAL, 0x04), + /// Request time value is past + MESH_ERR_TIME_PAST = MESH_ERR_(INTERNAL, 0x05), + /// Resource requested not found + MESH_ERR_NOT_FOUND = MESH_ERR_(INTERNAL, 0x06), + /// Sequence number error + MESH_ERR_SEQ_ERROR = MESH_ERR_(INTERNAL, 0x07), + /// Bearer instance has been closed + MESH_ERR_BEARER_CLOSED = MESH_ERR_(INTERNAL, 0x08), + /// Provisioning Failed + MESH_ERR_PROVISIONING_FAILED = MESH_ERR_(INTERNAL, 0x09), + /// Provisioning timeout - Transaction or Link timeout + MESH_ERR_PROVISIONING_TIMEOUT = MESH_ERR_(INTERNAL, 0x0A), + /// Failed to access ECDH - Critical error + MESH_ERR_ECDH_FAILED = MESH_ERR_(INTERNAL, 0x0B), + /// Request has no effect + MESH_ERR_NO_EFFECT = MESH_ERR_(INTERNAL, 0x0C), + /// Cannot fragment message due to lack of ressources + MESH_ERR_CANNOT_FRAGMENT = MESH_ERR_(INTERNAL, 0x0D), + + /* **************************************************************** */ + /* * LOW POWER NODE ERROR CODES * */ + /* **************************************************************** */ + /// Establishment failed after several attempts + MESH_ERR_LPN_ESTAB_FAILED = MESH_ERR_(LPN, 0x01), + /// Establishment failed due to failure during generation of friend keys + MESH_ERR_LPN_ESTAB_FAILED_KEY = MESH_ERR_(LPN, 0x02), + /// Establishment failed because Friend Update message not received after transmission of Friend Poll + MESH_ERR_LPN_ESTAB_FAILED_UPD = MESH_ERR_(LPN, 0x03), + /// Friendship stopped due to local request + MESH_ERR_LPN_FRIEND_LOST_LOCAL = MESH_ERR_(LPN, 0x04), + /// Friendship lost due to request timeout + MESH_ERR_LPN_FRIEND_LOST_TIMEOUT = MESH_ERR_(LPN, 0x05), + + /* **************************************************************** */ + /* * MODEL ERROR CODES * */ + /* **************************************************************** */ + /// Invalid Model Configuration + MESH_ERR_MDL_INVALID_CFG = MESH_ERR_(MDL, 0x01), + /// Invalid Model Identifier + MESH_ERR_MDL_INVALID_MDL_ID = MESH_ERR_(MDL, 0x02), + /// Invalid Opcode + MESH_ERR_MDL_INVALID_OPCODE = MESH_ERR_(MDL, 0x03), + /// Invalid model group local index + MESH_ERR_MDL_INVALID_GROUP = MESH_ERR_(MDL, 0x04), + /// Unknown model group + MESH_ERR_MDL_UNKNOWN_GROUP = MESH_ERR_(MDL, 0x05), + /// Model already part of the group + MESH_ERR_MDL_MDL_ALREADY_IN_GROUP = MESH_ERR_(MDL, 0x06), + /// Group of model is full + MESH_ERR_MDL_GROUP_FULL = MESH_ERR_(MDL, 0x07), + /// One of the models has already been registered + MESH_ERR_MDL_ALREADY_REGISTERED = MESH_ERR_(MDL, 0x08), + /// Provided Model Local Index is not valid + MESH_ERR_MDL_INVALID_MDL_LID = MESH_ERR_(MDL, 0x09), + /// Invalid role + MESH_ERR_MDL_INVALID_ROLE = MESH_ERR_(MDL, 0x0A), + /// Command is not available for the model + MESH_ERR_MDL_COMMAND_NOT_AVAILABLE = MESH_ERR_(MDL, 0x0B), +}; + +/// @} MESH_DEFINES + +#endif /* _MESH_ERR_H_ */ diff --git a/mesh/api/mesh_msg.h b/mesh/api/mesh_msg.h new file mode 100644 index 0000000..3627893 --- /dev/null +++ b/mesh/api/mesh_msg.h @@ -0,0 +1,812 @@ +/** + **************************************************************************************** + * + * @file mesh_msg.h + * + * @brief Header file for Mesh Stack Message Application Programming Interface + * + **************************************************************************************** + */ + +#ifndef MESH_MSG_H_ +#define MESH_MSG_H_ + +/** + **************************************************************************************** + * @defgroup MESH_MSG Mesh Stack Message Application Programming Interface + * @ingroup MESH + * @brief Mesh Stack Message Application Programming Interface + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include +#include "task.h" +#include "mesh_def.h" + + +/* + * MACROS + **************************************************************************************** + */ + +/// Reuse TASK_HCI(0x02) as Mesh Task ID +#define TASK_MESH 0x02 + +/// Retrieve message value from its index - TID_MESH = 10 @see task.h +#define MESH_MSG_ID(id) MSG_ID(MESH, id) + +/* + * ENUMERATIONS FOR MESH STACK + **************************************************************************************** + */ + +/// Mesh Stack Message Indexes +enum mesh_msg_id +{ + /* *************************************************** */ + /* * MESH SERVICE * */ + /* *************************************************** */ + + /// Mesh Command + MESH_CMD = MESH_MSG_ID(0), + /// Mesh Command Complete event + MESH_CMP_EVT = MESH_MSG_ID(1), + + // Mesh service state change indication + MESH_STATE_IND = MESH_MSG_ID(2), + + /// Inform/Get Registered Fault state or Request to start a test procedure + MESH_FNDH_FAULT_IND = MESH_MSG_ID(3), + /// Response containing current Registered Fault state for primary element + MESH_FNDH_FAULT_CFM = MESH_MSG_ID(4), + /// Inform about new publication period for Current Health state of primary element + MESH_FNDH_PERIOD_IND = MESH_MSG_ID(5), + + /// Mesh Provisioning Data Request + MESH_PROV_DATA_REQ_IND = MESH_MSG_ID(6), + /// Response containing the required composition data page + MESH_PROV_COMPO_DATA_CFM = MESH_MSG_ID(7), + /// Mesh Provisioning parameters response + MESH_PROV_PARAM_DATA_CFM = MESH_MSG_ID(8), + /// Mesh Provisioning Authentication Data response + MESH_PROV_AUTH_DATA_CFM = MESH_MSG_ID(9), + + /// Mesh Friend Offer reception indication + MESH_LPN_OFFER_IND = MESH_MSG_ID(10), + + /// Configuration loaded indication for application. + MESH_CONF_LOAD_IND = MESH_MSG_ID(11), + /// Configuration update indication for Storage. + MESH_CONF_UPDATE_IND = MESH_MSG_ID(12), + + /* *************************************************** */ + /* * MESH MODEL * */ + /* *************************************************** */ + + /// Mesh Model Command + MESH_MDL_MSG_FIRST = MESH_MSG_ID(100), + MESH_MDL_CMD = MESH_MDL_MSG_FIRST, + /// Mesh Model Command Complete Event + MESH_MDL_CMP_EVT = MESH_MSG_ID(101), + /// Mesh Model Indication + MESH_MDL_IND = MESH_MSG_ID(102), + /// Mesh Model Request Indication + MESH_MDL_REQ_IND = MESH_MSG_ID(103), + /// Mesh Model Confirm + MESH_MDL_CFM = MESH_MSG_ID(104), + MESH_MDL_MSG_LAST = MESH_MDL_CFM, +}; + +/* + * ENUMERATIONS FOR MESH PROFILE + **************************************************************************************** + */ + +/// Indicate codes for MESH_STATE_IND message +enum ms_state_ind_code +{ + /// Mesh profile state change indication + MS_PRF_STATE_IND, + /// Mesh Provisioning state change indication + MS_PROV_STATE_IND, + /// Mesh Proxy advertising state update indication + MS_PROXY_ADV_UPD_IND, + /// Inform about updated attention state + MS_ATEN_UPD_IND, + /// Inform about requested node reset + MS_NODE_RST_IND, +}; + +/// Indicate codes for MESH_FNDH_FAULT_IND message +enum ms_fault_ind_code +{ + /// Inform that clear of Registered Fault state identified by Company ID has been received + MS_FAULT_CLEAR_IND, + /// Request to get the current Registered Fault state identified by Company ID + MS_FAULT_GET_REQ_IND, + /// Request to start a test procedure of primary element + MS_FAULT_TEST_REQ_IND, + /// Test procedure, MESH_FAULT_CFM message isn't expected + MS_FAULT_TEST_NAK_IND, +}; + +/// Indicate codes for MESH_PROV_DATA_REQ_IND message +enum mesh_prov_data_req_code +{ + /// Request Provisioning Authentication Data (@see enum mesh_prov_auth_method) + MS_PROV_AUTH_DATA_REQ_IND = 0, + // No OOB authentication is used + MS_PROV_AUTH_NO_OOB_REQ_IND = MS_PROV_AUTH_DATA_REQ_IND, + // Static OOB authentication is used + MS_PROV_AUTH_STATIC_OOB_REQ_IND, + // Output OOB authentication is used + MS_PROV_AUTH_OUTPUT_OOB_REQ_IND, + // Input OOB authentication is used + MS_PROV_AUTH_INPUT_OOB_REQ_IND, + + /// Request Provisioning Parameters + MS_PROV_PARAM_DATA_REQ_IND, + + /// Request a page of the composition data + MS_PROV_COMPO_DATA_REQ_IND, +}; + +/// Indicate codes for MESH_CONF_LOAD_IND and MESH_CONF_UPDATE_IND message +enum ms_conf_type +{ + /// Mesh Created to load + MS_CONF_TYPE_CREATE = 0, + + /// Mesh State updated + MS_CONF_TYPE_STATE, + + /// Network key updated or deleted + MS_CONF_TYPE_NET_KEY, + + /// Application key updated or deleted + MS_CONF_TYPE_APP_KEY, + + /// Model publication parameters updated + MS_CONF_TYPE_PUBLI_PARAM, + /// Model subscription list updated + MS_CONF_TYPE_SUBS_LIST, + /// Model/application key binding updated + MS_CONF_TYPE_BINDING, + + /// Friendship with LPN updated or lost + MS_CONF_TYPE_LPN, + + /// Friendship with Friend updated or lost + MS_CONF_TYPE_FRIEND, +}; + +/// State updated index for MS_CONF_TYPE_STATE +enum ms_conf_state_index +{ + /// Primary element unicast address + MS_CONF_STATE_UNICAST_ADDR = 0, + /// Default TTL state + MS_CONF_STATE_DEFAULT_TTL, + /// Secure network beacon state + MS_CONF_STATE_BEACON, + /// Network transmit state + MS_CONF_STATE_NET_TX, + /// Relay state + MS_CONF_STATE_RELAY, + /// GATT proxy state + MS_CONF_STATE_GATT_PROXY, + /// Friend state + MS_CONF_STATE_FRIEND, + /// Device key + MS_CONF_STATE_DEV_KEY, + /// IV and SEQ values + MS_CONF_STATE_IV_SEQ, +}; + +/// Status updated for MS_CONF_TYPE_SUBS_LIST +enum ms_conf_mdl_subs_status +{ + // Model subscription add + MS_CONF_MDL_SUBS_ADD, + // Model subscription delete + MS_CONF_MDL_SUBS_DEL, + // Model subscription delete all + MS_CONF_MDL_SUBS_DEL_ALL, + // Model subscription virtual address add + MS_CONF_MDL_SUBS_VADDR_ADD, + // Model subscription virtual address delete + MS_CONF_MDL_SUBS_VADDR_DEL, +}; + +/* + * MESSAGE DEFINITIONS FOR MESH SERVICE + **************************************************************************************** + */ + +/// Command required structure (without parameters) +typedef struct ms_cmd +{ + /// Command code (@see enum ms_cmd_code) + uint8_t cmd_code; +} ms_cmd_t; + +/// Command complete event required structure (without parameters) +typedef struct ms_cmp_evt +{ + /// Command code (@see enum ms_cmd_code) + uint8_t cmd_code; + /// Status of the command execution + uint8_t status; +} ms_cmp_evt_t; + +/// State indication common structure +typedef struct ms_state_ind +{ + /// Indication code (@see enum ms_state_ind_code) + uint8_t ind_code; + /// State + uint8_t state; + /// Status or Reason + uint16_t status; +} ms_state_ind_t; + +/// Mesh Profile state change indication +typedef struct ms_prf_state_ind +{ + /// Indication code - MS_PRF_STATE_IND + uint8_t ind_code; + /// Enabled or Disabled state (@see enum m_prf_state) + uint8_t prf_state; + /// Status, success with MESH_ERR_NO_ERROR + uint16_t status; +} ms_prf_state_ind_t; + +/// Mesh Provisioning state change indication +typedef struct ms_prov_state_ind +{ + /// Indication code - MS_PROV_STATE_IND + uint8_t ind_code; + /// Provisioning procedure state (@see enum mesh_prov_state) + uint8_t prov_state; + /// Relevant only for provisioning failed (failed reason) + uint16_t status; +} ms_prov_state_ind_t; + +/// Indicate that proxy advertising has been started or stopped and the reason +typedef struct ms_proxy_adv_upd_ind +{ + /// Indication code - MS_PROXY_ADV_UPD_IND + uint8_t ind_code; + /// State (@see enum mesh_proxy_adv_upd) + uint8_t upd_state; + /// Reason (@see enum mesh_proxy_adv_upd_reason) + uint16_t reason; +} ms_proxy_adv_upd_ind_t; + +/// Inform about attention state update +typedef struct ms_aten_upd_ind +{ + /// Indication code - MS_ATEN_UPD_IND + uint8_t ind_code; + /// Attention state + uint8_t aten_state; + /// Status reserved + uint16_t status; +} ms_aten_upd_ind_t; + +/// Inform about requested node reset +typedef struct ms_node_rst_ind +{ + /// Indication code - MS_NODE_RST_IND + uint8_t ind_code; + /// Handle value configured by model + uint8_t tx_hdl; + /// Transmission status + uint16_t status; +} ms_node_rst_ind_t; + +/// Configuration load indication message structure +typedef struct ms_conf_load_ind +{ + /// Load type (@see ms_conf_type) + uint8_t cfg_type; + /// Local index + uint8_t index; + /// Status + uint16_t status; +} ms_conf_load_ind_t; + +/// Configuration update indication message structure +typedef struct ms_conf_update_ind +{ + /// Update type (@see ms_conf_type) + uint8_t upd_type; + /// Local index or status + uint8_t value1; + /// Entry value + uint16_t value2; +} ms_conf_update_ind_t; + +/// Low Power Node offer reception indication structure +typedef struct ms_lpn_offer_ind +{ + /// Address of Friend node that sent the Friend Offer message + uint16_t frd_addr; + /// Friend Counter + uint16_t frd_cnt; + + /// Friend Offer params + union { + struct { + /// Receive window value supported by the Friend node + uint8_t rx_window; + /// Queue size available on the Friend node + uint8_t queue_size; + /// Size of the subscription list that can be supported by the Friend Node + uint8_t subs_list_size; + /// RSSI measured by the Friend node + int8_t rssi; + }; + uint32_t wd_offer; + }; +} ms_lpn_offer_ind_t; + + +/// Request to start a test procedure of primary element +typedef struct ms_fndh_fault_ind +{ + /// Indication code (@see enum ms_fault_ind_code) + uint8_t ind_code; + /// Test ID, Relevant only for MS_FAULT_TEST_REQ_IND MS_FAULT_TEST_NAK_IND + uint8_t test_id; + /// Company ID + uint16_t comp_id; +} ms_fndh_fault_ind_t; + +/// Response containing current Registered Fault state for primary element +typedef struct ms_fndh_fault_cfm +{ + /// Accept (true) or reject (false) the request + bool accept; + /// Test ID + uint8_t test_id; + /// Company ID + uint16_t comp_id; + /// Length of fault array + uint8_t length; + /// Fault array + uint8_t fault_array[]; +} ms_fndh_fault_cfm_t; + +/// Inform about new publication period for Current Health state of primary element +typedef struct ms_fndh_period_ind +{ + /// Publication period in milliseconds when no fault is known + uint32_t period_ms; + /// Publication period in milliseconds when one or several fault are known + uint32_t period_fault_ms; +} ms_fndh_period_ind_t; + +/// Request Provisioning Parameters +typedef struct ms_prov_param_data_req_ind +{ + /// Request indication code - MS_PROV_PARAM_DATA_REQ_IND + uint8_t req_code; +} ms_prov_param_data_req_ind_t; + +/// Request a page of the composition data +typedef struct ms_prov_compo_data_req_ind +{ + /// Request indication code - MS_PROV_COMPO_DATA_REQ_IND + uint8_t req_code; + /// Page + uint8_t page; +} ms_prov_compo_data_req_ind_t; + +/// Mesh Provisioning Authentication Data Request +typedef struct ms_prov_auth_data_req_ind +{ + /// Request indication code - MS_PROV_AUTH_DATA_REQ_IND + /// - Same index with Authentication method (@see enum mesh_prov_auth_method) + uint8_t auth_method; + /// expected authentication maximum data size + uint8_t auth_size; + /// Authentication Action: + /// - MS_PROV_AUTH_NO_OOB = Prohibited + /// - MS_PROV_AUTH_STATIC_OOB = 16 bytes LSB static out of band data required + /// - MS_PROV_AUTH_OUTPUT_OOB = @see enum mesh_prov_out_oob, 1 bit set. + /// - MS_PROV_AUTH_INPUT_OOB = @see enum mesh_prov_in_oob, 1 bit set. + uint16_t auth_action; +} ms_prov_auth_data_req_ind_t; + +typedef struct ms_prov_data_req_ind +{ + /// Request indication code (@see enum mesh_prov_data_req_code) + uint8_t req_code; + /// Param value1 + uint8_t value1; + /// Param value2 + uint16_t value2; +} ms_prov_data_req_ind_t; + +/// Mesh Provisioning Parameters Response +typedef struct ms_prov_param_cfm +{ + /// Device UUID + uint8_t dev_uuid[MESH_DEV_UUID_LEN]; + /// URI hash + uint32_t uri_hash; + /// OOB information + uint16_t oob_info; + /// Public key OOB information available + uint8_t pub_key_oob; + /// Static OOB information available + uint8_t static_oob; + /// Maximum size of Output OOB supported + uint8_t out_oob_size; + /// Maximum size in octets of Input OOB supported + uint8_t in_oob_size; + /// Supported Output OOB Actions (@see enum mesh_prov_out_oob) + uint16_t out_oob_action; + /// Supported Input OOB Actions (@see enum mesh_prov_in_oob) + uint16_t in_oob_action; + /// Bit field providing additional information (@see enum mesh_prov_info) + uint8_t info; +} ms_prov_param_cfm_t; + +/// Response containing the required composition data page +typedef struct ms_compo_data_cfm +{ + /// Page + uint8_t page; + /// Length + uint8_t length; + /// Data + uint8_t data[]; +} ms_compo_data_cfm_t; + +/// Mesh Provisioning Authentication Data Response +typedef struct ms_prov_auth_data_cfm +{ + /// 1, Accept pairing request, 0 reject + uint8_t accept; + /// Authentication data size (<= requested size else pairing automatically rejected) + uint8_t auth_size; + /// Authentication data (LSB for a number or array of bytes) + uint8_t auth_data[]; +} ms_prov_auth_data_cfm_t; + + +/* + * ENUMERATIONS FOR MESH MODELS + **************************************************************************************** + */ + +/// Indication codes for MESH_MDL_IND message +enum mm_ind_code +{ + /// Model registered indication + MM_REGISTER_IND = 0, + + /// State update indication + MM_SRV_STATE_UPD_IND = 10, + /// Set Generic Location state indication (global part) for Generic Location Server model + MM_SRV_LOCG_UPD_IND, + /// Set Generic Location state indication (local part) for Generic Location Server model + MM_SRV_LOCL_UPD_IND, + + /// Received state indication for: + /// - Generic OnOff Client model + /// - Generic Default Transition Time Client model + /// - Generic Level Client model + /// - Generic Power OnOff Client model + MM_CLI_STATE_IND = 100, + /// Received Generic Battery state indication for Generic Battery Client model + MM_CLI_BAT_IND, + /// Received Generic Location state indication (global part) for Generic Location Client model + MM_CLI_LOCG_IND, + /// Received Generic Location state indication (local part) for Generic Location Client model + MM_CLI_LOCL_IND, + /// Get a Generic Property state value or list of Generic Property states + MM_CLI_PROP_IND, + /// Received list of User or Admin or Manufacturer properties + MM_CLI_PROP_LIST_IND, + + /// Group event indication + MM_GRP_EVENT_IND = 200, + /// State set by main model indication + MM_GRP_STATE_IND, +}; + +/// Indication codes for MESH_MDL_REQ_IND message +enum mm_req_code +{ + /// Request battery information for a given element + MM_SRV_BAT_REQ_IND = 0, + /// Request Generic Location state for a given element (global part) + MM_SRV_LOCG_REQ_IND, + /// Request Generic Location state for a given element (local part) + MM_SRV_LOCL_REQ_IND, + + /// Request to get Generic Property value + MM_SRV_PROP_GET_REQ_IND, + /// Request to set Generic Property value + MM_SRV_PROP_SET_REQ_IND, + + /// Request start of a new transition to the main model + MM_GRP_TRANS_REQ_IND = 50, +}; + +/* + * MESSAGE DEFINITIONS FOR MESH MODELS + **************************************************************************************** + */ + +/// Minimal content for MESH_MDL_CMD message +typedef struct mm_cmd +{ + /// Command Code (depends on indicated API) + uint8_t cmd_code; +} mm_cmd_t; + +/// Minimal content for MESH_MDL_CMP_EVT message +typedef struct mm_cmp_evt +{ + /// Command Code (depends on indicated API) + uint8_t cmd_code; + /// Status of command execution + uint8_t status; +} mm_cmp_evt_t; + +/// Minimal content for MESH_MDL_CFM message +typedef struct mm_cfm +{ + /// Request indication code (depends on indicated API) + uint8_t req_code; + /// Status of command execution by application + uint8_t status; +} mm_cfm_t; + +/// Common content for MESH_MDL_IND message +typedef struct mm_ind +{ + /// Indication code (@see enum mm_ind_code) + uint8_t ind_code; + + /* Model Register indication */ + + /* Server Role indication */ + + /* Client Role indication */ +} mm_ind_t; + +/// Model registered indication structure +typedef struct mm_register_ind +{ + /// Indication code - MM_REGISTER_IND + uint8_t ind_code; + /// Model local index + m_lid_t mdl_lid; + /// Element index + uint8_t elmt_idx; + /// Model ID + uint32_t model_id; +} mm_register_ind_t; + +/// State update indication structure +typedef struct mm_srv_state_upd_ind +{ + /// Indication code - MM_SRV_STATE_UPD_IND + uint8_t ind_code; + /// Element index + uint8_t elmt_idx; + + /// State identifier (@see enum mm_state_id) + uint16_t state_id; + /// New state value or targeted state value depending on transition time + uint32_t state; + /// Transition time in milliseconds + uint32_t trans_time_ms; +} mm_srv_state_upd_ind_t; + +/// Set Generic Location state (global part) indication structure +typedef struct mm_srv_locg_upd_ind +{ + /// Indication code - MM_SRV_LOCG_UPD_IND + uint8_t ind_code; + /// Element index + uint8_t elmt_idx; + + /// Global Latitude + int32_t latitude; + /// Global Longitude + int32_t longitude; + /// Global Altitude + int16_t altitude; +} mm_srv_locg_upd_ind_t; + +/// Set Generic Location state (local part) indication structure +typedef struct mm_srv_locl_upd_ind +{ + /// Indication code - MM_SRV_LOCL_UPD_IND + uint8_t ind_code; + /// Element index + uint8_t elmt_idx; + + /// Local North + int16_t north; + /// Local East + int16_t east; + /// Local Altitude + int16_t altitude; + /// Uncertainty + uint16_t uncertainty; + /// Floor + uint8_t floor; +} mm_srv_locl_upd_ind_t; + +/// Received state indication structure +typedef struct mm_cli_state_ind +{ + /// Indication code - MM_CLI_STATE_IND + uint8_t ind_code; + /// Source address + uint16_t src; + + /// State Identifier (@see enum mm_state_id) + uint16_t state_id; + /// State 1 + uint32_t state_1; + /// State 2 + uint32_t state_2; + /// Remaining time in milliseconds + uint32_t rem_time_ms; +} mm_cli_state_ind_t; + +/// Received Generic Battery state indication structure +typedef struct mm_cli_bat_ind +{ + /// Indication code - MM_CLI_BAT_IND + uint8_t ind_code; + /// Source address + uint16_t src; + + /// Time to discharge in minutes + uint32_t time_discharge; + /// Time to charge in minutes + uint32_t time_charge; + /// Battery level + uint8_t bat_lvl; + /// Flags + uint8_t flags; +} mm_cli_bat_ind_t; + +/// Received Generic Location state (global part) indication structure +typedef struct mm_cli_locg_ind +{ + /// Indication code - MM_CLI_LOCG_IND + uint8_t ind_code; + /// Source address + uint16_t src; + + /// Global Latitude + int32_t latitude; + /// Global Longitude + int32_t longitude; + /// Global Altitude + int16_t altitude; +} mm_cli_locg_ind_t; + +/// Received Generic Location state (local part) indication structure +typedef struct mm_cli_locl_ind +{ + /// Indication code - MM_CLI_LOCL_IND + uint8_t ind_code; + /// Source address + uint16_t src; + + /// Local North + int16_t north; + /// Local East + int16_t east; + /// Local Altitude + int16_t altitude; + /// Uncertainty + uint16_t uncertainty; + /// Floor + uint8_t floor; +} mm_cli_locl_ind_t; + +/// Received User or Admin or Manufacturer Property value indication structure +typedef struct mm_cli_prop_ind +{ + /// Indication code - MM_CLI_PROP_IND + uint8_t ind_code; + /// Source address + uint16_t src; + + /// Property ID + uint16_t prop_id; + /// Length + uint16_t length; + /// User access + uint8_t user_access; + /// Value + uint8_t val[]; +} mm_cli_prop_ind_t; + +/// Received list of User or Admin or Manufacturer properties indication structure +typedef struct mm_cli_prop_list_ind +{ + /// Indication code - MM_CLI_PROP_LIST_IND + uint8_t ind_code; + /// Source address + uint16_t src; + + /// Number of properties + uint16_t nb_prop; + /// Property type + uint8_t prop_type; + /// Property IDs + uint16_t prop_ids[]; +} mm_cli_prop_list_ind_t; + +/// Common content for MESH_MDL_REQ_IND message +typedef struct mm_req_ind +{ + /// Request indication code (@see enum mm_req_code) + uint8_t req_code; + + /* Server Role Request indication */ +} mm_req_ind_t; + +/// Get element state value request indication structure +typedef struct mm_srv_state_req_ind +{ + /// Request indication code (@see enum mm_req_code) + uint8_t req_code; + /// Element index + uint8_t elmt_idx; +} mm_srv_state_req_ind_t; + +/// Request to get Generic Property value +typedef struct mm_srv_prop_get_req_ind +{ + /// Request indication code - MM_SRV_PROP_GET_REQ_IND + uint8_t req_code; + /// Element index + uint8_t elmt_idx; + + /// Property type + uint8_t prop_type; + /// Property ID + uint16_t prop_id; +} mm_srv_prop_get_req_ind_t; + +/// Request to set Generic Property value +typedef struct mm_srv_prop_set_req_ind +{ + /// Request indication code - MM_SRV_PROP_SET_REQ_IND + uint8_t req_code; + /// Element index + uint8_t elmt_idx; + + /// Property type + uint8_t prop_type; + /// Property ID + uint16_t prop_id; + /// Value length + uint16_t length; + /// Value + uint8_t val[]; +} mm_srv_prop_set_req_ind_t; + +/// @} MESH_MSG + +#endif /* MESH_MSG_H_ */ diff --git a/mesh/api/mm_def.h b/mesh/api/mm_def.h new file mode 100644 index 0000000..170c6cf --- /dev/null +++ b/mesh/api/mm_def.h @@ -0,0 +1,333 @@ +/** + **************************************************************************************** + * + * @file mm_def.h + * + * @brief Header file for Mesh Model Definitions + * + **************************************************************************************** + */ + +#ifndef MM_DEF_H_ +#define MM_DEF_H_ + +/** + **************************************************************************************** + * @defgroup MM_DEFINES Mesh Model Definitions + * @ingroup MESH_MDL + * @brief Mesh Model Defines + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Maximum number of steps for transition time value +#define MM_TRANS_TIME_STEPS_MAX (0x3E) +/// Transition time not provided +#define MM_TRANS_TIME_UNKNOWN (0x3F) + + +/* + * ENUMERATIONS + **************************************************************************************** + */ + +/// State identifier values for MESH_MDL_IND message +enum mm_state_id +{ + /// Generic OnOff state + MM_STATE_GEN_ONOFF = 0, + /// Generic Level state + MM_STATE_GEN_LVL, + /// Generic Default Transition Time state + MM_STATE_GEN_DTT, + /// Generic Power Actual state + MM_STATE_GEN_POWER_ACTUAL, + /// Generic Power Last state + MM_STATE_GEN_POWER_LAST, + /// Generic Power Default state + MM_STATE_GEN_POWER_DFLT, + /// Generic Power Range state + MM_STATE_GEN_POWER_RANGE, + /// Generic OnPowerUp state + MM_STATE_GEN_ONPOWERUP, + + /// Light Lightness + MM_STATE_LIGHT_LN = 50, + /// Light Lightness Linear + MM_STATE_LIGHT_LN_LIN, + /// Light Lightness Last + MM_STATE_LIGHT_LN_LAST, + /// Light Lightness Default + MM_STATE_LIGHT_LN_DFLT, + /// Light Lightness Range + MM_STATE_LIGHT_LN_RANGE, + /// Light Lightness Range Min + MM_STATE_LIGHT_LN_RANGE_MIN, + /// Light Lightness Range Max + MM_STATE_LIGHT_LN_RANGE_MAX, + + /// Light CTL Lightness + MM_STATE_LIGHT_CTL_LN = 100, + /// Light CTL Temperature + MM_STATE_LIGHT_CTL_TEMP, + /// Light CTL Delta UV + MM_STATE_LIGHT_CTL_DELTA_UV, + /// Light CTL Temperature Default + MM_STATE_LIGHT_CTL_TEMP_DFLT, + /// Light CTL Temperature Range + MM_STATE_LIGHT_CTL_TEMP_RANGE, + /// Light CTL Delta UV Default + MM_STATE_LIGHT_CTL_DELTA_UV_DFLT, + + /// Light HSL Lightness + MM_STATE_LIGHT_HSL_LN = 150, + /// Light HSL Hue + MM_STATE_LIGHT_HSL_HUE, + /// Light HSL Saturation + MM_STATE_LIGHT_HSL_SAT, + /// Light HSL Target + MM_STATE_LIGHT_HSL_TGT, + /// Light HSL Default (Lightness + Hue + Saturation) + MM_STATE_LIGHT_HSL_DFLT, + /// Light HSL Lightness Default + MM_STATE_LIGHT_HSL_DFLT_LN, + /// Light HSL Hue Default + MM_STATE_LIGHT_HSL_DFLT_HUE, + /// Light HSL Saturation Default + MM_STATE_LIGHT_HSL_DFLT_SAT, + /// Light HSL Hue Range + MM_STATE_LIGHT_HSL_RANGE_HUE, + /// Light HSL Saturation Range + MM_STATE_LIGHT_HSL_RANGE_SAT, + + /// Light xyL Lightness + MM_STATE_LIGHT_XYL_LN = 200, + /// Light xyL x and y + MM_STATE_LIGHT_XYL_XY, + /// Light xyL Lightness Target + MM_STATE_LIGHT_XYL_LN_TGT, + /// Light xyL x and y Target + MM_STATE_LIGHT_XYL_XY_TGT, + /// Light xyL Lightness Default + MM_STATE_LIGHT_XYL_LN_DFLT, + /// Light xyL x and y Default + MM_STATE_LIGHT_XYL_XY_DFLT, + /// Light xyL x and y Range + MM_STATE_LIGHT_XYL_XY_RANGE + + /// User add Vendor States, more... + +}; + +/// Type of state that can be set +enum mm_state_type +{ + /// Current state value + MM_STATE_TYPE_CURRENT = 0, + /// Targeted state value + MM_STATE_TYPE_TARGET, + /// Targeted state value during move transition + MM_STATE_TYPE_TARGET_MOVE, +}; + +/// Transition type +enum mm_trans_type +{ + /// Classic Set + MM_TRANS_TYPE_CLASSIC = 0, + /// Delta Set + MM_TRANS_TYPE_DELTA, + /// Move Set + MM_TRANS_TYPE_MOVE, + /// No transition + MM_TRANS_TYPE_NONE, +}; + +/// Transition time step resolution values +enum mm_trans_time_step +{ + /// Resolution is 100 milliseconds + MM_TRANS_TIME_STEP_100MS = 0, + /// Resolution is 1 second + MM_TRANS_TIME_STEP_1S, + /// Resolution is 10 seconds + MM_TRANS_TIME_STEP_10S, + /// Resolution is 10 minutes + MM_TRANS_TIME_STEP_10M +}; + +/// Transition time format bit-field +/// 7 6 0 +/// +------------+-------------------+ +/// | Resolution | Number of steps | +/// +------------+-------------------+ +enum mm_trans_time_pos +{ + /// Number of steps + MM_TRANS_TIME_STEP_NB_LSB = 0, + MM_TRANS_TIME_STEP_NB_MASK = 0x3F, + + /// Resolution (@see enum mm_trans_time_step) + MM_TRANS_TIME_RESOL_LSB = 6, + MM_TRANS_TIME_RESOL_MASK = 0xC0, +}; + +/// Transition information bit-field +/// 16 8 7 6 2 0 +/// +-----+-----+------+-----+------+ +/// | TID | Ack | Long | RFU | Type | +/// +-----+-----+------+-----+------+ +enum mm_trans_info +{ + /// Type (value depends on model for which transition is required) + /// @see enum mm_trans_type + MM_TRANS_INFO_TYPE_LSB = 0, + MM_TRANS_INFO_TYPE_MASK = 0x0003, + + /// Include transition time and delay + MM_TRANS_INFO_LONG_POS = 6, + MM_TRANS_INFO_LONG_BIT = 0x0040, + + /// Set or Set Unacknowledged + MM_TRANS_INFO_ACK_POS = 7, + MM_TRANS_INFO_ACK_BIT = 0x0080, + + /// TID + MM_TRANS_INFO_TID_LSB = 8, + MM_TRANS_INFO_TID_MASK = 0xFF00, +}; + +/// Set information bit-field +/// 8 7 0 +/// +-----+------+ +/// | Ack | Type | +/// +-----+------+ +enum mm_set_info +{ + /// Type (value depends on model for which operation is required) + MM_SET_INFO_TYPE_LSB = 0, + MM_SET_INFO_TYPE_MASK = 0x7F, + + /// Set or Set Unacknowledged + MM_SET_INFO_ACK_POS = 7, + MM_SET_INFO_ACK_BIT = 0x80, +}; + +/// Status of Set command +enum mm_set_status +{ + /// Command successfully processed + MM_STATUS_SUCCESS = 0, + /// The provided value for Range Min cannot be set + MM_STATUS_ERROR_RANGE_MIN, + /// The provided value for Range Max cannot be set + MM_STATUS_ERROR_RANGE_MAX, +}; + +/// Group events for communication between Binding Manager and a model +enum mm_group_event +{ + /// New transition has been rejected by the main model, sent to bound model + MM_GRP_EVENT_TRANS_REJECTED = 0, + /// Delay period has expired, sent to main model + MM_GRP_EVENT_TRANS_DELAY_EXPIRED, + /// New Transition has been started by the main model + MM_GRP_EVENT_TRANS_STARTED, + /// Immediate transmission has been started by the main model + MM_GRP_EVENT_TRANS_IMMEDIATE, + /// Transition stopped after transition time + MM_GRP_EVENT_TRANS_END, + /// Transition aborted + MM_GRP_EVENT_TRANS_ABORTED, + + /// All bound models have been registered + MM_GRP_EVENT_GROUP_FULL, +}; + +/// Model register configuration +/// 7 1 0 +/// +-----+------------+ +/// | RFU | Publi Auth | +/// +-----+------------+ +enum mm_register_config +{ + /// Indicate if sending of publications is authorized or not + MM_CFG_PUBLI_AUTH_POS = 0, + MM_CFG_PUBLI_AUTH_BIT = 0x01, +}; + +/// Model role +enum mm_role +{ + /// Client role + MM_ROLE_CLI = 0x00, + /// Server role + MM_ROLE_SRV = 0x01, + /// Server role with Publication + MM_ROLE_SRV_PUBLI = 0x03, +}; + +/// Information bit field for model environment - add Bit[7:4] +/// 7 6 4 3 2 1 0 +/// +----------+----------+-------+------+-------+------+ +/// | Wait App | On Publi | Publi | Main | Role | +/// +----------+----------+-------+------+-------+------+ +enum mm_info +{ + /// Model Role @see mm_role + MM_INFO_ROLE_LSB = 0, + MM_INFO_ROLE_MASK = 0x03, + + /// Model is main model of its group - set by Binding Manager + MM_INFO_MAIN_POS = 2, + MM_INFO_MAIN_BIT = (1 << MM_INFO_MAIN_POS), + + /// Publication are enabled for the model + MM_INFO_PUBLI_POS = 3, + MM_INFO_PUBLI_BIT = (1 << MM_INFO_PUBLI_POS), + + /// Publication are ongoing @see mm_gens_loc_info mm_gens_bat_info + MM_INFO_ONPUBLI_LSB = 4, + MM_INFO_ONPUBLI_MASK = 0x30, + /// Wait for confirmation from application + MM_INFO_WAITAPP_LSB = 6, + MM_INFO_WAITAPP_MASK = 0xC0, +}; + +/// Routing Buffer information bitfield +/// 15 3 2 1 0 +/// +-----+---------+-------+-------+ +/// | RFU | PUBLISH | RELAY | RX/TX | +/// +-----+---------+-------+-------+ +enum mm_route_info +{ + /// RX or TX buffer (1 when RX) + MM_ROUTE_INFO_RX_POS = 0, + MM_ROUTE_INFO_RX_BIT = 0x01, + + /// Has been relayed (RX) or can be relayed (TX, only when response is sent) + MM_ROUTE_INFO_RELAY_POS = 1, + MM_ROUTE_INFO_RELAY_BIT = 0x02, + + /// Publication or response (for TX) + MM_ROUTE_INFO_PUBLISH_POS = 2, + MM_ROUTE_INFO_PUBLISH_BIT = 0x04, +}; + + +/// @} end of group + +#endif /* MM_DEF_H_ */ diff --git a/mesh/api/mm_itf.h b/mesh/api/mm_itf.h new file mode 100644 index 0000000..238ddeb --- /dev/null +++ b/mesh/api/mm_itf.h @@ -0,0 +1,693 @@ +/** + **************************************************************************************** + * + * @file mm_itf.h + * + * @brief Header file for Mesh Model Message Interface Definitions + * + **************************************************************************************** + */ + +#ifndef _MM_ITF_H_ +#define _MM_ITF_H_ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include +#include "string.h" +#include "mesh.h" +#include "mm_def.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +/// define the static keyword for this compiler +#ifndef __STATIC + #define __STATIC static +#endif + +/// define the force inlining attribute for this compiler +#ifndef __INLINE__ + #define __INLINE__ __forceinline static +#endif + + +/* + * ENUMERATIONS + **************************************************************************************** + */ + + +/* + * TYPE DEFINTIONS + **************************************************************************************** + */ + +typedef struct mm_mdl_env mm_mdl_env_t; + +typedef struct mm_route_env mm_route_env_t; + +/** + **************************************************************************************** + * @brief Inform model about reception of a mesh message with a supported opcode + **************************************************************************************** + */ +typedef void (*mm_rx_cb)(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, mm_route_env_t *p_route_env); + +/** + **************************************************************************************** + * @brief Check if an opcode is handled by the model + **************************************************************************************** + */ +typedef uint8_t (*mm_opcode_check_cb)(mm_mdl_env_t *p_env, uint32_t opcode); + +/** + **************************************************************************************** + * @brief Set state value of a local Server Model + **************************************************************************************** + */ +typedef uint8_t (*mm_srv_set_cb)(mm_mdl_env_t *p_env, uint16_t state_id, uint32_t state); + +/** + **************************************************************************************** + * @brief Get state value using a Client Model + **************************************************************************************** + */ +typedef uint8_t (*mm_cli_get_cb)(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint16_t get_info); + +/** + **************************************************************************************** + * @brief Get state value using a Client Model + **************************************************************************************** + */ +typedef uint8_t (*mm_cli_set_cb)(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint32_t state_1, uint32_t state_2, uint16_t set_info); + +/** + **************************************************************************************** + * @brief Initiate transition to a new state value using a Client Model + **************************************************************************************** + */ +typedef uint8_t (*mm_cli_trans_cb)(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint32_t state_1, uint32_t state_2, + uint32_t trans_time_ms, uint16_t delay_ms, + uint16_t trans_info); + +/** + **************************************************************************************** + * @brief Definition of callback function called by the Binding Manager to inform the main model + * when one of the model composing a model group has requested transition to a new state. + * + * @param[in] main_mdl_lid Main model local index + * @param[in] req_model_id Model ID of model that has requested the transition + * @param[in] trans_type Transition type + * @param[in] state_delta State value or delta value + **************************************************************************************** + */ +typedef void (*mm_bind_trans_req_cb) (m_lid_t main_mdl_lid, uint32_t req_model_id, + uint8_t trans_type, uint32_t state_delta); + +/** + **************************************************************************************** + * @brief Definition of callback function called by the Binding Manager to inform a model about + * transition or publication event + * + * @param[in] mdl_lid Model local index + * @param[in] event Event (@see enum mesh_mdl_grp_event) + **************************************************************************************** + */ +typedef void (*mm_bind_grp_event_cb) (m_lid_t mdl_lid, uint8_t event, uint8_t info); + +/** + **************************************************************************************** + * @brief Definition of callback function by the Binding Manager to inform a model about + * state value to be set + * + * @param[in] mdl_lid Model local index + * @param[in] type State type (@see mm_state_type) + * @param[in] state State value + **************************************************************************************** + */ +typedef void (*mm_bind_set_state_cb) (m_lid_t mdl_lid, uint8_t type, uint32_t state); + + +/* + * STRUCTURES DEFINTIONS + **************************************************************************************** + */ + +/// Structure containing specific callback functions for a Server Model +typedef struct mm_srv_cb +{ + /// Set state value of a local Server Model + mm_srv_set_cb cb_set; +} mm_srv_cb_t; + +/// Structure containing specific callback functions for a Client Model +typedef struct mm_cli_cb +{ + /// Get state value using a Client Model + mm_cli_get_cb cb_get; + /// Set state value using a Client Model + mm_cli_set_cb cb_set; + /// Initiate transition to a new state value using a Client Model + mm_cli_trans_cb cb_trans; +} mm_cli_cb_t; + +/// Model Callback Structure +typedef struct mm_mdl_cb +{ + /// Inform model about reception of a mesh message with a supported opcode + mm_rx_cb cb_rx; + /// Check if an opcode is handled by the model + mm_opcode_check_cb cb_opcode_check; + /// Pointer to either callback functions for Server Model or Client Model + union + { + /// Set state value of a local Server Model + mm_srv_set_cb cb_srv_set; + /// Pointer to callback functions for Client Model + const mm_cli_cb_t *p_cb_cli; + }; +} mm_mdl_cb_t; + +/// Basic structure for model information +struct mm_mdl_env +{ + /// Model ID + uint32_t model_id; + /// Model callback functions + mm_mdl_cb_t mdl_cb; + /// Information bit field (@see enum mm_info) + uint8_t info; + /// Model Local Index + m_lid_t mdl_lid; + /// Group Local Index - filled by Binding Manager + m_lid_t grp_lid; + /// Element Index + uint8_t elmt_idx; +}; + +/// Basic structure for model information when sending of publications is supported +typedef struct mm_mdl_publi_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; + /// Timer for sending of publications + mesh_timer_t tmr_publi; + /// Publication period in milliseconds + uint32_t publi_period_ms; +} mm_mdl_publi_env_t; + +/// Structure to allocate as part of model environment for replay protection +typedef struct mm_replay_env +{ + /// List of replay elements + list_t list_replay; + /// Timer for replay protection + mesh_timer_t tmr_replay; + /// Validity delay in milliseconds for replay elements inserted in the list + uint16_t delay_ms; + /// Sum of delays of elements placed after the first replay element in the list + uint16_t delay_total_ms; +} mm_replay_env_t; + +/// Buffer environment when handled by models +struct mm_route_env +{ + /// Opcode + uint32_t opcode; + /// Information bitfield (@see enum mm_route_info) + uint16_t info; + union + { + /// Source address (for RX) + uint16_t src; + /// Destination address (for TX) + uint16_t dst; + } u_addr; + /// Application key local index + m_lid_t app_key_lid; + /// Model local index + m_lid_t mdl_lid; +}; + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/**************************************************************************************** + * APIs - Mesh Stack for Models + ****************************************************************************************/ + +/** + **************************************************************************************** + * @brief Register a model instance. + * + * @param[in] model_id Model ID. + * @param[in] elmt_idx Index of the element the model belongs to + * @param[in] config Configuration (@see mesh_mdl_config) + * + * @return The allocated Model LID if model instance has been registered + * MESH_INVALID_LID if it was not possible to register the model instance. + **************************************************************************************** + */ +m_lid_t ms_register_model(uint32_t model_id, uint8_t elmt_idx, uint8_t config); + +/** + **************************************************************************************** + * @brief Inform the Model State Manager about registration of a new model + * + * @param[in] model_id Model Identifier + * @param[in] elmt_idx Index of element the model belongs to + * @param[in] mdl_lid Local index allocated by the mesh profile for the model + * @param[in] mdl_role Model Role + * @param[in] env_size Size of environment to allocate for this model + * + * @return Pointer to the new environment or NULL + **************************************************************************************** + */ +mm_mdl_env_t* mm_state_register(uint8_t elmt_idx, uint32_t model_id, m_lid_t mdl_lid, + uint8_t mdl_role, uint16_t env_size); + +/** + **************************************************************************************** + * @brief Get pointer to environment allocated for a given model + * + * @param[in] mdl_lid Model local index + * + * @return Pointer to the environment + **************************************************************************************** + */ +mm_mdl_env_t *mm_state_get_env(m_lid_t mdl_lid); + +/** + **************************************************************************************** + * @brief Get local index allocated for a given model on a given element + * + * @param[in] elmt_idx Element Index + * @param[in] model_id Model Identifier + * + * @return Model local index or MESH_INVALID_LID if not found. + **************************************************************************************** + */ +m_lid_t mm_state_get_lid(uint8_t elmt_idx, uint32_t model_id); + +/** + **************************************************************************************** + * @brief Convert a transition time value in milliseconds in its packed format + * + * @param[in] trans_time_ms Transition time in milliseconds + * + * @return Packed transition time + **************************************************************************************** + */ +uint8_t mm_get_trans_time(uint32_t trans_time_ms); + +/** + **************************************************************************************** + * @brief Convert a transition time value in its packed format into a millisecond value + * + * @param[in] time_tt Transition time (packed format) + * + * @return Transition time in milliseconds + **************************************************************************************** + */ +uint32_t mm_get_trans_time_ms(uint8_t time_tt); + +/** + **************************************************************************************** + * @brief Add a group of bound models + * + * @param[in] nb_mdl Number of models bound with the main model + * @param[in] elmt_idx Index of element the models belong to + * @param[out] p_grp_lid Pointer to variable in which group local index will be returned + * @param[in] main_mdl_lid Local index of the main model + * @param[in] cb_grp_event Callback function for communication with the model when a group + * event occurs + * @param[in] cb_trans_req Callback function used to inform the main model about a transition + * request received by one of its bound model + * + * @return An error status + **************************************************************************************** + */ +m_lid_t mm_bind_add_group(uint8_t nb_mdl, uint8_t elmt_idx, m_lid_t main_mdl_lid, + mm_bind_grp_event_cb cb_grp_event, + mm_bind_trans_req_cb cb_trans_req); + +/** + **************************************************************************************** + * @brief Add a model to a group of bound models + * + * @param[in] grp_lid Group local index + * @param[in] mdl_lid Local index of the model + * @param[in] model_id Model ID of the model + * @param[in] cb_grp_event Callback function for communication with the model when a group + * event occurs + * + * @return An error status + **************************************************************************************** + */ +uint8_t mm_bind_group_add_mdl(m_lid_t grp_lid, m_lid_t mdl_lid, uint32_t model_id, + mm_bind_grp_event_cb cb_grp_event, + mm_bind_set_state_cb cb_set_state); + +/** + **************************************************************************************** + * @brief Set default transition time value for groups belonging to a given element + * + * @param[in] elmt_idx Element index + * @param[in] dft_trans_time Default transition time value + **************************************************************************************** + */ +void mm_bind_set_dft_trans_time(uint8_t elmt_idx, uint8_t dft_trans_time); + +/** + **************************************************************************************** + * @brief Function used by a bound model to set state + * + * @param[in] grp_lid Group local index + * @param[in] type State type (@see enum mm_state_type) + * @param[in] model_id Model ID of the model + * @param[in] state State value + * + * @return An error status (@see mesh_err) + **************************************************************************************** + */ +uint8_t mm_bind_set_state(m_lid_t grp_lid, uint8_t type, uint32_t model_id, uint32_t state); + +/** + **************************************************************************************** + * @brief Function used by a bound model to request a new transition. + * + * @param[in] grp_lid Group local index + * @param[in] mdl_lid Model local index of model that requires a transition + * @param[in] trans_type Transition Type (@see enum mm_trans_type) + * @param[in] state_delta Either new state value or delta value to be applied + * @param[in] trans_time Transition Time (packed format) + * @param[in] delay Delay + * + * @return An error status (@see mesh_err) + **************************************************************************************** + */ +uint8_t mm_bind_trans_req(m_lid_t grp_lid, m_lid_t mdl_lid, + uint8_t trans_type, uint32_t state_delta, uint8_t trans_time, + uint8_t delay); + +/** + **************************************************************************************** + * @brief Function called by a main model in order to initiate a new transition + * + * @param[in] grp_lid Group local index + * @param[in] trans_time Transition time + * @param[in] delay Delay duration in multiple of 5ms + * + * @return An error status + **************************************************************************************** + */ +uint8_t mm_bind_trans_new(m_lid_t grp_lid, uint8_t trans_type, uint8_t trans_time, uint8_t delay); + +/** + **************************************************************************************** + * @brief Function called by a main model in order to reject a transition required by one of its + * bound models + * + * @param[in] grp_lid Group local index + **************************************************************************************** + */ +void mm_bind_trans_reject(m_lid_t grp_lid); + +/** + **************************************************************************************** + * @brief Function called by a main model once all target states have been set in order to start + * the transition + * + * @param[in] grp_lid Group local index + * + * @return An error status + **************************************************************************************** + */ +uint8_t mm_bind_trans_start(m_lid_t grp_lid); + +/** + **************************************************************************************** + * @brief Check if transition is currently in progress for a group and retrieve the remaining + * transition time if needed + * + * @param[in] grp_lid Group local index + * @param[in] p_rem_time Pointer to the variable in which remaining time will be written + * if a transition is in progress + * + * @return true if transition is in progress else false + **************************************************************************************** + */ +uint8_t mm_bind_get_trans_info(m_lid_t grp_lid, uint8_t *p_trans_type, uint8_t *p_rem_time); + +/** + **************************************************************************************** + * @brief + * + * @param[in] p_mdl_env + * @param[in] src Source addr + * @param[in] tid TID value + * + * @return + **************************************************************************************** + */ +bool mm_replay_is_retx(mm_replay_env_t *p_mdl_env, uint16_t src, uint8_t tid); + +/** + **************************************************************************************** + * @brief Allocate a buffer for transmission of a message + * + * @param[in] data_len Requested data length + **************************************************************************************** + */ +__INLINE__ mesh_buf_t* mm_route_buf_alloc(uint16_t data_len) +{ + // Allocate buffer and return the status + return (mesh_buf_alloc(2, data_len, 0)); +} + +/** + **************************************************************************************** + * @brief Allocate a buffer for transmission of a status message sent as a direct answer. + * + * @param[in] data_len Requested data length + * @param[in] p_route_env Pointer at which address of allocated buffer must be written + **************************************************************************************** + */ +mesh_buf_t* mm_route_buf_alloc_status(uint16_t data_len, mm_route_env_t *p_route_env); + +/** + **************************************************************************************** + * @brief Provide a buffer to the Access Layer of the Mesh Profile for transmission + * + * @param[in] p_buf Pointer to buffer containing the message to send + **************************************************************************************** + */ +void mm_route_send(mesh_buf_t *p_buf); + + +/**************************************************************************************** + * APIs - Send Messages to application + ****************************************************************************************/ + +/** + **************************************************************************************** + * @brief Inform upper application about registered model + * Send a MESH_MDL_IND message with MM_REGISTER_IND indication code. + * + * @param[in] model_id Model Identifier + * @param[in] elmt_idx Element Index + * @param[in] mdl_lid Allocated model local index + **************************************************************************************** + */ +//void mm_register_ind_send(uint32_t model_id, uint8_t elmt_idx, m_lid_t mdl_lid); +#define mm_register_ind_send(model_id, elmt_idx, mdl_lid) + +/** + **************************************************************************************** + * @brief Inform application about a local model state update + * Send a MESH_MDL_IND message with MM_SRV_STATE_UPD_IND indication code. + * + * @param[in] state_id State identifier (@see mm_state_idx) + * @param[in] elmt_idx Element Index + * @param[in] state New state value or targeted state value depending on + * transition time + * @param[in] trans_time_ms Transition time in milliseconds + **************************************************************************************** + */ +void mm_srv_state_upd_ind_send(uint16_t state_id, uint8_t elmt_idx, uint32_t state, + uint32_t trans_time_ms); + +/** + **************************************************************************************** + * @brief Inform upper application about set global part of Generic Location state value + * Send a MESH_MDL_IND message with MM_SRV_LOCG_UPD_IND indication code. + * + * @param[in] elmt_idx Element Index + * @param[in] latitude Global Latitude + * @param[in] longitude Global Longitude + * @param[in] altitude Global Altitude + **************************************************************************************** + */ +void mm_srv_locg_upd_ind_send(uint8_t elmt_idx, int32_t latitude, int32_t longitude, + int16_t altitude); + +/** + **************************************************************************************** + * @brief Inform upper application about set local part of Generic Location state value + * Send a MESH_MDL_IND message with MM_SRV_LOCL_UPD_IND indication code. + * + * @param[in] elmt_idx Element Index + * @param[in] north Local North + * @param[in] east Local East + * @param[in] altitude Local Altitude + * @param[in] floor Floor Number + * @param[in] uncertainty Uncertainty + **************************************************************************************** + */ +void mm_srv_locl_upd_ind_send(uint8_t elmt_idx, int16_t north, int16_t east, int16_t altitude, + uint8_t floor, uint16_t uncertainty); + +/** + **************************************************************************************** + * @brief Send a MESH_MDL_REQ_IND message to upper application in order to retrieve + * a state value not stored locally + * + * @param[in] req_code Request indication code (@see mm_req_code) + * @param[in] elmt_dix Element Index + **************************************************************************************** + */ +void mm_srv_state_req_ind_send(uint16_t req_code, uint8_t elmt_idx); + +/** + **************************************************************************************** + * @brief Send a MESH_MDL_REQ_IND message with MM_SRV_PROP_GET_REQ_IND to Inform application + * about received get request for a Generic User/Admin/Manufacturer Property. + * A confirmation is expected from the application. + * + * @param[in] elmt_idx Index of element for which get request has been received + * @param[in] prop_type Property type (@see enum mm_prop_type) + * @param[in] prop_id Property ID + **************************************************************************************** + */ +void mm_srv_prop_get_send(uint8_t elmt_idx, uint8_t prop_type, uint16_t prop_id); + +/** + **************************************************************************************** + * @brief Send a MESH_MDL_REQ_IND message with MM_SRV_PROP_SET_REQ_IND to Inform application + * about received set request for a Generic User/Admin/Manufacturer Property. + * A confirmation is expected from the application. + * + * @param[in] elmt_idx Index of element for which set request has been received + * @param[in] prop_type Property type (@see enum mm_prop_type) + * @param[in] prop_id Property ID + * @param[in] length Property value length + * @param[in] p_val Pointer to the received property value + **************************************************************************************** + */ +void mm_srv_prop_set_send(uint8_t elmt_idx, uint8_t prop_type, uint16_t prop_id, + uint16_t length, uint8_t *p_val); + +/** + **************************************************************************************** + * @brief Inform application about received state value from an element + * Send a MESH_MDL_IND message with MM_CLI_STATE_IND indication code. + * + * @param[in] src Address of element for which state value has been received + * @param[in] state_id State Identifier + * @param[in] state_1 State value 1 + * @param[in] state_2 State value 2 + * @param[in] rem_time_ms Remaining time in milliseconds + **************************************************************************************** + */ +void mm_cli_state_ind_send(uint16_t src, uint16_t state_id, uint32_t state_1, + uint32_t state_2, uint32_t rem_time_ms); + +/** + **************************************************************************************** + * @brief Inform application about received Generic Battery state value from an element + * Send a MESH_MDL_IND message with MM_CLI_BAT_IND indication code. + * + * @param[in] src Address of node's element that has reported its Generic Battery state + * @param[in] bat_lvl Battery level value + * @param[in] time_dischrg Time to discharge + * @param[in] time_chrg Time to charge + * @param[in] flags Flags + **************************************************************************************** + */ +void mm_cli_bat_ind_send(uint16_t src, uint8_t bat_lvl, uint32_t time_dischrg, + uint32_t time_chrg, uint8_t flags); + +/** + **************************************************************************************** + * @brief Inform application about received Generic Location Global state value from an element + * Send a MESH_MDL_IND message with a MM_CLI_LOCG_IND indication code. + * + * @param[in] src Address of node's element that has reported its Generic Location state + * @param[in] latitude Global Latitude + * @param[in] longitude Global Longitude + * @param[in] altitude Global Altitude + **************************************************************************************** + */ +void mm_cli_locg_ind_send(uint16_t src, int32_t latitude, int32_t longitude, int16_t altitude); + +/** + **************************************************************************************** + * @brief Inform application about received Generic Location Local state value from an element + * Send a MESH_MDL_IND message with a MM_CLI_LOCL_IND indication code. + * + * @param[in] src Address of node's element that has reported its Generic Location state + * @param[in] north Local North + * @param[in] East Local East + * @param[in] altitude Local Altitude + * @param[in] floor Floor + * @param[in] uncertainty Uncertainty + **************************************************************************************** + */ +void mm_cli_locl_ind_send(uint16_t src, int16_t north, int16_t east, int16_t altitude, + uint8_t floor, uint16_t uncertainty); + +/** + **************************************************************************************** + * @brief Inform application about reception of a Generic User/Admin/Manufacturer Property value. + * Send a MESH_MDL_IND message with a MM_CLI_PROP_IND indication code. + * + * @param[in] src Address of element for which property value has been received + * @param[in] prop_id Property ID + * @param[in] user_access User access + * @param[in] length Property value length + * @param[in] p_val Pointer to the property value + **************************************************************************************** + */ +void mm_cli_prop_ind_send(uint16_t src, uint16_t prop_id, uint8_t user_access, uint16_t length, + uint8_t *p_val); + +/** + **************************************************************************************** + * @brief Inform application about reception of list of Generic User/Admin/Manufacturer/Client + * Properties supported by an element. + * Send a MESH_MDL_IND message with a MM_CLI_PROP_IND indication code. + * + * @param[in] src Address of element for which list of properties has been received + * @param[in] prop_type Property type (@see enum mm_prop_type) + * @param[in] nb_prop Number of Properties + * @param[in] p_prop_ids Pointer to received list of Property IDs + **************************************************************************************** + */ +void mm_cli_prop_list_ind_send(uint16_t src, uint8_t prop_type, uint16_t nb_prop, + uint16_t *p_prop_ids); + + +#endif // _MM_ITF_H_ diff --git a/mesh/genie/genie_mesh.c b/mesh/genie/genie_mesh.c new file mode 100644 index 0000000..9290b3d --- /dev/null +++ b/mesh/genie/genie_mesh.c @@ -0,0 +1,166 @@ +/** + **************************************************************************************** + * + * @file genie_mesh.c + * + * @brief Tmall Genie mesh + * + **************************************************************************************** + */ + +#include +#include +#include "string.h" +#include "sha256.h" +#include "genie_mesh.h" + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +// pid + ',' + mac + ',' + secret = 8+1+12+1+32 = 54 +#define GENIE_OOB_STR_LEN (54) +// pid + ',' + mac + ',' + secret + ',' + rand = 8+1+12+1+32+1+32 = 87 +#define GENIE_OOB_RND_LEN (87) + + +/* + * LOCAL FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Swap bytes of an array of bytes + * . + * The swap is done in every case. Should not be called directly. + * + * @param[in] dst The output value. + * @param[in] src The input value. + * @param[in] len number of bytes to swap + **************************************************************************************** + */ +static __inline void co_bswap(uint8_t *dst, const uint8_t *src, uint16_t len) +{ + while (len--) + { + *dst++ = src[len]; + } +} + +/** + **************************************************************************************** + * @brief Function to return the hex char of a 4bit. + * @return The hex char. + **************************************************************************************** + */ +static __inline uint8_t co_hex(uint8_t b4) +{ + return b4 < 10 ? b4 + '0' : b4 - 10 + 'a'; +} + +static void hex2str(uint8_t *dest, const uint8_t *src, uint16_t len) +{ + while (len--) + { + *dest++ = co_hex(*src >> 4); + *dest++ = co_hex(*src & 0x0F); + src++; + } +} + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +/** + * @brief generate the trituple info formatted in uuid + * @return the pointer refering to uuid + */ +void genie_gen_uuid(uint8_t *p_uuid, const tri_tuple_t *p_triple) +{ + // all fields in uuid should be in little-endian + + // B[0:1] - CID, Taobao + *p_uuid++ = (GENIE_MESH_CID >> 0) & 0xFF; + *p_uuid++ = (GENIE_MESH_CID >> 8) & 0xFF; + + // B[2] - Flags Bit0~Bit3: 0001 (broadcast version) Bit4: (one secret pre device) + // Bit5: 1 (OTA support) Bit6~Bit7: 01 (00:4.0 01:4.2 10:5.0 11:>5.0) + *p_uuid++ = 0x71; + + // B[3:6] - Product ID + *p_uuid++ = (uint8_t)( p_triple->pid & 0xff); + *p_uuid++ = (uint8_t)((p_triple->pid & 0xff00) >> 8); + *p_uuid++ = (uint8_t)((p_triple->pid & 0xff0000) >> 16); + *p_uuid++ = (uint8_t)((p_triple->pid & 0xff000000) >> 24); + + // B[7:12] - MAC addr (device name) + for (uint8_t i = 0; i < 6; i++) + { + *p_uuid++ = p_triple->mac[TRI_TUPLE_MAC_SIZE - 1 - i]; + } + + // B[13:15] - Feature + *p_uuid++ = UNPROV_ADV_FEAT0_BROADCAST | UNPROV_ADV_FEAT0_UUID_VER0; + *p_uuid++ = 0; + *p_uuid = 0; +} + +/** + * @brief get the authentication info + * @param[in] random: the random sequence used for calculating. + * @return the authenticated sequence + */ +void genie_calc_auth(uint8_t *p_auth, const tri_tuple_t *p_triple) +{ + struct tc_sha256_state_struct sha256_ctx; + uint8_t tmp_auth[TC_SHA256_DIGEST_SIZE]; + + // Compose oob information + uint8_t oob_str[GENIE_OOB_STR_LEN]; + + hex2str(&oob_str[0], (uint8_t *)&p_triple->pid, 4); + oob_str[8] = ','; + hex2str(&oob_str[9], (uint8_t *)&p_triple->mac, 6); + oob_str[21] = ','; + hex2str(&oob_str[22], (uint8_t *)&p_triple->key, 16); + + /* calculate the sha256 of oob info */ + tc_sha256_init(&sha256_ctx); + tc_sha256_update(&sha256_ctx, oob_str, GENIE_OOB_STR_LEN); + tc_sha256_final(tmp_auth, &sha256_ctx); + + /* fetch the top 16 bytes as static value */ + co_bswap(p_auth, tmp_auth, 16); +} + +void genie_calc_auth_with_rand(uint8_t *p_auth, const tri_tuple_t *p_triple, const uint8_t *p_rand) +{ + struct tc_sha256_state_struct sha256_ctx; + uint8_t tmp_auth[TC_SHA256_DIGEST_SIZE]; + + // Compose oob information + uint8_t oob_str[GENIE_OOB_RND_LEN]; + + hex2str(&oob_str[0], (uint8_t *)&p_triple->pid, 4); + oob_str[8] = ','; + hex2str(&oob_str[9], (uint8_t *)&p_triple->mac, 6); + oob_str[21] = ','; + hex2str(&oob_str[22], (uint8_t *)&p_triple->key, 16); + oob_str[54] = ','; + hex2str(&oob_str[55], (uint8_t *)&p_rand, 16); + + /* calculate the sha256 of oob info */ + tc_sha256_init(&sha256_ctx); + tc_sha256_update(&sha256_ctx, oob_str, GENIE_OOB_RND_LEN); + tc_sha256_final(tmp_auth, &sha256_ctx); + + /* fetch the top 16 bytes as static value */ + co_bswap(p_auth, tmp_auth, 16); +} + diff --git a/mesh/genie/genie_mesh.h b/mesh/genie/genie_mesh.h new file mode 100644 index 0000000..57f74c5 --- /dev/null +++ b/mesh/genie/genie_mesh.h @@ -0,0 +1,140 @@ +/** + **************************************************************************************** + * + * @file genie_mesh.h + * + * @brief Tmall Genie mesh + * + **************************************************************************************** + */ + +#ifndef __GENIE_MESH_H__ +#define __GENIE_MESH_H__ + +#include + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// Genie's IDs +#define GENIE_MESH_CID (0x01A8) // taobao.inc + +/// Triple Tuple size +#define TRI_TUPLE_SIZE (28) // 4+16+6+2 +#define TRI_TUPLE_VAL_SIZE (26) // 4+16+6 +#define TRI_TUPLE_PID_SIZE (4) +#define TRI_TUPLE_KEY_SIZE (16) +#define TRI_TUPLE_MAC_SIZE (6) +#define TRI_TUPLE_CRC_SIZE (2) + +/// Size of Device UUID +#define MESH_DEV_UUID_LEN (16) + +/// Unprovison Feature Flag +//fixed broadcast +#define UNPROV_ADV_FEAT0_BROADCAST 0x00 +//sig mesh profile, This version is deprecated +#define UNPROV_ADV_FEAT0_UUID_VER0 0x00 +//Optimized the distribution network process and needs to support Vendor Model +#define UNPROV_ADV_FEAT0_UUID_VER1 0x02 +//This version adds some new Mesh features, see the definition of FeatureFlag2 flag bit for details +#define UNPROV_ADV_FEAT0_UUID_VER2 0x04 +//Tiny Mesh flag +#define UNPROV_ADV_FEAT1_TINY_MESH_FLAG 0x01 +//expand Auth value flag +#define UNPROV_ADV_FEAT1_EXPAND_AUTH_FLAG 0x02 +//BLE Advertising pair flag +#define UNPROV_ADV_FEAT1_BLE_ADV_PAIR_FLAG 0x04 +//RFU flag +#define UNPROV_ADV_FEAT1_RFU_FLAG 0x08 +//Genie BT Mesh Stack flag bit7~4 +#define UNPROV_ADV_FEAT1_GENIE_MESH_STACK 0x00 + + +/* + * ENUMERATIONS + **************************************************************************************** + */ + +/// Storage Index +enum genie_store_index +{ + GENIE_STORE_INDEX_START = 0, + GFI_MESH_PARA, + GFI_MESH_TRITUPLE, + GFI_MESH_SADDR, + GFI_MESH_SUB, + GFI_MESH_SEQ, + GFI_MESH_RESET_CNT, + GFI_MESH_POWERUP, + GFI_MESH_HB, + GFI_MESH_DEVKEY, + GFI_MESH_NETKEY, + GFI_MESH_APPKEY, + GFI_OTA_INDICAT, + GFI_OTA_IMAGE_ID, + GFI_USERDATA_START, + GFI_MESH_CTRL_RELAY, + GFI_MESH_APPKEY1, + GFI_MESH_SCENE_DATA, + GFI_MESH_PANEL_DATA, +}; + +/// Storage Status +enum genie_store_status +{ + GENIE_STORE_SUCCESS = 0, + GENIE_STORE_INIT_FAIL, + GENIE_STORE_MALLOC_FAIL, + GENIE_STORE_EARSE_FAIL, + GENIE_STORE_DATA_INVALID, + GENIE_STORE_ERASE_FAIL, + GENIE_STORE_READ_FAIL, + GENIE_STORE_WRITE_FAIL, + GENIE_STORE_DELETE_FAIL, + GENIE_STORE_INVALID_INDEX, + GENIE_STORE_SIZE_ERROR, + GENIE_STORE_CHECK_CRC_FAIL +}; + + +/* + * STRUCTURES + **************************************************************************************** + */ + +/// Triple Tuple struct +typedef struct tri_tuple +{ + uint32_t pid; + uint8_t key[TRI_TUPLE_KEY_SIZE]; + uint8_t mac[TRI_TUPLE_MAC_SIZE]; + uint16_t crc; +} tri_tuple_t; + + +/* +* FUNCTIONS DECLARATION +**************************************************************************************** +*/ + +/** + * @brief generate the trituple info formatted in uuid + * @return the pointer refering to uuid + */ +void genie_gen_uuid(uint8_t *p_uuid, const tri_tuple_t *p_triple); + +/** + * @brief get the authentication info + * @param[in] random: the random sequence used for calculating. + * @return the authenticated sequence + */ +void genie_calc_auth(uint8_t *p_auth, const tri_tuple_t *p_triple); + +void genie_calc_auth_with_rand(uint8_t *p_auth, const tri_tuple_t *p_triple, const uint8_t *p_rand); + + +#endif //__GENIE_MESH_H__ diff --git a/mesh/genie/sha256.c b/mesh/genie/sha256.c new file mode 100644 index 0000000..1b993f6 --- /dev/null +++ b/mesh/genie/sha256.c @@ -0,0 +1,216 @@ +/* sha256.c - TinyCrypt SHA-256 crypto hash algorithm implementation */ + +/* + * Copyright (C) 2017 by Intel Corporation, 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 Intel Corporation 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 "sha256.h" + + +static void compress(unsigned int *iv, const uint8_t *data); + +int tc_sha256_init(TCSha256State_t s) +{ + /* input sanity check: */ + if (s == (TCSha256State_t) 0) { + return SHA256_CRYPTO_FAIL; + } + + /* + * Setting the initial state values. + * These values correspond to the first 32 bits of the fractional parts + * of the square roots of the first 8 primes: 2, 3, 5, 7, 11, 13, 17 + * and 19. + */ + memset((uint8_t *) s, 0x00, sizeof(*s)); + s->iv[0] = 0x6a09e667; + s->iv[1] = 0xbb67ae85; + s->iv[2] = 0x3c6ef372; + s->iv[3] = 0xa54ff53a; + s->iv[4] = 0x510e527f; + s->iv[5] = 0x9b05688c; + s->iv[6] = 0x1f83d9ab; + s->iv[7] = 0x5be0cd19; + + return SHA256_CRYPTO_SUCCESS; +} + +int tc_sha256_update(TCSha256State_t s, const uint8_t *data, size_t datalen) +{ + /* input sanity check: */ + if (s == (TCSha256State_t) 0 || + data == (void *) 0) { + return SHA256_CRYPTO_FAIL; + } else if (datalen == 0) { + return SHA256_CRYPTO_SUCCESS; + } + + while (datalen-- > 0) { + s->leftover[s->leftover_offset++] = *(data++); + if (s->leftover_offset >= TC_SHA256_BLOCK_SIZE) { + compress(s->iv, s->leftover); + s->leftover_offset = 0; + s->bits_hashed += (TC_SHA256_BLOCK_SIZE << 3); + } + } + + return SHA256_CRYPTO_SUCCESS; +} + +int tc_sha256_final(uint8_t *digest, TCSha256State_t s) +{ + unsigned int i; + + /* input sanity check: */ + if (digest == (uint8_t *) 0 || + s == (TCSha256State_t) 0) { + return SHA256_CRYPTO_FAIL; + } + + s->bits_hashed += (s->leftover_offset << 3); + + s->leftover[s->leftover_offset++] = 0x80; /* always room for one byte */ + if (s->leftover_offset > (sizeof(s->leftover) - 8)) { + /* there is not room for all the padding in this block */ + memset(s->leftover + s->leftover_offset, 0x00, + sizeof(s->leftover) - s->leftover_offset); + compress(s->iv, s->leftover); + s->leftover_offset = 0; + } + + /* add the padding and the length in big-Endian format */ + memset(s->leftover + s->leftover_offset, 0x00, + sizeof(s->leftover) - 8 - s->leftover_offset); + s->leftover[sizeof(s->leftover) - 1] = (uint8_t)(s->bits_hashed); + s->leftover[sizeof(s->leftover) - 2] = (uint8_t)(s->bits_hashed >> 8); + s->leftover[sizeof(s->leftover) - 3] = (uint8_t)(s->bits_hashed >> 16); + s->leftover[sizeof(s->leftover) - 4] = (uint8_t)(s->bits_hashed >> 24); + s->leftover[sizeof(s->leftover) - 5] = (uint8_t)(s->bits_hashed >> 32); + s->leftover[sizeof(s->leftover) - 6] = (uint8_t)(s->bits_hashed >> 40); + s->leftover[sizeof(s->leftover) - 7] = (uint8_t)(s->bits_hashed >> 48); + s->leftover[sizeof(s->leftover) - 8] = (uint8_t)(s->bits_hashed >> 56); + + /* hash the padding and length */ + compress(s->iv, s->leftover); + + /* copy the iv out to digest */ + for (i = 0; i < TC_SHA256_STATE_BLOCKS; ++i) { + unsigned int t = *((unsigned int *) &s->iv[i]); + *digest++ = (uint8_t)(t >> 24); + *digest++ = (uint8_t)(t >> 16); + *digest++ = (uint8_t)(t >> 8); + *digest++ = (uint8_t)(t); + } + + /* destroy the current state */ + memset(s, 0, sizeof(*s)); + + return SHA256_CRYPTO_SUCCESS; +} + +/* + * Initializing SHA-256 Hash constant words K. + * These values correspond to the first 32 bits of the fractional parts of the + * cube roots of the first 64 primes between 2 and 311. + */ +static const unsigned int k256[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, + 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, + 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, + 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, + 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, + 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +}; + +static inline unsigned int ROTR(unsigned int a, unsigned int n) +{ + return (((a) >> n) | ((a) << (32 - n))); +} + +#define Sigma0(a)(ROTR((a), 2) ^ ROTR((a), 13) ^ ROTR((a), 22)) +#define Sigma1(a)(ROTR((a), 6) ^ ROTR((a), 11) ^ ROTR((a), 25)) +#define sigma0(a)(ROTR((a), 7) ^ ROTR((a), 18) ^ ((a) >> 3)) +#define sigma1(a)(ROTR((a), 17) ^ ROTR((a), 19) ^ ((a) >> 10)) + +#define Ch(a, b, c)(((a) & (b)) ^ ((~(a)) & (c))) +#define Maj(a, b, c)(((a) & (b)) ^ ((a) & (c)) ^ ((b) & (c))) + +static inline unsigned int BigEndian(const uint8_t **c) +{ + unsigned int n = 0; + + n = (((unsigned int)(*((*c)++))) << 24); + n |= ((unsigned int)(*((*c)++)) << 16); + n |= ((unsigned int)(*((*c)++)) << 8); + n |= ((unsigned int)(*((*c)++))); + return n; +} + +static void compress(unsigned int *iv, const uint8_t *data) +{ + unsigned int a, b, c, d, e, f, g, h; + unsigned int s0, s1; + unsigned int t1, t2; + unsigned int work_space[16]; + unsigned int n; + unsigned int i; + + a = iv[0]; b = iv[1]; c = iv[2]; d = iv[3]; + e = iv[4]; f = iv[5]; g = iv[6]; h = iv[7]; + + for (i = 0; i < 16; ++i) { + n = BigEndian(&data); + t1 = work_space[i] = n; + t1 += h + Sigma1(e) + Ch(e, f, g) + k256[i]; + t2 = Sigma0(a) + Maj(a, b, c); + h = g; g = f; f = e; e = d + t1; + d = c; c = b; b = a; a = t1 + t2; + } + + for ( ; i < 64; ++i) { + s0 = work_space[(i+1)&0x0f]; + s0 = sigma0(s0); + s1 = work_space[(i+14)&0x0f]; + s1 = sigma1(s1); + + t1 = work_space[i&0xf] += s0 + s1 + work_space[(i+9)&0xf]; + t1 += h + Sigma1(e) + Ch(e, f, g) + k256[i]; + t2 = Sigma0(a) + Maj(a, b, c); + h = g; g = f; f = e; e = d + t1; + d = c; c = b; b = a; a = t1 + t2; + } + + iv[0] += a; iv[1] += b; iv[2] += c; iv[3] += d; + iv[4] += e; iv[5] += f; iv[6] += g; iv[7] += h; +} diff --git a/mesh/genie/sha256.h b/mesh/genie/sha256.h new file mode 100644 index 0000000..69e2e7d --- /dev/null +++ b/mesh/genie/sha256.h @@ -0,0 +1,134 @@ +/* sha256.h - TinyCrypt interface to a SHA-256 implementation */ + +/* + * Copyright (C) 2017 by Intel Corporation, 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 Intel Corporation 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. + */ + +/** + * @file + * @brief Interface to a SHA-256 implementation. + * + * Overview: SHA-256 is a NIST approved cryptographic hashing algorithm + * specified in FIPS 180. A hash algorithm maps data of arbitrary + * size to data of fixed length. + * + * Security: SHA-256 provides 128 bits of security against collision attacks + * and 256 bits of security against pre-image attacks. SHA-256 does + * NOT behave like a random oracle, but it can be used as one if + * the string being hashed is prefix-free encoded before hashing. + * + * Usage: 1) call tc_sha256_init to initialize a struct + * tc_sha256_state_struct before hashing a new string. + * + * 2) call tc_sha256_update to hash the next string segment; + * tc_sha256_update can be called as many times as needed to hash + * all of the segments of a string; the order is important. + * + * 3) call tc_sha256_final to out put the digest from a hashing + * operation. + */ + +#ifndef __TC_SHA256_H__ +#define __TC_SHA256_H__ + +#include +#include +#include "string.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +#define SHA256_CRYPTO_SUCCESS 1 +#define SHA256_CRYPTO_FAIL 0 + +#define TC_SHA256_BLOCK_SIZE (64) +#define TC_SHA256_DIGEST_SIZE (32) +#define TC_SHA256_STATE_BLOCKS (TC_SHA256_DIGEST_SIZE/4) + +struct tc_sha256_state_struct { + unsigned int iv[TC_SHA256_STATE_BLOCKS]; + uint64_t bits_hashed; + uint8_t leftover[TC_SHA256_BLOCK_SIZE]; + size_t leftover_offset; +}; + +typedef struct tc_sha256_state_struct *TCSha256State_t; + +/** + * @brief SHA256 initialization procedure + * Initializes s + * @return returns SHA256_CRYPTO_SUCCESS (1) + * returns SHA256_CRYPTO_FAIL (0) if s == NULL + * @param s Sha256 state struct + */ +int tc_sha256_init(TCSha256State_t s); + +/** + * @brief SHA256 update procedure + * Hashes data_length bytes addressed by data into state s + * @return returns SHA256_CRYPTO_SUCCESS (1) + * returns SHA256_CRYPTO_FAIL (0) if: + * s == NULL, + * s->iv == NULL, + * data == NULL + * @note Assumes s has been initialized by tc_sha256_init + * @warning The state buffer 'leftover' is left in memory after processing + * If your application intends to have sensitive data in this + * buffer, remind to erase it after the data has been processed + * @param s Sha256 state struct + * @param data message to hash + * @param datalen length of message to hash + */ +int tc_sha256_update (TCSha256State_t s, const uint8_t *data, size_t datalen); + +/** + * @brief SHA256 final procedure + * Inserts the completed hash computation into digest + * @return returns SHA256_CRYPTO_SUCCESS (1) + * returns SHA256_CRYPTO_FAIL (0) if: + * s == NULL, + * s->iv == NULL, + * digest == NULL + * @note Assumes: s has been initialized by tc_sha256_init + * digest points to at least TC_SHA256_DIGEST_SIZE bytes + * @warning The state buffer 'leftover' is left in memory after processing + * If your application intends to have sensitive data in this + * buffer, remind to erase it after the data has been processed + * @param digest unsigned eight bit integer + * @param Sha256 state struct + */ +int tc_sha256_final(uint8_t *digest, TCSha256State_t s); + +#ifdef __cplusplus +} +#endif + +#endif /* __TC_SHA256_H__ */ diff --git a/mesh/lib/ble6_mesh.lib b/mesh/lib/ble6_mesh.lib new file mode 100644 index 0000000..bf38f8f Binary files /dev/null and b/mesh/lib/ble6_mesh.lib differ diff --git a/mesh/lib/ble6_mesh_full.lib b/mesh/lib/ble6_mesh_full.lib new file mode 100644 index 0000000..9972cf5 Binary files /dev/null and b/mesh/lib/ble6_mesh_full.lib differ diff --git a/mesh/lib/sig_model.h b/mesh/lib/sig_model.h new file mode 100644 index 0000000..7830ac9 --- /dev/null +++ b/mesh/lib/sig_model.h @@ -0,0 +1,31 @@ +/** + **************************************************************************************** + * + * @file sig_model.h + * + * @brief Header file for SIG Mesh Models + * + **************************************************************************************** + */ + +#ifndef SIG_MODEL_H_ +#define SIG_MODEL_H_ + +/// Mesh Generic Model +#include "..\model\api\mm_gen.h" +#include "..\model\api\mm_gens.h" +#include "..\model\api\mm_genc.h" + +/// Mesh Light Model +#include "..\model\api\mm_light.h" +#include "..\model\api\mm_lights.h" +#include "..\model\api\mm_lightc.h" + +/// Mesh Time and Scene Model +#include "..\model\api\mm_tscn.h" + +/// Mesh Sensor Model +#include "..\model\api\mm_sens.h" + + +#endif /* SIG_MODEL_H_ */ diff --git a/mesh/lib/sig_model.lib b/mesh/lib/sig_model.lib new file mode 100644 index 0000000..90cf822 Binary files /dev/null and b/mesh/lib/sig_model.lib differ diff --git a/mesh/mdk/clean.bat b/mesh/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/mesh/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/mesh/mdk/model.uvoptx b/mesh/mdk/model.uvoptx new file mode 100644 index 0000000..35c91b0 --- /dev/null +++ b/mesh/mdk/model.uvoptx @@ -0,0 +1,580 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + sigModel + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 7 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 0 + + + + + + + + + + + BIN\UL2CM3.DLL + + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FC1000 -FD20000000 + + + 0 + JL2CM3 + -U81480416 -O78 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO17 -FD20000000 -FC1000 -FN0 + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + 0 + DLGUARM + + + + + + + 0 + 1 + chachaTestTable + + + + + 1 + 2 + 0x20002c0c + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + api + 1 + 0 + 0 + 0 + + 1 + 1 + 5 + 0 + 0 + 0 + ..\lib\sig_model.h + sig_model.h + 0 + 0 + + + 1 + 2 + 5 + 0 + 0 + 0 + ..\api\mm_def.h + mm_def.h + 0 + 0 + + + 1 + 3 + 5 + 0 + 0 + 0 + ..\api\mm_itf.h + mm_itf.h + 0 + 0 + + + + + gens + 1 + 0 + 0 + 0 + + 2 + 4 + 1 + 0 + 0 + 0 + ..\model\gen\gens\mm_gens_oo.c + mm_gens_oo.c + 0 + 0 + + + 2 + 5 + 1 + 0 + 0 + 0 + ..\model\gen\gens\mm_gens_lvl.c + mm_gens_lvl.c + 0 + 0 + + + 2 + 6 + 1 + 0 + 0 + 0 + ..\model\gen\gens\mm_gens_poo.c + mm_gens_poo.c + 0 + 0 + + + 2 + 7 + 1 + 0 + 0 + 0 + ..\model\gen\gens\mm_gens_plvl.c + mm_gens_plvl.c + 0 + 0 + + + 2 + 8 + 1 + 0 + 0 + 0 + ..\model\gen\gens\mm_gens_loc.c + mm_gens_loc.c + 0 + 0 + + + 2 + 9 + 1 + 0 + 0 + 0 + ..\model\gen\gens\mm_gens_dtt.c + mm_gens_dtt.c + 0 + 0 + + + 2 + 10 + 1 + 0 + 0 + 0 + ..\model\gen\gens\mm_gens_bat.c + mm_gens_bat.c + 0 + 0 + + + 2 + 11 + 1 + 0 + 0 + 0 + ..\model\gen\gens\mm_gens_prop.c + mm_gens_prop.c + 0 + 0 + + + + + genc + 1 + 0 + 0 + 0 + + 3 + 12 + 1 + 0 + 0 + 0 + ..\model\gen\genc\mm_genc_oo.c + mm_genc_oo.c + 0 + 0 + + + 3 + 13 + 1 + 0 + 0 + 0 + ..\model\gen\genc\mm_genc_lvl.c + mm_genc_lvl.c + 0 + 0 + + + 3 + 14 + 1 + 0 + 0 + 0 + ..\model\gen\genc\mm_genc_poo.c + mm_genc_poo.c + 0 + 0 + + + 3 + 15 + 1 + 0 + 0 + 0 + ..\model\gen\genc\mm_genc_plvl.c + mm_genc_plvl.c + 0 + 0 + + + 3 + 16 + 1 + 0 + 0 + 0 + ..\model\gen\genc\mm_genc_loc.c + mm_genc_loc.c + 0 + 0 + + + 3 + 17 + 1 + 0 + 0 + 0 + ..\model\gen\genc\mm_genc_dtt.c + mm_genc_dtt.c + 0 + 0 + + + 3 + 18 + 1 + 0 + 0 + 0 + ..\model\gen\genc\mm_genc_bat.c + mm_genc_bat.c + 0 + 0 + + + 3 + 19 + 1 + 0 + 0 + 0 + ..\model\gen\genc\mm_genc_prop.c + mm_genc_prop.c + 0 + 0 + + + + + lights + 1 + 0 + 0 + 0 + + 4 + 20 + 1 + 0 + 0 + 0 + ..\model\light\lights\mm_lights_ctl.c + mm_lights_ctl.c + 0 + 0 + + + 4 + 21 + 1 + 0 + 0 + 0 + ..\model\light\lights\mm_lights_hsl.c + mm_lights_hsl.c + 0 + 0 + + + 4 + 22 + 1 + 0 + 0 + 0 + ..\model\light\lights\mm_lights_ln.c + mm_lights_ln.c + 0 + 0 + + + + + lightc + 1 + 0 + 0 + 0 + + 5 + 23 + 1 + 0 + 0 + 0 + ..\model\light\lightc\mm_lightc_ctl.c + mm_lightc_ctl.c + 0 + 0 + + + 5 + 24 + 1 + 0 + 0 + 0 + ..\model\light\lightc\mm_lightc_hsl.c + mm_lightc_hsl.c + 0 + 0 + + + 5 + 25 + 1 + 0 + 0 + 0 + ..\model\light\lightc\mm_lightc_ln.c + mm_lightc_ln.c + 0 + 0 + + + 5 + 26 + 1 + 0 + 0 + 0 + ..\model\light\lightc\mm_lightc_xyl.c + mm_lightc_xyl.c + 0 + 0 + + + + + sens + 0 + 0 + 0 + 0 + + + + tscn + 0 + 0 + 0 + 0 + + +
diff --git a/mesh/mdk/model.uvprojx b/mesh/mdk/model.uvprojx new file mode 100644 index 0000000..34f156f --- /dev/null +++ b/mesh/mdk/model.uvprojx @@ -0,0 +1,552 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + sigModel + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + ARMCM0P + ARM + ARM.CMSIS.5.6.0 + http://www.keil.com/pack/ + CPUTYPE("Cortex-M0+") CLOCK(16000000) ESEL ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000) + 0 + $$Device:ARMCM0P$Device\ARM\ARMCM0plus\Include\ARMCM0plus.h + + + + + + + + + + $$Device:ARMCM0P$Device\ARM\SVD\ARMCM0P.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + sig_model + 0 + 1 + 0 + 0 + 0 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + cmd.exe /C copy "#L" "$P..\lib" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0+ + SARMCM3.DLL + + TARMCM1.DLL + -pCM0+ + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M0+" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --gnu --thumb --bss_threshold=0 + __NO_EMBEDDED_ASM + + ..\api;..\lib;..\model;..\model\api;..\..\core;..\..\ble\api + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20003000 + + + + + --any_placement=best_fit --datacompressor=off + + + + + + + + api + + + sig_model.h + 5 + ..\lib\sig_model.h + + + mm_def.h + 5 + ..\api\mm_def.h + + + mm_itf.h + 5 + ..\api\mm_itf.h + + + + + gens + + + mm_gens_oo.c + 1 + ..\model\gen\gens\mm_gens_oo.c + + + mm_gens_lvl.c + 1 + ..\model\gen\gens\mm_gens_lvl.c + + + mm_gens_poo.c + 1 + ..\model\gen\gens\mm_gens_poo.c + + + mm_gens_plvl.c + 1 + ..\model\gen\gens\mm_gens_plvl.c + + + mm_gens_loc.c + 1 + ..\model\gen\gens\mm_gens_loc.c + + + mm_gens_dtt.c + 1 + ..\model\gen\gens\mm_gens_dtt.c + + + mm_gens_bat.c + 1 + ..\model\gen\gens\mm_gens_bat.c + + + mm_gens_prop.c + 1 + ..\model\gen\gens\mm_gens_prop.c + + + + + genc + + + mm_genc_oo.c + 1 + ..\model\gen\genc\mm_genc_oo.c + + + mm_genc_lvl.c + 1 + ..\model\gen\genc\mm_genc_lvl.c + + + mm_genc_poo.c + 1 + ..\model\gen\genc\mm_genc_poo.c + + + mm_genc_plvl.c + 1 + ..\model\gen\genc\mm_genc_plvl.c + + + mm_genc_loc.c + 1 + ..\model\gen\genc\mm_genc_loc.c + + + mm_genc_dtt.c + 1 + ..\model\gen\genc\mm_genc_dtt.c + + + mm_genc_bat.c + 1 + ..\model\gen\genc\mm_genc_bat.c + + + mm_genc_prop.c + 1 + ..\model\gen\genc\mm_genc_prop.c + + + + + lights + + + mm_lights_ctl.c + 1 + ..\model\light\lights\mm_lights_ctl.c + + + mm_lights_hsl.c + 1 + ..\model\light\lights\mm_lights_hsl.c + + + mm_lights_ln.c + 1 + ..\model\light\lights\mm_lights_ln.c + + + + + lightc + + + mm_lightc_ctl.c + 1 + ..\model\light\lightc\mm_lightc_ctl.c + + + mm_lightc_hsl.c + 1 + ..\model\light\lightc\mm_lightc_hsl.c + + + mm_lightc_ln.c + 1 + ..\model\light\lightc\mm_lightc_ln.c + + + mm_lightc_xyl.c + 1 + ..\model\light\lightc\mm_lightc_xyl.c + + + + + sens + + + tscn + + + + + + + + + + + +
diff --git a/mesh/model/api/mm_gen.h b/mesh/model/api/mm_gen.h new file mode 100644 index 0000000..3cf3852 --- /dev/null +++ b/mesh/model/api/mm_gen.h @@ -0,0 +1,736 @@ +/** + **************************************************************************************** + * + * @file mm_gen.h + * + * @brief Header file for Mesh Generic Model Definitions + * + **************************************************************************************** + */ + +#ifndef MM_GEN_H_ +#define MM_GEN_H_ + +/** + **************************************************************************************** + * @defgroup MM_DEFINES Mesh Model Definitions + * @ingroup MESH_MDL + * @brief Mesh Model Defines + * @{ + **************************************************************************************** + */ + +/* + * DEFINES (MODEL IDS) + **************************************************************************************** + */ + +/// ************************** Model IDs for Generic Models ***************************** + +/// Generic Server - OnOff +#define MM_ID_GENS_OO (0x1000) +/// Generic Server - Level +#define MM_ID_GENS_LVL (0x1002) +/// Generic Server - Default Transition Time +#define MM_ID_GENS_DTT (0x1004) +/// Generic Server - Power OnOff +#define MM_ID_GENS_POO (0x1006) +/// Generic Server - Power OnOff Setup +#define MM_ID_GENS_POOS (0x1007) +/// Generic Server - Power Level +#define MM_ID_GENS_PLVL (0x1009) +/// Generic Server - Power Level Setup +#define MM_ID_GENS_PLVLS (0x100A) +/// Generic Server - Battery +#define MM_ID_GENS_BAT (0x100C) +/// Generic Server - Location +#define MM_ID_GENS_LOC (0x100E) +/// Generic Server - Location Setup +#define MM_ID_GENS_LOCS (0x100F) +/// Generic Server - User Property +#define MM_ID_GENS_UPROP (0x1013) +/// Generic Server - Admin Property +#define MM_ID_GENS_APROP (0x1011) +/// Generic Server - Manufacturer Property +#define MM_ID_GENS_MPROP (0x1012) +/// Generic Server - Client Property +#define MM_ID_GENS_CPROP (0x1014) + +/// Generic Client - OnOff +#define MM_ID_GENC_OO (0x1001) +/// Generic Client - Level +#define MM_ID_GENC_LVL (0x1003) +/// Generic Client - Default Transition Time +#define MM_ID_GENC_DTT (0x1005) +/// Generic Client - Power OnOff +#define MM_ID_GENC_POO (0x1008) +/// Generic Client - Power Level +#define MM_ID_GENC_PLVL (0x100B) +/// Generic Client - Location +#define MM_ID_GENC_LOC (0x1010) +/// Generic Client - Battery +#define MM_ID_GENC_BAT (0x100D) +/// Generic Client - Property +#define MM_ID_GENC_PROP (0x1015) + +/* + * DEFINES (MESSAGE IDS) + **************************************************************************************** + */ + +/// ********************* Message IDs for Generic OnOff Model ************************** + +/// Generic OnOff Get +#define MM_MSG_GEN_OO_GET (0x0182) +/// Generic OnOff Set +#define MM_MSG_GEN_OO_SET (0x0282) +/// Generic OnOff Set Unacknowledged +#define MM_MSG_GEN_OO_SET_UNACK (0x0382) +/// Generic OnOff Status +#define MM_MSG_GEN_OO_STATUS (0x0482) + +/// ********************* Message IDs for Generic Level Model *************************** + +/// Generic Level Get +#define MM_MSG_GEN_LVL_GET (0x0582) +/// Generic Level Set +#define MM_MSG_GEN_LVL_SET (0x0682) +/// Generic Level Set Unacknowledged +#define MM_MSG_GEN_LVL_SET_UNACK (0x0782) +/// Generic Level Status +#define MM_MSG_GEN_LVL_STATUS (0x0882) +/// Generic Delta Set +#define MM_MSG_GEN_DELTA_SET (0x0982) +/// Generic Delta Set Unacknowledged +#define MM_MSG_GEN_DELTA_SET_UNACK (0x0A82) +/// Generic Move Set +#define MM_MSG_GEN_MOVE_SET (0x0B82) +/// Generic Move Set Unacknowledged +#define MM_MSG_GEN_MOVE_SET_UNACK (0x0C82) + +/// ************** Message IDs for Generic Default Transition Time Model **************** + +/// Generic Default Transition Time Get +#define MM_MSG_GEN_DTT_GET (0x0D82) +/// Generic Default Transition Time Set +#define MM_MSG_GEN_DTT_SET (0x0E82) +/// Generic Default Transition Time Set Unacknowledged +#define MM_MSG_GEN_DTT_SET_UNACK (0x0F82) +/// Generic Default Transition Time Status +#define MM_MSG_GEN_DTT_STATUS (0x1082) + +/// ******************** Message IDs for Generic Power OnOff Model ********************* + +/// Generic OnPowerUp Get +#define MM_MSG_GEN_ONPUP_GET (0x1182) +/// Generic OnPowerUp Status +#define MM_MSG_GEN_ONPUP_STATUS (0x1282) + +/// ******************** Message IDs for Generic Power OnOff Model ********************* + +/// Generic OnPowerUp Set +#define MM_MSG_GEN_ONPUP_SET (0x1382) +/// Generic OnPowerUp Set Unacknowledged +#define MM_MSG_GEN_ONPUP_SET_UNACK (0x1482) + +/// ******************** Message IDs for Generic Power Level Model ********************** + +/// Generic Power Level Get +#define MM_MSG_GEN_PLVL_GET (0x1582) +/// Generic Power Level Set +#define MM_MSG_GEN_PLVL_SET (0x1682) +/// Generic Power Level Set Unacknowledged +#define MM_MSG_GEN_PLVL_SET_UNACK (0x1782) +/// Generic Power Level Status +#define MM_MSG_GEN_PLVL_STATUS (0x1882) +/// Generic Power Last Get +#define MM_MSG_GEN_PLAST_GET (0x1982) +/// Generic Power Last Status +#define MM_MSG_GEN_PLAST_STATUS (0x1A82) +/// Generic Power Default Get +#define MM_MSG_GEN_PDFLT_GET (0x1B82) +/// Generic Power Default Status +#define MM_MSG_GEN_PDFLT_STATUS (0x1C82) +/// Generic Power Range Get +#define MM_MSG_GEN_PRANGE_GET (0x1D82) +/// Generic Power Range Status +#define MM_MSG_GEN_PRANGE_STATUS (0x1E82) + +/// ***************** Message IDs for Generic Power Level Setup Model ******************* + +/// Generic Power Default Set +#define MM_MSG_GEN_PDFLT_SET (0x1F82) +/// Generic Power Default Set Unacknowledged +#define MM_MSG_GEN_PDFLT_SET_UNACK (0x2082) +/// Generic Power Range Set +#define MM_MSG_GEN_PRANGE_SET (0x2182) +/// Generic Power Range Set Unacknowledged +#define MM_MSG_GEN_PRANGE_SET_UNACK (0x2282) + +/// ***************** Message IDs for Generic Battery Model ******************* + +/// Generic Battery Get +#define MM_MSG_GEN_BAT_GET (0x2382) +/// Generic Battery Status +#define MM_MSG_GEN_BAT_STATUS (0x2482) + +/// ***************** Message IDs for Generic Location Model ******************* + +/// Generic Location Global Get +#define MM_MSG_GEN_LOCG_GET (0x2582) +/// Generic Location Global Status +#define MM_MSG_GEN_LOCG_STATUS (0x40) +/// Generic Location Local Get +#define MM_MSG_GEN_LOCL_GET (0x2682) +/// Generic Location Local Status +#define MM_MSG_GEN_LOCL_STATUS (0x2782) + +/// ***************** Message IDs for Generic Location Setup Model ******************* + +/// Generic Location Global Set +#define MM_MSG_GEN_LOCG_SET (0x41) +/// Generic Location Global Set Unacknowledged +#define MM_MSG_GEN_LOCG_SET_UNACK (0x42) +/// Generic Location Local Set +#define MM_MSG_GEN_LOCL_SET (0x2882) +/// Generic Location Local Set Unacknowledged +#define MM_MSG_GEN_LOCL_SET_UNACK (0x2982) + +/// ***************** Message IDs for Generic Manufacturer Property Model ******************* + +/// Generic Manufacturer Properties Get +#define MM_MSG_GEN_MPROPS_GET (0x2A82) +/// Generic Manufacturer Properties Status +#define MM_MSG_GEN_MPROPS_STATUS (0x43) +/// Generic Manufacturer Property Get +#define MM_MSG_GEN_MPROP_GET (0x2B82) +/// Generic Manufacturer Property Set +#define MM_MSG_GEN_MPROP_SET (0x44) +/// Generic Manufacturer Property Set Unacknowledged +#define MM_MSG_GEN_MPROP_SET_UNACK (0x45) +/// Generic Manufacturer Property Status +#define MM_MSG_GEN_MPROP_STATUS (0x46) + +/// ***************** Message IDs for Generic Admin Property Model ******************* + +/// Generic Admin Properties Get +#define MM_MSG_GEN_APROPS_GET (0x2C82) +/// Generic Admin Properties Status +#define MM_MSG_GEN_APROPS_STATUS (0x47) +/// Generic Admin Property Get +#define MM_MSG_GEN_APROP_GET (0x2D82) +/// Generic Admin Property Set +#define MM_MSG_GEN_APROP_SET (0x48) +/// Generic Admin Property Set Unacknowledged +#define MM_MSG_GEN_APROP_SET_UNACK (0x49) +/// Generic Admin Property Status +#define MM_MSG_GEN_APROP_STATUS (0x4A) + +/// ***************** Message IDs for Generic User Property Model ******************* + +/// Generic User Properties Get +#define MM_MSG_GEN_UPROPS_GET (0x2E82) +/// Generic User Properties Status +#define MM_MSG_GEN_UPROPS_STATUS (0x4B) +/// Generic User Property Get +#define MM_MSG_GEN_UPROP_GET (0x2F82) +/// Generic User Property Set +#define MM_MSG_GEN_UPROP_SET (0x4C) +/// Generic User Property Set Unacknowledged +#define MM_MSG_GEN_UPROP_SET_UNACK (0x4D) +/// Generic User Property Status +#define MM_MSG_GEN_UPROP_STATUS (0x4E) + +/// ***************** Message IDs for Generic Client Property Model ******************* + +/// Generic Client Properties Get +#define MM_MSG_GEN_CPROPS_GET (0x4F) +/// Generic Client Properties Status +#define MM_MSG_GEN_CPROPS_STATUS (0x50) + +/* + * DEFINES + **************************************************************************************** + */ + +/// Location Global Latitude Not Configured +#define MM_LOC_GLOBAL_LAT_NOT_CONFIG (0x80000000) +/// Location Global Longitude Not Configured +#define MM_LOC_GLOBAL_LONG_NOT_CONFIG (0x80000000) +/// Location Global Altitude Not Configured +#define MM_LOC_GLOBAL_ALT_NOT_CONFIG (0x7FFF) +/// Location Local North Not Configured +#define MM_LOC_LOCAL_NORTH_NOT_CONFIG (0x8000) +/// Location Local East Not Configured +#define MM_LOC_LOCAL_EAST_NOT_CONFIG (0x8000) +/// Location Local Altitude Not Configured +#define MM_LOC_LOCAL_ALT_NOT_CONFIG (0x7FFF) +/// Floor Number Not Configured +#define MM_LOC_FLOOR_NOT_CONFIG (0xFF) + +/// Battery Level Max value +#define MM_BAT_LVL_MAX (0x64) +/// Battery Level Unknown +#define MM_BAT_LVL_UNKNOWN (0xFF) +/// Battery Flags (all unknown) +#define MM_BAT_FLAGS_UNKNOWN (0xFF) +/// Battery Time to discharge unknown +#define MM_BAT_TIME_DISCHRG_UNKNOWN (0x00FFFFFF) +/// Battery Time to charge unknown +#define MM_BAT_TIME_CHRG_UNKNOWN (0x00FFFFFF) + +/* + * DEFINES (MESSAGE LENGTH) + **************************************************************************************** + */ + +/// Minimal length of Generic OnOff Set/Set Unacknowledged message +#define MM_GEN_OO_SET_MIN_LEN (2) +/// Length of Generic OnOff Set/Set Unacknowledged message when all field are present +#define MM_GEN_OO_SET_LEN (4) +/// Minimal length of Generic OnOff Status message +#define MM_GEN_OO_STATUS_MIN_LEN (1) +/// Length of Generic OnOff Status message when all fields are present +#define MM_GEN_OO_STATUS_LEN (3) + +/// Minimal length of Generic Level Set/Set Unacknowledged message +#define MM_GEN_LVL_SET_MIN_LEN (3) +/// Length of Generic Level Set/Set Unacknowledged message when all field are present +#define MM_GEN_LVL_SET_LEN (5) +/// Minimal length of Generic Delta Set/Set Unacknowledged message +#define MM_GEN_LVL_SET_DELTA_MIN_LEN (5) +/// Length of Generic Delta Set/Set Unacknowledged message when all field are present +#define MM_GEN_LVL_SET_DELTA_LEN (7) +/// Minimal length of Generic Move Set/Set Unacknowledged message +#define MM_GEN_LVL_SET_MOVE_MIN_LEN (3) +/// Length of Generic Move Set/Set Unacknowledged message when all field are present +#define MM_GEN_LVL_SET_MOVE_LEN (5) +/// Minimal length of Generic Level Status message +#define MM_GEN_LVL_STATUS_MIN_LEN (2) +/// Length of Generic Level Status message when all fields are present +#define MM_GEN_LVL_STATUS_LEN (5) + +/// Length of Generic Default Transition Time Set/Set Unacknowledged message +#define MM_GEN_DTT_SET_LEN (1) +/// Length of Generic Default Transition Time Status message +#define MM_GEN_DTT_STATUS_LEN (1) + +/// Length of Generic OnPowerUp Set/Set Unacknowledged message +#define MM_GEN_POO_SET_LEN (1) +/// Length of Generic OnPowerUp Status message +#define MM_GEN_POO_STATUS_LEN (1) + +/// Length of Generic Battery Status message +#define MM_GEN_BAT_STATUS_LEN (8) + +/// Length of Generic Location Global Set/Set Unacknowledged message +#define MM_GEN_LOC_SET_GLOB_LEN (10) +/// Length of Generic Location Local Set/Set Unacknowledged message +#define MM_GEN_LOC_SET_LOC_LEN (9) +/// Length of Generic Location Global Status message +#define MM_GEN_LOC_STATUS_GLOB_LEN (10) +/// Length of Generic Location Local Status message +#define MM_GEN_LOC_STATUS_LOC_LEN (9) + +/// Minimal length of Generic Power Set/Set Unacknowledged message +#define MM_GEN_PLVL_SET_MIN_LEN (3) +/// Length of Generic Power Set/Set Unacknowledged message when all field are present +#define MM_GEN_PLVL_SET_LEN (5) +/// Minimal length of Generic Power Level Status message +#define MM_GEN_PLVL_STATUS_MIN_LEN (2) +/// Length of Generic Power Level Status message when all fields are present +#define MM_GEN_PLVL_STATUS_LEN (5) +/// Length of Generic Power Last Status +#define MM_GEN_PLVL_LAST_STATUS_LEN (2) +/// Length of Generic Power Default Set/Set Unacknowledged +#define MM_GEN_PLVL_DFLT_SET_LEN (2) +/// Length of Generic Power Default Status +#define MM_GEN_PLVL_DFLT_STATUS_LEN (2) +/// Length of Generic Power Range Set/Set Unacknowledged +#define MM_GEN_PLVL_RANGE_SET_LEN (4) +/// Length of Generic Power Range Status +#define MM_GEN_PLVL_RANGE_STATUS_LEN (5) + +/// Minimal length of Generic User Property Set/Set Unacknowledged message +#define MM_GEN_PROP_USER_SET_MIN_LEN (2) +/// Minimal length of Generic Admin Property Set/Set Unacknowledged message +#define MM_GEN_PROP_ADMIN_SET_MIN_LEN (3) +/// Length of Generic Manufacturer Property Set/Set Unacknowledged message +#define MM_GEN_PROP_MANUF_SET_LEN (3) +/// Minimal length of Generic User/Admin/Manufacturer Property Status message +#define MM_GEN_PROP_STATUS_MIN_LEN (2) + +/* + * ENUMERATIONS (MESSAGE CONTENT) + **************************************************************************************** + */ + +/// Positions in Generic OnOff Set/Set Unacknowledged message +enum mm_gen_oo_set_pos +{ + /// OnOff state value + MM_GEN_OO_SET_OO_POS = 0, + /// TID value + MM_GEN_OO_SET_TID_POS, + /// Transition time value + MM_GEN_OO_SET_TRANS_TIME_POS, + /// Delay value + MM_GEN_OO_SET_DELAY_POS, +}; + +/// Positions in Generic OnOff Status message +enum mm_gen_oo_status_pos +{ + /// Present OnOff state value + MM_GEN_OO_STATUS_OO_POS = 0, + /// Target OnOff state value + MM_GEN_OO_STATUS_TGT_OO_POS, + /// Remaining time value + MM_GEN_OO_STATUS_REM_TIME_POS, +}; + +/// Positions in Generic Level Set/Set Unacknowledged message +enum mm_gen_lvl_set_pos +{ + /// Level value + MM_GEN_LVL_SET_LVL_POS = 0, + /// TID value + MM_GEN_LVL_SET_TID_POS = 2, + /// Transition time value + MM_GEN_LVL_SET_TRANS_TIME_POS, + /// Delay value + MM_GEN_LVL_SET_DELAY_POS, +}; + +/// Positions in Generic Delta Set/Set Unacknowledged message +enum mm_gen_lvl_set_delta_pos +{ + /// Delta level value + MM_GEN_LVL_SET_DELTA_LVL_POS = 0, + /// TID value + MM_GEN_LVL_SET_DELTA_TID_POS = 4, + /// Transition time value + MM_GEN_LVL_SET_DELTA_TRANS_TIME_POS, + /// Delay value + MM_GEN_LVL_SET_DELTA_DELAY_POS, +}; + +/// Positions in Generic Move Set/Set Unacknowledged message +enum mm_gen_lvl_set_move_pos +{ + /// Delta level value + MM_GEN_LVL_SET_MOVE_DELTA_LVL_POS = 0, + /// TID value + MM_GEN_LVL_SET_MOVE_TID_POS = 2, + /// Transition time value + MM_GEN_LVL_SET_MOVE_TRANS_TIME_POS, + /// Delay value + MM_GEN_LVL_SET_MOVE_DELAY_POS, +}; + +/// Positions in Generic Level Status message +enum mm_gen_lvl_status_pos +{ + /// Present Level value + MM_GEN_LVL_STATUS_LVL_POS = 0, + /// Target Level value + MM_GEN_LVL_STATUS_TGT_LVL_POS = 2, + /// Remaining time value + MM_GEN_LVL_STATUS_REM_TIME_POS = 4, +}; + +/// Positions in Generic Power Level Set/Set Unacknowledged message +enum mm_gen_plvl_set_pos +{ + /// Power value + MM_GEN_PLVL_SET_POWER_POS = 0, + /// TID value + MM_GEN_PLVL_SET_TID_POS = 2, + /// Transition time value + MM_GEN_PLVL_SET_TRANS_TIME_POS, + /// Delay value + MM_GEN_PLVL_SET_DELAY_POS, +}; + +/// Positions in Generic Power Level Status message +enum mm_gen_plvl_status_pos +{ + /// Present Power value + MM_GEN_PLVL_STATUS_PRES_POWER_POS = 0, + /// Target Power value + MM_GEN_PLVL_STATUS_TGT_POWER_POS = 2, + /// Remaining time value + MM_GEN_PLVL_STATUS_REM_TIME_POS = 4, +}; + +/// Positions in Generic Power Last Status message +enum mm_gen_plvl_last_status_pos +{ + /// Power value + MM_GEN_PLVL_LAST_STATUS_POWER_POS = 0, +}; + +/// Positions in Generic Power Default Set/Set Unacknowledged message +enum mm_gen_plvl_dflt_set_pos +{ + /// Power value + MM_GEN_PLVL_DFLT_SET_POWER_POS = 0, +}; + +/// Positions in Generic Power Default Status message +enum mm_gen_plvl_dflt_status_pos +{ + /// Power value + MM_GEN_PLVL_DFLT_STATUS_POWER_POS = 0, +}; + +/// Positions in Generic Power Range Set/Set Unacknowledged message +enum mm_gen_plvl_range_set_pos +{ + /// Range Min + MM_GEN_PLVL_RANGE_SET_MIN_POS = 0, + /// Range Max + MM_GEN_PLVL_RANGE_SET_MAX_POS = 2, +}; + +/// Positions in Generic Power Range Status message +enum mm_gen_plvl_range_status_pos +{ + /// Status code + MM_GEN_PLVL_RANGE_STATUS_CODE_POS = 0, + /// Range Min + MM_GEN_PLVL_RANGE_STATUS_MIN_POS = 1, + /// Range Max + MM_GEN_PLVL_RANGE_STATUS_MAX_POS = 3, +}; + +/// Positions in Generic Default Transition Time Set/Set Unacknowledged message +enum mm_gen_ddt_set_pos +{ + /// Default transition time state value + MM_GEN_DDT_SET_DDT_POS = 0, +}; + +/// Positions in Generic Default Transition Time Status message +enum mm_gen_ddt_status_pos +{ + /// Default transition time state value + MM_GEN_DDT_STATUS_DDT_POS = 0, +}; + +/// Positions in Generic OnPowerUp Set/Set Unacknowledged message +enum mm_gen_poo_set_pos +{ + /// OnPowerUp state value + MM_GEN_POO_SET_OPU_POS = 0, +}; + +/// Positions in Generic OnPowerUp Status message +enum mm_gen_poo_status_pos +{ + /// OnPowerUp state value + MM_GEN_POO_STATUS_OPU_POS = 0, +}; + +/// Positions in Generic Battery Status message +enum mm_gen_bat_status_pos +{ + /// Battery Level + MM_GEN_BAT_STATUS_LEVEL_POS = 0, + /// Time to discharge + MM_GEN_BAT_STATUS_TIME_DISCHRG_POS = 1, + /// Time to charge + MM_GEN_BAT_STATUS_TIME_CHRG_POS = 4, + /// Flags + MM_GEN_BAT_STATUS_FLAGS_POS = 7, +}; + +/// Positions in Generic Location Global Set/Set Unacknowledged message +enum mm_gen_loc_set_glob_pos +{ + /// Global Latitude + MM_GEN_LOC_SET_GLOB_LAT_POS = 0, + /// Global Longitude + MM_GEN_LOC_SET_GLOB_LONG_POS = 4, + /// Global Altitude + MM_GEN_LOC_SET_GLOB_ALT_POS = 8, +}; + +/// Positions in Generic Location Global Status message +enum mm_gen_loc_status_glob_pos +{ + /// Global Latitude + MM_GEN_LOC_STATUS_GLOB_LAT_POS = 0, + /// Global Longitude + MM_GEN_LOC_STATUS_GLOB_LONG_POS = 4, + /// Global Altitude + MM_GEN_LOC_STATUS_GLOB_ALT_POS = 8, +}; + +/// Positions in Generic Location Local Set/Set Unacknowledged message +enum mm_gen_loc_set_loc_pos +{ + /// Local North + MM_GEN_LOC_SET_LOC_NORTH_POS = 0, + /// Local East + MM_GEN_LOC_SET_LOC_EAST_POS = 2, + /// Local Altitude + MM_GEN_LOC_SET_LOC_ALT_POS = 4, + /// Floor Number + MM_GEN_LOC_SET_LOC_FLOOR_POS = 6, + /// Uncertainty + MM_GEN_LOC_SET_LOC_UNCERT_POS = 7, +}; + +/// Positions in Generic Location Local Status message +enum mm_gen_loc_status_loc_pos +{ + /// Local North + MM_GEN_LOC_STATUS_LOC_NORTH_POS = 0, + /// Local East + MM_GEN_LOC_STATUS_LOC_EAST_POS = 2, + /// Local Altitude + MM_GEN_LOC_STATUS_LOC_ALT_POS = 4, + /// Floor Number + MM_GEN_LOC_STATUS_LOC_FLOOR_POS = 6, + /// Uncertainty + MM_GEN_LOC_STATUS_LOC_UNCERT_POS = 7, +}; + +/// Positions in Generic User Property Set/Set Unacknowledged message +enum mm_gen_prop_set_user_pos +{ + /// User Property ID + MM_GEN_PROP_SET_USER_ID_POS = 0, + /// User Property value + MM_GEN_PROP_SET_USER_VAL_POS = 2, +}; + +/// Positions in Generic Admin Property Set/Set Unacknowledged message +enum mm_gen_prop_set_admin_pos +{ + /// Admin Property ID + MM_GEN_PROP_SET_ADMIN_ID_POS = 0, + /// Admin User Access + MM_GEN_PROP_SET_ADMIN_ACCESS_POS = 2, + /// Admin Property Value + MM_GEN_PROP_SET_ADMIN_VAL_POS = 3, +}; + +/// Positions in Generic Manufacturer Property Set/Set Unacknowledged message +enum mm_gen_prop_set_manuf_pos +{ + /// Manufacturer Property ID + MM_GEN_PROP_SET_MANUF_ID_POS = 0, + /// Manufacturer User Access + MM_GEN_PROP_SET_MANUF_ACCESS_POS = 2, +}; + +/// Positions in Generic User/Admin/Manufacturer Property Status message +enum mm_gen_prop_status_pos +{ + /// Property ID + MM_GEN_PROP_STATUS_ID_POS = 0, + /// User Access + MM_GEN_PROP_STATUS_ACCESS_POS = 2, + /// Property value + MM_GEN_PROP_STATUS_VALUE_POS = 3, +}; + +/* + * ENUMERATIONS + **************************************************************************************** + */ + +/// Generic OnPowerUp state values +enum mm_on_power_up +{ + /// Off. After being powered up, the element is in an off state + MM_ON_POWER_UP_OFF = 0, + /// Default. After being powered up, the element is in an On state and uses default + /// state values + MM_ON_POWER_UP_DEFAULT, + /// Restore. If a transition was in progress when powered down, the element restores + /// the target state when powered up. Otherwise the element restores the state it + /// was in when powered down. + MM_ON_POWER_UP_RESTORE, +}; + +/// Get type values for Generic Power Level Client model +enum mm_get_type_plvl +{ + /// Get Generic Power Actual state value + MM_GET_TYPE_PLVL_ACTUAL = 0, + /// Get Generic Power Last state value + MM_GET_TYPE_PLVL_LAST, + /// Get Generic Power Default state value + MM_GET_TYPE_PLVL_DFLT, + /// Get Generic Power Range state value + MM_GET_TYPE_PLVL_RANGE, + + /// Last option value + MM_GET_TYPE_PLVL_MAX = MM_GET_TYPE_PLVL_RANGE, +}; + +/// Get type values for Generic Location Client model +enum mm_get_type_loc +{ + /// Get Generic Location Global state value + MM_GET_TYPE_LOC_GLOBAL = 0, + /// Get Generic Power Last state value + MM_GET_TYPE_LOC_LOCAL, + + /// Last option value + MM_GET_TYPE_LOC_MAX = MM_GET_TYPE_LOC_LOCAL, +}; + +/// Get type values for Generic Property Client model +enum mm_get_type_prop +{ + /// Send Generic User Properties Get message + MM_GET_TYPE_PROP_UPROPS = 0, + /// Send Generic User Property Get message + MM_GET_TYPE_PROP_UPROP, + /// Send Generic Admin Properties Get message + MM_GET_TYPE_PROP_APROPS, + /// Send Generic Admin Property Get message + MM_GET_TYPE_PROP_APROP, + /// Send Generic Manufacturer Properties Get message + MM_GET_TYPE_PROP_MPROPS, + /// Send Generic Manufacturer Property Get message + MM_GET_TYPE_PROP_MPROP, + /// Send Generic Client Properties Get message + MM_GET_TYPE_PROP_CPROPS, + + /// Last option value + MM_GET_TYPE_PROP_MAX = MM_GET_TYPE_PROP_CPROPS, +}; + +/// Set type values for the Generic Power Level Client model +enum mm_set_type_plvl +{ + /// Set Generic Power Default state value + MM_SET_TYPE_PLVL_DFLT = 0, + /// Set Generic Power Range state value + MM_SET_TYPE_PLVL_RANGE, + + /// Last option value + MM_SET_TYPE_PLVL_MAX = MM_SET_TYPE_PLVL_RANGE, +}; + +/// Generic Property type +enum mm_prop_type +{ + /// User Property + MM_PROP_TYPE_USER = 0, + /// Admin Property + MM_PROP_TYPE_ADMIN, + /// Manufacturer Property + MM_PROP_TYPE_MANUF, + /// Client Property + MM_PROP_TYPE_CLI, +}; + +/// @} MM_DEFINES + +#endif /* MM_DEF_H_ */ diff --git a/mesh/model/api/mm_genc.h b/mesh/model/api/mm_genc.h new file mode 100644 index 0000000..f8d8918 --- /dev/null +++ b/mesh/model/api/mm_genc.h @@ -0,0 +1,184 @@ +/** + **************************************************************************************** + * + * @file mm_genc.h + * + * @brief Header file for Mesh Model Generic Client Module + * + **************************************************************************************** + */ + +#ifndef _MM_GENC_H_ +#define _MM_GENC_H_ + +/** + **************************************************************************************** + * @defgroup MM_GENC Mesh Model Generic Client Module + * @ingroup MESH_MDL + * @brief Mesh Model Generic Client Module + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mesh_def.h" +#include "mm_gen.h" + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Register Generic OnOff Client model. Model is registered on first element. + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +uint8_t mm_genc_oo_register(void); + +/** + **************************************************************************************** + * @brief Register Generic Level Client model. Model is registered on first element. + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +uint8_t mm_genc_lvl_register(void); + +/** + **************************************************************************************** + * @brief Register Generic Default Transition Time Client model. Model is registered on first element. + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +uint8_t mm_genc_dtt_register(void); + +/** + **************************************************************************************** + * @brief Register Generic Power OnOff Client model. Model is registered on first element. + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +uint8_t mm_genc_poo_register(void); + +/** + **************************************************************************************** + * @brief Register Generic Power Loevel Client model. Model is registered on first element. + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +uint8_t mm_genc_plvl_register(void); + +/** + **************************************************************************************** + * @brief Register Generic Battery Client model. Model is registered on first element. + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +uint8_t mm_genc_bat_register(void); + +/** + **************************************************************************************** + * @brief Register Generic Location Client model. Model is registered on first element. + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +uint8_t mm_genc_loc_register(void); + +/** + **************************************************************************************** + * @brief Set global part of Generic Location state of a given node's element. + * + * @param[in] mdl_lid Local index for the client model used to set the needed state value + * @param[in] dst Address of node's element to which message will be sent + * @param[in] set_info Set information + * @param[in] latitude Global Latitude + * @param[in] longitude Global Longitude + * @param[in] altitude Global Altitude + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +uint8_t mm_genc_locg_set(m_lid_t mdl_lid, m_lid_t app_key_lid, uint16_t dst, + uint8_t set_info, int32_t latitude, int32_t longitude, + int16_t altitude); + +/** + **************************************************************************************** + * @brief Set local part of Generic Location state of a given node's element. + * + * @param[in] mdl_lid Local index for the client model used to set the needed state value + * @param[in] dst Address of node's element to which message will be sent + * @param[in] set_info Set information + * @param[in] north Local North + * @param[in] east Local East + * @param[in] altitude Local Altitude + * @param[in] floor Floor Number + * @param[in] uncertainty Uncertainty + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +uint8_t mm_genc_locl_set(m_lid_t mdl_lid, m_lid_t app_key_lid, uint16_t dst, + uint8_t set_info, int16_t north, int16_t east, int16_t altitude, + uint8_t floor, uint16_t uncertainty); + +/** + **************************************************************************************** + * @brief Register Generic Property Client model. Model is registered on first element. + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +uint8_t mm_genc_prop_register(void); + +/** + **************************************************************************************** + * @brief Request to send a Generic User/Admin/Manufacturer/Client Property(ies) Get message + * to an element + * + * @param[in] mdl_lid Model Local Index of Generic Property Client model + * @param[in] dst Address of element to which the message must be sent + * @param[in] prop_id Property ID + * + * @return An handling status (@see enum mesh_err) + **************************************************************************************** + */ +uint8_t mm_genc_prop_get(m_lid_t mdl_lid, m_lid_t app_key_lid, uint16_t dst, + uint8_t get_type, uint16_t prop_id); + +/** + **************************************************************************************** + * @brief Request to send a Generic User/Admin/Manufacturer Property Set message to an + * element + * + * @param[in] mdl_lid Model local Index of Generic Property Client model + * @param[in] dst Address of element to which the message must be sent + * @param[in] set_info Set information + * @param[in] prop_id Property ID + * @param[in] user_access User access + * @param[in] length Property value length + * @param[in] p_val Pointer to the property value + * + * @return An handling status (@see enum mesh_err) + **************************************************************************************** + */ +uint8_t mm_genc_prop_set(m_lid_t mdl_lid, m_lid_t app_key_lid, uint16_t dst, uint8_t set_info, + uint16_t prop_id, uint8_t user_access, uint16_t length, const uint8_t *p_val); + + +/// @} end of group + +#endif // _MM_GENC_ diff --git a/mesh/model/api/mm_gens.h b/mesh/model/api/mm_gens.h new file mode 100644 index 0000000..f012a8e --- /dev/null +++ b/mesh/model/api/mm_gens.h @@ -0,0 +1,240 @@ +/** + **************************************************************************************** + * @file mm_gens.h + * + * @brief Header file for Mesh Model Generic Server Module + * + **************************************************************************************** + */ + +#ifndef _MM_GENS_H_ +#define _MM_GENS_H_ + +/** + **************************************************************************************** + * @defgroup MM_GENS Mesh Model Generic Server Module + * @ingroup MESH_MDL + * @brief Mesh Model Generic Server Module + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mesh_def.h" +#include "mm_gen.h" + + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Structure for Generic Property state information +typedef struct mm_prop +{ + /// Property ID + uint16_t prop_id; + /// User Access + uint8_t user_access; +} mm_prop_t; + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Register Generic OnOff Server model for a given local element + * + * @param[in] elmt_idx Element Index + * @param[in] main True if model is a main model, else false + * + * @return An error status (@see mesh_err) + **************************************************************************************** + */ +m_lid_t mm_gens_oo_register(uint8_t elmt_idx, bool main); + +/** + **************************************************************************************** + * @brief Bind a Generic OnOff Server model to a group + * + * @param[in] grp_lid Group local index + * @param[in] oo_lid Model local index + **************************************************************************************** + */ +uint8_t mm_gens_oo_bind_group(m_lid_t grp_lid, m_lid_t oo_lid); + +/** + **************************************************************************************** + * @brief Register Generic Level Server model for a given local element + * + * @param[in] elmt_idx Element Index + * @param[in] p_mdl_lid Pointer to the variable in which allocated model local index + * will be written + * + * @return An error status (@see mesh_err) + **************************************************************************************** + */ +m_lid_t mm_gens_lvl_register(uint8_t elmt_idx, bool main); + +/** + **************************************************************************************** + * @brief Bind a Generic Level Server model to a group + * + * @param[in] grp_lid Group local index + * @param[in] lvl_lid Model local index + **************************************************************************************** + */ +uint8_t mm_gens_lvl_bind_group(m_lid_t grp_lid, m_lid_t lvl_lid); + +/** + **************************************************************************************** + * @brief Register Generic Power Level Server and Generic Power Level Setup Setup models + * for a given local element + * + * @param[in] elmt_idx Element Index + * @param[in] p_mdl_lid Pointer to the variable in which allocated model local index + * for the Generic Power Level Server model will be written + * + * @return An error status (@see mesh_err) + **************************************************************************************** + */ +uint8_t mm_gens_plvl_register(uint8_t elmt_idx, bool main); + +/** + **************************************************************************************** + * @brief Register Generic Default Transition Time Server model for a given local element + * + * @param[in] elmt_idx Element Index + * + * @return An error status (@see mesh_err) + **************************************************************************************** + */ +uint8_t mm_gens_dtt_register(uint8_t elmt_idx); + +/** + **************************************************************************************** + * @brief Register Generic Power OnOff Server and Generic Power OnOff Setup Server model + * for a given local element + * + * @param[in] elmt_idx Element Index + * + * @return An error status (@see mesh_err) + **************************************************************************************** + */ +uint8_t mm_gens_poo_register(uint8_t elmt_idx, bool main); + +/** + **************************************************************************************** + * @brief Register Generic Battery Server model for a given element + * + * @param[in] elmt_idx Element ID + * + * @return An error status (@see mesh_err) + **************************************************************************************** + */ +uint8_t mm_gens_bat_register(uint8_t elmt_idx); + +/** + **************************************************************************************** + * @brief Function called upon reception of Generic Battery state value for a local element. + * + * @param[in] elmt_idx Index of element for which Battery information are provided + * @param[in] status Confirmation status + * @param[in] bat_lvl Battery Level + * @param[in] time_charge Time to charge in minutes + * @param[in] time_discharge Time to discharge in minutes + * @param[in] flags Flags + **************************************************************************************** + */ +void mm_gens_bat_cfm(uint8_t elmt_idx, uint8_t status, uint8_t bat_lvl, + uint32_t time_discharge, uint32_t time_charge, uint8_t flags); + +/** + **************************************************************************************** + * @brief Register Generic Location Server and Generic Location Setup Server models for + * a given local element + * + * @param[in] elmt_idx Element Index + * + * @return An error status (@see mesh_err) + **************************************************************************************** + */ +uint8_t mm_gens_loc_register(uint8_t elmt_idx); + +/** + **************************************************************************************** + * @brief Function called upon reception of global part of Generic Location state value + * for a local element. + * + * @param[in] elmt_idx Index of element for which Location information are provided + * @param[in] status Confirmation status + * @param[in] latitude Global Latitude + * @param[in] longitude Global Longitude + * @param[in] altitude Global Altitude + **************************************************************************************** + */ +void mm_gens_locg_cfm(uint8_t elmt_idx, uint8_t status, int32_t latitude, + int32_t longitude, int16_t altitude); + +/** + **************************************************************************************** + * @brief Function called upon reception of local part of Generic Location state value + * for a local element. + * + * @param[in] elmt_idx Index of element for which Location information are provided + * @param[in] status Confirmation status + * @param[in] north Local North + * @param[in] east Local East + * @param[in] altitude Local Altitude + * @param[in] floor Floor Number + * @param[in] uncertainty Uncertainty + **************************************************************************************** + */ +void mm_gens_locl_cfm(uint8_t elmt_idx, uint8_t status, int16_t north, + int16_t east, int16_t altitude, uint8_t floor, uint16_t uncertainty); + +/** + **************************************************************************************** + * @brief Register Generic Property models on an element + * + * @param[in] elmt_idx Index of element on which models must be registered + * @param[in] req_queue_len Number of received messages that can be queued when model + * is waiting for application confirmation + * @param[in] nb_prop_user Number of Generic User Properties + * @param[in] nb_prop_admin Number of Generic Admin Properties + * @param[in] nb_prop_manuf Number of Generic Manufacturer Properties + * @param[in] nb_prop_cli Number of Generic Client Properties + * @param[in] p_props Pointer to list of Generic Property information + * + * @return An handling error status (@see enum mesh_err) + **************************************************************************************** + */ +uint8_t mm_gens_prop_register(uint8_t elmt_idx, uint8_t req_queue_len, + uint8_t nb_prop_user, uint8_t nb_prop_admin, + uint8_t nb_prop_manuf, uint8_t nb_prop_cli, const mm_prop_t *p_props); + +/** + **************************************************************************************** + * @brief Confirmation functions for get and set request indication received by the application + * + * @param[in] status Confirmation status + * @param[in] elmt_idx Element index + * @param[in] prop_type Property Type (@see enum mm_prop_type) + * @param[in] prop_id Property ID + * @param[in] length Property Length + * @param[in] p_val Pointer to the property value + **************************************************************************************** + */ +void mm_gens_prop_cfm(uint8_t elmt_idx, uint8_t status, uint8_t prop_type, uint16_t prop_id, + uint16_t length, const uint8_t *p_val); + +/// @} end of group + +#endif // _MM_GENS_ diff --git a/mesh/model/api/mm_light.h b/mesh/model/api/mm_light.h new file mode 100644 index 0000000..c8f21ec --- /dev/null +++ b/mesh/model/api/mm_light.h @@ -0,0 +1,954 @@ +/** + **************************************************************************************** + * + * @file mm_light.h + * + * @brief Header file for Mesh Light Model Definitions + * + **************************************************************************************** + */ + +#ifndef MM_LIGHT_H_ +#define MM_LIGHT_H_ + +/** + **************************************************************************************** + * @defgroup MM_DEFINES Mesh Model Definitions + * @ingroup MESH_MDL + * @brief Mesh Model Defines + * @{ + **************************************************************************************** + */ + +/* + * DEFINES (MODEL IDS) + **************************************************************************************** + */ + +/// ************************** Model IDs for Lighting Models **************************** + +/// Lighting Server - Light Lightness +#define MM_ID_LIGHTS_LN (0x1300) +/// Lighting Server - Light Lightness Setup +#define MM_ID_LIGHTS_LNS (0x1301) +/// Lighting Server - Light CTL +#define MM_ID_LIGHTS_CTL (0x1303) +/// Lighting Server - Light CTL Temperature +#define MM_ID_LIGHTS_CTLT (0x1306) +/// Lighting Server - Light CTL Setup +#define MM_ID_LIGHTS_CTLS (0x1304) +/// Lighting Server - Light HSL +#define MM_ID_LIGHTS_HSL (0x1307) +/// Lighting Server - Light HSL Hue +#define MM_ID_LIGHTS_HSLH (0x130A) +/// Lighting Server - Light HSL Saturation +#define MM_ID_LIGHTS_HSLSAT (0x130B) +/// Lighting Server - Light HSL Setup +#define MM_ID_LIGHTS_HSLS (0x1308) +/// Lighting Server - Light xyL +#define MM_ID_LIGHTS_XYL (0x130C) +/// Lighting Server - Light xyL Setup +#define MM_ID_LIGHTS_XYLS (0x130D) +/// Lighting Server - Light LC +#define MM_ID_LIGHTS_LC (0x130F) +/// Lighting Server - Light LC Setup +#define MM_ID_LIGHTS_LCS (0x1310) + +/// Lighting Client - Light Lightness +#define MM_ID_LIGHTC_LN (0x1302) +/// Lighting Client - Light CTL +#define MM_ID_LIGHTC_CTL (0x1305) +/// Lighting Client - Light HSL +#define MM_ID_LIGHTC_HSL (0x1309) +/// Lighting Client - Light xyL +#define MM_ID_LIGHTC_XYL (0x130E) +/// Lighting Client - Light LC +#define MM_ID_LIGHTC_LC (0x1311) + +/* + * DEFINES (MESSAGE IDS) + **************************************************************************************** + */ + +/// ********************** Message IDs for Light Lightness Model ********************** + +/// Light Lightness Get +#define MM_MSG_LIGHT_LN_GET (0x4B82) +/// Light Lightness Set +#define MM_MSG_LIGHT_LN_SET (0x4C82) +/// Light Lightness Set Unacknowledged +#define MM_MSG_LIGHT_LN_SET_UNACK (0x4D82) +/// Light Lightness Status +#define MM_MSG_LIGHT_LN_STATUS (0x4E82) +/// Light Lightness Linear Get +#define MM_MSG_LIGHT_LN_LINEAR_GET (0x4F82) +/// Light Lightness Linear Set +#define MM_MSG_LIGHT_LN_LINEAR_SET (0x5082) +/// Light Lightness Linear Set Unacknowledged +#define MM_MSG_LIGHT_LN_LINEAR_SET_UNACK (0x5182) +/// Light Lightness Linear Status +#define MM_MSG_LIGHT_LN_LINEAR_STATUS (0x5282) +/// Light Lightness Last Get +#define MM_MSG_LIGHT_LN_LAST_GET (0x5382) +/// Light Lightness Last Status +#define MM_MSG_LIGHT_LN_LAST_STATUS (0x5482) +/// Light Lightness Default Get +#define MM_MSG_LIGHT_LN_DFLT_GET (0x5582) +/// Light Lightness Default Status +#define MM_MSG_LIGHT_LN_DFLT_STATUS (0x5682) +/// Light Lightness Range Get +#define MM_MSG_LIGHT_LN_RANGE_GET (0x5782) +/// Light Lightness Range Status +#define MM_MSG_LIGHT_LN_RANGE_STATUS (0x5882) + +/// ***************** Message IDs for Light Lightness Setup Model ********************* + +/// Light Lightness Default Set +#define MM_MSG_LIGHT_LN_DFLT_SET (0x5982) +/// Light Lightness Default Set Unacknowledged +#define MM_MSG_LIGHT_LN_DFLT_SET_UNACK (0x5A82) +/// Light Lightness Range Set +#define MM_MSG_LIGHT_LN_RANGE_SET (0x5B82) +/// Light Lightness Range Set Unacknowledged +#define MM_MSG_LIGHT_LN_RANGE_SET_UNACK (0x5C82) + +/// ************************* Message IDs for Light CTL Model ************************* + +/// Light CTL Get +#define MM_MSG_LIGHT_CTL_GET (0x5D82) +/// Light CTL Set +#define MM_MSG_LIGHT_CTL_SET (0x5E82) +/// Light CTL Set Unacknowledged +#define MM_MSG_LIGHT_CTL_SET_UNACK (0x5F82) +/// Light CTL Status +#define MM_MSG_LIGHT_CTL_STATUS (0x6082) +/// Light CTL Temperature Get +#define MM_MSG_LIGHT_CTL_TEMP_GET (0x6182) +/// Light CTL Temperature Set +#define MM_MSG_LIGHT_CTL_TEMP_SET (0x6482) +/// Light CTL Temperature Set Unacknowledged +#define MM_MSG_LIGHT_CTL_TEMP_SET_UNACK (0x6582) +/// Light CTL Temperature Status +#define MM_MSG_LIGHT_CTL_TEMP_STATUS (0x6682) +/// Light CTL Temperature Range Get +#define MM_MSG_LIGHT_CTL_TEMP_RANGE_GET (0x6282) +/// Light CTL Temperature Range Status +#define MM_MSG_LIGHT_CTL_TEMP_RANGE_STATUS (0x6382) +/// Light CTL Default Get +#define MM_MSG_LIGHT_CTL_DFLT_GET (0x6782) +/// Light CTL Default Status +#define MM_MSG_LIGHT_CTL_DFLT_STATUS (0x6882) + +/// ********************* Message IDs for Light CTL Setup Model *********************** + +/// Light CTL Default Set +#define MM_MSG_LIGHT_CTL_DFLT_SET (0x6982) +/// Light CTL Default Set Unacknowledged +#define MM_MSG_LIGHT_CTL_DFLT_SET_UNACK (0x6A82) +/// Light CTL Temperature Range Set +#define MM_MSG_LIGHT_CTL_TEMP_RANGE_SET (0x6B82) +/// Light CTL Temperature Range Set Unacknowledged +#define MM_MSG_LIGHT_CTL_TEMP_RANGE_SET_UNACK (0x6C82) + +/// ************************* Message IDs for Light HSL Model ************************* + +/// Light HSL Get +#define MM_MSG_LIGHT_HSL_GET (0x6D82) +/// Light HSL Hue Get +#define MM_MSG_LIGHT_HSL_HUE_GET (0x6E82) +/// Light HSL Hue Set +#define MM_MSG_LIGHT_HSL_HUE_SET (0x6F82) +/// Light HSL Hue Set Unacknowledged +#define MM_MSG_LIGHT_HSL_HUE_SET_UNACK (0x7082) +/// Light HSL Hue Status +#define MM_MSG_LIGHT_HSL_HUE_STATUS (0x7182) +/// Light HSL Saturation Get +#define MM_MSG_LIGHT_HSL_SAT_GET (0x7282) +/// Light HSL Saturation Set +#define MM_MSG_LIGHT_HSL_SAT_SET (0x7382) +/// Light HSL Saturation Set Unacknowledged +#define MM_MSG_LIGHT_HSL_SAT_SET_UNACK (0x7482) +/// Light HSL Saturation Status +#define MM_MSG_LIGHT_HSL_SAT_STATUS (0x7582) +/// Light HSL Set +#define MM_MSG_LIGHT_HSL_SET (0x7682) +/// Light HSL Set Unacknowledged +#define MM_MSG_LIGHT_HSL_SET_UNACK (0x7782) +/// Light HSL Status +#define MM_MSG_LIGHT_HSL_STATUS (0x7882) +/// Light HSL Target Get +#define MM_MSG_LIGHT_HSL_TGT_GET (0x7982) +/// Light HSL Target Status +#define MM_MSG_LIGHT_HSL_TGT_STATUS (0x7A82) +/// Light HSL Default Get +#define MM_MSG_LIGHT_HSL_DFLT_GET (0x7B82) +/// Light HSL Default Status +#define MM_MSG_LIGHT_HSL_DFLT_STATUS (0x7C82) +/// Light HSL Range Get +#define MM_MSG_LIGHT_HSL_RANGE_GET (0x7D82) +/// Light HSL Range Status +#define MM_MSG_LIGHT_HSL_RANGE_STATUS (0x7E82) + +/// ********************* Message IDs for Light HSL Setup Model *********************** + +/// Light HSL Default Set +#define MM_MSG_LIGHT_HSL_DFLT_SET (0x7F82) +/// Light HSL Default Set Unacknowledged +#define MM_MSG_LIGHT_HSL_DFLT_SET_UNACK (0x8082) +/// Light HSL Range Set +#define MM_MSG_LIGHT_HSL_RANGE_SET (0x8182) +/// Light HSL Range Set Unacknowledged +#define MM_MSG_LIGHT_HSL_RANGE_SET_UNACK (0x8282) + +/// ************************* Message IDs for Light xyL Model ************************* + +/// Light xyL Get +#define MM_MSG_LIGHT_XYL_GET (0x8382) +/// Light xyL Set +#define MM_MSG_LIGHT_XYL_SET (0x8482) +/// Light xyL Set Unacknowledged +#define MM_MSG_LIGHT_XYL_SET_UNACK (0x8582) +/// Light xyL Status +#define MM_MSG_LIGHT_XYL_STATUS (0x8682) +/// Light xyL Target Get +#define MM_MSG_LIGHT_XYL_TGT_GET (0x8782) +/// Light xyL Target Status +#define MM_MSG_LIGHT_XYL_TGT_STATUS (0x8882) +/// Light HSL Default Get +#define MM_MSG_LIGHT_XYL_DFLT_GET (0x8982) +/// Light xyL Default Status +#define MM_MSG_LIGHT_XYL_DFLT_STATUS (0x8A82) +/// Light xyL Range Get +#define MM_MSG_LIGHT_XYL_RANGE_GET (0x8B82) +/// Light xyL Range Status +#define MM_MSG_LIGHT_XYL_RANGE_STATUS (0x8C82) + +/// ********************* Message IDs for Light xyL Setup Model *********************** + +/// Light xyL Default Set +#define MM_MSG_LIGHT_XYL_DFLT_SET (0x8D82) +/// Light xyL Default Set Unacknowledged +#define MM_MSG_LIGHT_XYL_DFLT_SET_UNACK (0x8E82) +/// Light xyL Range Set +#define MM_MSG_LIGHT_XYL_RANGE_SET (0x8F82) +/// Light xyL Range Set Unacknowledged +#define MM_MSG_LIGHT_XYL_RANGE_SET_UNACK (0x9082) + +/* + * DEFINES + **************************************************************************************** + */ + + +/* + * DEFINES (MESSAGE LENGTH) + **************************************************************************************** + */ + +/// Minimal length of Light Lightness Set/Set Unacknowledged message +#define MM_LIGHT_LN_SET_MIN_LEN (3) +/// Length of Light Lightness Set/Set Unacknowledged message +#define MM_LIGHT_LN_SET_LEN (5) +/// Minimal length of Light Lightness Status message +#define MM_LIGHT_LN_STATUS_MIN_LEN (2) +/// Length of Light Lightness Status message +#define MM_LIGHT_LN_STATUS_LEN (5) +/// Minimal length of Light Lightness Linear Set/Set Unacknowledged message +#define MM_LIGHT_LN_LIN_SET_MIN_LEN (3) +/// Length of Light Lightness Linear Set/Set Unacknowledged message +#define MM_LIGHT_LN_LIN_SET_LEN (5) +/// Minimal length of Light Lightness Linear Status message +#define MM_LIGHT_LN_LIN_STATUS_MIN_LEN (2) +/// Length of Light Lightness Linear Status message +#define MM_LIGHT_LN_LIN_STATUS_LEN (5) +/// Length of Light Lightness Last Status message +#define MM_LIGHT_LN_LAST_STATUS_LEN (2) +/// Length of Light Lightness Default Set/Set Unacknowledged message +#define MM_LIGHT_LN_DFLT_SET_LEN (2) +/// Length of Light Lightness Default Status message +#define MM_LIGHT_LN_DFLT_STATUS_LEN (2) +/// Length of Light Lightness Range Set/Set Unacknowledged message +#define MM_LIGHT_LN_RANGE_SET_LEN (4) +/// Length of Light Lightness Range Status message +#define MM_LIGHT_LN_RANGE_STATUS_LEN (5) + +/// Minimal length of Light CTL Set/Set Unacknowledged message +#define MM_LIGHT_CTL_SET_MIN_LEN (7) +/// Length of Light CTL Set//Set Unacknowledged message +#define MM_LIGHT_CTL_SET_LEN (9) +/// Minimal length of Light CTL Status message +#define MM_LIGHT_CTL_STATUS_MIN_LEN (4) +/// Length of Light CTL Status message +#define MM_LIGHT_CTL_STATUS_LEN (9) +/// Minimal length of Light CTL Temperature Set/Set Unacknowledged message +#define MM_LIGHT_CTL_TEMP_SET_MIN_LEN (5) +/// Length of Light CTL Temperature Set//Set Unacknowledged message +#define MM_LIGHT_CTL_TEMP_SET_LEN (7) +/// Minimal length of Light CTL Temperature Status message +#define MM_LIGHT_CTL_TEMP_STATUS_MIN_LEN (4) +/// Length of Light CTL Temperature Status message +#define MM_LIGHT_CTL_TEMP_STATUS_LEN (9) +/// Length of Light CTL Temperature Range Set/Set Unacknowledged +#define MM_LIGHT_CTL_TEMP_RANGE_SET_LEN (4) +/// Length of Light CTL Temperature Range Status +#define MM_LIGHT_CTL_TEMP_RANGE_STATUS_LEN (5) +/// Length of Light CTL Default Set/Unacknowledged message +#define MM_LIGHT_CTL_DFLT_SET_LEN (6) +/// Length of Light CTL Default Status message +#define MM_LIGHT_CTL_DFLT_STATUS_LEN (6) + +/// Minimal length of Light HSL Set/Set Unacknowledged message +#define MM_LIGHT_HSL_SET_MIN_LEN (7) +/// Length of Light HSL Set//Set Unacknowledged message +#define MM_LIGHT_HSL_SET_LEN (9) +/// Minimal length of Light HSL Status message +#define MM_LIGHT_HSL_STATUS_MIN_LEN (6) +/// Length of Light HSL Status message +#define MM_LIGHT_HSL_STATUS_LEN (7) +/// Minimal length of Light HSL Target Status message +#define MM_LIGHT_HSL_TGT_STATUS_MIN_LEN (6) +/// Length of Light HSL Target Status message +#define MM_LIGHT_HSL_TGT_STATUS_LEN (7) +/// Minimal length of Light HSL Hue Set/Set Unacknowledged message +#define MM_LIGHT_HSL_HUE_SET_MIN_LEN (3) +/// Length of Light HSL Hue Set//Set Unacknowledged message +#define MM_LIGHT_HSL_HUE_SET_LEN (5) +/// Minimal length of Light HSL Hue Status message +#define MM_LIGHT_HSL_HUE_STATUS_MIN_LEN (2) +/// Length of Light HSL Hue Status message +#define MM_LIGHT_HSL_HUE_STATUS_LEN (5) +/// Minimal length of Light HSL Saturation Set/Set Unacknowledged message +#define MM_LIGHT_HSL_SAT_SET_MIN_LEN (3) +/// Length of Light HSL Saturation Set//Set Unacknowledged message +#define MM_LIGHT_HSL_SAT_SET_LEN (5) +/// Minimal length of Light HSL Saturation Status message +#define MM_LIGHT_HSL_SAT_STATUS_MIN_LEN (2) +/// Length of Light HSL Saturation Status message +#define MM_LIGHT_HSL_SAT_STATUS_LEN (5) +/// Length of Light HSL Default Set/Set Unacknowledged message +#define MM_LIGHT_HSL_DFLT_SET_LEN (6) +/// Length of Light HSL Default Status message +#define MM_LIGHT_HSL_DFLT_STATUS_LEN (6) +/// Length of Light HSL Range Set/Set Unacknowledged message +#define MM_LIGHT_HSL_RANGE_SET_LEN (8) +/// Length of Light HSL Range Status message +#define MM_LIGHT_HSL_RANGE_STATUS_LEN (9) + +/// Minimal length of Light xyL Set/Set Unacknowledged message +#define MM_LIGHT_XYL_SET_MIN_LEN (7) +/// Length of Light xyL Set//Set Unacknowledged message +#define MM_LIGHT_XYL_SET_LEN (9) +/// Minimal length of Light xyL Status message +#define MM_LIGHT_XYL_STATUS_MIN_LEN (6) +/// Length of Light xyL Status message +#define MM_LIGHT_XYL_STATUS_LEN (7) +/// Minimal length of Light xyL Target Status message +#define MM_LIGHT_XYL_TGT_STATUS_MIN_LEN (6) +/// Length of Light xyL Target Status message +#define MM_LIGHT_XYL_TGT_STATUS_LEN (7) +/// Length of Light xyL Default Set/Set Unacknowledged message +#define MM_LIGHT_XYL_DFLT_SET_LEN (6) +/// Length of Light xyL Default Status message +#define MM_LIGHT_XYL_DFLT_STATUS_LEN (6) +/// Length of Light xyL Range Set/Set Unacknowledged message +#define MM_LIGHT_XYL_RANGE_SET_LEN (8) +/// Length of Light xyL Range Status message +#define MM_LIGHT_XYL_RANGE_STATUS_LEN (9) + +/* + * ENUMERATIONS (MESSAGE CONTENT) + **************************************************************************************** + */ + +/// Positions in Light Lightness Set/Set Unacknowledged message +enum mm_light_ln_set_pos +{ + /// Lightness + MM_LIGHT_LN_SET_LIGHTNESS_POS = 0, + /// TID + MM_LIGHT_LN_SET_TID_POS = 2, + /// Transition Time + MM_LIGHT_LN_SET_TRANS_TIME_POS = 3, + /// Delay + MM_LIGHT_LN_SET_DELAY_POS = 4 +}; + +/// Positions in Light Lightness Status message +enum mm_light_ln_status_pos +{ + /// Present Lightness + MM_LIGHT_LN_STATUS_LIGHTNESS_POS = 0, + /// Target Lightness + MM_LIGHT_LN_STATUS_TGT_LIGHTNESS_POS = 2, + /// Remaining Time + MM_LIGHT_LN_STATUS_REM_TIME_POS = 4, +}; + +/// Positions in Light Lightness Linear Set/Set Unacknowledged message +enum mm_light_ln_lin_set_pos +{ + /// Lightness + MM_LIGHT_LN_LIN_SET_LIGHTNESS_POS = 0, + /// TID + MM_LIGHT_LN_LIN_SET_TID_POS = 2, + /// Transition Time + MM_LIGHT_LN_LIN_SET_TRANS_TIME_POS = 3, + /// Delay + MM_LIGHT_LN_LIN_SET_DELAY_POS = 4 +}; + +/// Positions in Light Lightness Linear Status message +enum mm_light_ln_lin_status_pos +{ + /// Present Lightness + MM_LIGHT_LN_LIN_STATUS_LIGHTNESS_POS = 0, + /// Target Lightness + MM_LIGHT_LN_LIN_STATUS_TGT_LIGHTNESS_POS = 2, + /// Remaining Time + MM_LIGHT_LN_LIN_STATUS_REM_TIME_POS = 4, +}; + +/// Positions in Light Lightness Last Status message +enum mm_light_ln_last_status_pos +{ + /// Lightness + MM_LIGHT_LN_LAST_STATUS_LIGHTNESS_POS = 0, +}; + +/// Positions in Light Lightness Default Set/Set Unacknowledged message +enum mm_light_ln_dflt_set_pos +{ + /// Lightness + MM_LIGHT_LN_DFLT_SET_LIGHTNESS_POS = 0, +}; + +/// Positions in Light Lightness Linear Status message +enum mm_light_ln_dflt_status_pos +{ + /// Lightness + MM_LIGHT_LN_DFLT_STATUS_LIGHTNESS_POS = 0, +}; + +/// Positions in Light Lightness Range Set/Set Unacknowledged message +enum mm_light_ln_range_set_pos +{ + /// Range Min + MM_LIGHT_LN_RANGE_SET_MIN_POS = 0, + /// Range Max + MM_LIGHT_LN_RANGE_SET_MAX_POS = 2, +}; + +/// Positions in Light Lightness Range Status message +enum mm_light_ln_range_status_pos +{ + /// Status Code + MM_LIGHT_LN_RANGE_STATUS_CODE_POS = 0, + /// Range Min + MM_LIGHT_LN_RANGE_STATUS_MIN_POS = 1, + /// Range Max + MM_LIGHT_LN_RANGE_STATUS_MAX_POS = 3, +}; + +/// Positions in Light CTL Set/Set Unacknowledged message +enum mm_light_ctl_set_pos +{ + /// CTL Lightness + MM_LIGHT_CTL_SET_LIGHTNESS_POS = 0, + /// CTL Temperature + MM_LIGHT_CTL_SET_TEMP_POS = 2, + /// CTL Delta UV + MM_LIGHT_CTL_SET_DELTA_UV_POS = 4, + /// TID + MM_LIGHT_CTL_SET_TID_POS = 6, + /// Transition Time + MM_LIGHT_CTL_SET_TRANS_TIME_POS = 7, + /// Delay + MM_LIGHT_CTL_SET_DELAY_POS = 8 +}; + +/// Positions in Light CTL Status message +enum mm_light_ctl_status_pos +{ + /// Present CTL Lightness + MM_LIGHT_CTL_STATUS_LIGHTNESS_POS = 0, + /// Present CTL Temperature + MM_LIGHT_CTL_STATUS_TEMP_POS = 2, + /// Target CTL Lightness + MM_LIGHT_CTL_STATUS_TGT_LIGHTNESS_POS = 4, + /// Target CTL Temperature + MM_LIGHT_CTL_STATUS_TGT_TEMP_POS = 6, + /// Remaining Time + MM_LIGHT_CTL_STATUS_REM_TIME_POS = 8, +}; + +/// Positions in Light CTL Temperature Set/Set Unacknowledged message +enum mm_light_ctl_temp_set_pos +{ + /// CTL Temperature + MM_LIGHT_CTL_TEMP_SET_TEMP_POS = 0, + /// CTL Delta UV + MM_LIGHT_CTL_TEMP_SET_DELTA_UV_POS = 2, + /// TID + MM_LIGHT_CTL_TEMP_SET_TID_POS = 4, + /// Transition Time + MM_LIGHT_CTL_TEMP_SET_TRANS_TIME_POS = 5, + /// Delay + MM_LIGHT_CTL_TEMP_SET_DELAY_POS = 6 +}; + +/// Positions in Light CTL Temperature Status message +enum mm_light_ctl_temp_status_pos +{ + /// Present CTL Temperature + MM_LIGHT_CTL_TEMP_STATUS_TEMP_POS = 0, + /// Present CTL Delta UV + MM_LIGHT_CTL_TEMP_STATUS_DELTA_UV_POS = 2, + /// Target CTL Temperature + MM_LIGHT_CTL_TEMP_STATUS_TGT_TEMP_POS = 4, + /// Target CTL Delta UV + MM_LIGHT_CTL_TEMP_STATUS_TGT_DELTA_UV_POS = 6, + /// Remaining Time + MM_LIGHT_CTL_TEMP_STATUS_REM_TIME_POS = 8, +}; + +/// Positions in Light CTL Temperature Range Set/Set Unacknowledged message +enum mm_light_ctl_temp_range_set_pos +{ + /// Range Min + MM_LIGHT_CTL_TEMP_RANGE_SET_MIN_POS = 0, + /// Range Max + MM_LIGHT_CTL_TEMP_RANGE_SET_MAX_POS = 2, +}; + +/// Positions in Light CTL Temperature Range Status message +enum mm_light_ctl_temp_range_status_pos +{ + /// Status Code + MM_LIGHT_CTL_TEMP_RANGE_STATUS_CODE_POS = 0, + /// Range Min + MM_LIGHT_CTL_TEMP_RANGE_STATUS_MIN_POS = 1, + /// Range Max + MM_LIGHT_CTL_TEMP_RANGE_STATUS_MAX_POS = 3, +}; + +/// Positions in Light CTL Default Set/Set Unacknowledged message +enum mm_light_ctl_dflt_set_pos +{ + /// Lightness + MM_LIGHT_CTL_DFLT_SET_LIGHTNESS_POS = 0, + /// Temperature + MM_LIGHT_CTL_DFLT_SET_TEMP_POS = 2, + /// Delta UV + MM_LIGHT_CTL_DFLT_SET_DELTA_UV_POS = 4, +}; + +/// Positions in Light CTL Default Status message +enum mm_light_ctl_dflt_status_pos +{ + /// Lightness + MM_LIGHT_CTL_DFLT_STATUS_LIGHTNESS_POS = 0, + /// Temperature + MM_LIGHT_CTL_DFLT_STATUS_TEMP_POS = 2, + /// Delta UV + MM_LIGHT_CTL_DFLT_STATUS_DELTA_UV_POS = 4, +}; + +/// Positions in Light HSL Set/Set Unacknowledged message +enum mm_light_hsl_set_pos +{ + /// HSL Lightness + MM_LIGHT_HSL_SET_LIGHTNESS_POS = 0, + /// HSL Hue + MM_LIGHT_HSL_SET_HUE_POS = 2, + /// HSL Saturation + MM_LIGHT_HSL_SET_SAT_POS = 4, + /// TID + MM_LIGHT_HSL_SET_TID_POS = 6, + /// Transition Time + MM_LIGHT_HSL_SET_TRANS_TIME_POS = 7, + /// Delay + MM_LIGHT_HSL_SET_DELAY_POS = 8 +}; + +/// Positions in Light HSL Status message +enum mm_light_hsl_status_pos +{ + /// HSL Lightness + MM_LIGHT_HSL_STATUS_LIGHTNESS_POS = 0, + /// HSL Hue + MM_LIGHT_HSL_STATUS_HUE_POS = 2, + /// HSL Saturation + MM_LIGHT_HSL_STATUS_SAT_POS = 4, + /// Remaining Time + MM_LIGHT_HSL_STATUS_REM_TIME_POS = 6, +}; + +/// Positions in Light HSL Target Status message +enum mm_light_hsl_tgt_status_pos +{ + /// Target HSL Lightness + MM_LIGHT_HSL_TGT_STATUS_LIGHTNESS_POS = 0, + /// Target HSL Hue + MM_LIGHT_HSL_TGT_STATUS_HUE_POS = 2, + /// Target HSL Saturation + MM_LIGHT_HSL_TGT_STATUS_SAT_POS = 4, + /// Remaining Time + MM_LIGHT_HSL_TGT_STATUS_REM_TIME_POS = 6, +}; + +/// Positions in Light HSL Hue Set/Set Unacknowledged message +enum mm_light_hsl_hue_set_pos +{ + /// Hue + MM_LIGHT_HSL_HUE_SET_HUE_POS = 0, + /// TID + MM_LIGHT_HSL_HUE_SET_TID_POS = 2, + /// Transition Time + MM_LIGHT_HSL_HUE_SET_TRANS_TIME_POS = 3, + /// Delay + MM_LIGHT_HSL_HUE_SET_DELAY_POS = 4 +}; + +/// Positions in Light HSL Hue Status message +enum mm_light_hsl_hue_status_pos +{ + /// Present Hue + MM_LIGHT_HSL_HUE_STATUS_HUE_POS = 0, + /// Target Hue + MM_LIGHT_HSL_HUE_STATUS_TGT_HUE_POS = 2, + /// Remaining Time + MM_LIGHT_HSL_HUE_STATUS_REM_TIME_POS = 4, +}; + +/// Positions in Light HSL Saturation Set/Set Unacknowledged message +enum mm_light_hsl_sat_set_pos +{ + /// Saturation + MM_LIGHT_HSL_SAT_SET_SAT_POS = 0, + /// TID + MM_LIGHT_HSL_SAT_SET_TID_POS = 2, + /// Transition Time + MM_LIGHT_HSL_SAT_SET_TRANS_TIME_POS = 3, + /// Delay + MM_LIGHT_HSL_SAT_SET_DELAY_POS = 4 +}; + +/// Positions in Light HSL Saturation Status message +enum mm_light_hsl_sat_status_pos +{ + /// Present Saturation + MM_LIGHT_HSL_SAT_STATUS_SAT_POS = 0, + /// Target Saturation + MM_LIGHT_HSL_SAT_STATUS_TGT_SAT_POS = 2, + /// Remaining Time + MM_LIGHT_HSL_SAT_STATUS_REM_TIME_POS = 4, +}; + +/// Positions in Light HSL Default Set/Set Unacknowledged message +enum mm_light_hsl_dflt_set_pos +{ + /// Lightness + MM_LIGHT_HSL_DFLT_SET_LIGHTNESS_POS = 0, + /// Hue + MM_LIGHT_HSL_DFLT_SET_HUE_POS = 2, + /// Saturation + MM_LIGHT_HSL_DFLT_SET_SAT_POS = 4, +}; + +/// Positions in Light HSL Default Status message +enum mm_light_hsl_dflt_status_pos +{ + /// Lightness + MM_LIGHT_HSL_DFLT_STATUS_LIGHTNESS_POS = 0, + /// Hue + MM_LIGHT_HSL_DFLT_STATUS_HUE_POS = 2, + /// Saturation + MM_LIGHT_HSL_DFLT_STATUS_SAT_POS = 4, +}; + +/// Positions in Light HSL Range Set/Set Unacknowledged message +enum mm_light_hsl_range_set_pos +{ + /// Hue Range Min + MM_LIGHT_HSL_RANGE_SET_HUE_MIN_POS = 0, + /// Hue Range Max + MM_LIGHT_HSL_RANGE_SET_HUE_MAX_POS = 2, + /// Saturation Range Min + MM_LIGHT_HSL_RANGE_SET_SAT_MIN_POS = 4, + /// Saturation Range Max + MM_LIGHT_HSL_RANGE_SET_SAT_MAX_POS = 6, +}; + +/// Positions in Light HSL Range Status message +enum mm_light_hsl_range_status_pos +{ + /// Status + MM_LIGHT_HSL_RANGE_STATUS_CODE_POS = 0, + /// Hue Range Min + MM_LIGHT_HSL_RANGE_STATUS_HUE_MIN_POS = 1, + /// Hue Range Max + MM_LIGHT_HSL_RANGE_STATUS_HUE_MAX_POS = 3, + /// Saturation Range Min + MM_LIGHT_HSL_RANGE_STATUS_SAT_MIN_POS = 5, + /// Saturation Range Max + MM_LIGHT_HSL_RANGE_STATUS_SAT_MAX_POS = 7, +}; + +/// Positions in Light xyL Set/Set Unacknowledged message +enum mm_light_xyl_set_pos +{ + /// xyL Lightness + MM_LIGHT_XYL_SET_LIGHTNESS_POS = 0, + /// xyL x + MM_LIGHT_XYL_SET_X_POS = 2, + /// xyL y + MM_LIGHT_XYL_SET_Y_POS = 4, + /// TID + MM_LIGHT_XYL_SET_TID_POS = 6, + /// Transition Time + MM_LIGHT_XYL_SET_TRANS_TIME_POS = 7, + /// Delay + MM_LIGHT_XYL_SET_DELAY_POS = 8 +}; + +/// Positions in Light xyL Status message +enum mm_light_xyl_status_pos +{ + /// xyL Lightness + MM_LIGHT_XYL_STATUS_LIGHTNESS_POS = 0, + /// xyL x + MM_LIGHT_XYL_STATUS_X_POS = 2, + /// xyL y + MM_LIGHT_XYL_STATUS_Y_POS = 4, + /// Remaining Time + MM_LIGHT_XYL_STATUS_REM_TIME_POS = 6, +}; + +/// Positions in Light xyL Target Status message +enum mm_light_xyl_tgt_status_pos +{ + /// Target xyL Lightness + MM_LIGHT_XYL_TGT_STATUS_LIGHTNESS_POS = 0, + /// Target xyL x + MM_LIGHT_XYL_TGT_STATUS_X_POS = 2, + /// Target xyL y + MM_LIGHT_XYL_TGT_STATUS_Y_POS = 4, + /// Remaining Time + MM_LIGHT_XYL_TGT_STATUS_REM_TIME_POS = 6, +}; + +/// Positions in Light xyL Default Set/Set Unacknowledged message +enum mm_light_xyl_dflt_set_pos +{ + /// Lightness + MM_LIGHT_XYL_DFLT_SET_LIGHTNESS_POS = 0, + /// xyL x + MM_LIGHT_XYL_DFLT_SET_X_POS = 2, + /// xyL y + MM_LIGHT_XYL_DFLT_SET_Y_POS = 4, +}; + +/// Positions in Light xyL Default Status message +enum mm_light_xyl_dflt_status_pos +{ + /// Lightness + MM_LIGHT_XYL_DFLT_STATUS_LIGHTNESS_POS = 0, + /// xyL x + MM_LIGHT_XYL_DFLT_STATUS_X_POS = 2, + /// xyL y + MM_LIGHT_XYL_DFLT_STATUS_Y_POS = 4, +}; + +/// Positions in Light xyL Range Set/Set Unacknowledged message +enum mm_light_xyl_range_set_pos +{ + /// xyL x Range Min + MM_LIGHT_XYL_RANGE_SET_X_MIN_POS = 0, + /// xyL x Range Max + MM_LIGHT_XYL_RANGE_SET_X_MAX_POS = 2, + /// xyL y Range Min + MM_LIGHT_XYL_RANGE_SET_Y_MIN_POS = 4, + /// xyL y Range Max + MM_LIGHT_XYL_RANGE_SET_Y_MAX_POS = 6, +}; + +/// Positions in Light xyL Range Status message +enum mm_light_xyl_range_status_pos +{ + /// Status code + MM_LIGHT_XYL_RANGE_STATUS_CODE = 0, + /// xyL x Range Min + MM_LIGHT_XYL_RANGE_STATUS_X_MIN_POS = 1, + /// xyL x Range Max + MM_LIGHT_XYL_RANGE_STATUS_X_MAX_POS = 3, + /// xyL y Range Min + MM_LIGHT_XYL_RANGE_STATUS_Y_MIN_POS = 5, + /// xyL y Range Max + MM_LIGHT_XYL_RANGE_STATUS_Y_MAX_POS = 7, +}; + +/* + * ENUMERATIONS + **************************************************************************************** + */ + +/// Get type values for Light Lightness Client model +enum mm_get_type_light_ln +{ + /// Get Light Lightness state value + MM_GET_TYPE_LIGHT_LN_ACTUAL = 0, + /// Get Light Lightness Linear state value + MM_GET_TYPE_LIGHT_LN_LINEAR, + /// Get Light Lightness Default state value + MM_GET_TYPE_LIGHT_LN_DFLT, + /// Get Light Lightness Last state value + MM_GET_TYPE_LIGHT_LN_LAST, + /// Get Light Lightness Range state value + MM_GET_TYPE_LIGHT_LN_RANGE, + + /// Last option value + MM_GET_TYPE_LIGHT_LN_MAX = MM_GET_TYPE_LIGHT_LN_RANGE, +}; + +/// Get type values for Light CTL Client model +enum mm_get_type_light_ctl +{ + /// Get Light CTL Lightness and Light CTL Temperature state value + MM_GET_TYPE_LIGHT_CTL = 0, + /// Get Light CTL Temperature and Light CTL Delta UV state value + MM_GET_TYPE_LIGHT_CTL_TEMP, + /// Get Light CTL Temperature Range state value + MM_GET_TYPE_LIGHT_CTL_TEMP_RANGE, + /// Get Light Lightness Default and Light CTL Temperature Default and Light CTL + /// Delta UV Default state values + MM_GET_TYPE_LIGHT_CTL_DFLT, + + /// Last option value + MM_GET_TYPE_LIGHT_CTL_MAX = MM_GET_TYPE_LIGHT_CTL_DFLT, +}; + +/// Get type values for Light HSL Client model +enum mm_get_type_light_hsl +{ + /// Get Light HSL Lightness and Light HSL Hue and Light HSL Saturation state values + MM_GET_TYPE_LIGHT_HSL = 0, + /// Get Light HSL Hue state value + MM_GET_TYPE_LIGHT_HSL_HUE, + /// Get Light HSL Saturation state value + MM_GET_TYPE_LIGHT_HSL_SAT, + /// Get Light HSL Lightness and Light HSL Hue and Light HSL Saturation target state values + MM_GET_TYPE_LIGHT_HSL_TGT, + /// Get Light Lightness and Light HSL Hue and Light HSL Saturation default state values + MM_GET_TYPE_LIGHT_HSL_DFLT, + /// Get Light HSL Hue and Light HSL Saturation state range values + MM_GET_TYPE_LIGHT_HSL_RANGE, + + /// Last option value + MM_GET_TYPE_LIGHT_HSL_MAX = MM_GET_TYPE_LIGHT_HSL_RANGE, +}; + +/// Get type values for Light xyL Client model +enum mm_get_type_light_xyl +{ + /// Get Light xyL Lightness and Light xyL x and Light xyL y state values + MM_GET_TYPE_LIGHT_XYL = 0, + /// Get Light xyL Lightness and Light xyL x and Light xyL y state target values + MM_GET_TYPE_LIGHT_XYL_TGT, + /// Get Light Lightness and Light xyL x and Light xyL y state default values + MM_GET_TYPE_LIGHT_XYL_DFLT, + /// Get Light xyL x and Light xyL y state range values + MM_GET_TYPE_LIGHT_XYL_RANGE, + + /// Last option value + MM_GET_TYPE_LIGHT_XYL_MAX = MM_GET_TYPE_LIGHT_XYL_RANGE, +}; + +/// Set type values for the Light Lightness Client model +enum mm_set_type_light_ln +{ + /// Set Light Lightness Default state value + MM_SET_TYPE_LIGHT_LN_DFLT = 0, + /// Set Light Lightness Range state value + MM_SET_TYPE_LIGHT_LN_RANGE, + + /// Last option value + MM_SET_TYPE_LIGHT_LN_MAX = MM_SET_TYPE_LIGHT_LN_RANGE, +}; + +/// Set type values for the Light CTL Client model +enum mm_set_type_light_ctl +{ + /// Set Light CTL Temperature Range state value + MM_SET_TYPE_LIGHT_CTL_TEMP_RANGE = 0, + /// Set Light CTL Default state value + MM_SET_TYPE_LIGHT_CTL_DFLT, + + /// Last option value + MM_SET_TYPE_LIGHT_CTL_MAX = MM_SET_TYPE_LIGHT_CTL_DFLT, +}; + +/// Set type values for the Light HSL Client model +enum mm_set_type_light_hsl +{ + /// Set Light HSL Hue and Light HSL Saturation state range values + MM_SET_TYPE_LIGHT_HSL_RANGE = 0, + /// Set Light Lightness and Light HSL Hue and Light HSL Saturation default state values + MM_SET_TYPE_LIGHT_HSL_DFLT, + + /// Last option value + MM_SET_TYPE_LIGHT_HSL_MAX = MM_SET_TYPE_LIGHT_HSL_DFLT, +}; + +/// Set type values for the Light xyL Client model +enum mm_set_type_light_xyl +{ + /// Set Light xyL x and Light xyL y state range values + MM_SET_TYPE_LIGHT_XYL_RANGE = 0, + /// Set Light Lightness and Light xyL x and Light xyL y state default values + MM_SET_TYPE_LIGHT_XYL_DFLT, + + /// Last option value + MM_SET_TYPE_LIGHT_XYL_MAX = MM_SET_TYPE_LIGHT_XYL_DFLT, +}; + +/// Transition type values for the Light Lightness Client model +enum mm_trans_type_light_ln +{ + /// Set Light Lightness state value + MM_TRANS_TYPE_LIGHT_LN = 0, + /// Set Light Lightness Linear state value + MM_TRANS_TYPE_LIGHT_LN_LIN, + + /// Last option value + MM_TRANS_TYPE_LIGHT_LN_MAX = MM_TRANS_TYPE_LIGHT_LN_LIN, +}; + +/// Transition type values for the Light CTL Client model +enum mm_trans_type_light_ctl +{ + /// Set Light CTL Lightness and Light CTL Temperature and Light CTL Delta UV state values + MM_TRANS_TYPE_LIGHT_CTL = 0, + /// Set Light CTL Temperature and Light CTL Delta UV state values + MM_TRANS_TYPE_LIGHT_CTL_TEMP, + + /// Last option value + MM_TRANS_TYPE_LIGHT_CTL_MAX = MM_TRANS_TYPE_LIGHT_CTL_TEMP, +}; + +/// Transition type values for the Light HSL Client model +enum mm_trans_type_light_hsl +{ + /// Set Light HSL Lightness and Light HSL Hue and Light HSL Saturation state values + MM_TRANS_TYPE_LIGHT_HSL = 0, + /// Set Light HSL Hue state value + MM_TRANS_TYPE_LIGHT_HSL_HUE, + /// Set Light HSL Saturation state value + MM_TRANS_TYPE_LIGHT_HSL_SAT, + + /// Last option value + MM_TRANS_TYPE_LIGHT_HSL_MAX = MM_TRANS_TYPE_LIGHT_HSL_SAT, +}; + +/// @} MM_DEFINES + +#endif /* MM_LIGHT_H_ */ diff --git a/mesh/model/api/mm_lightc.h b/mesh/model/api/mm_lightc.h new file mode 100644 index 0000000..64a8edb --- /dev/null +++ b/mesh/model/api/mm_lightc.h @@ -0,0 +1,75 @@ +/** + **************************************************************************************** + * + * @file mm_lightc.h + * + * @brief Header file for Mesh Model Lighting Client Module + * + **************************************************************************************** + */ + +#ifndef _MM_LIGHTC_H_ +#define _MM_LIGHTC_H_ + +/** + **************************************************************************************** + * @defgroup MM_LIGHTC Mesh Model Lighting Client Module + * @ingroup MESH_MDL + * @brief Mesh Model Lighting Client Module + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mesh_def.h" +#include "mm_light.h" + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Register Light Lightness Client model. Model is registered on first element. + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +uint8_t mm_lightc_ln_register(void); + +/** + **************************************************************************************** + * @brief Register Light CTL Client model. Model is registered on first element. + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +uint8_t mm_lightc_ctl_register(void); + +/** + **************************************************************************************** + * @brief Register Light HSL Client model. Model is registered on first element. + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +uint8_t mm_lightc_hsl_register(void); + +/** + **************************************************************************************** + * @brief Register Light XYL Client model. Model is registered on first element. + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +uint8_t mm_lightc_xyl_register(void); + +/// @} end of group + +#endif // _MM_LIGHTC_ diff --git a/mesh/model/api/mm_lights.h b/mesh/model/api/mm_lights.h new file mode 100644 index 0000000..0b54c4c --- /dev/null +++ b/mesh/model/api/mm_lights.h @@ -0,0 +1,110 @@ +/** + **************************************************************************************** + * + * @file mm_lights.h + * + * @brief Header file for Mesh Model Lighting Server Module + * + **************************************************************************************** + */ + +#ifndef _MM_LIGHTS_H_ +#define _MM_LIGHTS_H_ + +/** + **************************************************************************************** + * @defgroup MM_LIGHTS Mesh Model Lighting Server Module + * @ingroup MESH_MDL + * @brief Mesh Model Lighting Server Module + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mesh_def.h" +#include "mm_light.h" + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Register Light Lightness Server and Light Lightness Setup Server models + * needed for management of Light Lightness state. Also register the Generic Power + * OnOff Server and the Generic Level Server models and the Generic OnOff Server model. + * + * @param[in] elmt_idx Index of element on which required models must be registered + * @param[in] main True if Generic Power Level model is a main model, else false + * + * @return An error status + **************************************************************************************** + */ +uint8_t mm_lights_ln_register(uint8_t elmt_idx, bool main); + +/** + **************************************************************************************** + * @brief Bind a Light Lightness Server model to a group + * + * @param[in] grp_lid Group local index + * @param[in] oo_lid Model local index + **************************************************************************************** + */ +uint8_t mm_lights_ln_bind_group(m_lid_t grp_lid, m_lid_t ln_lid); + +/** + **************************************************************************************** + * @brief Get Light Lightness Range or Light Lightness Default value of an element + * + * @param[in] elmt_idx Element index + * @param[in] state_id State Identifier + **************************************************************************************** + */ +uint16_t mm_lights_ln_get(uint8_t elmt_idx, uint32_t state_id); + +/** + **************************************************************************************** + * @brief Set Light Lightness Default value of an element + * + * @param[in] elmt_idx Element index + * @param[in] ln_dflt Light Lightness Default value + **************************************************************************************** + */ +void mm_lights_ln_set_dflt(uint8_t elmt_idx, uint16_t ln_dflt); + +/** + **************************************************************************************** + * @brief Register Light CTL Server, Light CTL Setup Server, Light Lightness Temperature + * Server models and associated models + * + * @param[in] elmt_idx Index of element on which required models must be registered + * @param[in] main True if Generic Power Level model is a main model, else false + * + * @return An error status + **************************************************************************************** + */ +uint8_t mm_lights_ctl_register(uint8_t elmt_idx, bool main); + +/** + **************************************************************************************** + * @brief Register Light HSL Server, Light HSL Setup Server, Light Lightness Hue Server, + * Light Lightness Saturation Server models and associated models + * + * @param[in] elmt_idx Index of element on which required models must be registered + * @param[in] main True if Generic Power Level model is a main model, else false + * + * @return An error status + **************************************************************************************** + */ +uint8_t mm_lights_hsl_register(uint8_t elmt_idx, bool main); + + +/// @} end of group + +#endif // _MM_LIGHTS_ diff --git a/mesh/model/api/mm_sens.h b/mesh/model/api/mm_sens.h new file mode 100644 index 0000000..65e4e89 --- /dev/null +++ b/mesh/model/api/mm_sens.h @@ -0,0 +1,60 @@ +/** + **************************************************************************************** + * + * @file mm_sens.h + * + * @brief Header file for Mesh Sensor Model Definitions + * + **************************************************************************************** + */ + +#ifndef MM_SENS_H_ +#define MM_SENS_H_ + +/** + **************************************************************************************** + * @defgroup MM_DEFINES Mesh Model Definitions + * @ingroup MESH_MDL + * @brief Mesh Model Defines + * @{ + **************************************************************************************** + */ + +/* + * DEFINES (MODEL IDS) + **************************************************************************************** + */ + +/// ************************** Model IDs for Sensors Models ***************************** + +/// Sensors Server - Sensor +#define MM_ID_SENS_SEN (0x1100) +/// Sensors Server - Sensor Setup +#define MM_ID_SENS_SENS (0x1101) + +/// Sensors Client - Sensor +#define MM_ID_SENC_SEN (0x1102) + +/* + * DEFINES + **************************************************************************************** + */ + +/* + * DEFINES (MESSAGE LENGTH) + **************************************************************************************** + */ + +/* + * ENUMERATIONS (MESSAGE CONTENT) + **************************************************************************************** + */ + +/* + * ENUMERATIONS + **************************************************************************************** + */ + +/// @} MM_DEFINES + +#endif /* MM_SENS_H_ */ diff --git a/mesh/model/api/mm_tscn.h b/mesh/model/api/mm_tscn.h new file mode 100644 index 0000000..a978e17 --- /dev/null +++ b/mesh/model/api/mm_tscn.h @@ -0,0 +1,72 @@ +/** + **************************************************************************************** + * + * @file mm_sens.h + * + * @brief Header file for Mesh Time and Scene Model Definitions + * + **************************************************************************************** + */ + +#ifndef MM_TSCN_H_ +#define MM_TSCN_H_ + +/** + **************************************************************************************** + * @defgroup MM_DEFINES Mesh Model Definitions + * @ingroup MESH_MDL + * @brief Mesh Model Defines + * @{ + **************************************************************************************** + */ + +/* + * DEFINES (MODEL IDS) + **************************************************************************************** + */ + +/// ********************** Model IDs for Time and Scenes Models ************************* + +/// Time and Scene Server - Time +#define MM_ID_TSCNS_TIM (0x1200) +/// Time and Scene Server - Time Setup +#define MM_ID_TSCNS_TIMS (0x1201) +/// Time and Scene Server - Scene +#define MM_ID_TSCNS_SCN (0x1203) +/// Time and Scene Server - Scene Setup +#define MM_ID_TSCNS_SCNS (0x1204) +/// Time and Scene Server - Scheduler +#define MM_ID_TSCNS_SCH (0x1206) +/// Time and Scene Server - Scheduler Setup +#define MM_ID_TSCNS_SCHS (0x1207) + +/// Time and Scene Client - Time +#define MM_ID_TSCNC_TIM (0x1202) +/// Time and Scene Client - Scene +#define MM_ID_TSCNC_SCN (0x1205) +/// Time and Scene Client - Scheduler +#define MM_ID_TSCNC_SCH (0x1208) + +/* + * DEFINES + **************************************************************************************** + */ + +/* + * DEFINES (MESSAGE LENGTH) + **************************************************************************************** + */ + +/* + * ENUMERATIONS (MESSAGE CONTENT) + **************************************************************************************** + */ + +/* + * ENUMERATIONS + **************************************************************************************** + */ + +/// @} MM_DEFINES + +#endif /* MM_TSCN_H_ */ diff --git a/mesh/model/gen/genc/mm_genc_bat.c b/mesh/model/gen/genc/mm_genc_bat.c new file mode 100644 index 0000000..6901cf9 --- /dev/null +++ b/mesh/model/gen/genc/mm_genc_bat.c @@ -0,0 +1,183 @@ +/** + **************************************************************************************** + * + * @file mm_genc_bat.c + * + * @brief Mesh Model Generic Battery Client Module + * + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @addtogroup MM_GENC_BAT + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mm_itf.h" +#include "mm_genc.h" + + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Structure for Generic Battery Client model environment +typedef struct mm_genc_bat_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; +} mm_genc_bat_env_t; + + +/* + * INTERNAL CALLBACK FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Inform Generic Battery Client model about reception of a message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing environment containing information about the + * received message + **************************************************************************************** + */ +__STATIC void mm_genc_bat_cb_rx(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + if (p_route_env->opcode == MM_MSG_GEN_BAT_STATUS) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Generic Battery State values + uint8_t bat_lvl = *(p_data + MM_GEN_BAT_STATUS_LEVEL_POS); + uint32_t time_discharge = read24p(p_data + MM_GEN_BAT_STATUS_TIME_DISCHRG_POS); + uint32_t time_charge = read24p(p_data + MM_GEN_BAT_STATUS_TIME_CHRG_POS); + uint8_t flags = *(p_data + MM_GEN_BAT_STATUS_FLAGS_POS); + + // Inform the application about the received Generic Battery state value + mm_cli_bat_ind_send(p_route_env->u_addr.src, bat_lvl, time_discharge, + time_charge, flags); + } +} + +/** + **************************************************************************************** + * @brief Inform Generic Battery Client model about a received opcode in order + * to check if the model is authorized to handle the associated message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] opcode Opcode value to be checked + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_genc_bat_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status; + + if (opcode == MM_MSG_GEN_BAT_STATUS) + { + status = MESH_ERR_NO_ERROR; + } + else + { + status = MESH_ERR_MDL_INVALID_OPCODE; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Send a Generic Battery Get message to a given node's element + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element to which message will be sent + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_genc_bat_cb_get(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint16_t get_info) +{ + uint8_t status = MESH_ERR_NO_ERROR; + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_get = mm_route_buf_alloc(0); + + if (p_buf_get) + { + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_get->env; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + p_buf_env->opcode = MM_MSG_GEN_BAT_GET; + + // Send the message + mm_route_send(p_buf_get); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + + return (status); +} + +/* + * GLOBAL FUNCTIONS + **************************************************************************************** + */ + +__STATIC mm_cli_cb_t mm_genc_bat_cb = +{ + .cb_get = mm_genc_bat_cb_get, + .cb_set = NULL, + .cb_trans = NULL, +}; + +uint8_t mm_genc_bat_register(void) +{ + // Model local index + m_lid_t mdl_lid = ms_register_model(MM_ID_GENC_BAT, 0, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) //if (status == MESH_ERR_NO_ERROR) + { + // Inform the Model State Manager about registered model + mm_genc_bat_env_t *p_env_bat = (mm_genc_bat_env_t *)mm_state_register(0, MM_ID_GENC_BAT, mdl_lid, + MM_ROLE_CLI, sizeof(mm_genc_bat_env_t)); + + if (p_env_bat) + { + // Get client-specific callback functions + //mm_cli_cb_t *p_cb_cli = p_env_bat->env.cb.u.p_cb_cli; + + // Set internal callback functions + p_env_bat->env.mdl_cb.cb_rx = mm_genc_bat_cb_rx; + p_env_bat->env.mdl_cb.cb_opcode_check = mm_genc_bat_cb_opcode_check; + //p_cb_cli->cb_get = mm_genc_bat_cb_get; + p_env_bat->env.mdl_cb.p_cb_cli = &mm_genc_bat_cb; + + // Inform application about registered model + mm_register_ind_send(MM_ID_GENC_BAT, 0, mdl_lid); + } + } + + return (mdl_lid); +} + +/// @} end of group diff --git a/mesh/model/gen/genc/mm_genc_dtt.c b/mesh/model/gen/genc/mm_genc_dtt.c new file mode 100644 index 0000000..b63d740 --- /dev/null +++ b/mesh/model/gen/genc/mm_genc_dtt.c @@ -0,0 +1,232 @@ +/** + **************************************************************************************** + * + * @file mm_genc_dtt.c + * + * @brief Mesh Model Generic Default Transition Time Client Module + * + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @addtogroup MM_GENC_DTT + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mm_itf.h" +#include "mm_genc.h" + + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Structure for Generic Default Transition Time Client model environment +typedef struct mm_genc_dtt_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; +} mm_genc_dtt_env_t; + +/* + * INTERNAL CALLBACK FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Inform Generic Default Transition Time Client model about reception of a message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing environment containing information about the + * received message + **************************************************************************************** + */ +__STATIC void mm_genc_dtt_cb_rx(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + if (p_route_env->opcode == MM_MSG_GEN_DTT_STATUS) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Generic Default Transition Time state value + uint8_t dft_trans_time = *(p_data + MM_GEN_DDT_STATUS_DDT_POS); + + // Inform the application about the received Generic Default Transition Time state value + mm_cli_state_ind_send(p_route_env->u_addr.src, MM_STATE_GEN_DTT, dft_trans_time, 0, 0); + } +} + +/** + **************************************************************************************** + * @brief Inform Generic Default Transition Time Client model about a received opcode in order + * to check if the model is authorized to handle the associated message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] opcode Opcode value to be checked + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_genc_dtt_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status; + + if (opcode == MM_MSG_GEN_DTT_STATUS) + { + status = MESH_ERR_NO_ERROR; + } + else + { + status = MESH_ERR_MDL_INVALID_OPCODE; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Send a Generic Default Transition Time Get message to a given node's element + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element to which message will be sent + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_genc_dtt_cb_get(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint16_t get_info) +{ + uint8_t status = MESH_ERR_NO_ERROR; + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_get = mm_route_buf_alloc(0); + + if (p_buf_get) + { + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_get->env; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + p_buf_env->opcode = MM_MSG_GEN_DTT_GET; + + // Send the message + mm_route_send(p_buf_get); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Set Generic Default Transition Time state value on a given node's element by + * sending either a Generic Default Transition Time Set or a Generic Default Transition + * Time Set Unacknowledged message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element to which message will be sent + * @param[in] state_1 Generic Default Transition Time state value (uint8_t) + * @param[in] state_2 N\A + * @param[in] set_info Set information (@see enum mm_set_info) + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_genc_dtt_cb_set(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint32_t state_1, uint32_t state_2, + uint16_t set_info) +{ + uint8_t status = MESH_ERR_NO_ERROR; + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_set = mm_route_buf_alloc(MM_GEN_DTT_SET_LEN); + + if (p_buf_set) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_set); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_set->env; + // Generic Default Transition Time state value + uint8_t dft_trans_time = state_1; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + p_buf_env->opcode = GETB(set_info, MM_SET_INFO_ACK) ? MM_MSG_GEN_DTT_SET : MM_MSG_GEN_DTT_SET_UNACK;; + + // Fill the message + *(p_data + MM_GEN_DDT_STATUS_DDT_POS) = dft_trans_time; + + // Send the message + mm_route_send(p_buf_set); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + + return (status); +} + +/* + * GLOBAL FUNCTIONS + **************************************************************************************** + */ + +__STATIC mm_cli_cb_t mm_genc_dtt_cb = +{ + .cb_get = mm_genc_dtt_cb_get, + .cb_set = mm_genc_dtt_cb_set, + .cb_trans = NULL, +}; + +uint8_t mm_genc_dtt_register(void) +{ + // Register the model + m_lid_t mdl_lid = ms_register_model(MM_ID_GENC_DTT, 0, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) //if (status == MESH_ERR_NO_ERROR) + { + // Inform the Model State Manager about registered model + mm_genc_dtt_env_t *p_env_dtt = (mm_genc_dtt_env_t *)mm_state_register(0, MM_ID_GENC_DTT, mdl_lid, + MM_ROLE_CLI, sizeof(mm_genc_dtt_env_t)); + + if (p_env_dtt) + { + // Get client-specific callback functions + //mm_cli_cb_t *p_cb_cli = p_env_dtt->env.cb.u.p_cb_cli; + + // Set internal callback functions + p_env_dtt->env.mdl_cb.cb_rx = mm_genc_dtt_cb_rx; + p_env_dtt->env.mdl_cb.cb_opcode_check = mm_genc_dtt_cb_opcode_check; + //p_cb_cli->cb_get = mm_genc_dtt_cb_get; + //p_cb_cli->cb_set = mm_genc_dtt_cb_set; + p_env_dtt->env.mdl_cb.p_cb_cli = &mm_genc_dtt_cb; + + // Inform application about registered model + mm_register_ind_send(MM_ID_GENC_DTT, 0, mdl_lid); + } + } + + return (mdl_lid); +} + +/// @} end of group diff --git a/mesh/model/gen/genc/mm_genc_loc.c b/mesh/model/gen/genc/mm_genc_loc.c new file mode 100644 index 0000000..f9d10b8 --- /dev/null +++ b/mesh/model/gen/genc/mm_genc_loc.c @@ -0,0 +1,302 @@ +/** + **************************************************************************************** + * + * @file mm_genc_loc.c + * + * @brief Mesh Model Generic Location Client Module + * + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @addtogroup MM_GENC_LOC + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mm_itf.h" +#include "mm_genc.h" + + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Structure for Generic Location Client model environment +typedef struct mm_genc_loc_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; +} mm_genc_loc_env_t; + +/* + * INTERNAL CALLBACK FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Inform Generic Location Client model about reception of a message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing environment containing information about the + * received message + **************************************************************************************** + */ +__STATIC void mm_genc_loc_cb_rx(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + + if (p_route_env->opcode == MM_MSG_GEN_LOCG_STATUS) + { + // Global latitude value + int32_t latitude = (int32_t)read32p(p_data + MM_GEN_LOC_STATUS_GLOB_LAT_POS); + // Global longitude value + int32_t longitude = (int32_t)read32p(p_data + MM_GEN_LOC_STATUS_GLOB_LONG_POS); + // Global altitude value + int16_t altitude = (int16_t)read16p(p_data + MM_GEN_LOC_STATUS_GLOB_ALT_POS); + + // Inform the application about the received Generic Location state value (global part) + mm_cli_locg_ind_send(p_route_env->u_addr.src, latitude, longitude, altitude); + } + else + { + // Local north value + int16_t north = (int16_t)read16p(p_data + MM_GEN_LOC_STATUS_LOC_NORTH_POS); + // Local east value + int16_t east = (int16_t)read16p(p_data + MM_GEN_LOC_STATUS_LOC_EAST_POS); + // Local altitude value + int16_t altitude = (int16_t)read16p(p_data + MM_GEN_LOC_STATUS_LOC_ALT_POS); + // Floor value + uint8_t floor = *(p_data + MM_GEN_LOC_STATUS_LOC_FLOOR_POS); + // Uncertainty value + uint16_t uncertainty = read16p(p_data + MM_GEN_LOC_STATUS_LOC_UNCERT_POS); + + // Inform the application about the received Generic Location state value (local part) + mm_cli_locl_ind_send(p_route_env->u_addr.src, north, east, altitude, + floor, uncertainty); + } +} + +/** + **************************************************************************************** + * @brief Inform Generic Location Client model about a received opcode in order + * to check if the model is authorized to handle the associated message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] opcode Opcode value to be checked + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_genc_loc_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status; + + if ((opcode == MM_MSG_GEN_LOCG_STATUS) + || (opcode == MM_MSG_GEN_LOCL_STATUS)) + { + status = MESH_ERR_NO_ERROR; + } + else + { + status = MESH_ERR_MDL_INVALID_OPCODE; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Send a Generic Location Get message in order to retrieve Generic Location state + * value (either global or local part) of a given node's element. + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element from which Generic Location state value + * must be retrieved + * @param[in] get_info Get information + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_genc_loc_cb_get(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint16_t get_info) +{ + uint8_t status = MESH_ERR_NO_ERROR; + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_get = mm_route_buf_alloc(0); + + if (p_buf_get) + { + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_get->env; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + p_buf_env->opcode = (get_info == MM_GET_TYPE_LOC_GLOBAL) + ? MM_MSG_GEN_LOCG_GET : MM_MSG_GEN_LOCL_GET; + + // Send the message + mm_route_send(p_buf_get); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + + return (status); +} + +/* + * GLOBAL FUNCTIONS + **************************************************************************************** + */ + +__STATIC mm_cli_cb_t mm_genc_loc_cb = +{ + .cb_get = mm_genc_loc_cb_get, + .cb_set = NULL, + .cb_trans = NULL, +}; + +uint8_t mm_genc_loc_register(void) +{ + // Model local index + m_lid_t mdl_lid = ms_register_model(MM_ID_GENC_LOC, 0, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) + { + // Inform the Model State Manager about registered model + mm_genc_loc_env_t *p_env_loc = (mm_genc_loc_env_t *)mm_state_register(0, MM_ID_GENC_LOC, mdl_lid, + MM_ROLE_CLI, sizeof(mm_genc_loc_env_t)); + + if (p_env_loc) + { + // Get client-specific callback functions + //mm_cli_cb_t *p_cb_cli = p_env_loc->env.cb.u.p_cb_cli; + + // Set internal callback functions + p_env_loc->env.mdl_cb.cb_rx = mm_genc_loc_cb_rx; + p_env_loc->env.mdl_cb.cb_opcode_check = mm_genc_loc_cb_opcode_check; + //p_cb_cli->cb_get = mm_genc_loc_cb_get; + p_env_loc->env.mdl_cb.p_cb_cli = &mm_genc_loc_cb; + + // Inform application about registered model + mm_register_ind_send(MM_ID_GENC_LOC, 0, mdl_lid); + } + } + + return (mdl_lid); +} + +uint8_t mm_genc_locg_set(m_lid_t mdl_lid, m_lid_t app_key_lid, uint16_t dst, + uint8_t set_info, int32_t latitude, int32_t longitude, int16_t altitude) +{ + uint8_t status = MESH_ERR_NO_ERROR; + mm_mdl_env_t *p_env = mm_state_get_env(mdl_lid); + + if (p_env && p_env->model_id == MM_ID_GENC_LOC) + { + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_set = mm_route_buf_alloc(MM_GEN_LOC_SET_GLOB_LEN); + + if (p_buf_set) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_set); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_set->env; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + p_buf_env->opcode = GETB(set_info, MM_SET_INFO_ACK) + ? MM_MSG_GEN_LOCG_SET : MM_MSG_GEN_LOCG_SET_UNACK; + + // Fill the message + write32p(p_data + MM_GEN_LOC_SET_GLOB_LAT_POS, latitude); + write32p(p_data + MM_GEN_LOC_SET_GLOB_LONG_POS, longitude); + write16p(p_data + MM_GEN_LOC_SET_GLOB_ALT_POS, altitude); + + // Send the message + mm_route_send(p_buf_set); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + } + else + { + status = MESH_ERR_INVALID_PARAM; + } + + return (status); +} + +uint8_t mm_genc_locl_set(m_lid_t mdl_lid, m_lid_t app_key_lid, uint16_t dst, + uint8_t set_info, int16_t north, int16_t east, int16_t altitude, + uint8_t floor, uint16_t uncertainty) +{ + uint8_t status = MESH_ERR_NO_ERROR; + mm_mdl_env_t *p_env = mm_state_get_env(mdl_lid); + + if (p_env && p_env->model_id == MM_ID_GENC_LOC) + { + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_set = mm_route_buf_alloc(MM_GEN_LOC_SET_LOC_LEN); + + if (p_buf_set) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_set); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_set->env; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + p_buf_env->opcode = GETB(set_info, MM_SET_INFO_ACK) + ? MM_MSG_GEN_LOCL_SET : MM_MSG_GEN_LOCL_SET_UNACK; + + // Fill the message + write16p(p_data + MM_GEN_LOC_SET_LOC_NORTH_POS, north); + write16p(p_data + MM_GEN_LOC_SET_LOC_EAST_POS, east); + write16p(p_data + MM_GEN_LOC_SET_LOC_ALT_POS, altitude); + *(p_data + MM_GEN_LOC_SET_LOC_FLOOR_POS) = floor; + write16p(p_data + MM_GEN_LOC_SET_LOC_UNCERT_POS, uncertainty); + + // Send the message + mm_route_send(p_buf_set); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + } + else + { + status = MESH_ERR_INVALID_PARAM; + } + + return (status); +} + +/// @} end of group diff --git a/mesh/model/gen/genc/mm_genc_lvl.c b/mesh/model/gen/genc/mm_genc_lvl.c new file mode 100644 index 0000000..9b96691 --- /dev/null +++ b/mesh/model/gen/genc/mm_genc_lvl.c @@ -0,0 +1,331 @@ +/** + **************************************************************************************** + * + * @file mm_genc_lvl.c + * + * @brief Mesh Model Generic Level Client Module + * + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @addtogroup MM_GENC_LVL + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mm_itf.h" +#include "mm_genc.h" + + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Structure for Generic Level Client model environment +typedef struct mm_genc_lvl_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; +} mm_genc_lvl_env_t; + +/* + * LOCAL FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Compute length of set message to prepare: + * - Generic Level Set/Set Unacknowledged + * - Generic Delta Set/Set Unacknowledged + * - Generic Move Set/Set Unacknowledged + * + * @param[in] trans_type Transition type (@see enum mm_trans_type) + * @param[in] set_long True if optional parameters are present, else false + * + * @return Length of the set message + **************************************************************************************** + */ +__STATIC uint8_t mm_genc_lvl_get_length(uint8_t trans_type, bool set_long) +{ + uint8_t length; + + if (trans_type == MM_TRANS_TYPE_CLASSIC) + { + // Generic Level Set/Set Unacknowledged + length = (set_long) ? MM_GEN_LVL_SET_LEN : MM_GEN_LVL_SET_MIN_LEN; + } + else if (trans_type == MM_TRANS_TYPE_DELTA) + { + // Generic Delta Set/Set Unacknowledged + length = (set_long) ? MM_GEN_LVL_SET_DELTA_LEN : MM_GEN_LVL_SET_DELTA_MIN_LEN; + } + else // (trans_type == MM_TRANS_TYPE_MOVE) + { + // Generic Move Set/Set Unacknowledged + length = (set_long) ? MM_GEN_LVL_SET_MOVE_LEN : MM_GEN_LVL_SET_MOVE_MIN_LEN; + } + + return (length); +} + +/* + * INTERNAL CALLBACK FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Inform Generic Level Client model about reception of a message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing environment containing information about the + * received message + **************************************************************************************** + */ +__STATIC void mm_genc_lvl_cb_rx(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + if (p_route_env->opcode == MM_MSG_GEN_LVL_STATUS) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Current state + uint16_t cur_state = read16p(p_data + MM_GEN_LVL_STATUS_LVL_POS); + // Target state + uint16_t tgt_state; + // Remaining time + uint8_t rem_time; + + // Read optional parameters if presents + if (p_buf->data_len == MM_GEN_LVL_STATUS_LEN) + { + tgt_state = read16p(p_data + MM_GEN_LVL_STATUS_TGT_LVL_POS); + rem_time = *(p_data + MM_GEN_LVL_STATUS_REM_TIME_POS); + } + else + { + tgt_state = 0; + rem_time = 0; + } + + // Inform the application about the received Generic Level state value + mm_cli_state_ind_send(p_route_env->u_addr.src, MM_STATE_GEN_LVL, cur_state, + tgt_state, mm_get_trans_time_ms(rem_time)); + } +} + +/** + **************************************************************************************** + * @brief Inform Generic Level Client model about a received opcode in order to check if the + * model is authorized to handle the associated message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] opcode Opcode value to be checked + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_genc_lvl_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status; + + if (opcode == MM_MSG_GEN_LVL_STATUS) + { + status = MESH_ERR_NO_ERROR; + } + else + { + status = MESH_ERR_MDL_INVALID_OPCODE; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Send a Generic Level Get message to a given node's element + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element to which message will be sent + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_genc_lvl_cb_get(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint16_t get_info) +{ + uint8_t status = MESH_ERR_NO_ERROR; + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_get = mm_route_buf_alloc(0); + + if (p_buf_get) + { + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_get->env; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + p_buf_env->opcode = MM_MSG_GEN_LVL_GET; + + // Send the message + mm_route_send(p_buf_get); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Initiate transition of Generic Level state value on a given node's element by + * sending either a Generic Level Set or a Generic Level Set Unacknowledged message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element to which message will be sent + * @param[in] state_1 Target Generic Level state value + * @param[in] state_2 N\A + * @param[in] trans_time_ms Transition time in milliseconds + * @param[in] delay_ms Delay in milliseconds + * @param[in] trans_info Transition information (@see enum mm_trans_info) + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_genc_lvl_cb_trans(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint32_t state_1, uint32_t state_2, + uint32_t trans_time_ms, uint16_t delay_ms, + uint16_t trans_info) +{ + uint8_t status = MESH_ERR_NO_ERROR; + // Transition type + uint8_t trans_type = GETF(trans_info, MM_TRANS_INFO_TYPE); + // Long message or not + bool long_set = (GETB(trans_info, MM_TRANS_INFO_LONG) || trans_time_ms || delay_ms); + // Get message length + uint8_t length = mm_genc_lvl_get_length(trans_type, long_set); + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_set = mm_route_buf_alloc(length); + + if (p_buf_set) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_set); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_set->env; + + // Prepare environment + p_buf_env->app_key_lid = 6; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + + if (trans_type == MM_TRANS_TYPE_CLASSIC) + { + p_buf_env->opcode = GETB(trans_info, MM_TRANS_INFO_ACK) + ? MM_MSG_GEN_LVL_SET : MM_MSG_GEN_LVL_SET_UNACK; + + // Fill the message + write16p(p_data + MM_GEN_LVL_SET_LVL_POS, state_1); + *(p_data + MM_GEN_LVL_SET_TID_POS) = GETF(trans_info, MM_TRANS_INFO_TID); + p_data += MM_GEN_LVL_SET_TRANS_TIME_POS; + } + else if (trans_type == MM_TRANS_TYPE_DELTA) + { + p_buf_env->opcode = GETB(trans_info, MM_TRANS_INFO_ACK) + ? MM_MSG_GEN_DELTA_SET : MM_MSG_GEN_DELTA_SET_UNACK; + + // Fill the message + write32p(p_data + MM_GEN_LVL_SET_DELTA_LVL_POS, state_1); + *(p_data + MM_GEN_LVL_SET_DELTA_TID_POS) = GETF(trans_info, MM_TRANS_INFO_TID); + p_data += MM_GEN_LVL_SET_DELTA_TRANS_TIME_POS; + } + else + { + p_buf_env->opcode = GETB(trans_info, MM_TRANS_INFO_ACK) + ? MM_MSG_GEN_MOVE_SET : MM_MSG_GEN_MOVE_SET_UNACK; + + // Fill the message + write16p(p_data + MM_GEN_LVL_SET_MOVE_DELTA_LVL_POS, state_1); + *(p_data + MM_GEN_LVL_SET_MOVE_TID_POS) = GETF(trans_info, MM_TRANS_INFO_TID); + p_data += MM_GEN_LVL_SET_MOVE_TRANS_TIME_POS; + } + + if (long_set) + { + // Set transition time and delay values + *p_data = mm_get_trans_time(trans_time_ms); + *(p_data + 1) = delay_ms / 5; + } + + // Send the message + mm_route_send(p_buf_set); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + + return (status); +} + + +/* + * GLOBAL FUNCTIONS + **************************************************************************************** + */ + +__STATIC mm_cli_cb_t mm_genc_lvl_cb = +{ + .cb_get = mm_genc_lvl_cb_get, + .cb_set = NULL, + .cb_trans = mm_genc_lvl_cb_trans, +}; + +uint8_t mm_genc_lvl_register(void) +{ + // Register the model + m_lid_t mdl_lid = ms_register_model(MM_ID_GENC_LVL, 0, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) //if (status == MESH_ERR_NO_ERROR) + { + // Inform the Model State Manager about registered model + mm_genc_lvl_env_t *p_env_lvl = (mm_genc_lvl_env_t *)mm_state_register(0, MM_ID_GENC_LVL, mdl_lid, + MM_ROLE_CLI, sizeof(mm_genc_lvl_env_t)); + + if (p_env_lvl) + { + // Get client-specific callback functions + //mm_cli_cb_t *p_cb_cli = p_env_lvl->env.cb.u.p_cb_cli; + + // Set internal callback functions + p_env_lvl->env.mdl_cb.cb_rx = mm_genc_lvl_cb_rx; + p_env_lvl->env.mdl_cb.cb_opcode_check = mm_genc_lvl_cb_opcode_check; + //p_cb_cli->cb_get = mm_genc_lvl_cb_get; + //p_cb_cli->cb_trans = mm_genc_lvl_cb_trans; + p_env_lvl->env.mdl_cb.p_cb_cli = &mm_genc_lvl_cb; + + // Inform application about registered model + mm_register_ind_send(MM_ID_GENC_LVL, 0, mdl_lid); + } + } + + return (mdl_lid); +} + +/// @} end of group diff --git a/mesh/model/gen/genc/mm_genc_oo.c b/mesh/model/gen/genc/mm_genc_oo.c new file mode 100644 index 0000000..57b6b63 --- /dev/null +++ b/mesh/model/gen/genc/mm_genc_oo.c @@ -0,0 +1,257 @@ +/** + **************************************************************************************** + * + * @file mm_genc_oo.c + * + * @brief Mesh Model Generic OnOff Client Module + * + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @addtogroup MM_GENC_OO + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mm_itf.h" +#include "mm_genc.h" + + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Structure for Generic OnOff Client model environment +typedef struct mm_genc_oo_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; +} mm_genc_oo_env_t; + +/* + * INTERNAL CALLBACK FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Inform Generic OnOff Client model about reception of a message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing environment containing information about the + * received message + **************************************************************************************** + */ +__STATIC void mm_genc_oo_cb_rx(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + if (p_route_env->opcode == MM_MSG_GEN_OO_STATUS) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Current state + uint8_t cur_state = *(p_data + MM_GEN_OO_STATUS_OO_POS); + // Target state + uint8_t tgt_state = 0; + // Remaining time + uint8_t rem_time = 0; + + // Read optional parameters if presents + if (p_buf->data_len == MM_GEN_OO_STATUS_LEN) + { + tgt_state = *(p_data + MM_GEN_OO_STATUS_TGT_OO_POS); + rem_time = *(p_data + MM_GEN_OO_STATUS_REM_TIME_POS); + } + + // Inform the application about the received Generic OnOff state value + mm_cli_state_ind_send(p_route_env->u_addr.src, MM_STATE_GEN_ONOFF, cur_state, + tgt_state, mm_get_trans_time_ms(rem_time)); + } +} + +/** + **************************************************************************************** + * @brief Inform Generic OnOff Client model about a received opcode in order to check if the + * model is authorized to handle the associated message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] opcode Opcode value to be checked + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_genc_oo_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status; + + if (opcode == MM_MSG_GEN_OO_STATUS) + { + status = MESH_ERR_NO_ERROR; + } + else + { + status = MESH_ERR_MDL_INVALID_OPCODE; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Send a Generic OnOff Get message to a given node's element + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element to which message will be sent + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_genc_oo_cb_get(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint16_t get_info) +{ + uint8_t status = MESH_ERR_NO_ERROR; + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_get = mm_route_buf_alloc(0); + + if (p_buf_get) + { + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_get->env; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + p_buf_env->opcode = MM_MSG_GEN_OO_GET; + + // Send the message + mm_route_send(p_buf_get); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Initiate transition of Generic OnOff state value on a given node's element by + * sending either a Generic OnOff Set or a Generic OnOff Set Unacknowledged message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element to which message will be sent + * @param[in] state_1 Target Generic OnOff state value + * @param[in] state_2 N\A + * @param[in] trans_time_ms Transition time in milliseconds + * @param[in] delay_ms Delay in milliseconds + * @param[in] trans_info Transition information (@see enum mm_trans_info) + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_genc_oo_cb_trans(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint32_t state_1, uint32_t state_2, + uint32_t trans_time_ms, uint16_t delay_ms, + uint16_t trans_info) +{ + uint8_t status = MESH_ERR_NO_ERROR; + // Get message length + uint8_t length = (GETB(trans_info, MM_TRANS_INFO_LONG) || trans_time_ms || delay_ms) + ? MM_GEN_OO_SET_LEN : MM_GEN_OO_SET_MIN_LEN; + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_set = mm_route_buf_alloc(length); + + if (p_buf_set) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_set); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_set->env; + // Generic OnOff state value + uint8_t onoff = state_1; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + p_buf_env->opcode = GETB(trans_info, MM_TRANS_INFO_ACK) + ? MM_MSG_GEN_OO_SET : MM_MSG_GEN_OO_SET_UNACK; + + // Fill the message + *(p_data + MM_GEN_OO_SET_OO_POS) = onoff; + *(p_data + MM_GEN_OO_SET_TID_POS) = GETF(trans_info, MM_TRANS_INFO_TID); + + if (length == MM_GEN_OO_SET_LEN) + { + *(p_data + MM_GEN_OO_SET_TRANS_TIME_POS) = mm_get_trans_time(trans_time_ms); + *(p_data + MM_GEN_OO_SET_DELAY_POS) = delay_ms / 5; + } + + // Send the message + mm_route_send(p_buf_set); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + + return (status); +} + +/* + * GLOBAL FUNCTIONS + **************************************************************************************** + */ + +__STATIC mm_cli_cb_t mm_genc_oo_cb = +{ + .cb_get = mm_genc_oo_cb_get, + .cb_set = NULL, + .cb_trans = mm_genc_oo_cb_trans, +}; + +uint8_t mm_genc_oo_register(void) +{ + // Register the model + m_lid_t mdl_lid = ms_register_model(MM_ID_GENC_OO, 0, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) //if (status == MESH_ERR_NO_ERROR) + { + // Inform the Model State Manager about registered model + mm_genc_oo_env_t *p_env_oo = (mm_genc_oo_env_t *)mm_state_register(0, MM_ID_GENC_OO, mdl_lid, + MM_ROLE_CLI, sizeof(mm_genc_oo_env_t)); + + if (p_env_oo) + { + // Get client-specific callback functions + //mm_cli_cb_t *p_cb_cli = p_env_oo->env.cb.u.p_cb_cli; + + // Set internal callback functions + p_env_oo->env.mdl_cb.cb_rx = mm_genc_oo_cb_rx; + p_env_oo->env.mdl_cb.cb_opcode_check = mm_genc_oo_cb_opcode_check; + //p_cb_cli->cb_get = mm_genc_oo_cb_get; + //p_cb_cli->cb_trans = mm_genc_oo_cb_trans; + p_env_oo->env.mdl_cb.p_cb_cli = &mm_genc_oo_cb; + + // Inform application about registered model + mm_register_ind_send(MM_ID_GENC_OO, 0, mdl_lid); + } + } + + return (mdl_lid); +} + +/// @} end of group diff --git a/mesh/model/gen/genc/mm_genc_plvl.c b/mesh/model/gen/genc/mm_genc_plvl.c new file mode 100644 index 0000000..5a5a55d --- /dev/null +++ b/mesh/model/gen/genc/mm_genc_plvl.c @@ -0,0 +1,488 @@ +/** + **************************************************************************************** + * + * @file mm_genc_plvl.c + * + * @brief Mesh Model Generic Power Level Client Module + * + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @addtogroup MM_GENC_PLVL + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mm_itf.h" +#include "mm_genc.h" + + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Structure for Generic Power Level Client model environment +typedef struct mm_genc_plvl_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; +} mm_genc_plvl_env_t; + +/* + * MESSAGE HANDLERS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Handler for Generic Power Level Status message + * + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] src Source address of the message + **************************************************************************************** + */ +__STATIC void mm_genc_plvl_handler_status(mesh_buf_t *p_buf, uint16_t src) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Generic Power Actual state value + uint16_t power_actual = read16p(p_data + MM_GEN_PLVL_STATUS_PRES_POWER_POS); + // Targeted Generic Power Actual state value + uint16_t power_tgt; + // Remaining time + uint32_t rem_time; + + // Check if optional parameters are provided + if (p_buf->data_len == MM_GEN_PLVL_STATUS_LEN) + { + power_tgt = read16p(p_data + MM_GEN_PLVL_STATUS_TGT_POWER_POS); + rem_time = *(p_data + MM_GEN_PLVL_STATUS_REM_TIME_POS); + } + else + { + power_tgt = 0; + rem_time = 0; + } + + // Inform the application about the received Generic Power Last state value + mm_cli_state_ind_send(src, MM_STATE_GEN_POWER_ACTUAL, power_actual, power_tgt, + mm_get_trans_time_ms(rem_time)); +} + +/** + **************************************************************************************** + * @brief Handler for Generic Power Last Status message + * + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] src Source address of the message + **************************************************************************************** + */ +__STATIC void mm_genc_plvl_handler_status_last(mesh_buf_t *p_buf, uint16_t src) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Generic Power Last state value + uint16_t power_last = read16p(p_data + MM_GEN_PLVL_LAST_STATUS_POWER_POS); + + // Inform the application about the received Generic Power Last state value + mm_cli_state_ind_send(src, MM_STATE_GEN_POWER_LAST, power_last, 0, 0); +} + +/** + **************************************************************************************** + * @brief Handler for Generic Power Default Status message + * + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] src Source address of the message + **************************************************************************************** + */ +__STATIC void mm_genc_plvl_handler_status_dflt(mesh_buf_t *p_buf, uint16_t src) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Generic Power Default state value + uint16_t power_dflt = read16p(p_data + MM_GEN_PLVL_DFLT_SET_POWER_POS); + + // Inform the application about the received Generic Power Default state value + mm_cli_state_ind_send(src, MM_STATE_GEN_POWER_DFLT, power_dflt, 0, 0); +} + +/** + **************************************************************************************** + * @brief Handler for Generic Power Range Status message + * + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] src Source address of the message + **************************************************************************************** + */ +__STATIC void mm_genc_plvl_handler_status_range(mesh_buf_t *p_buf, uint16_t src) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Generic Power Range state value (minimum) + uint16_t power_min = read16p(p_data + MM_GEN_PLVL_RANGE_STATUS_MIN_POS); + // Generic Power Range state value (maximum) + uint16_t power_max = read16p(p_data + MM_GEN_PLVL_RANGE_STATUS_MAX_POS); + + // Inform the application about the received Generic Power Default state value + mm_cli_state_ind_send(src, MM_STATE_GEN_POWER_RANGE, power_min, power_max, 0); +} + +/* + * INTERNAL CALLBACK FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Inform Generic Power Level Client model about reception of a message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing environment containing information about the + * received message + **************************************************************************************** + */ +__STATIC void mm_genc_plvl_cb_rx(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + // Call the appropriate handler for the received message + switch (p_route_env->opcode) + { + case (MM_MSG_GEN_PLVL_STATUS): + { + mm_genc_plvl_handler_status(p_buf, p_route_env->u_addr.src); + } break; + + case (MM_MSG_GEN_PLAST_STATUS): + { + mm_genc_plvl_handler_status_last(p_buf, p_route_env->u_addr.src); + } break; + + case (MM_MSG_GEN_PDFLT_STATUS): + { + mm_genc_plvl_handler_status_dflt(p_buf, p_route_env->u_addr.src); + } break; + + case (MM_MSG_GEN_PRANGE_STATUS): + { + mm_genc_plvl_handler_status_range(p_buf, p_route_env->u_addr.src); + } break; + + default: + { + + } break; + } +} + +/** + **************************************************************************************** + * @brief Inform Generic Power Level Client model about a received opcode in order + * to check if the model is authorized to handle the associated message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] opcode Opcode value to be checked + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_genc_plvl_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status; + + if ((opcode == MM_MSG_GEN_PLVL_STATUS) + || (opcode == MM_MSG_GEN_PLAST_STATUS) + || (opcode == MM_MSG_GEN_PDFLT_STATUS) + || (opcode == MM_MSG_GEN_PRANGE_STATUS)) + { + status = MESH_ERR_NO_ERROR; + } + else + { + status = MESH_ERR_MDL_INVALID_OPCODE; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Get Generic Power Actual or Generic Power Last or Generic Power Default or + * Generic Power Range state value + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element from which state value must be retrieved + * @param[in] get_option Get option + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_genc_plvl_cb_get(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint16_t get_info) +{ + // Status + uint8_t status = MESH_ERR_NO_ERROR; + // Get type + uint8_t get_type = get_info; + + // Check option value + if (get_type <= MM_GET_TYPE_PLVL_MAX) + { + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_get = mm_route_buf_alloc(0); + + if (p_buf_get) + { + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_get->env; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + + if (get_type == MM_GET_TYPE_PLVL_ACTUAL) + { + p_buf_env->opcode = MM_MSG_GEN_PLVL_GET; + } + else if (get_type == MM_GET_TYPE_PLVL_LAST) + { + p_buf_env->opcode = MM_MSG_GEN_PLAST_GET; + } + else if (get_type == MM_GET_TYPE_PLVL_DFLT) + { + p_buf_env->opcode = MM_MSG_GEN_PDFLT_GET; + } + else // (option == MM_GET_OPTION_PLVL_RANGE) + { + p_buf_env->opcode = MM_MSG_GEN_PRANGE_GET; + } + + // Send the message + mm_route_send(p_buf_get); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + } + else + { + status = MESH_ERR_INVALID_PARAM; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Set Generic Power Actual state value + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element on which state value must be set + * @param[in] state_1 Generic Power Actual state value + * @param[in] state_2 N/A + * @param[in] trans_time_ms Transition time in milliseconds + * @param[in] delay_ms Delay in milliseconds + * @param[in] trans_info Transition information + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_genc_plvl_cb_trans(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint32_t state_1, uint32_t state_2, + uint32_t trans_time_ms, uint16_t delay_ms, + uint16_t trans_info) +{ + uint8_t status = MESH_ERR_NO_ERROR; + // Long message or not + bool long_set = (GETB(trans_info, MM_TRANS_INFO_LONG) || trans_time_ms || delay_ms); + // Get message length + uint8_t length = (long_set) ? MM_GEN_PLVL_SET_LEN : MM_GEN_PLVL_SET_MIN_LEN; + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_set = mm_route_buf_alloc(length); + + if (p_buf_set) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_set); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_set->env; + // Generic Power Level Actual state value + int16_t power = state_1; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + p_buf_env->opcode = (GETB(trans_info, MM_TRANS_INFO_ACK)) + ? MM_MSG_GEN_PLVL_SET : MM_MSG_GEN_PLVL_SET_UNACK; + + // Fill the message + write16p(p_data + MM_GEN_PLVL_SET_POWER_POS, power); + *(p_data + MM_GEN_PLVL_SET_TID_POS) = GETF(trans_info, MM_TRANS_INFO_TID); + + if (long_set) + { + // Set transition time and delay values + *(p_data + MM_GEN_PLVL_SET_TRANS_TIME_POS) = mm_get_trans_time(trans_time_ms); + *(p_data + MM_GEN_PLVL_SET_DELAY_POS) = delay_ms / 5; + } + + // Send the message + mm_route_send(p_buf_set); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Set Generic Power Last or Generic Power Default or Generic Power Range state + * value + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element on which state value must be set + * @param[in] state_1 State value 1 + * @param[in] state_2 State value 2 + * @param[in] set_info Set information + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_genc_plvl_cb_set(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint32_t state_1, uint32_t state_2, + uint16_t set_info) +{ + // Set type + uint8_t set_type = GETF(set_info, MM_SET_INFO_TYPE); + // Status + uint8_t status = MESH_ERR_NO_ERROR; + + // Check provided set type + if (set_type <= MM_SET_TYPE_PLVL_MAX) + { + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_set; + // Opcode + uint32_t opcode; + // Length + uint8_t length; + + if (set_type == MM_SET_TYPE_PLVL_DFLT) + { + length = MM_GEN_PLVL_DFLT_SET_LEN; + opcode = GETB(set_info, MM_SET_INFO_ACK) + ? MM_MSG_GEN_PDFLT_SET : MM_MSG_GEN_PDFLT_SET_UNACK; + } + else // (set_type == MM_SET_TYPE_PLVL_RANGE) + { + length = MM_GEN_PLVL_RANGE_SET_LEN; + opcode = GETB(set_info, MM_SET_INFO_ACK) + ? MM_MSG_GEN_PRANGE_SET : MM_MSG_GEN_PRANGE_SET_UNACK; + } + + // Allocate a new buffer for the publication + p_buf_set = mm_route_buf_alloc(length); + + if (p_buf_set) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_set); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_set->env; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + p_buf_env->opcode = opcode; + + // Fill the message + if (set_type == MM_SET_TYPE_PLVL_DFLT) + { + write16p(p_data + MM_GEN_PLVL_DFLT_SET_POWER_POS, state_1); + } + else // (set_type == MM_SET_TYPE_PLVL_RANGE) + { + write16p(p_data + MM_GEN_PLVL_RANGE_SET_MIN_POS, state_1); + write16p(p_data + MM_GEN_PLVL_RANGE_SET_MAX_POS, state_2); + } + + // Send the message + mm_route_send(p_buf_set); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + } + else + { + status = MESH_ERR_INVALID_PARAM; + } + + return (status); +} + +/* + * GLOBAL FUNCTIONS + **************************************************************************************** + */ + +__STATIC mm_cli_cb_t mm_genc_plvl_cb = +{ + .cb_get = mm_genc_plvl_cb_get, + .cb_set = mm_genc_plvl_cb_set, + .cb_trans = mm_genc_plvl_cb_trans, +}; + +uint8_t mm_genc_plvl_register(void) +{ + // Register the model + m_lid_t mdl_lid = ms_register_model(MM_ID_GENC_PLVL, 0, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) + { + // Inform the Model State Manager about registered model + mm_genc_plvl_env_t *p_env_plvl = (mm_genc_plvl_env_t *)mm_state_register(0, MM_ID_GENC_PLVL, mdl_lid, + MM_ROLE_CLI, sizeof(mm_genc_plvl_env_t)); + + if (p_env_plvl) + { + // Get client-specific callback functions + //mm_cli_cb_t *p_cb_cli = p_env_plvl->env.cb.u.p_cb_cli; + + // Set internal callback functions + p_env_plvl->env.mdl_cb.cb_rx = mm_genc_plvl_cb_rx; + p_env_plvl->env.mdl_cb.cb_opcode_check = mm_genc_plvl_cb_opcode_check; + //p_cb_cli->cb_get = mm_genc_plvl_cb_get; + //p_cb_cli->cb_set = mm_genc_plvl_cb_set; + //p_cb_cli->cb_trans = mm_genc_plvl_cb_trans; + p_env_plvl->env.mdl_cb.p_cb_cli = &mm_genc_plvl_cb; + + // Inform application about registered model + mm_register_ind_send(MM_ID_GENC_PLVL, 0, mdl_lid); + } + } + + return (mdl_lid); +} + +/// @} end of group diff --git a/mesh/model/gen/genc/mm_genc_poo.c b/mesh/model/gen/genc/mm_genc_poo.c new file mode 100644 index 0000000..8b37950 --- /dev/null +++ b/mesh/model/gen/genc/mm_genc_poo.c @@ -0,0 +1,232 @@ +/** + **************************************************************************************** + * + * @file mm_genc_poo.c + * + * @brief Mesh Model Generic Power OnOff Client Module + * + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @addtogroup MM_GENC_POO + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mm_itf.h" +#include "mm_genc.h" + + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Structure for Generic Power OnOff Client model environment +typedef struct mm_genc_poo_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; +} mm_genc_poo_env_t; + +/* + * INTERNAL CALLBACK FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Inform Generic Power OnOff Client model about reception of a message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing environment containing information about the + * received message + **************************************************************************************** + */ +__STATIC void mm_genc_poo_cb_rx(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + if (p_route_env->opcode == MM_MSG_GEN_ONPUP_STATUS) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Generic OnPowerUp state value + uint8_t on_power_up = *(p_data + MM_GEN_POO_SET_OPU_POS); + + // Inform the application about the received Generic OnPowerUp state value + mm_cli_state_ind_send(p_route_env->u_addr.src, MM_STATE_GEN_ONPOWERUP, on_power_up, 0, 0); + } +} + +/** + **************************************************************************************** + * @brief Inform Generic Power OnOff Client model about a received opcode in order + * to check if the model is authorized to handle the associated message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] opcode Opcode value to be checked + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_genc_poo_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status; + + if (opcode == MM_MSG_GEN_ONPUP_STATUS) + { + status = MESH_ERR_NO_ERROR; + } + else + { + status = MESH_ERR_MDL_INVALID_OPCODE; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Send a Generic OnPowerUp Get message to a given node's element + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element to which message will be sent + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_genc_poo_cb_get(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, \ + uint16_t get_info) +{ + uint8_t status = MESH_ERR_NO_ERROR; + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_get = mm_route_buf_alloc(0); + + if (p_buf_get) + { + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_get->env; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + p_buf_env->opcode = MM_MSG_GEN_ONPUP_GET; + + // Send the message + mm_route_send(p_buf_get); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Set Generic OnPowerUp state value on a given node's element by + * sending either a Generic OnPowerUp Set or a Generic OnPowerUp Set Unacknowledged message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element to which message will be sent + * @param[in] state_1 New Generic OnPowerUp state value + * @param[in] state_2 N/A + * @param[in] set_info Transition information (@see enum mm_set_info) + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_genc_poo_cb_set(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint32_t state_1, uint32_t state_2, + uint16_t set_info) +{ + uint8_t status = MESH_ERR_NO_ERROR; + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_set = mm_route_buf_alloc(MM_GEN_POO_SET_LEN); + + if (p_buf_set) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_set); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_set->env; + // Generic OnPowerUp state value + uint8_t on_power_up = state_1; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + p_buf_env->opcode = GETB(set_info, MM_SET_INFO_ACK) + ? MM_MSG_GEN_ONPUP_SET : MM_MSG_GEN_ONPUP_SET_UNACK; + + // Fill the message + *(p_data + MM_GEN_POO_SET_OPU_POS) = on_power_up; + + // Send the message + mm_route_send(p_buf_set); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + + return (status); +} + +/* + * GLOBAL FUNCTIONS + **************************************************************************************** + */ + +__STATIC mm_cli_cb_t mm_genc_poo_cb = +{ + .cb_get = mm_genc_poo_cb_get, + .cb_set = mm_genc_poo_cb_set, + .cb_trans = NULL, +}; + +uint8_t mm_genc_poo_register(void) +{ + // Register the model + m_lid_t mdl_lid = ms_register_model(MM_ID_GENC_POO, 0, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) //if (status == MESH_ERR_NO_ERROR) + { + // Inform the Model State Manager about registered model + mm_genc_poo_env_t *p_env_poo = (mm_genc_poo_env_t *)mm_state_register(0, MM_ID_GENC_POO, mdl_lid, + MM_ROLE_CLI, sizeof(mm_genc_poo_env_t)); + + if (p_env_poo) + { + // Get client-specific callback functions + //mm_cli_cb_t *p_cb_cli = p_env_poo->env.cb.u.p_cb_cli; + + // Set internal callback functions + p_env_poo->env.mdl_cb.cb_rx = mm_genc_poo_cb_rx; + p_env_poo->env.mdl_cb.cb_opcode_check = mm_genc_poo_cb_opcode_check; + //p_cb_cli->cb_get = mm_genc_poo_cb_get; + //p_cb_cli->cb_set = mm_genc_poo_cb_set; + p_env_poo->env.mdl_cb.p_cb_cli = &mm_genc_poo_cb; + + // Inform application about registered model + mm_register_ind_send(MM_ID_GENC_POO, 0, mdl_lid); + } + } + + return (mdl_lid); +} + +/// @} end of group diff --git a/mesh/model/gen/genc/mm_genc_prop.c b/mesh/model/gen/genc/mm_genc_prop.c new file mode 100644 index 0000000..5f4390f --- /dev/null +++ b/mesh/model/gen/genc/mm_genc_prop.c @@ -0,0 +1,381 @@ +/** + **************************************************************************************** + * + * @file mm_genc_prop.c + * + * @brief Mesh Model Generic Property Client Module + * + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @addtogroup MM_GENC_PROP + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mm_itf.h" +#include "mm_genc.h" + + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Structure for Generic Property Client model environment +typedef struct mm_genc_prop_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; +} mm_genc_prop_env_t; + +/* + * INTERNAL CALLBACK FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Inform Generic Property Client model about reception of a message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing environment containing information about the + * received message + **************************************************************************************** + */ +__STATIC void mm_genc_prop_cb_rx(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + + switch (p_route_env->opcode) + { + case (MM_MSG_GEN_UPROP_STATUS): + case (MM_MSG_GEN_APROP_STATUS): + case (MM_MSG_GEN_MPROP_STATUS): + { + // Extract Property ID + uint16_t prop_id = read16p(p_data + MM_GEN_PROP_STATUS_ID_POS); + // Extract User Access + uint8_t user_access = *(p_data + MM_GEN_PROP_STATUS_ACCESS_POS); + // Compute state value length + uint16_t length = p_buf->data_len - (MM_GEN_PROP_STATUS_MIN_LEN + 1); + + // Send the received property state value to the application + mm_cli_prop_ind_send(p_route_env->u_addr.src, prop_id, user_access, length, + p_data + MM_GEN_PROP_STATUS_VALUE_POS); + } break; + + default: + { + // Property type + uint8_t prop_type; + // Compute number of Property IDs + uint8_t nb_prop = p_buf->data_len >> 1; + + switch (p_route_env->opcode) + { + case (MM_MSG_GEN_UPROPS_STATUS): + { + prop_type = MM_PROP_TYPE_USER; + } break; + + case (MM_MSG_GEN_APROPS_STATUS): + { + prop_type = MM_PROP_TYPE_ADMIN; + } break; + + case (MM_MSG_GEN_MPROPS_STATUS): + { + prop_type = MM_PROP_TYPE_MANUF; + } break; + + default: // MM_MSG_GEN_CPROPS_STATUS + { + prop_type = MM_PROP_TYPE_CLI; + } break; + } + + // Send the received list of properties to the application + mm_cli_prop_list_ind_send(p_route_env->u_addr.src, prop_type, + nb_prop, (uint16_t *)p_data); + } break; + } +} + +/** + **************************************************************************************** + * @brief Inform Generic Property Client model about a received opcode in order + * to check if the model is authorized to handle the associated message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] opcode Opcode value to be checked + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_genc_prop_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status; + + if ((opcode == MM_MSG_GEN_UPROPS_STATUS) + || (opcode == MM_MSG_GEN_UPROP_STATUS) + || (opcode == MM_MSG_GEN_APROPS_STATUS) + || (opcode == MM_MSG_GEN_APROP_STATUS) + || (opcode == MM_MSG_GEN_MPROPS_STATUS) + || (opcode == MM_MSG_GEN_MPROP_STATUS) + || (opcode == MM_MSG_GEN_CPROPS_STATUS)) + { + status = MESH_ERR_NO_ERROR; + } + else + { + status = MESH_ERR_MDL_INVALID_OPCODE; + } + + return (status); +} + +/* + * GLOBAL FUNCTIONS + **************************************************************************************** + */ + +uint8_t mm_genc_prop_register(void) +{ + // Register the model + m_lid_t mdl_lid = ms_register_model(MM_ID_GENC_PROP, 0, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) + { + // Inform the Model State Manager about registered model + mm_genc_prop_env_t *p_env_prop = (mm_genc_prop_env_t *)mm_state_register(0, MM_ID_GENC_PROP, mdl_lid, + MM_ROLE_CLI, sizeof(mm_genc_prop_env_t)); + + if (p_env_prop) + { + // Set internal callback functions + p_env_prop->env.mdl_cb.cb_rx = mm_genc_prop_cb_rx; + p_env_prop->env.mdl_cb.cb_opcode_check = mm_genc_prop_cb_opcode_check; + + // Inform application about registered model + mm_register_ind_send(MM_ID_GENC_PROP, 0, mdl_lid); + } + } + + return (mdl_lid); +} + +uint8_t mm_genc_prop_get(m_lid_t mdl_lid, m_lid_t app_key_lid, uint16_t dst, + uint8_t get_type, uint16_t prop_id) +{ + // Allocate a new buffer for the message + uint8_t status = MESH_ERR_NO_ERROR; + mm_mdl_env_t *p_env = mm_state_get_env(mdl_lid); + + if (p_env && (p_env->model_id == MM_ID_GENC_PROP) && (get_type <= MM_GET_TYPE_PROP_MAX)) + { + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_get; + // Opcode + uint32_t opcode = 0; + // Length + uint16_t length = 0; + + switch (get_type) + { + case (MM_GET_TYPE_PROP_UPROPS): + { + opcode = MM_MSG_GEN_UPROPS_GET; + } break; + + case (MM_GET_TYPE_PROP_UPROP): + { + opcode = MM_MSG_GEN_UPROP_GET; + length = 2; + } break; + + case (MM_GET_TYPE_PROP_APROPS): + { + opcode = MM_MSG_GEN_APROPS_GET; + } break; + + case (MM_GET_TYPE_PROP_APROP): + { + opcode = MM_MSG_GEN_APROP_GET; + length = 2; + } break; + + case (MM_GET_TYPE_PROP_MPROPS): + { + opcode = MM_MSG_GEN_MPROPS_GET; + } break; + + case (MM_GET_TYPE_PROP_MPROP): + { + opcode = MM_MSG_GEN_MPROP_GET; + length = 2; + } break; + + case (MM_GET_TYPE_PROP_CPROPS): + { + opcode = MM_MSG_GEN_CPROPS_GET; + length = 2; + } break; + + default: + { + } break; + } + + p_buf_get = mm_route_buf_alloc(length); + + if (p_buf_get) + { + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_get->env; + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_get); + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = mdl_lid; + p_buf_env->opcode = opcode; + + if (length != 0) + { + write16p(p_data, prop_id); + } + + // Send the message + mm_route_send(p_buf_get); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + } + else + { + status = MESH_ERR_INVALID_PARAM; + } + + return (status); +} + +uint8_t mm_genc_prop_set(m_lid_t mdl_lid, m_lid_t app_key_lid, uint16_t dst, uint8_t set_info, + uint16_t prop_id, uint8_t user_access, uint16_t length, const uint8_t *p_val) +{ + // Allocate a new buffer for the message + uint8_t status = MESH_ERR_NO_ERROR; + // Property type + uint8_t prop_type = GETF(set_info, MM_SET_INFO_TYPE); + mm_mdl_env_t *p_env = mm_state_get_env(mdl_lid); + + if (p_env && (p_env->model_id == MM_ID_GENC_PROP) && (prop_type < MM_PROP_TYPE_CLI)) + { + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_get; + // Opcode + uint32_t opcode = 0; + // Length + uint16_t set_length = 0; + + switch (prop_type) + { + case (MM_PROP_TYPE_USER): + { + opcode = (GETB(set_info, MM_SET_INFO_ACK)) + ? MM_MSG_GEN_UPROP_SET : MM_MSG_GEN_UPROP_SET_UNACK; + set_length = MM_GEN_PROP_USER_SET_MIN_LEN + length; + } break; + + case (MM_PROP_TYPE_ADMIN): + { + opcode = (GETB(set_info, MM_SET_INFO_ACK)) + ? MM_MSG_GEN_APROP_SET : MM_MSG_GEN_APROP_SET_UNACK; + set_length = MM_GEN_PROP_ADMIN_SET_MIN_LEN + length; + } break; + + case (MM_PROP_TYPE_MANUF): + { + opcode = (GETB(set_info, MM_SET_INFO_ACK)) + ? MM_MSG_GEN_MPROP_SET : MM_MSG_GEN_MPROP_SET_UNACK; + set_length = MM_GEN_PROP_MANUF_SET_LEN; + } break; + + default: + { + } break; + } + + p_buf_get = mm_route_buf_alloc(set_length); + + if (p_buf_get) + { + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_get->env; + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_get); + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = mdl_lid; + p_buf_env->opcode = opcode; + + // Write Property ID + write16p(p_data, prop_id); + + switch (prop_type) + { + case (MM_PROP_TYPE_USER): + { + memcpy(p_data + MM_GEN_PROP_SET_USER_VAL_POS, p_val, length); + } break; + + case (MM_PROP_TYPE_ADMIN): + { + *(p_data + MM_GEN_PROP_SET_ADMIN_ACCESS_POS) = user_access; + memcpy(p_data + MM_GEN_PROP_SET_ADMIN_VAL_POS, p_val, length); + } break; + + case (MM_PROP_TYPE_MANUF): + { + *(p_data + MM_GEN_PROP_SET_MANUF_ACCESS_POS) = user_access; + } break; + + default: + { + } break; + } + + // Send the message + mm_route_send(p_buf_get); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + } + else + { + status = MESH_ERR_INVALID_PARAM; + } + + return (status); +} + +/// @} end of group diff --git a/mesh/model/gen/gens/mm_gens_bat.c b/mesh/model/gen/gens/mm_gens_bat.c new file mode 100644 index 0000000..a8e7e30 --- /dev/null +++ b/mesh/model/gen/gens/mm_gens_bat.c @@ -0,0 +1,379 @@ +/** + **************************************************************************************** + * @file mm_gens_bat.c + * + * @brief Mesh Model Generic Battery Server Module + * + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @addtogroup MM_GENS_BAT + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mm_itf.h" +#include "mm_gens.h" + + +/* + * ENUMERATIONS + **************************************************************************************** + */ + +/// Information bit field - base on Bit[7:4] of mm_info +/// 8 7 6 5 4 +/// +-----+----------+-----+-------+ +/// | RFU | Wait App | RFU | Publi | +/// +-----+----------+-----+-------+ +enum mm_gens_bat_info +{ + /// Publication to be sent after confirmation received from application + MM_GENS_BAT_INFO_PUBLI_POS = 4, + MM_GENS_BAT_INFO_PUBLI_BIT = (1 << MM_GENS_BAT_INFO_PUBLI_POS), + + /// Wait for confirmation from application + MM_GENS_BAT_INFO_WAIT_APP_POS = 6, + MM_GENS_BAT_INFO_WAIT_APP_BIT = (1 << MM_GENS_BAT_INFO_WAIT_APP_POS), +}; + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Structure for Generic Battery Server model environment +typedef struct mm_gens_bat_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; + /// Timer for sending of publications + mesh_timer_t tmr_publi; + /// Publication period + uint32_t publi_period_ms; + + /// List of prepared Generic Battery Status messages + list_t list_status; + + /// Information (@see enum mm_gens_bat_info) - combine to env.info + //uint8_t info; +} mm_gens_bat_env_t; + +/* + * LOCAL FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Prepare and send a Generic Battery Status message + * + * @param[in] p_env_bat Pointer to Generic Battery Server model environment + **************************************************************************************** + */ +__STATIC void mm_gens_bat_send_status(mm_gens_bat_env_t *p_env_bat, mesh_buf_t *p_buf, + uint8_t bat_lvl, uint32_t time_discharge, uint32_t time_charge, + uint8_t flags) +{ + // Status + //uint8_t status; + + if (!p_buf) + { + p_buf = mm_route_buf_alloc(MM_GEN_BAT_STATUS_LEN); + } + + if (p_buf) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Get pointer to environment + mm_route_env_t *p_env = (mm_route_env_t *)&p_buf->env[0]; + + p_env->opcode = MM_MSG_GEN_BAT_STATUS; + SETB(p_env->info, MM_ROUTE_INFO_PUBLISH, (p_buf == NULL)); + SETB(p_env->info, MM_ROUTE_INFO_RX, 0); + + // Fill the message + *(p_data + MM_GEN_BAT_STATUS_LEVEL_POS) = bat_lvl; + write24p(p_data + MM_GEN_BAT_STATUS_TIME_DISCHRG_POS, time_discharge); + write24p(p_data + MM_GEN_BAT_STATUS_TIME_CHRG_POS, time_charge); + *(p_data + MM_GEN_BAT_STATUS_FLAGS_POS) = flags; + + // Send the message + mm_route_send(p_buf); + } +} + +/** + **************************************************************************************** + * @brief Inform application that current Generic Battery State is required + * + * @param[in] p_env_bat Pointer to Generic Battery Server model environment + **************************************************************************************** + */ +__STATIC void mm_gens_bat_send_req_ind(mm_gens_bat_env_t *p_env_bat) +{ + // Check that a confirmation is not already expected from application + if (!GETB(p_env_bat->env.info, MM_GENS_BAT_INFO_WAIT_APP)) + { + SETB(p_env_bat->env.info, MM_GENS_BAT_INFO_WAIT_APP, 1); + mm_srv_state_req_ind_send(MM_SRV_BAT_REQ_IND, p_env_bat->env.elmt_idx); + } +} + +/** + **************************************************************************************** + * @brief Look for buffer prepared for transmission of Generic Battery Status message to a given + * node's element + * + * @param[in] p_env_bat Pointer to environment allocated for the Generic Battery Server model + * @param[in] src Address of node's element + **************************************************************************************** + */ +__STATIC bool mm_gens_bat_find_get(mm_gens_bat_env_t *p_env_bat, uint16_t src) +{ + // Buffer with same source address has been found + bool found = false; + // Get first buffer + mesh_buf_t *p_buf = (mesh_buf_t *)list_pick(&p_env_bat->list_status); + + while (p_buf) + { + // Read environment + mm_route_env_t *p_env = (mm_route_env_t *)&p_buf->env[0]; + + if (p_env->u_addr.src == src) + { + found = true; + break; + } + + // Get next buffer + p_buf = (mesh_buf_t *)p_buf->hdr.next; + } + + return (found); +} + +/** + **************************************************************************************** + * @brief Prepare a buffer for transmission of Generic Battery Status message + * + * @param[in] p_env_bat Pointer to Generic Battery Server model environment + * @param[in] p_route_env Information about received Generic Battery Get message + **************************************************************************************** + */ +__STATIC void mm_gens_bat_prepare_status(mm_gens_bat_env_t *p_env_bat, + mm_route_env_t *p_route_env) +{ + // Check that a Generic Battery Get message from the same source address has not already + // been received + if (!mm_gens_bat_find_get(p_env_bat, p_route_env->u_addr.src)) + { + // Buffer that will contain the Generic Battery Status message + mesh_buf_t *p_buf_status = mm_route_buf_alloc(MM_GEN_BAT_STATUS_LEN); + + if (p_buf_status) + { + // Copy the received environment + memcpy(&p_buf_status->env[0], p_route_env, sizeof(mm_route_env_t)); + + // Insert the buffer in the list of received get messages + list_push_back(&p_env_bat->list_status, &p_buf_status->hdr); + } + } +} + +/* + * INTERNAL CALLBACK FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Callback function called when timer monitoring publication duration for + * Generic Battery Server model expires + * + * @param[in] p_env Pointer to model environment for Generic Battery Server model + **************************************************************************************** + */ +__STATIC void mm_gens_bat_cb_tmr_publi(void *p_tmr) +{ + // Get allocated environment + mm_gens_bat_env_t *p_env_bat = MESH_TMR2ENV(p_tmr, mm_gens_bat_env_t, tmr_publi); + + if (p_env_bat->publi_period_ms) + { + // Keep in mind that a publication must be sent + SETB(p_env_bat->env.info, MM_GENS_BAT_INFO_PUBLI, 1); + + // Retrieve current Generic Battery state from the application + mm_gens_bat_send_req_ind(p_env_bat); + + // Restart the timer + mesh_timer_set(&p_env_bat->tmr_publi, p_env_bat->publi_period_ms); + } +} + +/** + **************************************************************************************** + * @brief Inform Generic Battery Server model about a received message + * + * @param[in] p_env Pointer to the environment allocated for the Generic Battery + * Server model + * @param[in] p_buf Pointer to the buffer containing the received message + * @param[in] p_route_env Pointer to structure containing reception parameters provided + * by the Mesh Profile block + **************************************************************************************** + */ +__STATIC void mm_gens_bat_cb_rx(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + do + { + // Get environment for Generic Battery Server model + mm_gens_bat_env_t *p_env_bat = (mm_gens_bat_env_t *)p_env; + + // Prepare buffer for transmission of Generic Battery Status message + mm_gens_bat_prepare_status(p_env_bat, p_route_env); + + // Retrieve current Generic Battery state from the application + mm_gens_bat_send_req_ind(p_env_bat); + } while (0); +} + +/** + **************************************************************************************** + * @brief Check if a given opcode is handled by the Generic Battery Server model + * + * @param[in] p_env Pointer to the environment allocated for the Generic Battery + * Server model + * @param[in] opcode Opcode to check + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_gens_bat_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status; + + if (opcode == MM_MSG_GEN_BAT_GET) + { + status = MESH_ERR_NO_ERROR; + } + else + { + status = MESH_ERR_MDL_INVALID_OPCODE; + } + + return (status); +} + +/* + * GLOBAL FUNCTIONS + **************************************************************************************** + */ + +uint8_t mm_gens_bat_register(uint8_t elmt_idx) +{ + //uint8_t status = MESH_ERR_COMMAND_DISALLOWED; + // Register the model + m_lid_t mdl_lid = ms_register_model(MM_ID_GENS_BAT, elmt_idx, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) //if (status == MESH_ERR_NO_ERROR) + { + // Inform the Model State Manager about registered model + mm_gens_bat_env_t *p_env_bat = (mm_gens_bat_env_t *)mm_state_register(elmt_idx, MM_ID_GENS_BAT, mdl_lid, + MM_ROLE_SRV_PUBLI, sizeof(mm_gens_bat_env_t)); + + if (p_env_bat) + { + // Prepare timer for publications + p_env_bat->tmr_publi.cb = mm_gens_bat_cb_tmr_publi; + //p_env_bat->tmr_publi.p_env = (void *)p_env_bat; + + // Set internal callback functions + p_env_bat->env.mdl_cb.cb_rx = mm_gens_bat_cb_rx; + p_env_bat->env.mdl_cb.cb_opcode_check = mm_gens_bat_cb_opcode_check; + //p_env_bat->env.mdl_cb.cb_publish_param = mm_gens_bat_cb_publish_param; + + //status = MESH_ERR_NO_ERROR; + // Inform application about registered model + mm_register_ind_send(MM_ID_GENS_BAT, elmt_idx, mdl_lid); + } + } + + return (mdl_lid); +} + +void mm_gens_bat_cfm(uint8_t elmt_idx, uint8_t status, uint8_t bat_lvl, + uint32_t time_discharge, uint32_t time_charge, uint8_t flags) +{ + // Look for Generic Battery Server model in the list of models + m_lid_t mdl_lid = mm_state_get_lid(elmt_idx, MM_ID_GENS_BAT); + + if (mdl_lid != MESH_INVALID_LID) + { + mm_gens_bat_env_t *p_env_bat = (mm_gens_bat_env_t *)mm_state_get_env(mdl_lid); + + // Check if confirmation from application was expected + if (GETB(p_env_bat->env.info, MM_GENS_BAT_INFO_WAIT_APP)) + { + SETB(p_env_bat->env.info, MM_GENS_BAT_INFO_WAIT_APP, 0); + + if (status != MESH_ERR_NO_ERROR) + { + bat_lvl = MM_BAT_LVL_UNKNOWN; + time_discharge = MM_BAT_TIME_DISCHRG_UNKNOWN; + time_charge = MM_BAT_TIME_CHRG_UNKNOWN; + flags = MM_BAT_FLAGS_UNKNOWN; + } + else + { + // Check the provided values + if (bat_lvl > MM_BAT_LVL_MAX) + { + bat_lvl = MM_BAT_LVL_UNKNOWN; + } + + if (time_discharge > MM_BAT_TIME_DISCHRG_UNKNOWN) + { + time_discharge = MM_BAT_TIME_DISCHRG_UNKNOWN; + } + + if (time_charge > MM_BAT_TIME_CHRG_UNKNOWN) + { + time_charge = MM_BAT_TIME_CHRG_UNKNOWN; + } + } + + // Send responses for received get requests + while (!list_is_empty(&p_env_bat->list_status)) + { + mesh_buf_t *p_buf = (mesh_buf_t *)list_pop_front(&p_env_bat->list_status); + + mm_gens_bat_send_status(p_env_bat, p_buf, + bat_lvl, time_discharge, time_charge, flags); + } + + // Send a publication if needed + if (GETB(p_env_bat->env.info, MM_GENS_BAT_INFO_PUBLI)) + { + SETB(p_env_bat->env.info, MM_GENS_BAT_INFO_PUBLI, 0); + + mm_gens_bat_send_status(p_env_bat, NULL, + bat_lvl, time_discharge, time_charge, flags); + } + } + } +} + +/// @} end of group diff --git a/mesh/model/gen/gens/mm_gens_dtt.c b/mesh/model/gen/gens/mm_gens_dtt.c new file mode 100644 index 0000000..35aa9d6 --- /dev/null +++ b/mesh/model/gen/gens/mm_gens_dtt.c @@ -0,0 +1,315 @@ +/** + **************************************************************************************** + * @file mm_gens_dtt.c + * + * @brief Mesh Model Generic Default Transition Time Server Module + * + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @addtogroup MM_GENS_DTT + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mm_itf.h" +#include "mm_gens.h" + + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Structure for Generic Default Transition Time server model environment +typedef struct mm_gens_dtt_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; + /// Timer for sending of publications + mesh_timer_t tmr_publi; + /// Publication period + uint32_t publi_period_ms; + + /// Default Transition Time state value + uint8_t dft_trans_time; +} mm_gens_dtt_env_t; + +/* + * LOCAL FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Prepare and send a Generic Default Transition Time Status + * + * @param[in] p_env_dtt Pointer to Generic Default Transition Time Server model + * environment + **************************************************************************************** + */ +__STATIC void mm_gens_dtt_send_status(mm_gens_dtt_env_t *p_env_dtt, mm_route_env_t *p_route_env) +{ + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_status = mm_route_buf_alloc(MM_GEN_DTT_STATUS_LEN); + + if (p_buf_status) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_status); + // Get pointer to environment + mm_route_env_t *p_env = (mm_route_env_t *)&p_buf_status->env[0]; + + // Prepare environment + if (p_route_env) + { + memcpy(p_env, p_route_env, sizeof(mm_route_env_t)); + } + + p_env->opcode = MM_MSG_GEN_DTT_STATUS; + p_env->mdl_lid = p_env_dtt->env.mdl_lid; + SETB(p_env->info, MM_ROUTE_INFO_PUBLISH, (p_route_env == NULL)); + SETB(p_env->info, MM_ROUTE_INFO_RX, 0); + + // Fill the message + *(p_data + MM_GEN_DDT_STATUS_DDT_POS) = p_env_dtt->dft_trans_time; + + // Send the message + mm_route_send(p_buf_status); + } +} + +/* + * MESSAGE HANDLERS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Handler for Generic Default Transition Time Set/Set Unacknowledged message + * + * @param[in] p_env_dtt Pointer to environment for Generic Default Transition Time model + * @param[in] p_buf Pointer to received message content + * @param[in] p_route_env Pointer to structure containing reception parameters provided + * by the Mesh Profile block + **************************************************************************************** + */ +__STATIC void mm_gens_dtt_handler_set(mm_gens_dtt_env_t *p_env_dtt, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + // Set pointer to received message + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Get received default transition time + uint8_t dft_trans_time = *(p_data + MM_GEN_DDT_SET_DDT_POS); + + // Check received value + if (GETF(dft_trans_time, MM_TRANS_TIME_STEP_NB) <= MM_TRANS_TIME_STEPS_MAX) + { + // Check if state value has been changed + bool update = (dft_trans_time != p_env_dtt->dft_trans_time); + + if (update) + { + // Keep the provided value + p_env_dtt->dft_trans_time = dft_trans_time; + + // Inform the Binding Manager + mm_bind_set_dft_trans_time(p_env_dtt->env.elmt_idx, dft_trans_time); + + // Inform application about received value + mm_srv_state_upd_ind_send(MM_STATE_GEN_DTT, p_env_dtt->env.elmt_idx, + dft_trans_time, 0); + + } + + // Send the response + if (p_route_env->opcode == MM_MSG_GEN_DTT_SET) + { + mm_gens_dtt_send_status(p_env_dtt, p_route_env); + } + + // Send a publication if authorized + if (update + && GETB(p_env_dtt->env.info, MM_INFO_PUBLI)) + { + mm_gens_dtt_send_status(p_env_dtt, NULL); + } + } +} + +/* + * INTERNAL CALLBACK FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Callback function called when timer monitoring publication duration for + * Generic Default Transition Time Server model expires + * + * @param[in] p_env Pointer to model environment for Generic Default Transition Time Server + * model + **************************************************************************************** + */ +__STATIC void mm_gens_dtt_cb_tmr_publi(void *p_tmr) +{ + // Get allocated environment + mm_gens_dtt_env_t *p_env_dtt = MESH_TMR2ENV(p_tmr, mm_gens_dtt_env_t, tmr_publi); + + if (p_env_dtt->publi_period_ms) + { + // Publish a Generic Default Transition Time Status message + mm_gens_dtt_send_status(p_env_dtt, NULL); + + // Restart the timer + mesh_timer_set(&p_env_dtt->tmr_publi, p_env_dtt->publi_period_ms); + } +} + +/** + **************************************************************************************** + * @brief Inform Generic Default Transition Time Server model about a received message + * + * @param[in] p_env Pointer to the environment allocated for the Generic Default + * Transition Time Server model + * @param[in] p_buf Pointer to the buffer containing the received message + * @param[in] p_route_env Pointer to structure containing reception parameters provided + * by the Mesh Profile block + **************************************************************************************** + */ +__STATIC void mm_gens_dtt_cb_rx(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + // Get environment for Generic Default Transition Time Server model + mm_gens_dtt_env_t *p_env_dtt = (mm_gens_dtt_env_t *)p_env; + + if (p_route_env->opcode != MM_MSG_GEN_DTT_GET) + { + // Handle Generic Default Transition Time Set/Set Unacknowledged message + mm_gens_dtt_handler_set(p_env_dtt, p_buf, p_route_env); + } + else + { + // Send a Generic Default Transition Time Status message + mm_gens_dtt_send_status(p_env_dtt, p_route_env); + } +} + +/** + **************************************************************************************** + * @brief Check if a given opcode is handled by the Generic Default Transition Time Server model + * + * @param[in] p_env Pointer to the environment allocated for the Generic Default Transition + * Time Server model + * @param[in] opcode Opcode to check + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_gens_dtt_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status; + + if ((opcode == MM_MSG_GEN_DTT_GET) + || (opcode == MM_MSG_GEN_DTT_SET) + || (opcode == MM_MSG_GEN_DTT_SET_UNACK)) + { + status = MESH_ERR_NO_ERROR; + } + else + { + status = MESH_ERR_MDL_INVALID_OPCODE; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Set Generic Default Transition Time state value + * + * @param[in] p_env Pointer the the environment allocated for the Generic OnOff + * Server model + * @param[in] dtt Generic Default Transition Time state value + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_gens_dtt_cb_set(mm_mdl_env_t *p_env, uint16_t state_id, uint32_t state) +{ + // Returned status + uint8_t status = MESH_ERR_NO_ERROR; + // Generic Default Transition Time state value + uint8_t dft_trans_time = (uint8_t)state; + + // Check provided value + if (GETF(dft_trans_time, MM_TRANS_TIME_STEP_NB) <= MM_TRANS_TIME_STEPS_MAX) + { + // Get environment for the Generic Default Transition Time Server model + mm_gens_dtt_env_t *p_env_dtt = (mm_gens_dtt_env_t *)p_env; + + // Keep the provided value + p_env_dtt->dft_trans_time = dft_trans_time; + + // Inform the Binding Manager + mm_bind_set_dft_trans_time(p_env_dtt->env.elmt_idx, dft_trans_time); + } + else + { + status = MESH_ERR_INVALID_PARAM; + } + + return (status); +} + +/* + * GLOBAL FUNCTIONS + **************************************************************************************** + */ + +uint8_t mm_gens_dtt_register(uint8_t elmt_idx) +{ + //uint8_t status = MESH_ERR_COMMAND_DISALLOWED; + // Register the model + m_lid_t mdl_lid = ms_register_model(MM_ID_GENS_DTT, elmt_idx, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) //if (status == MESH_ERR_NO_ERROR) + { + // Inform the Model State Manager about registered model + mm_gens_dtt_env_t *p_env_dtt = (mm_gens_dtt_env_t *)mm_state_register(elmt_idx, MM_ID_GENS_DTT, mdl_lid, + MM_ROLE_SRV_PUBLI, + sizeof(mm_gens_dtt_env_t)); + + if (p_env_dtt) + { + // Get server-specific callback functions + //mm_srv_cb_t *p_cb_srv = p_env_dtt->env.cb.u.p_cb_srv; + + // Prepare timer for publications + p_env_dtt->tmr_publi.cb = mm_gens_dtt_cb_tmr_publi; + //p_env_dtt->tmr_publi.p_env = (void *)p_env_dtt; + + // Set internal callback functions + p_env_dtt->env.mdl_cb.cb_rx = mm_gens_dtt_cb_rx; + p_env_dtt->env.mdl_cb.cb_opcode_check = mm_gens_dtt_cb_opcode_check; + //p_env_dtt->env.mdl_cb.cb_publish_param = mm_gens_dtt_cb_publish_param; + //p_cb_srv->cb_set = mm_gens_dtt_cb_set; + p_env_dtt->env.mdl_cb.cb_srv_set = mm_gens_dtt_cb_set; + + //status = MESH_ERR_NO_ERROR; + // Inform application about registered model + mm_register_ind_send(MM_ID_GENS_DTT, elmt_idx, mdl_lid); + } + } + + return (mdl_lid); +} + +/// @} end of group diff --git a/mesh/model/gen/gens/mm_gens_loc.c b/mesh/model/gen/gens/mm_gens_loc.c new file mode 100644 index 0000000..84745f8 --- /dev/null +++ b/mesh/model/gen/gens/mm_gens_loc.c @@ -0,0 +1,633 @@ +/** + **************************************************************************************** + * @file mm_gens_loc.c + * + * @brief Mesh Model Generic Location Server Module + * + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @addtogroup MM_GENS_LOC + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mm_itf.h" +#include "mm_gens.h" + + +/* + * ENUMERATIONS + **************************************************************************************** + */ + +/// Information bit field - base on Bit[7:4] of mm_info +/// 8 7 6 5 4 +/// +--------------+---------------+-----------+------------+ +/// | Wait App Loc | Wait App Glob | Publi Loc | Publi Glob | +/// +--------------+---------------+-----------+------------+ +enum mm_gens_loc_info +{ + /// Publication for Generic Location state (global part) to be sent after + /// confirmation received from application + MM_GENS_LOC_INFO_PUBLI_GLOB_POS = 4, + MM_GENS_LOC_INFO_PUBLI_GLOB_BIT = (1 << MM_GENS_LOC_INFO_PUBLI_GLOB_POS), + + /// Publication for Generic Location state (local part) to be sent after + /// confirmation received from application + MM_GENS_LOC_INFO_PUBLI_LOC_POS = 5, + MM_GENS_LOC_INFO_PUBLI_LOC_BIT = (1 << MM_GENS_LOC_INFO_PUBLI_LOC_POS), + + /// Wait for confirmation from application for Generic Location Global Get message + MM_GENS_LOC_INFO_WAIT_APP_GLOB_POS = 6, + MM_GENS_LOC_INFO_WAIT_APP_GLOB_BIT = (1 << MM_GENS_LOC_INFO_WAIT_APP_GLOB_POS), + + /// Wait for confirmation from application for Generic Location Local Get message + MM_GENS_LOC_INFO_WAIT_APP_LOC_POS = 7, + MM_GENS_LOC_INFO_WAIT_APP_LOC_BIT = (1 << MM_GENS_LOC_INFO_WAIT_APP_LOC_POS), +}; + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Structure for Generic Location Server model environment +typedef struct mm_gens_loc_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; + /// Timer for sending of publications + mesh_timer_t tmr_publi; + /// Publication period + uint32_t publi_period_ms; + + /// List of prepared Generic Location Global Status messages + list_t list_status_glob; + /// List of prepared Generic Location Local Status messages + list_t list_status_loc; + + /// Information (@see enum mm_gens_loc_info) - combine to env.info + //uint8_t info; +} mm_gens_loc_env_t; + +/// Structure for Generic Location Setup Server model environment +typedef struct mm_gens_locs_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; + /// Pointer to environment of associated Generic Location Server model + mm_gens_loc_env_t *p_env_loc; +} mm_gens_locs_env_t; + +/* + * LOCAL FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief TODO [LT] + **************************************************************************************** + */ +__STATIC mesh_buf_t *mm_gens_loc_find_buf(list_t *p_list, uint16_t src, bool extract) +{ + // Get first buffer + mesh_buf_t *p_buf = (mesh_buf_t *)list_pick(p_list); + + while (p_buf) + { + // Read environment + mm_route_env_t *p_env = (mm_route_env_t *)&p_buf->env[0]; + + if (p_env->u_addr.src == src) + { + // Extract the buffer if required + if (extract) + { + list_extract(p_list, &(p_buf->hdr)); + } + + break; + } + + // Get next buffer + p_buf = (mesh_buf_t *)p_buf->hdr.next; + } + + return (p_buf); +} + +/** + **************************************************************************************** + * @brief Prepare and send a Generic Location Global Status message + * + * @param[in] p_env_loc Pointer to Generic Location Server model environment + **************************************************************************************** + */ +__STATIC void mm_gens_loc_send_status_global(mm_gens_loc_env_t *p_env_loc, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env, + int32_t latitude, int32_t longitude, int16_t altitude) +{ + // Status + //uint8_t status; + + if (!p_buf) + { + p_buf = mm_route_buf_alloc(MM_GEN_LOC_STATUS_GLOB_LEN); + } + + if (p_buf) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Get pointer to environment + mm_route_env_t *p_env = (mm_route_env_t *)&p_buf->env[0]; + + if (p_route_env) + { + memcpy(p_env, p_route_env, sizeof(mm_route_env_t)); + } + + p_env->opcode = MM_MSG_GEN_LOCG_STATUS; + p_env->mdl_lid = p_env_loc->env.mdl_lid; + SETB(p_env->info, MM_ROUTE_INFO_PUBLISH, (p_buf == NULL) && (p_route_env == NULL)); + SETB(p_env->info, MM_ROUTE_INFO_RX, 0); + + // Fill the message + write32p(p_data + MM_GEN_LOC_STATUS_GLOB_LAT_POS, latitude); + write32p(p_data + MM_GEN_LOC_STATUS_GLOB_LONG_POS, longitude); + write16p(p_data + MM_GEN_LOC_STATUS_GLOB_ALT_POS, altitude); + + // Send the message + mm_route_send(p_buf); + } +} + +/** + **************************************************************************************** + * @brief Prepare and send a Generic Location Local Status message + * + * @param[in] p_env_loc Pointer to Generic Location Server model environment + **************************************************************************************** + */ +__STATIC void mm_gens_loc_send_status_local(mm_gens_loc_env_t *p_env_loc, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env, + int16_t north, int16_t east, int16_t altitude, uint8_t floor, + uint16_t uncertainty) +{ + // Status + //uint8_t status; + + if (!p_buf) + { + p_buf = mm_route_buf_alloc(MM_GEN_LOC_STATUS_LOC_LEN); + } + + if (p_buf) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Get pointer to environment + mm_route_env_t *p_env = (mm_route_env_t *)&p_buf->env[0]; + + if (p_route_env) + { + memcpy(p_env, p_route_env, sizeof(mm_route_env_t)); + } + + p_env->opcode = MM_MSG_GEN_LOCL_STATUS; + p_env->mdl_lid = p_env_loc->env.mdl_lid; + SETB(p_env->info, MM_ROUTE_INFO_PUBLISH, (p_buf == NULL) && (p_route_env == NULL)); + SETB(p_env->info, MM_ROUTE_INFO_RX, 0); + + // Fill the message + write16p(p_data + MM_GEN_LOC_STATUS_LOC_NORTH_POS, north); + write16p(p_data + MM_GEN_LOC_STATUS_LOC_EAST_POS, east); + write16p(p_data + MM_GEN_LOC_STATUS_LOC_ALT_POS, altitude); + *(p_data + MM_GEN_LOC_STATUS_LOC_FLOOR_POS) = floor; + write16p(p_data + MM_GEN_LOC_STATUS_LOC_UNCERT_POS, uncertainty); + + // Send the message + mm_route_send(p_buf); + } +} + +/** + **************************************************************************************** + * @brief Inform application that current Generic Location State is required (global part) + * + * @param[in] p_env_loc Pointer to Generic Location Server model environment + **************************************************************************************** + */ +__STATIC void mm_gens_loc_send_global_req_ind(mm_gens_loc_env_t *p_env_loc) +{ + // Check that a confirmation is not already expected from application + if (!GETB(p_env_loc->env.info, MM_GENS_LOC_INFO_WAIT_APP_GLOB)) + { + SETB(p_env_loc->env.info, MM_GENS_LOC_INFO_WAIT_APP_GLOB, 1); + mm_srv_state_req_ind_send(MM_SRV_LOCG_REQ_IND, p_env_loc->env.elmt_idx); + } +} + +/** + **************************************************************************************** + * @brief Inform application that current Generic Location State is required (local part) + * + * @param[in] p_env_loc Pointer to Generic Location Server model environment + **************************************************************************************** + */ +__STATIC void mm_gens_loc_send_local_req_ind(mm_gens_loc_env_t *p_env_loc) +{ + // Check that a confirmation is not already expected from application + if (!GETB(p_env_loc->env.info, MM_GENS_LOC_INFO_WAIT_APP_LOC)) + { + SETB(p_env_loc->env.info, MM_GENS_LOC_INFO_WAIT_APP_LOC, 1); + mm_srv_state_req_ind_send(MM_SRV_LOCL_REQ_IND, p_env_loc->env.elmt_idx); + } +} + +/** + **************************************************************************************** + * @brief Handler for Generic Location Global Set/Set Unacknowledged message + * + * @param[in] p_env_loc Pointer to Generic Location Server model environment + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] opcode Received operation code + **************************************************************************************** + */ +__STATIC void mm_gens_loc_handler_set_global(mm_gens_loc_env_t *p_env_loc, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Global Latitude + int32_t latitude = (int32_t)read32p(p_data + MM_GEN_LOC_SET_GLOB_LAT_POS); + // Global Longitude + int32_t longitude = (int32_t)read32p(p_data + MM_GEN_LOC_SET_GLOB_LONG_POS); + // Global Altitude + int16_t altitude = (int16_t)read16p(p_data + MM_GEN_LOC_SET_GLOB_ALT_POS); + + // Inform application about new state value + mm_srv_locg_upd_ind_send(p_env_loc->env.elmt_idx, latitude, longitude, altitude); + + if (p_route_env->opcode == MM_MSG_GEN_LOCG_SET) + { + // Send a Generic Location Global Status message + mm_gens_loc_send_status_global(p_env_loc, NULL, p_route_env, latitude, longitude, altitude); + } +} + +/** + **************************************************************************************** + * @brief Handler for Generic Location Local Set/Set Unacknowledged message + * + * @param[in] p_env_loc Pointer to Generic Location Server model environment + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] opcode Received operation code + **************************************************************************************** + */ +__STATIC void mm_gens_loc_handler_set_local(mm_gens_loc_env_t *p_env_loc, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Local North + int16_t north = (int16_t)read16p(p_data + MM_GEN_LOC_SET_LOC_NORTH_POS); + // Local East + int16_t east = (int16_t)read16p(p_data + MM_GEN_LOC_SET_LOC_EAST_POS); + // Global Altitude + int16_t altitude = (int16_t)read16p(p_data + MM_GEN_LOC_SET_LOC_ALT_POS); + // Floor + uint8_t floor = *(p_data + MM_GEN_LOC_SET_LOC_FLOOR_POS); + // Uncertainty + uint16_t uncertainty = read16p(p_data + MM_GEN_LOC_SET_LOC_UNCERT_POS); + + // Inform application about new state value + mm_srv_locl_upd_ind_send(p_env_loc->env.elmt_idx, north, east, altitude, + floor, uncertainty); + + if (p_route_env->opcode == MM_MSG_GEN_LOCL_SET) + { + // Send a Generic Location Local Status message + mm_gens_loc_send_status_local(p_env_loc, NULL, p_route_env, north, east, altitude, + floor, uncertainty); + } +} + +/** + **************************************************************************************** + * @brief Prepare a buffer for transmission of Generic Location Global Status or Generic + * Location Local Status message after reception of a get message + * + * @param[in] p_env_loc Pointer to Generic Location Server model environment + * @param[in] p_route_env Information about received Generic Location Global/Local Get message + * @param[in] global True if Generic Location Global Get message has been received, else False + **************************************************************************************** + */ +__STATIC void mm_gens_loc_prepare_status(mm_gens_loc_env_t *p_env_loc, + mm_route_env_t *p_route_env, bool global) +{ + // Pointer to the list of received get messages to parse + list_t *p_list = (global) ? &p_env_loc->list_status_glob : &p_env_loc->list_status_loc; + + // Check that a Generic Location Global/Local Get message from the same source address has not already + // been received + if (!mm_gens_loc_find_buf(p_list, p_route_env->u_addr.src, false)) + { + // Buffer that will contain the Generic Location Global/Local Status message + mesh_buf_t *p_buf_status = mm_route_buf_alloc((global) ? MM_GEN_LOC_STATUS_GLOB_LEN + : MM_GEN_LOC_STATUS_LOC_LEN); + + if (p_buf_status) + { + // Copy the received environment + memcpy(&p_buf_status->env[0], p_route_env, sizeof(mm_route_env_t)); + + // Insert the buffer in the list of received get messages + list_push_back(p_list, &p_buf_status->hdr); + + // Retrieve the Generic Location state from the application + if (global) + { + mm_gens_loc_send_global_req_ind(p_env_loc); + } + else + { + mm_gens_loc_send_local_req_ind(p_env_loc); + } + } + } +} + +/* + * INTERNAL CALLBACK FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Callback function called when timer monitoring publication duration for + * Generic Location Server model expires + * + * @param[in] p_env Pointer to model environment for Generic Location Server model + **************************************************************************************** + */ +__STATIC void mm_gens_loc_cb_tmr_publi(void *p_tmr) +{ + // Get allocated environment + mm_gens_loc_env_t *p_env_loc = MESH_TMR2ENV(p_tmr, mm_gens_loc_env_t, tmr_publi); + + if (p_env_loc->publi_period_ms) + { + // Keep in mind that a publication must be sent + SETB(p_env_loc->env.info, MM_GENS_LOC_INFO_PUBLI_LOC, 1); + SETB(p_env_loc->env.info, MM_GENS_LOC_INFO_PUBLI_GLOB, 1); + + // Retrieve current Generic Location state (Global part) from the application + mm_gens_loc_send_global_req_ind(p_env_loc); + // Retrieve current Generic Location state (Location part) from the application + mm_gens_loc_send_local_req_ind(p_env_loc); + + // Restart the timer + mesh_timer_set(&p_env_loc->tmr_publi, p_env_loc->publi_period_ms); + } +} + +/** + **************************************************************************************** + * @brief Inform Generic Location Server model about a received message + * + * @param[in] p_env Pointer to the environment allocated for the Generic Location + * Server model + * @param[in] p_buf Pointer to the buffer containing the received message + * @param[in] p_route_env Pointer to structure containing reception parameters provided + * by the Mesh Profile block + **************************************************************************************** + */ +__STATIC void mm_gens_loc_cb_rx(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, mm_route_env_t *p_route_env) +{ + // Environment for Generic Location Server model + mm_gens_loc_env_t *p_env_loc; + + if ((p_route_env->opcode == MM_MSG_GEN_LOCG_GET) + || (p_route_env->opcode == MM_MSG_GEN_LOCL_GET)) + { + p_env_loc = (mm_gens_loc_env_t *)p_env; + + // Prepare environment for transition of status message + mm_gens_loc_prepare_status(p_env_loc, p_route_env, + (p_route_env->opcode == MM_MSG_GEN_LOCG_GET)); + } + else + { + // Environment for Generic Location Setup Server model + mm_gens_locs_env_t *p_env_locs = (mm_gens_locs_env_t *)p_env; + + p_env_loc = p_env_locs->p_env_loc; + + if ((p_route_env->opcode == MM_MSG_GEN_LOCG_SET) + || (p_route_env->opcode == MM_MSG_GEN_LOCG_SET_UNACK)) + { + // Handle the received message + mm_gens_loc_handler_set_global(p_env_loc, p_buf, p_route_env); + } + else + { + // Handle the receive message + mm_gens_loc_handler_set_local(p_env_loc, p_buf, p_route_env); + } + } +} + +/** + **************************************************************************************** + * @brief Check if a given opcode is handled by the Generic Location Server model + * + * @param[in] p_env Pointer to the environment allocated for the Generic Location + * Server model + * @param[in] opcode Opcode to check + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_gens_loc_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status = MESH_ERR_MDL_INVALID_OPCODE; + + if (p_env->model_id == MM_ID_GENS_LOC) + { + if ((opcode == MM_MSG_GEN_LOCG_GET) + || (opcode == MM_MSG_GEN_LOCL_GET)) + { + status = MESH_ERR_NO_ERROR; + } + } + else if (p_env->model_id == MM_ID_GENS_LOCS) + { + if ((opcode == MM_MSG_GEN_LOCG_SET) + || (opcode == MM_MSG_GEN_LOCG_SET_UNACK) + || (opcode == MM_MSG_GEN_LOCL_SET) + || (opcode == MM_MSG_GEN_LOCL_SET_UNACK)) + { + status = MESH_ERR_NO_ERROR; + } + } + + return (status); +} + +/* + * GLOBAL FUNCTIONS + **************************************************************************************** + */ + +uint8_t mm_gens_loc_register(uint8_t elmt_idx) +{ + // Register Generic Location Server model + m_lid_t mdl_lid = ms_register_model(MM_ID_GENS_LOC, elmt_idx, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) + { + // Inform the Model State Manager about registered model + mm_gens_loc_env_t *p_env_loc = (mm_gens_loc_env_t *)mm_state_register(elmt_idx, MM_ID_GENS_LOC, mdl_lid, + MM_ROLE_SRV_PUBLI, sizeof(mm_gens_loc_env_t)); + + if (p_env_loc) + { + // Set internal callback functions + p_env_loc->tmr_publi.cb = mm_gens_loc_cb_tmr_publi; + //p_env_loc->tmr_publi.p_env = (void *)p_env_loc; + + // Set internal callback functions + p_env_loc->env.mdl_cb.cb_rx = mm_gens_loc_cb_rx; + p_env_loc->env.mdl_cb.cb_opcode_check = mm_gens_loc_cb_opcode_check; + //p_env_loc->env.mdl_cb.cb_publish_param = mm_gens_loc_cb_publish_param; + + // Inform application about registered model + mm_register_ind_send(MM_ID_GENS_LOC, elmt_idx, mdl_lid); + } + + // Register Generic Location Setup Server model + m_lid_t locs_lid = ms_register_model(MM_ID_GENS_LOCS, elmt_idx, 0); + + if (locs_lid != MESH_INVALID_LID) + { + // Inform the Model State Manager about registered model + mm_gens_locs_env_t *p_env_locs = (mm_gens_locs_env_t *)mm_state_register(elmt_idx, MM_ID_GENS_LOCS, locs_lid, + MM_ROLE_SRV, sizeof(mm_gens_locs_env_t)); + + if (p_env_locs) + { + // Set internal callback functions + p_env_locs->env.mdl_cb.cb_rx = mm_gens_loc_cb_rx; + p_env_locs->env.mdl_cb.cb_opcode_check = mm_gens_loc_cb_opcode_check; + + // Link environment + p_env_locs->p_env_loc = p_env_loc; + + // Inform application about registered model + mm_register_ind_send(MM_ID_GENS_LOCS, elmt_idx, locs_lid); + } + } + } + + return (mdl_lid); +} + +void mm_gens_locg_cfm(uint8_t elmt_idx, uint8_t status, int32_t latitude, + int32_t longitude, int16_t altitude) +{ + // Look for Generic Location Server model in the list of models + m_lid_t mdl_lid = mm_state_get_lid(elmt_idx, MM_ID_GENS_LOC); + + if (mdl_lid != MESH_INVALID_LID) + { + mm_gens_loc_env_t *p_env_loc = (mm_gens_loc_env_t *)mm_state_get_env(mdl_lid); + + // Check if confirmation from application was expected + if (GETB(p_env_loc->env.info, MM_GENS_LOC_INFO_WAIT_APP_GLOB)) + { + SETB(p_env_loc->env.info, MM_GENS_LOC_INFO_WAIT_APP_GLOB, 0); + + if (status != MESH_ERR_NO_ERROR) + { + latitude = MM_LOC_GLOBAL_LAT_NOT_CONFIG; + longitude = MM_LOC_GLOBAL_LONG_NOT_CONFIG; + altitude = MM_LOC_GLOBAL_ALT_NOT_CONFIG; + } + + // Send responses for received get requests + while (!list_is_empty(&p_env_loc->list_status_glob)) + { + mesh_buf_t *p_buf = (mesh_buf_t *)list_pop_front(&p_env_loc->list_status_glob); + + mm_gens_loc_send_status_global(p_env_loc, p_buf, NULL, + latitude, longitude, altitude); + } + + // Send a publication if needed + if (GETB(p_env_loc->env.info, MM_GENS_LOC_INFO_PUBLI_GLOB)) + { + SETB(p_env_loc->env.info, MM_GENS_LOC_INFO_PUBLI_GLOB, 0); + + mm_gens_loc_send_status_global(p_env_loc, NULL, NULL, + latitude, longitude, altitude); + } + } + } +} + +void mm_gens_locl_cfm(uint8_t elmt_idx, uint8_t status, int16_t north, + int16_t east, int16_t altitude, uint8_t floor, uint16_t uncertainty) +{ + // Look for Generic Location Server model in the list of models + m_lid_t mdl_lid = mm_state_get_lid(elmt_idx, MM_ID_GENS_LOC); + + if (mdl_lid != MESH_INVALID_LID) + { + mm_gens_loc_env_t *p_env_loc = (mm_gens_loc_env_t *)mm_state_get_env(mdl_lid); + + // Check if confirmation from application was expected + if (GETB(p_env_loc->env.info, MM_GENS_LOC_INFO_WAIT_APP_LOC)) + { + SETB(p_env_loc->env.info, MM_GENS_LOC_INFO_WAIT_APP_LOC, 0); + + if (status != MESH_ERR_NO_ERROR) + { + north = MM_LOC_LOCAL_NORTH_NOT_CONFIG; + east = MM_LOC_LOCAL_EAST_NOT_CONFIG; + altitude = MM_LOC_LOCAL_ALT_NOT_CONFIG; + floor = MM_LOC_FLOOR_NOT_CONFIG; + uncertainty = 0; + } + + // Send responses for received get requests + while (!list_is_empty(&p_env_loc->list_status_loc)) + { + mesh_buf_t *p_buf = (mesh_buf_t *)list_pop_front(&p_env_loc->list_status_loc); + + mm_gens_loc_send_status_local(p_env_loc, p_buf, NULL, + north, east, altitude, floor, uncertainty); + } + + // Send a publication if needed + if (GETB(p_env_loc->env.info, MM_GENS_LOC_INFO_PUBLI_LOC)) + { + SETB(p_env_loc->env.info, MM_GENS_LOC_INFO_PUBLI_LOC, 0); + + mm_gens_loc_send_status_local(p_env_loc, NULL, NULL, + north, east, altitude, floor, uncertainty); + } + } + } +} + +/// @} end of group diff --git a/mesh/model/gen/gens/mm_gens_lvl.c b/mesh/model/gen/gens/mm_gens_lvl.c new file mode 100644 index 0000000..c7d8220 --- /dev/null +++ b/mesh/model/gen/gens/mm_gens_lvl.c @@ -0,0 +1,961 @@ +/** + **************************************************************************************** + * @file mm_gens_lvl.c + * + * @brief Mesh Model Generic Level Server Module + * + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @addtogroup MM_GENS_LVL + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mm_itf.h" +#include "mm_gens.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Upper limit of Generic Level State when no model is bound (signed 16-bit integer) +#define MM_GENS_LVL_UPPER_LIMIT (32767) +/// Lower limit of Generic Level State when no model is bound (signed 16-bit integer) +#define MM_GENS_LVL_LOWER_LIMIT (-32768) +/// Validity of information provided to the Replay Manager +#define MM_GENS_LVL_REPLAY_MS (6000) + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Information for handling of move transition +typedef struct mm_gens_lvl_move_param +{ + /// Received delta value + int16_t delta; + /// Received transition time + uint8_t trans_time; +} mm_gens_lvl_move_param_t; + +/// Information for handling of delta transitions +typedef struct mm_gens_lvl_delta_param +{ + /// Source address + uint16_t src; + /// TID + uint8_t tid; +} mm_gens_lvl_delta_param_t; + +/// Structure for Generic Level server model environment +typedef struct mm_gens_lvl_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; + /// Timer for sending of publications + mesh_timer_t tmr_publi; + /// Publication period in milliseconds + uint32_t publi_period_ms; + + /// Environment for replay protection mechanism + mm_replay_env_t replay_env; + + /// Parameters for a move transition + mm_gens_lvl_move_param_t move_param; + /// Parameters for a delta transition + mm_gens_lvl_delta_param_t delta_param; + union + { + /// Initial level in case of a delta transition + int16_t init_level; + /// Target level in case of move transition + int16_t tgt_move_level; + } u; + /// Current level + int16_t level; + /// Target Level + int16_t tgt_level; + + /// Source address of set message that has triggered last or current transition + uint8_t status_dst_addr; + /// Application key local index to be used for transmission of Generic Level Status message + m_lid_t status_app_key_lid; + /// Relaying of sent Generic Level Status authorized + bool status_relay; +} mm_gens_lvl_env_t; + +/* + * LOCAL FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Compute target level when delta value is applied for a delta transition + * + * @param[in] p_env_lvl Pointer to Generic Level Server model environment + * @param[in] delta Delta value + * + * @return Computed target level + **************************************************************************************** + */ +__STATIC int16_t mm_gens_lvl_compute_tgt_delta(mm_gens_lvl_env_t *p_env_lvl, int32_t delta) +{ + // Target level + int32_t tgt_level = p_env_lvl->u.init_level; + + tgt_level += delta; + + if (tgt_level > MM_GENS_LVL_UPPER_LIMIT) + { + tgt_level = MM_GENS_LVL_UPPER_LIMIT; + } + else if (tgt_level < MM_GENS_LVL_LOWER_LIMIT) + { + tgt_level = MM_GENS_LVL_LOWER_LIMIT; + } + + return ((int16_t)tgt_level); +} + +/** + **************************************************************************************** + * @brief Compute target level when delta value is applied for a move transition + * + * @param[in] p_env_lvl Pointer to Generic Level Server model environment + * @param[in] delta Delta value + * + * @return Computed target level + **************************************************************************************** + */ +__STATIC int16_t mm_gens_lvl_compute_tgt_move(mm_gens_lvl_env_t *p_env_lvl) +{ + // Target level + int32_t tgt_level = p_env_lvl->level; + + tgt_level += p_env_lvl->move_param.delta; + + if (tgt_level > MM_GENS_LVL_UPPER_LIMIT) + { + tgt_level = MM_GENS_LVL_UPPER_LIMIT; + } + else if (tgt_level < MM_GENS_LVL_LOWER_LIMIT) + { + tgt_level = MM_GENS_LVL_LOWER_LIMIT; + } + + return ((int16_t)tgt_level); +} + +/** + **************************************************************************************** + * @brief Prepare and send a Generic Level Status message + * + * @param[in] p_env_lvl Pointer to Generic Level Server model environment + * @param[in] p_route_env Pointer to structure containing reception information provided + * by Mesh Profile for received request message + * @param[in] publish Indicate if message is sent as a publication (true) or as + * a response to a received request (false) + **************************************************************************************** + */ +__STATIC void mm_gens_lvl_send_status(mm_gens_lvl_env_t *p_env_lvl, mm_route_env_t *p_route_env, + bool publish) +{ + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_status; + // Remaining time + uint8_t rem_time; + // Transition type + uint8_t trans_type; + // Data length + uint8_t data_length; + + // Check if a transition has been started + mm_bind_get_trans_info(p_env_lvl->env.grp_lid, &trans_type, &rem_time); + + // Deduce deduce data length + data_length = (trans_type != MM_TRANS_TYPE_NONE) + ? MM_GEN_LVL_STATUS_LEN : MM_GEN_LVL_STATUS_MIN_LEN; + + p_buf_status = mm_route_buf_alloc(data_length); + if (p_buf_status) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_status); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_status->env; + + // Prepare environment + if (p_route_env) + { + memcpy(p_buf_env, p_route_env, sizeof(mm_route_env_t)); + } + else if (!publish) + { + p_buf_env->app_key_lid = p_env_lvl->status_app_key_lid; + p_buf_env->u_addr.dst = p_env_lvl->status_dst_addr; + SETB(p_buf_env->info, MM_ROUTE_INFO_RELAY, p_env_lvl->status_relay); + } + + SETB(p_buf_env->info, MM_ROUTE_INFO_RX, 0); + SETB(p_buf_env->info, MM_ROUTE_INFO_PUBLISH, publish); + p_buf_env->mdl_lid = p_env_lvl->env.mdl_lid; + p_buf_env->opcode = MM_MSG_GEN_LVL_STATUS; + + // Fill the message + write16p(p_data + MM_GEN_LVL_STATUS_LVL_POS, p_env_lvl->level); + + if (data_length == MM_GEN_LVL_STATUS_LEN) + { + // Targeted level + int16_t tgt_level; + + if (trans_type == MM_TRANS_TYPE_MOVE) + { + rem_time = MM_TRANS_TIME_UNKNOWN; + tgt_level = p_env_lvl->u.tgt_move_level; + } + else + { + tgt_level = p_env_lvl->tgt_level; + } + + write16p(p_data + MM_GEN_LVL_STATUS_TGT_LVL_POS, tgt_level); + *(p_data + MM_GEN_LVL_STATUS_REM_TIME_POS) = rem_time; + } + + // Send the message + mm_route_send(p_buf_status); + } +} + +/** + **************************************************************************************** + * @brief Publish Generic Level state value if sending of publications is enabled + * + * @param[in] p_env_lvl Pointer to Generic Level Server model environment + **************************************************************************************** + */ +__STATIC void mm_gens_lvl_publish(mm_gens_lvl_env_t *p_env_lvl) +{ + // Check if sending of publication is enabled + if (GETB(p_env_lvl->env.info, MM_INFO_PUBLI)) + { + mm_gens_lvl_send_status(p_env_lvl, NULL, true); + } +} + +/** + **************************************************************************************** + * @brief Check if a Generic Level Status message must be sent and send it if it + * is the case + * + * @param[in] p_env_lvl Pointer to Generic Level Server model environment + **************************************************************************************** + */ +__STATIC void mm_gens_lvl_check_status_rsp(mm_gens_lvl_env_t *p_env_lvl) +{ + if (p_env_lvl->status_dst_addr) + { + // Send a response to the node that has required the transition + mm_gens_lvl_send_status(p_env_lvl, NULL, false); + + p_env_lvl->status_dst_addr = MESH_UNASSIGNED_ADDR; + } +} + +/** + **************************************************************************************** + * @brief Check if a transaction initiated by a peer node is a new transaction or continuation + * of an already started one + * + * @param[in] p_env_lvl Pointer to Generic Level Server model environment + * @param[in] src Source address of received Generic Delta Set/Set Unacknowledged + * message + * @param[in] tid Received transaction identifier + **************************************************************************************** + */ +__STATIC bool mm_gens_lvl_is_new_transaction(mm_gens_lvl_env_t *p_env_lvl, uint16_t src, uint8_t tid) +{ + // New transaction or not + bool new_transaction = true; + + // Check if the SRC/TID couple has already been received in the last 6 seconds + if (mm_replay_is_retx(&p_env_lvl->replay_env, src, tid)) + { + if ((src == p_env_lvl->delta_param.src) + && (tid == p_env_lvl->delta_param.tid)) + { + new_transaction = false; + } + } + + return (new_transaction); +} + +/* + * MESSAGE HANDLERS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Handler for Generic Level Set/Set Unacknowledged message + * + * @param[in] p_env Pointer to environment of model for which message has been received + * @param[in] p_buf Pointer to the buffer containing the received message + * @param[in] p_route_env Pointer to structure containing reception parameters provided + * by the Mesh Profile block + **************************************************************************************** + */ +__STATIC bool mm_gens_lvl_handler_set(mm_gens_lvl_env_t *p_env_lvl, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + // Boolean indicating if Generic Level Status can be sent now + bool send_status = (p_route_env->opcode == MM_MSG_GEN_LVL_SET); + + do + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Extract required Generic Level state value + int16_t level = read16p(p_data + MM_GEN_LVL_SET_LVL_POS); + // Extract TID value + uint8_t tid = *(p_data + MM_GEN_LVL_SET_TID_POS); + // Transition time + uint8_t trans_time = MM_TRANS_TIME_UNKNOWN; + // Delay + uint8_t delay = 0; + + // Extract optional parameters if present + if (p_buf->data_len == MM_GEN_LVL_SET_LEN) + { + trans_time = (uint16_t)(*(p_data + MM_GEN_LVL_SET_TRANS_TIME_POS)); + + // Check received value + if (GETF(trans_time, MM_TRANS_TIME_STEP_NB) > MM_TRANS_TIME_STEPS_MAX) + { + // Drop the message + send_status = false; + break; + } + + delay = *(p_data + MM_GEN_LVL_SET_DELAY_POS); + } + + // Check if received message is a retransmitted one, if state is modified and if + // a new transition can be started now + if ((p_env_lvl->status_dst_addr != MESH_UNASSIGNED_ADDR) + || mm_replay_is_retx(&p_env_lvl->replay_env, p_route_env->u_addr.src, tid) + || (level == p_env_lvl->level)) + { + if (send_status) + { + // Send Generic Level status message + mm_gens_lvl_send_status(p_env_lvl, p_route_env, false); + } + break; + } + + // Keep information for transmission of status if needed + if (send_status) + { + // Keep transaction information + p_env_lvl->status_dst_addr = p_route_env->u_addr.src; + p_env_lvl->status_app_key_lid = p_route_env->app_key_lid; + p_env_lvl->status_relay = GETB(p_route_env->info, MM_ROUTE_INFO_RELAY); + + // Delay status transmission + send_status = false; + } + + if (GETB(p_env_lvl->env.info, MM_INFO_MAIN)) + { + // Update target state + p_env_lvl->tgt_level = level; + + // Inform the Binding Manager about new transition + mm_bind_trans_new(p_env_lvl->env.grp_lid, MM_TRANS_TYPE_CLASSIC, + trans_time, delay); + } + else + { + // Inform the Binding Manager + mm_bind_trans_req(p_env_lvl->env.grp_lid, p_env_lvl->env.mdl_lid, + MM_TRANS_TYPE_CLASSIC, level, trans_time, delay); + } + } while (0); + + return (send_status); +} + +/** + **************************************************************************************** + * @brief Handler for Generic Delta Set/Set Unacknowledged message + * + * @param[in] p_env Pointer to environment of model for which message has been received + * @param[in] p_buf Pointer to the buffer containing the received message + * @param[in] p_route_env Pointer to structure containing reception parameters provided + * by the Mesh Profile block + **************************************************************************************** + */ +__STATIC bool mm_gens_lvl_handler_set_delta(mm_gens_lvl_env_t *p_env_lvl, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + // Boolean indicating if Generic Level Status can be sent now + bool send_status = (p_route_env->opcode == MM_MSG_GEN_DELTA_SET); + + do + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Extract required delta value + int32_t delta = (int32_t)read32p(p_data + MM_GEN_LVL_SET_DELTA_LVL_POS); + // Extract TID value + uint8_t tid = *(p_data + MM_GEN_LVL_SET_DELTA_TID_POS); + // Transition time + uint8_t trans_time = MM_TRANS_TIME_UNKNOWN; + // Delay + uint8_t delay = 0; + // Indicate if transaction is a new one + uint8_t new_transaction; + + // Extract optional value if present + if (p_buf->data_len == MM_GEN_LVL_SET_DELTA_LEN) + { + trans_time = (uint16_t)(*(p_data + MM_GEN_LVL_SET_DELTA_TRANS_TIME_POS)); + + // Check received value + if (GETF(trans_time, MM_TRANS_TIME_STEP_NB) > MM_TRANS_TIME_STEPS_MAX) + { + // Drop the message + send_status = false; + break; + } + + delay = *(p_data + MM_GEN_LVL_SET_DELTA_DELAY_POS); + } + + if (delta == 0) + { + break; + } + + // Check if transaction is a new transaction or if a new one must be started + new_transaction = mm_gens_lvl_is_new_transaction(p_env_lvl, p_route_env->u_addr.src, tid); + + // Keep information for transmission of status if needed + if (send_status) + { + p_env_lvl->status_dst_addr = p_route_env->u_addr.src; + p_env_lvl->status_app_key_lid = p_route_env->app_key_lid; + p_env_lvl->status_relay = GETB(p_route_env->info, MM_ROUTE_INFO_RELAY); + + send_status = false; + } + + p_env_lvl->delta_param.src = p_route_env->u_addr.src; + p_env_lvl->delta_param.tid = tid; + + if (GETB(p_env_lvl->env.info, MM_INFO_MAIN)) + { + // If transition is a new transition, keep the current level + if (new_transaction) + { + p_env_lvl->u.init_level = p_env_lvl->level; + } + + // Update target state + p_env_lvl->tgt_level = mm_gens_lvl_compute_tgt_delta(p_env_lvl, delta); + + // Inform the Binding Manager about new transition + mm_bind_trans_new(p_env_lvl->env.grp_lid, MM_TRANS_TYPE_DELTA, + trans_time, delay); + } + else + { + // Inform the Binding Manager + mm_bind_trans_req(p_env_lvl->env.grp_lid, p_env_lvl->env.mdl_lid, + MM_TRANS_TYPE_DELTA, delta, trans_time, delay); + } + } while (0); + + return (send_status); +} + +/** + **************************************************************************************** + * @brief Handler for Generic Move Set/Set Unacknowledged message + * + * @param[in] p_env Pointer to environment of model for which message has been received + * @param[in] p_buf Pointer to the buffer containing the received message + * @param[in] p_route_env Pointer to structure containing reception parameters provided + * by the Mesh Profile block + **************************************************************************************** + */ +__STATIC bool mm_gens_lvl_handler_set_move(mm_gens_lvl_env_t *p_env_lvl, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + // Boolean indicating if Generic Level Status can be sent now + bool send_status = (p_route_env->opcode == MM_MSG_GEN_MOVE_SET); + + do + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Extract required delta value + int16_t delta = (int16_t)read16p(p_data + MM_GEN_LVL_SET_MOVE_DELTA_LVL_POS); + // Extract TID value + uint8_t tid = *(p_data + MM_GEN_LVL_SET_MOVE_TID_POS); + // Transition time + uint8_t trans_time = MM_TRANS_TIME_UNKNOWN; + // Delay + uint8_t delay = 0; + + // Extract and check optional parameters if present + if (p_buf->data_len == MM_GEN_LVL_SET_MOVE_LEN) + { + trans_time = (uint16_t)(*(p_data + MM_GEN_LVL_SET_MOVE_TRANS_TIME_POS)); + + // Check received value + if (GETF(trans_time, MM_TRANS_TIME_STEP_NB) > MM_TRANS_TIME_STEPS_MAX) + { + // Drop the message + send_status = false; + break; + } + + delay = *(p_data + MM_GEN_LVL_SET_MOVE_DELAY_POS); + } + + // Check if received message is a retransmitted one, if state is modified and if + // a new transition can be started now + if ((p_env_lvl->status_dst_addr != MESH_UNASSIGNED_ADDR) + || mm_replay_is_retx(&p_env_lvl->replay_env, p_route_env->u_addr.src, tid)) + { + if (send_status) + { + // Send Generic Level status message + mm_gens_lvl_send_status(p_env_lvl, p_route_env, false); + } + break; + } + + // Keep information for transmission of status if needed + if (send_status) + { + p_env_lvl->status_dst_addr = p_route_env->u_addr.src; + p_env_lvl->status_app_key_lid = p_route_env->app_key_lid; + p_env_lvl->status_relay = GETB(p_route_env->info, MM_ROUTE_INFO_RELAY); + + send_status = false; + } + + p_env_lvl->move_param.delta = delta; + p_env_lvl->move_param.trans_time = trans_time; + + if (GETB(p_env_lvl->env.info, MM_INFO_MAIN)) + { + if (delta != 0) + { + // Move target level + int16_t tgt_move_level = (delta > 0) + ? MM_GENS_LVL_UPPER_LIMIT : MM_GENS_LVL_LOWER_LIMIT; + + if (p_env_lvl->level != p_env_lvl->u.tgt_move_level) + { + // Update target state + p_env_lvl->u.tgt_move_level = tgt_move_level; + p_env_lvl->tgt_level = p_env_lvl->level + delta; + + // Inform the Binding Manager about new transition + if (mm_bind_trans_new(p_env_lvl->env.grp_lid, MM_TRANS_TYPE_MOVE, + trans_time, delay) == MESH_ERR_NO_ERROR) + { + break; + } + } + + send_status = (p_route_env->opcode == MM_MSG_GEN_MOVE_SET); + p_env_lvl->status_dst_addr = MESH_UNASSIGNED_ADDR; + } + } + else + { + // Inform the Binding Manager + mm_bind_trans_req(p_env_lvl->env.grp_lid, p_env_lvl->env.mdl_lid, + MM_TRANS_TYPE_MOVE, delta, trans_time, delay); + } + } while (0); + + return (send_status); +} + +/* + * INTERNAL CALLBACK FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Callback function called when timer monitoring publication duration for + * Generic Level Server model expires + * + * @param[in] p_env Pointer to model environment for Generic Level Server model + **************************************************************************************** + */ +__STATIC void mm_gens_lvl_cb_tmr_publi(void *p_tmr) +{ + // Get allocated environment + mm_gens_lvl_env_t *p_env_lvl = MESH_TMR2ENV(p_tmr, mm_gens_lvl_env_t, tmr_publi); + + if (p_env_lvl->publi_period_ms) + { + // Publish a Generic Level Status message + mm_gens_lvl_publish(p_env_lvl); + + // Restart the timer + mesh_timer_set(&p_env_lvl->tmr_publi, p_env_lvl->publi_period_ms); + } +} + +/** + **************************************************************************************** + * @brief Inform Generic Level Server model about a received message + * + * @param[in] p_env Pointer to the environment allocated for the Generic Level + * Server model + * @param[in] p_buf Pointer to the buffer containing the received message + * @param[in] p_route_env Pointer to structure containing reception parameters provided + * by the Mesh Profile block + **************************************************************************************** + */ +__STATIC void mm_gens_lvl_cb_rx(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + // Boolean indicating if Generic Level Status message can be sent now + bool send_status; + // Cast the provided environment structure + mm_gens_lvl_env_t *p_env_lvl = (mm_gens_lvl_env_t *)p_env; + + switch (p_route_env->opcode) + { + case (MM_MSG_GEN_LVL_SET): + case (MM_MSG_GEN_LVL_SET_UNACK): + { + send_status = mm_gens_lvl_handler_set(p_env_lvl, p_buf, p_route_env); + } break; + + case (MM_MSG_GEN_DELTA_SET): + case (MM_MSG_GEN_DELTA_SET_UNACK): + { + send_status = mm_gens_lvl_handler_set_delta(p_env_lvl, p_buf, p_route_env); + } break; + + case (MM_MSG_GEN_MOVE_SET): + case (MM_MSG_GEN_MOVE_SET_UNACK): + { + send_status = mm_gens_lvl_handler_set_move(p_env_lvl, p_buf, p_route_env); + } break; + + case (MM_MSG_GEN_LVL_GET): + { + send_status = true; + } break; + + default: + { + send_status = false; + } break; + } + + if (send_status) + { + // Send a Generic Level Status message + mm_gens_lvl_send_status(p_env_lvl, p_route_env, false); + } +} + +/** + **************************************************************************************** + * @brief Check if a given opcode is handled by the Generic Level Server model + * + * @param[in] p_env Pointer to the environment allocated for the Generic Level + * Server model + * @param[in] opcode Opcode to check + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_gens_lvl_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status; + + if ((opcode == MM_MSG_GEN_LVL_GET) + || (opcode == MM_MSG_GEN_LVL_SET) + || (opcode == MM_MSG_GEN_LVL_SET_UNACK) + || (opcode == MM_MSG_GEN_DELTA_SET) + || (opcode == MM_MSG_GEN_DELTA_SET_UNACK) + || (opcode == MM_MSG_GEN_MOVE_SET) + || (opcode == MM_MSG_GEN_MOVE_SET_UNACK) + ) + { + status = MESH_ERR_NO_ERROR; + } + else + { + status = MESH_ERR_MDL_INVALID_OPCODE; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Set Generic Level state value + * + * @param[in] p_env Pointer the the environment allocated for the Generic Level + * Server model + * @param[in] level Generic Level state value + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_gens_lvl_cb_set(mm_mdl_env_t *p_env, uint16_t state_id, uint32_t state) +{ + // Returned status + uint8_t status = MESH_ERR_NO_ERROR; + + if (GETB(p_env->info, MM_INFO_MAIN)) + { + // Get environment for the Generic Level Server model + mm_gens_lvl_env_t *p_env_lvl = (mm_gens_lvl_env_t *)p_env; + + // Set state value + p_env_lvl->level = state; + } + else + { + status = MESH_ERR_COMMAND_DISALLOWED; + } + + return (status); +} + +/* + * CALLBACK FUNCTIONS FOR BINDING MANAGER + **************************************************************************************** + */ + + +/** + **************************************************************************************** + * @brief Callback function provided to the Binding Manager so that Generic Level Server + * model can be informed about group event + * + * @param[in] mdl_lid Model Local Index + * @param[in] event Event + * @param[in] info Information (depends on the event type) + **************************************************************************************** + */ +__STATIC void mm_gens_lvl_cb_grp_event(m_lid_t mdl_lid, uint8_t event, uint8_t info) +{ + // Get environment for Generic Level Server model + mm_gens_lvl_env_t *p_env_lvl = (mm_gens_lvl_env_t *)mm_state_get_env(mdl_lid); + + switch (event) + { + case (MM_GRP_EVENT_TRANS_REJECTED): + { + // Send Generic Level Status message + mm_gens_lvl_check_status_rsp(p_env_lvl); + } break; + + case (MM_GRP_EVENT_TRANS_DELAY_EXPIRED): + { + // Start the transition + mm_bind_trans_start(p_env_lvl->env.grp_lid); + } break; + + case (MM_GRP_EVENT_TRANS_IMMEDIATE): + { + p_env_lvl->level = p_env_lvl->tgt_level; + } // no break; + + case (MM_GRP_EVENT_TRANS_STARTED): + { + // Inform application about the update + if (GETB(p_env_lvl->env.info, MM_INFO_MAIN)) + { + uint8_t trans_time = info; + + // Inform application about state update + mm_srv_state_upd_ind_send(MM_STATE_GEN_LVL, p_env_lvl->env.elmt_idx, + (uint16_t)p_env_lvl->tgt_level, + (trans_time) ? mm_get_trans_time_ms(trans_time) : 0); + } + + // Check if a Generic Level Status message must be sent + mm_gens_lvl_check_status_rsp(p_env_lvl); + + // Send a publication + mm_gens_lvl_publish(p_env_lvl); + } break; + + case (MM_GRP_EVENT_TRANS_END): + { + // Transition type + uint8_t trans_type = info; + + // Update current level value + p_env_lvl->level = p_env_lvl->tgt_level; + + // Inform application about the update + if (GETB(p_env_lvl->env.info, MM_INFO_MAIN)) + { + // Inform application about state update + mm_srv_state_upd_ind_send(MM_STATE_GEN_LVL, p_env_lvl->env.elmt_idx, + (uint16_t)p_env_lvl->level, 0);; + } + + // Send a publication + mm_gens_lvl_publish(p_env_lvl); + + // Check transition type + if (trans_type == MM_TRANS_TYPE_MOVE) + { + // Continue transition to the target state + if (GETB(p_env_lvl->env.info, MM_INFO_MAIN)) + { + // Check if target level has been reached + if (p_env_lvl->level != p_env_lvl->u.tgt_move_level) + { + // Update target level + p_env_lvl->tgt_level = mm_gens_lvl_compute_tgt_move(p_env_lvl); + + // Inform the Binding Manager about new transition + mm_bind_trans_new(p_env_lvl->env.grp_lid, MM_TRANS_TYPE_MOVE, + p_env_lvl->move_param.trans_time, 0); + } + } + else + { + // Inform the Binding Manager + mm_bind_trans_req(p_env_lvl->env.grp_lid, p_env_lvl->env.mdl_lid, + MM_TRANS_TYPE_MOVE, p_env_lvl->move_param.delta, + p_env_lvl->move_param.trans_time, 0); + } + } + } break; + + // case (MM_GRP_EVENT_TRANS_ABORTED): + // case (MM_GRP_EVENT_GROUP_FULL): + default: + { + } break; + } +} + +/** + **************************************************************************************** + * @brief Callback function provided to the Binding Manager so that Generic Level state + * value can be set by main model of the group + * + * @param[in] mdl_lid Model Local Index + * @param[in] type Type + * @param[in] state State value + **************************************************************************************** + */ +__STATIC void mm_gens_lvl_cb_set_state(m_lid_t mdl_lid, uint8_t type, uint32_t state) +{ + // Get environment for Generic Level Server model + mm_gens_lvl_env_t *p_env_lvl = (mm_gens_lvl_env_t *)mm_state_get_env(mdl_lid); + + // Sanity check + ASSERT_INFO(!GETB(p_env_lvl->env.info, MM_INFO_MAIN), mdl_lid, 0); + + if (type == MM_STATE_TYPE_CURRENT) + { + p_env_lvl->level = (int16_t)state; + } + else if (type == MM_STATE_TYPE_TARGET) + { + p_env_lvl->tgt_level = (int16_t)state; + } + else // (type == MM_STATE_TYPE_TARGET_MOVE) + { + p_env_lvl->u.tgt_move_level = (int16_t)state; + } +} + +/* + * GLOBAL FUNCTIONS + **************************************************************************************** + */ + +m_lid_t mm_gens_lvl_register(uint8_t elmt_idx, bool main) +{ + //uint8_t status = MESH_ERR_COMMAND_DISALLOWED; + // Register the model + m_lid_t mdl_lid = ms_register_model(MM_ID_GENS_LVL, elmt_idx, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) //if (status == MESH_ERR_NO_ERROR) + { + // Inform the Model State Manager about registered model + mm_gens_lvl_env_t *p_env_lvl = (mm_gens_lvl_env_t *)mm_state_register(elmt_idx, MM_ID_GENS_LVL, mdl_lid, + MM_ROLE_SRV_PUBLI, sizeof(mm_gens_lvl_env_t)); + + if (p_env_lvl) + { + // Get server-specific callback functions + //mm_srv_cb_t *p_cb_srv = p_env_lvl->env.cb.u.p_cb_srv; + + // Prepare timer for publications + p_env_lvl->tmr_publi.cb = mm_gens_lvl_cb_tmr_publi; + //p_env_lvl->tmr_publi.p_env = (void *)p_env_lvl; + + // Prepare environment for Replay Manager + p_env_lvl->replay_env.delay_ms = MM_GENS_LVL_REPLAY_MS; + + // Set internal callback functions + p_env_lvl->env.mdl_cb.cb_rx = mm_gens_lvl_cb_rx; + p_env_lvl->env.mdl_cb.cb_opcode_check = mm_gens_lvl_cb_opcode_check; + //p_env_lvl->env.mdl_cb.cb_publish_param = mm_gens_lvl_cb_publish_param; + //p_cb_srv->cb_set = mm_gens_lvl_cb_set; + p_env_lvl->env.mdl_cb.cb_srv_set = mm_gens_lvl_cb_set; + + if (main) + { + // Create group + m_lid_t grp_lid = mm_bind_add_group(0, elmt_idx, mdl_lid, + mm_gens_lvl_cb_grp_event, NULL); + } + + //status = MESH_ERR_NO_ERROR; + // Inform application about registered model + mm_register_ind_send(MM_ID_GENS_LVL, elmt_idx, mdl_lid); + } + } + + return (mdl_lid); +} + +uint8_t mm_gens_lvl_bind_group(m_lid_t grp_lid, m_lid_t lvl_lid) +{ + return mm_bind_group_add_mdl(grp_lid, lvl_lid, MM_ID_GENS_LVL, + mm_gens_lvl_cb_grp_event, + mm_gens_lvl_cb_set_state); +} + +/// @} end of group diff --git a/mesh/model/gen/gens/mm_gens_oo.c b/mesh/model/gen/gens/mm_gens_oo.c new file mode 100644 index 0000000..7af97e6 --- /dev/null +++ b/mesh/model/gen/gens/mm_gens_oo.c @@ -0,0 +1,581 @@ +/** + **************************************************************************************** + * @file mm_gens_oo.c + * + * @brief Mesh Model Generic OnOff Server Module + * + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @addtogroup MM_GENS_OO + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mm_itf.h" +#include "mm_gens.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Validity of information provided to the Replay Manager +#define MM_GENS_OO_REPLAY_MS (6000) + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Structure for Generic OnOff Server model environment +typedef struct mm_gens_oo_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; + /// Timer for sending of publications + mesh_timer_t tmr_publi; + /// Publication period in milliseconds + uint32_t publi_period_ms; + + /// Environment for replay protection mechanism + mm_replay_env_t replay_env; + + /// Current OnOff state value + uint8_t onoff; + /// Target OnOff state value + uint8_t tgt_onoff; + + /// Address to which a Generic OnOff Status message must be sent (unassigned address if no + /// status must be sent) + uint8_t status_dst_addr; + /// Application key local index to be used for transmission of Generic OnOff Status message + m_lid_t status_app_key_lid; + /// Relaying of sent Generic OnOff Status authorized + bool status_relay; +} mm_gens_oo_env_t; + +/* + * LOCAL FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Prepare and send a Generic OnOff Status message + * + * @param[in] p_env_oo Pointer to Generic OnOff Server model environment + * @param[in] publish True if status is a publication, false if state is a response + **************************************************************************************** + */ +__STATIC void mm_gens_oo_send_status(mm_gens_oo_env_t *p_env_oo, mm_route_env_t *p_route_env, + bool publish) +{ + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_status; + // Remaining time + uint8_t rem_time; + // Transition type + uint8_t trans_type; + // Data length + uint8_t data_length; + + // Check if a transition has been started + mm_bind_get_trans_info(p_env_oo->env.grp_lid, &trans_type, &rem_time); + + // Deduce deduce data length + data_length = (trans_type != MM_TRANS_TYPE_NONE) ? MM_GEN_OO_STATUS_LEN : MM_GEN_OO_STATUS_MIN_LEN; + + p_buf_status = mm_route_buf_alloc(data_length); + if (p_buf_status) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_status); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_status->env; + + // Prepare environment + if (p_route_env) + { + p_buf_env->app_key_lid = p_route_env->app_key_lid; + p_buf_env->u_addr.dst = p_route_env->u_addr.src; + p_buf_env->info = p_route_env->info; + } + else if (!publish) + { + p_buf_env->app_key_lid = p_env_oo->status_app_key_lid; + p_buf_env->u_addr.dst = p_env_oo->status_dst_addr; + SETB(p_buf_env->info, MM_ROUTE_INFO_RELAY, p_env_oo->status_relay); + + // Can accept new transitions + p_env_oo->status_dst_addr = MESH_UNASSIGNED_ADDR; + } + + SETB(p_buf_env->info, MM_ROUTE_INFO_RX, 0); + SETB(p_buf_env->info, MM_ROUTE_INFO_PUBLISH, publish); + p_buf_env->mdl_lid = p_env_oo->env.mdl_lid; + p_buf_env->opcode = MM_MSG_GEN_OO_STATUS; + + // Fill the message + *(p_data + MM_GEN_OO_STATUS_OO_POS) = p_env_oo->onoff; + + if (data_length == MM_GEN_OO_STATUS_LEN) + { + *(p_data + MM_GEN_OO_STATUS_TGT_OO_POS) = p_env_oo->tgt_onoff; + *(p_data + MM_GEN_OO_STATUS_REM_TIME_POS) = rem_time; + } + + // Send the message + mm_route_send(p_buf_status); + } +} + +/** + **************************************************************************************** + * @brief Publish Generic OnOff state value if sending of publications is enabled + * + * @param[in] p_env_oo Pointer to Generic OnOff Server model environment + **************************************************************************************** + */ +__STATIC void mm_gens_oo_publish(mm_gens_oo_env_t *p_env_oo) +{ + // Check if sending of publication is enabled + if (GETB(p_env_oo->env.info, MM_INFO_PUBLI)) + { + mm_gens_oo_send_status(p_env_oo, NULL, true); + } +} + +/** + **************************************************************************************** + * @brief Check if a Generic OnOff Status message must be sent and send it if it + * is the case + * + * @param[in] p_env_oo Pointer to Generic OnOff Server model environment + **************************************************************************************** + */ +__STATIC void mm_gens_oo_check_status_rsp(mm_gens_oo_env_t *p_env_oo) +{ + if (p_env_oo->status_dst_addr) + { + // Send a response to the node that has required the transition + mm_gens_oo_send_status(p_env_oo, NULL, false); + + p_env_oo->status_dst_addr = MESH_UNASSIGNED_ADDR; + } +} + +/* + * MESSAGE HANDLERS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Handler for Generic OnOff Set/Set Unacknowledged message + * + * @param[in] p_env Pointer to environment of model for which message has been received + * @param[in] p_data Pointer to received message + **************************************************************************************** + */ +__STATIC void mm_gens_oo_handler_set(mm_gens_oo_env_t *p_env_oo, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + do + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Extract required onoff state value + uint8_t onoff = *(p_data + MM_GEN_OO_SET_OO_POS); + // Extract TID value + uint8_t tid = *(p_data + MM_GEN_OO_SET_TID_POS); + // Transition time + uint8_t trans_time = MM_TRANS_TIME_UNKNOWN; + // Delay + uint8_t delay = 0; + + // Check received state value + if (onoff > 1) + { + break; + } + + // Extract and check optional parameters if present + if (p_buf->data_len == MM_GEN_OO_SET_LEN) + { + trans_time = (uint16_t)(*(p_data + MM_GEN_OO_SET_TRANS_TIME_POS)); + + // Check received value + if (GETF(trans_time, MM_TRANS_TIME_STEP_NB) > MM_TRANS_TIME_STEPS_MAX) + { + // Drop the message + break; + } + + delay = *(p_data + MM_GEN_OO_SET_DELAY_POS); + } + + // Check if received message is a retransmitted one, if state is modified and if + // a new transition can be started now + if ((p_env_oo->status_dst_addr != MESH_UNASSIGNED_ADDR) + || mm_replay_is_retx(&p_env_oo->replay_env, p_route_env->u_addr.src, tid) + || (onoff == p_env_oo->onoff)) + { + if (p_route_env->opcode == MM_MSG_GEN_OO_SET) + { + // Send Generic OnOff status message + mm_gens_oo_send_status(p_env_oo, p_route_env, false); + } + break; + } + + // Keep information for transmission of status if needed + if (p_route_env->opcode == MM_MSG_GEN_OO_SET) + { + p_env_oo->status_dst_addr = p_route_env->u_addr.src; + p_env_oo->status_app_key_lid = p_route_env->app_key_lid; + p_env_oo->status_relay = GETB(p_route_env->info, MM_ROUTE_INFO_RELAY); + } + + if (GETB(p_env_oo->env.info, MM_INFO_MAIN)) + { + // Update target state + p_env_oo->tgt_onoff = onoff; + + // Inform the Binding Manager about new transition + mm_bind_trans_new(p_env_oo->env.grp_lid, MM_TRANS_TYPE_CLASSIC, + trans_time, delay); + } + else + { + // Inform the Binding Manager + mm_bind_trans_req(p_env_oo->env.grp_lid, p_env_oo->env.mdl_lid, + MM_TRANS_TYPE_CLASSIC, onoff, trans_time, delay); + } + } while (0); +} + +/* + * INTERNAL CALLBACK FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Callback function called when timer monitoring publication duration for + * Generic OnOff Server model expires + * + * @param[in] p_env Pointer to model environment for Generic OnOff Server model + **************************************************************************************** + */ +__STATIC void mm_gens_oo_cb_tmr_publi(void *p_tmr) +{ + // Get allocated environment + mm_gens_oo_env_t *p_env_oo = MESH_TMR2ENV(p_tmr, mm_gens_oo_env_t, tmr_publi); + + if (p_env_oo->publi_period_ms) + { + // Publish a Generic OnOff Status message + mm_gens_oo_publish(p_env_oo); + + // Restart the timer + mesh_timer_set(&p_env_oo->tmr_publi, p_env_oo->publi_period_ms); + } +} + +/** + **************************************************************************************** + * @brief Inform Generic OnOff Server model about a received message + * + * @param[in] p_env Pointer to the environment allocated for the Generic OnOff + * Server model + * @param[in] p_buf Pointer to the buffer containing the received message + * @param[in] p_route_env Pointer to structure containing reception parameters provided + * by the Mesh Profile block + **************************************************************************************** + */ +__STATIC void mm_gens_oo_cb_rx(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + // Get environment for Generic OnOff Server model + mm_gens_oo_env_t *p_env_oo = (mm_gens_oo_env_t *)p_env; + + if (p_route_env->opcode != MM_MSG_GEN_OO_GET) + { + // Handle Generic OnOff Set/Set Unacknowledged message + mm_gens_oo_handler_set(p_env_oo, p_buf, p_route_env); + } + else + { + // Send a Generic OnOff Status message + mm_gens_oo_send_status(p_env_oo, p_route_env, false); + } +} + +/** + **************************************************************************************** + * @brief Check if a given opcode is handled by the Generic OnOff Server model + * + * @param[in] p_env Pointer to the environment allocated for the Generic OnOff + * Server model + * @param[in] opcode Opcode to check + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_gens_oo_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + #if 0 + uint8_t status; + + if ((opcode == MM_MSG_GEN_OO_GET) + || (opcode == MM_MSG_GEN_OO_SET) + || (opcode == MM_MSG_GEN_OO_SET_UNACK)) + { + status = MESH_ERR_NO_ERROR; + } + else + { + status = MESH_ERR_MDL_INVALID_OPCODE; + } + #else + uint8_t status = MESH_ERR_MDL_INVALID_OPCODE; + + if ((opcode & 0xFF) == 0x82) + { + uint8_t opcode_2b = (uint8_t)(opcode >> 8); + + if ((opcode_2b >= 0x01/*MM_MSG_GEN_OO_GET*/) + && (opcode_2b <= 0x03/*MM_MSG_GEN_OO_SET_UNACK*/)) + { + status = MESH_ERR_NO_ERROR; + } + } + #endif + return (status); +} + +/** + **************************************************************************************** + * @brief Set Generic OnOff state value + * + * @param[in] p_env Pointer the the environment allocated for the Generic OnOff + * Server model + * @param[in] onoff Generic OnOff state value + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_gens_oo_cb_set(mm_mdl_env_t *p_env, uint16_t state_id, uint32_t state) +{ + // Returned status + uint8_t status = MESH_ERR_NO_ERROR; + + if (GETB(p_env->info, MM_INFO_MAIN)) + { + // Generic OnOff state + uint8_t onoff = state; + + if (onoff < 1) + { + // Get environment for the Generic OnOff Server model + mm_gens_oo_env_t *p_env_oo = (mm_gens_oo_env_t *)p_env; + + // Set state value + p_env_oo->onoff = onoff; + } + else + { + status = MESH_ERR_INVALID_PARAM; + } + } + else + { + status = MESH_ERR_COMMAND_DISALLOWED; + } + + return (status); +} + +/* + * CALLBACK FUNCTIONS FOR BINDING MANAGER + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Callback function provided to the Binding Manager so that Generic OnOff Server + * model can be informed about group event + * + * @param[in] mdl_lid Model Local Index + * @param[in] event Event + * @param[in] info Information (depends on the event type) + **************************************************************************************** + */ +__STATIC void mm_gens_oo_cb_grp_event(m_lid_t mdl_lid, uint8_t event, uint8_t info) +{ + // Get environment for Generic OnOff Server model + mm_gens_oo_env_t *p_env_oo = (mm_gens_oo_env_t *)mm_state_get_env(mdl_lid); + + switch (event) + { + case (MM_GRP_EVENT_TRANS_REJECTED): + { + // Send a response to the node that has required the transition + mm_gens_oo_check_status_rsp(p_env_oo); + } break; + + case (MM_GRP_EVENT_TRANS_DELAY_EXPIRED): + { + // Start the transition + mm_bind_trans_start(p_env_oo->env.grp_lid); + } break; + + case (MM_GRP_EVENT_TRANS_IMMEDIATE): + { + p_env_oo->onoff = p_env_oo->tgt_onoff; + } // no break; + + case (MM_GRP_EVENT_TRANS_STARTED): + { + // Inform application about the update + if (GETB(p_env_oo->env.info, MM_INFO_MAIN)) + { + uint8_t trans_time = info; + + // Inform application about state update + mm_srv_state_upd_ind_send(MM_STATE_GEN_ONOFF, p_env_oo->env.elmt_idx, + p_env_oo->tgt_onoff, + (trans_time) ? mm_get_trans_time_ms(trans_time) : 0); + } + + // Send a response to the node that has required the transition + mm_gens_oo_check_status_rsp(p_env_oo); + + // Send a publication + mm_gens_oo_publish(p_env_oo); + + if (p_env_oo->tgt_onoff == 1) + { + p_env_oo->onoff = 1; + } + } break; + + case (MM_GRP_EVENT_TRANS_END): + { + // New state is the target state + p_env_oo->onoff = p_env_oo->tgt_onoff; + + // Inform application about the update + if (GETB(p_env_oo->env.info, MM_INFO_MAIN)) + { + // Inform application about state update + mm_srv_state_upd_ind_send(MM_STATE_GEN_ONOFF, p_env_oo->env.elmt_idx, + p_env_oo->onoff, 0); + } + + // Send a publication + mm_gens_oo_publish(p_env_oo); + } break; + + // case (MM_GRP_EVENT_TRANS_ABORTED): + // case (MM_GRP_EVENT_GROUP_FULL): + default: + { + } break; + } +} + +/** + **************************************************************************************** + * @brief Callback function provided to the Binding Manager so that Generic OnOff state + * value can be set by main model of the group + * + * @param[in] mdl_lid Model Local Index + * @param[in] type Type + * @param[in] state State value + **************************************************************************************** + */ +__STATIC void mm_gens_oo_cb_set_state(m_lid_t mdl_lid, uint8_t type, uint32_t state) +{ + // Get environment for Generic Level Server model + mm_gens_oo_env_t *p_env_oo = (mm_gens_oo_env_t *)mm_state_get_env(mdl_lid); + + // Sanity check + ASSERT_INFO(!GETB(p_env_oo->env.info, MM_INFO_MAIN), mdl_lid, 0); + + if (type == MM_STATE_TYPE_CURRENT) + { + p_env_oo->onoff = (uint8_t)state; + } + else // (type == MM_STATE_TYPE_TARGET) || (type == MM_STATE_TYPE_TARGET_MOVE) + { + p_env_oo->tgt_onoff = (int8_t)state; + } +} + +/* + * GLOBAL FUNCTIONS + **************************************************************************************** + */ + +m_lid_t mm_gens_oo_register(uint8_t elmt_idx, bool main) +{ + // Register the model + m_lid_t mdl_lid = ms_register_model(MM_ID_GENS_OO, elmt_idx, MM_CFG_PUBLI_AUTH_BIT); + + // Check if model has been properly registered + if (mdl_lid != MESH_INVALID_LID) + { + // Inform the Model State Manager about registered model + mm_gens_oo_env_t *p_env_oo = (mm_gens_oo_env_t *)mm_state_register(elmt_idx, MM_ID_GENS_OO, mdl_lid, + MM_ROLE_SRV_PUBLI, sizeof(mm_gens_oo_env_t)); + + if (p_env_oo) + { + // Prepare timer for publication + p_env_oo->tmr_publi.cb = mm_gens_oo_cb_tmr_publi; + + // Prepare environment for Replay Manager + p_env_oo->replay_env.delay_ms = MM_GENS_OO_REPLAY_MS; + + // Set internal callback functions + p_env_oo->env.mdl_cb.cb_rx = mm_gens_oo_cb_rx; + p_env_oo->env.mdl_cb.cb_opcode_check = mm_gens_oo_cb_opcode_check; + p_env_oo->env.mdl_cb.cb_srv_set = mm_gens_oo_cb_set; + + if (main) + { + // Create group + m_lid_t grp_lid = mm_bind_add_group(0, elmt_idx, mdl_lid, + mm_gens_oo_cb_grp_event, NULL); + } + + // Inform application about registered model + mm_register_ind_send(MM_ID_GENS_OO, elmt_idx, mdl_lid); + } + else + { + // Allocate fail - MESH_ERR_STORAGE_FAILURE + } + } + + return (mdl_lid); +} + +uint8_t mm_gens_oo_bind_group(m_lid_t grp_lid, m_lid_t oo_lid) +{ + return mm_bind_group_add_mdl(grp_lid, oo_lid, MM_ID_GENS_OO, + mm_gens_oo_cb_grp_event, + mm_gens_oo_cb_set_state); +} + +/// @} end of group diff --git a/mesh/model/gen/gens/mm_gens_plvl.c b/mesh/model/gen/gens/mm_gens_plvl.c new file mode 100644 index 0000000..8b1b42d --- /dev/null +++ b/mesh/model/gen/gens/mm_gens_plvl.c @@ -0,0 +1,1051 @@ +/** + **************************************************************************************** + * @file mm_gens_plvl.c + * + * @brief Mesh Model Generic Power Level Server Module + * + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @addtogroup MM_GENS_PLVL + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mm_itf.h" +#include "mm_gens.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Validity of information provided to the Replay Manager +#define MM_GENS_PLVL_REPLAY_MS (6000) + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Structure for Generic Power Level server model environment +typedef struct mm_gens_plvl_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; + /// Timer for sending of publications + mesh_timer_t tmr_publi; + /// Publication period in milliseconds + uint32_t publi_period_ms; + + /// Environment for replay protection mechanism + mm_replay_env_t replay_env; + + /// Delta value in case of move transition + int16_t move_delta; + /// Generic Power Actual state value + uint16_t power_actual; + /// Target value of Generic Power Actual state value + uint16_t tgt_power_actual; + /// Generic Power Last state value + uint16_t power_last; + /// Generic Power Default state value + uint16_t power_dflt; + /// Generic Power Range Min state value + uint16_t power_min; + /// Generic Power Range Max state value + uint16_t power_max; + + /// Source address of set message that has triggered last or current transition + uint8_t status_dst_addr; + /// Application key local index to be used for transmission of Generic Level Status message + m_lid_t status_app_key_lid; + /// Relaying of sent Generic Level Status authorized + bool status_relay; +} mm_gens_plvl_env_t; + +/// Structure for Generic Power Level Setup Server model environment +typedef struct mm_gens_plvls_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; + /// Pointer to environment of associated Generic Power Level Server model + mm_gens_plvl_env_t *p_env_plvl; +} mm_gens_plvls_env_t; + + +/* + * LOCAL FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Prepare and send a Generic Power Level Status message + * + * @param[in] p_env_plvl Pointer to Generic Power Level Server model environment + * @param[in] p_route_env Pointer to structure containing reception information provided + * by Mesh Profile for received request message + * @param[in] publish Indicate if message is sent as a publication (true) or as + * a response to a received request (false) + **************************************************************************************** + */ +__STATIC void mm_gens_plvl_send_plvl_status(mm_gens_plvl_env_t *p_env_plvl, + mm_route_env_t *p_route_env, bool publish) +{ + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_status; + // Remaining time + uint8_t rem_time; + // Transition type + uint8_t trans_type; + // Data length + uint8_t data_length; + + // Check if a transition has been started + mm_bind_get_trans_info(p_env_plvl->env.grp_lid, &trans_type, &rem_time); + + // Deduce deduce data length + data_length = (trans_type != MM_TRANS_TYPE_NONE) + ? MM_GEN_PLVL_STATUS_LEN : MM_GEN_PLVL_STATUS_MIN_LEN; + + p_buf_status = mm_route_buf_alloc(data_length); + if (p_buf_status) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_status); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_status->env; + + // Prepare environment + if (p_route_env) + { + memcpy(p_buf_env, p_route_env, sizeof(mm_route_env_t)); + } + else if (!publish) + { + p_buf_env->app_key_lid = p_env_plvl->status_app_key_lid; + p_buf_env->u_addr.dst = p_env_plvl->status_dst_addr; + SETB(p_buf_env->info, MM_ROUTE_INFO_RELAY, p_env_plvl->status_relay); + } + + SETB(p_buf_env->info, MM_ROUTE_INFO_RX, 0); + SETB(p_buf_env->info, MM_ROUTE_INFO_PUBLISH, publish); + p_buf_env->mdl_lid = p_env_plvl->env.mdl_lid; + p_buf_env->opcode = MM_MSG_GEN_PLVL_STATUS; + + // Fill the message + write16p(p_data + MM_GEN_PLVL_STATUS_PRES_POWER_POS, p_env_plvl->power_actual); + + if (data_length == MM_GEN_PLVL_STATUS_LEN) + { + // Targeted Generic Power Actual state value + uint16_t tgt_power; + + if (trans_type == MM_TRANS_TYPE_MOVE) + { + tgt_power = (p_env_plvl->move_delta > 0) ? p_env_plvl->power_max + : p_env_plvl->power_min; + rem_time = MM_TRANS_TIME_UNKNOWN; + } + else + { + tgt_power = p_env_plvl->tgt_power_actual; + } + + write16p(p_data + MM_GEN_PLVL_STATUS_TGT_POWER_POS, tgt_power); + *(p_data + MM_GEN_PLVL_STATUS_REM_TIME_POS) = rem_time; + } + + // Send the message + mm_route_send(p_buf_status); + } +} + +/** + **************************************************************************************** + * @brief Prepare and send a Generic Power Last Status message + * + * @param[in] p_env_plvl Pointer to Generic Power Level Server model environment + * @param[in] p_route_env Pointer to structure containing reception information provided + * by Mesh Profile for received request message + **************************************************************************************** + */ +__STATIC void mm_gens_plvl_send_plast_status(mm_gens_plvl_env_t *p_env_plvl, + mm_route_env_t *p_route_env) +{ + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_status = mm_route_buf_alloc_status(MM_GEN_PLVL_LAST_STATUS_LEN, p_route_env); + + if (p_buf_status) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_status); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_status->env; + + // Prepare environment + p_buf_env->mdl_lid = p_env_plvl->env.mdl_lid; + p_buf_env->opcode = MM_MSG_GEN_PLAST_STATUS; + + // Fill the message + write16p(p_data + MM_GEN_PLVL_LAST_STATUS_POWER_POS, p_env_plvl->power_last); + + // Send the message + mm_route_send(p_buf_status); + } +} + +/** + **************************************************************************************** + * @brief Prepare and send a Generic Power Default Status message + * + * @param[in] p_env_plvl Pointer to Generic Power Level Server model environment + * @param[in] p_route_env Pointer to structure containing reception information provided + * by Mesh Profile for received request message + **************************************************************************************** + */ +__STATIC void mm_gens_plvl_send_pdflt_status(mm_gens_plvl_env_t *p_env_plvl, + mm_route_env_t *p_route_env) +{ + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_status = mm_route_buf_alloc_status(MM_GEN_PLVL_DFLT_STATUS_LEN, p_route_env); + + if (p_buf_status) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_status); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_status->env; + + // Prepare environment + p_buf_env->mdl_lid = p_env_plvl->env.mdl_lid; + p_buf_env->opcode = MM_MSG_GEN_PDFLT_STATUS; + + // Fill the message + write16p(p_data + MM_GEN_PLVL_DFLT_STATUS_POWER_POS, p_env_plvl->power_dflt); + + // Send the message + mm_route_send(p_buf_status); + } +} + +/** + **************************************************************************************** + * @brief Prepare and send a Generic Power Range Status message + * + * @param[in] p_env_plvl Pointer to Generic Power Level Server model environment + * @param[in] p_route_env Pointer to structure containing reception information provided + * by Mesh Profile for received request message + * @param[in] status Status sent in the Generic Power Range Status message + * (@see enum mm_status) + **************************************************************************************** + */ +__STATIC void mm_gens_plvl_send_prange_status(mm_gens_plvl_env_t *p_env_plvl, + mm_route_env_t *p_route_env, + uint8_t status) +{ + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_status = mm_route_buf_alloc_status(MM_GEN_PLVL_RANGE_STATUS_LEN, p_route_env); + + if (p_buf_status) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_status); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_status->env; + + // Prepare environment + p_buf_env->mdl_lid = p_env_plvl->env.mdl_lid; + p_buf_env->opcode = MM_MSG_GEN_PRANGE_STATUS; + + // Fill the message + *(p_data + MM_GEN_PLVL_RANGE_STATUS_CODE_POS) = status; + write16p(p_data + MM_GEN_PLVL_RANGE_STATUS_MIN_POS, p_env_plvl->power_min); + write16p(p_data + MM_GEN_PLVL_RANGE_STATUS_MAX_POS, p_env_plvl->power_max); + + // Send the message + mm_route_send(p_buf_status); + } +} + +/** + **************************************************************************************** + * @brief Publish Generic Power Level state value if sending of publications is enabled + * + * @param[in] p_env_plvl Pointer to Generic Power Level Server model environment + **************************************************************************************** + */ +__STATIC void mm_gens_plvl_publish(mm_gens_plvl_env_t *p_env_plvl) +{ + // Check if sending of publication is enabled + if (GETB(p_env_plvl->env.info, MM_INFO_PUBLI)) + { + mm_gens_plvl_send_plvl_status(p_env_plvl, NULL, true); + } +} + +/** + **************************************************************************************** + * @brief Check if a Generic Power Level Status message must be sent and send it if it + * is the case + * + * @param[in] p_env_plvl Pointer to Generic Power Level Server model environment + **************************************************************************************** + */ +__STATIC void mm_gens_plvl_check_status_rsp(mm_gens_plvl_env_t *p_env_plvl) +{ + if (p_env_plvl->status_dst_addr != MESH_UNASSIGNED_ADDR) + { + // Send a response to the node that has required the transition + mm_gens_plvl_send_plvl_status(p_env_plvl, NULL, false); + + p_env_plvl->status_dst_addr = MESH_UNASSIGNED_ADDR; + } +} + +/* + * MESSAGE HANDLERS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Handler for Generic Power Level Set/Set Unacknowledged message + * + * @param[in] p_env Pointer to environment of model for which message has been received + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing information for the received buffer + **************************************************************************************** + */ +__STATIC void mm_gens_plvl_handler_set_plvl(mm_gens_plvl_env_t *p_env_plvl, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + do + { + // Check if a Generic Power Level Status message must be sent + bool send_status = (p_route_env->opcode == MM_MSG_GEN_PLVL_SET); + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Extract power value + uint16_t power = read16p(p_data + MM_GEN_PLVL_SET_POWER_POS); + // Extract TID value + uint8_t tid = *(p_data + MM_GEN_PLVL_SET_TID_POS); + // Transition time + uint8_t trans_time = MM_TRANS_TIME_UNKNOWN; + // Delay + uint8_t delay = 0; + + // Extract and check optional parameters if present + if (p_buf->data_len == MM_GEN_PLVL_SET_LEN) + { + trans_time = (uint16_t)(*(p_data + MM_GEN_PLVL_SET_TRANS_TIME_POS)); + + // Check received value + if (GETF(trans_time, MM_TRANS_TIME_STEP_NB) > MM_TRANS_TIME_STEPS_MAX) + { + // Drop the message + break; + } + + delay = *(p_data + MM_GEN_PLVL_SET_DELAY_POS); + } + + // Check if Generic Power Actual state is modified + if ((p_env_plvl->status_dst_addr != MESH_UNASSIGNED_ADDR) + || mm_replay_is_retx(&p_env_plvl->replay_env, p_route_env->u_addr.src, tid) + || (power == p_env_plvl->power_actual)) + { + // Send a Generic Power Level Status message + if (send_status) + { + mm_gens_plvl_send_plvl_status(p_env_plvl, p_route_env, false); + } + break; + }; + + if (send_status) + { + // Keep information for transmission of status + p_env_plvl->status_dst_addr = p_route_env->u_addr.src; + p_env_plvl->status_app_key_lid = p_route_env->app_key_lid; + p_env_plvl->status_relay = GETB(p_route_env->info, MM_ROUTE_INFO_RELAY); + } + + if (power != 0) + { + // Ensure that Generic Power Actual state value is between Generic Power Range + // Min and Max values + if (power > p_env_plvl->power_max) + { + power = p_env_plvl->power_max; + } + else if (power < p_env_plvl->power_min) + { + power = p_env_plvl->power_min; + } + } + + // Update target state + p_env_plvl->tgt_power_actual = power; + + // Inform the Binding Manager about new transition + mm_bind_trans_new(p_env_plvl->env.grp_lid, MM_TRANS_TYPE_CLASSIC, + trans_time, delay); + } while (0); +} + +/** + **************************************************************************************** + * @brief Handler for Generic Power Default Set/Set Unacknowledged message + * + * @param[in] p_env Pointer to environment of model for which message has been received + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing information for the received buffer + **************************************************************************************** + */ +__STATIC void mm_gens_plvl_handler_set_pdflt(mm_gens_plvl_env_t *p_env_plvl, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Extract received state value + uint16_t power_dflt = read16p(p_data + MM_GEN_PLVL_DFLT_SET_POWER_POS); + + if (power_dflt != p_env_plvl->power_dflt) + { + // Keep received value + p_env_plvl->power_dflt = power_dflt; + + // Inform application about received value + mm_srv_state_upd_ind_send(MM_STATE_GEN_POWER_DFLT, p_env_plvl->env.elmt_idx, + p_env_plvl->power_dflt, 0); + } + + // If needed, send a Generic Power Default Status message to the requester + if (p_route_env->opcode == MM_MSG_GEN_PDFLT_SET) + { + mm_gens_plvl_send_pdflt_status(p_env_plvl, p_route_env); + } +} + +/** + **************************************************************************************** + * @brief Handler for Generic Power Range Set/Set Unacknowledged message + * + * @param[in] p_env Pointer to environment of model for which message has been received + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing information for the received buffer + **************************************************************************************** + */ +__STATIC void mm_gens_plvl_handler_set_prange(mm_gens_plvl_env_t *p_env_plvl, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + do + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Status + uint8_t status = MM_STATUS_SUCCESS; + // Extract Generic Power Range state value + uint16_t power_min = read16p(p_data + MM_GEN_PLVL_RANGE_SET_MIN_POS); + // Extract Generic Power Range state value + uint16_t power_max = read16p(p_data + MM_GEN_PLVL_RANGE_SET_MAX_POS); + + // Check provided values + if (power_min == 0) + { + status = MM_STATUS_ERROR_RANGE_MIN; + } + else if (power_max == 0) + { + status = MM_STATUS_ERROR_RANGE_MAX; + } + else if (power_min > power_max) + { + // Drop the message + break; + } + + if ((status == MM_STATUS_SUCCESS) + && ((p_env_plvl->power_min != power_min) + || (p_env_plvl->power_max != power_max))) + { + p_env_plvl->power_min = power_min; + p_env_plvl->power_max = power_max; + + // Inform application about received value + mm_srv_state_upd_ind_send(MM_STATE_GEN_POWER_RANGE, p_env_plvl->env.elmt_idx, + power_min | ((uint32_t)power_max << 16), 0); + } + + // If needed, send a Generic Power Range Status message to the requester + if (p_route_env->opcode == MM_MSG_GEN_PRANGE_SET) + { + mm_gens_plvl_send_prange_status(p_env_plvl, p_route_env, status); + } + } while (0); +} + +/* + * INTERNAL CALLBACK FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Callback function called when timer monitoring publication duration for + * Generic Power Level Server model expires + * + * @param[in] p_env Pointer to model environment for Generic Power Level Server model + **************************************************************************************** + */ +__STATIC void mm_gens_plvl_cb_tmr_publi(void *p_tmr) +{ + // Get allocated environment + mm_gens_plvl_env_t *p_env_plvl = MESH_TMR2ENV(p_tmr, mm_gens_plvl_env_t, tmr_publi); + + if (p_env_plvl->publi_period_ms) + { + // Publish a Generic Power Level Status message + mm_gens_plvl_publish(p_env_plvl); + + // Restart the timer + mesh_timer_set(&p_env_plvl->tmr_publi, p_env_plvl->publi_period_ms); + } +} + +/** + **************************************************************************************** + * @brief Inform Generic Power Level Server model about a received message + * + * @param[in] p_env Pointer to the environment allocated for the Generic Power Level + * Server model + * @param[in] p_buf Pointer to the buffer containing the received message + * @param[in] p_route_env Pointer to structure containing reception parameters provided + * by the Mesh Profile block + **************************************************************************************** + */ +__STATIC void mm_gens_plvl_cb_rx(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + do + { + // Environment for Generic Power Level Server model + mm_gens_plvl_env_t *p_env_plvl; + + if (p_env->model_id == MM_ID_GENS_PLVL) + { + p_env_plvl = (mm_gens_plvl_env_t *)p_env; + + switch (p_route_env->opcode) + { + case (MM_MSG_GEN_PLVL_GET): + { + // Send a Generic Power Level Status message + mm_gens_plvl_send_plvl_status(p_env_plvl, p_route_env, false); + } break; + + case (MM_MSG_GEN_PLVL_SET): + case (MM_MSG_GEN_PLVL_SET_UNACK): + { + // Handle the message + mm_gens_plvl_handler_set_plvl(p_env_plvl, p_buf, p_route_env); + } break; + + case (MM_MSG_GEN_PLAST_GET): + { + // Send a Generic Power Last Status message + mm_gens_plvl_send_plast_status(p_env_plvl, p_route_env); + } break; + + case (MM_MSG_GEN_PDFLT_GET): + { + // Send a Generic Power Default Status message + mm_gens_plvl_send_pdflt_status(p_env_plvl, p_route_env); + } break; + + case (MM_MSG_GEN_PRANGE_GET): + { + // Send a Generic Power Range Status message + mm_gens_plvl_send_prange_status(p_env_plvl, p_route_env, MM_STATUS_SUCCESS); + } break; + + default: + { + } break; + } + } + else + { + // Environment for Generic Power Level Setup Server model + mm_gens_plvls_env_t *p_env_plvls = (mm_gens_plvls_env_t *)p_env; + p_env_plvl = p_env_plvls->p_env_plvl; + + switch (p_route_env->opcode) + { + case (MM_MSG_GEN_PDFLT_SET): + case (MM_MSG_GEN_PDFLT_SET_UNACK): + { + // Handle the message + mm_gens_plvl_handler_set_pdflt(p_env_plvl, p_buf, p_route_env); + } break; + + case (MM_MSG_GEN_PRANGE_SET): + case (MM_MSG_GEN_PRANGE_SET_UNACK): + { + // Handle the message + mm_gens_plvl_handler_set_prange(p_env_plvl, p_buf, p_route_env); + } break; + + default: + { + } break; + } + } + } while (0); +} + +/** + **************************************************************************************** + * @brief Check if a given opcode is handled by the Generic Power Level Server model + * + * @param[in] p_env Pointer to the environment allocated for the Generic Power Level + * Server model + * @param[in] opcode Opcode to check + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_gens_plvl_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status = MESH_ERR_MDL_INVALID_OPCODE; + + if (p_env->model_id == MM_ID_GENS_PLVL) + { + if ((opcode == MM_MSG_GEN_PLVL_GET) + || (opcode == MM_MSG_GEN_PLVL_SET) + || (opcode == MM_MSG_GEN_PLVL_SET_UNACK) + || (opcode == MM_MSG_GEN_PLAST_GET) + || (opcode == MM_MSG_GEN_PDFLT_GET) + || (opcode == MM_MSG_GEN_PRANGE_GET)) + { + status = MESH_ERR_NO_ERROR; + } + } + else if (p_env->model_id == MM_ID_GENS_PLVLS) + { + if ((opcode == MM_MSG_GEN_PDFLT_SET) + || (opcode == MM_MSG_GEN_PDFLT_SET_UNACK) + || (opcode == MM_MSG_GEN_PRANGE_SET) + || (opcode == MM_MSG_GEN_PRANGE_SET_UNACK)) + { + status = MESH_ERR_NO_ERROR; + } + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Set Generic Power Actual or Generic Power Default or Generic Power Range state value + * + * @param[in] p_env Pointer the the environment allocated for the Generic OnOff + * Server model + * @param[in] state_id State identifier + * @param[in] state Generic Power Actual or Generic Power Default or Generic Power + * Range state value + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_gens_plvl_cb_set(mm_mdl_env_t *p_env, uint16_t state_id, uint32_t state) +{ + // Returned status + uint8_t status = MESH_ERR_NO_ERROR; + // Get environment for the Generic Power Level Server model + mm_gens_plvl_env_t *p_env_plvl = (mm_gens_plvl_env_t *)p_env; + + switch (state_id) + { + case (MM_STATE_GEN_POWER_ACTUAL): + case (MM_STATE_GEN_POWER_DFLT): + { + uint16_t level = state; + + if ((level == 0) + || ((level >= p_env_plvl->power_min) + && (level <= p_env_plvl->power_max))) + { + if (state_id == MM_STATE_GEN_POWER_ACTUAL) + { + p_env_plvl->power_actual = level; + + if (level != 0) + { + p_env_plvl->power_last = level; + } + + // Set the targeted Generic OnOff state value + mm_bind_set_state(p_env_plvl->env.grp_lid, MM_STATE_TYPE_TARGET, MM_ID_GENS_OO, + (p_env_plvl->power_actual == 0) ? 0 : 1); + + // Set the targeted Generic Level state value + mm_bind_set_state(p_env_plvl->env.grp_lid, MM_STATE_TYPE_TARGET, MM_ID_GENS_LVL, + p_env_plvl->power_actual - 32768); + } + else + { + p_env_plvl->power_dflt = level; + } + } + else + { + status = MESH_ERR_INVALID_PARAM; + } + } break; + + case (MM_STATE_GEN_POWER_RANGE): + { + + } break; + + default: + { + status = MESH_ERR_INVALID_PARAM; + } break; + } + + return (status); +} + +/* + * CALLBACK FUNCTIONS FOR BINDING MANAGER + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Callback function provided to the Binding Manager so that Generic Power Level Server + * model can be informed about group event + * + * @param[in] mdl_lid Model Local Index + * @param[in] event Event + * @param[in] info Information (depends on the event type) + **************************************************************************************** + */ +__STATIC void mm_gens_plvl_cb_grp_event(m_lid_t mdl_lid, uint8_t event, uint8_t info) +{ + // Get environment for Generic Power Server model + mm_gens_plvl_env_t *p_env_plvl = (mm_gens_plvl_env_t *)mm_state_get_env(mdl_lid); + + switch (event) + { + case (MM_GRP_EVENT_TRANS_DELAY_EXPIRED): + { + // Set the targeted Generic OnOff state value + mm_bind_set_state(p_env_plvl->env.grp_lid, MM_STATE_TYPE_TARGET, MM_ID_GENS_OO, + (p_env_plvl->tgt_power_actual == 0) ? 0 : 1); + + // Set the targeted Generic Level state value + mm_bind_set_state(p_env_plvl->env.grp_lid, MM_STATE_TYPE_TARGET, MM_ID_GENS_LVL, + p_env_plvl->tgt_power_actual - 32768); + + // Start the transition + mm_bind_trans_start(p_env_plvl->env.grp_lid); + } break; + + case (MM_GRP_EVENT_TRANS_IMMEDIATE): + { + p_env_plvl->power_actual = p_env_plvl->tgt_power_actual; + + if (p_env_plvl->power_actual != 0) + { + p_env_plvl->power_last = p_env_plvl->power_actual; + } + } // no break; + + case (MM_GRP_EVENT_TRANS_STARTED): + { + uint8_t trans_time = info; + + // Inform application about state update + mm_srv_state_upd_ind_send(MM_STATE_GEN_POWER_ACTUAL, p_env_plvl->env.elmt_idx, + p_env_plvl->tgt_power_actual, + (trans_time) ? mm_get_trans_time_ms(trans_time) : 0); + + // Check if a status message must be sent + mm_gens_plvl_check_status_rsp(p_env_plvl); + + // Send a publication + mm_gens_plvl_publish(p_env_plvl); + } break; + + case (MM_GRP_EVENT_TRANS_END): + { + p_env_plvl->power_actual = p_env_plvl->tgt_power_actual; + + // Inform application about state update + mm_srv_state_upd_ind_send(MM_STATE_GEN_POWER_ACTUAL, p_env_plvl->env.elmt_idx, + p_env_plvl->power_actual, 0); + + if (p_env_plvl->power_actual != 0) + { + p_env_plvl->power_last = p_env_plvl->power_actual; + } + + // Check if a status message must be sent + mm_gens_plvl_check_status_rsp(p_env_plvl); + + // Send a publication + mm_gens_plvl_publish(p_env_plvl); + } break; + + case (MM_GRP_EVENT_GROUP_FULL): + { + // Set Generic Level state value + mm_bind_set_state(p_env_plvl->env.grp_lid, MM_STATE_TYPE_CURRENT, + MM_ID_GENS_LVL, 0x8000); + } break; + + //case (MM_GRP_EVENT_TRANS_ABORTED): + default: + { + } break; + } +} + +/** + **************************************************************************************** + * @brief Callback function provided to the Binding Manager so that Generic Power Level state + * value can be set by main model of the group + * + * @param[in] mdl_lid Model Local Index + * @param[in] type Type + * @param[in] state State value + **************************************************************************************** + */ +__STATIC void mm_gens_plvl_cb_trans_req(m_lid_t main_mdl_lid, uint32_t req_model_id, uint8_t trans_type, + uint32_t state_delta) +{ + // Get environment for Generic Power Server model + mm_gens_plvl_env_t *p_env_plvl = (mm_gens_plvl_env_t *)mm_state_get_env(main_mdl_lid); + // Targeted Generic Power Actual state value + uint16_t tgt_power; + + if (req_model_id == MM_ID_GENS_OO) + { + // Requested Generic OnOff state value + uint8_t onoff = (uint8_t)state_delta; + + if (onoff == 0) + { + tgt_power = 0; + } + else + { + tgt_power = (p_env_plvl->power_dflt == 0) ? p_env_plvl->power_last + : p_env_plvl->power_dflt; + } + } + else // req_model_id == MM_ID_GENS_LVL + { + if (trans_type == MM_TRANS_TYPE_CLASSIC) + { + // Requested Generic Level state value + int16_t level = (int16_t)state_delta; + + // Generic Power Actual = Generic Level + 32768 + tgt_power = 32768 + level; + } + else // ((trans_type == MM_TRANS_TYPE_DELTA) || trans_type == MM_TRANS_TYPE_MOVE)) + { + // Delta value + int32_t delta; + + if (trans_type == MM_TRANS_TYPE_MOVE) + { + delta = (int16_t)state_delta; + + // Keep the provided delta value + p_env_plvl->move_delta = (int16_t)state_delta; + } + else + { + delta = (int32_t)state_delta; + } + + // Add the Generic Power Actual state value to the received delta value + delta += p_env_plvl->power_actual; + + // The Generic Power Actual state value cannot wrap + if (delta < 0) + { + tgt_power = 0; + } + else + { + tgt_power = (delta > 0xFFFF) ? 0xFFFF : (uint16_t)delta; + } + } + } + + // Check that new targeted Generic Power Actual state value is well within the set + // Generic Power Range state min and max values + if (tgt_power != 0) + { + // Ensure that Generic Power Actual state value is between Generic Power Range + // Min and Max values + if (tgt_power > p_env_plvl->power_max) + { + tgt_power = p_env_plvl->power_max; + } + else if (tgt_power < p_env_plvl->power_min) + { + tgt_power = p_env_plvl->power_min; + } + } + + // Check if Generic Power Actual state value is modified + if (tgt_power != p_env_plvl->power_actual) + { + p_env_plvl->tgt_power_actual = tgt_power; + + // Start a new transition + mm_bind_trans_new(p_env_plvl->env.grp_lid, trans_type, 0, 0); + } + else + { + // Reject the transition + mm_bind_trans_reject(p_env_plvl->env.grp_lid); + } +} + +__STATIC uint8_t mm_gens_plvls_register(uint8_t elmt_idx) +{ + // Register Generic Power Level Server model + m_lid_t mdl_lid = ms_register_model(MM_ID_GENS_PLVL, elmt_idx, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) + { + // Inform the Model State Manager about registered model + mm_gens_plvl_env_t *p_env_plvl = (mm_gens_plvl_env_t *)mm_state_register(elmt_idx, MM_ID_GENS_PLVL, mdl_lid, + MM_ROLE_SRV_PUBLI, + sizeof(mm_gens_plvl_env_t)); + + if (p_env_plvl) + { + // Get server-specific callback functions + //p_cb_srv = p_env_plvl->env.cb.u.p_cb_srv; + + // Initiate states + p_env_plvl->power_min = 1; + p_env_plvl->power_max = 0xFFFF; + + // Prepare environment for Replay Manager + p_env_plvl->replay_env.delay_ms = MM_GENS_PLVL_REPLAY_MS; + + // Prepare timer for publications + p_env_plvl->tmr_publi.cb = mm_gens_plvl_cb_tmr_publi; + //p_env_plvl->tmr_publi.p_env = (void *)p_env_plvl; + + // Set internal callback functions + p_env_plvl->env.mdl_cb.cb_rx = mm_gens_plvl_cb_rx; + p_env_plvl->env.mdl_cb.cb_opcode_check = mm_gens_plvl_cb_opcode_check; + //p_env_plvl->env.mdl_cb.cb_publish_param = mm_gens_plvl_cb_publish_param; + //p_cb_srv->cb_set = mm_gens_plvl_cb_set; + p_env_plvl->env.mdl_cb.cb_srv_set = mm_gens_plvl_cb_set; + + // Inform application about registered model + mm_register_ind_send(MM_ID_GENS_PLVL, elmt_idx, mdl_lid); + } + + // Register Generic Power Level Setup Server model + m_lid_t plvls_lid = ms_register_model(MM_ID_GENS_PLVLS, elmt_idx, 0); + + if (plvls_lid != MESH_INVALID_LID) + { + // Inform the Model State Manager about registered model + mm_gens_plvls_env_t *p_env_plvls = (mm_gens_plvls_env_t *)mm_state_register(elmt_idx, MM_ID_GENS_PLVLS, plvls_lid, + MM_ROLE_SRV, sizeof(mm_gens_plvls_env_t)); + + if (p_env_plvls) + { + // Set internal callback functions + p_env_plvls->env.mdl_cb.cb_rx = mm_gens_plvl_cb_rx; + p_env_plvls->env.mdl_cb.cb_opcode_check = mm_gens_plvl_cb_opcode_check; + + // Link environment + p_env_plvls->p_env_plvl = p_env_plvl; + + // Inform application about registered model + mm_register_ind_send(MM_ID_GENS_PLVLS, elmt_idx, plvls_lid); + } + } + } + + return (mdl_lid); +} + +/* + * GLOBAL FUNCTIONS + **************************************************************************************** + */ + +uint8_t mm_gens_plvl_register(uint8_t elmt_idx, bool main) +{ + m_lid_t mdl_lid = MESH_INVALID_LID; + m_lid_t oo_lid, lvl_lid, plvl_lid; + + do + { + // Register the Generic Power OnOff Server and Setup Server models + oo_lid = mm_gens_poo_register(elmt_idx, false); + if (oo_lid != MESH_INVALID_LID) + { + break; + } + + // Register the Generic Level Server model + lvl_lid = mm_gens_lvl_register(elmt_idx, false); + if (lvl_lid == MESH_INVALID_LID) + { + break; + } + + // Register the Generic Power Level Server and Setup models + plvl_lid = mm_gens_plvls_register(elmt_idx); + if (plvl_lid == MESH_INVALID_LID) + { + break; + } + + if (main) + { + // Create group and set Generic Power Level Server model as main model + m_lid_t grp_lid = mm_bind_add_group(2, elmt_idx, plvl_lid, + mm_gens_plvl_cb_grp_event, mm_gens_plvl_cb_trans_req); + + // Add Generic Level Server model to the group + mm_gens_oo_bind_group(grp_lid, lvl_lid); + + // Add Generic OnOff Server model to the group + mm_gens_oo_bind_group(grp_lid, oo_lid); + } + + mdl_lid = plvl_lid; + } while (0); + + return (mdl_lid); +} + +/// @} end of group diff --git a/mesh/model/gen/gens/mm_gens_poo.c b/mesh/model/gen/gens/mm_gens_poo.c new file mode 100644 index 0000000..1bc9ce3 --- /dev/null +++ b/mesh/model/gen/gens/mm_gens_poo.c @@ -0,0 +1,360 @@ +/** + **************************************************************************************** + * @file mm_gens_poo.c + * + * @brief Mesh Model Generic Power OnOff Server Module + * + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @addtogroup MM_GENS_POO + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mm_itf.h" +#include "mm_gens.h" + + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Structure for Generic Power OnOff Server model environment +typedef struct mm_gens_poo_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; + /// Timer for sending of publications + mesh_timer_t tmr_publi; + /// Publication period + uint32_t publi_period_ms; + + /// Generic OnPowerUp state value + uint8_t on_power_up; +} mm_gens_poo_env_t; + +/// Structure for Generic Power OnOff Setup Server model environment +typedef struct mm_gens_poos_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; + /// Pointer to environment of associated Generic Power OnOff Server model + mm_gens_poo_env_t *p_env_poo; +} mm_gens_poos_env_t; + +/* + * LOCAL FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Prepare and send a Generic OnPowerUp Status + * + * @param[in] p_env_poo Pointer to Generic Power OnOff Server model environment + **************************************************************************************** + */ +__STATIC void mm_gens_poo_send_status(mm_gens_poo_env_t *p_env_poo, mm_route_env_t *p_route_env) +{ + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_status = mm_route_buf_alloc(MM_GEN_POO_STATUS_LEN); + + if (p_buf_status) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_status); + // Get pointer to environment + mm_route_env_t *p_env = (mm_route_env_t *)&p_buf_status->env[0]; + + // Prepare environment + if (p_route_env) + { + memcpy(p_env, p_route_env, sizeof(mm_route_env_t)); + } + + p_env->opcode = MM_MSG_GEN_ONPUP_STATUS; + SETB(p_env->info, MM_ROUTE_INFO_PUBLISH, (p_route_env == NULL)); + SETB(p_env->info, MM_ROUTE_INFO_RX, 0); + + // Fill the message + *(p_data + MM_GEN_POO_STATUS_OPU_POS) = p_env_poo->on_power_up; + + // Send the message + mm_route_send(p_buf_status); + } +} + +/* + * MESSAGE HANDLERS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Handler for Generic OnPowerUp Set/Set Unacknowledged message + * + * @param[in] p_env_poo Pointer to environment for Generic OnPowerUp Server model + * @param[in] p_buf Pointer to received message content + * @param[in] p_route_env Pointer to structure containing reception parameters provided + * by the Mesh Profile block + **************************************************************************************** + */ +__STATIC void mm_gens_poo_handler_set(mm_gens_poo_env_t *p_env_poo, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + // Set pointer to received message + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Get received Generic OnPowerUp state value + uint8_t on_power_up = *(p_data + MM_GEN_POO_SET_OPU_POS); + + // Check received value + if (on_power_up <= MM_ON_POWER_UP_RESTORE) + { + // Check if state value has been changed + bool updated = (on_power_up != p_env_poo->on_power_up); + + if (updated) + { + // Keep the provided value + p_env_poo->on_power_up = on_power_up; + + // Inform application about received value + mm_srv_state_upd_ind_send(MM_STATE_GEN_ONPOWERUP, p_env_poo->env.elmt_idx, + on_power_up, 0); + } + + // Send the response + if (p_route_env->opcode == MM_MSG_GEN_ONPUP_SET) + { + mm_gens_poo_send_status(p_env_poo, p_route_env); + } + + // Send a publication if authorized + if (updated + && GETB(p_env_poo->env.info, MM_INFO_PUBLI)) + { + mm_gens_poo_send_status(p_env_poo, NULL); + } + } +} + +/* + * INTERNAL CALLBACK FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Callback function called when timer monitoring publication duration for + * Generic Power OnOff Server model expires + * + * @param[in] p_env Pointer to model environment for Generic Power OnOff Server + * model + **************************************************************************************** + */ +__STATIC void mm_gens_poo_cb_tmr_publi(void *p_tmr) +{ + // Get allocated environment + mm_gens_poo_env_t *p_env_poo = MESH_TMR2ENV(p_tmr, mm_gens_poo_env_t, tmr_publi); + + if (p_env_poo->publi_period_ms) + { + // Publish a Generic OnPowerUp Status message + mm_gens_poo_send_status(p_env_poo, NULL); + + // Restart the timer + mesh_timer_set(&p_env_poo->tmr_publi, p_env_poo->publi_period_ms); + } +} + +/** + **************************************************************************************** + * @brief Inform Generic Power OnOff Server model about a received message + * + * @param[in] p_env Pointer to the environment allocated for the Generic Power OnOff + * Server model + * @param[in] p_buf Pointer to the buffer containing the received message + * @param[in] p_route_env Pointer to structure containing reception parameters provided + * by the Mesh Profile block + **************************************************************************************** + */ +__STATIC void mm_gens_poo_cb_rx(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + if (p_route_env->opcode != MM_MSG_GEN_ONPUP_GET) + { + // Environment for Generic Power OnOff Setup Server model + mm_gens_poos_env_t *p_env_poos = (mm_gens_poos_env_t *)p_env; + + // Handle Generic OnPowerUp Set/Set Unacknowledged message + mm_gens_poo_handler_set(p_env_poos->p_env_poo, p_buf, p_route_env); + } + else + { + // Send a Generic OnPowerUp Status message + mm_gens_poo_send_status((mm_gens_poo_env_t *)p_env, p_route_env); + } +} + +/** + **************************************************************************************** + * @brief Check if a given opcode is handled by the Generic Power OnOff Server model + * + * @param[in] p_env Pointer to the environment allocated for the Generic Power OnOff + * Server model + * @param[in] opcode Opcode to check + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_gens_poo_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status = MESH_ERR_MDL_INVALID_OPCODE; + + if (p_env->model_id == MM_ID_GENS_POO) + { + if (opcode == MM_MSG_GEN_ONPUP_GET) + { + status = MESH_ERR_NO_ERROR; + } + } + else if (p_env->model_id == MM_ID_GENS_POOS) + { + if ((opcode == MM_MSG_GEN_ONPUP_SET) + || (opcode == MM_MSG_GEN_ONPUP_SET_UNACK)) + { + status = MESH_ERR_NO_ERROR; + } + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Set Generic OnPowerUp state value + * + * @param[in] p_env Pointer the the environment allocated for the Generic OnOff + * Server model + * @param[in] on_power_up Generic OnPowerUp state value + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_gens_poo_cb_set(mm_mdl_env_t *p_env, uint16_t state_id, + uint32_t state) +{ + // Returned status + uint8_t status = MESH_ERR_NO_ERROR; + // Generic OnPowerUp state value + uint8_t on_power_up = state; + + // Check provided value + if (on_power_up <= MM_ON_POWER_UP_RESTORE) + { + // Get environment for the Generic Power OnOff Server model + mm_gens_poo_env_t *p_env_poo = (mm_gens_poo_env_t *)p_env; + + // Keep the provided value + p_env_poo->on_power_up = on_power_up; + } + else + { + status = MESH_ERR_INVALID_PARAM; + } + + return (status); +} + +/* + * GLOBAL FUNCTIONS + **************************************************************************************** + */ + +__STATIC uint8_t mm_gens_poos_register(uint8_t elmt_idx) +{ + // Register Generic Power OnOff Server model + m_lid_t mdl_lid = ms_register_model(MM_ID_GENS_POO, elmt_idx, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) + { + // Inform the Model State Manager about registered model + mm_gens_poo_env_t *p_env_poo = (mm_gens_poo_env_t *)mm_state_register(elmt_idx, MM_ID_GENS_POO, mdl_lid, + MM_ROLE_SRV_PUBLI, sizeof(mm_gens_poo_env_t)); + + if (p_env_poo) + { + // Get server-specific callback functions + //p_cb_srv = p_env_poo->env.cb.u.p_cb_srv; + + // Prepare timer for publications + p_env_poo->tmr_publi.cb = mm_gens_poo_cb_tmr_publi; + //p_env_poo->tmr_publi.p_env = (void *)p_env_poo; + + // Set internal callback functions + p_env_poo->env.mdl_cb.cb_rx = mm_gens_poo_cb_rx; + p_env_poo->env.mdl_cb.cb_opcode_check = mm_gens_poo_cb_opcode_check; + //p_env_poo->env.mdl_cb.cb_publish_param = mm_gens_poo_cb_publish_param; + //p_cb_srv->cb_set = mm_gens_poo_cb_set; + p_env_poo->env.mdl_cb.cb_srv_set = mm_gens_poo_cb_set; + + // Inform application about registered model + mm_register_ind_send(MM_ID_GENS_POO, elmt_idx, mdl_lid); + } + + // Register Generic Power OnOff Setup Server model + m_lid_t poos_lid = ms_register_model(MM_ID_GENS_POOS, elmt_idx, 0); + + if (poos_lid != MESH_INVALID_LID) + { + // Inform the Model State Manager about registered model + mm_gens_poos_env_t *p_env_poos = (mm_gens_poos_env_t *)mm_state_register(elmt_idx, MM_ID_GENS_POOS, poos_lid, + MM_ROLE_SRV, sizeof(mm_gens_poos_env_t)); + + if (p_env_poos) + { + // Set internal callback functions + p_env_poos->env.mdl_cb.cb_rx = mm_gens_poo_cb_rx; + p_env_poos->env.mdl_cb.cb_opcode_check = mm_gens_poo_cb_opcode_check; + + // Link environment + p_env_poos->p_env_poo = p_env_poo; + + // Inform application about registered model + mm_register_ind_send(MM_ID_GENS_POOS, elmt_idx, poos_lid); + } + } + } + + return (mdl_lid); +} + +uint8_t mm_gens_poo_register(uint8_t elmt_idx, bool main) +{ + // Add Generic OnOff Server model if not already present + m_lid_t mdl_lid = mm_gens_oo_register(elmt_idx, main); + + if (mdl_lid != MESH_INVALID_LID) + { + // Register Generic Power OnOff Server and Setup model + m_lid_t poo_lid = mm_gens_poos_register(elmt_idx); + + if (poo_lid != MESH_INVALID_LID) + { + + } + } + + return mdl_lid; +} + +/// @} end of group diff --git a/mesh/model/gen/gens/mm_gens_prop.c b/mesh/model/gen/gens/mm_gens_prop.c new file mode 100644 index 0000000..24910f6 --- /dev/null +++ b/mesh/model/gen/gens/mm_gens_prop.c @@ -0,0 +1,1529 @@ +/** + **************************************************************************************** + * @file mm_gens_prop.c + * + * @brief Mesh Model Generic User/Admin/Manufacturer/Client Property Server Module + * + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @addtogroup MM_GENS_PROP + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mm_itf.h" +#include "mm_gens.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Length of Property ID field +#define MM_GENS_PROP_ID_LENGTH (2) +/// Length of User Access field +#define MM_GENS_PROP_ACCESS_LENGTH (1) +/// Timeout timer duration in milliseconds (5s) +#define MM_GENS_PROP_TMR_TO_DUR (5000) + +/* + * ENUMERATION + **************************************************************************************** + */ + +/// Access bitfield content +enum mm_gens_prop_access_bf +{ + /// Readable + MM_GENS_PROP_ACCESS_READ_POS = 0, + MM_GENS_PROP_ACCESS_READ_BIT = (1 << MM_GENS_PROP_ACCESS_READ_POS), + + /// Writable + MM_GENS_PROP_ACCESS_WRITE_POS = 1, + MM_GENS_PROP_ACCESS_WRITE_BIT = (1 << MM_GENS_PROP_ACCESS_WRITE_POS), +}; + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Buffer environment for buffer containing a stored message +typedef struct mm_gens_prop_buf_env +{ + /// Routing environment + mm_route_env_t route_env; + /// Type of request that has been received (User, Admin, Manufacturer) + uint8_t type; + /// Set (> 0) or get request + uint8_t set; + /// Set a status to acknowledge reception of message + uint8_t ack; + /// Type of property + uint8_t prop_type; + /// Property ID + uint16_t prop_id; + /// Element Index + uint8_t elmt_idx; + /// Property Index + uint8_t prop_idx; +} mm_gens_prop_buf_env_t; + +/// General environment for Generic Property models +typedef struct mm_gens_prop_env +{ + /// List of received messages waiting to be handled + list_t list_msg_rx; + /// Timer for detection of application timeout + mesh_timer_t tmr_to; + /// Delayed job structure + mesh_djob_t djob; + + /// Total number of user properties + uint16_t nb_prop_user; + /// Number of stored received messages (not higher than MM_GENS_PROP_STORED_MSG_MAX) + uint8_t nb_msg_rx; + /// Local index for Generic User Property Server model + m_lid_t mdl_lid_user; + /// Local index for Generic Admin Property Server model + m_lid_t mdl_lid_admin; + /// Local index for Generic Manufacturer Property Server model + m_lid_t mdl_lid_manuf; + /// Number of message that can be stored in the list + uint8_t queue_len; +} mm_gens_prop_env_t; + +/// Environment common for Generic User/Admin/Manufacturer Property models +typedef struct mm_gens_prop_common_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; + /// Pointer to environment allocated for all Generic Property models + mm_gens_prop_env_t *p_env_prop; +} mm_gens_prop_common_env_t; + +/// Structure for Generic User/Admin/Manufacturer Property Server model environment +typedef struct mm_gens_prop_full_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; + /// Pointer to environment allocated for all Generic Property models - DO NOT MOVE + mm_gens_prop_env_t *p_env_prop; + + /// Number of Generic Admin Property states + uint8_t nb_prop; + /// Generic Admin Property states + mm_prop_t prop[]; +} mm_gens_prop_full_env_t; + +/// Structure for Generic Client Property Server model environment +typedef struct mm_gens_prop_cli_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; + + /// Number of Generic Client Property states + uint8_t nb_prop; + /// Generic Client Property states + uint16_t prop[]; +} mm_gens_prop_cli_env_t; + +/* + * LOCAL FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Look for Generic Property information in a list of Generic Properties. + * Properties are sorted in ascending order, dichotomy is used. + * + * @param[in] prop_id Property ID to look for + * @param[in] p_env_prop Pointer to environment for the model + * @param[out] p_prop_idx Pointer at which index of found property must be returned + * @param[out] p_access Pointer at which user access of found property must be returned + * + * @return True if indicated property has been found, else False + **************************************************************************************** + */ +__STATIC bool mm_gens_prop_find(uint16_t prop_id, mm_gens_prop_full_env_t *p_env_prop, + uint8_t *p_prop_idx, uint8_t *p_access) +{ + // Position + uint8_t pos = p_env_prop->nb_prop; + + if (pos == 1) + { + if (p_env_prop->prop[0].prop_id == prop_id) + { + pos = 0; + } + } + else + { + // Start index + uint16_t start = 0; + // End index + uint16_t end = p_env_prop->nb_prop - 1; + + while (true) + { + // Checked index + uint16_t idx = start + ((end - start) >> 1); + + if (p_env_prop->prop[idx].prop_id == prop_id) + { + pos = idx; + break; + } + + if (start == end) + { + break; + } + + if (p_env_prop->prop[idx].prop_id < prop_id) + { + start = idx; + } + else + { + end = idx; + } + + if (end == (start + 1)) + { + if (p_env_prop->prop[start].prop_id == prop_id) + { + pos = start; + } + else if (p_env_prop->prop[end].prop_id == prop_id) + { + pos = end; + } + break; + } + } + } + + if (pos != p_env_prop->nb_prop) + { + // Return user access and position + if (p_access) + { + *p_access = p_env_prop->prop[pos].user_access; + } + *p_prop_idx = pos; + } + + // Return if property has been found + return (pos != p_env_prop->nb_prop); +} + +/** + **************************************************************************************** + * @brief Send a Generic User/Admin/Manufacturer Properties Status message + * + * @param[in] p_route_env Pointer to the routing environment for the received get + * request + * @param[in] type Status type + * @param[in] p_env_prop Pointer to the environment for the model + **************************************************************************************** + */ +__STATIC void mm_gens_prop_send_status_list(mm_route_env_t *p_route_env, uint8_t type, + mm_gens_prop_full_env_t *p_env_prop) +{ + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_status; + // Environment common for all Generic Property models + mm_gens_prop_env_t *p_env_common = p_env_prop->p_env_prop; + // Number of Property IDs + uint16_t nb_prop; + + // Get number of Property IDs + if (type == MM_PROP_TYPE_USER) + { + nb_prop = p_env_common->nb_prop_user; + } + else + { + nb_prop = p_env_prop->nb_prop; + } + + p_buf_status = mm_route_buf_alloc_status(MM_GENS_PROP_ID_LENGTH * nb_prop, p_route_env); + if (p_buf_status) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_status); + // Get pointer to environment + mm_route_env_t *p_env = (mm_route_env_t *)&p_buf_status->env[0]; + // Counter + uint16_t cnt; + + if (type == MM_PROP_TYPE_USER) + { + p_env->opcode = MM_MSG_GEN_UPROPS_STATUS; + } + else if (type == MM_PROP_TYPE_ADMIN) + { + p_env->opcode = MM_MSG_GEN_APROPS_STATUS; + } + else // (type == MM_PROP_TYPE_MANUF) + { + p_env->opcode = MM_MSG_GEN_MPROPS_STATUS; + } + SETB(p_env->info, MM_ROUTE_INFO_PUBLISH, 0); + SETB(p_env->info, MM_ROUTE_INFO_RX, 0); + + // Fill the message + for (cnt = 0; cnt < p_env_prop->nb_prop; cnt++) + { + write16p(p_data, p_env_prop->prop[cnt].prop_id); + p_data += MM_GENS_PROP_ID_LENGTH; + } + + if (type == MM_PROP_TYPE_USER) + { + if (p_env_common->mdl_lid_manuf != MESH_INVALID_LID) + { + // Get environment for Generic Manufacturer Property Server model + mm_gens_prop_full_env_t *p_env_manuf + = (mm_gens_prop_full_env_t *)mm_state_get_env(p_env_common->mdl_lid_manuf); + + // Get Property ID of Manufacturer Properties that are User Properties + for (cnt = 0; cnt < p_env_manuf->nb_prop; cnt++) + { + if (p_env_manuf->prop[cnt].user_access != 0) + { + write16p(p_data, p_env_manuf->prop[cnt].prop_id); + p_data += MM_GENS_PROP_ID_LENGTH; + } + } + } + + if (p_env_common->mdl_lid_admin != MESH_INVALID_LID) + { + // Get environment for Generic Admin Property Server model + mm_gens_prop_full_env_t *p_env_admin + = (mm_gens_prop_full_env_t *)mm_state_get_env(p_env_common->mdl_lid_admin); + + // Get Property ID of Admin Properties that are User Properties + for (cnt = 0; cnt < p_env_admin->nb_prop; cnt++) + { + if (p_env_admin->prop[cnt].user_access != 0) + { + write16p(p_data, p_env_admin->prop[cnt].prop_id); + p_data += MM_GENS_PROP_ID_LENGTH; + } + } + } + } + + // Send the message + mm_route_send(p_buf_status); + } +} + +/** + **************************************************************************************** + * @brief Send a Generic Client Properties Status message + * + * @param[in] p_route_env Pointer to the routing environment for the received get + * request + * @param[in] p_env_prop Pointer to the environment for the model + **************************************************************************************** + */ +__STATIC void mm_gens_prop_send_status_list_cli(mm_route_env_t *p_route_env, + mm_gens_prop_cli_env_t *p_env_prop_cli) +{ + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_status; + // Status length + uint16_t length_status = MM_GENS_PROP_ID_LENGTH * p_env_prop_cli->nb_prop; + // Allocate a new buffer for the publication + p_buf_status = mm_route_buf_alloc_status(length_status, p_route_env); + + if (p_buf_status) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_status); + // Get pointer to environment + mm_route_env_t *p_env = (mm_route_env_t *)&p_buf_status->env[0]; + // Counter + uint8_t cnt; + + p_env->opcode = MM_MSG_GEN_CPROPS_STATUS; + SETB(p_env->info, MM_ROUTE_INFO_PUBLISH, 0); + SETB(p_env->info, MM_ROUTE_INFO_RX, 0); + + // Fill the message + for (cnt = 0; cnt < p_env_prop_cli->nb_prop; cnt++) + { + write16p(p_data, p_env_prop_cli->prop[cnt]); + p_data += MM_GENS_PROP_ID_LENGTH; + } + + // Send the message + mm_route_send(p_buf_status); + } +} + +/** + **************************************************************************************** + * @brief Send a Generic User/Admin/Manufacturer Property Status message + * + * @param[in] p_route_env Pointer to the routing environment for the received get + * request + * @param[in] type Status type + * @param[in] prop_id Property ID + * @param[in] found True if property has been found and is known + * @param[in] access User access + * @param[in] length Length of property value + * @param[in] p_val Pointer to the property value + **************************************************************************************** + */ +__STATIC void mm_gens_prop_send_status(mm_route_env_t *p_route_env, bool publish, uint8_t type, + uint16_t prop_id, bool found, uint8_t access, + uint8_t length, const uint8_t *p_val) +{ + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_status; + // Status message length + uint16_t length_status = MM_GEN_PROP_STATUS_MIN_LEN; + + if (found) + { + length_status += (length + 1); + } + + // Allocate a new buffer for the publication + p_buf_status = mm_route_buf_alloc_status(length_status, p_route_env); + + if (p_buf_status) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_status); + // Get pointer to environment + mm_route_env_t *p_env = (mm_route_env_t *)&p_buf_status->env[0]; + + if (type == MM_PROP_TYPE_USER) + { + p_env->opcode = MM_MSG_GEN_UPROP_STATUS; + } + else if (type == MM_PROP_TYPE_ADMIN) + { + p_env->opcode = MM_MSG_GEN_APROP_STATUS; + } + else if (type == MM_PROP_TYPE_MANUF) + { + p_env->opcode = MM_MSG_GEN_MPROP_STATUS; + } + SETB(p_env->info, MM_ROUTE_INFO_PUBLISH, publish); + + // Fill the message + write16p(p_data + MM_GEN_PROP_STATUS_ID_POS, prop_id); + + if (found) + { + *(p_data + MM_GEN_PROP_STATUS_ACCESS_POS) = access; + + if (p_val) + { + memcpy(p_data + MM_GEN_PROP_STATUS_VALUE_POS, p_val, length); + } + } + + // Send the message + mm_route_send(p_buf_status); + } +} + +/* + * MESSAGE HANDLING FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Handle received Generic User Properties Get or Generic User Property Get or Generic + * User Property Set or Generic User Property Set Unacknowledged + * + * @param[in] p_env_prop_user Pointer to the environment allocated for the Generic User + * Property Server model + * @param[in] p_buf Pointer to the buffer containing the received message + * @param[in] p_route_env Pointer to structure containing reception parameters provided + * by the Mesh Profile block + **************************************************************************************** + */ +__STATIC bool mm_gens_prop_handler_user(mm_gens_prop_full_env_t *p_env_prop_user, + mesh_buf_t *p_buf, mm_route_env_t *p_route_env) +{ + // Free the message + bool free_msg = true; + + if (p_route_env->opcode == MM_MSG_GEN_UPROPS_GET) + { + // Send a Generic User Properties Status message + mm_gens_prop_send_status_list(p_route_env, MM_PROP_TYPE_USER, p_env_prop_user); + } + else // MM_MSG_GEN_UPROP_GET || MM_MSG_GEN_UPROP_SET || MM_MSG_GEN_UPROP_SET_UNACK + { + do + { + // Pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Extract Property ID (same position in set and get messages) + uint16_t prop_id = read16p(p_data + MM_GEN_PROP_SET_USER_ID_POS); + // Property type, property index and user access rights + uint8_t prop_type, prop_idx, access; + // Indicate if indicated property has been found + bool found = true; + + if (prop_id == 0x0000) + { + break; + } + + // Look for indicated property + do + { + mm_gens_prop_env_t *p_env_prop; + + // Start by parsing list of Generic User Properties + if (mm_gens_prop_find(prop_id, p_env_prop_user, &prop_idx, &access)) + { + prop_type = MM_PROP_TYPE_USER; + break; + } + + p_env_prop = p_env_prop_user->p_env_prop; + + // Not found, parse list of Generic Admin Properties if not empty + if (p_env_prop->mdl_lid_admin != MESH_INVALID_LID) + { + // Get environment for the Generic Admin Property Server model + mm_gens_prop_full_env_t *p_env_prop_admin + = (mm_gens_prop_full_env_t *)mm_state_get_env(p_env_prop->mdl_lid_admin); + + if (mm_gens_prop_find(prop_id, p_env_prop_admin, &prop_idx, &access)) + { + prop_type = MM_PROP_TYPE_ADMIN; + break; + } + } + + // Not found, parse list of Generic Manufacturer Properties if not empty + if (p_env_prop->mdl_lid_manuf != MESH_INVALID_LID) + { + // Get environment for the Generic Manufacturer Property Server model + mm_gens_prop_full_env_t *p_env_prop_manuf + = (mm_gens_prop_full_env_t *)mm_state_get_env(p_env_prop->mdl_lid_manuf); + + if (mm_gens_prop_find(prop_id, p_env_prop_manuf, &prop_idx, &access)) + { + prop_type = MM_PROP_TYPE_MANUF; + break; + } + } + + found = false; + } while (0); + + if (found) + { + // Pointer to buffer environment + mm_gens_prop_buf_env_t *p_buf_env = (mm_gens_prop_buf_env_t *)&p_buf->env[0]; + + // Fill buffer environment + p_buf_env->elmt_idx = p_env_prop_user->env.elmt_idx; + p_buf_env->prop_id = prop_id; + p_buf_env->prop_idx = prop_idx; + p_buf_env->prop_type = prop_type; + p_buf_env->type = MM_PROP_TYPE_USER; + p_buf_env->set = (p_route_env->opcode != MM_MSG_GEN_UPROP_GET); + p_buf_env->ack = (p_route_env->opcode != MM_MSG_GEN_UPROP_SET_UNACK); + + if (!p_buf_env->set) + { + if (GETB(access, MM_GENS_PROP_ACCESS_READ)) + { + // Inform the application about received get request + mm_srv_prop_get_send(p_buf_env->elmt_idx, prop_type, prop_id); + free_msg = false; + break; + } + } + else + { + if (GETB(access, MM_GENS_PROP_ACCESS_WRITE)) + { + // Get property value length + uint16_t length = p_buf->data_len - MM_GEN_PROP_SET_USER_VAL_POS; + // Get pointer to property value + uint8_t *p_val = p_data + MM_GEN_PROP_SET_USER_VAL_POS; + + // Inform the application about received set request + mm_srv_prop_set_send(p_buf_env->elmt_idx, prop_type, prop_id, length, p_val); + free_msg = false; + break; + } + } + } + + // Error detected, send a Generic User Property Status message + mm_gens_prop_send_status(p_route_env, false, MM_PROP_TYPE_USER, prop_id, false, 0, 0, NULL); + } while (0); + } + + return (free_msg); +} + +/** + **************************************************************************************** + * @brief Handle received Generic Admin Properties Get or Generic Admin Property Get or Generic + * Admin Property Set or Generic Admin Property Set Unacknowledged + * + * @param[in] p_env_prop_admin Pointer to the environment allocated for the Generic Admin + * Property Server model + * @param[in] p_buf Pointer to the buffer containing the received message + * @param[in] p_route_env Pointer to structure containing reception parameters provided + * by the Mesh Profile block + **************************************************************************************** + */ +__STATIC bool mm_gens_prop_handler_admin(mm_gens_prop_full_env_t *p_env_prop_admin, + mesh_buf_t *p_buf, mm_route_env_t *p_route_env) +{ + // Free the message + bool free_msg = true; + + if (p_route_env->opcode == MM_MSG_GEN_APROPS_GET) + { + // Send a Generic Admin Properties Status message + mm_gens_prop_send_status_list(p_route_env, MM_PROP_TYPE_ADMIN, p_env_prop_admin); + } + else // MM_MSG_GEN_APROP_GET || MM_MSG_GEN_APROP_SET || MM_MSG_GEN_APROP_SET_UNACK + { + // Pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Extract Property ID (same position in set and get messages) + uint16_t prop_id = read16p(p_data + MM_GEN_PROP_SET_ADMIN_ID_POS); + // Property index + uint8_t prop_idx; + + if (prop_id != 0x0000) + { + if (mm_gens_prop_find(prop_id, p_env_prop_admin, &prop_idx, NULL)) + { + // Pointer to buffer environment + mm_gens_prop_buf_env_t *p_buf_env = (mm_gens_prop_buf_env_t *)&p_buf->env[0]; + + // Fill buffer environment + p_buf_env->elmt_idx = p_env_prop_admin->env.elmt_idx; + p_buf_env->prop_id = prop_id; + p_buf_env->prop_idx = prop_idx; + p_buf_env->prop_type = MM_PROP_TYPE_ADMIN; + p_buf_env->type = MM_PROP_TYPE_ADMIN; + p_buf_env->set = (p_route_env->opcode != MM_MSG_GEN_APROP_GET); + p_buf_env->ack = (p_route_env->opcode != MM_MSG_GEN_APROP_SET_UNACK); + + if (!p_buf_env->set) + { + // Inform the application about received get request + mm_srv_prop_get_send(p_buf_env->elmt_idx, MM_PROP_TYPE_ADMIN, prop_id); + free_msg = false; + } + else + { + // Get User Access + uint8_t access = *(p_data + MM_GEN_PROP_SET_ADMIN_ACCESS_POS); + + // Check that user access value is valid + if ((access & ~(MM_GENS_PROP_ACCESS_READ_BIT | MM_GENS_PROP_ACCESS_WRITE_BIT)) == 0) + { + // Get property value length + uint16_t length = p_buf->data_len - MM_GEN_PROP_SET_ADMIN_VAL_POS; + // Get pointer to property value + uint8_t *p_val = p_data + MM_GEN_PROP_SET_ADMIN_VAL_POS; + + // Decrease number of User Properties if property is a User Property + if (p_env_prop_admin->prop[prop_idx].user_access != 0) + { + p_env_prop_admin->p_env_prop->nb_prop_user--; + } + + // Update user access + p_env_prop_admin->prop[prop_idx].user_access = access; + + // Increase number of User Properties if property is a User Property + if (access != 0) + { + p_env_prop_admin->p_env_prop->nb_prop_user++; + } + + // Inform the application about received set request + mm_srv_prop_set_send(p_buf_env->elmt_idx, MM_PROP_TYPE_ADMIN, + prop_id, length, p_val); + free_msg = false; + } + } + } + else + { + // Send a Generic Admin Property Status message + mm_gens_prop_send_status(p_route_env, false, MM_PROP_TYPE_ADMIN, prop_id, + false, 0, 0, NULL); + } + } + } + + return (free_msg); +} + +/** + **************************************************************************************** + * @brief Handle received Generic Manufacturer Properties Get or Generic Manufacturer Property + * Get or Generic Manufacturer Property Set or Generic Manufacturer Property Set Unacknowledged + * + * @param[in] p_env_prop_manuf Pointer to the environment allocated for the Generic + * Manufacturer Property Server model + * @param[in] p_buf Pointer to the buffer containing the received message + * @param[in] p_route_env Pointer to structure containing reception parameters provided + * by the Mesh Profile block + **************************************************************************************** + */ +__STATIC bool mm_gens_prop_handler_manuf(mm_gens_prop_full_env_t *p_env_prop_manuf, + mesh_buf_t *p_buf, mm_route_env_t *p_route_env) +{ + // Free the message + bool free_msg = true; + + if (p_route_env->opcode == MM_MSG_GEN_MPROPS_GET) + { + // Send a Generic Manufacturer Properties Status message + mm_gens_prop_send_status_list(p_route_env, MM_PROP_TYPE_MANUF, p_env_prop_manuf); + } + else // MM_MSG_GEN_MPROP_GET || MM_MSG_GEN_MPROP_SET || MM_MSG_GEN_MPROP_SET_UNACK + { + // Pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Extract Property ID (same position in set and get messages) + uint16_t prop_id = read16p(p_data + MM_GEN_PROP_SET_MANUF_ID_POS); + // Property index + uint8_t prop_idx; + + if (prop_id != 0x0000) + { + if (mm_gens_prop_find(prop_id, p_env_prop_manuf, &prop_idx, NULL)) + { + // Pointer to buffer environment + mm_gens_prop_buf_env_t *p_buf_env = (mm_gens_prop_buf_env_t *)&p_buf->env[0]; + + // Fill buffer environment + p_buf_env->elmt_idx = p_env_prop_manuf->env.elmt_idx; + p_buf_env->prop_id = prop_id; + p_buf_env->prop_idx = prop_idx; + p_buf_env->prop_type = MM_PROP_TYPE_MANUF; + p_buf_env->type = MM_PROP_TYPE_MANUF; + p_buf_env->set = (p_route_env->opcode != MM_MSG_GEN_MPROP_GET); + p_buf_env->ack = (p_route_env->opcode != MM_MSG_GEN_MPROP_SET_UNACK); + + if (!p_buf_env->set) + { + // Inform the application about received get request + mm_srv_prop_get_send(p_buf_env->elmt_idx, MM_PROP_TYPE_MANUF, prop_id); + free_msg = false; + } + else + { + // Get User Access + uint8_t access = *(p_data + MM_GEN_PROP_SET_MANUF_ACCESS_POS); + + // Check that user access value is valid + if ((access & ~MM_GENS_PROP_ACCESS_READ_BIT) == 0) + { + // Decrease number of User Properties if property is a User Property + if (p_env_prop_manuf->prop[prop_idx].user_access != 0) + { + p_env_prop_manuf->p_env_prop->nb_prop_user--; + } + + // Update user access + p_env_prop_manuf->prop[prop_idx].user_access = access; + + // Decrease number of User Properties if property is a User Property + if (access != 0) + { + p_env_prop_manuf->p_env_prop->nb_prop_user++; + } + + // Inform the application about received get request + mm_srv_prop_get_send(p_buf_env->elmt_idx, MM_PROP_TYPE_MANUF, prop_id); + free_msg = false; + } + } + } + else + { + // Send a Generic Manufacturer Property Status message + mm_gens_prop_send_status(p_route_env, false, MM_PROP_TYPE_MANUF, prop_id, + false, 0, 0, NULL); + } + } + } + + return (free_msg); +} + +/** + **************************************************************************************** + * @brief Extract first buffer from the list of stored received message. Release the buffer. + * Delay handling of next buffer in the list. + * + * @param[in] p_env_prop Pointer to general environment for the Generic Property models + **************************************************************************************** + */ +__STATIC void mm_gens_prop_msg_free(mm_gens_prop_env_t *p_env_prop) +{ + // Extract first buffer from the list + mesh_buf_t *p_buf = (mesh_buf_t *)list_pop_front(&p_env_prop->list_msg_rx); + + p_env_prop->nb_msg_rx--; + + // Release the buffer + mesh_buf_release(p_buf); + + // Delay processing of next stored buffer if needed + if (p_env_prop->nb_msg_rx) + { + mesh_djob_reg(&p_env_prop->djob); + } +} + +/** + **************************************************************************************** + * @brief Get first buffer from the list of stored received message. Process it + * + * @param[in] p_env_prop Pointer to general environment for the Generic Property models + **************************************************************************************** + */ +__STATIC void mm_gens_prop_msg_process_next(mm_gens_prop_env_t *p_env_prop) +{ + // Get first buffer in the list + mesh_buf_t *p_buf = (mesh_buf_t *)list_pick(&p_env_prop->list_msg_rx); + // Get environment provided by the Routing Manager + mm_route_env_t *p_route_env = (mm_route_env_t *)&p_buf->env[0]; + // Indicate if message can be freed + bool free_msg = true; + + // Call the appropriate handler + switch (p_route_env->opcode) + { + case (MM_MSG_GEN_UPROPS_GET): + case (MM_MSG_GEN_UPROP_GET): + case (MM_MSG_GEN_UPROP_SET): + case (MM_MSG_GEN_UPROP_SET_UNACK): + { + // Get environment allocated for the Generic User Property Server model + mm_gens_prop_full_env_t *p_env_user + = (mm_gens_prop_full_env_t *)mm_state_get_env(p_env_prop->mdl_lid_user); + + free_msg = mm_gens_prop_handler_user(p_env_user, p_buf, p_route_env); + } break; + + case (MM_MSG_GEN_APROPS_GET): + case (MM_MSG_GEN_APROP_GET): + case (MM_MSG_GEN_APROP_SET): + case (MM_MSG_GEN_APROP_SET_UNACK): + { + if (p_env_prop->mdl_lid_admin != MESH_INVALID_LID) + { + // Get environment allocated for the Generic Admin Property Server model + mm_gens_prop_full_env_t *p_env_admin + = (mm_gens_prop_full_env_t *)mm_state_get_env(p_env_prop->mdl_lid_admin); + + free_msg = mm_gens_prop_handler_admin(p_env_admin, p_buf, p_route_env); + } + } break; + + case (MM_MSG_GEN_MPROPS_GET): + case (MM_MSG_GEN_MPROP_GET): + case (MM_MSG_GEN_MPROP_SET): + case (MM_MSG_GEN_MPROP_SET_UNACK): + { + if (p_env_prop->mdl_lid_manuf != MESH_INVALID_LID) + { + // Get environment allocated for the Generic Manufacturer Property Server model + mm_gens_prop_full_env_t *p_env_manuf + = (mm_gens_prop_full_env_t *)mm_state_get_env(p_env_prop->mdl_lid_manuf); + + free_msg = mm_gens_prop_handler_manuf(p_env_manuf, p_buf, p_route_env); + } + } break; + + default: + { + } break; + } + + if (free_msg) + { + // Free the message + mm_gens_prop_msg_free(p_env_prop); + } + else + { + // Start timeout timer + mesh_timer_set(&p_env_prop->tmr_to, MM_GENS_PROP_TMR_TO_DUR); + } +} + +/* + * INTERNAL CALLBACK FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Check if a given opcode is handled by the Generic User Property Server model + * + * @param[in] p_env Pointer to the environment allocated for the Generic User Property + * Server model + * @param[in] opcode Opcode to check + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_gens_prop_user_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status; + + if ((opcode == MM_MSG_GEN_UPROPS_GET) + || (opcode == MM_MSG_GEN_UPROP_GET) + || (opcode == MM_MSG_GEN_UPROP_SET) + || (opcode == MM_MSG_GEN_UPROP_SET_UNACK)) + { + status = MESH_ERR_NO_ERROR; + } + else + { + status = MESH_ERR_MDL_INVALID_OPCODE; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Check if a given opcode is handled by the Generic Admin Property Server model + * + * @param[in] p_env Pointer to the environment allocated for the Generic Admin Property + * Server model + * @param[in] opcode Opcode to check + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_gens_prop_admin_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status; + + if ((opcode == MM_MSG_GEN_APROPS_GET) + || (opcode == MM_MSG_GEN_APROP_GET) + || (opcode == MM_MSG_GEN_APROP_SET) + || (opcode == MM_MSG_GEN_APROP_SET_UNACK)) + { + status = MESH_ERR_NO_ERROR; + } + else + { + status = MESH_ERR_MDL_INVALID_OPCODE; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Check if a given opcode is handled by the Generic Manufacturer Property Server model + * + * @param[in] p_env Pointer to the environment allocated for the Generic Manufacturer + * Property Server model + * @param[in] opcode Opcode to check + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_gens_prop_manuf_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status; + + if ((opcode == MM_MSG_GEN_MPROPS_GET) + || (opcode == MM_MSG_GEN_MPROP_GET) + || (opcode == MM_MSG_GEN_MPROP_SET) + || (opcode == MM_MSG_GEN_MPROP_SET_UNACK)) + { + status = MESH_ERR_NO_ERROR; + } + else + { + status = MESH_ERR_MDL_INVALID_OPCODE; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Inform Generic Client Property Server model about a received message + * + * @param[in] p_env Pointer to the environment allocated for the Generic Client Property + * Server model + * @param[in] p_buf Pointer to the buffer containing the received message + * @param[in] p_route_env Pointer to structure containing reception parameters provided + * by the Mesh Profile block + **************************************************************************************** + */ +__STATIC void mm_gens_prop_cli_cb_rx(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + // Get environment allocated for Generic Client Property Server model + mm_gens_prop_cli_env_t *p_env_prop_cli = (mm_gens_prop_cli_env_t *)p_env; + + // Send a Generic Client Properties Status message + mm_gens_prop_send_status_list_cli(p_route_env, p_env_prop_cli); +} + +/** + **************************************************************************************** + * @brief Check if a given opcode is handled by the Generic Client Property Server model + * + * @param[in] p_env Pointer to the environment allocated for the Generic Client Property + * Server model + * @param[in] opcode Opcode to check + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_gens_prop_cli_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status; + + if (opcode == MM_MSG_GEN_CPROPS_GET) + { + status = MESH_ERR_NO_ERROR; + } + else + { + status = MESH_ERR_MDL_INVALID_OPCODE; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Inform Generic User/Admin/Manufacturer/Client Property Server model about a received + * message + * + * @param[in] p_env Pointer to the environment allocated for the Generic Battery + * Server model + * @param[in] p_buf Pointer to the buffer containing the received message + * @param[in] p_route_env Pointer to structure containing reception parameters provided + * by the Mesh Profile block + **************************************************************************************** + */ +__STATIC void mm_gens_prop_cb_rx(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + // Map structure common for all kind of environments + mm_gens_prop_common_env_t *p_env_common = (mm_gens_prop_common_env_t *)p_env; + // Get environment allocated for the Generic Property models + mm_gens_prop_env_t *p_env_prop = p_env_common->p_env_prop; + + // Check that list of received messages is not full + if (p_env_prop->nb_msg_rx < p_env_prop->queue_len) + { + // Buffer that will contain a copy of the message + mesh_buf_t *p_buf_cpy; + // Allocate a buffer + p_buf_cpy = mesh_buf_alloc(p_buf->head_len, p_buf->data_len, p_buf->tail_len); + + if (p_buf_cpy) + { + // Copy received message + //uint8_t status = mesh_buf_copy(p_buf, p_buf_cpy, p_buf->data_len, false); + mesh_buf_copy_data(p_buf_cpy, p_buf, p_buf->data_len); + + //if (status == MESH_ERR_NO_ERROR) + { + // Copy environment provided by the Routing Manager + memcpy(&p_buf_cpy->env[0], p_route_env, sizeof(mm_route_env_t)); + + // Store the buffer containing the copy of the received message + list_push_back(&p_env_prop->list_msg_rx, &p_buf_cpy->hdr); + p_env_prop->nb_msg_rx++; + + // If message is the first in the list, process it + if (p_env_prop->nb_msg_rx == 1) + { + mm_gens_prop_msg_process_next(p_env_prop); + } + } + } + } + // else drop the message +} + +/** + **************************************************************************************** + * @brief Callback function used for delaying of a task + **************************************************************************************** + */ +__STATIC void mm_gens_prop_cb_djob(void *p_djob) +{ + // Get environment allocated for the Generic Property models + mm_gens_prop_env_t *p_env_prop = MESH_DJOB2ENV(p_djob, mm_gens_prop_env_t, djob); + + // Handle next message + if (p_env_prop->nb_msg_rx) + { + mm_gens_prop_msg_process_next(p_env_prop); + } +} + +/** + **************************************************************************************** + * @brief Callback function used for timeout timer when waiting for a confirmation from the + * application. + **************************************************************************************** + */ +__STATIC void mm_gens_prop_cb_tmr_to(void *p_tmr) +{ + mm_gens_prop_env_t *p_env_prop = MESH_TMR2ENV(p_tmr, mm_gens_prop_env_t, tmr_to); + // Free first message in the queue + mm_gens_prop_msg_free(p_env_prop); +} + +/* + * LOCAL FUNCTIONS (REGISTRATION) + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Register Generic User Property Server model + * + * @param[in] elmt_idx Element index + * @param[in] nb_prop_user Number of Generic User Property states + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_gens_prop_register_user(uint8_t elmt_idx, uint8_t nb_prop_user, mm_prop_t *p_props, + m_lid_t *p_mdl_lid, mm_gens_prop_env_t **pp_env_prop) +{ + // Returned status + uint8_t status = MESH_ERR_COMMAND_DISALLOWED; + // Environment length + uint16_t env_length + = sizeof(mm_gens_prop_full_env_t) + nb_prop_user * sizeof(mm_prop_t) + + sizeof(mm_gens_prop_env_t); + + // Register Generic User Property Server model + *p_mdl_lid = ms_register_model(MM_ID_GENS_UPROP, elmt_idx, MM_CFG_PUBLI_AUTH_BIT); + + if (*p_mdl_lid != MESH_INVALID_LID) //if (status == MESH_ERR_NO_ERROR) + { + // Inform the Model State Manager about registered model + mm_gens_prop_full_env_t *p_env_prop_user = (mm_gens_prop_full_env_t *)mm_state_register(elmt_idx, MM_ID_GENS_UPROP, *p_mdl_lid, MM_ROLE_SRV_PUBLI, + env_length); + + if (p_env_prop_user) + { + // Keep number of properties + p_env_prop_user->nb_prop = nb_prop_user; + + // Keep property information + memcpy(&p_env_prop_user->prop[0], p_props, nb_prop_user * sizeof(mm_prop_t)); + + // Set internal callback functions + p_env_prop_user->env.mdl_cb.cb_rx = mm_gens_prop_cb_rx; + p_env_prop_user->env.mdl_cb.cb_opcode_check = mm_gens_prop_user_cb_opcode_check; + //p_env_prop_user->env.mdl_cb.cb_publish_param = mm_gens_prop_cb_publish_param; + + status = MESH_ERR_NO_ERROR; + // Inform application about registered model + mm_register_ind_send(MM_ID_GENS_UPROP, elmt_idx, *p_mdl_lid); + + // Return address of general environment + p_env_prop_user->p_env_prop = (mm_gens_prop_env_t *)((uint32_t)p_env_prop_user + + sizeof(mm_gens_prop_full_env_t) + + (nb_prop_user * sizeof(mm_prop_t))); + *pp_env_prop = p_env_prop_user->p_env_prop; + p_env_prop_user->p_env_prop->nb_prop_user = nb_prop_user; + } + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Register Generic Admin Property Server model + * + * @param[in] elmt_idx Element index + * @param[in] nb_prop_admin Number of Generic Admin Property states + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_gens_prop_register_admin(uint8_t elmt_idx, uint8_t nb_prop_admin, + mm_prop_t *p_props, mm_gens_prop_env_t *p_env_prop) +{ + // Returned status + uint8_t status = MESH_ERR_COMMAND_DISALLOWED; + // Environment length + uint16_t env_length + = sizeof(mm_gens_prop_full_env_t) + nb_prop_admin * sizeof(mm_prop_t); + // Register Generic Admin Property Server model + m_lid_t mdl_lid = ms_register_model(MM_ID_GENS_APROP, elmt_idx, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) //if (status == MESH_ERR_NO_ERROR) + { + // Inform the Model State Manager about registered model + mm_gens_prop_full_env_t *p_env_prop_admin = (mm_gens_prop_full_env_t *)mm_state_register(elmt_idx, MM_ID_GENS_APROP, mdl_lid, + MM_ROLE_SRV_PUBLI, env_length); + + if (p_env_prop_admin) + { + // Counter + uint8_t cnt; + + // Keep number of properties + p_env_prop_admin->nb_prop = nb_prop_admin; + + // Keep property information + memcpy(&p_env_prop_admin->prop[0], p_props, nb_prop_admin * sizeof(mm_prop_t)); + + // Check if there are User Properties + for (cnt = 0; cnt < nb_prop_admin; cnt++) + { + if (p_env_prop_admin->prop[cnt].user_access != 0) + { + p_env_prop->nb_prop_user++; + } + } + + // Set internal callback functions + p_env_prop_admin->env.mdl_cb.cb_rx = mm_gens_prop_cb_rx; + p_env_prop_admin->env.mdl_cb.cb_opcode_check = mm_gens_prop_admin_cb_opcode_check; + //p_env_prop_admin->env.mdl_cb.cb_publish_param = mm_gens_prop_cb_publish_param; + + status = MESH_ERR_NO_ERROR; + // Inform application about registered model + mm_register_ind_send(MM_ID_GENS_APROP, elmt_idx, mdl_lid); + + p_env_prop_admin->p_env_prop = p_env_prop; + p_env_prop->mdl_lid_admin = mdl_lid; + } + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Register Generic Manufacturer Property Server model + * + * @param[in] elmt_idx Element index + * @param[in] nb_prop_manuf Number of Generic Manufacturer Property states + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_gens_prop_register_manuf(uint8_t elmt_idx, uint8_t nb_prop_manuf, + mm_prop_t *p_props, mm_gens_prop_env_t *p_env_prop) +{ + // Returned status + uint8_t status = MESH_ERR_COMMAND_DISALLOWED; + // Environment length + uint16_t env_length + = sizeof(mm_gens_prop_full_env_t) + nb_prop_manuf * sizeof(mm_prop_t); + // Register Generic Manufacturer Property Server model + m_lid_t mdl_lid = ms_register_model(MM_ID_GENS_MPROP, elmt_idx, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) //if (status == MESH_ERR_NO_ERROR) + { + // Inform the Model State Manager about registered model + mm_gens_prop_full_env_t *p_env_prop_manuf = (mm_gens_prop_full_env_t *)mm_state_register(elmt_idx, MM_ID_GENS_MPROP, mdl_lid, + MM_ROLE_SRV_PUBLI, env_length); + + if (p_env_prop_manuf) + { + // Counter + uint8_t cnt; + + // Keep number of properties + p_env_prop_manuf->nb_prop = nb_prop_manuf; + + // Keep property information + memcpy(&p_env_prop_manuf->prop[0], p_props, nb_prop_manuf * sizeof(mm_prop_t)); + + // Check if there are User Properties + for (cnt = 0; cnt < nb_prop_manuf; cnt++) + { + if (p_env_prop_manuf->prop[cnt].user_access != 0) + { + p_env_prop->nb_prop_user++; + } + } + + // Set internal callback functions + p_env_prop_manuf->env.mdl_cb.cb_rx = mm_gens_prop_cb_rx; + p_env_prop_manuf->env.mdl_cb.cb_opcode_check = mm_gens_prop_manuf_cb_opcode_check; + //p_env_prop_manuf->env.mdl_cb.cb_publish_param = mm_gens_prop_cb_publish_param; + + status = MESH_ERR_NO_ERROR; + // Inform application about registered model + mm_register_ind_send(MM_ID_GENS_MPROP, elmt_idx, mdl_lid); + + p_env_prop_manuf->p_env_prop = p_env_prop; + p_env_prop->mdl_lid_manuf = mdl_lid; + } + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Register Generic Client Property Server model + * + * @param[in] elmt_idx Element index + * @param[in] nb_prop_cli Number of Generic Client Property states + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_gens_prop_register_cli(uint8_t elmt_idx, uint8_t nb_prop_cli, mm_prop_t *p_props) +{ + // Returned status + uint8_t status = MESH_ERR_COMMAND_DISALLOWED; + // Environment length + uint16_t env_length + = sizeof(mm_gens_prop_cli_env_t) + nb_prop_cli * sizeof(mm_gens_prop_cli_env_t); + // Register Generic Client Property Server model + m_lid_t mdl_lid = ms_register_model(MM_ID_GENS_CPROP, elmt_idx, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) //if (status == MESH_ERR_NO_ERROR) + { + // Inform the Model State Manager about registered model + mm_gens_prop_cli_env_t *p_env_prop_cli = (mm_gens_prop_cli_env_t *)mm_state_register(elmt_idx, MM_ID_GENS_CPROP, mdl_lid, + MM_ROLE_SRV_PUBLI, env_length); + + if (p_env_prop_cli) + { + // Counter + uint8_t cnt; + + // Keep number of properties + p_env_prop_cli->nb_prop = nb_prop_cli; + + // Keep property information + for (cnt = 0; cnt < nb_prop_cli; cnt++) + { + p_env_prop_cli->prop[cnt] = p_props[cnt].prop_id; + } + + // Set internal callback functions + p_env_prop_cli->env.mdl_cb.cb_rx = mm_gens_prop_cli_cb_rx; + p_env_prop_cli->env.mdl_cb.cb_opcode_check = mm_gens_prop_cli_cb_opcode_check; + //p_env_prop_cli->env.mdl_cb.cb_publish_param = mm_gens_prop_cb_publish_param; + + status = MESH_ERR_NO_ERROR; + // Inform application about registered model + mm_register_ind_send(MM_ID_GENS_MPROP, elmt_idx, mdl_lid); + } + } + + return (status); +} + +/* + * GLOBAL FUNCTIONS + **************************************************************************************** + */ + +uint8_t mm_gens_prop_register(uint8_t elmt_idx, uint8_t req_queue_len, + uint8_t nb_prop_user, uint8_t nb_prop_admin, + uint8_t nb_prop_manuf, uint8_t nb_prop_cli, const mm_prop_t *p_props) +{ + uint8_t status = MESH_ERR_NO_ERROR; + + do + { + mm_prop_t *p_prop_cursor = (mm_prop_t *)p_props; + + if (nb_prop_user) + { + // Pointer to general environment + mm_gens_prop_env_t *p_env_prop; + // Model local index for the Generic User Property Server model + m_lid_t mdl_lid_user; + + // Register Generic User Property Server model + status = mm_gens_prop_register_user(elmt_idx, nb_prop_user, p_prop_cursor, + &mdl_lid_user, &p_env_prop); + + if (status != MESH_ERR_NO_ERROR) + { + break; + } + + // Fill general environment + p_env_prop->queue_len = req_queue_len; + p_env_prop->mdl_lid_user = mdl_lid_user; + + p_prop_cursor += nb_prop_user; + + if (nb_prop_admin) + { + // Register Generic Admin Property Server model + status = mm_gens_prop_register_admin(elmt_idx, nb_prop_admin, + p_prop_cursor, p_env_prop); + + if (status != MESH_ERR_NO_ERROR) + { + break; + } + + p_prop_cursor += nb_prop_admin; + } + else + { + p_env_prop->mdl_lid_admin = MESH_INVALID_LID; + } + + if (nb_prop_manuf) + { + // Register Generic Manufacturer Property Server model + status = mm_gens_prop_register_manuf(elmt_idx, nb_prop_manuf, + p_prop_cursor, p_env_prop); + + if (status != MESH_ERR_NO_ERROR) + { + break; + } + + p_prop_cursor += nb_prop_manuf; + } + else + { + p_env_prop->mdl_lid_manuf = MESH_INVALID_LID; + } + + // Prepare timeout timer structure + p_env_prop->tmr_to.cb = mm_gens_prop_cb_tmr_to; + //p_env_prop->tmr_to.p_env = p_env_prop; + + // Prepare delayed job structure + p_env_prop->djob.cb = mm_gens_prop_cb_djob; + //p_env_prop->djob.p_env = p_env_prop; + } + + if (nb_prop_cli) + { + // Register Generic Client Property Server model + status = mm_gens_prop_register_cli(elmt_idx, nb_prop_cli, p_prop_cursor); + } + } while (0); + + return (status); +} + +void mm_gens_prop_cfm(uint8_t elmt_idx, uint8_t status, uint8_t prop_type, uint16_t prop_id, + uint16_t length, const uint8_t *p_val) +{ + // Get model local index for Generic User Property Server model on the element + m_lid_t mdl_lid = mm_state_get_lid(elmt_idx, MM_ID_GENS_UPROP); + + if (mdl_lid != MESH_INVALID_LID) + { + // Get environment allocated for Generic User Property Server model + mm_gens_prop_full_env_t *p_env_user + = (mm_gens_prop_full_env_t *)mm_state_get_env(mdl_lid); + // Get environment allocated for the Generic Property models + mm_gens_prop_env_t *p_env_prop = p_env_user->p_env_prop; + + if (p_env_prop->nb_msg_rx) + { + // Pick first message in the list + mesh_buf_t *p_buf = (mesh_buf_t *)list_pick(&p_env_prop->list_msg_rx); + // Get buffer environment + mm_gens_prop_buf_env_t *p_buf_env = (mm_gens_prop_buf_env_t *)&p_buf->env[0]; + + if ((elmt_idx == p_buf_env->elmt_idx) + && (prop_type == p_buf_env->prop_type) + && (prop_id == p_buf_env->prop_id)) + { + // Model environment + mm_gens_prop_full_env_t *p_env; + // Get property information + mm_prop_t *p_prop; + + // Stop the timeout timer + mesh_timer_clear(&p_env_prop->tmr_to); + + if (status == MESH_ERR_NO_ERROR) + { + if (prop_type == MM_PROP_TYPE_USER) + { + p_env = p_env_user; + } + else if (prop_type == MM_PROP_TYPE_ADMIN) + { + p_env = (mm_gens_prop_full_env_t *)mm_state_get_env(p_env_prop->mdl_lid_admin); + } + else // (prop_type == MM_PROP_TYPE_MANUF): + { + p_env = (mm_gens_prop_full_env_t *)mm_state_get_env(p_env_prop->mdl_lid_manuf); + } + + p_prop = &p_env->prop[p_buf_env->prop_idx]; + + if (p_buf_env->ack) + { + // Send the status message + mm_gens_prop_send_status(&p_buf_env->route_env, false, p_buf_env->type, + p_buf_env->prop_id, true, p_prop->user_access, length, p_val); + } + + // Send a publication + if (p_buf_env->set + && GETB(p_env->env.info, MM_INFO_PUBLI)) + { + // Send the status message + mm_gens_prop_send_status(&p_buf_env->route_env, true, p_buf_env->type, + p_buf_env->prop_id, true, p_prop->user_access, length, + p_val); + } + } + + // Free the message + mm_gens_prop_msg_free(p_env_prop); + } + } + // else confirmation is not expected + } +} + +/// @} end of group diff --git a/mesh/model/light/lightc/mm_lightc_ctl.c b/mesh/model/light/lightc/mm_lightc_ctl.c new file mode 100644 index 0000000..4782ea2 --- /dev/null +++ b/mesh/model/light/lightc/mm_lightc_ctl.c @@ -0,0 +1,596 @@ +/** + **************************************************************************************** + * + * @file mm_lightc_ctl.c + * + * @brief Mesh Model Light CTL Client Module + * + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @addtogroup MM_LIGHTC_CTL + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mm_itf.h" +#include "mm_lightc.h" + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Structure for Light CTL Client model environment +typedef struct mm_lightc_ctl_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; +} mm_lightc_ctl_env_t; + +/* + * MESSAGE HANDLERS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Handler for Light CTL Status message + * + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] src Source address of the message + **************************************************************************************** + */ +__STATIC void mm_lightc_ctl_handler_status(mesh_buf_t *p_buf, uint16_t src) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Present CTL Lightness value + uint16_t lightness = read16p(p_data + MM_LIGHT_CTL_STATUS_LIGHTNESS_POS); + // Present CTL Temperature value + uint16_t temp = read16p(p_data + MM_LIGHT_CTL_STATUS_TEMP_POS); + // Target CTL Lightness value + uint16_t lightness_tgt; + // Target CTL Temperature value + uint16_t temp_tgt; + // Remaining time in milliseconds + uint32_t rem_time_ms; + + // Check if optional parameters are provided + if (p_buf->data_len == MM_LIGHT_CTL_STATUS_LEN) + { + lightness_tgt = read16p(p_data + MM_LIGHT_CTL_STATUS_TGT_LIGHTNESS_POS); + temp_tgt = read16p(p_data + MM_LIGHT_CTL_STATUS_TGT_TEMP_POS); + rem_time_ms = mm_get_trans_time_ms(*(p_data + MM_LIGHT_CTL_STATUS_REM_TIME_POS)); + } + else + { + lightness_tgt = 0; + temp_tgt = 0; + rem_time_ms = 0; + } + + // Inform the application about the received Light CTL Lightness state value + mm_cli_state_ind_send(src, MM_STATE_LIGHT_CTL_LN, lightness, lightness_tgt, rem_time_ms); + // Inform the application about the received Light CTL Temperature state value + mm_cli_state_ind_send(src, MM_STATE_LIGHT_CTL_TEMP, temp, temp_tgt, rem_time_ms); +} + +/** + **************************************************************************************** + * @brief Handler for Light CTL Temperature Status message + * + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] src Source address of the message + **************************************************************************************** + */ +__STATIC void mm_lightc_ctl_handler_status_temp(mesh_buf_t *p_buf, uint16_t src) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Present CTL Delta UV value + int16_t delta_uv = (int16_t)read16p(p_data + MM_LIGHT_CTL_TEMP_STATUS_DELTA_UV_POS); + // Present CTL Temperature value + uint16_t temp = read16p(p_data + MM_LIGHT_CTL_TEMP_STATUS_TEMP_POS); + // Target CTL Delta UV value + int16_t delta_uv_tgt; + // Target CTL Temperature value + uint16_t temp_tgt; + // Remaining time in milliseconds + uint32_t rem_time_ms; + + // Check if optional parameters are provided + if (p_buf->data_len == MM_LIGHT_CTL_TEMP_STATUS_LEN) + { + delta_uv_tgt = (int16_t)read16p(p_data + MM_LIGHT_CTL_TEMP_STATUS_TGT_DELTA_UV_POS); + temp_tgt = read16p(p_data + MM_LIGHT_CTL_TEMP_STATUS_TGT_TEMP_POS); + rem_time_ms = mm_get_trans_time_ms(*(p_data + MM_LIGHT_CTL_TEMP_STATUS_REM_TIME_POS)); + } + else + { + delta_uv_tgt = 0; + temp_tgt = 0; + rem_time_ms = 0; + } + + // Inform the application about the received Light CTL Temperature state value + mm_cli_state_ind_send(src, MM_STATE_LIGHT_CTL_TEMP, temp, temp_tgt, rem_time_ms); + // Inform the application about the received Light CTL Delta UV state value + mm_cli_state_ind_send(src, MM_STATE_LIGHT_CTL_DELTA_UV, delta_uv, delta_uv_tgt, rem_time_ms); +} + +/** + **************************************************************************************** + * @brief Handler for Light CTL Default Status message + * + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] src Source address of the message + **************************************************************************************** + */ +__STATIC void mm_lightc_ctl_handler_status_dflt(mesh_buf_t *p_buf, uint16_t src) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Light Lightness Default state value + uint16_t lightness_dflt = read16p(p_data + MM_LIGHT_CTL_DFLT_STATUS_LIGHTNESS_POS); + // Light CTL Temperature Default state value + uint16_t temp_dflt = read16p(p_data + MM_LIGHT_CTL_DFLT_STATUS_TEMP_POS); + // Light CTL Delta UV Default state value + int16_t delta_uv_dflt = (int16_t)read16p(p_data + MM_LIGHT_CTL_DFLT_STATUS_DELTA_UV_POS); + + // Inform the application about the received Light Lightness Default state value + mm_cli_state_ind_send(src, MM_STATE_LIGHT_LN_DFLT, lightness_dflt, 0, 0); + // Inform the application about the received Light Lightness Default state value + mm_cli_state_ind_send(src, MM_STATE_LIGHT_CTL_TEMP_DFLT, temp_dflt, 0, 0); + // Inform the application about the received Light Lightness Default state value + mm_cli_state_ind_send(src, MM_STATE_LIGHT_CTL_DELTA_UV_DFLT, delta_uv_dflt, 0, 0); +} + +/** + **************************************************************************************** + * @brief Handler for Light CTL Temperature Range Status message + * + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] src Source address of the message + **************************************************************************************** + */ +__STATIC void mm_lightc_ctl_handler_status_temp_range(mesh_buf_t *p_buf, uint16_t src) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Light CTL Temperature Range state value (minimum) + uint16_t temp_min = read16p(p_data + MM_LIGHT_CTL_TEMP_RANGE_STATUS_MIN_POS); + // Light CTL Temperature Range state value (maximum) + uint16_t temp_max = read16p(p_data + MM_LIGHT_CTL_TEMP_RANGE_STATUS_MAX_POS); + + // Inform the application about the received Light Lightness Range state value + mm_cli_state_ind_send(src, MM_STATE_LIGHT_CTL_TEMP_RANGE, temp_min, temp_max, 0); +} + +/* + * INTERNAL CALLBACK FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Inform Light CTL Client model about reception of a message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing environment containing information about the + * received message + **************************************************************************************** + */ +__STATIC void mm_lightc_ctl_cb_rx(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + // Call the appropriate handler for the received message + switch (p_route_env->opcode) + { + case (MM_MSG_LIGHT_CTL_STATUS): + { + mm_lightc_ctl_handler_status(p_buf, p_route_env->u_addr.src); + } break; + + case (MM_MSG_LIGHT_CTL_TEMP_STATUS): + { + mm_lightc_ctl_handler_status_temp(p_buf, p_route_env->u_addr.src); + } break; + + case (MM_MSG_LIGHT_CTL_TEMP_RANGE_STATUS): + { + mm_lightc_ctl_handler_status_temp_range(p_buf, p_route_env->u_addr.src); + } break; + + case (MM_MSG_LIGHT_CTL_DFLT_STATUS): + { + mm_lightc_ctl_handler_status_dflt(p_buf, p_route_env->u_addr.src); + } break; + + default: + { + } break; + } +} + +/** + **************************************************************************************** + * @brief Inform Light CTL Client model about a received opcode in order + * to check if the model is authorized to handle the associated message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] opcode Opcode value to be checked + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lightc_ctl_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status; + + if ((opcode == MM_MSG_LIGHT_CTL_STATUS) + || (opcode == MM_MSG_LIGHT_CTL_TEMP_STATUS) + || (opcode == MM_MSG_LIGHT_CTL_TEMP_RANGE_STATUS) + || (opcode == MM_MSG_LIGHT_CTL_DFLT_STATUS)) + { + status = MESH_ERR_NO_ERROR; + } + else + { + status = MESH_ERR_MDL_INVALID_OPCODE; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Send Light CTL Get or Light CTL Temperature Get or Light CTL Temperature Range Get + * or Light CTL Default Get message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element from which state value must be retrieved + * @param[in] get_option Get option + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lightc_ctl_cb_get(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint16_t get_info) +{ + // Status + uint8_t status = MESH_ERR_NO_ERROR; + // Get type + uint8_t get_type = get_info; + + // Check option value + if (get_type <= MM_GET_TYPE_LIGHT_CTL_MAX) + { + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_get = mm_route_buf_alloc(0); + + if (p_buf_get) + { + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_get->env; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + + if (get_type == MM_GET_TYPE_LIGHT_CTL) + { + p_buf_env->opcode = MM_MSG_LIGHT_CTL_GET; + } + else if (get_type == MM_GET_TYPE_LIGHT_CTL_TEMP) + { + p_buf_env->opcode = MM_MSG_LIGHT_CTL_TEMP_GET; + } + else if (get_type == MM_GET_TYPE_LIGHT_CTL_TEMP_RANGE) + { + p_buf_env->opcode = MM_MSG_LIGHT_CTL_TEMP_RANGE_GET; + } + else // (option == MM_GET_TYPE_LIGHT_CTL_DFLT) + { + p_buf_env->opcode = MM_MSG_LIGHT_CTL_DFLT_GET; + } + + // Send the message + mm_route_send(p_buf_get); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + } + else + { + status = MESH_ERR_INVALID_PARAM; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Send Light CTL Set or Light CTL Set Unacknowledged message in order to set: + * - Light CTL Lightness state value + * - Light CTL Temperature state value + * - Light CTL Delta UV state value + * or Light CTL Temperature Set or Light CTL Temperature Set Unacknowledged message in order + * to set + * - Light CTL Temperature state value + * - Light CTL Delta UV state value + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element on which state value must be set + * @param[in] state_1 State value 1 + * - Light CTL Lightness state value (uint16_t) (Bit 0-15) | Light CTL Temperature + * state value (uint16_t) (Bit 16-31) if Light CTL Set message + * or + * - Light CTL Temperature state value (uint16_t) if Light CTL Temperature Set message + * @param[in] state_2 State value 2 + * - Light CTL Delta UV state value (int16_t) + * @param[in] trans_time_ms Transition time in milliseconds + * @param[in] delay_ms Delay in milliseconds + * @param[in] trans_info Transition information (@see enum mm_trans_info and + * @see enum mm_trans_type_light_ctl) + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lightc_ctl_cb_trans(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint32_t state_1, uint32_t state_2, + uint32_t trans_time_ms, uint16_t delay_ms, + uint16_t trans_info) +{ + // Status + uint8_t status = MESH_ERR_NO_ERROR; + // Transition type + uint8_t trans_type = GETF(trans_info, MM_TRANS_INFO_TYPE); + + if (trans_type <= MM_TRANS_TYPE_LIGHT_CTL_MAX) + { + // Long message or not + bool long_set = (GETB(trans_info, MM_TRANS_INFO_LONG) || trans_time_ms || delay_ms); + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_set; + // Message length + uint8_t length; + + if (trans_type == MM_TRANS_TYPE_LIGHT_CTL_TEMP) + { + length = (long_set) ? MM_LIGHT_CTL_TEMP_SET_LEN : MM_LIGHT_CTL_TEMP_SET_MIN_LEN; + } + else // (trans_type == MM_TRANS_TYPE_LIGHT_CTL) + { + length = (long_set) ? MM_LIGHT_CTL_SET_LEN : MM_LIGHT_CTL_SET_MIN_LEN; + } + + // Allocate a new buffer + p_buf_set = mm_route_buf_alloc(length); + + if (p_buf_set) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_set); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_set->env; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + + // Set opcode and start to fill the message + if (trans_type == MM_TRANS_TYPE_LIGHT_CTL_TEMP) + { + p_buf_env->opcode = (GETB(trans_info, MM_TRANS_INFO_ACK)) + ? MM_MSG_LIGHT_CTL_TEMP_SET : MM_MSG_LIGHT_CTL_TEMP_SET_UNACK; + + write16p(p_data + MM_LIGHT_CTL_TEMP_SET_TEMP_POS, state_1); + write16p(p_data + MM_LIGHT_CTL_TEMP_SET_DELTA_UV_POS, (int16_t)state_2); + + p_data += MM_LIGHT_CTL_TEMP_SET_TID_POS; + } + else // (trans_type == MM_TRANS_TYPE_LIGHT_CTL) + { + p_buf_env->opcode = (GETB(trans_info, MM_TRANS_INFO_ACK)) + ? MM_MSG_LIGHT_CTL_SET : MM_MSG_LIGHT_CTL_SET_UNACK; + + write16p(p_data + MM_LIGHT_CTL_SET_LIGHTNESS_POS, state_1); + write16p(p_data + MM_LIGHT_CTL_SET_TEMP_POS, (state_1 >> 16)); + write16p(p_data + MM_LIGHT_CTL_SET_DELTA_UV_POS, (int16_t)state_2); + + p_data += MM_LIGHT_CTL_SET_TID_POS; + } + + // Fill the message + *(p_data++) = GETF(trans_info, MM_TRANS_INFO_TID); + + if (long_set) + { + // Set transition time and delay values + *(p_data++) = mm_get_trans_time(trans_time_ms); + *(p_data++) = delay_ms / 5; + } + + // Send the message + mm_route_send(p_buf_set); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + } + else + { + status = MESH_ERR_INVALID_PARAM; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Send Light CTL Default Set or Light CTL Default Set Unacknowledged message in + * order to set: + * - Light Lightness Default state value + * - Light CTL Temperature Default state value + * - Light CTL Delta UV Default state value + * or Light CTL Temperature Range Set or Light CTL Temperature Range Set Unacknowledged message + * in order to set Light CTL Temperature Range state value + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element on which state value must be set + * @param[in] state_1 State value 1 + * - Light Lightness Default state value (uint16_t) (Bit 0-15) | Light CTL Temperature + * Default state value (uint16_t) (Bit 16-31) if Light CTL Default Set message + * or + * - Light CTL Temperature Range Min state value (uint16_t) if Light CTL Temperature Range + * Set message + * @param[in] state_2 State value 2 + * - Light CTL Delta UV Default state value (int16_t) if Light CTL Default Set message + * or + * - Light CTL Temperature Range Max state value (uint16_t) if Light CTL Temperature Range + * Set message + * @param[in] set_info Set information (@see enum mm_set_info and + * @see enum mm_set_type_light_ctl for set type value) + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lightc_ctl_cb_set(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint32_t state_1, uint32_t state_2, + uint16_t set_info) +{ + // Set type + uint8_t set_type = GETF(set_info, MM_SET_INFO_TYPE); + // Status + uint8_t status = MESH_ERR_NO_ERROR; + + // Check provided set type + if (set_type <= MM_SET_TYPE_LIGHT_CTL_MAX) + { + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_set; + // Opcode + uint32_t opcode; + // Length + uint8_t length; + + if (set_type == MM_SET_TYPE_LIGHT_CTL_TEMP_RANGE) + { + length = MM_LIGHT_CTL_TEMP_RANGE_SET_LEN; + opcode = GETB(set_info, MM_SET_INFO_ACK) + ? MM_MSG_LIGHT_CTL_TEMP_RANGE_SET : MM_MSG_LIGHT_CTL_TEMP_RANGE_SET_UNACK; + } + else // (set_type == MM_SET_TYPE_LIGHT_CTL_DFLT) + { + length = MM_LIGHT_CTL_DFLT_SET_LEN; + opcode = GETB(set_info, MM_SET_INFO_ACK) + ? MM_MSG_LIGHT_CTL_DFLT_SET : MM_MSG_LIGHT_CTL_DFLT_SET_UNACK; + } + + // Allocate a new buffer for the publication + p_buf_set = mm_route_buf_alloc(length); + + if (p_buf_set) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_set); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_set->env; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + p_buf_env->opcode = opcode; + + // Fill the message + if (set_type == MM_SET_TYPE_LIGHT_CTL_TEMP_RANGE) + { + write16p(p_data + MM_LIGHT_CTL_TEMP_RANGE_SET_MIN_POS, state_1); + write16p(p_data + MM_LIGHT_CTL_TEMP_RANGE_SET_MAX_POS, state_2); + } + else // (set_type == MM_SET_TYPE_LIGHT_CTL_DFLT) + { + write16p(p_data + MM_LIGHT_CTL_DFLT_SET_LIGHTNESS_POS, state_1); + write16p(p_data + MM_LIGHT_CTL_DFLT_SET_TEMP_POS, (state_1 >> 16)); + write16p(p_data + MM_LIGHT_CTL_DFLT_SET_DELTA_UV_POS, (int16_t)state_2); + } + + // Send the message + mm_route_send(p_buf_set); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + } + else + { + status = MESH_ERR_INVALID_PARAM; + } + + return (status); +} + +/* + * GLOBAL FUNCTIONS + **************************************************************************************** + */ + +__STATIC mm_cli_cb_t mm_lightc_ctl_cb = +{ + .cb_get = mm_lightc_ctl_cb_get, + .cb_set = mm_lightc_ctl_cb_set, + .cb_trans = mm_lightc_ctl_cb_trans, +}; + +uint8_t mm_lightc_ctl_register(void) +{ + // Register the model + m_lid_t mdl_lid = ms_register_model(MM_ID_LIGHTC_CTL, 0, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) //if (status == MESH_ERR_NO_ERROR) + { + // Inform the Model State Manager about registered model + mm_lightc_ctl_env_t *p_env_ctl = (mm_lightc_ctl_env_t *)mm_state_register(0, MM_ID_LIGHTC_CTL, mdl_lid, + MM_ROLE_CLI, sizeof(mm_lightc_ctl_env_t)); + + if (p_env_ctl) + { + // Get client-specific callback functions + //mm_cli_cb_t *p_cb_cli = p_env_ctl->env.cb.u.p_cb_cli; + + // Set internal callback functions + p_env_ctl->env.mdl_cb.cb_rx = mm_lightc_ctl_cb_rx; + p_env_ctl->env.mdl_cb.cb_opcode_check = mm_lightc_ctl_cb_opcode_check; + //p_cb_cli->cb_get = mm_lightc_ctl_cb_get; + //p_cb_cli->cb_set = mm_lightc_ctl_cb_set; + //p_cb_cli->cb_trans = mm_lightc_ctl_cb_trans; + p_env_ctl->env.mdl_cb.p_cb_cli = &mm_lightc_ctl_cb; + + // Inform application about registered model + mm_register_ind_send(MM_ID_LIGHTC_CTL, 0, mdl_lid); + } + } + + return (mdl_lid); +} + +/// @} end of group diff --git a/mesh/model/light/lightc/mm_lightc_hsl.c b/mesh/model/light/lightc/mm_lightc_hsl.c new file mode 100644 index 0000000..2c14333 --- /dev/null +++ b/mesh/model/light/lightc/mm_lightc_hsl.c @@ -0,0 +1,625 @@ +/** + **************************************************************************************** + * + * @file mm_lightc_hsl.c + * + * @brief Mesh Model Light HSL Client Module + * + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @addtogroup MM_LIGHTC_HSL + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mm_itf.h" +#include "mm_lightc.h" + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Structure for Light HSL Client model environment +typedef struct mm_lightc_hsl_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; +} mm_lightc_hsl_env_t; + +/* + * MESSAGE HANDLERS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Handler for Light HSL Status and Light HSL Target Status message + * Note that both messages have the same content. + * + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] src Source address of the message + * @param[in] target True if Light HSL Target Status message, else false + **************************************************************************************** + */ +__STATIC void mm_lightc_hsl_handler_status(mesh_buf_t *p_buf, uint16_t src, bool target) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Light HSL Lightness state value + uint16_t lightness = read16p(p_data + MM_LIGHT_HSL_STATUS_LIGHTNESS_POS); + // Light HSL Hue state value + uint16_t hue = read16p(p_data + MM_LIGHT_HSL_STATUS_HUE_POS); + // Light HSL Saturation state value + uint16_t sat = read16p(p_data + MM_LIGHT_HSL_STATUS_SAT_POS); + // Remaining time in milliseconds + uint32_t rem_time_ms; + + if (p_buf->data_len == MM_LIGHT_HSL_STATUS_LEN) + { + rem_time_ms = mm_get_trans_time_ms(*(p_data + MM_LIGHT_HSL_STATUS_REM_TIME_POS)); + } + else + { + rem_time_ms = 0; + } + + if (target) + { + // Inform the application about the received Light HSL Lightness state value + mm_cli_state_ind_send(src, MM_STATE_LIGHT_HSL_TGT, + (uint32_t)lightness | ((uint32_t)hue << 16), sat, rem_time_ms); + } + else + { + // Inform the application about the received Light HSL Lightness state value + mm_cli_state_ind_send(src, MM_STATE_LIGHT_HSL_LN, lightness, 0, rem_time_ms); + // Inform the application about the received Light HSL Hue state value + mm_cli_state_ind_send(src, MM_STATE_LIGHT_HSL_HUE, hue, 0, rem_time_ms); + // Inform the application about the received Light HSL Saturation state value + mm_cli_state_ind_send(src, MM_STATE_LIGHT_HSL_SAT, sat, 0, rem_time_ms); + } +} + +/** + **************************************************************************************** + * @brief Handler for Light HSL Hue Status and Light HSL Saturation Status message. + * Note that both message have same content structure (Hue and Staturation fields have + * same size and same type). + * + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] src Source address of the message + * @param[in] hue True if Light HSL Hue Status message, else false + **************************************************************************************** + */ +__STATIC void mm_lightc_hsl_handler_status_single(mesh_buf_t *p_buf, uint16_t src, bool hue) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Present Light HSL Hue/Saturation state value + uint16_t present = (int16_t)read16p(p_data + MM_LIGHT_HSL_HUE_STATUS_HUE_POS); + // Target Light HSL Hue/Saturation state value + uint16_t target; + // Remaining time in milliseconds + uint32_t rem_time_ms; + + // Check if optional parameters are provided + if (p_buf->data_len == MM_LIGHT_HSL_HUE_STATUS_LEN) + { + target = read16p(p_data + MM_LIGHT_HSL_HUE_STATUS_TGT_HUE_POS); + rem_time_ms = mm_get_trans_time_ms(*(p_data + MM_LIGHT_HSL_HUE_STATUS_REM_TIME_POS)); + } + else + { + target = 0; + rem_time_ms = 0; + } + + // Inform the application about the received Light HSL Hue state value + mm_cli_state_ind_send(src, (hue) ? MM_STATE_LIGHT_HSL_HUE : MM_STATE_LIGHT_HSL_SAT, + present, target, rem_time_ms); +} + +/** + **************************************************************************************** + * @brief Handler for Light HSL Default Status message + * + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] src Source address of the message + **************************************************************************************** + */ +__STATIC void mm_lightc_hsl_handler_status_dflt(mesh_buf_t *p_buf, uint16_t src) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Light HSL Lightness Default state value + uint16_t lightness = read16p(p_data + MM_LIGHT_HSL_DFLT_STATUS_LIGHTNESS_POS); + // Light HSL Hue Default state value + uint16_t hue = read16p(p_data + MM_LIGHT_HSL_DFLT_STATUS_HUE_POS); + // Light HSL Saturation Default state value + uint16_t sat = read16p(p_data + MM_LIGHT_HSL_DFLT_STATUS_SAT_POS); + + // Inform the application about the received Light HSL Default state value + mm_cli_state_ind_send(src, MM_STATE_LIGHT_HSL_DFLT, + (uint32_t)lightness | ((uint32_t)hue << 16), sat, 0); +} + +/** + **************************************************************************************** + * @brief Handler for Light HSL Range Status message + * + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] src Source address of the message + **************************************************************************************** + */ +__STATIC void mm_lightc_hsl_handler_status_range(mesh_buf_t *p_buf, uint16_t src) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Light HSL Hue Range state value (minimum) + uint16_t hue_min = read16p(p_data + MM_LIGHT_HSL_RANGE_STATUS_HUE_MIN_POS); + // Light HSL Hue Range state value (maximum) + uint16_t hue_max = read16p(p_data + MM_LIGHT_HSL_RANGE_STATUS_HUE_MAX_POS); + // Light HSL Saturation Range state value (minimum) + uint16_t sat_min = read16p(p_data + MM_LIGHT_HSL_RANGE_STATUS_SAT_MIN_POS); + // Light HSL Saturation Range state value (maximum) + uint16_t sat_max = read16p(p_data + MM_LIGHT_HSL_RANGE_STATUS_SAT_MAX_POS); + + // Inform the application about the received Light HSL Hue Range state value + mm_cli_state_ind_send(src, MM_STATE_LIGHT_HSL_RANGE_HUE, hue_min, hue_max, 0); + // Inform the application about the received Light HSL Hue Range state value + mm_cli_state_ind_send(src, MM_STATE_LIGHT_HSL_RANGE_SAT, sat_min, sat_max, 0); +} + +/* + * INTERNAL CALLBACK FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Inform Light HSL Client model about reception of a message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing environment containing information about the + * received message + **************************************************************************************** + */ +__STATIC void mm_lightc_hsl_cb_rx(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + // Call the appropriate handler for the received message + switch (p_route_env->opcode) + { + case (MM_MSG_LIGHT_HSL_HUE_STATUS): + case (MM_MSG_LIGHT_HSL_SAT_STATUS): + { + mm_lightc_hsl_handler_status_single(p_buf, p_route_env->u_addr.src, + (p_route_env->opcode == MM_MSG_LIGHT_HSL_HUE_STATUS)); + } break; + + case (MM_MSG_LIGHT_HSL_STATUS): + case (MM_MSG_LIGHT_HSL_TGT_STATUS): + { + mm_lightc_hsl_handler_status(p_buf, p_route_env->u_addr.src, + (p_route_env->opcode == MM_MSG_LIGHT_HSL_TGT_STATUS)); + } break; + + case (MM_MSG_LIGHT_HSL_DFLT_STATUS): + { + mm_lightc_hsl_handler_status_dflt(p_buf, p_route_env->u_addr.src); + } break; + + case (MM_MSG_LIGHT_HSL_RANGE_STATUS): + { + mm_lightc_hsl_handler_status_range(p_buf, p_route_env->u_addr.src); + } break; + + default: + { + } break; + } +} + +/** + **************************************************************************************** + * @brief Inform Light HSL Client model about a received opcode in order + * to check if the model is authorized to handle the associated message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] opcode Opcode value to be checked + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lightc_hsl_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status; + + if ((opcode == MM_MSG_LIGHT_HSL_HUE_STATUS) + || (opcode == MM_MSG_LIGHT_HSL_SAT_STATUS) + || (opcode == MM_MSG_LIGHT_HSL_STATUS) + || (opcode == MM_MSG_LIGHT_HSL_TGT_STATUS) + || (opcode == MM_MSG_LIGHT_HSL_DFLT_STATUS) + || (opcode == MM_MSG_LIGHT_HSL_RANGE_STATUS)) + { + status = MESH_ERR_NO_ERROR; + } + else + { + status = MESH_ERR_MDL_INVALID_OPCODE; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Send Light HSL Get or Light HSL Hue Get or Light HSL Saturation Get + * or Light HSL Default Get or Light HSL Target or Light HSL Range Get message + * + * - Light HSL Get: Light HSL Lightness and Light HSL Hue and Light HSL Saturation state + * values + * - Light HSL Saturation Get: Light HSL Saturation state value + * - Light HSL Hue Get: Light HSL Hue state value + * - Light HSL Target Get: Light HSL Lightness and Light HSL Hue and Light HSL Saturation + * state target values + * - Light HSL Default Get: Light Lightness and Light HSL Hue and Light HSL Saturation + * state default values + * - Light HSL Range Get: Light HSL Hue and Light HSL Saturation state range values + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element from which state value must be retrieved + * @param[in] get_option Get option (@see enum mm_get_type_light_hsl) + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lightc_hsl_cb_get(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint16_t get_info) +{ + // Status + uint8_t status = MESH_ERR_NO_ERROR; + // Get type + uint8_t get_type = get_info; + + // Check option value + if (get_type <= MM_GET_TYPE_LIGHT_HSL_MAX) + { + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_get = mm_route_buf_alloc(0); + + if (p_buf_get) + { + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_get->env; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + + if (get_type == MM_GET_TYPE_LIGHT_HSL) + { + p_buf_env->opcode = MM_MSG_LIGHT_HSL_GET; + } + else if (get_type == MM_GET_TYPE_LIGHT_HSL_HUE) + { + p_buf_env->opcode = MM_MSG_LIGHT_HSL_HUE_GET; + } + else if (get_type == MM_GET_TYPE_LIGHT_HSL_SAT) + { + p_buf_env->opcode = MM_MSG_LIGHT_HSL_SAT_GET; + } + else if (get_type == MM_GET_TYPE_LIGHT_HSL_TGT) + { + p_buf_env->opcode = MM_MSG_LIGHT_HSL_TGT_GET; + } + else if (get_type == MM_GET_TYPE_LIGHT_HSL_DFLT) + { + p_buf_env->opcode = MM_MSG_LIGHT_HSL_DFLT_GET; + } + else // (option == MM_GET_TYPE_LIGHT_HSL_RANGE) + { + p_buf_env->opcode = MM_MSG_LIGHT_HSL_RANGE_GET; + } + + // Send the message + mm_route_send(p_buf_get); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + } + else + { + status = MESH_ERR_INVALID_PARAM; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Send Light HSL Set or Light HSL Set Unacknowledged message in order to set: + * - Light HSL Lightness state value + * - Light HSL Temperature state value + * - Light HSL Delta UV state value + * or Light HSL Hue Set or Light CTL Hue Set Unacknowledged message in order to set Light + * HSL Hue state value + * or Light HSL Saturation Set or Light HSL Saturation Set Unacknowledged message in order to + * set Light HSL Saturation state value + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element on which state value must be set + * @param[in] state_1 State value 1 + * @param[in] state_2 State value 2 + * @param[in] trans_time_ms Transition time in milliseconds + * @param[in] delay_ms Delay in milliseconds + * @param[in] trans_info Transition information (@see enum mm_trans_info and + * @see enum mm_trans_type_light_hsl) + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lightc_hsl_cb_trans(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint32_t state_1, uint32_t state_2, + uint32_t trans_time_ms, uint16_t delay_ms, + uint16_t trans_info) +{ + // Status + uint8_t status = MESH_ERR_NO_ERROR; + // Transition type + uint8_t trans_type = GETF(trans_info, MM_TRANS_INFO_TYPE); + + if (trans_type <= MM_TRANS_TYPE_LIGHT_HSL_MAX) + { + // Long message or not + bool long_set = (GETB(trans_info, MM_TRANS_INFO_LONG) || trans_time_ms || delay_ms); + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_set; + // Message length + uint8_t length; + + if (trans_type == MM_TRANS_TYPE_LIGHT_HSL) + { + length = (long_set) ? MM_LIGHT_HSL_SET_LEN : MM_LIGHT_HSL_SET_MIN_LEN; + } + else if (trans_type == MM_TRANS_TYPE_LIGHT_HSL_HUE) + { + length = (long_set) ? MM_LIGHT_HSL_HUE_SET_LEN : MM_LIGHT_HSL_HUE_SET_MIN_LEN; + } + else // (trans_type == MM_TRANS_TYPE_LIGHT_HSL_SAT) + { + length = (long_set) ? MM_LIGHT_HSL_SAT_SET_LEN : MM_LIGHT_HSL_SAT_SET_MIN_LEN; + } + + // Allocate a new buffer + p_buf_set = mm_route_buf_alloc(length); + + if (p_buf_set) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_set); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_set->env; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + + // Set opcode and start to fill the message + if (trans_type == MM_TRANS_TYPE_LIGHT_HSL) + { + p_buf_env->opcode = (GETB(trans_info, MM_TRANS_INFO_ACK)) + ? MM_MSG_LIGHT_HSL_SET : MM_MSG_LIGHT_HSL_SET_UNACK; + + write16p(p_data + MM_LIGHT_HSL_SET_LIGHTNESS_POS, state_1); + write16p(p_data + MM_LIGHT_HSL_SET_HUE_POS, state_1 >> 16); + write16p(p_data + MM_LIGHT_HSL_SET_SAT_POS, state_2); + + p_data += MM_LIGHT_HSL_SET_TID_POS; + } + else if (trans_type == MM_TRANS_TYPE_LIGHT_HSL_HUE) + { + p_buf_env->opcode = (GETB(trans_info, MM_TRANS_INFO_ACK)) + ? MM_MSG_LIGHT_HSL_HUE_SET : MM_MSG_LIGHT_HSL_HUE_SET_UNACK; + + write16p(p_data + MM_LIGHT_HSL_HUE_SET_HUE_POS, state_1); + + p_data += MM_LIGHT_HSL_HUE_SET_TID_POS; + } + else // (trans_type == MM_TRANS_TYPE_LIGHT_HSL_SAT) + { + p_buf_env->opcode = (GETB(trans_info, MM_TRANS_INFO_ACK)) + ? MM_MSG_LIGHT_HSL_SAT_SET : MM_MSG_LIGHT_HSL_SAT_SET_UNACK; + + write16p(p_data + MM_LIGHT_HSL_SAT_SET_SAT_POS, state_1); + + p_data += MM_LIGHT_HSL_SAT_SET_TID_POS; + } + + // Fill the message + *(p_data++) = GETF(trans_info, MM_TRANS_INFO_TID); + + if (long_set) + { + // Set transition time and delay values + *(p_data++) = mm_get_trans_time(trans_time_ms); + *(p_data++) = delay_ms / 5; + } + + // Send the message + mm_route_send(p_buf_set); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + } + else + { + status = MESH_ERR_INVALID_PARAM; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Send Light HSL Default Set or Light HSL Default Set Unacknowledged message in + * order to set: + * - Light Lightness Default state value + * - Light HSL Hue Default state value + * - Light HSL Saturation Default state value + * or Light HSL Range Set or Light HSL Range Set Unacknowledged message in order to set + * Light HSL Hue and Light HSL Saturation state range value + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element on which state value must be set + * @param[in] state_1 State value 1 + * @param[in] state_2 State value 2 + * @param[in] set_info Set information (@see enum mm_set_info and + * @see enum mm_set_type_light_hsl for set type value) + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lightc_hsl_cb_set(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint32_t state_1, uint32_t state_2, + uint16_t set_info) +{ + // Set type + uint8_t set_type = GETF(set_info, MM_SET_INFO_TYPE); + // Status + uint8_t status = MESH_ERR_NO_ERROR; + + // Check provided set type + if (set_type <= MM_SET_TYPE_LIGHT_HSL_MAX) + { + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_set; + // Opcode + uint32_t opcode; + // Length + uint8_t length; + + if (set_type == MM_SET_TYPE_LIGHT_HSL_RANGE) + { + length = MM_LIGHT_HSL_RANGE_SET_LEN; + opcode = GETB(set_info, MM_SET_INFO_ACK) + ? MM_MSG_LIGHT_HSL_RANGE_SET : MM_MSG_LIGHT_HSL_RANGE_SET_UNACK; + } + else // (set_type == MM_SET_TYPE_LIGHT_HSL_DFLT) + { + length = MM_LIGHT_HSL_DFLT_SET_LEN; + opcode = GETB(set_info, MM_SET_INFO_ACK) + ? MM_MSG_LIGHT_HSL_DFLT_SET : MM_MSG_LIGHT_HSL_DFLT_SET_UNACK; + } + + // Allocate a new buffer for the publication + p_buf_set = mm_route_buf_alloc(length); + + if (p_buf_set) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_set); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_set->env; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + p_buf_env->opcode = opcode; + + // Fill the message + if (set_type == MM_SET_TYPE_LIGHT_HSL_RANGE) + { + write16p(p_data + MM_LIGHT_HSL_RANGE_SET_HUE_MIN_POS, state_1); + write16p(p_data + MM_LIGHT_HSL_RANGE_SET_HUE_MAX_POS, state_1 >> 16); + write16p(p_data + MM_LIGHT_HSL_RANGE_SET_SAT_MIN_POS, state_2); + write16p(p_data + MM_LIGHT_HSL_RANGE_SET_SAT_MAX_POS, state_2 >> 16); + } + else // (set_type == MM_SET_TYPE_LIGHT_HSL_DFLT) + { + write16p(p_data + MM_LIGHT_HSL_DFLT_SET_LIGHTNESS_POS, state_1); + write16p(p_data + MM_LIGHT_HSL_DFLT_SET_HUE_POS, (state_1 >> 16)); + write16p(p_data + MM_LIGHT_HSL_DFLT_SET_SAT_POS, state_2); + } + + // Send the message + mm_route_send(p_buf_set); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + } + else + { + status = MESH_ERR_INVALID_PARAM; + } + + return (status); +} + +/* + * GLOBAL FUNCTIONS + **************************************************************************************** + */ + +__STATIC mm_cli_cb_t mm_lightc_hsl_cb = +{ + .cb_get = mm_lightc_hsl_cb_get, + .cb_set = mm_lightc_hsl_cb_set, + .cb_trans = mm_lightc_hsl_cb_trans, +}; + +uint8_t mm_lightc_hsl_register(void) +{ + // Register the model + m_lid_t mdl_lid = ms_register_model(MM_ID_LIGHTC_HSL, 0, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) + { + // Inform the Model State Manager about registered model + mm_lightc_hsl_env_t *p_env_hsl = (mm_lightc_hsl_env_t *)mm_state_register(0, MM_ID_LIGHTC_HSL, mdl_lid, + MM_ROLE_CLI, sizeof(mm_lightc_hsl_env_t)); + + if (p_env_hsl) + { + // Get client-specific callback functions + //mm_cli_cb_t *p_cb_cli = p_env_hsl->env.cb.u.p_cb_cli; + + // Set internal callback functions + p_env_hsl->env.mdl_cb.cb_rx = mm_lightc_hsl_cb_rx; + p_env_hsl->env.mdl_cb.cb_opcode_check = mm_lightc_hsl_cb_opcode_check; + //p_cb_cli->cb_get = mm_lightc_hsl_cb_get; + //p_cb_cli->cb_set = mm_lightc_hsl_cb_set; + //p_cb_cli->cb_trans = mm_lightc_hsl_cb_trans; + p_env_hsl->env.mdl_cb.p_cb_cli = &mm_lightc_hsl_cb; + + // Inform application about registered model + mm_register_ind_send(MM_ID_LIGHTC_HSL, 0, mdl_lid); + } + } + + return (mdl_lid); +} + +/// @} end of group diff --git a/mesh/model/light/lightc/mm_lightc_ln.c b/mesh/model/light/lightc/mm_lightc_ln.c new file mode 100644 index 0000000..61ec566 --- /dev/null +++ b/mesh/model/light/lightc/mm_lightc_ln.c @@ -0,0 +1,524 @@ +/** + **************************************************************************************** + * + * @file mm_lightc_ln.c + * + * @brief Mesh Model Light Lightness Client Module + * + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @addtogroup MM_LIGHTC_LN + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mm_itf.h" +#include "mm_lightc.h" + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Structure for Light Lightness Client model environment +typedef struct mm_lightc_ln_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; +} mm_lightc_ln_env_t; + +/* + * MESSAGE HANDLERS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Handler for Light Lightness Status and Light Lightness Linear Status messages. + * Note that both messages have same content. + * + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] src Source address of the message + * @param[in] linear True if message is a Light Lightness Linear Status message, else + * False + **************************************************************************************** + */ +__STATIC void mm_lightc_ln_handler_status(mesh_buf_t *p_buf, uint16_t src, bool linear) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Present lightness value + uint16_t lightness = read16p(p_data + MM_LIGHT_LN_STATUS_LIGHTNESS_POS); + // Target lightness value + uint16_t lightness_tgt; + // Remaining time in milliseconds + uint32_t rem_time_ms; + + // Check if optional parameters are provided + if (p_buf->data_len == MM_LIGHT_LN_STATUS_LEN) + { + lightness_tgt = read16p(p_data + MM_LIGHT_LN_STATUS_TGT_LIGHTNESS_POS); + rem_time_ms = mm_get_trans_time_ms(*(p_data + MM_LIGHT_LN_STATUS_REM_TIME_POS)); + } + else + { + lightness_tgt = 0; + rem_time_ms = 0; + } + + // Inform the application about the received Light Lightness or Light Lightness Linear state value + mm_cli_state_ind_send(src, (linear) ? MM_STATE_LIGHT_LN_LIN : MM_STATE_LIGHT_LN, + lightness, lightness_tgt, rem_time_ms); +} + +/** + **************************************************************************************** + * @brief Handler for Light Lightness Last Status message + * + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] src Source address of the message + **************************************************************************************** + */ +__STATIC void mm_lightc_ln_handler_status_last(mesh_buf_t *p_buf, uint16_t src) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Light Lightness Last state value + uint16_t lightness_last = read16p(p_data + MM_LIGHT_LN_LAST_STATUS_LIGHTNESS_POS); + + // Inform the application about the received Light Lightness Last state value + mm_cli_state_ind_send(src, MM_STATE_LIGHT_LN_LAST, lightness_last, 0, 0); +} + +/** + **************************************************************************************** + * @brief Handler for Light Lightness Default Status message + * + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] src Source address of the message + **************************************************************************************** + */ +__STATIC void mm_lightc_ln_handler_status_dflt(mesh_buf_t *p_buf, uint16_t src) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Light Lightness Default state value + uint16_t lightness_dflt = read16p(p_data + MM_LIGHT_LN_DFLT_STATUS_LIGHTNESS_POS); + + // Inform the application about the received Light Lightness Default state value + mm_cli_state_ind_send(src, MM_STATE_LIGHT_LN_DFLT, lightness_dflt, 0, 0); +} + +/** + **************************************************************************************** + * @brief Handler for Light Lightness Range Status message + * + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] src Source address of the message + **************************************************************************************** + */ +__STATIC void mm_lightc_ln_handler_status_range(mesh_buf_t *p_buf, uint16_t src) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Light Lightness Range state value (minimum) + uint16_t lightness_min = read16p(p_data + MM_LIGHT_LN_RANGE_STATUS_MIN_POS); + // Light Lightness Range state value (maximum) + uint16_t lightness_max = read16p(p_data + MM_LIGHT_LN_RANGE_STATUS_MAX_POS); + + // Inform the application about the received Light Lightness Range state value + mm_cli_state_ind_send(src, MM_STATE_LIGHT_LN_RANGE, lightness_min, lightness_max, 0); +} + +/* + * INTERNAL CALLBACK FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Inform Light Lightness Client model about reception of a message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing environment containing information about the + * received message + **************************************************************************************** + */ +__STATIC void mm_lightc_ln_cb_rx(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + // Call the appropriate handler for the received message + switch (p_route_env->opcode) + { + case (MM_MSG_LIGHT_LN_STATUS): + case (MM_MSG_LIGHT_LN_LINEAR_STATUS): + { + mm_lightc_ln_handler_status(p_buf, p_route_env->u_addr.src, + (p_route_env->opcode == MM_MSG_LIGHT_LN_LINEAR_STATUS)); + } break; + + case (MM_MSG_LIGHT_LN_LAST_STATUS): + { + mm_lightc_ln_handler_status_last(p_buf, p_route_env->u_addr.src); + } break; + + case (MM_MSG_LIGHT_LN_DFLT_STATUS): + { + mm_lightc_ln_handler_status_dflt(p_buf, p_route_env->u_addr.src); + } break; + + case (MM_MSG_LIGHT_LN_RANGE_STATUS): + { + mm_lightc_ln_handler_status_range(p_buf, p_route_env->u_addr.src); + } break; + + default: + { + } break; + } +} + +/** + **************************************************************************************** + * @brief Inform Light Lightness Client model about a received opcode in order + * to check if the model is authorized to handle the associated message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] opcode Opcode value to be checked + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lightc_ln_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status; + + if ((opcode == MM_MSG_LIGHT_LN_STATUS) + || (opcode == MM_MSG_LIGHT_LN_LINEAR_STATUS) + || (opcode == MM_MSG_LIGHT_LN_LAST_STATUS) + || (opcode == MM_MSG_LIGHT_LN_DFLT_STATUS) + || (opcode == MM_MSG_LIGHT_LN_RANGE_STATUS)) + { + status = MESH_ERR_NO_ERROR; + } + else + { + status = MESH_ERR_MDL_INVALID_OPCODE; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Get Light Lightness Get or Light Lightness Linear Get or Light Lightness Last + * Get or Light Lightness Default Get or Light Lightness Range Get state value + * + * - Light Lightness Get: Light Lightness state value + * - Light Lightness Linear Get: Light Lightness Linear state value + * - Light Lightness Last Get: Light Lightness Last state value + * - Light Lightness Default Get: Light Lightness Default state value + * - Light Lightness Range Get: Light Lightness Range state value + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element from which state value must be retrieved + * @param[in] get_option Get option (@see enum mm_get_type_light_ln) + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lightc_ln_cb_get(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint16_t get_info) +{ + // Status + uint8_t status = MESH_ERR_NO_ERROR; + // Get type + uint8_t get_type = get_info; + + // Check option value + if (get_type <= MM_GET_TYPE_LIGHT_LN_MAX) + { + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_get; + + // Allocate a new buffer for the message + p_buf_get = mm_route_buf_alloc(0); + + if (p_buf_get) + { + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_get->env; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + + if (get_type == MM_GET_TYPE_LIGHT_LN_ACTUAL) + { + p_buf_env->opcode = MM_MSG_LIGHT_LN_GET; + } + else if (get_type == MM_GET_TYPE_LIGHT_LN_LINEAR) + { + p_buf_env->opcode = MM_MSG_LIGHT_LN_LINEAR_GET; + } + else if (get_type == MM_GET_TYPE_LIGHT_LN_DFLT) + { + p_buf_env->opcode = MM_MSG_LIGHT_LN_DFLT_GET; + } + else if (get_type == MM_GET_TYPE_LIGHT_LN_LAST) + { + p_buf_env->opcode = MM_MSG_LIGHT_LN_LAST_GET; + } + else // (option == MM_GET_TYPE_LIGHT_LN_RANGE) + { + p_buf_env->opcode = MM_MSG_LIGHT_LN_RANGE_GET; + } + + // Send the message + mm_route_send(p_buf_get); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + } + else + { + status = MESH_ERR_INVALID_PARAM; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Set Light Lightness or Light Lightness Linear state value. Note that Light Lightness + * Set/Set Unacknowledged and Light Lightness Linear Set/Set Unacknowledged have the same + * content. + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element on which state value must be set + * @param[in] state_1 State value 1 + * @param[in] state_2 State value 2 + * @param[in] trans_time_ms Transition time in milliseconds + * @param[in] delay_ms Delay in milliseconds + * @param[in] trans_info Transition information + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lightc_ln_cb_trans(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint32_t state_1, uint32_t state_2, + uint32_t trans_time_ms, uint16_t delay_ms, + uint16_t trans_info) +{ + // Transition type + uint8_t trans_type = GETF(trans_info, MM_TRANS_INFO_TYPE); + // Status + uint8_t status = MESH_ERR_NO_ERROR; + + if (trans_type <= MM_TRANS_TYPE_LIGHT_LN_MAX) + { + // Long message or not + bool long_set = (GETB(trans_info, MM_TRANS_INFO_LONG) || trans_time_ms || delay_ms); + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_set = mm_route_buf_alloc( + (long_set) ? MM_LIGHT_LN_SET_LEN : MM_LIGHT_LN_SET_MIN_LEN); + + if (p_buf_set) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_set); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_set->env; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + + // Set opcode + if (trans_type == MM_TRANS_TYPE_LIGHT_LN_LIN) + { + p_buf_env->opcode = (GETB(trans_info, MM_TRANS_INFO_ACK)) + ? MM_MSG_LIGHT_LN_LINEAR_SET : MM_MSG_LIGHT_LN_LINEAR_SET_UNACK; + } + else + { + p_buf_env->opcode = (GETB(trans_info, MM_TRANS_INFO_ACK)) + ? MM_MSG_LIGHT_LN_SET : MM_MSG_LIGHT_LN_SET_UNACK; + } + + // Fill the message + write16p(p_data + MM_LIGHT_LN_SET_LIGHTNESS_POS, state_1); + *(p_data + MM_LIGHT_LN_SET_TID_POS) = GETF(trans_info, MM_TRANS_INFO_TID); + + if (long_set) + { + // Set transition time and delay values + *(p_data + MM_LIGHT_LN_SET_TRANS_TIME_POS) = mm_get_trans_time(trans_time_ms); + *(p_data + MM_LIGHT_LN_SET_DELAY_POS) = delay_ms / 5; + } + + // Send the message + mm_route_send(p_buf_set); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + } + else + { + status = MESH_ERR_INVALID_PARAM; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Set Light Lightness Default or Light Lightness Range state value + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element on which state value must be set + * @param[in] state_1 State value 1 + * @param[in] state_2 State value 2 + * @param[in] set_info Set information + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lightc_ln_cb_set(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint32_t state_1, uint32_t state_2, + uint16_t set_info) +{ + // Set type + uint8_t set_type = GETF(set_info, MM_SET_INFO_TYPE); + // Status + uint8_t status = MESH_ERR_NO_ERROR; + + // Check provided set type + if (set_type <= MM_SET_TYPE_LIGHT_LN_MAX) + { + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_set; + // Opcode + uint32_t opcode; + // Length + uint8_t length; + + if (set_type == MM_SET_TYPE_LIGHT_LN_DFLT) + { + length = MM_LIGHT_LN_DFLT_SET_LEN; + opcode = GETB(set_info, MM_SET_INFO_ACK) + ? MM_MSG_LIGHT_LN_DFLT_SET : MM_MSG_LIGHT_LN_DFLT_SET_UNACK; + } + else // (set_type == MM_SET_TYPE_LIGHT_LN_RANGE) + { + length = MM_LIGHT_LN_RANGE_SET_LEN; + opcode = GETB(set_info, MM_SET_INFO_ACK) + ? MM_MSG_LIGHT_LN_RANGE_SET : MM_MSG_LIGHT_LN_RANGE_SET_UNACK; + } + + // Allocate a new buffer for the publication + p_buf_set = mm_route_buf_alloc(length); + + if (p_buf_set) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_set); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_set->env; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + p_buf_env->opcode = opcode; + + // Fill the message + if (set_type == MM_SET_TYPE_LIGHT_LN_DFLT) + { + write16p(p_data + MM_LIGHT_LN_DFLT_SET_LIGHTNESS_POS, state_1); + } + else // (set_type == MM_SET_TYPE_LN_RANGE) + { + write16p(p_data + MM_LIGHT_LN_RANGE_SET_MIN_POS, state_1); + write16p(p_data + MM_LIGHT_LN_RANGE_SET_MAX_POS, state_2); + } + + // Send the message + mm_route_send(p_buf_set); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + } + else + { + status = MESH_ERR_INVALID_PARAM; + } + + return (status); +} + +/* + * GLOBAL FUNCTIONS + **************************************************************************************** + */ + +__STATIC mm_cli_cb_t mm_lightc_ln_cb = +{ + .cb_get = mm_lightc_ln_cb_get, + .cb_set = mm_lightc_ln_cb_set, + .cb_trans = mm_lightc_ln_cb_trans, +}; + +uint8_t mm_lightc_ln_register(void) +{ + // Register the model + m_lid_t mdl_lid = ms_register_model(MM_ID_LIGHTC_LN, 0, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) //if (status == MESH_ERR_NO_ERROR) + { + // Inform the Model State Manager about registered model + mm_lightc_ln_env_t *p_env_ln = (mm_lightc_ln_env_t *)mm_state_register(0, MM_ID_LIGHTC_LN, mdl_lid, + MM_ROLE_CLI, sizeof(mm_lightc_ln_env_t)); + + if (p_env_ln) + { + // Get client-specific callback functions + //mm_cli_cb_t *p_cb_cli = p_env_ln->env.cb.u.p_cb_cli; + + // Set internal callback functions + p_env_ln->env.mdl_cb.cb_rx = mm_lightc_ln_cb_rx; + p_env_ln->env.mdl_cb.cb_opcode_check = mm_lightc_ln_cb_opcode_check; + //p_cb_cli->cb_get = mm_lightc_ln_cb_get; + //p_cb_cli->cb_set = mm_lightc_ln_cb_set; + //p_cb_cli->cb_trans = mm_lightc_ln_cb_trans; + p_env_ln->env.mdl_cb.p_cb_cli = &mm_lightc_ln_cb; + + // Inform application about registered model + mm_register_ind_send(MM_ID_LIGHTC_LN, 0, mdl_lid); + } + } + + return (mdl_lid); +} + +/// @} end of group diff --git a/mesh/model/light/lightc/mm_lightc_xyl.c b/mesh/model/light/lightc/mm_lightc_xyl.c new file mode 100644 index 0000000..cc5fe43 --- /dev/null +++ b/mesh/model/light/lightc/mm_lightc_xyl.c @@ -0,0 +1,519 @@ +/** + **************************************************************************************** + * + * @file mm_lightc_xyl.c + * + * @brief Mesh Model Light xyL Client Module + * + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @addtogroup MM_LIGHTC_XYL + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mm_itf.h" +#include "mm_lightc.h" + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Structure for Light xyL Client model environment +typedef struct mm_lightc_xyL_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; +} mm_lightc_xyl_env_t; + +/* + * MESSAGE HANDLERS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Handler for Light xyL Status and Light xyL Target Status messages. + * Note that both messages have the same content. + * + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] src Source address of the message + * @param[in] target True if Light xyL Target Status message, else false + **************************************************************************************** + */ +__STATIC void mm_lightc_xyl_handler_status(mesh_buf_t *p_buf, uint16_t src, bool target) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Light xyL Lightness state value + uint16_t lightness = read16p(p_data + MM_LIGHT_XYL_STATUS_LIGHTNESS_POS); + // Light xyL x state value + uint16_t x = read16p(p_data + MM_LIGHT_XYL_STATUS_X_POS); + // Light xyL y state value + uint16_t y = read16p(p_data + MM_LIGHT_XYL_STATUS_Y_POS); + // Remaining time in milliseconds + uint32_t rem_time_ms; + + if (p_buf->data_len == MM_LIGHT_XYL_STATUS_LEN) + { + rem_time_ms = mm_get_trans_time_ms(*(p_data + MM_LIGHT_XYL_STATUS_REM_TIME_POS)); + } + else + { + rem_time_ms = 0; + } + + // Inform the application about the received Light xyL Lightness state value + mm_cli_state_ind_send(src, (target) ? MM_STATE_LIGHT_XYL_LN_TGT : MM_STATE_LIGHT_XYL_LN, + lightness, 0, rem_time_ms); + // Inform the application about the received Light xyL XY state value + mm_cli_state_ind_send(src, (target) ? MM_STATE_LIGHT_XYL_XY_TGT : MM_STATE_LIGHT_XYL_XY, + x , y, rem_time_ms); +} + +/** + **************************************************************************************** + * @brief Handler for Light xyL Default Status message + * + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] src Source address of the message + **************************************************************************************** + */ +__STATIC void mm_lightc_xyl_handler_status_dflt(mesh_buf_t *p_buf, uint16_t src) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Light xyL Lightness Default state value + uint16_t lightness = read16p(p_data + MM_LIGHT_XYL_TGT_STATUS_LIGHTNESS_POS); + // Light xyL x Default state value + uint16_t x = read16p(p_data + MM_LIGHT_XYL_TGT_STATUS_X_POS); + // Light xyL y Default state value + uint16_t y = read16p(p_data + MM_LIGHT_XYL_TGT_STATUS_Y_POS); + + // Inform the application about the received Light xyL Lightness Default state value + mm_cli_state_ind_send(src, MM_STATE_LIGHT_XYL_LN_DFLT, lightness, 0, 0); + // Inform the application about the received Target Light xyL x and y state value + mm_cli_state_ind_send(src, MM_STATE_LIGHT_XYL_XY_DFLT, x, y, 0); +} + +/** + **************************************************************************************** + * @brief Handler for Light xyL Range Status message + * + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] src Source address of the message + **************************************************************************************** + */ +__STATIC void mm_lightc_xyl_handler_status_range(mesh_buf_t *p_buf, uint16_t src) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Light xyL x Range state value (minimum) + uint16_t x_min = read16p(p_data + MM_LIGHT_XYL_RANGE_STATUS_X_MIN_POS); + // Light xyL x Range state value (maximum) + uint16_t x_max = read16p(p_data + MM_LIGHT_XYL_RANGE_STATUS_X_MAX_POS); + // Light xyL y Range state value (minimum) + uint16_t y_min = read16p(p_data + MM_LIGHT_XYL_RANGE_STATUS_Y_MIN_POS); + // Light xyL y Range state value (maximum) + uint16_t y_max = read16p(p_data + MM_LIGHT_XYL_RANGE_STATUS_Y_MAX_POS); + + // Inform the application about the received Light xyL x Range state value + mm_cli_state_ind_send(src, MM_STATE_LIGHT_XYL_XY_RANGE, + (uint32_t)x_min | ((uint32_t)x_max << 16), + (uint32_t)y_min | ((uint32_t)y_max << 16), 0); +} + +/* + * INTERNAL CALLBACK FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Inform Light xyL Client model about reception of a message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing environment containing information about the + * received message + **************************************************************************************** + */ +__STATIC void mm_lightc_xyl_cb_rx(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + // Call the appropriate handler for the received message + switch (p_route_env->opcode) + { + case (MM_MSG_LIGHT_XYL_STATUS): + case (MM_MSG_LIGHT_XYL_TGT_STATUS): + { + mm_lightc_xyl_handler_status(p_buf, p_route_env->u_addr.src, + (p_route_env->opcode == MM_MSG_LIGHT_XYL_TGT_STATUS)); + } break; + + case (MM_MSG_LIGHT_XYL_DFLT_STATUS): + { + mm_lightc_xyl_handler_status_dflt(p_buf, p_route_env->u_addr.src); + } break; + + case (MM_MSG_LIGHT_XYL_RANGE_STATUS): + { + mm_lightc_xyl_handler_status_range(p_buf, p_route_env->u_addr.src); + } break; + + default: + { + } break; + } +} + +/** + **************************************************************************************** + * @brief Inform Light xyL Client model about a received opcode in order + * to check if the model is authorized to handle the associated message + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] opcode Opcode value to be checked + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lightc_xyl_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status; + + if ((opcode == MM_MSG_LIGHT_XYL_STATUS) + || (opcode == MM_MSG_LIGHT_XYL_TGT_STATUS) + || (opcode == MM_MSG_LIGHT_XYL_DFLT_STATUS) + || (opcode == MM_MSG_LIGHT_XYL_RANGE_STATUS)) + { + status = MESH_ERR_NO_ERROR; + } + else + { + status = MESH_ERR_MDL_INVALID_OPCODE; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Send Light xyL Get or Light xyL Target Get or Light xyL Default Get or Light xyL + * Range message. + * + * - Light xyL Get: Light xyL Lightness and Light xyL x and Light xyL y state values + * - Light xyL Target Get: Light xyL Lightness and Light xyL x and Light xyL y state + * target values + * - Light xyL Default Get: Light Lightness and Light xyL x and Light xyL y state + * default values + * - Light xyL Range Get: Light xyL x and Light xyL y state range values + * + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element from which state value must be retrieved + * @param[in] get_option Get option (@see enum mm_get_type_light_xyl) + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lightc_xyl_cb_get(mm_mdl_env_t *p_env, m_lid_t app_key_lid, + uint16_t dst, uint16_t get_info) +{ + // Status + uint8_t status = MESH_ERR_NO_ERROR; + // Get type + uint8_t get_type = get_info; + + // Check option value + if (get_type <= MM_GET_TYPE_LIGHT_XYL_MAX) + { + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_get = mm_route_buf_alloc(0); + + if (p_buf_get) + { + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_get->env; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + + if (get_type == MM_GET_TYPE_LIGHT_XYL) + { + p_buf_env->opcode = MM_MSG_LIGHT_XYL_GET; + } + else if (get_type == MM_GET_TYPE_LIGHT_XYL_TGT) + { + p_buf_env->opcode = MM_MSG_LIGHT_XYL_TGT_GET; + } + else if (get_type == MM_GET_TYPE_LIGHT_XYL_DFLT) + { + p_buf_env->opcode = MM_MSG_LIGHT_XYL_DFLT_GET; + } + else // (option == MM_GET_TYPE_LIGHT_XYL_RANGE) + { + p_buf_env->opcode = MM_MSG_LIGHT_XYL_RANGE_GET; + } + + // Send the message + mm_route_send(p_buf_get); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + } + else + { + status = MESH_ERR_INVALID_PARAM; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Send Light xyL Set or Light xyL Set Unacknowledged message in order to set: + * - Light xyL Lightness state value + * - Light xyL x state value + * - Light xyL y state value + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element on which state value must be set + * @param[in] state_1 State value 1 + * - Light xyL Lightness state value (uint16_t) (Bit 0-15) | Light xyL x + * state value (uint16_t) (Bit 16-31) + * @param[in] state_2 State value 2 + * - Light xyL y state value (uint16_t) + * @param[in] trans_time_ms Transition time in milliseconds + * @param[in] delay_ms Delay in milliseconds + * @param[in] trans_info Transition information (@see enum mm_trans_info and + * @see enum mm_trans_type_light_xyl) + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lightc_xyl_cb_trans(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint32_t state_1, uint32_t state_2, + uint32_t trans_time_ms, uint16_t delay_ms, + uint16_t trans_info) +{ + // Status + uint8_t status = MESH_ERR_NO_ERROR; + // Long message or not + bool long_set = (GETB(trans_info, MM_TRANS_INFO_LONG) || trans_time_ms || delay_ms); + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_set; + // Message length + uint8_t length = (long_set) ? MM_LIGHT_XYL_SET_LEN : MM_LIGHT_XYL_SET_MIN_LEN; + + // Allocate a new buffer + p_buf_set = mm_route_buf_alloc(length); + + if (p_buf_set) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_set); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_set->env; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + p_buf_env->opcode = (GETB(trans_info, MM_TRANS_INFO_ACK)) + ? MM_MSG_LIGHT_XYL_SET : MM_MSG_LIGHT_XYL_SET_UNACK; + + write16p(p_data + MM_LIGHT_XYL_SET_LIGHTNESS_POS, state_1); + write16p(p_data + MM_LIGHT_XYL_SET_X_POS, state_1 >> 16); + write16p(p_data + MM_LIGHT_XYL_SET_Y_POS, state_2); + + // Fill the message + *(p_data + MM_LIGHT_XYL_SET_TID_POS) = GETF(trans_info, MM_TRANS_INFO_TID); + + if (long_set) + { + // Set transition time and delay values + *(p_data + MM_LIGHT_XYL_SET_TRANS_TIME_POS) = mm_get_trans_time(trans_time_ms); + *(p_data + MM_LIGHT_XYL_SET_DELAY_POS) = delay_ms / 5; + } + + // Send the message + mm_route_send(p_buf_set); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Send Light xyL Default Set or Light xyL Default Set Unacknowledged message in + * order to set: + * - Light Lightness Default state value + * - Light xyL x Default state value + * - Light xyL y Default state value + * or Light xyL Range Set or Light xyL Range Set Unacknowledged message in order to set + * Light xyL x and Light xyL y Range state values + * + * @param[in] p_env Pointer to the environment allocated for the model + * @param[in] dst Address of node's element on which state value must be set + * @param[in] state_1 State value 1 + * - Light Lightness Default state value (uint16_t) (Bit 0-15) | Light xyL x + * Default state value (uint16_t) (Bit 16-31) if Light xyL Default Set message + * or + * - Light xyL x Range Min state value (uint16_t) (Bit 0-15) | Light xyL x Range Max + * state value (uint16_t) (Bit 16-31) if Light xyL Range Set message + * @param[in] state_2 State value 2 + * - Light xyL y Default state value (uint16_t) if Light xyL Default Set message + * or + * - Light xyL y Range Min state value (uint16_t) (Bit 0-15) | Light xyL y Range Max + * state value (uint16_t) (Bit 16-31) if Light xyL Range Set message + * @param[in] set_info Set information (@see enum mm_set_info and + * @see enum mm_set_type_light_xyl for set type value) + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lightc_xyl_cb_set(mm_mdl_env_t *p_env, m_lid_t app_key_lid, uint16_t dst, + uint32_t state_1, uint32_t state_2, + uint16_t set_info) +{ + // Set type + uint8_t set_type = GETF(set_info, MM_SET_INFO_TYPE); + // Status + uint8_t status = MESH_ERR_NO_ERROR; + + // Check provided set type + if (set_type <= MM_SET_TYPE_LIGHT_XYL_MAX) + { + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_set; + // Opcode + uint32_t opcode; + // Length + uint8_t length; + + if (set_type == MM_SET_TYPE_LIGHT_XYL_RANGE) + { + length = MM_LIGHT_XYL_RANGE_SET_LEN; + opcode = GETB(set_info, MM_SET_INFO_ACK) + ? MM_MSG_LIGHT_XYL_RANGE_SET : MM_MSG_LIGHT_XYL_RANGE_SET_UNACK; + } + else // (set_type == MM_SET_TYPE_LIGHT_XYL_DFLT) + { + length = MM_LIGHT_XYL_DFLT_SET_LEN; + opcode = GETB(set_info, MM_SET_INFO_ACK) + ? MM_MSG_LIGHT_XYL_DFLT_SET : MM_MSG_LIGHT_XYL_DFLT_SET_UNACK; + } + + // Allocate a new buffer for the publication + p_buf_set = mm_route_buf_alloc(length); + + if (p_buf_set) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_set); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_set->env; + + // Prepare environment + p_buf_env->app_key_lid = app_key_lid; + p_buf_env->u_addr.dst = dst; + p_buf_env->info = 0; + p_buf_env->mdl_lid = p_env->mdl_lid; + p_buf_env->opcode = opcode; + + // Fill the message + if (set_type == MM_SET_TYPE_LIGHT_XYL_RANGE) + { + write16p(p_data + MM_LIGHT_XYL_RANGE_SET_X_MIN_POS, state_1); + write16p(p_data + MM_LIGHT_XYL_RANGE_SET_X_MAX_POS, state_1 >> 16); + write16p(p_data + MM_LIGHT_XYL_RANGE_SET_Y_MIN_POS, state_2); + write16p(p_data + MM_LIGHT_XYL_RANGE_SET_Y_MAX_POS, state_2 >> 16); + } + else // (set_type == MM_SET_TYPE_LIGHT_XYL_DFLT) + { + write16p(p_data + MM_LIGHT_XYL_DFLT_SET_LIGHTNESS_POS, state_1); + write16p(p_data + MM_LIGHT_XYL_DFLT_SET_X_POS, (state_1 >> 16)); + write16p(p_data + MM_LIGHT_XYL_DFLT_SET_Y_POS, state_2); + } + + // Send the message + mm_route_send(p_buf_set); + } + else + { + status = MESH_ERR_INSUFFICIENT_RESOURCES; + } + } + else + { + status = MESH_ERR_INVALID_PARAM; + } + + return (status); +} + +/* + * GLOBAL FUNCTIONS + **************************************************************************************** + */ + +__STATIC const mm_cli_cb_t mm_lightc_xyl_cb = +{ + .cb_get = mm_lightc_xyl_cb_get, + .cb_set = mm_lightc_xyl_cb_set, + .cb_trans = mm_lightc_xyl_cb_trans, +}; + +uint8_t mm_lightc_xyl_register(void) +{ + // Register the model + m_lid_t mdl_lid = ms_register_model(MM_ID_LIGHTC_XYL, 0, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) + { + // Inform the Model State Manager about registered model + mm_lightc_xyl_env_t *p_env_xyl = (mm_lightc_xyl_env_t *)mm_state_register(0, MM_ID_LIGHTC_XYL, mdl_lid, + MM_ROLE_CLI, sizeof(mm_lightc_xyl_env_t)); + + if (p_env_xyl) + { + // Get client-specific callback functions + //mm_cli_cb_t *p_cb_cli = p_env_xyl->env.cb.u.p_cb_cli; + + // Set internal callback functions + p_env_xyl->env.mdl_cb.cb_rx = mm_lightc_xyl_cb_rx; + p_env_xyl->env.mdl_cb.cb_opcode_check = mm_lightc_xyl_cb_opcode_check; + //p_cb_cli->cb_get = mm_lightc_xyl_cb_get; + //p_cb_cli->cb_set = mm_lightc_xyl_cb_set; + //p_cb_cli->cb_trans = mm_lightc_xyl_cb_trans; + p_env_xyl->env.mdl_cb.p_cb_cli = &mm_lightc_xyl_cb; + + // Inform application about registered model + mm_register_ind_send(MM_ID_LIGHTC_XYL, 0, mdl_lid); + } + } + + return (mdl_lid); +} + +/// @} end of group diff --git a/mesh/model/light/lights/mm_lights_ctl.c b/mesh/model/light/lights/mm_lights_ctl.c new file mode 100644 index 0000000..6befe4f --- /dev/null +++ b/mesh/model/light/lights/mm_lights_ctl.c @@ -0,0 +1,1886 @@ +/** + **************************************************************************************** + * @file mm_lights_ctl.c + * + * @brief Mesh Model Light CTL Server Module + * + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @addtogroup MM_LIGHTS_CTL + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mm_itf.h" +#include "mm_gens.h" +#include "mm_lights.h" + +/* + * DEFINES + **************************************************************************************** + */ + +/// Validity of information provided to the Replay Manager +#define MM_LIGHTS_CTL_REPLAY_MS (6000) +/// Minimum value for Light CTL Temperature state value +#define MM_LIGHTS_CTL_TEMP_MIN (0x0320) +/// Maximum value for Light CTL Temperature state value +#define MM_LIGHTS_CTL_TEMP_MAX (0x4E20) + +/* + * ENUMERATIONS + **************************************************************************************** + */ + +/// Bit field content for status_info value present in environment for Light CTL Server model +/// 7 6 5 4 3 2 1 0 +/// +------------+-----------+----------+-------------+-----------+----------+---------+-------+ +/// | Trans Temp | Trans DUV | Trans LN | Temp Status | Wait Temp | Wait DUV | Wait LN | Relay | +/// +------------+-----------+----------+-------------+-----------+----------+---------+-------+ +enum mm_lights_ctl_sinfo_bf +{ + /// Relaying of sent status message is authorized + MM_LIGHTS_CTL_SINFO_RELAY_POS = 0, + MM_LIGHTS_CTL_SINFO_RELAY_BIT = (1 << MM_LIGHTS_CTL_SINFO_RELAY_POS), + + /// Wait for transition event for Light CTL Lightness state + MM_LIGHTS_CTL_SINFO_WAIT_LN_POS = 1, + MM_LIGHTS_CTL_SINFO_WAIT_LN_BIT = (1 << MM_LIGHTS_CTL_SINFO_WAIT_LN_POS), + + /// Wait for transition event for Light CTL Delta UV state + MM_LIGHTS_CTL_SINFO_WAIT_DUV_POS = 2, + MM_LIGHTS_CTL_SINFO_WAIT_DUV_BIT = (1 << MM_LIGHTS_CTL_SINFO_WAIT_DUV_POS), + + /// Wait for transition event for Light CTL Temperature state + MM_LIGHTS_CTL_SINFO_WAIT_TEMP_POS = 3, + MM_LIGHTS_CTL_SINFO_WAIT_TEMP_BIT = (1 << MM_LIGHTS_CTL_SINFO_WAIT_TEMP_POS), + + /// Wait for transition event mask + MM_LIGHTS_CTL_SINFO_WAIT_LSB = 1, + MM_LIGHTS_CTL_SINFO_WAIT_MASK = 0x0E, + + /// Indicate if Light CTL Status (0) or Light CTL Temperature Status message must be sent + MM_LIGHTS_CTL_SINFO_TEMP_STATUS_POS = 4, + MM_LIGHTS_CTL_SINFO_TEMP_STATUS_BIT = (1 << MM_LIGHTS_CTL_SINFO_TEMP_STATUS_POS), + + /// Transition for Light CTL Lightness state in progress + MM_LIGHTS_CTL_SINFO_TRANS_LN_POS = 5, + MM_LIGHTS_CTL_SINFO_TRANS_LN_BIT = (1 << MM_LIGHTS_CTL_SINFO_TRANS_LN_POS), + + /// Transition for Light CTL Delta UV state in progress + MM_LIGHTS_CTL_SINFO_TRANS_DUV_POS = 6, + MM_LIGHTS_CTL_SINFO_TRANS_DUV_BIT = (1 << MM_LIGHTS_CTL_SINFO_TRANS_DUV_POS), + + /// Transition for Light CTL Temperature in progress + MM_LIGHTS_CTL_SINFO_TRANS_TEMP_POS = 7, + MM_LIGHTS_CTL_SINFO_TRANS_TEMP_BIT = (1 << MM_LIGHTS_CTL_SINFO_TRANS_TEMP_POS), + + /// Transition in progress mask + MM_LIGHTS_CTL_SINFO_TRANS_LSB = 5, + MM_LIGHTS_CTL_SINFO_TRANS_MASK = 0xE0, +}; + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +typedef struct mm_lights_ctl_env mm_lights_ctl_env_t; +typedef struct mm_lights_ctls_env mm_lights_ctls_env_t; +typedef struct mm_lights_ctlt_env mm_lights_ctlt_env_t; + +/// Structure for Light CTL Server model environment +struct mm_lights_ctl_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; + /// Timer for sending of publications + mesh_timer_t tmr_publi; + /// Publication period in milliseconds + uint32_t publi_period_ms; + + /// Environment for replay protection mechanism + mm_replay_env_t replay_env; + + /// Pointer to environment of associated Light CTL Temperature model + mm_lights_ctlt_env_t *p_env_ctlt; + + /// Delta value in case of move transition for Light CTL Lightness state value + int16_t move_delta; + /// Light CTL Lightness state value + uint16_t ln; + /// Target Light CTL Lightness state value + uint16_t ln_tgt; + /// Light CTL Delta UV state value + int16_t delta_uv; + /// Target Light CTL Delta UV state value + int16_t delta_uv_tgt; + /// Light CTL Delta Default state value + int16_t delta_uv_dflt; + + /// Source address of set message that has triggered last or current transition + uint8_t status_dst_addr; + /// Application key local index to be used for transmission of Light CTL Status + /// or Light CTL Linear Status message + m_lid_t status_app_key_lid; + /// Status information bitfield (@see enum mm_lights_ctl_sinfo_bf) + uint8_t status_info; +}; + +/// Structure for Light CTL Setup Server model environment +struct mm_lights_ctls_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; + + /// Pointer to environment of associated Light CTL Server model + mm_lights_ctl_env_t *p_env_ctl; +}; + +/// Structure for Light CTL Temperature Server model environment +struct mm_lights_ctlt_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; + /// Timer for sending of publications + mesh_timer_t tmr_publi; + /// Publication period in milliseconds + uint32_t publi_period_ms; + + /// Pointer to environment of associated Light CTL Temperature model + mm_lights_ctl_env_t *p_env_ctl; + + /// Delta value in case of move transition for Light CTL Temperature state value + int16_t move_delta; + /// Light CTL Temperature + uint16_t temp; + /// Target Light CTL Temperature + uint16_t temp_tgt; + /// Target Generic Level value - Keep it in order to not accumulate error due to division + int16_t lvl_tgt; + /// Light CTL Temperature Default + uint16_t temp_dflt; + /// Light CTL Temperature Range Min state value + uint16_t temp_min; + /// Light CTL Temperature Range Max state value + uint16_t temp_max; +}; + +/* + * LOCAL FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Prepare and send a Light CTL Status message. + * + * @param[in] p_env_ctl Pointer to Light CTL Server model environment + * @param[in] p_route_env Pointer to structure containing reception information provided + * by Mesh Profile for received request message + * @param[in] publish Indicate if message is sent as a publication (true) or as + * a response to a received request (false) + **************************************************************************************** + */ +__STATIC void mm_lights_ctl_send_status(mm_lights_ctl_env_t *p_env_ctl, + mm_route_env_t *p_route_env, bool publish) +{ + // Get environment for Light CTL Temperature Server model + mm_lights_ctlt_env_t *p_env_ctlt = p_env_ctl->p_env_ctlt; + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_status; + // Remaining time for Light CTL Lightness state and for Light CTL Temperature + // state transition + uint8_t ln_rem_time, temp_rem_time; + // Transition type for Light CTL Lightness and for Light CTL Temperature states + uint8_t ln_trans_type, temp_trans_type; + // Data length + uint8_t data_length; + + // Check if a transition has been started + mm_bind_get_trans_info(p_env_ctl->env.grp_lid, &ln_trans_type, &ln_rem_time); + mm_bind_get_trans_info(p_env_ctlt->env.grp_lid, &temp_trans_type, &temp_rem_time); + + // Deduce deduce data length + data_length = ((ln_trans_type != MM_TRANS_TYPE_NONE) || (temp_trans_type != MM_TRANS_TYPE_NONE)) + ? MM_LIGHT_CTL_STATUS_LEN : MM_LIGHT_CTL_STATUS_MIN_LEN; + + p_buf_status = mm_route_buf_alloc(data_length); + if (p_buf_status) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_status); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_status->env; + + // Prepare environment + if (p_route_env) + { + memcpy(p_buf_env, p_route_env, sizeof(mm_route_env_t)); + } + else if (!publish) + { + p_buf_env->app_key_lid = p_env_ctl->status_app_key_lid; + p_buf_env->u_addr.dst = p_env_ctl->status_dst_addr; + SETB(p_buf_env->info, MM_ROUTE_INFO_RELAY, + GETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_RELAY)); + } + + SETB(p_buf_env->info, MM_ROUTE_INFO_RX, 0); + SETB(p_buf_env->info, MM_ROUTE_INFO_PUBLISH, publish); + p_buf_env->mdl_lid = p_env_ctl->env.mdl_lid; + p_buf_env->opcode = MM_MSG_LIGHT_CTL_STATUS; + + // Fill the message + write16p(p_data + MM_LIGHT_CTL_STATUS_LIGHTNESS_POS, p_env_ctl->ln); + write16p(p_data + MM_LIGHT_CTL_STATUS_TEMP_POS, p_env_ctlt->temp); + + if (data_length == MM_LIGHT_CTL_STATUS_LEN) + { + // Sent Target Light CTL Temperature and Light CTL Lightness state values + uint16_t temp_tgt, ln_tgt; + // Sent Remaining Time value + uint8_t rem_time = 0; + + if (ln_trans_type != MM_TRANS_TYPE_NONE) + { + if (ln_trans_type == MM_TRANS_TYPE_MOVE) + { + // Light Lightness Range + uint16_t ln_min = mm_lights_ln_get(p_env_ctl->env.elmt_idx, + MM_STATE_LIGHT_LN_RANGE_MIN); + uint16_t ln_max = mm_lights_ln_get(p_env_ctl->env.elmt_idx, + MM_STATE_LIGHT_LN_RANGE_MAX); + + ln_tgt = (p_env_ctl->move_delta > 0) ? ln_max : ln_min; + rem_time = MM_TRANS_TIME_UNKNOWN; + } + else + { + ln_tgt = p_env_ctl->ln_tgt; + rem_time = ln_rem_time; + } + } + else + { + ln_tgt = p_env_ctl->ln; + } + + if (temp_trans_type != MM_TRANS_TYPE_NONE) + { + if (temp_trans_type == MM_TRANS_TYPE_MOVE) + { + temp_tgt = (p_env_ctlt->move_delta > 0) ? p_env_ctlt->temp_max + : p_env_ctlt->temp_min; + rem_time = MM_TRANS_TIME_UNKNOWN; + } + else + { + temp_tgt = p_env_ctlt->temp_tgt; + + if (rem_time != MM_TRANS_TIME_UNKNOWN) + { + if (temp_rem_time > ln_rem_time) + { + rem_time = temp_rem_time; + } + } + } + } + else + { + temp_tgt = p_env_ctlt->temp; + } + + write16p(p_data + MM_LIGHT_CTL_STATUS_TGT_LIGHTNESS_POS, ln_tgt); + write16p(p_data + MM_LIGHT_CTL_STATUS_TGT_TEMP_POS, temp_tgt); + *(p_data + MM_LIGHT_CTL_STATUS_REM_TIME_POS) = rem_time; + } + + // Send the message + mm_route_send(p_buf_status); + } +} + +/** + **************************************************************************************** + * @brief Prepare and send a Light CTL Temperature Status message + * + * @param[in] p_env_ctlt Pointer to Light CTL Temperature Server model environment + * @param[in] p_route_env Pointer to structure containing reception information provided + * by Mesh Profile for received request message + * @param[in] publish Indicate if message is sent as a publication (true) or as + * a response to a received request (false) + **************************************************************************************** + */ +__STATIC void mm_lights_ctl_send_status_temp(mm_lights_ctlt_env_t *p_env_ctlt, + mm_route_env_t *p_route_env, bool publish) +{ + // Get environment for Light CTL Server model + mm_lights_ctl_env_t *p_env_ctl = p_env_ctlt->p_env_ctl; + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_status; + // Remaining time for Light CTL Lightness state and for Light CTL Temperature + // state transition + uint8_t ln_rem_time, temp_rem_time;; + // Transition type for Light CTL Lightness and for Light CTL Temperature states + uint8_t ln_trans_type, temp_trans_type; + // Data length + uint8_t data_length; + + // Check if a transition has been started + mm_bind_get_trans_info(p_env_ctl->env.grp_lid, &ln_trans_type, &ln_rem_time); + mm_bind_get_trans_info(p_env_ctlt->env.grp_lid, &temp_trans_type, &temp_rem_time); + + // Deduce deduce data length + data_length = ((ln_trans_type != MM_TRANS_TYPE_NONE) || (temp_trans_type != MM_TRANS_TYPE_NONE)) + ? MM_LIGHT_CTL_TEMP_STATUS_LEN : MM_LIGHT_CTL_TEMP_STATUS_MIN_LEN; + + p_buf_status = mm_route_buf_alloc(data_length); + if (p_buf_status) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_status); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_status->env; + + // Prepare environment + if (p_route_env) + { + memcpy(p_buf_env, p_route_env, sizeof(mm_route_env_t)); + } + else if (!publish) + { + p_buf_env->app_key_lid = p_env_ctl->status_app_key_lid; + p_buf_env->u_addr.dst = p_env_ctl->status_dst_addr; + SETB(p_buf_env->info, MM_ROUTE_INFO_RELAY, + GETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_RELAY)); + } + + SETB(p_buf_env->info, MM_ROUTE_INFO_RX, 0); + SETB(p_buf_env->info, MM_ROUTE_INFO_PUBLISH, publish); + p_buf_env->mdl_lid = p_env_ctlt->env.mdl_lid; + p_buf_env->opcode = MM_MSG_LIGHT_CTL_TEMP_STATUS; + + // Fill the message + write16p(p_data + MM_LIGHT_CTL_TEMP_STATUS_TEMP_POS, p_env_ctlt->temp); + write16p(p_data + MM_LIGHT_CTL_TEMP_STATUS_DELTA_UV_POS, p_env_ctl->delta_uv); + + if (data_length == MM_LIGHT_CTL_TEMP_STATUS_LEN) + { + // Sent Target Light CTL Temperature and Light CTL Delta UV state values + uint16_t temp_tgt, delta_uv_tgt; + // Sent Remaining Time value + uint8_t rem_time = 0; + + if (ln_trans_type != MM_TRANS_TYPE_NONE) + { + delta_uv_tgt = p_env_ctl->delta_uv_tgt; + rem_time = ln_rem_time; + } + else + { + delta_uv_tgt = p_env_ctl->delta_uv; + } + + if (temp_trans_type != MM_TRANS_TYPE_NONE) + { + if (temp_trans_type == MM_TRANS_TYPE_MOVE) + { + temp_tgt = (p_env_ctlt->move_delta > 0) ? p_env_ctlt->temp_max + : p_env_ctlt->temp_min; + rem_time = MM_TRANS_TIME_UNKNOWN; + } + else + { + temp_tgt = p_env_ctlt->temp_tgt; + + if (temp_rem_time > ln_rem_time) + { + rem_time = temp_rem_time; + } + } + } + else + { + temp_tgt = p_env_ctlt->temp; + } + + write16p(p_data + MM_LIGHT_CTL_TEMP_STATUS_TGT_TEMP_POS, temp_tgt); + write16p(p_data + MM_LIGHT_CTL_TEMP_STATUS_TGT_DELTA_UV_POS, delta_uv_tgt); + *(p_data + MM_LIGHT_CTL_TEMP_STATUS_REM_TIME_POS) = rem_time; + } + + // Send the message + mm_route_send(p_buf_status); + } +} + +/** + **************************************************************************************** + * @brief Prepare and send a Light CTL Default Status message + * + * @param[in] p_env_ctl Pointer to Light CTL Server model environment + * @param[in] p_route_env Pointer to structure containing reception information provided + * by Mesh Profile for received request message + **************************************************************************************** + */ +__STATIC void mm_lights_ctl_send_status_dflt(mm_lights_ctl_env_t *p_env_ctl, + mm_route_env_t *p_route_env) +{ + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_status = mm_route_buf_alloc_status(MM_LIGHT_CTL_DFLT_STATUS_LEN, p_route_env); + + if (p_buf_status) + { + // Get pointer to environment for Light Lightness CTL Temperature Server model + mm_lights_ctlt_env_t *p_env_ctlt = p_env_ctl->p_env_ctlt; + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_status); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_status->env; + + // Prepare environment + p_buf_env->mdl_lid = p_env_ctl->env.mdl_lid; + p_buf_env->opcode = MM_MSG_LIGHT_CTL_DFLT_STATUS; + + // Fill the message + write16p(p_data + MM_LIGHT_CTL_DFLT_STATUS_LIGHTNESS_POS, + mm_lights_ln_get(p_env_ctl->env.elmt_idx, MM_STATE_LIGHT_LN_DFLT)); + write16p(p_data + MM_LIGHT_CTL_DFLT_STATUS_TEMP_POS, p_env_ctlt->temp_dflt); + write16p(p_data + MM_LIGHT_CTL_DFLT_STATUS_DELTA_UV_POS, p_env_ctl->delta_uv_dflt); + + // Send the message + mm_route_send(p_buf_status); + } +} + +/** + **************************************************************************************** + * @brief Prepare and send a Light CTL Temperature Range Status message + * + * @param[in] p_env_ctlt Pointer to Light CTL Temperature Server model environment + * @param[in] p_route_env Pointer to structure containing reception information provided + * by Mesh Profile for received request message + * @param[in] status Status sent in the Light CTL Temperature Status message + * (@see enum mm_status) + **************************************************************************************** + */ +__STATIC void mm_lights_ctl_send_status_temp_range(mm_lights_ctl_env_t *p_env_ctl, + mm_route_env_t *p_route_env, + uint8_t status) +{ + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_status = mm_route_buf_alloc_status(MM_LIGHT_CTL_TEMP_RANGE_STATUS_LEN, p_route_env); + + if (p_buf_status) + { + // Pointer to environment for Light CTL Temperature Server model + mm_lights_ctlt_env_t *p_env_ctlt = p_env_ctl->p_env_ctlt; + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_status); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_status->env; + + // Prepare environment + p_buf_env->mdl_lid = p_env_ctl->env.mdl_lid; + p_buf_env->opcode = MM_MSG_LIGHT_CTL_TEMP_RANGE_STATUS; + + // Fill the message + *(p_data + MM_LIGHT_CTL_TEMP_RANGE_STATUS_CODE_POS) = status; + write16p(p_data + MM_LIGHT_CTL_TEMP_RANGE_STATUS_MIN_POS, p_env_ctlt->temp_min); + write16p(p_data + MM_LIGHT_CTL_TEMP_RANGE_STATUS_MAX_POS, p_env_ctlt->temp_max); + + // Send the message + mm_route_send(p_buf_status); + } +} + +/** + **************************************************************************************** + * @brief Publish Light CTL state value if sending of publications is enabled + * + * @param[in] p_env_ctl Pointer to Light CTL Server model environment + **************************************************************************************** + */ +__STATIC void mm_lights_ctl_publish(mm_lights_ctl_env_t *p_env_ctl) +{ + // Check if sending of publication is enabled + if (GETB(p_env_ctl->env.info, MM_INFO_PUBLI)) + { + mm_lights_ctl_send_status(p_env_ctl, NULL, true); + } +} + +/** + **************************************************************************************** + * @brief Publish Light CTL Temperature state value if sending of publications is enabled + * + * @param[in] p_env_ctlt Pointer to Light CTL Temperature Server model environment + **************************************************************************************** + */ +__STATIC void mm_lights_ctl_publish_temp(mm_lights_ctlt_env_t *p_env_ctlt) +{ + // Check if sending of publication is enabled + if (GETB(p_env_ctlt->env.info, MM_INFO_PUBLI)) + { + mm_lights_ctl_send_status_temp(p_env_ctlt, NULL, true); + } +} + +/** + **************************************************************************************** + * @brief Check if a Light CTL Status or a Light CTL Temperature Status message must be sent + * and send it if it is the case + * + * @param[in] p_env_ctl Pointer to Light CTL Server model environment + **************************************************************************************** + */ +__STATIC void mm_lights_ctl_check_status(mm_lights_ctl_env_t *p_env_ctl, uint8_t event) +{ + if (!GETF(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_WAIT)) + { + // Get environment for Light CTL Temperature Server model + mm_lights_ctlt_env_t *p_env_ctlt = p_env_ctl->p_env_ctlt; + + if (p_env_ctl->status_dst_addr != MESH_UNASSIGNED_ADDR) + { + // Send a response to the node that has required the transition + if (!GETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TEMP_STATUS)) + { + mm_lights_ctl_send_status(p_env_ctl, NULL, false); + } + else + { + mm_lights_ctl_send_status_temp(p_env_ctl->p_env_ctlt, NULL, false); + } + + p_env_ctl->status_dst_addr = MESH_UNASSIGNED_ADDR; + } + + if (GETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS_LN) + || GETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS_TEMP)) + { + mm_lights_ctl_publish(p_env_ctl); + } + + if (GETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS_DUV) + || GETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS_TEMP)) + { + // Send a publication + mm_lights_ctl_publish_temp(p_env_ctlt); + } + + if (event == MM_GRP_EVENT_TRANS_STARTED) + { + SETF(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_WAIT, + GETF(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS)); + } + else + { + SETF(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_WAIT, 0); + SETF(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS, 0); + } + } +} + +/** + **************************************************************************************** + * @brief Convert a Generic Level value into a Light CTL Temperature value + * + * @param[in] lvl Generic level value + * @param[in] temp_min Light CTL Temperature Min value + * @param[in] temp_max Light CTL Temperature Max value + * + * @return Light CTL Temperature value + **************************************************************************************** + */ +__STATIC uint16_t mm_lights_ctl_lvl_to_temp(int16_t lvl, uint16_t temp_min, uint16_t temp_max) +{ + // Temperature value + uint32_t temp = (int32_t)lvl + 32768; + + temp *= (temp_max - temp_min); + temp /= 65535; + temp += temp_min; + + return ((uint16_t)temp); +} + +/** + **************************************************************************************** + * @brief Convert a Light CTL Temperature value into a Generic Level value + * + * @param[in] temp Light CTL Temperature value + * @param[in] temp_min Light CTL Temperature Min value + * @param[in] temp_max Light CTL Temperature Max value + * + * @return Generic Level value + **************************************************************************************** + */ +__STATIC int16_t mm_lights_ctl_temp_to_lvl(uint16_t temp, uint16_t temp_min, uint16_t temp_max) +{ + // Level value + int32_t lvl = ((int32_t)temp - temp_min); + + lvl *= 65535; + lvl /= (temp_max - temp_min); + lvl -= 32768; + + return ((int16_t)lvl); +} + +/** + **************************************************************************************** + * @brief Convert a Light CTL Temperature value into a Generic Level value + * + * @param[in] temp Light CTL Temperature value + * @param[in] temp_min Light CTL Temperature Min value + * @param[in] temp_max Light CTL Temperature Max value + * + * @return Generic Level value + **************************************************************************************** + */ +__STATIC uint16_t mm_lights_ctl_temp_add_delta(uint16_t temp, int32_t delta, + uint16_t temp_min, uint16_t temp_max) +{ + delta *= (temp_max - temp_min); + delta /= 65535; + delta += temp; + + return ((uint16_t)delta); +} + +/* + * MESSAGE HANDLERS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Handler for Light CTL Set/Set Unacknowledged message + * + * @param[in] p_env Pointer to environment of model for which message has been received + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing information for the received buffer + **************************************************************************************** + */ +__STATIC void mm_lights_ctl_handler_set(mm_lights_ctl_env_t *p_env_ctl, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + do + { + // Get environment for Light CTL Temperature Server model + mm_lights_ctlt_env_t *p_env_ctlt = p_env_ctl->p_env_ctlt; + // Check if a status message must be sent + bool send_status = (p_route_env->opcode == MM_MSG_LIGHT_CTL_SET); + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // TID value + uint8_t tid = *(p_data + MM_LIGHT_CTL_SET_TID_POS); + // Light CTL Lightness, Light CTL Temperature and Light CTL Delta UV value + uint16_t ln, temp; + int16_t delta_uv; + // Transition time + uint8_t trans_time; + // Delay + uint8_t delay; + + // Check if request can be processed + if ((p_env_ctl->status_dst_addr != MESH_UNASSIGNED_ADDR) + || (mm_replay_is_retx(&p_env_ctl->replay_env, p_route_env->u_addr.src, tid))) + { + // Send a Light CTL Status message + if (send_status) + { + mm_lights_ctl_send_status(p_env_ctl, p_route_env, false); + } + break; + } + + // Extract and check optional parameters if present + if (p_buf->data_len == MM_LIGHT_CTL_SET_LEN) + { + trans_time = (uint16_t)(*(p_data + MM_LIGHT_CTL_SET_TRANS_TIME_POS)); + + // Check received value + if (GETF(trans_time, MM_TRANS_TIME_STEP_NB) > MM_TRANS_TIME_STEPS_MAX) + { + // Drop the message + break; + } + + delay = *(p_data + MM_LIGHT_CTL_SET_DELAY_POS); + } + else + { + trans_time = MM_TRANS_TIME_UNKNOWN; + delay = 0; + } + + ln = read16p(p_data + MM_LIGHT_CTL_SET_LIGHTNESS_POS); + temp = read16p(p_data + MM_LIGHT_CTL_SET_TEMP_POS); + delta_uv = read16p(p_data + MM_LIGHT_CTL_SET_DELTA_UV_POS); + + // Ensure that Light CTL Temperature state value is between Light CTL Temperature + // Range Min and Max values + if (temp > p_env_ctlt->temp_max) + { + temp = p_env_ctlt->temp_max; + } + else if (temp < p_env_ctlt->temp_min) + { + temp = p_env_ctlt->temp_min; + } + + // Check if at least one of the states is modified + if ((ln == p_env_ctl->ln) + && (temp == p_env_ctlt->temp) + && (delta_uv == p_env_ctl->delta_uv)) + { + // Send a Light CTL Status message + if (send_status) + { + mm_lights_ctl_send_status(p_env_ctl, p_route_env, false); + } + break; + }; + + if (send_status) + { + // Keep information for transmission of status + p_env_ctl->status_dst_addr = p_route_env->u_addr.src; + p_env_ctl->status_app_key_lid = p_route_env->app_key_lid; + SETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TEMP_STATUS, 0); + SETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_RELAY, + GETB(p_route_env->info, MM_ROUTE_INFO_RELAY)); + } + + SETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS_LN, (ln != p_env_ctl->ln)); + SETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS_DUV, (delta_uv != p_env_ctl->delta_uv)); + SETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS_TEMP, (temp != p_env_ctlt->temp)); + SETF(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_WAIT, + GETF(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS)); + + if (GETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS_LN) + || GETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS_DUV)) + { + // Update target state + p_env_ctl->ln_tgt = ln; + p_env_ctl->delta_uv_tgt = delta_uv; + + // Inform the Binding Manager about new transition + mm_bind_trans_new(p_env_ctl->env.grp_lid, MM_TRANS_TYPE_CLASSIC, trans_time, delay); + } + + if (GETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS_TEMP)) + { + // Update target state + p_env_ctlt->temp_tgt = temp; + p_env_ctlt->lvl_tgt = mm_lights_ctl_temp_to_lvl(p_env_ctlt->temp_tgt, p_env_ctlt->temp_min, + p_env_ctlt->temp_max); + + // Inform the Binding Manager about new transition + mm_bind_trans_new(p_env_ctlt->env.grp_lid, MM_TRANS_TYPE_CLASSIC, trans_time, delay); + } + } while (0); +} + +/** + **************************************************************************************** + * @brief Handler for Light CTL Temperature Set/Set Unacknowledged message + * + * @param[in] p_env Pointer to environment of model for which message has been received + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing information for the received buffer + **************************************************************************************** + */ +__STATIC void mm_lights_ctl_handler_set_temp(mm_lights_ctlt_env_t *p_env_ctlt, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + do + { + // Get pointer to environment for Light Lightness CTL Server model + mm_lights_ctl_env_t *p_env_ctl = p_env_ctlt->p_env_ctl; + // Check if a status message must be sent + bool send_status = (p_route_env->opcode == MM_MSG_LIGHT_CTL_TEMP_SET); + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Received ight CTL Temperature and Light CTL Delta UV state values + uint16_t temp; + int16_t delta_uv; + // Transition time + uint8_t trans_time = MM_TRANS_TIME_UNKNOWN; + // Delay + uint8_t delay = 0; + // TID value + uint8_t tid = *(p_data + MM_LIGHT_CTL_TEMP_SET_TID_POS);; + + // Check if request can be processed + if ((p_env_ctl->status_dst_addr != MESH_UNASSIGNED_ADDR) + || (mm_replay_is_retx(&p_env_ctl->replay_env, p_route_env->u_addr.src, tid))) + { + // Send a Light CTL Temperature Status message + if (send_status) + { + mm_lights_ctl_send_status_temp(p_env_ctlt, p_route_env, false); + } + break; + } + + // Extract and check optional parameters if present + if (p_buf->data_len == MM_LIGHT_CTL_TEMP_SET_LEN) + { + trans_time = (uint16_t)(*(p_data + MM_LIGHT_CTL_TEMP_SET_TRANS_TIME_POS)); + + // Check received value + if (GETF(trans_time, MM_TRANS_TIME_STEP_NB) > MM_TRANS_TIME_STEPS_MAX) + { + // Drop the message + break; + } + + delay = *(p_data + MM_LIGHT_CTL_TEMP_SET_DELAY_POS); + } + + temp = read16p(p_data + MM_LIGHT_CTL_TEMP_SET_TEMP_POS); + delta_uv = read16p(p_data + MM_LIGHT_CTL_TEMP_SET_DELTA_UV_POS); + + // Ensure that Light CTL Temperature state value is between Light CTL Temperature Range + // Min and Max values + if ((temp > p_env_ctlt->temp_max) + || ((temp < p_env_ctlt->temp_min))) + { + break; + } + + // Check if at least one of the states is modified + if ((temp == p_env_ctlt->temp) + && (delta_uv == p_env_ctl->delta_uv)) + { + // Send a Light CTL Temperature Status message + if (send_status) + { + mm_lights_ctl_send_status_temp(p_env_ctlt, p_route_env, false); + } + break; + }; + + if (send_status) + { + // Keep information for transmission of status + p_env_ctl->status_dst_addr = p_route_env->u_addr.src; + p_env_ctl->status_app_key_lid = p_route_env->app_key_lid; + SETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TEMP_STATUS, 1); + SETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_RELAY, + GETB(p_route_env->info, MM_ROUTE_INFO_RELAY)); + } + + SETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS_LN, 0); + SETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS_DUV, (delta_uv != p_env_ctl->delta_uv)); + SETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS_TEMP, (temp != p_env_ctlt->temp)); + SETF(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_WAIT, + GETF(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS)); + + // Check if Light CTL Delta UV value is modified + if (GETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS_DUV)) + { + // Update target state + p_env_ctl->delta_uv_tgt = delta_uv; + p_env_ctl->ln_tgt = p_env_ctl->ln; + + // Inform the Binding Manager about new transition + mm_bind_trans_new(p_env_ctl->env.grp_lid, MM_TRANS_TYPE_CLASSIC, trans_time, delay); + } + + // Check if Light CTL Temperature value is modified + if (GETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS_TEMP)) + { + // Update target state + p_env_ctlt->temp_tgt = temp; + p_env_ctlt->lvl_tgt = mm_lights_ctl_temp_to_lvl(p_env_ctlt->temp_tgt, p_env_ctlt->temp_min, + p_env_ctlt->temp_max); + + // Inform the Binding Manager about new transition + mm_bind_trans_new(p_env_ctlt->env.grp_lid, MM_TRANS_TYPE_CLASSIC, trans_time, delay); + } + } while (0); +} + +/** + **************************************************************************************** + * @brief Handler for Light CTL Default Set/Set Unacknowledged message + * + * @param[in] p_env Pointer to environment of model for which message has been received + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing information for the received buffer + **************************************************************************************** + */ +__STATIC void mm_lights_ctl_handler_set_dflt(mm_lights_ctl_env_t *p_env_ctl, + mesh_buf_t *p_buf, mm_route_env_t *p_route_env) +{ + do + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Get environment for Light Lightness CTL Temperature Server model + mm_lights_ctlt_env_t *p_env_ctlt = p_env_ctl->p_env_ctlt; + // Extract received state values + uint16_t ln_dflt = read16p(p_data + MM_LIGHT_CTL_DFLT_SET_LIGHTNESS_POS); + uint16_t temp_dflt = read16p(p_data + MM_LIGHT_CTL_DFLT_SET_TEMP_POS); + uint16_t delta_uv_dflt = read16p(p_data + MM_LIGHT_CTL_DFLT_SET_DELTA_UV_POS); + + if ((temp_dflt > p_env_ctlt->temp_max) + || (temp_dflt < p_env_ctlt->temp_min)) + { + break; + } + + // Inform Light Lightness Server model about received Light Lightness Default state value + mm_lights_ln_set_dflt(p_env_ctl->env.elmt_idx, ln_dflt); + + if (temp_dflt != p_env_ctlt->temp_dflt) + { + // Keep received value + p_env_ctlt->temp_dflt = temp_dflt; + + // Inform application about received value + mm_srv_state_upd_ind_send(MM_STATE_LIGHT_CTL_TEMP_DFLT, + p_env_ctlt->env.elmt_idx, temp_dflt, 0); + } + + if (delta_uv_dflt != p_env_ctl->delta_uv_dflt) + { + // Keep received value + p_env_ctl->delta_uv_dflt = delta_uv_dflt; + + // Inform application about received value + mm_srv_state_upd_ind_send(MM_STATE_LIGHT_CTL_DELTA_UV_DFLT, + p_env_ctl->env.elmt_idx, delta_uv_dflt, 0); + } + + // If needed, send a Light CTL Default Status message to the requester + if (p_route_env->opcode == MM_MSG_LIGHT_CTL_DFLT_SET) + { + mm_lights_ctl_send_status_dflt(p_env_ctl, p_route_env); + } + } while (0); +} + +/** + **************************************************************************************** + * @brief Handler for Light CTL Temperature Range Set/Set Unacknowledged message + * + * @param[in] p_env Pointer to environment of model for which message has been received + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing information for the received buffer + **************************************************************************************** + */ +__STATIC void mm_lights_ctl_handler_set_temp_range(mm_lights_ctl_env_t *p_env_ctl, + mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + do + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Get environment for Light Lightness CTL Temperature Server model + mm_lights_ctlt_env_t *p_env_ctlt = p_env_ctl->p_env_ctlt; + // Status + uint8_t status = MM_STATUS_SUCCESS; + // Extract Light CTL Temperature Range state value + uint16_t temp_min = read16p(p_data + MM_LIGHT_CTL_TEMP_RANGE_SET_MIN_POS); + // Extract Light CTL Range state value + uint16_t temp_max = read16p(p_data + MM_LIGHT_CTL_TEMP_RANGE_SET_MAX_POS); + + // Check provided values + if (temp_min < MM_LIGHTS_CTL_TEMP_MIN) + { + status = MM_STATUS_ERROR_RANGE_MIN; + } + else if (temp_max > MM_LIGHTS_CTL_TEMP_MAX) + { + status = MM_STATUS_ERROR_RANGE_MAX; + } + else if (temp_min > temp_max) + { + // Drop the message + break; + } + + if ((status == MM_STATUS_SUCCESS) + && ((p_env_ctlt->temp_min != temp_min) + || (p_env_ctlt->temp_max != temp_max))) + { + p_env_ctlt->temp_min = temp_min; + p_env_ctlt->temp_max = temp_max; + + // Inform application about received value + mm_srv_state_upd_ind_send(MM_STATE_LIGHT_CTL_TEMP_RANGE, p_env_ctlt->env.elmt_idx, + (uint32_t)temp_min | ((uint32_t)temp_max << 16), 0); + } + + // If needed, send a Light CTL Temperature Range Status message to the requester + if (p_route_env->opcode == MM_MSG_LIGHT_CTL_TEMP_RANGE_SET) + { + mm_lights_ctl_send_status_temp_range(p_env_ctl, p_route_env, status); + } + } while (0); +} + +/* + * INTERNAL CALLBACK FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Callback function called when timer monitoring publication duration for + * Light CTL Server model or for Light CTL Temperature expires + * + * @param[in] p_env Pointer to model environment for Light CTL Server or Light CTL + * Temperature model + **************************************************************************************** + */ +__STATIC void mm_lights_ctl_cb_tmr_publi(void *p_tmr) +{ + mm_lights_ctl_env_t *p_env = MESH_TMR2ENV(p_tmr, mm_lights_ctl_env_t, tmr_publi); + // Get allocated environment + mm_mdl_publi_env_t *p_env_publi = (mm_mdl_publi_env_t *)p_env; + + if (p_env_publi->publi_period_ms) + { + if (p_env_publi->env.model_id == MM_ID_LIGHTS_CTL) + { + // Publish a Light CTL Status message + mm_lights_ctl_publish((mm_lights_ctl_env_t *)p_env); + } + else // (p_env_publi->env.model_id == MM_ID_LIGHTS_CTLT) + { + // Publish a Light CTL Temperature Status message + mm_lights_ctl_publish_temp((mm_lights_ctlt_env_t *)p_env); + } + + // Restart the timer + mesh_timer_set(&p_env_publi->tmr_publi, p_env_publi->publi_period_ms); + } +} + +/** + **************************************************************************************** + * @brief Inform Light CTL Server model about a received message + * + * @param[in] p_env Pointer to the environment allocated for the Light CTL + * Server model + * @param[in] p_buf Pointer to the buffer containing the received message + * @param[in] p_route_env Pointer to structure containing reception parameters provided + * by the Mesh Profile block + **************************************************************************************** + */ +__STATIC void mm_lights_ctl_cb_rx(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + do + { + // Environment for Light CTL Server model + mm_lights_ctl_env_t *p_env_ctl; + + if (p_env->model_id == MM_ID_LIGHTS_CTL) + { + p_env_ctl = (mm_lights_ctl_env_t *)p_env; + + switch (p_route_env->opcode) + { + case (MM_MSG_LIGHT_CTL_GET): + { + // Send a Light CTL Status message + mm_lights_ctl_send_status(p_env_ctl, p_route_env, false); + } break; + + case (MM_MSG_LIGHT_CTL_SET): + case (MM_MSG_LIGHT_CTL_SET_UNACK): + { + // Handle the message + mm_lights_ctl_handler_set(p_env_ctl, p_buf, p_route_env); + } break; + + case (MM_MSG_LIGHT_CTL_TEMP_RANGE_GET): + { + // Send a Light CTL Temperature Range Status message + mm_lights_ctl_send_status_temp_range(p_env_ctl, p_route_env, MM_STATUS_SUCCESS); + } break; + + case (MM_MSG_LIGHT_CTL_DFLT_GET): + { + // Send a Light CTL Default Status message + mm_lights_ctl_send_status_dflt(p_env_ctl, p_route_env); + } break; + + default: + { + } break; + } + } + else if (p_env->model_id == MM_ID_LIGHTS_CTLS) + { + // Environment for Light CTL Setup Server model + mm_lights_ctls_env_t *p_env_ctls = (mm_lights_ctls_env_t *)p_env; + + p_env_ctl = p_env_ctls->p_env_ctl; + + switch (p_route_env->opcode) + { + case (MM_MSG_LIGHT_CTL_DFLT_SET): + case (MM_MSG_LIGHT_CTL_DFLT_SET_UNACK): + { + // Handle the message + mm_lights_ctl_handler_set_dflt(p_env_ctl, p_buf, p_route_env); + } break; + + case (MM_MSG_LIGHT_CTL_TEMP_RANGE_SET): + case (MM_MSG_LIGHT_CTL_TEMP_RANGE_SET_UNACK): + { + // Handle the message + mm_lights_ctl_handler_set_temp_range(p_env_ctl, p_buf, p_route_env); + } break; + + default: + { + } break; + } + } + else // (p_env->model_id == MM_ID_LIGHTS_CTLT) + { + // Environment for Light CTL Temperature model + mm_lights_ctlt_env_t *p_env_ctlt = (mm_lights_ctlt_env_t *)p_env; + + switch (p_route_env->opcode) + { + case (MM_MSG_LIGHT_CTL_TEMP_GET): + { + // Send a Light CTL Temperature Status message + mm_lights_ctl_send_status_temp(p_env_ctlt, p_route_env, false); + } break; + + case (MM_MSG_LIGHT_CTL_TEMP_SET): + case (MM_MSG_LIGHT_CTL_TEMP_SET_UNACK): + { + // Handle the message + mm_lights_ctl_handler_set_temp(p_env_ctlt, p_buf, p_route_env); + } break; + + default: + { + } break; + } + } + } while (0); +} + +/** + **************************************************************************************** + * @brief Check if a given opcode is handled by the Light CTL Server model + * + * @param[in] p_env Pointer to the environment allocated for the Light CTL + * Server model + * @param[in] opcode Opcode to check + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lights_ctl_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status = MESH_ERR_MDL_INVALID_OPCODE; + + if (p_env->model_id == MM_ID_LIGHTS_CTL) + { + if ((opcode == MM_MSG_LIGHT_CTL_GET) + || (opcode == MM_MSG_LIGHT_CTL_SET) + || (opcode == MM_MSG_LIGHT_CTL_SET_UNACK) + || (opcode == MM_MSG_LIGHT_CTL_TEMP_RANGE_GET) + || (opcode == MM_MSG_LIGHT_CTL_DFLT_GET)) + { + status = MESH_ERR_NO_ERROR; + } + } + else if (p_env->model_id == MM_ID_LIGHTS_CTLS) + { + if ((opcode == MM_MSG_LIGHT_CTL_DFLT_SET) + || (opcode == MM_MSG_LIGHT_CTL_DFLT_SET_UNACK) + || (opcode == MM_MSG_LIGHT_CTL_TEMP_RANGE_SET) + || (opcode == MM_MSG_LIGHT_CTL_TEMP_RANGE_SET_UNACK)) + { + status = MESH_ERR_NO_ERROR; + } + } + else if (p_env->model_id == MM_ID_LIGHTS_CTLT) + { + if ((opcode == MM_MSG_LIGHT_CTL_TEMP_GET) + || (opcode == MM_MSG_LIGHT_CTL_TEMP_SET) + || (opcode == MM_MSG_LIGHT_CTL_TEMP_SET_UNACK)) + { + status = MESH_ERR_NO_ERROR; + } + } + + return (status); +} + +/** + **************************************************************************************** + * @brief + * + * @param[in] p_env Pointer the the environment allocated for the Generic OnOff + * Server model + * @param[in] state_id State identifier + * @param[in] state Light CTL Actual or Light CTL Default or Light + * Lightness Range state value + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lights_ctl_cb_set(mm_mdl_env_t *p_env, uint16_t state_id, uint32_t state) +{ + // Returned status + uint8_t status = MESH_ERR_NO_ERROR; + // Get environment for the Light CTL Server model + mm_lights_ctl_env_t *p_env_ctl = (mm_lights_ctl_env_t *)p_env; + // Get environment for the Light CTL Temperature Server model + mm_lights_ctlt_env_t *p_env_ctlt = p_env_ctl->p_env_ctlt; + + switch (state_id) + { + case (MM_STATE_LIGHT_CTL_LN): + { + // Keep the provided state value + p_env_ctl->ln = state; + + // Set the Light Lightness state value + mm_bind_set_state(p_env_ctl->env.grp_lid, MM_STATE_TYPE_CURRENT, + MM_ID_LIGHTS_LN, state); + } break; + + case (MM_STATE_LIGHT_CTL_DELTA_UV): + { + // Keep the provided state value + p_env_ctl->delta_uv = state; + } break; + + case (MM_STATE_LIGHT_CTL_DELTA_UV_DFLT): + { + // Keep the provided state value + p_env_ctl->delta_uv_dflt = state; + } break; + + case (MM_STATE_LIGHT_CTL_TEMP): + { + // Keep the provided state value + p_env_ctlt->temp = state; + } break; + + case (MM_STATE_LIGHT_CTL_TEMP_DFLT): + { + // Keep the provided state value + p_env_ctlt->temp_dflt = state; + } break; + + case (MM_STATE_LIGHT_CTL_TEMP_RANGE): + { + // Keep the provided state value + p_env_ctlt->temp_min = state; + p_env_ctlt->temp_max = state; + } break; + + default: + { + status = MESH_ERR_INVALID_PARAM; + } break; + } + + return (status); +} + +/* + * CALLBACK FUNCTIONS FOR BINDING MANAGER + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Callback function provided to the Binding Manager so that Light CTL Server + * model can be informed about group event + * + * @param[in] mdl_lid Model Local Index + * @param[in] event Event + * @param[in] info Information (depends on the event type) + **************************************************************************************** + */ +__STATIC void mm_lights_ctl_cb_grp_event(m_lid_t mdl_lid, uint8_t event, uint8_t info) +{ + // Get environment for Light CTL Server model + mm_lights_ctl_env_t *p_env_ctl = (mm_lights_ctl_env_t *)mm_state_get_env(mdl_lid); + + switch (event) + { + case (MM_GRP_EVENT_TRANS_DELAY_EXPIRED): + { + if (GETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS_LN)) + { + // Set the targeted Light Lightness state value + mm_bind_set_state(p_env_ctl->env.grp_lid, MM_STATE_TYPE_TARGET, MM_ID_LIGHTS_LN, + p_env_ctl->ln_tgt); + } + + // Start the transition + mm_bind_trans_start(p_env_ctl->env.grp_lid); + } break; + + case (MM_GRP_EVENT_TRANS_IMMEDIATE): + { + p_env_ctl->ln = p_env_ctl->ln_tgt; + p_env_ctl->delta_uv = p_env_ctl->delta_uv_tgt; + } // no break; + + case (MM_GRP_EVENT_TRANS_STARTED): + { + uint8_t trans_time = info; + + // Inform application about state update + if (GETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_WAIT_LN)) + { + // Expected event has been received + SETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_WAIT_LN, 0); + + // Inform application + mm_srv_state_upd_ind_send(MM_STATE_LIGHT_CTL_LN, p_env_ctl->env.elmt_idx, + p_env_ctl->ln_tgt, + (trans_time) ? mm_get_trans_time_ms(trans_time) : 0); + } + + if (GETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_WAIT_DUV)) + { + // Expected event has been received + SETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_WAIT_DUV, 0); + + // Inform application + mm_srv_state_upd_ind_send(MM_STATE_LIGHT_CTL_DELTA_UV, p_env_ctl->env.elmt_idx, + p_env_ctl->delta_uv_tgt, + (trans_time) ? mm_get_trans_time_ms(trans_time) : 0); + } + + // Check if status message must be sent + mm_lights_ctl_check_status(p_env_ctl, event); + } break; + + case (MM_GRP_EVENT_TRANS_END): + { + p_env_ctl->ln = p_env_ctl->ln_tgt; + p_env_ctl->delta_uv = p_env_ctl->delta_uv_tgt; + + // Inform application about state update + if (GETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_WAIT_LN)) + { + // Expected event has been received + SETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_WAIT_LN, 0); + + mm_srv_state_upd_ind_send(MM_STATE_LIGHT_CTL_LN, + p_env_ctl->env.elmt_idx, p_env_ctl->ln, 0); + } + if (GETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_WAIT_DUV)) + { + // Expected event has been received + SETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_WAIT_DUV, 0); + + mm_srv_state_upd_ind_send(MM_STATE_LIGHT_CTL_DELTA_UV, + p_env_ctl->env.elmt_idx, p_env_ctl->delta_uv, 0); + } + + // Check if status message must be sent + mm_lights_ctl_check_status(p_env_ctl, event); + } break; + + case (MM_GRP_EVENT_GROUP_FULL): + { + // Set the targeted Light Lightness state value + mm_bind_set_state(p_env_ctl->env.grp_lid, MM_STATE_TYPE_CURRENT, MM_ID_LIGHTS_LN, + p_env_ctl->ln); + } break; + + //case (MM_GRP_EVENT_TRANS_ABORTED): + default: + { + } break; + } +} + +/** + **************************************************************************************** + * @brief Callback function provided to the Binding Manager so that Light CTL Temperature Server + * model can be informed about group event + * + * @param[in] mdl_lid Model Local Index + * @param[in] event Event + * @param[in] info Information (depends on the event type) + **************************************************************************************** + */ +__STATIC void mm_lights_ctl_cb_grp_event_temp(m_lid_t mdl_lid, uint8_t event, uint8_t info) +{ + // Get environment for Light CTL Temperature Server model + mm_lights_ctlt_env_t *p_env_ctlt = (mm_lights_ctlt_env_t *)mm_state_get_env(mdl_lid); + // Get environment for Light CTL Server model + mm_lights_ctl_env_t *p_env_ctl = p_env_ctlt->p_env_ctl; + + switch (event) + { + case (MM_GRP_EVENT_TRANS_DELAY_EXPIRED): + { + // Set the targeted Generic Level state value + mm_bind_set_state(p_env_ctlt->env.grp_lid, MM_STATE_TYPE_TARGET, MM_ID_GENS_LVL, + p_env_ctlt->lvl_tgt); + + // Start the transition + mm_bind_trans_start(p_env_ctlt->env.grp_lid); + } break; + + case (MM_GRP_EVENT_TRANS_IMMEDIATE): + { + p_env_ctlt->temp = p_env_ctlt->temp_tgt; + } // no break; + + case (MM_GRP_EVENT_TRANS_STARTED): + { + uint8_t trans_time = info; + + // Mark transition as finished + SETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_WAIT_TEMP, 0); + + // Inform application about state update + mm_srv_state_upd_ind_send(MM_STATE_LIGHT_CTL_TEMP, p_env_ctlt->env.elmt_idx, + p_env_ctlt->temp_tgt, + (trans_time) ? mm_get_trans_time_ms(trans_time) : 0); + + // Check if status message must be sent + mm_lights_ctl_check_status(p_env_ctl, event); + } break; + + case (MM_GRP_EVENT_TRANS_END): + { + p_env_ctlt->temp = p_env_ctlt->temp_tgt; + + // Mark transition as finished + SETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_WAIT_TEMP, 0); + + // Inform application about state update + mm_srv_state_upd_ind_send(MM_STATE_LIGHT_CTL_TEMP, p_env_ctlt->env.elmt_idx, + p_env_ctlt->temp, 0); + + // Check if status message must be sent + mm_lights_ctl_check_status(p_env_ctl, event); + } break; + + case (MM_GRP_EVENT_GROUP_FULL): + { + // Deduce Generic Level state value from Light CTL Temperature state value + int16_t lvl = mm_lights_ctl_temp_to_lvl(p_env_ctlt->temp, p_env_ctlt->temp_min, + p_env_ctlt->temp_max); + + // Set the current Generic Level state value + mm_bind_set_state(p_env_ctlt->env.grp_lid, MM_STATE_TYPE_CURRENT, MM_ID_GENS_LVL, lvl); + }; + + //case (MM_GRP_EVENT_TRANS_ABORTED): + default: + { + } break; + } +} + +/** + **************************************************************************************** + * @brief Callback function provided to the Binding Manager so that Light Lighting state + * value can be set by main model of the group + * + * @param[in] mdl_lid Model Local Index + * @param[in] type Type + * @param[in] state State value + **************************************************************************************** + */ +__STATIC void mm_lights_ctl_cb_trans_req(m_lid_t main_mdl_lid, uint32_t req_model_id, uint8_t trans_type, + uint32_t state_delta) +{ + // Get environment for Light CTL Server model + mm_lights_ctl_env_t *p_env_ctl = (mm_lights_ctl_env_t *)mm_state_get_env(main_mdl_lid); + // Targeted Light CTL Actual state value + uint16_t ln_tgt; + + if (req_model_id == MM_ID_LIGHTS_LN) + { + ln_tgt = (uint16_t)state_delta; + } + else + { + if (req_model_id == MM_ID_GENS_OO) + { + // Requested Generic OnOff state value + uint8_t onoff = (uint8_t)state_delta; + + if (onoff == 0) + { + ln_tgt = 0; + } + else + { + ln_tgt = 0; + } + } + else // (req_model_id == MM_ID_GENS_LVL) + { + if (trans_type == MM_TRANS_TYPE_CLASSIC) + { + // Requested Generic Level state value + int16_t level = (int16_t)state_delta; + + // Light CTL Actual = Generic Level + 32768 + ln_tgt = 32768 + level; + } + else // ((trans_type == MM_TRANS_TYPE_DELTA) || trans_type == MM_TRANS_TYPE_MOVE)) + { + // Delta value + int32_t delta; + + if (trans_type == MM_TRANS_TYPE_MOVE) + { + delta = (int16_t)state_delta; + + // Keep the provided delta value + p_env_ctl->move_delta = (int16_t)state_delta; + } + else + { + delta = (int32_t)state_delta; + } + + // Add the Light CTL Actual state value to the received delta value + delta += p_env_ctl->ln; + + // The Light CTL Actual state value cannot wrap + if (delta < 0) + { + ln_tgt = 0; + } + else + { + ln_tgt = (delta > 0xFFFF) ? 0xFFFF : (uint16_t)delta; + } + } + } + + if (ln_tgt != 0) + { + // Get range value + uint16_t ln_min = mm_lights_ln_get(p_env_ctl->env.elmt_idx, MM_STATE_LIGHT_LN_RANGE_MIN); + uint16_t ln_max = mm_lights_ln_get(p_env_ctl->env.elmt_idx, MM_STATE_LIGHT_LN_RANGE_MAX); + + // Ensure that Light CTL Lightness state value is between Light CTL Lightness Range + // Min and Max values + if (ln_tgt > ln_max) + { + ln_tgt = ln_max; + } + else if (ln_tgt < ln_min) + { + ln_tgt = ln_min; + } + } + + } + + // Check if Light CTL Actual state value is modified + if (ln_tgt != p_env_ctl->ln) + { + p_env_ctl->ln_tgt = ln_tgt; + + SETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS_LN, 1); + SETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS_DUV, 0); + SETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS_TEMP, 0); + SETF(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_WAIT, + GETF(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS)); + + // Start a new transition + mm_bind_trans_new(p_env_ctl->env.grp_lid, trans_type, 0, 0); + } + else + { + // Reject the transition + mm_bind_trans_reject(p_env_ctl->env.grp_lid); + } +} + +/** + **************************************************************************************** + * @brief Inform Light CTL Temperature Server model that a transition has been requested + * using Generic Level model + * + * @param[in] main_mdl_lid Light CTL Temperature Server model local index + * @param[in] req_model_id Model ID of model requesting the transition + * @param[in] trans_type Transition type + * @param[in] state_delta State or delta value + **************************************************************************************** + */ +__STATIC void mm_lights_ctl_cb_trans_req_temp(m_lid_t main_mdl_lid, uint32_t req_model_id, uint8_t trans_type, + uint32_t state_delta) +{ + // Get environment for Light CTL Temperature Server model + mm_lights_ctlt_env_t *p_env_ctlt = (mm_lights_ctlt_env_t *)mm_state_get_env(main_mdl_lid); + // Requested Generic Level state value + int16_t lvl = (int16_t)state_delta; + // Targeted Light CTL Temperature state value + uint16_t temp_tgt; + + if (trans_type == MM_TRANS_TYPE_CLASSIC) + { + temp_tgt = mm_lights_ctl_lvl_to_temp(lvl, p_env_ctlt->temp_min, p_env_ctlt->temp_max); + } + else // ((trans_type == MM_TRANS_TYPE_DELTA) || trans_type == MM_TRANS_TYPE_MOVE)) + { + // Delta value + int32_t delta; + + if (trans_type == MM_TRANS_TYPE_MOVE) + { + delta = (int16_t)state_delta; + + // Keep the provided delta value + p_env_ctlt->move_delta = delta; + } + else + { + delta = (int32_t)state_delta; + } + + temp_tgt = mm_lights_ctl_temp_add_delta(p_env_ctlt->temp, delta, + p_env_ctlt->temp_min, p_env_ctlt->temp_max); + } + + // Ensure that Light CTL Temperature state value is between Light CTL Temperature Range + // Min and Max values + if (temp_tgt > p_env_ctlt->temp_max) + { + temp_tgt = p_env_ctlt->temp_max; + } + else if (temp_tgt < p_env_ctlt->temp_min) + { + temp_tgt = p_env_ctlt->temp_min; + } + + // Check if Light CTL Temperature state value is modified + if (temp_tgt != p_env_ctlt->temp) + { + // Get environment for Light CTL Server model + mm_lights_ctl_env_t *p_env_ctl = p_env_ctlt->p_env_ctl; + + SETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS_LN, 0); + SETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS_DUV, 0); + SETB(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS_TEMP, 1); + SETF(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_WAIT, + GETF(p_env_ctl->status_info, MM_LIGHTS_CTL_SINFO_TRANS)); + + p_env_ctlt->temp_tgt = temp_tgt; + p_env_ctlt->lvl_tgt = lvl; + + // Start a new transition + mm_bind_trans_new(p_env_ctlt->env.grp_lid, trans_type, 0, 0); + } + else + { + // Reject the transition + mm_bind_trans_reject(p_env_ctlt->env.grp_lid); + } +} + +/** + **************************************************************************************** + * @brief Register Light CTL Server, Light CTL Setup Server models on a given element and + * Light CTL Temperature Server model on next element + * + * @param[in] elmt_idx Element Index + * @param[in] p_mdl_lid Pointer to the variable in which allocated model local index + * will be written + * + * @return An error status (@see mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lights_ctls_register(uint8_t elmt_idx) +{ + m_lid_t mdl_lid, ctls_lid, ctlt_lid; + + // Register Light CTL Server model + mdl_lid = ms_register_model(MM_ID_LIGHTS_CTL, elmt_idx, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) + { + // Inform the Model State Manager about registered model + mm_lights_ctl_env_t *p_env_ctl = (mm_lights_ctl_env_t *)mm_state_register(elmt_idx, MM_ID_LIGHTS_CTL, mdl_lid, + MM_ROLE_SRV_PUBLI, sizeof(mm_lights_ctl_env_t)); + + if (p_env_ctl) + { + // Get server-specific callback functions + //p_cb_srv = p_env_ctl->env.cb.u.p_cb_srv; + + // Prepare environment for Replay Manager + p_env_ctl->replay_env.delay_ms = MM_LIGHTS_CTL_REPLAY_MS; + + // Prepare timer for publications + p_env_ctl->tmr_publi.cb = mm_lights_ctl_cb_tmr_publi; + //p_env_ctl->tmr_publi.p_env = (void *)p_env_ctl; + + // Set internal callback functions + p_env_ctl->env.mdl_cb.cb_rx = mm_lights_ctl_cb_rx; + p_env_ctl->env.mdl_cb.cb_opcode_check = mm_lights_ctl_cb_opcode_check; + //p_env_ctl->env.mdl_cb.cb_publish_param = mm_lights_ctl_cb_publish_param; + //p_cb_srv->cb_set = mm_lights_ctl_cb_set; + p_env_ctl->env.mdl_cb.cb_srv_set = mm_lights_ctl_cb_set; + + // Inform application about registered model + mm_register_ind_send(MM_ID_LIGHTS_CTL, elmt_idx, mdl_lid); + } + + // Register Light CTL Setup Server model + ctls_lid = ms_register_model(MM_ID_LIGHTS_CTLS, elmt_idx, 0); + + if (ctls_lid != MESH_INVALID_LID) + { + // Inform the Model State Manager about registered model + mm_lights_ctls_env_t *p_env_ctls = (mm_lights_ctls_env_t *)mm_state_register(elmt_idx, MM_ID_LIGHTS_CTLS, ctls_lid, + MM_ROLE_SRV, sizeof(mm_lights_ctls_env_t)); + + if (p_env_ctls) + { + // Set internal callback functions + p_env_ctls->env.mdl_cb.cb_rx = mm_lights_ctl_cb_rx; + p_env_ctls->env.mdl_cb.cb_opcode_check = mm_lights_ctl_cb_opcode_check; + + // Link environment + p_env_ctls->p_env_ctl = p_env_ctl; + + // Inform application about registered model + mm_register_ind_send(MM_ID_LIGHTS_CTLS, elmt_idx, ctls_lid); + } + } + + // Register Light CTL Temperature Server model + ctlt_lid = ms_register_model(MM_ID_LIGHTS_CTLT, elmt_idx + 1, MM_CFG_PUBLI_AUTH_BIT); + + if (ctlt_lid != MESH_INVALID_LID) + { + // Inform the Model State Manager about registered model + mm_lights_ctlt_env_t *p_env_ctlt = (mm_lights_ctlt_env_t *)mm_state_register(elmt_idx + 1, MM_ID_LIGHTS_CTLT, ctlt_lid, + MM_ROLE_SRV_PUBLI, sizeof(mm_lights_ctlt_env_t)); + + if (p_env_ctlt) + { + // Get server-specific callback functions + //p_cb_srv = p_env_ctlt->env.cb.u.p_cb_srv; + + // Set initial range + p_env_ctlt->temp_min = MM_LIGHTS_CTL_TEMP_MIN; + p_env_ctlt->temp_max = MM_LIGHTS_CTL_TEMP_MAX; + + // And initial value + p_env_ctlt->temp = MM_LIGHTS_CTL_TEMP_MIN; + + // Prepare timer for publications + p_env_ctlt->tmr_publi.cb = mm_lights_ctl_cb_tmr_publi; + //p_env_ctlt->tmr_publi.p_env = (void *)p_env_ctlt; + + // Set internal callback functions + p_env_ctlt->env.mdl_cb.cb_rx = mm_lights_ctl_cb_rx; + p_env_ctlt->env.mdl_cb.cb_opcode_check = mm_lights_ctl_cb_opcode_check; + //p_env_ctlt->env.mdl_cb.cb_publish_param = mm_lights_ctl_cb_publish_param; + //p_cb_srv->cb_set = mm_lights_ctl_cb_set; + p_env_ctlt->env.mdl_cb.cb_srv_set = mm_lights_ctl_cb_set; + + // Inform application about registered model + mm_register_ind_send(MM_ID_LIGHTS_CTLT, elmt_idx + 1, ctlt_lid); + + // Bound models together + p_env_ctlt->p_env_ctl = p_env_ctl; + p_env_ctl->p_env_ctlt = p_env_ctlt; + } + } + } + + return (mdl_lid); +} + +/* + * GLOBAL FUNCTIONS + **************************************************************************************** + */ + +uint8_t mm_lights_ctl_register(uint8_t elmt_idx, bool main) +{ + m_lid_t mdl_lid = MESH_INVALID_LID; + + do + { + // Model local index for Light CTL Server model and for Light CTL Tempereture Server model + // and for Light Lightness Server model + m_lid_t ln_lid, lvl1_lid, ctl_lid, ctlt_lid; + + // Register Light Lightness Server model and associated models + ln_lid = mm_lights_ln_register(elmt_idx, false); + if (ln_lid == MESH_INVALID_LID) + { + break; + } + + // Register Generic Level Server model + lvl1_lid = mm_gens_lvl_register(elmt_idx + 1, false); + if (lvl1_lid == MESH_INVALID_LID) + { + break; + } + + // Register the Light CTL Server model and associated models + ctl_lid = mm_lights_ctls_register(elmt_idx); + + if (main && (ctl_lid != MESH_INVALID_LID)) + { + mdl_lid = ctl_lid; + ctlt_lid = ctl_lid + 2; + + // Create group and set Light CTL Server model as main model + m_lid_t grp_lid = mm_bind_add_group(3, elmt_idx, ctl_lid, + mm_lights_ctl_cb_grp_event, mm_lights_ctl_cb_trans_req); + + // Add Generic Level Server model to the group + mm_gens_lvl_bind_group(grp_lid, mm_state_get_lid(elmt_idx, MM_ID_GENS_LVL)); + // Add Generic OnOff Server model to the group + mm_gens_oo_bind_group(grp_lid, mm_state_get_lid(elmt_idx, MM_ID_GENS_OO)); + // Add Light Lightness Server model to the group + mm_lights_ln_bind_group(grp_lid, ln_lid); + + // Create group and set Light CTL Temperature Server model as main model + grp_lid = mm_bind_add_group(1, elmt_idx + 1, ctlt_lid, + mm_lights_ctl_cb_grp_event_temp, mm_lights_ctl_cb_trans_req_temp); + + // Add Generic Level Server model to the group + mm_gens_lvl_bind_group(grp_lid, lvl1_lid); + + } + } while (0); + + return (mdl_lid); +} + +/// @} end of group diff --git a/mesh/model/light/lights/mm_lights_hsl.c b/mesh/model/light/lights/mm_lights_hsl.c new file mode 100644 index 0000000..a842b14 --- /dev/null +++ b/mesh/model/light/lights/mm_lights_hsl.c @@ -0,0 +1,2358 @@ +/** + **************************************************************************************** + * @file mm_lights_hsl.c + * + * @brief Mesh Model Light HSL Server Module + * + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @addtogroup MM_LIGHTS_HSL + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mm_itf.h" +#include "mm_gens.h" +#include "mm_lights.h" + +/* + * DEFINES + **************************************************************************************** + */ + +/// Validity of information provided to the Replay Manager +#define MM_LIGHTS_HSL_REPLAY_MS (6000) + +/* + * ENUMERATIONS + **************************************************************************************** + */ + +/// Bit field content for status_info value present in environment for Light HSL Server model +/// 8 7 6 5 4 3 2 1 0 +/// +-----+-----------+-----------+----------+----------------+----------------+---------------+-------+ +/// | RFU | Trans Sat | Trans Hue | Trans LN | Wait Sat Trans | Wait Hue Trans | Wait LN Trans | Relay | +/// +-----+-----------+-----------+----------+----------------+----------------+---------------+-------+ +enum mm_lights_hsl_sinfo_bf +{ + /// Relaying of sent status message is authorized + MM_LIGHTS_HSL_SINFO_RELAY_POS = 0, + MM_LIGHTS_HSL_SINFO_RELAY_BIT = (1 << MM_LIGHTS_HSL_SINFO_RELAY_POS), + + /// Wait for transition event for Light HSL Lightness state + MM_LIGHTS_HSL_SINFO_WAIT_LN_POS = 1, + MM_LIGHTS_HSL_SINFO_WAIT_LN_BIT = (1 << MM_LIGHTS_HSL_SINFO_WAIT_LN_POS), + + /// Wait for transition event for Light HSL Hue state + MM_LIGHTS_HSL_SINFO_WAIT_HUE_POS = 2, + MM_LIGHTS_HSL_SINFO_WAIT_HUE_BIT = (1 << MM_LIGHTS_HSL_SINFO_WAIT_HUE_POS), + + /// Wait for transition event for Light HSL Saturation state + MM_LIGHTS_HSL_SINFO_WAIT_SAT_POS = 3, + MM_LIGHTS_HSL_SINFO_WAIT_SAT_BIT = (1 << MM_LIGHTS_HSL_SINFO_WAIT_SAT_POS), + + /// Wait for transition start (either Light HSL Lightness or Light HSL Hue or Light HSL + /// Saturation) + MM_LIGHTS_HSL_SINFO_WAIT_LSB = 1, + MM_LIGHTS_HSL_SINFO_WAIT_MASK = 0x0E, + + /// Transition for Light HSL Lightness state in progress + MM_LIGHTS_HSL_SINFO_TRANS_LN_POS = 4, + MM_LIGHTS_HSL_SINFO_TRANS_LN_BIT = (1 << MM_LIGHTS_HSL_SINFO_TRANS_LN_POS), + + /// Transition for Light HSL Hue state in progress + MM_LIGHTS_HSL_SINFO_TRANS_HUE_POS = 5, + MM_LIGHTS_HSL_SINFO_TRANS_HUE_BIT = (1 << MM_LIGHTS_HSL_SINFO_TRANS_HUE_POS), + + /// Transition for Light HSL Saturation state in progress + MM_LIGHTS_HSL_SINFO_TRANS_SAT_POS = 6, + MM_LIGHTS_HSL_SINFO_TRANS_SAT_BIT = (1 << MM_LIGHTS_HSL_SINFO_TRANS_SAT_POS), + + /// Transition in progress mask + MM_LIGHTS_HSL_SINFO_TRANS_LSB = 4, + MM_LIGHTS_HSL_SINFO_TRANS_MASK = 0x70, +}; + +/// Bit field content for status_info value present in environment for Light HSL Hue Server +/// and Light HSL Saturation Server models +/// 7 1 0 +/// +----------------------+-------+ +/// | RFU | Relay | +/// +----------------------+-------+ +enum mm_lights_hsl_sinfo_hs_bf +{ + /// Relaying of sent status message is authorized + MM_LIGHTS_HSL_SINFO_HS_RELAY_POS = 0, + MM_LIGHTS_HSL_SINFO_HS_RELAY_BIT = (1 << MM_LIGHTS_HSL_SINFO_HS_RELAY_POS), +}; + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +typedef struct mm_lights_hsl_env mm_lights_hsl_env_t; +typedef struct mm_lights_hsls_env mm_lights_hsls_env_t; +typedef struct mm_lights_hslh_env mm_lights_hslh_env_t; +typedef struct mm_lights_hslsat_env mm_lights_hslsat_env_t; + +/// Structure for Light HSL Server model environment +struct mm_lights_hsl_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; + /// Timer for sending of publications + mesh_timer_t tmr_publi; + /// Publication period in milliseconds + uint32_t publi_period_ms; + + /// Environment for replay protection mechanism + mm_replay_env_t replay_env; + + /// Pointer to environment of associated Light HSL Hue model + mm_lights_hslh_env_t *p_env_hslh; + /// Pointer to environment of associated Light HSL Saturation model + mm_lights_hslsat_env_t *p_env_hslsat; + + /// Delta value in case of move transition for Light HSL Lightness state value + int16_t move_delta; + /// Light HSL Lightness state value + uint16_t ln; + /// Target Light HSL Lightness state value + uint16_t ln_tgt; + + /// Source address of set message that has triggered last or current transition + uint8_t status_dst_addr; + /// Application key local index to be used for transmission of Light HSL Status + /// or Light HSL Linear Status message + m_lid_t status_app_key_lid; + /// Status information bitfield (@see enum mm_lights_hsl_sinfo_bf) + uint8_t status_info; +}; + +/// Structure for Light HSL Setup Server model environment +struct mm_lights_hsls_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; + + /// Pointer to environment of associated Light HSL Server model + mm_lights_hsl_env_t *p_env_hsl; +}; + +/// Structure for Light HSL Hue Server model environment +struct mm_lights_hslh_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; + /// Timer for sending of publications + mesh_timer_t tmr_publi; + /// Publication period in milliseconds + uint32_t publi_period_ms; + + /// Pointer to environment of associated Light HSL model + mm_lights_hsl_env_t *p_env_hsl; + + /// Delta value in case of move transition for Light HSL Hue state value + int16_t move_delta; + /// Light HSL Hue state value + uint16_t hue; + /// Target Light HSL Hue state value + uint16_t hue_tgt; + /// Light HSL Hue Min state value + uint16_t hue_min; + /// Light HSL Hue Max state value + uint16_t hue_max; + /// Light HSL Hue Default state value + uint16_t hue_dflt; + + /// Source address of set message that has triggered last or current transition + uint8_t status_dst_addr; + /// Application key local index to be used for transmission of Light HSL Status + /// or Light HSL Linear Status message + m_lid_t status_app_key_lid; + /// Status information bitfield (@see enum mm_lights_hsl_sinfo_hs_bf) + uint8_t status_info; +}; + +/// Structure for Light HSL Saturation Server model environment +struct mm_lights_hslsat_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; + /// Timer for sending of publications + mesh_timer_t tmr_publi; + /// Publication period in milliseconds + uint32_t publi_period_ms; + + /// Pointer to environment of associated Light HSL model + mm_lights_hsl_env_t *p_env_hsl; + + /// Delta value in case of move transition for Light HSL Hue state value + int16_t move_delta; + /// Light HSL Saturation state value + uint16_t sat; + /// Target Light HSL Saturation state value + uint16_t sat_tgt; + /// Light HSL Saturation Min state value + uint16_t sat_min; + /// Light HSL Saturation Max state value + uint16_t sat_max; + /// Light HSL Saturation Default state value + uint16_t sat_dflt; + + /// Source address of set message that has triggered last or current transition + uint8_t status_dst_addr; + /// Application key local index to be used for transmission of Light HSL Status + /// or Light HSL Linear Status message + m_lid_t status_app_key_lid; + /// Status information bitfield (@see enum mm_lights_hsl_sinfo_hs_bf) + uint8_t status_info; +}; + +/* + * LOCAL FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Prepare and send a Light HSL Status or Light HSL Target Status message. + * Note that both messages have the same content + * + * @param[in] p_env_hsl Pointer to Light HSL Server model environment + * @param[in] p_route_env Pointer to structure containing reception information provided + * by Mesh Profile for received request message + * @param[in] publish Indicate if message is sent as a publication (true) or as + * a response to a received request (false) + * @param[in] target True if Light HSL Target Status message, else false + **************************************************************************************** + */ +__STATIC void mm_lights_hsl_send_status(mm_lights_hsl_env_t *p_env_hsl, + mm_route_env_t *p_route_env, bool publish, bool target) +{ + // Get environment for Light Lightness HSL Hue Server model + mm_lights_hslh_env_t *p_env_hslh = p_env_hsl->p_env_hslh; + // Get environment for Light Lightness HSL Saturation Server model + mm_lights_hslsat_env_t *p_env_hslsat = p_env_hsl->p_env_hslsat; + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_status; + // Remaining time + uint8_t ln_rem_time, hue_rem_time, sat_rem_time; + // Transition type + uint8_t ln_trans_type, hue_trans_type, sat_trans_type; + // Data length + uint8_t data_length; + + // Check if a transition has been started and deduce data length + mm_bind_get_trans_info(p_env_hsl->env.grp_lid, &ln_trans_type, &ln_rem_time); + mm_bind_get_trans_info(p_env_hslh->env.grp_lid, &hue_trans_type, &hue_rem_time); + mm_bind_get_trans_info(p_env_hslsat->env.grp_lid, &sat_trans_type, &sat_rem_time); + + // Deduce deduce data length + data_length = ((ln_trans_type != MM_TRANS_TYPE_NONE) + || (hue_trans_type != MM_TRANS_TYPE_NONE) + || (sat_trans_type != MM_TRANS_TYPE_NONE)) + ? MM_LIGHT_HSL_STATUS_LEN : MM_LIGHT_HSL_STATUS_MIN_LEN; + + p_buf_status = mm_route_buf_alloc(data_length); + if (p_buf_status) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_status); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_status->env; + // State value + uint16_t state; + // Remaining time + uint8_t rem_time = 0; + + // Prepare environment + if (p_route_env) + { + memcpy(p_buf_env, p_route_env, sizeof(mm_route_env_t)); + } + else if (!publish) + { + p_buf_env->app_key_lid = p_env_hsl->status_app_key_lid; + p_buf_env->u_addr.dst = p_env_hsl->status_dst_addr; + SETB(p_buf_env->info, MM_ROUTE_INFO_RELAY, + GETB(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_RELAY)); + } + + SETB(p_buf_env->info, MM_ROUTE_INFO_RX, 0); + SETB(p_buf_env->info, MM_ROUTE_INFO_PUBLISH, publish); + p_buf_env->mdl_lid = p_env_hsl->env.mdl_lid; + p_buf_env->opcode = (target) ? MM_MSG_LIGHT_HSL_TGT_STATUS + : MM_MSG_LIGHT_HSL_STATUS; + + // Fill the message + if (target && (ln_trans_type != MM_TRANS_TYPE_NONE)) + { + if (ln_trans_type == MM_TRANS_TYPE_MOVE) + { + state = (p_env_hsl->move_delta > 0) + ? mm_lights_ln_get(p_env_hsl->env.elmt_idx, MM_STATE_LIGHT_LN_RANGE_MAX) + : mm_lights_ln_get(p_env_hsl->env.elmt_idx, MM_STATE_LIGHT_LN_RANGE_MIN); + rem_time = MM_TRANS_TIME_UNKNOWN; + } + else + { + state = p_env_hsl->ln_tgt; + } + } + else + { + state = p_env_hsl->ln; + } + write16p(p_data + MM_LIGHT_HSL_STATUS_LIGHTNESS_POS, state); + + if (target && (hue_trans_type != MM_TRANS_TYPE_NONE)) + { + if (hue_trans_type == MM_TRANS_TYPE_MOVE) + { + state = (p_env_hslh->move_delta > 0) ? p_env_hslh->hue_max : p_env_hslh->hue_min; + rem_time = MM_TRANS_TIME_UNKNOWN; + } + else + { + state = p_env_hslh->hue_tgt; + } + } + else + { + state = p_env_hslh->hue; + } + write16p(p_data + MM_LIGHT_HSL_STATUS_HUE_POS, state); + + if (target && (sat_trans_type != MM_TRANS_TYPE_NONE)) + { + if (sat_trans_type == MM_TRANS_TYPE_MOVE) + { + state = (p_env_hslsat->move_delta > 0) ? p_env_hslsat->sat_max : p_env_hslsat->sat_min; + rem_time = MM_TRANS_TIME_UNKNOWN; + } + else + { + state = p_env_hslsat->sat_tgt; + } + } + else + { + state = p_env_hslsat->sat; + } + write16p(p_data + MM_LIGHT_HSL_STATUS_SAT_POS, state); + + if (data_length == MM_LIGHT_HSL_STATUS_LEN) + { + if (rem_time != MM_TRANS_TIME_UNKNOWN) + { + rem_time = co_max(co_max(ln_rem_time, hue_rem_time), sat_rem_time); + } + *(p_data + MM_LIGHT_HSL_STATUS_REM_TIME_POS) = rem_time; + } + + // Send the message + mm_route_send(p_buf_status); + } +} + +/** + **************************************************************************************** + * @brief Prepare and send a Light HSL Hue Status message + * + * @param[in] p_env_hslsat Pointer to Light HSL Hue Server model environment + * @param[in] p_route_env Pointer to structure containing reception information provided + * by Mesh Profile for received request message + * @param[in] publish Indicate if message is sent as a publication (true) or as + * a response to a received request (false) + **************************************************************************************** + */ +__STATIC void mm_lights_hsl_send_status_hue(mm_lights_hslh_env_t *p_env_hslh, + mm_route_env_t *p_route_env, bool publish) +{ + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_status; + // Remaining time + uint8_t rem_time; + // Transition type + uint8_t trans_type; + // Data length + uint8_t data_length; + + // Check if a transition has been started + mm_bind_get_trans_info(p_env_hslh->env.grp_lid, &trans_type, &rem_time); + + // Deduce deduce data length + data_length = (trans_type != MM_TRANS_TYPE_NONE) + ? MM_LIGHT_HSL_HUE_STATUS_LEN : MM_LIGHT_HSL_HUE_STATUS_MIN_LEN; + + p_buf_status = mm_route_buf_alloc(data_length); + if (p_buf_status) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_status); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_status->env; + + // Prepare environment + if (p_route_env) + { + memcpy(p_buf_env, p_route_env, sizeof(mm_route_env_t)); + } + else if (!publish) + { + p_buf_env->app_key_lid = p_env_hslh->status_app_key_lid; + p_buf_env->u_addr.dst = p_env_hslh->status_dst_addr; + SETB(p_buf_env->info, MM_ROUTE_INFO_RELAY, + GETB(p_env_hslh->status_info, MM_LIGHTS_HSL_SINFO_RELAY)); + } + + SETB(p_buf_env->info, MM_ROUTE_INFO_RX, 0); + SETB(p_buf_env->info, MM_ROUTE_INFO_PUBLISH, publish); + p_buf_env->mdl_lid = p_env_hslh->env.mdl_lid; + p_buf_env->opcode = MM_MSG_LIGHT_HSL_HUE_STATUS; + + // Fill the message + write16p(p_data + MM_LIGHT_HSL_HUE_STATUS_HUE_POS, p_env_hslh->hue); + + if (data_length == MM_LIGHT_HSL_HUE_STATUS_LEN) + { + // Sent Target Light HSL Hue state values + uint16_t hue_tgt; + + if (trans_type == MM_TRANS_TYPE_MOVE) + { + hue_tgt = (p_env_hslh->move_delta > 0) ? p_env_hslh->hue_max + : p_env_hslh->hue_min; + rem_time = MM_TRANS_TIME_UNKNOWN; + } + else + { + hue_tgt = p_env_hslh->hue_tgt; + } + + write16p(p_data + MM_LIGHT_HSL_HUE_STATUS_TGT_HUE_POS, hue_tgt); + *(p_data + MM_LIGHT_HSL_HUE_STATUS_REM_TIME_POS) = rem_time; + } + + // Send the message + mm_route_send(p_buf_status); + } +} + +/** + **************************************************************************************** + * @brief Prepare and send a Light HSL Saturation Status message + * + * @param[in] p_env_hslsat Pointer to Light HSL Saturation Server model environment + * @param[in] p_route_env Pointer to structure containing reception information provided + * by Mesh Profile for received request message + * @param[in] publish Indicate if message is sent as a publication (true) or as + * a response to a received request (false) + **************************************************************************************** + */ +__STATIC void mm_lights_hsl_send_status_sat(mm_lights_hslsat_env_t *p_env_hslsat, + mm_route_env_t *p_route_env, bool publish) +{ + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_status; + // Remaining time + uint8_t rem_time; + // Transition type + uint8_t trans_type; + // Data length + uint8_t data_length; + + // Check if a transition has been started + mm_bind_get_trans_info(p_env_hslsat->env.grp_lid, &trans_type, &rem_time); + + // Deduce deduce data length + data_length = (trans_type != MM_TRANS_TYPE_NONE) + ? MM_LIGHT_HSL_SAT_STATUS_LEN : MM_LIGHT_HSL_SAT_STATUS_MIN_LEN; + + p_buf_status = mm_route_buf_alloc(data_length); + if (p_buf_status) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_status); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_status->env; + + // Prepare environment + if (p_route_env) + { + memcpy(p_buf_env, p_route_env, sizeof(mm_route_env_t)); + } + else if (!publish) + { + p_buf_env->app_key_lid = p_env_hslsat->status_app_key_lid; + p_buf_env->u_addr.dst = p_env_hslsat->status_dst_addr; + SETB(p_buf_env->info, MM_ROUTE_INFO_RELAY, + GETB(p_env_hslsat->status_info, MM_LIGHTS_HSL_SINFO_RELAY)); + } + + SETB(p_buf_env->info, MM_ROUTE_INFO_RX, 0); + SETB(p_buf_env->info, MM_ROUTE_INFO_PUBLISH, publish); + p_buf_env->mdl_lid = p_env_hslsat->env.mdl_lid; + p_buf_env->opcode = MM_MSG_LIGHT_HSL_SAT_STATUS; + + // Fill the message + write16p(p_data + MM_LIGHT_HSL_SAT_STATUS_SAT_POS, p_env_hslsat->sat); + + if (data_length == MM_LIGHT_HSL_SAT_STATUS_LEN) + { + // Sent Target Light HSL Saturation state values + uint16_t sat_tgt; + + if (trans_type == MM_TRANS_TYPE_MOVE) + { + sat_tgt = (p_env_hslsat->move_delta > 0) ? p_env_hslsat->sat_max + : p_env_hslsat->sat_min; + rem_time = MM_TRANS_TIME_UNKNOWN; + } + else + { + sat_tgt = p_env_hslsat->sat_tgt; + } + + write16p(p_data + MM_LIGHT_HSL_SAT_STATUS_TGT_SAT_POS, sat_tgt); + *(p_data + MM_LIGHT_HSL_SAT_STATUS_REM_TIME_POS) = rem_time; + } + + // Send the message + mm_route_send(p_buf_status); + } +} + +/** + **************************************************************************************** + * @brief Prepare and send a Light HSL Default Status message + * + * @param[in] p_env_hsl Pointer to Light HSL Server model environment + * @param[in] p_route_env Pointer to structure containing reception information provided + * by Mesh Profile for received request message + **************************************************************************************** + */ +__STATIC void mm_lights_hsl_send_status_dflt(mm_lights_hsl_env_t *p_env_hsl, + mm_route_env_t *p_route_env) +{ + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_status = mm_route_buf_alloc_status(MM_LIGHT_HSL_DFLT_STATUS_LEN, p_route_env); + + if (p_buf_status) + { + // Get environment for Light Lightness HSL Hue Server model + mm_lights_hslh_env_t *p_env_hslh = p_env_hsl->p_env_hslh; + // Get environment for Light Lightness HSL Saturation Server model + mm_lights_hslsat_env_t *p_env_hslsat = p_env_hsl->p_env_hslsat; + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_status); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_status->env; + + // Prepare environment + p_buf_env->mdl_lid = p_env_hsl->env.mdl_lid; + p_buf_env->opcode = MM_MSG_LIGHT_HSL_DFLT_STATUS; + + // Fill the message + write16p(p_data + MM_LIGHT_HSL_DFLT_STATUS_LIGHTNESS_POS, + mm_lights_ln_get(p_env_hsl->env.elmt_idx, MM_STATE_LIGHT_LN_DFLT)); + write16p(p_data + MM_LIGHT_HSL_DFLT_STATUS_HUE_POS, p_env_hslh->hue_dflt); + write16p(p_data + MM_LIGHT_HSL_DFLT_STATUS_SAT_POS, p_env_hslsat->sat_dflt); + + // Send the message + mm_route_send(p_buf_status); + } +} + +/** + **************************************************************************************** + * @brief Prepare and send a Light HSL Range Status message + * + * @param[in] p_env_hsl Pointer to Light HSL Server model environment + * @param[in] p_route_env Pointer to structure containing reception information provided + * by Mesh Profile for received request message + * @param[in] status Status sent in the Light HSL Status message + * (@see enum mm_status) + **************************************************************************************** + */ +__STATIC void mm_lights_hsl_send_status_range(mm_lights_hsl_env_t *p_env_hsl, + mm_route_env_t *p_route_env, + uint8_t status) +{ + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_status = mm_route_buf_alloc_status(MM_LIGHT_HSL_RANGE_STATUS_LEN, p_route_env); + + if (p_buf_status) + { + // Get environment for Light Lightness HSL Hue Server model + mm_lights_hslh_env_t *p_env_hslh = p_env_hsl->p_env_hslh; + // Get environment for Light Lightness HSL Saturation Server model + mm_lights_hslsat_env_t *p_env_hslsat = p_env_hsl->p_env_hslsat; + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_status); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_status->env; + + // Prepare environment + p_buf_env->mdl_lid = p_env_hsl->env.mdl_lid; + p_buf_env->opcode = MM_MSG_LIGHT_HSL_RANGE_STATUS; + + // Fill the message + *(p_data + MM_LIGHT_HSL_RANGE_STATUS_CODE_POS) = status; + write16p(p_data + MM_LIGHT_HSL_RANGE_STATUS_HUE_MIN_POS, p_env_hslh->hue_min); + write16p(p_data + MM_LIGHT_HSL_RANGE_STATUS_HUE_MAX_POS, p_env_hslh->hue_max); + write16p(p_data + MM_LIGHT_HSL_RANGE_STATUS_SAT_MIN_POS, p_env_hslsat->sat_min); + write16p(p_data + MM_LIGHT_HSL_RANGE_STATUS_SAT_MAX_POS, p_env_hslsat->sat_max); + + // Send the message + mm_route_send(p_buf_status); + } +} + +/** + **************************************************************************************** + * @brief Publish Light HSL state value if sending of publications is enabled + * + * @param[in] p_env_hsl Pointer to Light HSL Server model environment + * @param[in] target Publish current state or target state + **************************************************************************************** + */ +__STATIC void mm_lights_hsl_publish(mm_lights_hsl_env_t *p_env_hsl, bool target) +{ + // Check if sending of publication is enabled + if (GETB(p_env_hsl->env.info, MM_INFO_PUBLI)) + { + mm_lights_hsl_send_status(p_env_hsl, NULL, true, target); + } +} + +/** + **************************************************************************************** + * @brief Publish Light HSL Hue or Light HSL Saturation state value if sending of publications + * is enabled + * + * @param[in] p_env Pointer to Light HSL Hue/Saturation Server model environment + **************************************************************************************** + */ +__STATIC void mm_lights_hsl_publish_hue_sat(mm_mdl_env_t *p_env) +{ + // Check if sending of publication is enabled + if (GETB(p_env->info, MM_INFO_PUBLI)) + { + if (p_env->model_id == MM_ID_LIGHTS_HSLH) + { + mm_lights_hsl_send_status_hue((mm_lights_hslh_env_t *)p_env, NULL, true); + } + else // (p_env->model_id == MM_ID_LIGHTS_HSLSAT) + { + mm_lights_hsl_send_status_sat((mm_lights_hslsat_env_t *)p_env, NULL, true); + } + } +} + +/** + **************************************************************************************** + * @brief Check if a Light HSL Status message must be sent and send it if it is the case + * + * @param[in] p_env_hsl Pointer to Light HSL Server model environment + * @param[in] event + **************************************************************************************** + */ +__STATIC void mm_lights_hsl_check_status(mm_lights_hsl_env_t *p_env_hsl, uint8_t event) +{ + if (!GETF(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_WAIT)) + { + if (p_env_hsl->status_dst_addr != MESH_UNASSIGNED_ADDR) + { + // Send a response to the node that has required the transition + mm_lights_hsl_send_status(p_env_hsl, NULL, false, false); + + p_env_hsl->status_dst_addr = MESH_UNASSIGNED_ADDR; + } + + // Send a publication + mm_lights_hsl_publish(p_env_hsl, (event == MM_GRP_EVENT_TRANS_STARTED)); + + if (event == MM_GRP_EVENT_TRANS_STARTED) + { + SETF(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_WAIT, + GETF(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_TRANS)); + } + else + { + SETF(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_WAIT, 0); + SETF(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_TRANS, 0); + } + } +} + +/** + **************************************************************************************** + * @brief Check if a Light HSL Hue Status message or a Light HSL Saturation Status message + * must be sent and send it if it is the case + * + * @param[in] p_env Pointer to Light HSL Hue/Saturation Server model environment + **************************************************************************************** + */ +__STATIC void mm_lights_hsl_check_status_rsp_hue_sat(mm_mdl_env_t *p_env) +{ + if (p_env->model_id == MM_ID_LIGHTS_HSLH) + { + // Get environment allocated for Light HSL Hue Server model + mm_lights_hslh_env_t *p_env_hslh = (mm_lights_hslh_env_t *)p_env; + + if (p_env_hslh->status_dst_addr != MESH_UNASSIGNED_ADDR) + { + // Send a response to the node that has required the transition + mm_lights_hsl_send_status_hue(p_env_hslh, NULL, false); + + p_env_hslh->status_dst_addr = MESH_UNASSIGNED_ADDR; + } + } + else + { + // Get environment allocated for Light HSL Saturation Server model + mm_lights_hslsat_env_t *p_env_hslsat = (mm_lights_hslsat_env_t *)p_env; + + if (p_env_hslsat->status_dst_addr != MESH_UNASSIGNED_ADDR) + { + // Send a response to the node that has required the transition + mm_lights_hsl_send_status_sat(p_env_hslsat, NULL, false); + + p_env_hslsat->status_dst_addr = MESH_UNASSIGNED_ADDR; + } + } +} + +/* + * MESSAGE HANDLERS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Handler for Light HSL Set/Set Unacknowledged message + * + * @param[in] p_env Pointer to environment of model for which message has been received + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing information for the received buffer + **************************************************************************************** + */ +__STATIC void mm_lights_hsl_handler_set(mm_lights_hsl_env_t *p_env_hsl, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + do + { + // Get environment for Light Lightness HSL Hue Server model + mm_lights_hslh_env_t *p_env_hslh = p_env_hsl->p_env_hslh; + // Get environment for Light Lightness HSL Saturation Server model + mm_lights_hslsat_env_t *p_env_hslsat = p_env_hsl->p_env_hslsat; + // Check if a status message must be sent + bool send_status = (p_route_env->opcode == MM_MSG_LIGHT_HSL_SET); + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // TID value + uint8_t tid; + // Light HSL Lightness, Light HSL Hue and Light HSL Saturation value + uint16_t ln = read16p(p_data + MM_LIGHT_HSL_SET_LIGHTNESS_POS); + uint16_t hue = read16p(p_data + MM_LIGHT_HSL_SET_HUE_POS); + uint16_t sat = read16p(p_data + MM_LIGHT_HSL_SET_SAT_POS); + // Transition time + uint8_t trans_time; + // Delay + uint8_t delay; + + // Check if Light CTL Hue and Light CTL Saturation state values are within the defined ranges + if ((hue > p_env_hslh->hue_max) + || (hue < p_env_hslh->hue_min) + || (sat > p_env_hslsat->sat_max) + || (sat < p_env_hslsat->sat_min)) + { + break; + } + + tid = *(p_data + MM_LIGHT_CTL_SET_TID_POS); + + // Check if request can be processed + if ((p_env_hsl->status_dst_addr != MESH_UNASSIGNED_ADDR) + || (p_env_hslh->status_dst_addr != MESH_UNASSIGNED_ADDR) + || (p_env_hslsat->status_dst_addr != MESH_UNASSIGNED_ADDR) + || (mm_replay_is_retx(&p_env_hsl->replay_env, p_route_env->u_addr.src, tid))) + { + // Send a Light HSL Status message + if (send_status) + { + mm_lights_hsl_send_status(p_env_hsl, p_route_env, false, false); + } + break; + } + + // Extract and check optional parameters if present + if (p_buf->data_len == MM_LIGHT_HSL_SET_LEN) + { + trans_time = (uint16_t)(*(p_data + MM_LIGHT_HSL_SET_TRANS_TIME_POS)); + + // Check received value + if (GETF(trans_time, MM_TRANS_TIME_STEP_NB) > MM_TRANS_TIME_STEPS_MAX) + { + // Drop the message + break; + } + + delay = *(p_data + MM_LIGHT_HSL_SET_DELAY_POS); + } + else + { + trans_time = MM_TRANS_TIME_UNKNOWN; + delay = 0; + } + + // Check if at least one of the states is modified + if ((ln == p_env_hsl->ln) + && (hue == p_env_hslh->hue) + && (sat == p_env_hslsat->sat)) + { + // Send a Light HSL Status message + if (send_status) + { + mm_lights_hsl_send_status(p_env_hsl, p_route_env, false, false); + } + break; + }; + + if (send_status) + { + // Keep information for transmission of status + p_env_hsl->status_dst_addr = p_route_env->u_addr.src; + p_env_hsl->status_app_key_lid = p_route_env->app_key_lid; + SETB(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_RELAY, + GETB(p_route_env->info, MM_ROUTE_INFO_RELAY)); + } + + SETB(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_TRANS_LN, (ln != p_env_hsl->ln)); + SETB(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_TRANS_HUE, (hue != p_env_hslh->hue)); + SETB(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_TRANS_SAT, (sat != p_env_hslsat->sat)); + SETF(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_WAIT, + GETF(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_TRANS)); + + if (ln != p_env_hsl->ln) + { + // Update target state + p_env_hsl->ln_tgt = ln; + + // Inform the Binding Manager about new transition + mm_bind_trans_new(p_env_hsl->env.grp_lid, MM_TRANS_TYPE_CLASSIC, trans_time, delay); + } + + if (hue != p_env_hslh->hue) + { + // Update target state + p_env_hslh->hue_tgt = hue; + + // Inform the Binding Manager about new transition + mm_bind_trans_new(p_env_hslh->env.grp_lid, MM_TRANS_TYPE_CLASSIC, trans_time, delay); + } + + if (sat != p_env_hslsat->sat) + { + // Update target state + p_env_hslsat->sat_tgt = sat; + + // Inform the Binding Manager about new transition + mm_bind_trans_new(p_env_hslsat->env.grp_lid, MM_TRANS_TYPE_CLASSIC, trans_time, delay); + } + } while (0); +} + +/** + **************************************************************************************** + * @brief Handler for Light HSL Hue Set/Set Unacknowledged message + * + * @param[in] p_env Pointer to environment of model for which message has been received + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing information for the received buffer + **************************************************************************************** + */ +__STATIC void mm_lights_hsl_handler_set_hue(mm_lights_hslh_env_t *p_env_hslh, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + do + { + // Get pointer to environment for Light HSL Server model + mm_lights_hsl_env_t *p_env_hsl = p_env_hslh->p_env_hsl; + // Check if a status message must be sent + bool send_status = (p_route_env->opcode == MM_MSG_LIGHT_HSL_HUE_SET); + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // TID value + uint8_t tid; + // Received Light CTL Hue state values + uint16_t hue = read16p(p_data + MM_LIGHT_HSL_HUE_SET_HUE_POS); + // Transition time + uint8_t trans_time; + // Delay + uint8_t delay = 0; + + // Check if Light CTL Hue state value is within the defined range + if ((hue > p_env_hslh->hue_max) + || (hue < p_env_hslh->hue_min)) + { + break; + } + + tid = *(p_data + MM_LIGHT_HSL_HUE_SET_TID_POS); + + // Check if request can be processed + if ((p_env_hsl->status_dst_addr != MESH_UNASSIGNED_ADDR) + || (mm_replay_is_retx(&p_env_hsl->replay_env, p_route_env->u_addr.src, tid))) + { + // Send a Light HSL Hue Status message + if (send_status) + { + mm_lights_hsl_send_status_hue(p_env_hslh, p_route_env, false); + } + break; + } + + // Extract and check optional parameters if present + if (p_buf->data_len == MM_LIGHT_HSL_HUE_SET_LEN) + { + trans_time = (uint16_t)(*(p_data + MM_LIGHT_HSL_HUE_SET_TRANS_TIME_POS)); + + // Check received value + if (GETF(trans_time, MM_TRANS_TIME_STEP_NB) > MM_TRANS_TIME_STEPS_MAX) + { + // Drop the message + break; + } + + delay = *(p_data + MM_LIGHT_HSL_HUE_SET_DELAY_POS); + } + else + { + delay = 0; + trans_time = MM_TRANS_TIME_UNKNOWN; + } + + // Check if state is modified + if (hue == p_env_hslh->hue) + { + // Send a Light HSL Hue Status message + if (send_status) + { + mm_lights_hsl_send_status_hue(p_env_hslh, p_route_env, false); + } + break; + }; + + if (send_status) + { + // Keep information for transmission of status + p_env_hslh->status_dst_addr = p_route_env->u_addr.src; + p_env_hslh->status_app_key_lid = p_route_env->app_key_lid; + SETB(p_env_hslh->status_info, MM_LIGHTS_HSL_SINFO_HS_RELAY, + GETB(p_route_env->info, MM_ROUTE_INFO_RELAY)); + } + + SETB(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_TRANS_LN, 0); + SETB(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_TRANS_HUE, 1); + SETB(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_TRANS_SAT, 0); + SETF(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_TRANS, + GETF(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_WAIT)); + + // Update target state + p_env_hslh->hue_tgt = hue; + + // Inform the Binding Manager about new transition + mm_bind_trans_new(p_env_hslh->env.grp_lid, MM_TRANS_TYPE_CLASSIC, trans_time, delay); + } while (0); +} + +/** + **************************************************************************************** + * @brief Handler for Light HSL Saturation Set/Set Unacknowledged message + * + * @param[in] p_env Pointer to environment of model for which message has been received + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing information for the received buffer + **************************************************************************************** + */ +__STATIC void mm_lights_hsl_handler_set_sat(mm_lights_hslsat_env_t *p_env_hslsat, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + do + { + // Get pointer to environment for Light HSL Server model + mm_lights_hsl_env_t *p_env_hsl = p_env_hslsat->p_env_hsl; + // Check if a status message must be sent + bool send_status = (p_route_env->opcode == MM_MSG_LIGHT_HSL_SAT_SET); + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // TID value + uint8_t tid; + // Received Light CTL Saturation state values + uint16_t sat = read16p(p_data + MM_LIGHT_HSL_SAT_SET_SAT_POS); + // Transition time + uint8_t trans_time; + // Delay + uint8_t delay; + + // Check if Light CTL Saturation state value is within the defined range + if ((sat > p_env_hslsat->sat_max) + || (sat < p_env_hslsat->sat_min)) + { + break; + } + + tid = *(p_data + MM_LIGHT_HSL_SAT_SET_TID_POS); + + // Check if request can be processed + if ((p_env_hsl->status_dst_addr != MESH_UNASSIGNED_ADDR) + || (mm_replay_is_retx(&p_env_hsl->replay_env, p_route_env->u_addr.src, tid))) + { + // Send a Light HSL Saturation Status message + if (send_status) + { + mm_lights_hsl_send_status_sat(p_env_hslsat, p_route_env, false); + } + break; + } + + // Extract and check optional parameters if present + if (p_buf->data_len == MM_LIGHT_HSL_SAT_SET_LEN) + { + trans_time = (uint16_t)(*(p_data + MM_LIGHT_HSL_SAT_SET_TRANS_TIME_POS)); + + // Check received value + if (GETF(trans_time, MM_TRANS_TIME_STEP_NB) > MM_TRANS_TIME_STEPS_MAX) + { + // Drop the message + break; + } + + delay = *(p_data + MM_LIGHT_HSL_SAT_SET_DELAY_POS); + } + else + { + delay = 0; + trans_time = MM_TRANS_TIME_UNKNOWN; + } + + // Check if state is modified + if (sat == p_env_hslsat->sat) + { + // Send a Light HSL Saturation Status message + if (send_status) + { + mm_lights_hsl_send_status_sat(p_env_hslsat, p_route_env, false); + } + break; + }; + + if (send_status) + { + // Keep information for transmission of status + p_env_hslsat->status_dst_addr = p_route_env->u_addr.src; + p_env_hslsat->status_app_key_lid = p_route_env->app_key_lid; + SETB(p_env_hslsat->status_info, MM_LIGHTS_HSL_SINFO_HS_RELAY, + GETB(p_route_env->info, MM_ROUTE_INFO_RELAY)); + } + + SETB(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_TRANS_LN, 0); + SETB(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_TRANS_HUE, 0); + SETB(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_TRANS_SAT, 1); + SETF(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_TRANS, + GETF(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_WAIT)); + + // Update target state + p_env_hslsat->sat_tgt = sat; + + // Inform the Binding Manager about new transition + mm_bind_trans_new(p_env_hslsat->env.grp_lid, MM_TRANS_TYPE_CLASSIC, trans_time, delay); + } while (0); +} + +/** + **************************************************************************************** + * @brief Handler for Light HSL Default Set/Set Unacknowledged message + * + * @param[in] p_env Pointer to environment of model for which message has been received + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing information for the received buffer + **************************************************************************************** + */ +__STATIC void mm_lights_hsl_handler_set_dflt(mm_lights_hsl_env_t *p_env_hsl, + mesh_buf_t *p_buf, mm_route_env_t *p_route_env) +{ + do + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Get environment for Light Lightness HSL Hue Server model + mm_lights_hslh_env_t *p_env_hslh = p_env_hsl->p_env_hslh; + // Get environment for Light Lightness HSL Saturation Server model + mm_lights_hslsat_env_t *p_env_hslsat = p_env_hsl->p_env_hslsat; + // Extract Light HSL Lightness Default state value + uint16_t ln_dflt = read16p(p_data + MM_LIGHT_HSL_DFLT_SET_LIGHTNESS_POS); + // Extract Light HSL Hue Default state value + uint16_t hue_dflt = read16p(p_data + MM_LIGHT_HSL_DFLT_SET_HUE_POS); + // Extract Light HSL Saturation Default state value + uint16_t sat_dflt = read16p(p_data + MM_LIGHT_HSL_DFLT_SET_SAT_POS); + + // Check if Light CTL Hue and Light CTL Saturation state values are within the defined ranges + if ((hue_dflt > p_env_hslh->hue_max) + || (hue_dflt < p_env_hslh->hue_min) + || (sat_dflt > p_env_hslsat->sat_max) + || (sat_dflt < p_env_hslsat->sat_min)) + { + break; + } + + // Inform Light Lightness Server model about received Light Lightness Default state value + mm_lights_ln_set_dflt(p_env_hsl->env.elmt_idx, ln_dflt); + + if (hue_dflt != p_env_hslh->hue_dflt) + { + // Keep received value + p_env_hslh->hue_dflt = hue_dflt; + + // Inform application about received value + mm_srv_state_upd_ind_send(MM_STATE_LIGHT_HSL_DFLT_HUE, + p_env_hslh->env.elmt_idx, hue_dflt, 0); + } + + if (sat_dflt != p_env_hslsat->sat_dflt) + { + // Keep received value + p_env_hslsat->sat_dflt = sat_dflt; + + // Inform application about received value + mm_srv_state_upd_ind_send(MM_STATE_LIGHT_HSL_DFLT_SAT, + p_env_hslsat->env.elmt_idx, sat_dflt, 0); + } + + // If needed, send a Light HSL Default Status message to the requester + if (p_route_env->opcode == MM_MSG_LIGHT_HSL_DFLT_SET) + { + mm_lights_hsl_send_status_dflt(p_env_hsl, p_route_env); + } + } while (0); +} + +/** + **************************************************************************************** + * @brief Handler for Light HSL Range Set/Set Unacknowledged message + * + * @param[in] p_env Pointer to environment of model for which message has been received + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing information for the received buffer + **************************************************************************************** + */ +__STATIC void mm_lights_hsl_handler_set_range(mm_lights_hsl_env_t *p_env_hsl, + mesh_buf_t *p_buf, mm_route_env_t *p_route_env) +{ + do + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Get environment for Light Lightness HSL Hue Server model + mm_lights_hslh_env_t *p_env_hslh = p_env_hsl->p_env_hslh; + // Get environment for Light Lightness HSL Saturation Server model + mm_lights_hslsat_env_t *p_env_hslsat = p_env_hsl->p_env_hslsat; + // Extract Light HSL Hue Min state value + uint16_t hue_min = read16p(p_data + MM_LIGHT_HSL_RANGE_SET_HUE_MIN_POS); + // Extract Light HSL Hue Max state value + uint16_t hue_max = read16p(p_data + MM_LIGHT_HSL_RANGE_SET_HUE_MAX_POS); + // Extract Light HSL Saturation Min state value + uint16_t sat_min = read16p(p_data + MM_LIGHT_HSL_RANGE_SET_SAT_MIN_POS); + // Extract Light HSL Saturation Max state value + uint16_t sat_max = read16p(p_data + MM_LIGHT_HSL_RANGE_SET_SAT_MAX_POS); + + // Check provided values + if ((hue_min > hue_max) + || (sat_min > sat_max)) + { + // Drop the message + break; + } + + if ((p_env_hslh->hue_min != hue_min) + || (p_env_hslh->hue_max != hue_max)) + { + p_env_hslh->hue_min = hue_min; + p_env_hslh->hue_max = hue_max; + + // Inform application about received value + mm_srv_state_upd_ind_send(MM_STATE_LIGHT_HSL_RANGE_HUE, p_env_hslh->env.elmt_idx, + (uint32_t)hue_min | ((uint32_t)hue_max << 16), 0); + } + + if ((p_env_hslsat->sat_min != sat_min) + || (p_env_hslsat->sat_max != sat_max)) + { + p_env_hslsat->sat_min = sat_min; + p_env_hslsat->sat_max = sat_max; + + // Inform application about received value + mm_srv_state_upd_ind_send(MM_STATE_LIGHT_HSL_RANGE_SAT, p_env_hslsat->env.elmt_idx, + (uint32_t)sat_min | ((uint32_t)sat_max << 16), 0); + } + + // If needed, send a Light HSL Range Status message to the requester + if (p_route_env->opcode == MM_MSG_LIGHT_HSL_RANGE_SET) + { + mm_lights_hsl_send_status_range(p_env_hsl, p_route_env, MM_STATUS_SUCCESS); + } + } while (0); +} + +/* + * INTERNAL CALLBACK FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Callback function called when timer monitoring publication duration for + * Light HSL Server model or for Light HSL Hue Server model or for Light HSL Saturation + * Server model expires + * + * @param[in] p_env Pointer to model environment for Light HSL Server or Light HSL + * Hue Server or Light HSL Saturation Server model + **************************************************************************************** + */ +__STATIC void mm_lights_hsl_cb_tmr_publi(void *p_tmr) +{ + mm_lights_hsl_env_t *p_env = MESH_TMR2ENV(p_tmr, mm_lights_hsl_env_t, tmr_publi); + // Get allocated environment + mm_mdl_publi_env_t *p_env_publi = (mm_mdl_publi_env_t *)p_env; + + if (p_env_publi->publi_period_ms) + { + if (p_env_publi->env.model_id == MM_ID_LIGHTS_HSL) + { + // Publish a Light HSL Status message + mm_lights_hsl_publish((mm_lights_hsl_env_t *)p_env, false); + } + else + { + // Publish a Light HSL Hue Status message + mm_lights_hsl_publish_hue_sat(&p_env_publi->env); + } + + // Restart the timer + mesh_timer_set(&p_env_publi->tmr_publi, p_env_publi->publi_period_ms); + } +} + +/** + **************************************************************************************** + * @brief Inform Light HSL Server model about a received message + * + * @param[in] p_env Pointer to the environment allocated for the Light HSL + * Server model + * @param[in] p_buf Pointer to the buffer containing the received message + * @param[in] p_route_env Pointer to structure containing reception parameters provided + * by the Mesh Profile block + **************************************************************************************** + */ +__STATIC void mm_lights_hsl_cb_rx(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + do + { + mm_lights_hsl_env_t *p_env_hsl; + + if (p_env->model_id == MM_ID_LIGHTS_HSL) + { + // Get Environment for Light HSL Server model + p_env_hsl = (mm_lights_hsl_env_t *)p_env; + + switch (p_route_env->opcode) + { + case (MM_MSG_LIGHT_HSL_GET): + case (MM_MSG_LIGHT_HSL_TGT_GET): + { + // Send a Light HSL Status message + mm_lights_hsl_send_status(p_env_hsl, p_route_env, false, + (p_route_env->opcode == MM_MSG_LIGHT_HSL_TGT_GET)); + } break; + + case (MM_MSG_LIGHT_HSL_SET): + case (MM_MSG_LIGHT_HSL_SET_UNACK): + { + // Handle the message + mm_lights_hsl_handler_set(p_env_hsl, p_buf, p_route_env); + } break; + + case (MM_MSG_LIGHT_HSL_DFLT_GET): + { + // Send a Light HSL Default Status message + mm_lights_hsl_send_status_dflt(p_env_hsl, p_route_env); + } break; + + case (MM_MSG_LIGHT_HSL_RANGE_GET): + { + // Send a Light HSL Range Status message + mm_lights_hsl_send_status_range(p_env_hsl, p_route_env, MM_STATUS_SUCCESS); + } break; + + default: + { + } break; + } + } + else if (p_env->model_id == MM_ID_LIGHTS_HSLS) + { + // Get Environment for Light HSL Setup Server model + mm_lights_hsls_env_t *p_env_hsls = (mm_lights_hsls_env_t *)p_env; + + // Get environment for Light HSL Server model + p_env_hsl = p_env_hsls->p_env_hsl; + + switch (p_route_env->opcode) + { + case (MM_MSG_LIGHT_HSL_DFLT_SET): + case (MM_MSG_LIGHT_HSL_DFLT_SET_UNACK): + { + // Handle the message + mm_lights_hsl_handler_set_dflt(p_env_hsl, p_buf, p_route_env); + } break; + + case (MM_MSG_LIGHT_HSL_RANGE_SET): + case (MM_MSG_LIGHT_HSL_RANGE_SET_UNACK): + { + // Handle the message + mm_lights_hsl_handler_set_range(p_env_hsl, p_buf, p_route_env); + } break; + + default: + { + } break; + } + } + else if (p_env->model_id == MM_ID_LIGHTS_HSLH) + { + // Get environment for Light HSL Hue model + mm_lights_hslh_env_t *p_env_hslh = (mm_lights_hslh_env_t *)p_env; + + switch (p_route_env->opcode) + { + case (MM_MSG_LIGHT_HSL_HUE_GET): + { + // Send a Light HSL Hue Status message + mm_lights_hsl_send_status_hue(p_env_hslh, p_route_env, false); + } break; + + case (MM_MSG_LIGHT_HSL_HUE_SET): + case (MM_MSG_LIGHT_HSL_HUE_SET_UNACK): + { + // Handle the message + mm_lights_hsl_handler_set_hue(p_env_hslh, p_buf, p_route_env); + } break; + + default: + { + } break; + } + } + else // (p_env->model_id == MM_ID_LIGHTS_HSLSAT) + { + // Get environment for Light HSL Saturation model + mm_lights_hslsat_env_t *p_env_hslsat = (mm_lights_hslsat_env_t *)p_env; + + switch (p_route_env->opcode) + { + case (MM_MSG_LIGHT_HSL_SAT_GET): + { + // Send a Light HSL Saturation Status message + mm_lights_hsl_send_status_sat(p_env_hslsat, p_route_env, false); + } break; + + case (MM_MSG_LIGHT_HSL_SAT_SET): + case (MM_MSG_LIGHT_HSL_SAT_SET_UNACK): + { + // Handle the message + mm_lights_hsl_handler_set_sat(p_env_hslsat, p_buf, p_route_env); + } break; + + default: + { + } break; + } + } + } while (0); +} + +/** + **************************************************************************************** + * @brief Check if a given opcode is handled by the Light HSL Server model + * + * @param[in] p_env Pointer to the environment allocated for the Light HSL + * Server model + * @param[in] opcode Opcode to check + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lights_hsl_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status = MESH_ERR_MDL_INVALID_OPCODE; + + if (p_env->model_id == MM_ID_LIGHTS_HSL) + { + if ((opcode == MM_MSG_LIGHT_HSL_GET) + || (opcode == MM_MSG_LIGHT_HSL_SET) + || (opcode == MM_MSG_LIGHT_HSL_SET_UNACK) + || (opcode == MM_MSG_LIGHT_HSL_TGT_GET) + || (opcode == MM_MSG_LIGHT_HSL_RANGE_GET) + || (opcode == MM_MSG_LIGHT_HSL_DFLT_GET)) + { + status = MESH_ERR_NO_ERROR; + } + } + else if (p_env->model_id == MM_ID_LIGHTS_HSLS) + { + if ((opcode == MM_MSG_LIGHT_HSL_DFLT_SET) + || (opcode == MM_MSG_LIGHT_HSL_DFLT_SET_UNACK) + || (opcode == MM_MSG_LIGHT_HSL_RANGE_SET) + || (opcode == MM_MSG_LIGHT_HSL_RANGE_SET_UNACK)) + { + status = MESH_ERR_NO_ERROR; + } + } + else if (p_env->model_id == MM_ID_LIGHTS_HSLH) + { + if ((opcode == MM_MSG_LIGHT_HSL_HUE_GET) + || (opcode == MM_MSG_LIGHT_HSL_HUE_SET) + || (opcode == MM_MSG_LIGHT_HSL_HUE_SET_UNACK)) + { + status = MESH_ERR_NO_ERROR; + } + } + else if (p_env->model_id == MM_ID_LIGHTS_HSLSAT) + { + if ((opcode == MM_MSG_LIGHT_HSL_SAT_GET) + || (opcode == MM_MSG_LIGHT_HSL_SAT_SET) + || (opcode == MM_MSG_LIGHT_HSL_SAT_SET_UNACK)) + { + status = MESH_ERR_NO_ERROR; + } + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Callback function called upon reception of application request to set a Light + * HSL state value + * + * @param[in] p_env Pointer the the environment allocated for model + * @param[in] state_id State identifier + * @param[in] state State value + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lights_hsl_cb_set(mm_mdl_env_t *p_env, uint16_t state_id, + uint32_t state) +{ + // Returned status + uint8_t status = MESH_ERR_NO_ERROR; + + if (state_id == MM_STATE_LIGHT_HSL_LN) + { + // Get environment for the Light HSL Server model + mm_lights_hsl_env_t *p_env_hsl = (mm_lights_hsl_env_t *)p_env; + + // Keep the provided state value + p_env_hsl->ln = state; + + // Set the Light Lightness state value + mm_bind_set_state(p_env_hsl->env.grp_lid, MM_STATE_TYPE_CURRENT, + MM_ID_LIGHTS_LN, state); + } + else + { + status = MESH_ERR_INVALID_PARAM; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Callback function called upon reception of application request to set a Light + * HSL Hue state value + * + * @param[in] p_env Pointer the the environment allocated for model + * @param[in] state_id State identifier + * @param[in] state State value + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lights_hsl_cb_set_hue(mm_mdl_env_t *p_env, uint16_t state_id, + uint32_t state) +{ + // Returned status + uint8_t status = MESH_ERR_NO_ERROR; + // Get environment for the Light HSL Hue Server model + mm_lights_hslh_env_t *p_env_hslh = (mm_lights_hslh_env_t *)p_env; + + switch (state_id) + { + case (MM_STATE_LIGHT_HSL_HUE): + { + // Keep the provided state value + p_env_hslh->hue = state; + + // Set the Generic Level state value + mm_bind_set_state(p_env_hslh->env.grp_lid, MM_STATE_TYPE_CURRENT, + MM_ID_GENS_LVL, state - 32768); + } break; + + case (MM_STATE_LIGHT_HSL_DFLT_HUE): + { + // Keep the provided state value + p_env_hslh->hue_dflt = state; + } break; + + case (MM_STATE_LIGHT_HSL_RANGE_HUE): + { + // Keep the provided state value + p_env_hslh->hue_min = state; + p_env_hslh->hue_max = (state >> 16); + } break; + + default: + { + status = MESH_ERR_INVALID_PARAM; + } break; + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Callback function called upon reception of application request to set a Light + * HSL Saturation state value + * + * @param[in] p_env Pointer the the environment allocated for model + * @param[in] state_id State identifier + * @param[in] state State value + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lights_hsl_cb_set_sat(mm_mdl_env_t *p_env, uint16_t state_id, uint32_t state) +{ + // Returned status + uint8_t status = MESH_ERR_NO_ERROR; + // Get environment for the Light HSL Saturation Server model + mm_lights_hslsat_env_t *p_env_hslsat = (mm_lights_hslsat_env_t *)p_env; + + switch (state_id) + { + case (MM_STATE_LIGHT_HSL_SAT): + { + // Keep the provided state value + p_env_hslsat->sat = state; + + // Set the Generic Level state value + mm_bind_set_state(p_env_hslsat->env.grp_lid, MM_STATE_TYPE_CURRENT, + MM_ID_GENS_LVL, state - 32768); + } break; + + case (MM_STATE_LIGHT_HSL_DFLT_SAT): + { + // Keep the provided state value + p_env_hslsat->sat_dflt = state; + } break; + + case (MM_STATE_LIGHT_HSL_RANGE_SAT): + { + // Keep the provided state value + p_env_hslsat->sat_min = state; + p_env_hslsat->sat_max = (state >> 16); + } break; + + default: + { + status = MESH_ERR_INVALID_PARAM; + } break; + } + + return (status); +} + +/* + * REGISTRATION FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Register Light HSL Server model + * + * @param[in] elmt_idx Index of element on which the model must be registered + * @param[out] p_mdl_lid Address at which allocated model local index must be returned + * + * @return An handling status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lights_hsl_register_hsl(uint8_t elmt_idx) +{ + // Register Light HSL Server model + m_lid_t mdl_lid = ms_register_model(MM_ID_LIGHTS_HSL, elmt_idx, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) + { + // Inform the Model State Manager about registered model + mm_lights_hsl_env_t *p_env_hsl = (mm_lights_hsl_env_t *)mm_state_register(elmt_idx, MM_ID_LIGHTS_HSL, mdl_lid, + MM_ROLE_SRV_PUBLI, sizeof(mm_lights_hsl_env_t)); + + if (p_env_hsl) + { + // Pointer to server-specific callback functions + //mm_srv_cb_t *p_cb_srv = p_env_hsl->env.cb.u.p_cb_srv; + + // Prepare environment for Replay Manager + p_env_hsl->replay_env.delay_ms = MM_LIGHTS_HSL_REPLAY_MS; + + // Prepare timer for publications + p_env_hsl->tmr_publi.cb = mm_lights_hsl_cb_tmr_publi; + //p_env_hsl->tmr_publi.p_env = (void *)p_env_hsl; + + // Set internal callback functions + p_env_hsl->env.mdl_cb.cb_rx = mm_lights_hsl_cb_rx; + p_env_hsl->env.mdl_cb.cb_opcode_check = mm_lights_hsl_cb_opcode_check; + //p_env_hsl->env.mdl_cb.cb_publish_param = mm_lights_hsl_cb_publish_param; + //p_cb_srv->cb_set = mm_lights_hsl_cb_set; + p_env_hsl->env.mdl_cb.cb_srv_set = mm_lights_hsl_cb_set; + + // Inform application about registered model + mm_register_ind_send(MM_ID_LIGHTS_HSL, elmt_idx, mdl_lid); + } + } + + return (mdl_lid); +} + +/** + **************************************************************************************** + * @brief Register Light HSL Setup Server model + * + * @param[in] elmt_idx Index of element on which the model must be registered + * @param[out] p_mdl_lid Address at which allocated model local index must be returned + * + * @return An handling status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lights_hsl_register_hsls(uint8_t elmt_idx) +{ + // Register Light HSL Setup Server model + m_lid_t mdl_lid = ms_register_model(MM_ID_LIGHTS_HSLS, elmt_idx, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) + { + // Inform the Model State Manager about registered model + mm_lights_hsls_env_t *p_env_hsls + = (mm_lights_hsls_env_t *)mm_state_register(elmt_idx, MM_ID_LIGHTS_HSLS, mdl_lid, + MM_ROLE_SRV, sizeof(mm_lights_hsls_env_t)); + + if (p_env_hsls) + { + // Set internal callback functions + p_env_hsls->env.mdl_cb.cb_rx = mm_lights_hsl_cb_rx; + p_env_hsls->env.mdl_cb.cb_opcode_check = mm_lights_hsl_cb_opcode_check; + + // Inform application about registered model + mm_register_ind_send(MM_ID_LIGHTS_HSLS, elmt_idx, mdl_lid); + } + } + + return (mdl_lid); +} + +/** + **************************************************************************************** + * @brief Register Light HSL Hue Server model + * + * @param[in] elmt_idx Index of element on which the model must be registered + * @param[out] p_mdl_lid Address at which allocated model local index must be returned + * + * @return An handling status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lights_hsl_register_hslh(uint8_t elmt_idx) +{ + // Register Light HSL Hue Server model + m_lid_t mdl_lid = ms_register_model(MM_ID_LIGHTS_HSLH, elmt_idx, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) + { + // Inform the Model State Manager about registered model + mm_lights_hslh_env_t *p_env_hslh = (mm_lights_hslh_env_t *)mm_state_register(elmt_idx, MM_ID_LIGHTS_HSLH, mdl_lid, + MM_ROLE_SRV_PUBLI, sizeof(mm_lights_hslh_env_t)); + + if (p_env_hslh) + { + // Pointer to server-specific callback functions + //mm_srv_cb_t *p_cb_srv = p_env_hslh->env.cb.u.p_cb_srv; + + // Prepare timer for publications + p_env_hslh->tmr_publi.cb = mm_lights_hsl_cb_tmr_publi; + //p_env_hslh->tmr_publi.p_env = (void *)p_env_hslh; + + // Set internal callback functions + p_env_hslh->env.mdl_cb.cb_rx = mm_lights_hsl_cb_rx; + p_env_hslh->env.mdl_cb.cb_opcode_check = mm_lights_hsl_cb_opcode_check; + //p_env_hslh->env.mdl_cb.cb_publish_param = mm_lights_hsl_cb_publish_param; + //p_cb_srv->cb_set = mm_lights_hsl_cb_set_hue; + p_env_hslh->env.mdl_cb.cb_srv_set = mm_lights_hsl_cb_set_hue; + + // Set range value + p_env_hslh->hue_max = 0xFFFF; + + // Inform application about registered model + mm_register_ind_send(MM_ID_LIGHTS_HSLH, elmt_idx, mdl_lid); + } + } + + return (mdl_lid); +} + +/** + **************************************************************************************** + * @brief Register Light HSL Saturation Server model + * + * @param[in] elmt_idx Index of element on which the model must be registered + * @param[out] p_mdl_lid Address at which allocated model local index must be returned + * + * @return An handling status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lights_hsl_register_hslsat(uint8_t elmt_idx) +{ + // Register Light HSL Server model + m_lid_t mdl_lid = ms_register_model(MM_ID_LIGHTS_HSLSAT, elmt_idx, MM_CFG_PUBLI_AUTH_BIT); + + if ( mdl_lid != MESH_INVALID_LID) + { + // Inform the Model State Manager about registered model + mm_lights_hslsat_env_t *p_env_hslsat + = (mm_lights_hslsat_env_t *)mm_state_register(elmt_idx, MM_ID_LIGHTS_HSLSAT, mdl_lid, + MM_ROLE_SRV_PUBLI, sizeof(mm_lights_hslsat_env_t)); + + if (p_env_hslsat) + { + // Pointer to server-specific callback functions + //mm_srv_cb_t *p_cb_srv = p_env_hslsat->env.cb.u.p_cb_srv; + + // Prepare timer for publications + p_env_hslsat->tmr_publi.cb = mm_lights_hsl_cb_tmr_publi; + //p_env_hslsat->tmr_publi.p_env = (void *)p_env_hslsat; + + // Set internal callback functions + p_env_hslsat->env.mdl_cb.cb_rx = mm_lights_hsl_cb_rx; + p_env_hslsat->env.mdl_cb.cb_opcode_check = mm_lights_hsl_cb_opcode_check; + //p_env_hslsat->env.mdl_cb.cb_publish_param = mm_lights_hsl_cb_publish_param; + //p_cb_srv->cb_set = mm_lights_hsl_cb_set_sat; + p_env_hslsat->env.mdl_cb.cb_srv_set = mm_lights_hsl_cb_set_sat; + + // Set range value + p_env_hslsat->sat_max = 0xFFFF; + + // Inform application about registered model + mm_register_ind_send(MM_ID_LIGHTS_HSLSAT, elmt_idx, mdl_lid); + } + } + + return (mdl_lid); +} + +/** + **************************************************************************************** + * @brief Bind the Light HSL Server, the Light HSL Setup Server, the Light HSL Hue Server + * and the Light HSL Saturation Server models together + * + * @param[in] mdl_lid Model local index for the Light HSL Server model + * @param[in] mdl_lid_setup Model local index for the Light HSL Setup Server model + * @param[in] mdl_lid_hue Model local index for the Light HSL Hue Server model + * @param[in] mdl_lid_sat Model local index for the Light HSL Saturation Server model + **************************************************************************************** + */ +__STATIC void mm_lights_hsl_bind(m_lid_t mdl_lid, m_lid_t mdl_lid_setup, m_lid_t mdl_lid_hue, + m_lid_t mdl_lid_sat) +{ + // Pointer to environment for the Light HSL Server model + mm_lights_hsl_env_t *p_env_hsl = (mm_lights_hsl_env_t *)mm_state_get_env(mdl_lid); + // Pointer to environment for the Light HSL Setup Server model + mm_lights_hsls_env_t *p_env_hsls = (mm_lights_hsls_env_t *)mm_state_get_env(mdl_lid_setup); + // Pointer to environment for the Light HSL Hue Server model + mm_lights_hslh_env_t *p_env_hslh = (mm_lights_hslh_env_t *)mm_state_get_env(mdl_lid_hue); + // Pointer to environment for the Light HSL Saturation Server model + mm_lights_hslsat_env_t *p_env_hslsat = (mm_lights_hslsat_env_t *)mm_state_get_env(mdl_lid_sat); + + // Bind environment together + p_env_hsl->p_env_hslh = p_env_hslh; + p_env_hsl->p_env_hslsat = p_env_hslsat; + p_env_hsls->p_env_hsl = p_env_hsl; + p_env_hslh->p_env_hsl = p_env_hsl; + p_env_hslsat->p_env_hsl = p_env_hsl; +} + + +/* + * CALLBACK FUNCTIONS FOR BINDING MANAGER + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Callback function provided to the Binding Manager so that Light HSL Server + * model can be informed about group event + * + * @param[in] mdl_lid Model Local Index + * @param[in] event Event + * @param[in] info Information (depends on the event type) + **************************************************************************************** + */ +__STATIC void mm_lights_hsl_cb_grp_event(m_lid_t mdl_lid, uint8_t event, uint8_t info) +{ + // Get environment for Light HSL Server model + mm_lights_hsl_env_t *p_env_hsl = (mm_lights_hsl_env_t *)mm_state_get_env(mdl_lid); + + switch (event) + { + case (MM_GRP_EVENT_TRANS_DELAY_EXPIRED): + { + // Set the targeted Light Lightness state value + mm_bind_set_state(p_env_hsl->env.grp_lid, MM_STATE_TYPE_TARGET, MM_ID_LIGHTS_LN, + p_env_hsl->ln_tgt); + + // Start the transition + mm_bind_trans_start(p_env_hsl->env.grp_lid); + } break; + + case (MM_GRP_EVENT_TRANS_IMMEDIATE): + { + p_env_hsl->ln = p_env_hsl->ln_tgt; + } // no break; + + case (MM_GRP_EVENT_TRANS_STARTED): + { + uint8_t trans_time = info; + + // Transition has been started + SETB(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_WAIT_LN, 0); + + // Inform application about state update + mm_srv_state_upd_ind_send(MM_STATE_LIGHT_HSL_LN, p_env_hsl->env.elmt_idx, + p_env_hsl->ln_tgt, + (trans_time) ? mm_get_trans_time_ms(trans_time) : 0); + + // Check if Light HSL Status message must be sent + mm_lights_hsl_check_status(p_env_hsl, event); + } break; + + case (MM_GRP_EVENT_TRANS_END): + { + p_env_hsl->ln = p_env_hsl->ln_tgt; + + // Inform application about state update + mm_srv_state_upd_ind_send(MM_STATE_LIGHT_HSL_LN, + p_env_hsl->env.elmt_idx, p_env_hsl->ln, 0); + + // Check if Light HSL Status message must be sent + mm_lights_hsl_check_status(p_env_hsl, event); + } break; + + case (MM_GRP_EVENT_GROUP_FULL): + { + // Set the current Light Lightness state value + mm_bind_set_state(p_env_hsl->env.grp_lid, MM_STATE_TYPE_CURRENT, MM_ID_LIGHTS_LN, + p_env_hsl->ln); + } break; + + //case (MM_GRP_EVENT_TRANS_ABORTED): + default: + { + } break; + } +} + +/** + **************************************************************************************** + * @brief Callback function provided to the Binding Manager so that Light HSL Hue or + * Saturation Server model can be informed about group event + * + * @param[in] mdl_lid Model Local Index + * @param[in] event Event + * @param[in] info Information (depends on the event type) + **************************************************************************************** + */ +__STATIC void mm_lights_hsl_cb_grp_event_hue_sat(m_lid_t mdl_lid, uint8_t event, uint8_t info) +{ + // Pointer to environment for the main model + mm_mdl_env_t *p_env = (mm_mdl_env_t *)mm_state_get_env(mdl_lid); + // Pointer to the environment allocated for the Light HSL Server model + mm_lights_hsl_env_t *p_env_hsl; + // Pointer to the needed value in the main model environment + uint16_t *p_tgt_state, *p_state; + // State identifier + uint32_t state_id; + + if (p_env->model_id == MM_ID_LIGHTS_HSLH) + { + // Pointer to environment for the Light HSL Hue Server model + mm_lights_hslh_env_t *p_env_hslh = (mm_lights_hslh_env_t *)p_env; + + p_tgt_state = &p_env_hslh->hue_tgt; + p_state = &p_env_hslh->hue; + p_env_hsl = p_env_hslh->p_env_hsl; + state_id = MM_STATE_LIGHT_HSL_HUE; + } + else // (p_env->model_id == MM_ID_LIGHTS_HSLSAT) + { + // Pointer to environment for the Light HSL Saturation Server model + mm_lights_hslsat_env_t *p_env_hslsat = (mm_lights_hslsat_env_t *)p_env; + + p_tgt_state = &p_env_hslsat->sat_tgt; + p_state = &p_env_hslsat->sat; + p_env_hsl = p_env_hslsat->p_env_hsl; + state_id = MM_STATE_LIGHT_HSL_SAT; + } + + switch (event) + { + case (MM_GRP_EVENT_TRANS_DELAY_EXPIRED): + { + // Generic Level = Light HSL Hue/Saturation - 32768 + int16_t lvl = ((int32_t)*p_tgt_state) - 32768; + + // Set the targeted Generic Level state value + mm_bind_set_state(p_env->grp_lid, MM_STATE_TYPE_TARGET, MM_ID_GENS_LVL, lvl); + + // Start the transition + mm_bind_trans_start(p_env->grp_lid); + } break; + + case (MM_GRP_EVENT_TRANS_IMMEDIATE): + { + *p_state = *p_tgt_state; + } // no break; + + case (MM_GRP_EVENT_TRANS_STARTED): + { + uint8_t trans_time = info; + + // Transition has been started + if (p_env->model_id == MM_ID_LIGHTS_HSLH) + { + SETB(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_WAIT_HUE, 0); + } + else + { + SETB(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_WAIT_SAT, 0); + } + + // Inform application about state update + mm_srv_state_upd_ind_send(state_id, p_env->elmt_idx, *p_tgt_state, + (trans_time) ? mm_get_trans_time_ms(trans_time) : 0); + + // Check if a status message must be sent + mm_lights_hsl_check_status_rsp_hue_sat(p_env); + + // Send a publication + mm_lights_hsl_publish_hue_sat(p_env); + + // Check if Light HSL Status message must be sent + mm_lights_hsl_check_status(p_env_hsl, event); + } break; + + case (MM_GRP_EVENT_TRANS_END): + { + *p_state = *p_tgt_state; + + // Inform application about state update + mm_srv_state_upd_ind_send(state_id, p_env->elmt_idx, *p_state, 0); + + // Check if a status message must be sent + mm_lights_hsl_check_status_rsp_hue_sat(p_env); + + // Send a publication + mm_lights_hsl_publish_hue_sat(p_env); + + // Check if Light HSL Status message must be sent + mm_lights_hsl_check_status(p_env_hsl, event); + } break; + + case (MM_GRP_EVENT_GROUP_FULL): + { + // Generic Level = Light HSL Hue/Saturation - 32768 + int16_t lvl = ((int32_t)*p_state) - 32768; + + // Set the current Generic Level state value + mm_bind_set_state(p_env->grp_lid, MM_STATE_TYPE_CURRENT, MM_ID_GENS_LVL, lvl); + } break; + + //case (MM_GRP_EVENT_TRANS_ABORTED): + default: + { + } break; + } +} + +/** + **************************************************************************************** + * @brief Callback function provided to the Binding Manager so that Light HSL Hue or Light + * HSL Saturation state value can be set by main model of the group + * + * @param[in] main_mdl_lid Model Local Index + * @param[in] req_model_id Model ID of model that has requested the transition + * @param[in] trans_type Transition type + * @param[in] state_delta State value or delta value + **************************************************************************************** + */ +__STATIC void mm_lights_hsl_cb_trans_req(m_lid_t main_mdl_lid, uint32_t req_model_id, uint8_t trans_type, + uint32_t state_delta) +{ + // Get environment for Light HSL Server model + mm_lights_hsl_env_t *p_env_hsl = (mm_lights_hsl_env_t *)mm_state_get_env(main_mdl_lid); + // Targeted Light HSL Lightness state value + uint16_t ln_tgt; + + if (req_model_id == MM_ID_LIGHTS_LN) + { + // Light HSL Lightness = Light Lightness Actual + ln_tgt = (uint16_t)state_delta; + } + else + { + if (req_model_id == MM_ID_GENS_OO) + { + // Requested Generic OnOff state value + uint8_t onoff = (uint8_t)state_delta; + + // Deduce Target Light HSL Lightness state value + ln_tgt = (onoff == 0) ? 0 : mm_lights_ln_get(p_env_hsl->env.elmt_idx, + MM_STATE_LIGHT_LN_DFLT); + } + else // (req_model_id == MM_ID_GENS_LVL) + { + if (trans_type == MM_TRANS_TYPE_CLASSIC) + { + // Requested Generic Level state value + int16_t level = (int16_t)state_delta; + + // Light HSL Lightness = Generic Level + 32768 + ln_tgt = 32768 + level; + } + else // ((trans_type == MM_TRANS_TYPE_DELTA) || trans_type == MM_TRANS_TYPE_MOVE)) + { + // Delta value + int32_t delta; + + if (trans_type == MM_TRANS_TYPE_MOVE) + { + delta = (int16_t)state_delta; + + // Keep the provided delta value + p_env_hsl->move_delta = (int16_t)state_delta; + } + else + { + delta = (int32_t)state_delta; + } + + // Add the Light HSL Lightness state value to the received delta value + delta += p_env_hsl->ln; + + // The Light HSL Actual state value cannot wrap + if (delta < 0) + { + ln_tgt = 0; + } + else + { + ln_tgt = (delta > 0xFFFF) ? 0xFFFF : (uint16_t)delta; + } + } + } + + if (ln_tgt != 0) + { + // Get range value + uint16_t ln_min = mm_lights_ln_get(p_env_hsl->env.elmt_idx, MM_STATE_LIGHT_LN_RANGE_MIN); + uint16_t ln_max = mm_lights_ln_get(p_env_hsl->env.elmt_idx, MM_STATE_LIGHT_LN_RANGE_MAX); + + // Ensure that Light HSL Lightness state value is between Light HSL Lightness Range + // Min and Max values + if (ln_tgt > ln_max) + { + ln_tgt = ln_max; + } + else if (ln_tgt < ln_min) + { + ln_tgt = ln_min; + } + } + } + + // Check if Light HSL Actual state value is modified + if (ln_tgt != p_env_hsl->ln) + { + SETB(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_TRANS_LN, 1); + SETB(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_TRANS_HUE, 0); + SETB(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_TRANS_SAT, 0); + SETF(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_TRANS, + GETF(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_WAIT)); + + p_env_hsl->ln_tgt = ln_tgt; + + // Start a new transition + mm_bind_trans_new(p_env_hsl->env.grp_lid, trans_type, 0, 0); + } + else + { + // Reject the transition + mm_bind_trans_reject(p_env_hsl->env.grp_lid); + } +} + +/** + **************************************************************************************** + * @brief Callback function provided to the Binding Manager so that Light HSL Hue or Light + * HSL Saturation state value can be set by main model of the group + * + * @param[in] main_mdl_lid Model Local Index + * @param[in] req_model_id Model ID of model that has requested the transition + * @param[in] trans_type Transition type + * @param[in] state_delta State value or delta value + **************************************************************************************** + */ +void mm_lights_hsl_cb_trans_req_hue_sat(m_lid_t main_mdl_lid, uint32_t req_model_id, uint8_t trans_type, + uint32_t state_delta) +{ + // Pointer to environment for the main model + mm_mdl_env_t *p_env = (mm_mdl_env_t *)mm_state_get_env(main_mdl_lid); + // Pointer to the needed value in the main model environment + uint16_t *p_range_min, *p_range_max, *p_tgt_state, *p_state; + int16_t *p_move_delta; + // Target Light HSL Hue or Light HSL Saturation state value + uint16_t tgt_state; + + if (p_env->model_id == MM_ID_LIGHTS_HSLH) + { + // Pointer to environment for the Light HSL Hue Server model + mm_lights_hslh_env_t *p_env_hslh = (mm_lights_hslh_env_t *)p_env; + + p_range_min = &p_env_hslh->hue_min; + p_range_max = &p_env_hslh->hue_max; + p_tgt_state = &p_env_hslh->hue_tgt; + p_state = &p_env_hslh->hue; + p_move_delta = &p_env_hslh->move_delta; + } + else // (p_env->model_id == MM_ID_LIGHTS_HSLSAT) + { + // Pointer to environment for the Light HSL Saturation Server model + mm_lights_hslsat_env_t *p_env_hslsat = (mm_lights_hslsat_env_t *)p_env; + + p_range_min = &p_env_hslsat->sat_min; + p_range_max = &p_env_hslsat->sat_max; + p_tgt_state = &p_env_hslsat->sat_tgt; + p_state = &p_env_hslsat->sat; + p_move_delta = &p_env_hslsat->move_delta; + } + + if (trans_type == MM_TRANS_TYPE_CLASSIC) + { + // Light HSL Hue/Saturation = Generic Level + 32768 + tgt_state = 32768 + (int16_t)state_delta; + } + else // ((trans_type == MM_TRANS_TYPE_DELTA) || trans_type == MM_TRANS_TYPE_MOVE)) + { + // Delta value + int32_t delta; + + if (trans_type == MM_TRANS_TYPE_MOVE) + { + delta = (int16_t)state_delta; + + // Keep the provided delta value + *p_move_delta = (int16_t)state_delta; + } + else + { + delta = (int32_t)state_delta; + } + + // Add the current state value to the received delta value + delta += *p_state;; + + // The state value cannot wrap + if (delta < 0) + { + tgt_state = 0; + } + else + { + tgt_state = (delta > 0xFFFF) ? 0xFFFF : (uint16_t)delta; + } + } + + // Check that new targeted Light HSL Hue/Saturation state value is well within the set Light HSL + // Hue/Saturation state min and max values + if (tgt_state > *p_range_max) + { + tgt_state = *p_range_max; + } + else if (tgt_state < *p_range_min) + { + tgt_state = *p_range_min; + } + + // Check if state value is modified + if (tgt_state != *p_tgt_state) + { + // Pointer to environment for the Light HSL Server model + mm_lights_hsl_env_t *p_env_hsl = (mm_lights_hsl_env_t *)p_env; + + SETB(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_TRANS_LN, 0); + SETB(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_TRANS_HUE, p_env->model_id == MM_ID_LIGHTS_HSLH); + SETB(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_TRANS_SAT, p_env->model_id == MM_ID_LIGHTS_HSLSAT); + SETF(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_TRANS, + GETF(p_env_hsl->status_info, MM_LIGHTS_HSL_SINFO_WAIT)); + + *p_tgt_state = tgt_state; + + // Start a new transition + mm_bind_trans_new(p_env->grp_lid, trans_type, 0, 0); + } + else + { + // Reject the transition + mm_bind_trans_reject(p_env->grp_lid); + } +} + +/* + * GLOBAL FUNCTIONS + **************************************************************************************** + */ + +uint8_t mm_lights_hsl_register(uint8_t elmt_idx, bool main) +{ + m_lid_t mdl_lid = MESH_INVALID_LID; + + do + { + // Model local index for Light CTL Server model, for Light CTL Hue Server model + // for Light CTL Saturation Server model and for Light Lightness Server model + m_lid_t ln_lid, lvl1_lid, lvl2_lid; + m_lid_t hsl_lid, hsls_lid, hslh_lid, hslsat_lid; + + + // Register Light Lightness Server model and associated models + ln_lid = mm_lights_ln_register(elmt_idx, false); + if (ln_lid == MESH_INVALID_LID) + { + break; + } + + // Register Generic Level Server model + lvl1_lid = mm_gens_lvl_register(elmt_idx + 1, false); + if (lvl1_lid == MESH_INVALID_LID) + { + break; + } + + // Register Generic Level Server model + lvl2_lid = mm_gens_lvl_register(elmt_idx + 2, false); + if (lvl2_lid == MESH_INVALID_LID) + { + break; + } + + // Register the Light HSL Server model and associated models + // 1. Register Light HSL Server model + hsl_lid = mm_lights_hsl_register_hsl(elmt_idx); + if (hsl_lid == MESH_INVALID_LID) + { + break; + } + + // 2. Register Light HSL Setup Server model + hsls_lid = mm_lights_hsl_register_hsls(elmt_idx); + if (hsls_lid == MESH_INVALID_LID) + { + break; + } + + // 3. Register Light HSL Hue Server model + hslh_lid = mm_lights_hsl_register_hslh(elmt_idx + 1); + if (hslh_lid == MESH_INVALID_LID) + { + break; + } + + // 4. Register Light HSL Saturation Server model + hslsat_lid = mm_lights_hsl_register_hslsat(elmt_idx + 2); + if (hslsat_lid == MESH_INVALID_LID) + { + break; + } + + // 5. Bound models together + mm_lights_hsl_bind(hsl_lid, hsls_lid, hslh_lid, hslsat_lid); + mdl_lid = hsl_lid; + + if (main) + { + // Create group and set Light HSL Server model as main model + m_lid_t grp_lid = grp_lid = mm_bind_add_group(3, elmt_idx, hsl_lid, + mm_lights_hsl_cb_grp_event, mm_lights_hsl_cb_trans_req); + + // Add Generic Level Server model to the group + mm_gens_lvl_bind_group(grp_lid, mm_state_get_lid(elmt_idx, MM_ID_GENS_LVL)); + // Add Generic OnOff Server model to the group + mm_gens_oo_bind_group(grp_lid, mm_state_get_lid(elmt_idx, MM_ID_GENS_OO)); + // Add Light Lightness Server model to the group + mm_lights_ln_bind_group(grp_lid, ln_lid); + + // Create group and set Light HSL Hue Server model as main model + grp_lid = mm_bind_add_group(1, elmt_idx + 1, hslh_lid, + mm_lights_hsl_cb_grp_event_hue_sat, + mm_lights_hsl_cb_trans_req_hue_sat); + + // Add Generic Level Server model to the group + mm_gens_lvl_bind_group(grp_lid, lvl1_lid); + + // Create group and set Light HSL Saturation Server model as main model + grp_lid = mm_bind_add_group(1, elmt_idx + 2, hslsat_lid, + mm_lights_hsl_cb_grp_event_hue_sat, + mm_lights_hsl_cb_trans_req_hue_sat); + + // Add Generic Level Server model to the group + mm_gens_lvl_bind_group(grp_lid, lvl2_lid); + } + } while (0); + + return (mdl_lid); +} + +/// @} end of group diff --git a/mesh/model/light/lights/mm_lights_ln.c b/mesh/model/light/lights/mm_lights_ln.c new file mode 100644 index 0000000..2ee7524 --- /dev/null +++ b/mesh/model/light/lights/mm_lights_ln.c @@ -0,0 +1,1270 @@ +/** + **************************************************************************************** + * @file mm_lights_ln.c + * + * @brief Mesh Model Light Lightness Server Module + * + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @addtogroup MM_LIGHTS_LN + * @{ + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "mm_itf.h" +#include "mm_gens.h" +#include "mm_lights.h" + +/* + * DEFINES + **************************************************************************************** + */ + +/// Validity of information provided to the Replay Manager +#define MM_LIGHTS_LN_REPLAY_MS (6000) + +/* + * MACROS + **************************************************************************************** + */ + +/// Convert Light Lightness Linear value into Light Lightness Actual value +/// LA = 65535 * sqrt(LL / 65535) +/// = sqrt(65535 * 65535) * sqrt(LL / 65535) +/// = sqrt(65535 * LL) +/// = sqrt(65536 * LL - LL) +/// = sqrt(2^16 * LL - LL) +#define MM_LIGHTS_LN_ACTUAL(linear) \ + (mm_lights_isqrt(((uint32_t)linear << 16) - linear)) + +/// Convert Light Lightness Actual value into Light Lightness Linear value +/// LL = Ceil(65535 * (LA / 65535)^2) +/// = Ceil(LA^2 / 65535) +/// = Floor((LA^2 + 65534) + 65535) +#define MM_LIGHTS_LN_LINEAR(actual) \ + ((((uint32_t)actual * actual) + 65534) / 65535) + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Structure for Lighting Lightness Server model environment +typedef struct mm_lights_ln_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; + /// Timer for sending of publications + mesh_timer_t tmr_publi; + /// Publication period in milliseconds + uint32_t publi_period_ms; + + /// Environment for replay protection mechanism + mm_replay_env_t replay_env; + + /// Delta value in case of move transition + int16_t move_delta; + /// Light Lightness Actual state value + uint16_t ln; + /// Light Lightness Linear + uint16_t ln_linear; + /// Target value of Light Lightness Actual state value + uint16_t ln_tgt; + /// Target value of Light Lightness Linear state value + uint16_t ln_tgt_linear; + /// Light Lightness Last state value + uint16_t ln_last; + /// Light Lightness Default state value + uint16_t ln_dflt; + /// Light Lightness Range Min state value + uint16_t ln_min; + /// Light Lightness Range Max state value + uint16_t ln_max; + + /// Source address of set message that has triggered last or current transition + uint8_t status_dst_addr; + /// Application key local index to be used for transmission of Light Lightness Status + /// or Light Lightness Linear Status message + m_lid_t status_app_key_lid; + /// Relaying of sent Light Lightness Status or Light Lightness Linear Status message + /// authorized + bool status_relay; + /// Send a Light Lightness Status or Light Lightness Linear Status message + bool status_linear; +} mm_lights_ln_env_t; + +/// Structure for Light Lightness Setup Server model environment +typedef struct mm_lights_lns_env +{ + /// Basic model environment - Must be first element in the structure - DO NOT MOVE + mm_mdl_env_t env; + /// Pointer to environment of associated Light Lightness Server model + mm_lights_ln_env_t *p_env_ln; +} mm_lights_lns_env_t; + +/* + * LOCAL FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Compure integer square root + * + * @param[in] n Value + * + * @return Integer square root of n + **************************************************************************************** + */ +__STATIC uint32_t mm_lights_isqrt(uint32_t n) +{ + uint64_t isqrt; + uint64_t min = 0; + uint64_t max = ((uint64_t)1) << 32; + + while (1) + { + uint64_t sq; + + if (max <= (1 + min)) + { + isqrt = min; + break; + } + + isqrt = min + ((max - min) >> 1); + sq = isqrt * isqrt; + + if (sq == n) + { + break; + } + + if (sq > n) + { + max = isqrt; + } + else + { + min = isqrt; + } + } + + return (isqrt); +} + +/** + **************************************************************************************** + * @brief Prepare and send a Light Lightness Status or a Light Lightness Linear Status message. + * Note that both messages have the same content. + * + * @param[in] p_env_ln Pointer to Light Lightness Server model environment + * @param[in] p_route_env Pointer to structure containing reception information provided + * by Mesh Profile for received request message + * @param[in] publish Indicate if message is sent as a publication (true) or as + * a response to a received request (false) + * @param[in] linear True if Light Lightness Status must be sent, else False + **************************************************************************************** + */ +__STATIC void mm_lights_ln_send_status(mm_lights_ln_env_t *p_env_ln, + mm_route_env_t *p_route_env, bool publish, bool linear) +{ + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_status; + // Remaining time + uint8_t rem_time; + // Transition type + uint8_t trans_type; + // Data length + uint8_t data_length; + + // Check if a transition has been started + mm_bind_get_trans_info(p_env_ln->env.grp_lid, &trans_type, &rem_time); + + // Deduce deduce data length + data_length = (trans_type != MM_TRANS_TYPE_NONE) + ? MM_LIGHT_LN_STATUS_LEN : MM_LIGHT_LN_STATUS_MIN_LEN; + + p_buf_status = mm_route_buf_alloc(data_length); + if (p_buf_status) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_status); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_status->env; + + // Prepare environment + if (p_route_env) + { + memcpy(p_buf_env, p_route_env, sizeof(mm_route_env_t)); + } + else if (!publish) + { + p_buf_env->app_key_lid = p_env_ln->status_app_key_lid; + p_buf_env->u_addr.dst = p_env_ln->status_dst_addr; + SETB(p_buf_env->info, MM_ROUTE_INFO_RELAY, p_env_ln->status_relay); + } + + SETB(p_buf_env->info, MM_ROUTE_INFO_RX, 0); + SETB(p_buf_env->info, MM_ROUTE_INFO_PUBLISH, publish); + p_buf_env->mdl_lid = p_env_ln->env.mdl_lid; + p_buf_env->opcode = (linear) ? MM_MSG_LIGHT_LN_LINEAR_STATUS : MM_MSG_LIGHT_LN_STATUS; + + // Fill the message + write16p(p_data + MM_LIGHT_LN_STATUS_LIGHTNESS_POS, + (linear) ? p_env_ln->ln_linear : p_env_ln->ln); + + if (data_length == MM_LIGHT_LN_STATUS_LEN) + { + // Target state value + uint16_t tgt; + + if (trans_type == MM_TRANS_TYPE_MOVE) + { + tgt = (p_env_ln->move_delta > 0) ? p_env_ln->ln_max + : p_env_ln->ln_min; + + if (linear) + { + tgt = MM_LIGHTS_LN_LINEAR(tgt); + } + + rem_time = MM_TRANS_TIME_UNKNOWN; + } + else + { + tgt = (linear) ? p_env_ln->ln_tgt_linear : p_env_ln->ln_tgt; + } + + write16p(p_data + MM_LIGHT_LN_STATUS_TGT_LIGHTNESS_POS, tgt); + *(p_data + MM_LIGHT_LN_STATUS_REM_TIME_POS) = rem_time; + } + + // Send the message + mm_route_send(p_buf_status); + } +} + +/** + **************************************************************************************** + * @brief Prepare and send a Light Lightness Last Status message + * + * @param[in] p_env_ln Pointer to Light Lightness Server model environment + * @param[in] p_route_env Pointer to structure containing reception information provided + * by Mesh Profile for received request message + **************************************************************************************** + */ +__STATIC void mm_lights_ln_send_status_last(mm_lights_ln_env_t *p_env_ln, + mm_route_env_t *p_route_env) +{ + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_status = mm_route_buf_alloc_status(MM_LIGHT_LN_LAST_STATUS_LEN, p_route_env); + + if (p_buf_status) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_status); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_status->env; + + // Complete environment + p_buf_env->mdl_lid = p_env_ln->env.mdl_lid; + p_buf_env->opcode = MM_MSG_LIGHT_LN_LAST_STATUS; + + // Fill the message + write16p(p_data + MM_LIGHT_LN_LAST_STATUS_LIGHTNESS_POS, p_env_ln->ln_last); + + // Send the message + mm_route_send(p_buf_status); + } +} + +/** + **************************************************************************************** + * @brief Prepare and send a Light Lightness Default Status message + * + * @param[in] p_env_ln Pointer to Light Lightness Server model environment + * @param[in] p_route_env Pointer to structure containing reception information provided + * by Mesh Profile for received request message + **************************************************************************************** + */ +__STATIC void mm_lights_ln_send_status_dflt(mm_lights_ln_env_t *p_env_ln, + mm_route_env_t *p_route_env) +{ + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_status = mm_route_buf_alloc_status(MM_LIGHT_LN_DFLT_STATUS_LEN, p_route_env); + + if (p_buf_status) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_status); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_status->env; + + // Complete environment + p_buf_env->mdl_lid = p_env_ln->env.mdl_lid; + p_buf_env->opcode = MM_MSG_LIGHT_LN_DFLT_STATUS; + + // Fill the message + write16p(p_data + MM_LIGHT_LN_DFLT_STATUS_LIGHTNESS_POS, p_env_ln->ln_dflt); + + // Send the message + mm_route_send(p_buf_status); + } +} + +/** + **************************************************************************************** + * @brief Prepare and send a Light Lightness Range Status message + * + * @param[in] p_env_ln Pointer to Light Lightness Level Server model environment + * @param[in] p_route_env Pointer to structure containing reception information provided + * by Mesh Profile for received request message + * @param[in] status Status sent in the Light Lightness Range Status message + * (@see enum mm_status) + **************************************************************************************** + */ +__STATIC void mm_lights_ln_send_status_range(mm_lights_ln_env_t *p_env_ln, + mm_route_env_t *p_route_env, + uint8_t status) +{ + // Pointer to the buffer that will contain the message + mesh_buf_t *p_buf_status = mm_route_buf_alloc_status(MM_LIGHT_LN_RANGE_STATUS_LEN, p_route_env); + + if (p_buf_status) + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf_status); + // Get pointer to environment + mm_route_env_t *p_buf_env = (mm_route_env_t *)&p_buf_status->env; + + // Prepare environment + p_buf_env->mdl_lid = p_env_ln->env.mdl_lid; + p_buf_env->opcode = MM_MSG_LIGHT_LN_RANGE_STATUS; + + // Fill the message + *(p_data + MM_LIGHT_LN_RANGE_STATUS_CODE_POS) = status; + write16p(p_data + MM_LIGHT_LN_RANGE_STATUS_MIN_POS, p_env_ln->ln_min); + write16p(p_data + MM_LIGHT_LN_RANGE_STATUS_MAX_POS, p_env_ln->ln_max); + + // Send the message + mm_route_send(p_buf_status); + } +} + +/** + **************************************************************************************** + * @brief Publish Light Lightness Actual state value if sending of publications is enabled + * + * @param[in] p_env_ln Pointer to Light Lightness Server model environment + **************************************************************************************** + */ +__STATIC void mm_lights_ln_publish(mm_lights_ln_env_t *p_env_ln) +{ + // Check if sending of publication is enabled + if (GETB(p_env_ln->env.info, MM_INFO_PUBLI)) + { + mm_lights_ln_send_status(p_env_ln, NULL, true, false); + } +} + +/** + **************************************************************************************** + * @brief Check if a Light Lightnes Status message must be sent and send it if it + * is the case + * + * @param[in] p_env_ln Pointer to Light Lightness Server model environment + **************************************************************************************** + */ +__STATIC void mm_lights_ln_check_status_rsp(mm_lights_ln_env_t *p_env_ln) +{ + if (p_env_ln->status_dst_addr != MESH_UNASSIGNED_ADDR) + { + // Send a response to the node that has required the transition + mm_lights_ln_send_status(p_env_ln, NULL, false, p_env_ln->status_linear); + + p_env_ln->status_dst_addr = MESH_UNASSIGNED_ADDR; + } +} + +/* + * MESSAGE HANDLERS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Handler for Light Lightness Set/Set Unacknowledged and Light Lightness Linear + * Set/Set Unacknowledged message. + * Note that all messages have the same content. + * + * @param[in] p_env Pointer to environment of model for which message has been received + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing information for the received buffer + **************************************************************************************** + */ +__STATIC void mm_lights_ln_handler_set(mm_lights_ln_env_t *p_env_ln, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + do + { + // Set Light Lightness Actual or Light Lightness Linear staet value + bool linear = ((p_route_env->opcode == MM_MSG_LIGHT_LN_LINEAR_SET) + || (p_route_env->opcode == MM_MSG_LIGHT_LN_LINEAR_SET_UNACK)); + // Check if a status message must be sent + bool send_status = ((p_route_env->opcode == MM_MSG_LIGHT_LN_LINEAR_SET) + || (p_route_env->opcode == MM_MSG_LIGHT_LN_SET)); + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Lightness Actual and Lightness Linear values + uint16_t ln, ln_linear; + // Extract TID value + uint8_t tid = *(p_data + MM_LIGHT_LN_SET_TID_POS); + // Transition time + uint8_t trans_time = MM_TRANS_TIME_UNKNOWN; + // Delay + uint8_t delay = 0; + + // Extract and check optional parameters if present + if (p_buf->data_len == MM_LIGHT_LN_SET_LEN) + { + trans_time = (uint16_t)(*(p_data + MM_LIGHT_LN_SET_TRANS_TIME_POS)); + + // Check received value + if (GETF(trans_time, MM_TRANS_TIME_STEP_NB) > MM_TRANS_TIME_STEPS_MAX) + { + // Drop the message + break; + } + + delay = *(p_data + MM_LIGHT_LN_SET_DELAY_POS); + } + + if (linear) + { + ln_linear = read16p(p_data + MM_LIGHT_LN_SET_LIGHTNESS_POS); + ln = MM_LIGHTS_LN_ACTUAL(ln_linear); + } + else + { + ln = read16p(p_data + MM_LIGHT_LN_SET_LIGHTNESS_POS); + } + + if (ln != 0) + { + // Ensure that Light Lightness Actual state value is between Light Lightness Range + // Min and Max values + if (ln > p_env_ln->ln_max) + { + ln = p_env_ln->ln_max; + } + else if (ln < p_env_ln->ln_min) + { + ln = p_env_ln->ln_min; + } + } + + // Check if Light Lightness Actual state is modified + if ((p_env_ln->status_dst_addr != MESH_UNASSIGNED_ADDR) + || mm_replay_is_retx(&p_env_ln->replay_env, p_route_env->u_addr.src, tid) + || (ln == p_env_ln->ln)) + { + // Send a Light Lightness Status or a Light Lightness Linear Status message + if (send_status) + { + mm_lights_ln_send_status(p_env_ln, p_route_env, false, linear); + } + break; + }; + + if (send_status) + { + // Keep information for transmission of status + p_env_ln->status_dst_addr = p_route_env->u_addr.src; + p_env_ln->status_app_key_lid = p_route_env->app_key_lid; + p_env_ln->status_relay = GETB(p_route_env->info, MM_ROUTE_INFO_RELAY); + p_env_ln->status_linear = linear; + } + + if (GETB(p_env_ln->env.info, MM_INFO_MAIN)) + { + // Update target state + p_env_ln->ln_tgt = ln; + p_env_ln->ln_tgt_linear = MM_LIGHTS_LN_LINEAR(ln); + + // Inform the Binding Manager about new transition + mm_bind_trans_new(p_env_ln->env.grp_lid, MM_TRANS_TYPE_CLASSIC, trans_time, delay); + } + else + { + // Inform the Binding Manager + mm_bind_trans_req(p_env_ln->env.grp_lid, p_env_ln->env.mdl_lid, + MM_TRANS_TYPE_CLASSIC, ln, trans_time, delay); + } + } while (0); +} + +/** + **************************************************************************************** + * @brief Handler for Light Lightness Default Set/Set Unacknowledged message + * + * @param[in] p_env Pointer to environment of model for which message has been received + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing information for the received buffer + **************************************************************************************** + */ +__STATIC void mm_lights_ln_handler_set_dflt(mm_lights_ln_env_t *p_env_ln, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Extract received state value + uint16_t ln_dflt = read16p(p_data + MM_LIGHT_LN_DFLT_SET_LIGHTNESS_POS); + + if (ln_dflt != p_env_ln->ln_dflt) + { + // Keep received value + p_env_ln->ln_dflt = ln_dflt; + + // Inform application about received value + mm_srv_state_upd_ind_send(MM_STATE_LIGHT_LN_DFLT, p_env_ln->env.elmt_idx, + p_env_ln->ln_dflt, 0); + } + + // If needed, send a Light Lightness Default Status message to the requester + if (p_route_env->opcode == MM_MSG_LIGHT_LN_DFLT_SET) + { + mm_lights_ln_send_status_dflt(p_env_ln, p_route_env); + } +} + +/** + **************************************************************************************** + * @brief Handler for Light Lightness Range Set/Set Unacknowledged message + * + * @param[in] p_env Pointer to environment of model for which message has been received + * @param[in] p_buf Pointer to buffer containing the received message + * @param[in] p_route_env Pointer to routing information for the received buffer + **************************************************************************************** + */ +__STATIC void mm_lights_ln_handler_set_range(mm_lights_ln_env_t *p_env_ln, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + do + { + // Get pointer to data + uint8_t *p_data = MESH_BUF_DATA(p_buf); + // Status + uint8_t status = MM_STATUS_SUCCESS; + // Extract Light Lightness Range state value + uint16_t ln_min = read16p(p_data + MM_LIGHT_LN_RANGE_SET_MIN_POS); + // Extract Light Lightness Range state value + uint16_t ln_max = read16p(p_data + MM_LIGHT_LN_RANGE_SET_MAX_POS); + + // Check provided values + if (ln_min == 0) + { + status = MM_STATUS_ERROR_RANGE_MIN; + } + else if (ln_max == 0) + { + status = MM_STATUS_ERROR_RANGE_MAX; + } + else if (ln_min > ln_max) + { + // Drop the message + break; + } + + if ((status == MM_STATUS_SUCCESS) + && ((p_env_ln->ln_min != ln_min) + || (p_env_ln->ln_max != ln_max))) + { + p_env_ln->ln_min = ln_min; + p_env_ln->ln_max = ln_max; + + // Inform application about received value + mm_srv_state_upd_ind_send(MM_STATE_LIGHT_LN_RANGE, p_env_ln->env.elmt_idx, + (uint32_t)ln_min | ((uint32_t)ln_max << 16), 0); + } + + // If needed, send a Light Lightness Range Status message to the requester + if (p_route_env->opcode == MM_MSG_LIGHT_LN_RANGE_SET) + { + mm_lights_ln_send_status_range(p_env_ln, p_route_env, status); + } + } while (0); +} + +/* + * INTERNAL CALLBACK FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Callback function called when timer monitoring publication duration for + * Light Lightness Server model expires + * + * @param[in] p_env Pointer to model environment for Light Lightness Server model + **************************************************************************************** + */ +__STATIC void mm_lights_ln_cb_tmr_publi(void *p_tmr) +{ + // Get allocated environment + mm_lights_ln_env_t *p_env_ln = MESH_TMR2ENV(p_tmr, mm_lights_ln_env_t, tmr_publi); + + if (p_env_ln->publi_period_ms) + { + // Publish a Light Lightness Status message + mm_lights_ln_publish(p_env_ln); + + // Restart the timer + mesh_timer_set(&p_env_ln->tmr_publi, p_env_ln->publi_period_ms); + } +} + +/** + **************************************************************************************** + * @brief Inform Light Lightness Server model about a received message + * + * @param[in] p_env Pointer to the environment allocated for the Light Lightness + * Server model + * @param[in] p_buf Pointer to the buffer containing the received message + * @param[in] p_route_env Pointer to structure containing reception parameters provided + * by the Mesh Profile block + **************************************************************************************** + */ +__STATIC void mm_lights_ln_cb_rx(mm_mdl_env_t *p_env, mesh_buf_t *p_buf, + mm_route_env_t *p_route_env) +{ + do + { + // Environment for Light Lightness Server model + mm_lights_ln_env_t *p_env_ln; + + if (p_env->model_id == MM_ID_LIGHTS_LN) + { + p_env_ln = (mm_lights_ln_env_t *)p_env; + + switch (p_route_env->opcode) + { + case (MM_MSG_LIGHT_LN_GET): + case (MM_MSG_LIGHT_LN_LINEAR_GET): + { + // Send a Light Lightness Status or a Light Lightness Linear Status message + mm_lights_ln_send_status(p_env_ln, p_route_env, false, + (p_route_env->opcode == MM_MSG_LIGHT_LN_LINEAR_GET)); + } break; + + case (MM_MSG_LIGHT_LN_SET): + case (MM_MSG_LIGHT_LN_SET_UNACK): + case (MM_MSG_LIGHT_LN_LINEAR_SET): + case (MM_MSG_LIGHT_LN_LINEAR_SET_UNACK): + { + // Handle the message + mm_lights_ln_handler_set(p_env_ln, p_buf, p_route_env); + } break; + + case (MM_MSG_LIGHT_LN_LAST_GET): + { + // Send a Light Lightness Last Status message + mm_lights_ln_send_status_last(p_env_ln, p_route_env); + } break; + + case (MM_MSG_LIGHT_LN_DFLT_GET): + { + // Send a Light Lightness Default Status message + mm_lights_ln_send_status_dflt(p_env_ln, p_route_env); + } break; + + case (MM_MSG_LIGHT_LN_RANGE_GET): + { + // Send a Light Lightness Range Status message + mm_lights_ln_send_status_range(p_env_ln, p_route_env, MM_STATUS_SUCCESS); + } break; + + default: + { + } break; + } + } + else // (p_env->model_id == MM_ID_LIGHTS_LNS) + { + // Environment for Light Lightness Setup Server model + mm_lights_lns_env_t *p_env_lns = (mm_lights_lns_env_t *)p_env; + p_env_ln = p_env_lns->p_env_ln; + + switch (p_route_env->opcode) + { + case (MM_MSG_LIGHT_LN_DFLT_SET): + case (MM_MSG_LIGHT_LN_DFLT_SET_UNACK): + { + // Handle the message + mm_lights_ln_handler_set_dflt(p_env_ln, p_buf, p_route_env); + } break; + + case (MM_MSG_LIGHT_LN_RANGE_SET): + case (MM_MSG_LIGHT_LN_RANGE_SET_UNACK): + { + // Handle the message + mm_lights_ln_handler_set_range(p_env_ln, p_buf, p_route_env); + } break; + + default: + { + } break; + } + } + } while (0); +} + +/** + **************************************************************************************** + * @brief Check if a given opcode is handled by the Light Lightness Server model + * + * @param[in] p_env Pointer to the environment allocated for the Light Lightness + * Server model + * @param[in] opcode Opcode to check + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lights_ln_cb_opcode_check(mm_mdl_env_t *p_env, uint32_t opcode) +{ + uint8_t status = MESH_ERR_MDL_INVALID_OPCODE; + + if (p_env->model_id == MM_ID_LIGHTS_LN) + { + if ((opcode == MM_MSG_LIGHT_LN_GET) + || (opcode == MM_MSG_LIGHT_LN_SET) + || (opcode == MM_MSG_LIGHT_LN_SET_UNACK) + || (opcode == MM_MSG_LIGHT_LN_LINEAR_GET) + || (opcode == MM_MSG_LIGHT_LN_LINEAR_SET) + || (opcode == MM_MSG_LIGHT_LN_LINEAR_SET_UNACK) + || (opcode == MM_MSG_LIGHT_LN_LAST_GET) + || (opcode == MM_MSG_LIGHT_LN_DFLT_GET) + || (opcode == MM_MSG_LIGHT_LN_RANGE_GET)) + { + status = MESH_ERR_NO_ERROR; + } + } + else if (p_env->model_id == MM_ID_LIGHTS_LNS) + { + if ((opcode == MM_MSG_LIGHT_LN_DFLT_SET) + || (opcode == MM_MSG_LIGHT_LN_DFLT_SET_UNACK) + || (opcode == MM_MSG_LIGHT_LN_RANGE_SET) + || (opcode == MM_MSG_LIGHT_LN_RANGE_SET_UNACK)) + { + status = MESH_ERR_NO_ERROR; + } + } + + return (status); +} + +/** + **************************************************************************************** + * @brief Set Light Lightness Actual or Light Lightness Default or Light Lightness Range + * state value + * + * @param[in] p_env Pointer the the environment allocated for the Generic OnOff + * Server model + * @param[in] state_id State identifier + * @param[in] state Light Lightness Actual or Light Lightness Default or Light + * Lightness Range state value + * + * @return An error status (@see enum mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lights_ln_cb_set(mm_mdl_env_t *p_env, uint16_t state_id, uint32_t state) +{ + // Returned status + uint8_t status = MESH_ERR_NO_ERROR; + // Get environment for the Light Lightness Server model + mm_lights_ln_env_t *p_env_ln = (mm_lights_ln_env_t *)p_env; + + switch (state_id) + { + case (MM_STATE_LIGHT_LN): + { + uint16_t ln = state; + + p_env_ln->ln = ln; + p_env_ln->ln_linear = MM_LIGHTS_LN_LINEAR(ln); + + if (ln != 0) + { + p_env_ln->ln_last = ln; + } + + // Set the targeted Generic OnOff state value + mm_bind_set_state(p_env_ln->env.grp_lid, MM_STATE_TYPE_TARGET, MM_ID_GENS_OO, + (p_env_ln->ln == 0) ? 0 : 1); + + // Set the targeted Generic Level state value + mm_bind_set_state(p_env_ln->env.grp_lid, MM_STATE_TYPE_TARGET, MM_ID_GENS_LVL, + p_env_ln->ln - 32768); + } break; + + case (MM_STATE_LIGHT_LN_DFLT): + { + p_env_ln->ln_dflt = state; + } break; + + case (MM_STATE_LIGHT_LN_RANGE): + { + p_env_ln->ln_min = state; + p_env_ln->ln_max = (state >> 16); + } break; + + default: + { + status = MESH_ERR_INVALID_PARAM; + } break; + } + + return (status); +} + +/* + * CALLBACK FUNCTIONS FOR BINDING MANAGER + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Callback function provided to the Binding Manager so that Light Lighting Server + * model can be informed about group event + * + * @param[in] mdl_lid Model Local Index + * @param[in] event Event + * @param[in] info Information (depends on the event type) + **************************************************************************************** + */ +__STATIC void mm_lights_ln_cb_grp_event(m_lid_t mdl_lid, uint8_t event, uint8_t info) +{ + // Get environment for Light Lightness Server model + mm_lights_ln_env_t *p_env_ln = (mm_lights_ln_env_t *)mm_state_get_env(mdl_lid); + + switch (event) + { + case (MM_GRP_EVENT_TRANS_DELAY_EXPIRED): + { + // Set the targeted Generic OnOff state value + mm_bind_set_state(p_env_ln->env.grp_lid, MM_STATE_TYPE_TARGET, MM_ID_GENS_OO, + (p_env_ln->ln_tgt == 0) ? 0 : 1); + + // Set the targeted Generic Level state value + mm_bind_set_state(p_env_ln->env.grp_lid, MM_STATE_TYPE_TARGET, MM_ID_GENS_LVL, + (int32_t)p_env_ln->ln_tgt - 32768); + + // Start the transition + mm_bind_trans_start(p_env_ln->env.grp_lid); + } break; + + case (MM_GRP_EVENT_TRANS_IMMEDIATE): + { + p_env_ln->ln = p_env_ln->ln_tgt; + p_env_ln->ln_linear = p_env_ln->ln_tgt_linear; + + if (p_env_ln->ln != 0) + { + p_env_ln->ln_last = p_env_ln->ln; + } + } // no break; + + case (MM_GRP_EVENT_TRANS_STARTED): + { + uint8_t trans_time = info; + + if (GETB(p_env_ln->env.info, MM_INFO_MAIN)) + { + // Inform application about state update + mm_srv_state_upd_ind_send(MM_STATE_LIGHT_LN, p_env_ln->env.elmt_idx, + p_env_ln->ln_tgt, + (trans_time) ? mm_get_trans_time_ms(trans_time) : 0); + } + + // Check if a status message must be sent + mm_lights_ln_check_status_rsp(p_env_ln); + + // Send a publication + mm_lights_ln_publish(p_env_ln); + } break; + + case (MM_GRP_EVENT_TRANS_END): + { + p_env_ln->ln = p_env_ln->ln_tgt; + p_env_ln->ln_linear = p_env_ln->ln_tgt_linear; + + if (GETB(p_env_ln->env.info, MM_INFO_MAIN)) + { + // Inform application about state update + mm_srv_state_upd_ind_send(MM_STATE_LIGHT_LN, p_env_ln->env.elmt_idx, p_env_ln->ln, 0); + } + + if (p_env_ln->ln != 0) + { + p_env_ln->ln_last = p_env_ln->ln; + } + + // Check if a status message must be sent + mm_lights_ln_check_status_rsp(p_env_ln); + + // Send a publication + mm_lights_ln_publish(p_env_ln); + } break; + + case (MM_GRP_EVENT_GROUP_FULL): + { + // Set Generic Level state value + mm_bind_set_state(p_env_ln->env.grp_lid, MM_STATE_TYPE_CURRENT, + MM_ID_GENS_LVL, 0x8000); + } break; + + //case (MM_GRP_EVENT_TRANS_ABORTED): + default: + { + } break; + } +} + +/** + **************************************************************************************** + * @brief Callback function provided to the Binding Manager so that Light Lighting state + * value can be set by main model of the group + * + * @param[in] mdl_lid Model Local Index + * @param[in] type Type + * @param[in] state State value + **************************************************************************************** + */ +__STATIC void mm_lights_ln_cb_trans_req(m_lid_t main_mdl_lid, uint32_t req_model_id, uint8_t trans_type, + uint32_t state_delta) +{ + // Get environment for Light Lightness Server model + mm_lights_ln_env_t *p_env_ln = (mm_lights_ln_env_t *)mm_state_get_env(main_mdl_lid); + // Targeted Light Lightness Actual state value + uint16_t ln_tgt; + + if (req_model_id == MM_ID_GENS_OO) + { + // Requested Generic OnOff state value + uint8_t onoff = (uint8_t)state_delta; + + if (onoff == 0) + { + ln_tgt = 0; + } + else + { + ln_tgt = (p_env_ln->ln_dflt == 0) ? p_env_ln->ln_last + : p_env_ln->ln_dflt; + } + } + else // req_model_id == MM_ID_GENS_LVL + { + if (trans_type == MM_TRANS_TYPE_CLASSIC) + { + // Requested Generic Level state value + int16_t level = (int16_t)state_delta; + + // Light Lightness Actual = Generic Level + 32768 + ln_tgt = 32768 + level; + } + else // ((trans_type == MM_TRANS_TYPE_DELTA) || trans_type == MM_TRANS_TYPE_MOVE)) + { + // Delta value + int32_t delta; + + if (trans_type == MM_TRANS_TYPE_MOVE) + { + delta = (int16_t)state_delta; + + // Keep the provided delta value + p_env_ln->move_delta = (int16_t)state_delta; + } + else + { + delta = (int32_t)state_delta; + } + + // Add the Light Lightness Actual state value to the received delta value + delta += p_env_ln->ln; + + // The Light Lightness Actual state value cannot wrap + if (delta < 0) + { + ln_tgt = 0; + } + else + { + ln_tgt = (delta > 0xFFFF) ? 0xFFFF : (uint16_t)delta; + } + } + } + + if (ln_tgt != 0) + { + // Ensure that Light Lightness Actual state value is between Light Lightness Range + // Min and Max values + if (ln_tgt > p_env_ln->ln_max) + { + ln_tgt = p_env_ln->ln_max; + } + else if (ln_tgt < p_env_ln->ln_min) + { + ln_tgt = p_env_ln->ln_min; + } + } + + // Check if Light Lightness Actual state value is modified + if (ln_tgt != p_env_ln->ln) + { + p_env_ln->ln_tgt = ln_tgt; + p_env_ln->ln_tgt_linear = MM_LIGHTS_LN_LINEAR(ln_tgt); + + // Start a new transition + mm_bind_trans_new(p_env_ln->env.grp_lid, trans_type, 0, 0); + } + else + { + // Reject the transition + mm_bind_trans_reject(p_env_ln->env.grp_lid); + } +} + +/** + **************************************************************************************** + * @brief Callback function provided to the Binding Manager so that Light Lightness state + * value can be set by main model of the group + * + * @param[in] mdl_lid Model Local Index + * @param[in] type Type + * @param[in] state State value + **************************************************************************************** + */ +__STATIC void mm_lights_ln_cb_set_state(m_lid_t mdl_lid, uint8_t type, uint32_t state) +{ + // Get environment for Light Lightness Server model + mm_lights_ln_env_t *p_env_ln = (mm_lights_ln_env_t *)mm_state_get_env(mdl_lid); + // Light Lightness state value + uint16_t ln = state; + // Generic Level = Light Lightness - 32768 + int16_t lvl = (int32_t)ln - 32768; + + // Sanity check + ASSERT_INFO(!GETB(p_env_ln->env.info, MM_INFO_MAIN), mdl_lid, 0); + + if (type == MM_STATE_TYPE_CURRENT) + { + p_env_ln->ln = ln; + p_env_ln->ln_linear = MM_LIGHTS_LN_LINEAR(ln); + } + else // (type == MM_STATE_TYPE_TARGET) + { + p_env_ln->ln_tgt = ln; + p_env_ln->ln_tgt_linear = MM_LIGHTS_LN_LINEAR(ln); + } + + // Set the Generic Level state (current or target) value + mm_bind_set_state(p_env_ln->env.grp_lid, type, MM_ID_GENS_LVL, lvl); +} + +/** + **************************************************************************************** + * @brief Register Light Lightness Server model for a given local element + * + * @param[in] elmt_idx Element Index + * @param[in] p_mdl_lid Pointer to the variable in which allocated model local index + * will be written + * + * @return An error status (@see mesh_err) + **************************************************************************************** + */ +__STATIC uint8_t mm_lights_lns_register(uint8_t elmt_idx) +{ + // Register Light Lightness Server model + m_lid_t mdl_lid = ms_register_model(MM_ID_LIGHTS_LN, elmt_idx, MM_CFG_PUBLI_AUTH_BIT); + + if (mdl_lid != MESH_INVALID_LID) + { + // Inform the Model State Manager about registered model + mm_lights_ln_env_t *p_env_ln = (mm_lights_ln_env_t *)mm_state_register(elmt_idx, MM_ID_LIGHTS_LN, mdl_lid, + MM_ROLE_SRV_PUBLI, sizeof(mm_lights_ln_env_t)); + + if (p_env_ln) + { + // Initiate states + p_env_ln->ln_min = 1; + p_env_ln->ln_max = 0xFFFF; + + // Prepare environment for Replay Manager + p_env_ln->replay_env.delay_ms = MM_LIGHTS_LN_REPLAY_MS; + + // Prepare timer for publications + p_env_ln->tmr_publi.cb = mm_lights_ln_cb_tmr_publi; + //p_env_ln->tmr_publi.p_env = (void *)p_env_ln; + + // Set internal callback functions + p_env_ln->env.mdl_cb.cb_rx = mm_lights_ln_cb_rx; + p_env_ln->env.mdl_cb.cb_opcode_check = mm_lights_ln_cb_opcode_check; + //p_env_ln->env.mdl_cb.cb_publish_param = mm_lights_ln_cb_publish_param; + //p_cb_srv->cb_set = mm_lights_ln_cb_set; + p_env_ln->env.mdl_cb.cb_srv_set = mm_lights_ln_cb_set; + + // Inform application about registered model + mm_register_ind_send(MM_ID_LIGHTS_LN, elmt_idx, mdl_lid); + } + + // Register Light Lightness Setup Server model + m_lid_t lns_lid = ms_register_model(MM_ID_LIGHTS_LNS, elmt_idx, 0); + + if (lns_lid != MESH_INVALID_LID) + { + // Inform the Model State Manager about registered model + mm_lights_lns_env_t *p_env_lns = (mm_lights_lns_env_t *)mm_state_register(elmt_idx, MM_ID_LIGHTS_LNS, lns_lid, + MM_ROLE_SRV, sizeof(mm_lights_lns_env_t)); + + if (p_env_lns) + { + // Set internal callback functions + p_env_lns->env.mdl_cb.cb_rx = mm_lights_ln_cb_rx; + p_env_lns->env.mdl_cb.cb_opcode_check = mm_lights_ln_cb_opcode_check; + + // Link environment + p_env_lns->p_env_ln = p_env_ln; + + // Inform application about registered model + mm_register_ind_send(MM_ID_LIGHTS_LNS, elmt_idx, lns_lid); + } + } + } + + return (mdl_lid); +} + +/* + * GLOBAL FUNCTIONS + **************************************************************************************** + */ + +uint8_t mm_lights_ln_register(uint8_t elmt_idx, bool main) +{ + m_lid_t mdl_lid = MESH_INVALID_LID; + + do + { + m_lid_t oo_lid, lvl_lid; + + // Register the Generic OnOff Server, the Generic Power OnOff Server and Setup models + oo_lid = mm_gens_poo_register(elmt_idx, false); + if (oo_lid == MESH_INVALID_LID) + { + break; + } + + // Register the Generic Level Server model + lvl_lid = mm_gens_lvl_register(elmt_idx, false); + if (lvl_lid == MESH_INVALID_LID) + { + break; + } + + // Register the Light Lightness Server and the Light Lightness Setup models + mdl_lid = mm_lights_lns_register(elmt_idx); + + if (main && (mdl_lid != MESH_INVALID_LID)) + { + // Create group and set Light Lightness Server model as main model + m_lid_t grp_lid = mm_bind_add_group(2, elmt_idx, mdl_lid, + mm_lights_ln_cb_grp_event, mm_lights_ln_cb_trans_req); + + // Add Generic Level Server model to the group + mm_gens_lvl_bind_group(grp_lid, lvl_lid); + // Add Generic OnOff Server model to the group + mm_gens_oo_bind_group(grp_lid, oo_lid); + } + } while (0); + + return (mdl_lid); +} + +uint8_t mm_lights_ln_bind_group(m_lid_t grp_lid, m_lid_t ln_lid) +{ + return mm_bind_group_add_mdl(grp_lid, ln_lid, MM_ID_LIGHTS_LN, + mm_lights_ln_cb_grp_event, + mm_lights_ln_cb_set_state); +} + +uint16_t mm_lights_ln_get(uint8_t elmt_idx, uint32_t state_id) +{ + // Get model local index of Light Lightness Server model on given element + m_lid_t mdl_lid = mm_state_get_lid(elmt_idx, MM_ID_LIGHTS_LN); + // State + uint16_t state = 0; + + if (mdl_lid != MESH_INVALID_LID) + { + // Get environment for the model + mm_lights_ln_env_t *p_env_ln = (mm_lights_ln_env_t *)mm_state_get_env(mdl_lid); + + switch (state_id) + { + case (MM_STATE_LIGHT_LN_DFLT): + { + state = p_env_ln->ln_dflt; + } break; + + case (MM_STATE_LIGHT_LN_RANGE_MIN): + { + state = p_env_ln->ln_min; + } break; + + case (MM_STATE_LIGHT_LN_RANGE_MAX): + { + state = p_env_ln->ln_max; + } break; + + case (MM_STATE_LIGHT_LN_LAST): + { + state = p_env_ln->ln_last; + } break; + + default: + { + } break; + } + } + + return (state); +} + +void mm_lights_ln_set_dflt(uint8_t elmt_idx, uint16_t ln_dflt) +{ + // Get model local index of Light Lightness Server model on given element + m_lid_t mdl_lid = mm_state_get_lid(elmt_idx, MM_ID_LIGHTS_LN); + + if (mdl_lid != MESH_INVALID_LID) + { + // Get environment for the model + mm_lights_ln_env_t *p_env_ln = (mm_lights_ln_env_t *)mm_state_get_env(mdl_lid); + + // Keep the provided value + p_env_ln->ln_dflt = ln_dflt; + + // Inform application about received value + mm_srv_state_upd_ind_send(MM_STATE_LIGHT_LN_DFLT, elmt_idx, ln_dflt, 0); + } +} + +/// @} end of group diff --git a/mesh/readme.md b/mesh/readme.md new file mode 100644 index 0000000..6a4c221 --- /dev/null +++ b/mesh/readme.md @@ -0,0 +1,25 @@ +Mesh Module + |--api Mesh APIs of Stack and Service + | |--*.h Header Files of APIs + |--lib Mesh Stack and Model Libraries + | |--ble6_mesh.lib Mesh Support general node (no Relay Friend LPN) + | |--ble6_mesh_full.lib Mesh Support all node feature: Relay Friend LPN Proxy + | |--sig_model.lib SIG Mesh Model, Genrated via "\mdk\model.uvprojx" + | |--sig_model.h wrap *.h file which be in "\model\api" + |--mdk MDK5 Project of Mesh Model + | |--model.uvprojx Build sig_model.lib + | |--model.uvoptx + |--model Mesh Model Source File + | |--api APIs of Mesh Model + | |--gen Mesh Generic Model + | |--light Mesh Light Model + | |--sens Mesh Sensor Model* + | |--tscn Mesh Time and Scene Model* + |--genie Tmall Genie Source File + | |--genie_mesh.c Tmall Genie mesh + | |--genie_mesh.h + | |--sha256.c TinyCrypt SHA-256 + | |--sha256.c + +Mesh Demo + see ..\projects\bleMesh \ No newline at end of file diff --git a/modules/api/CRCxx.h b/modules/api/CRCxx.h new file mode 100644 index 0000000..3ed8f5f --- /dev/null +++ b/modules/api/CRCxx.h @@ -0,0 +1,321 @@ +/** + **************************************************************************************** + * + * @file CRCxx.h + * + * @brief Head File of Common CRC bitwise operation functions. + * + **************************************************************************************** + */ +#ifndef _CRCxx_H_ +#define _CRCxx_H_ + +#include + +#ifndef ulen_t +#define ulen_t uint16_t +#endif + + +/****************************************************************************** +* Name: CRC-4/ITU +* Poly: 0x03 ( x4+x+1 ) +* Init: 0x00 +* Refin: True +* Refout: True +* Xorout: 0x00 +*****************************************************************************/ +uint8_t crc4_itu(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-5/EPC +* Poly: 0x09 ( x5+x3+1 ) +* Init: 0x09 +* Refin: False +* Refout: False +* Xorout: 0x00 +*****************************************************************************/ +uint8_t crc5_epc(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-5/ITU +* Poly: 0x15 ( x5+x4+x2+1 ) +* Init: 0x00 +* Refin: True +* Refout: True +* Xorout: 0x00 +*****************************************************************************/ +uint8_t crc5_itu(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-5/USB +* Poly: 0x05 ( x5+x2+1 ) +* Init: 0x1F +* Refin: True +* Refout: True +* Xorout: 0x1F +*****************************************************************************/ +uint8_t crc5_usb(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-6/ITU +* Poly: 0x03 ( x6+x+1 ) +* Init: 0x00 +* Refin: True +* Refout: True +* Xorout: 0x00 +*****************************************************************************/ +uint8_t crc6_itu(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-7/MMC +* Poly: 0x09 ( x7+x3+1 ) +* Init: 0x00 +* Refin: False +* Refout: False +* Xorout: 0x00 +* Use: MultiMediaCard,SD,ect. +*****************************************************************************/ +uint8_t crc7_mmc(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-8 +* Poly: 0x07 ( x8+x2+x+1 ) +* Init: 0x00 +* Refin: False +* Refout: False +* Xorout: 0x00 +*****************************************************************************/ +uint8_t crc8(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-8/ITU +* Poly: 0x07 ( x8+x2+x+1 ) +* Init: 0x00 +* Refin: False +* Refout: False +* Xorout: 0x55 +* Alias: CRC-8/ATM +*****************************************************************************/ +uint8_t crc8_itu(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-8/ROHC +* Poly: 0x07 ( x8+x2+x+1 ) +* Init: 0xFF +* Refin: True +* Refout: True +* Xorout: 0x00 +*****************************************************************************/ +uint8_t crc8_rohc(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-8/MAXIM +* Poly: 0x31 ( x8+x5+x4+1 ) +* Init: 0x00 +* Refin: True +* Refout: True +* Xorout: 0x00 +* Alias: DOW-CRC,CRC-8/IBUTTON +* Use: Maxim(Dallas)'s some devices,e.g. DS18B20 +*****************************************************************************/ +uint8_t crc8_maxim(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-16 +* Poly: 0x8005 ( x16+x15+x2+1 ) +* Init: 0x0000 +* Refin: True +* Refout: True +* Xorout: 0x0000 +* Alias: CRC-16/IBM,CRC-16/ARC,CRC-16/LHA +*****************************************************************************/ +uint16_t crc16(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-16/MAXIM +* Poly: 0x8005 ( x16+x15+x2+1 ) +* Init: 0x0000 +* Refin: True +* Refout: True +* Xorout: 0xFFFF +*****************************************************************************/ +uint16_t crc16_maxim(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-16/USB +* Poly: 0x8005 ( x16+x15+x2+1 ) +* Init: 0xFFFF +* Refin: True +* Refout: True +* Xorout: 0xFFFF +*****************************************************************************/ +uint16_t crc16_usb(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-16/MODBUS +* Poly: 0x8005 ( x16+x15+x2+1 ) +* Init: 0xFFFF +* Refin: True +* Refout: True +* Xorout: 0x0000 +*****************************************************************************/ +uint16_t crc16_modbus(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-16/CCITT +* Poly: 0x1021 ( x16+x12+x5+1 ) +* Init: 0x0000 +* Refin: True +* Refout: True +* Xorout: 0x0000 +* Alias: CRC-CCITT,CRC-16/CCITT-TRUE,CRC-16/KERMIT +*****************************************************************************/ +uint16_t crc16_ccitt(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-16/CCITT-FALSE +* Poly: 0x1021 ( x16+x12+x5+1 ) +* Init: 0xFFFF +* Refin: False +* Refout: False +* Xorout: 0x0000 +*****************************************************************************/ +uint16_t crc16_ccitt_false(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-16/X25 +* Poly: 0x1021 ( x16+x12+x5+1 ) +* Init: 0xFFFF +* Refin: True +* Refout: True +* Xorout: 0XFFFF +*****************************************************************************/ +uint16_t crc16_x25(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-16/XMODEM +* Poly: 0x1021 ( x16+x12+x5+1 ) +* Init: 0x0000 +* Refin: False +* Refout: False +* Xorout: 0x0000 +* Alias: CRC-16/ZMODEM,CRC-16/ACORN +*****************************************************************************/ +uint16_t crc16_xmodem(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-16/DNP +* Poly: 0x3D65 ( x16+x13+x12+x11+x10+x8+x6+x5+x2+1 ) +* Init: 0x0000 +* Refin: True +* Refout: True +* Xorout: 0xFFFF +* Use: M-Bus,ect. +*****************************************************************************/ +uint16_t crc16_dnp(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-24 +* Poly: 0x864CFB ( x24+x23+x18+x17+x14+x11+x10+x7+x6+x5+x4+x3+x1+1 ) +* Init: 0xB704CE +* Refin: True +* Refout: True +* Xorout: 0x000000 +* Alias: CRC-24/OPENPGP +*****************************************************************************/ +uint32_t crc24(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-24/BLE +* Poly: 0x00065B ( x24+x10+x9+x6+x4+x3+x1+1 ) +* Init: 0x555555 +* Refin: True +* Refout: True +* Xorout: 0x000000 +*****************************************************************************/ +uint32_t crc24_ble(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-24/FLEXRAY-A +* Poly: 0x5D6DCB ( x24+x22+x20+x19+x18+x16+x14+x13+x11+x10+x8+x7+x6+x3+x1+1 ) +* Init: 0xFEDCBA +* Refin: True +* Refout: True +* Xorout: 0x000000 +*****************************************************************************/ +uint32_t crc24_flexraya(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-24/FLEXRAY-B +* Poly: 0x5D6DCB ( x24+x22+x20+x19+x18+x16+x14+x13+x11+x10+x8+x7+x6+x3+x1+1 ) +* Init: 0xABCDEF +* Refin: True +* Refout: True +* Xorout: 0x000000 +*****************************************************************************/ +uint32_t crc24_flexrayb(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-24/LTE-A +* Poly: 0x864CFB ( x24+x23+x18+x17+x14+x11+x10+x7+x6+x5+x4+x3+x1+1 ) +* Init: 0x000000 +* Refin: False +* Refout: False +* Xorout: 0x000000 +*****************************************************************************/ +uint32_t crc24_lte_a(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-24/LTE-B +* Poly: 0x800063 ( x24+x23+x6+x5+x1+1 ) +* Init: 0x000000 +* Refin: False +* Refout: False +* Xorout: 0x000000 +*****************************************************************************/ +uint32_t crc24_lte_b(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-24/OS-9 +* Poly: 0x800063 ( x24+x23+x6+x5+x1+1 ) +* Init: 0xFFFFFF +* Refin: False +* Refout: False +* Xorout: 0xFFFFFF +*****************************************************************************/ +uint32_t crc24_os9(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-24/INTERLAKEN +* Poly: 0x328B63 ( x24+x21+x20+x17+x15+x11+x9+x8+x6+x5+x1+1 ) +* Init: 0xFFFFFF +* Refin: False +* Refout: False +* Xorout: 0xFFFFFF +*****************************************************************************/ +uint32_t crc24_interlaken(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-32 +* Poly: 0x4C11DB7 ( x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1 ) +* Init: 0xFFFFFFF +* Refin: True +* Refout: True +* Xorout: 0xFFFFFFF +* Alias: CRC_32/ADCCP +* Use: WinRAR,ect. +*****************************************************************************/ +uint32_t crc32(uint8_t *data, ulen_t length); + +/****************************************************************************** +* Name: CRC-32/MPEG-2 +* Poly: 0x4C11DB7 ( x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1 ) +* Init: 0xFFFFFFF +* Refin: False +* Refout: False +* Xorout: 0x0000000 +*****************************************************************************/ +uint32_t crc32_mpeg2(uint8_t *data, ulen_t length); + +#endif // _CRCxx_H_ diff --git a/modules/api/adpcm.h b/modules/api/adpcm.h new file mode 100644 index 0000000..8790994 --- /dev/null +++ b/modules/api/adpcm.h @@ -0,0 +1,27 @@ +/* +** adpcm.h - include file for adpcm coder. +** +** Version 1.0, 7-Jul-92. +*/ + +#ifndef ADPCM_H +#define ADPCM_H + +#ifdef __cplusplus +extern "C" { +#endif + +struct adpcm_state { + short valprev; /* Previous output value */ + char index; /* Index into stepsize table */ +}; + +//len 是采样点的个数,不是字节大小 +int adpcm_coder(short* indata, char* outdata, int len, struct adpcm_state* state); +int adpcm_decoder(char* indata, short* outdata, int len, struct adpcm_state* state); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* ADPCM_H*/ diff --git a/modules/api/btns.h b/modules/api/btns.h new file mode 100644 index 0000000..befcc38 --- /dev/null +++ b/modules/api/btns.h @@ -0,0 +1,51 @@ +/** + **************************************************************************************** + * + * @file btns.h + * + * @brief Header file - Separate Button Module + * + **************************************************************************************** + */ + +#ifndef _BTNS_H_ +#define _BTNS_H_ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +enum btn_evt { + BTN_IDLE, + + BTN_PRESS, + BTN_RELEASE, + + BTN_CLICK, + BTN_DCLICK, // double click + BTN_LONG, + BTN_LLONG, // long long press + + BTN_EVT_MAX +}; + +typedef void(*btn_func_t)(uint8_t id, uint8_t evt); + + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ + +/// Init iopad and env +void btns_init(void); + +/// Conf event handler, disabled when 'hdl' is NULL +void btns_conf(btn_func_t hdl); + + +#endif // _BTNS_H_ diff --git a/modules/api/dbg.h b/modules/api/dbg.h new file mode 100644 index 0000000..fce2578 --- /dev/null +++ b/modules/api/dbg.h @@ -0,0 +1,70 @@ +/** + **************************************************************************************** + * + * @file dbg.h + * + * @brief Debug Output via UART or JLink-RTT, or Disable + * + **************************************************************************************** + */ + +#ifndef _DBG_H_ +#define _DBG_H_ + +#include + + +/// Debug Mode: 0=Disable, 1=via UART, 2=RTT Viewer +#define DBG_DISABLE 0 +#define DBG_VIA_UART 1 +#define DBG_VIA_RTT 2 + +#if !defined(DBG_MODE) +#define DBG_MODE (DBG_DISABLE) +#endif + + +/// Debug Output Functions +#if (DBG_MODE == DBG_VIA_UART) +#include + +void dbgInit(void); + +#define debug(format, ...) printf(format, ##__VA_ARGS__) + +#define debugHex(dat, len) do{ debug("<%s,%d>", __MODULE__, __LINE__);\ + for (int i=0; i + KEY_SLASH = 0x38, // /? + KEY_CAPS_LOCK = 0x39, + + KEY_F1 = 0x3A, + KEY_F2 = 0x3B, + KEY_F3 = 0x3C, + KEY_F4 = 0x3D, + KEY_F5 = 0x3E, + KEY_F6 = 0x3F, + KEY_F7 = 0x40, + KEY_F8 = 0x41, + KEY_F9 = 0x42, + KEY_F10 = 0x43, + KEY_F11 = 0x44, + KEY_F12 = 0x45, + + KEY_PRINT_SCREEN = 0x46, + KEY_SCROLL_LOCK = 0x47, + KEY_PAUSE = 0x48, + KEY_INSERT = 0x49, + KEY_HOME = 0x4A, + KEY_PAGE_UP = 0x4B, + KEY_DELETE = 0x4C, + KEY_END = 0x4D, + KEY_PAGE_DOWN = 0x4E, + + KEY_RIGHT = 0x4F, + KEY_LEFT = 0x50, + KEY_DOWN = 0x51, + KEY_UP = 0x52, + + KEY_NUM_LOCK = 0x53, + KEY_PAD_SLASH = 0x54, // / + KEY_PAD_ASTERIX = 0x55, // * + KEY_PAD_MINUS = 0x56, // - + KEY_PAD_PLUS = 0x57, // + + KEY_PAD_ENTER = 0x58, + KEY_PAD_1 = 0x59, + KEY_PAD_2 = 0x5A, + KEY_PAD_3 = 0x5B, + KEY_PAD_4 = 0x5C, + KEY_PAD_5 = 0x5D, + KEY_PAD_6 = 0x5E, + KEY_PAD_7 = 0x5F, + KEY_PAD_8 = 0x60, + KEY_PAD_9 = 0x61, + KEY_PAD_0 = 0x62, + KEY_PAD_DOT = 0x63, // . + + KEY_K45 = 0x64, + KEY_APP = 0x65, + KEY_POWER = 0x66, + KEY_PAD_EQUAL = 0x67, + KEY_F13 = 0x68, + KEY_F14 = 0x69, + KEY_F15 = 0x6A, + KEY_F16 = 0x6B, + KEY_F17 = 0x6C, + KEY_F18 = 0x6D, + KEY_F19 = 0x6E, + KEY_F20 = 0x6F, + KEY_F21 = 0x70, + KEY_F22 = 0x71, + KEY_F23 = 0x72, + KEY_F24 = 0x73, + KEY_EXECUTE = 0x74, + KEY_HELP = 0x75, + KEY_MENU = 0x76, + KEY_SELECT = 0x77, + + KEY_STOP = 0x78, + KEY_AGAIN = 0x79, + KEY_UNDO = 0x7A, + KEY_CUT = 0x7B, + KEY_COPY = 0x7C, + KEY_PASTE = 0x7D, + KEY_FIND = 0x7E, + KEY_MUTE = 0x7F, + KEY_VOL_UP = 0x80, + KEY_VOL_DN = 0x81, + + KEY_LOCKING_CAPS = 0x82, + KEY_LOCKING_NUM = 0x83, + KEY_LOCKING_SCROLL = 0x84, + KEY_PAD_COMMA = 0x85, + KEY_PAD_EQUAL_AS400 = 0x86, + KEY_INTL_1 = 0x87, + KEY_INTL_2 = 0x88, + KEY_INTL_3 = 0x89, + KEY_INTL_4 = 0x8A, + KEY_INTL_5 = 0x8B, + KEY_INTL_6 = 0x8C, + KEY_INTL_7 = 0x8D, + KEY_INTL_8 = 0x8E, + KEY_INTL_9 = 0x8F, + KEY_LANG_1 = 0x90, + KEY_LANG_2 = 0x91, + KEY_LANG_3 = 0x92, + KEY_LANG_4 = 0x93, + KEY_LANG_5 = 0x94, + KEY_LANG_6 = 0x95, + KEY_LANG_7 = 0x96, + KEY_LANG_8 = 0x97, + KEY_LANG_9 = 0x98, + KEY_ALT_ERASE = 0x99, + KEY_SYS_REQ = 0x9A, + KEY_CANCEL = 0x9B, + KEY_CLEAR = 0x9C, + KEY_PRIOR = 0x9D, + KEY_RETURN = 0x9E, + KEY_SEPARATOR = 0x9F, + + KEY_OUT = 0xA0, + KEY_OPER = 0xA1, + KEY_CLEAR_AGAIN = 0xA2, + KEY_CRSEL = 0xA3, + KEY_EXSEL = 0xA4, + + // Reserved 0xA5-0xAF(165-175) + + KEY_PAD_00 = 0xB0, + KEY_PAD_000 = 0xB1, + KEY_THOUSANDS_SEPERATOR = 0xB2, + KEY_DECIMAL_SEPERATOR = 0xB3, + + KEY_CURRENCY_UNIT = 0xB4, + KEY_CURRENCY_SUB_UNIT = 0xB5, + KEY_PAD_LEFT_PAREN = 0xB6, + KEY_PAD_RIGHT_PAREN = 0xB7, + KEY_PAD_LEFT_CURLY_BRACE = 0xB8, + KEY_PAD_RIGHT_CURLY_BRACE = 0xB9, + KEY_PAD_TAB = 0xBA, + KEY_PAD_BACKSPACE = 0xBB, + KEY_PAD_A = 0xBC, + KEY_PAD_B = 0xBD, + + KEY_PAD_C = 0xBE, + KEY_PAD_D = 0xBF, + KEY_PAD_E = 0xC0, + KEY_PAD_F = 0xC1, + KEY_PAD_XOR = 0xC2, + KEY_PAD_CARET = 0xC3, + KEY_PAD_PERCENT = 0xC4, + KEY_PAD_LESS_THAN = 0xC5, + KEY_PAD_GREATER_THAN = 0xC6, + KEY_PAD_AMPERSAND = 0xC7, + + KEY_PAD_DOUBLE_AMPERSAND = 0xC8, + KEY_PAD_VERTICAL_BAR = 0xC9, + KEY_PAD_DOUBLE_VERTICAL_BAR = 0xCA, + KEY_PAD_COLON = 0xCB, + KEY_PAD_HASH = 0xCC, + KEY_PAD_SPACE = 0xCD, + KEY_PAD_AT = 0xCE, + KEY_PAD_EXCLAMATION = 0xCF, + KEY_PAD_MEM_STORE = 0xD0, + KEY_PAD_MEM_RECALL = 0xD1, + + KEY_PAD_MEM_CLEAR = 0xD2, + KEY_PAD_MEM_ADD = 0xD3, + KEY_PAD_MEM_SUBTRACT = 0xD4, + KEY_PAD_MEM_MULTIPLY = 0xD5, + KEY_PAD_MEM_DIVIDE = 0xD6, + KEY_PAD_PLUS_MINUS = 0xD7, + KEY_PAD_CLEAR = 0xD8, + KEY_PAD_CLEAR_ENTRY = 0xD9, + KEY_PAD_BINARY = 0xDA, + KEY_PAD_OCTAL = 0xDB, + + KEY_PAD_DECIMAL = 0xDC, + KEY_PAD_HEX = 0xDD, + + // Reserved 0xDE-0xDF(222-223) + + KEY_LCTRL = 0xE0, + KEY_LSHIFT = 0xE1, + KEY_LALT = 0xE2, + KEY_LGUI = 0xE3, + KEY_RCTRL = 0xE4, + KEY_RSHIFT = 0xE5, + KEY_RALT = 0xE6, + KEY_RGUI = 0xE7, + + KEY_FN = 0xF0, + KEY_LED = 0xF1, + KEY_RGB = 0xF2, +}; + +/// Multi-Fn keys, Reference: <> Consumer Page(0x0C) +enum multi_key +{ + MKEY_POWER = 0x0030, // Lock screen + MKEY_RESET = 0x0031, + MKEY_SLEEP = 0x0032, + + MKEY_MENU = 0x0040, + MKEY_MENU_PICK = 0x0041, + MKEY_MENU_UP = 0x0042, + MKEY_MENU_DN = 0x0043, + MKEY_MENU_LEFT = 0x0044, + MKEY_MENU_RIGHT = 0x0045, + + MKEY_LIGHT_UP = 0x006F, + MKEY_LIGHT_DN = 0x0070, + + MKEY_CHN_UP = 0x009C, + MKEY_CHN_DN = 0x009D, + + MKEY_PLAY = 0x00B0, + MKEY_PAUSE = 0x00B1, + MKEY_RECORD = 0x00B2, + MKEY_FAST_FORWARD = 0x00B3, + MKEY_REWIND = 0x00B4, + MKEY_NEXT_TRK = 0x00B5, + MKEY_PREV_TRK = 0x00B6, + MKEY_STOP = 0x00B7, + MKEY_EJECT = 0x00B8, + + MKEY_START_PAUSE = 0x00CD, + MKEY_START_SKIP = 0x00CE, + + MKEY_VOLUME = 0x00E0, + MKEY_BALANCE = 0x00E1, + MKEY_MUTE = 0x00E2, + MKEY_VOL_UP = 0x00E9, + MKEY_VOL_DN = 0x00EA, + + MKEY_MUSIC = 0x0183, + MKEY_EMAIL = 0x018A, + MKEY_CALCAULATOL = 0x0192, + MKEY_COMPUTER = 0x0194, + + MKEY_VIRKB = 0x01AE, // Soft keyboard + + MKEY_WWW_SEARCH = 0x0221, + MKEY_WWW_HOME = 0x0223, + MKEY_WWW_BACK = 0x0224, + MKEY_WWW_FORWARD = 0x0225, + MKEY_WWW_STOP = 0x0226, + MKEY_WWW_REFRESH = 0x0227, + MKEY_WWW_FAVORITES = 0x022A, +}; + +enum multi_key_pos +{ + MKEY_BIT0_POS = 0, + MKEY_BIT1_POS = 1, + MKEY_BIT2_POS = 2, + MKEY_BIT3_POS = 3, + MKEY_BIT4_POS = 4, + MKEY_BIT5_POS = 5, + MKEY_BIT6_POS = 6, + MKEY_BIT7_POS = 7, +}; + +/// Bitmap of Keys +enum key_bit +{ + // byte0: E0~E7(Modifier Keys) + KEY_BIT_LCTRL = 0x01, + KEY_BIT_LSHIFT = 0x02, + KEY_BIT_LALT = 0x04, + KEY_BIT_LGUI = 0x08, + + KEY_BIT_RCTRL = 0x10, + KEY_BIT_RSHIFT = 0x20, + KEY_BIT_RALT = 0x40, + KEY_BIT_RGUI = 0x80, + + // byte1: F0~F2(Fn Keys) + KEY_BIT_FN = 0x01, + KEY_BIT_LED = 0x02, + KEY_BIT_RGB = 0x04, +}; + +enum key_sys +{ + ANDROID = 0, + WINDOWS = 1, + SYS_IOS = 2, //iPad + SYS_MAC = 3, + + SYS_MAX = SYS_MAC, +}; + +#endif //_HIDKEY_H_ diff --git a/modules/api/leds.h b/modules/api/leds.h new file mode 100644 index 0000000..293a954 --- /dev/null +++ b/modules/api/leds.h @@ -0,0 +1,55 @@ +/** + **************************************************************************************** + * + * @file leds.h + * + * @brief Header file - Separate LED Display Module + * + **************************************************************************************** + */ + +#ifndef _LEDS_H_ +#define _LEDS_H_ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +/// mode of leds_play *User should override it* +enum led_mode +{ + LED_SLOW_BL, // slow blink + LED_FAST_BL, // fast blink + LED_BUSY_BL, // busy blink, more fast + LED_CONT_ON, // continued ON + LED_HINT_BL, // twice blink as hint + + // add more... + + LED_MODE_MAX +}; + + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ + +#if (LED_PLAY) +/// Init iopad and env +void leds_init(void); + +/// Dispaly 'mode' @see enum led_mode +void leds_play(uint8_t mode); +#else +/// Disable via empty marco +#define leds_init() +#define leds_play(mode) +#endif + + +#endif // _LEDS_H_ diff --git a/modules/api/rbuf.h b/modules/api/rbuf.h new file mode 100644 index 0000000..35f15a6 --- /dev/null +++ b/modules/api/rbuf.h @@ -0,0 +1,261 @@ +/** + **************************************************************************************** + * + * @file rbuf.h + * + * @brief Definitons of Ring Buffer module(Predefine Size, Byte-byte Copy). + * + **************************************************************************************** + */ + +#ifndef _RBUF_H_ +#define _RBUF_H_ + +#include +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Buffer space size *User should redefine it via #undef RBUF_SIZE. +#ifndef RBUF_SIZE +#define RBUF_SIZE 0x100 +#endif + +/// Length type of buffer +#ifndef rblen_t +#define rblen_t uint16_t +#endif + +/// Macro of utils function +#define IS_PWR_2(n) ((n != 0) && ((n & (n - 1)) == 0)) +#define RBUF_MIN(a, b) ((a) < (b) ? (a) : (b)) +#define RBUF_MAX(a, b) ((a) > (b) ? (a) : (b)) + +#if IS_PWR_2(RBUF_SIZE) +// Increase 'p'(position) with 's'(step). +#define RBUF_INC(p, s) ((p + s) % RBUF_SIZE) +// Get number of bytes currently in buffer. +#define RBUF_LEN(h, t) ((RBUF_SIZE + h - t) % RBUF_SIZE) +// Get available size in buffer for write, 1 less than it actually is. +#define RBUF_AVAIL(h, t) ((RBUF_SIZE + t - h - 1) % RBUF_SIZE) +#else +// Increase 'p'(position) with 's'(step). +#define RBUF_INC(p, s) ((p == (RBUF_SIZE - s)) ? (s - 1) : (p + s)) +// Get number of bytes currently in buffer. +#define RBUF_LEN(h, t) ((h >= t) ? (h - t) : (RBUF_SIZE + h - t)) +// Get available size in buffer for write, 1 less than it actually is. +#define RBUF_AVAIL(h, t) ((t > h) ? (t - h - 1) : (RBUF_SIZE + t - h - 1)) +#endif + +/// Struct type of Ring Buffer +typedef struct ringbuffer +{ + volatile rblen_t head; + volatile rblen_t tail; + uint8_t data[RBUF_SIZE]; +} rbuf_t; + + +/* + * INLINE FUNCTION + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Init/Reset the entire BUFF contents. + * + * @param[in] rb The ringbuff to be emptied. + * @return None. + **************************************************************************************** + */ +static __forceinline void rbuf_init(rbuf_t *rb) +{ + rb->head = rb->tail = 0; +} + +/** + **************************************************************************************** + * @brief Returns the size of the BUFF in bytes. + * + * @param[in] rb The ringbuff to be used. + * @return The size of the BUFF. + **************************************************************************************** + */ +static __forceinline rblen_t rbuf_size(rbuf_t *rb) +{ + return RBUF_SIZE; // Direct return +} + +/** + **************************************************************************************** + * @brief Returns the number of used bytes in the BUFF. + * + * @param[in] rb The ringbuff to be used. + * @return The number of used bytes. + **************************************************************************************** + */ +static __forceinline rblen_t rbuf_len(rbuf_t *rb) +{ + rblen_t head = rb->head; + rblen_t tail = rb->tail; + + return RBUF_LEN(head, tail); +} + +/** + **************************************************************************************** + * @brief Returns the number of bytes available in the BUFF. + * + * @param[in] rb The ringbuff to be used. + * @return The number of bytes available. + **************************************************************************************** + */ +static __forceinline rblen_t rbuf_avail(rbuf_t *rb) +{ + rblen_t head = rb->head; + rblen_t tail = rb->tail; + + return RBUF_AVAIL(head, tail); +} + +/** + **************************************************************************************** + * @brief Is the BUFF empty? + * + * @param[in] rb The ringbuff to be used. + * @return Yes or No. + **************************************************************************************** + */ +static __forceinline bool rbuf_is_empty(rbuf_t *rb) +{ + return (rb->head == rb->tail); +} + +/** + **************************************************************************************** + * @brief Is the BUFF full? + * + * @param[in] rb The ringbuff to be used. + * @return Yes or No. + **************************************************************************************** + */ +static __forceinline bool rbuf_is_full(rbuf_t *rb) +{ + rblen_t head = rb->head; + rblen_t tail = rb->tail; + + return (RBUF_AVAIL(head, tail) == 0); +} + +/** + **************************************************************************************** + * @brief Force Put one byte into the BUFF. + * + * @param[in] rb The ringbuff to be used. + * @param[in] ch The byte to be added. + * + * @return None. + **************************************************************************************** + */ +static __forceinline void rbuf_putc(rbuf_t *rb, uint8_t ch) +{ + rblen_t head = rb->head; + + rb->data[head] = ch; + rb->head = RBUF_INC(head, 1); +} + +/** + **************************************************************************************** + * @brief Force Puts some data into the BUFF. + * + * @param[in] rb The ringbuff to be used. + * @param[in] in The data to be added. + * @param[in] len The length of the data to be added. + * + * @return None. + **************************************************************************************** + */ +static __forceinline void rbuf_puts(rbuf_t *rb, const uint8_t *in, rblen_t len) +{ + rblen_t head = rb->head; + + // copy byte to byte + for (rblen_t i = 0; i < len; i++) + { + rb->data[head] = in[i]; + head = RBUF_INC(head, 1); + } + + rb->head = head; +} + +/** + **************************************************************************************** + * @brief Get one byte from the BUFF. + * + * @param[in] rb The ringbuff to be used. + * @param[out] ch Where the byte be copied. + * + * @return Byte copied or not. + **************************************************************************************** + */ +static __forceinline bool rbuf_getc(rbuf_t *rb, uint8_t *ch) +{ + rblen_t head = rb->head; + rblen_t tail = rb->tail; + + if (head != tail) + { + *ch = rb->data[tail]; + rb->tail = RBUF_INC(tail, 1); + return 1; + } + + return 0; // empty +} + +/** + **************************************************************************************** + * @brief Gets some data from the BUFF. + * + * @param[in] rb The ringbuff to be used. + * @param[out] out Where the data must be copied. + * @param[in] max The max size of the destination buffer. + * + * @return The number of copied bytes. + **************************************************************************************** + */ +static __forceinline rblen_t rbuf_gets(rbuf_t *rb, uint8_t *out, rblen_t max) +{ + rblen_t head = rb->head; + rblen_t tail = rb->tail; + rblen_t dlen = RBUF_LEN(head, tail); + + if (dlen > max) + { + dlen = max; + } + + if (dlen > 0) + { + // copy byte to byte + for (rblen_t i = 0; i < dlen; i++) + { + out[i] = rb->data[tail]; + tail = RBUF_INC(tail, 1); + } + + rb->tail = tail; + } + + return dlen; +} + + +#endif // _RBUF_H_ diff --git a/modules/api/revbit.h b/modules/api/revbit.h new file mode 100644 index 0000000..3b3be6e --- /dev/null +++ b/modules/api/revbit.h @@ -0,0 +1,26 @@ +/** + **************************************************************************************** + * + * @file revbit.h + * + * @brief Head File of Bit Reversal functions. + * + **************************************************************************************** + */ +#ifndef _REVBIT_H_ +#define _REVBIT_H_ + +#include + + +uint8_t revbit8(uint8_t v); + +uint16_t revbit16(uint16_t v); + +uint32_t revbit24(uint32_t v); + +uint32_t revbit32(uint32_t v); + +uint32_t revbit(uint8_t n, uint32_t v); + +#endif // _REVBIT_H_ diff --git a/modules/api/sftmr.h b/modules/api/sftmr.h new file mode 100644 index 0000000..07238f3 --- /dev/null +++ b/modules/api/sftmr.h @@ -0,0 +1,74 @@ +/** + **************************************************************************************** + * + * @file sftmr.h + * + * @brief Header file - Soft Timer Module + * + **************************************************************************************** + */ + +#ifndef _SFTMR_H_ +#define _SFTMR_H_ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Types of timer id, valid range 1 ~ num. +typedef uint8_t tmr_id_t; + +/// Types of timer-tick, 16bits enough. +typedef uint16_t tmr_tk_t; + +/// Callback function, continue mode(>0) or single mode(0). +typedef tmr_tk_t (*tmr_cb_t)(tmr_id_t tmid); + +/// timer ID: 0 - Invalid, 1 ~ num Valid +#define TMR_ID_NONE (0x00) + +/// Maximum timer value (Not exceed tmr_tk_t range) +#if !defined(SFTMR_TICKS_MSK) +#define SFTMR_TICKS_MSK (0xFFFF) +#endif + +#define SFTMR_DELAY_MAX (SFTMR_TICKS_MSK >> 1) + +/// Convert to timer accuracy (in uint of 10ms) +#if !defined(_MS) +#define _MS(n) ((n) / 10) +#endif + + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ + +/// Init timer source +void sftmr_init(void); + +/// Schedule timer event of callback. +void sftmr_schedule(void); + +/// Start timer, callback 'func' after 'delay' ticks post. +tmr_id_t sftmr_start(tmr_tk_t delay, tmr_cb_t func); + +// Refresh timing time +void sftmr_Refresh(tmr_id_t tmr_id, tmr_tk_t delay); + +/// Clear/Free 'tmr_id' timer instance +void sftmr_clear(tmr_id_t tmr_id); + +/// Get current ticks +tmr_tk_t sftmr_tick(void); + +/// Blocking to wait 'delay' ticks arrived +void sftmr_wait(tmr_tk_t delay); + + +#endif // _SFTMR_H_ diff --git a/modules/api/uartRb.h b/modules/api/uartRb.h new file mode 100644 index 0000000..276a1b5 --- /dev/null +++ b/modules/api/uartRb.h @@ -0,0 +1,83 @@ +/** + **************************************************************************************** + * + * @file uartRb.h + * + * @brief Header file for UARTx Interrupt-Mode with RingBuffer. + * + **************************************************************************************** + */ + +#ifndef _UARTRB_H_ +#define _UARTRB_H_ + +#include +#include "uart.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +#ifndef USE_UART1 +#define USE_UART1 (1) //default ON +#endif + +#ifndef USE_UART2 +#define USE_UART2 (0) //default OFF +#endif + + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ + +#if (USE_UART1) + +#if !defined(PA_UART1_TX) + #define PA_UART1_TX (3) //PA06 +#endif +#if !defined(PA_UART1_RX) + #define PA_UART1_RX (4) //PA07 +#endif + +/// Init UARTx and its RB, enable IRQ. +void uart1Rb_Init(void); + +/// Empty RingBuffer to reset. +void uart1Rb_Reset(void); + +/// Get Length of data in RB. +uint16_t uart1Rb_Len(void); + +/// Read data from RB, return the Length of data copied. +uint16_t uart1Rb_Read(uint8_t *buff, uint16_t max); + +#endif //(USE_UART1) + +#if (USE_UART2) + +#if !defined(PA_UART2_TX) + #define PA_UART2_TX (11) //PA11 +#endif +#if !defined(PA_UART2_RX) + #define PA_UART2_RX (12) //PA11 +#endif + +/// Init UARTx and its RB, enable IRQ. +void uart2Rb_Init(void); + +/// Empty RingBuffer to reset. +void uart2Rb_Reset(void); + +/// Get Length of data in RB. +uint16_t uart2Rb_Len(void); + +/// Read data from RB, return the Length of data copied. +uint16_t uart2Rb_Read(uint8_t *buff, uint16_t max); + +#endif //(USE_UART2) + +#endif // _UARTRB_H_ diff --git a/modules/src/CRCxx.c b/modules/src/CRCxx.c new file mode 100644 index 0000000..4e30df0 --- /dev/null +++ b/modules/src/CRCxx.c @@ -0,0 +1,784 @@ +/** + **************************************************************************************** + * + * @file CRCxx.c + * + * @brief Common CRC bitwise operation functions. + * could verify at http://www.ip33.com/crc.html + * + **************************************************************************************** + */ + +#include +#include +#include "CRCxx.h" + + +/****************************************************************************** +* Name: CRC-4/ITU +* Poly: 0x03 ( x4+x+1 ) +* Init: 0x00 +* Refin: True +* Refout: True +* Xorout: 0x00 +*****************************************************************************/ +uint8_t crc4_itu(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint8_t crc = 0; // Initial value + while (length--) + { + crc ^= *data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0x0C; // 0x0C = (reverse 0x03)>>(8-4) + else + crc = (crc >> 1); + } + } + return crc; +} + +/****************************************************************************** +* Name: CRC-5/EPC +* Poly: 0x09 ( x5+x3+1 ) +* Init: 0x09 +* Refin: False +* Refout: False +* Xorout: 0x00 +*****************************************************************************/ +uint8_t crc5_epc(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint8_t crc = 0x48; // Initial value: 0x48 = 0x09<<(8-5) + while (length--) + { + crc ^= *data++; + for ( i = 0; i < 8; i++ ) + { + if ( crc & 0x80 ) + crc = (crc << 1) ^ 0x48; // 0x48 = 0x09<<(8-5) + else + crc <<= 1; + } + } + return crc >> 3; +} + +/****************************************************************************** +* Name: CRC-5/ITU +* Poly: 0x15 ( x5+x4+x2+1 ) +* Init: 0x00 +* Refin: True +* Refout: True +* Xorout: 0x00 +*****************************************************************************/ +uint8_t crc5_itu(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint8_t crc = 0; // Initial value + while (length--) + { + crc ^= *data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0x15; // 0x15 = (reverse 0x15)>>(8-5) + else + crc = (crc >> 1); + } + } + return crc; +} + +/****************************************************************************** +* Name: CRC-5/USB +* Poly: 0x05 ( x5+x2+1 ) +* Init: 0x1F +* Refin: True +* Refout: True +* Xorout: 0x1F +*****************************************************************************/ +uint8_t crc5_usb(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint8_t crc = 0x1F; // Initial value + while (length--) + { + crc ^= *data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0x14; // 0x14 = (reverse 0x05)>>(8-5) + else + crc = (crc >> 1); + } + } + return crc ^ 0x1F; +} + +/****************************************************************************** +* Name: CRC-6/ITU +* Poly: 0x03 ( x6+x+1 ) +* Init: 0x00 +* Refin: True +* Refout: True +* Xorout: 0x00 +*****************************************************************************/ +uint8_t crc6_itu(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint8_t crc = 0; // Initial value + while (length--) + { + crc ^= *data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0x30; // 0x30 = (reverse 0x03)>>(8-6) + else + crc = (crc >> 1); + } + } + return crc; +} + +/****************************************************************************** +* Name: CRC-7/MMC +* Poly: 0x09 ( x7+x3+1 ) +* Init: 0x00 +* Refin: False +* Refout: False +* Xorout: 0x00 +* Use: MultiMediaCard,SD,ect. +*****************************************************************************/ +uint8_t crc7_mmc(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint8_t crc = 0; // Initial value + while (length--) + { + crc ^= *data++; + for ( i = 0; i < 8; i++ ) + { + if ( crc & 0x80 ) + crc = (crc << 1) ^ 0x12; // 0x12 = 0x09<<(8-7) + else + crc <<= 1; + } + } + return crc >> 1; +} + + +/****************************************************************************** +* Name: CRC-8 +* Poly: 0x07 ( x8+x2+x+1 ) +* Init: 0x00 +* Refin: False +* Refout: False +* Xorout: 0x00 +*****************************************************************************/ +uint8_t crc8(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint8_t crc = 0; // Initial value + while (length--) + { + crc ^= *data++; + for ( i = 0; i < 8; i++ ) + { + if ( crc & 0x80 ) + crc = (crc << 1) ^ 0x07; + else + crc <<= 1; + } + } + return crc; +} + +/****************************************************************************** +* Name: CRC-8/ITU +* Poly: 0x07 ( x8+x2+x+1 ) +* Init: 0x00 +* Refin: False +* Refout: False +* Xorout: 0x55 +* Alias: CRC-8/ATM +*****************************************************************************/ +uint8_t crc8_itu(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint8_t crc = 0; // Initial value + while (length--) + { + crc ^= *data++; + for ( i = 0; i < 8; i++ ) + { + if ( crc & 0x80 ) + crc = (crc << 1) ^ 0x07; + else + crc <<= 1; + } + } + return crc ^ 0x55; +} + +/****************************************************************************** +* Name: CRC-8/ROHC +* Poly: 0x07 ( x8+x2+x+1 ) +* Init: 0xFF +* Refin: True +* Refout: True +* Xorout: 0x00 +*****************************************************************************/ +uint8_t crc8_rohc(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint8_t crc = 0xFF; // Initial value + while (length--) + { + crc ^= *data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0xE0; // 0xE0 = reverse 0x07 + else + crc = (crc >> 1); + } + } + return crc; +} + +/****************************************************************************** +* Name: CRC-8/MAXIM +* Poly: 0x31 ( x8+x5+x4+1 ) +* Init: 0x00 +* Refin: True +* Refout: True +* Xorout: 0x00 +* Alias: DOW-CRC,CRC-8/IBUTTON +* Use: Maxim(Dallas)'s some devices,e.g. DS18B20 +*****************************************************************************/ +uint8_t crc8_maxim(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint8_t crc = 0; // Initial value + while (length--) + { + crc ^= *data++; + for (i = 0; i < 8; i++) + { + if (crc & 1) + crc = (crc >> 1) ^ 0x8C; // 0x8C = reverse 0x31 + else + crc >>= 1; + } + } + return crc; +} + + +/****************************************************************************** +* Name: CRC-16 +* Poly: 0x8005 ( x16+x15+x2+1 ) +* Init: 0x0000 +* Refin: True +* Refout: True +* Xorout: 0x0000 +* Alias: CRC-16/IBM,CRC-16/ARC,CRC-16/LHA +*****************************************************************************/ +uint16_t crc16(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint16_t crc = 0; // Initial value + while (length--) + { + crc ^= *data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0xA001; // 0xA001 = reverse 0x8005 + else + crc = (crc >> 1); + } + } + return crc; +} + +/****************************************************************************** +* Name: CRC-16/MAXIM +* Poly: 0x8005 ( x16+x15+x2+1 ) +* Init: 0x0000 +* Refin: True +* Refout: True +* Xorout: 0xFFFF +*****************************************************************************/ +uint16_t crc16_maxim(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint16_t crc = 0; // Initial value + while (length--) + { + crc ^= *data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0xA001; // 0xA001 = reverse 0x8005 + else + crc = (crc >> 1); + } + } + return ~crc; // crc^0xffff +} + +/****************************************************************************** +* Name: CRC-16/USB +* Poly: 0x8005 ( x16+x15+x2+1 ) +* Init: 0xFFFF +* Refin: True +* Refout: True +* Xorout: 0xFFFF +*****************************************************************************/ +uint16_t crc16_usb(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint16_t crc = 0xffff; // Initial value + while (length--) + { + crc ^= *data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0xA001; // 0xA001 = reverse 0x8005 + else + crc = (crc >> 1); + } + } + return ~crc; // crc^0xffff +} + +/****************************************************************************** +* Name: CRC-16/MODBUS +* Poly: 0x8005 ( x16+x15+x2+1 ) +* Init: 0xFFFF +* Refin: True +* Refout: True +* Xorout: 0x0000 +*****************************************************************************/ +uint16_t crc16_modbus(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint16_t crc = 0xffff; // Initial value + while (length--) + { + crc ^= *data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0xA001; // 0xA001 = reverse 0x8005 + else + crc = (crc >> 1); + } + } + return crc; +} + +/****************************************************************************** +* Name: CRC-16/CCITT +* Poly: 0x1021 ( x16+x12+x5+1 ) +* Init: 0x0000 +* Refin: True +* Refout: True +* Xorout: 0x0000 +* Alias: CRC-CCITT,CRC-16/CCITT-TRUE,CRC-16/KERMIT +*****************************************************************************/ +uint16_t crc16_ccitt(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint16_t crc = 0; // Initial value + while (length--) + { + crc ^= *data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0x8408; // 0x8408 = reverse 0x1021 + else + crc = (crc >> 1); + } + } + return crc; +} + +/****************************************************************************** +* Name: CRC-16/CCITT-FALSE +* Poly: 0x1021 ( x16+x12+x5+1 ) +* Init: 0xFFFF +* Refin: False +* Refout: False +* Xorout: 0x0000 +*****************************************************************************/ +uint16_t crc16_ccitt_false(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint16_t crc = 0xffff; // Initial value + while (length--) + { + crc ^= (uint16_t)(*data++) << 8; + for (i = 0; i < 8; ++i) + { + if ( crc & 0x8000 ) + crc = (crc << 1) ^ 0x1021; + else + crc <<= 1; + } + } + return crc; +} + +/****************************************************************************** +* Name: CRC-16/X25 +* Poly: 0x1021 ( x16+x12+x5+1 ) +* Init: 0xFFFF +* Refin: True +* Refout: True +* Xorout: 0XFFFF +*****************************************************************************/ +uint16_t crc16_x25(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint16_t crc = 0xffff; // Initial value + while (length--) + { + crc ^= *data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0x8408; // 0x8408 = reverse 0x1021 + else + crc = (crc >> 1); + } + } + return ~crc; // crc^Xorout +} + +/****************************************************************************** +* Name: CRC-16/XMODEM +* Poly: 0x1021 ( x16+x12+x5+1 ) +* Init: 0x0000 +* Refin: False +* Refout: False +* Xorout: 0x0000 +* Alias: CRC-16/ZMODEM,CRC-16/ACORN +*****************************************************************************/ +uint16_t crc16_xmodem(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint16_t crc = 0; // Initial value + while (length--) + { + crc ^= (uint16_t)(*data++) << 8; + for (i = 0; i < 8; ++i) + { + if ( crc & 0x8000 ) + crc = (crc << 1) ^ 0x1021; + else + crc <<= 1; + } + } + return crc; +} + +/****************************************************************************** +* Name: CRC-16/DNP +* Poly: 0x3D65 ( x16+x13+x12+x11+x10+x8+x6+x5+x2+1 ) +* Init: 0x0000 +* Refin: True +* Refout: True +* Xorout: 0xFFFF +* Use: M-Bus,ect. +*****************************************************************************/ +uint16_t crc16_dnp(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint16_t crc = 0; // Initial value + while (length--) + { + crc ^= *data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0xA6BC; // 0xA6BC = reverse 0x3D65 + else + crc = (crc >> 1); + } + } + return ~crc; // crc^Xorout +} + + +/****************************************************************************** +* Name: CRC-24 +* Poly: 0x864CFB ( x24+x23+x18+x17+x14+x11+x10+x7+x6+x5+x4+x3+x1+1 ) +* Init: 0xB704CE +* Refin: True +* Refout: True +* Xorout: 0x000000 +* Alias: CRC-24/OPENPGP +*****************************************************************************/ +uint32_t crc24(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint32_t crc = 0x7320ED; // Initial value: 0x7320ED = revbit24(0xB704CE) + while (length--) + { + crc ^= *data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0xDF3261; // 0xDF3261 = revbit24(0x864CFB) + else + crc = (crc >> 1); + } + } + return crc; +} + +/****************************************************************************** +* Name: CRC-24/BLE +* Poly: 0x00065B ( x24+x10+x9+x6+x4+x3+x1+1 ) +* Init: 0x555555 +* Refin: True +* Refout: True +* Xorout: 0x000000 +*****************************************************************************/ +uint32_t crc24_ble(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint32_t crc = 0xAAAAAA; // Initial value: 0xAAAAAA = revbit24(0x555555) + while (length--) + { + crc ^= *data++; + for (i = 0; i < 8; i++) + { + if (crc & 1) + crc = (crc >> 1) ^ 0xDA6000; // 0xDA6000 = revbit24(0x00065b) + else + crc = (crc >> 1); + } + } + return crc; +} + +/****************************************************************************** +* Name: CRC-24/FLEXRAY-A +* Poly: 0x5D6DCB ( x24+x22+x20+x19+x18+x16+x14+x13+x11+x10+x8+x7+x6+x3+x1+1 ) +* Init: 0xFEDCBA +* Refin: True +* Refout: True +* Xorout: 0x000000 +*****************************************************************************/ +uint32_t crc24_flexraya(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint32_t crc = 0x5D3B7F; // Initial value: 0x5D3B7F = revbit24(0xFEDCBA) + while (length--) + { + crc ^= *data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0xD3B6BA; // 0xD3B6BA = revbit24(0x5D6DCB) + else + crc = (crc >> 1); + } + } + return crc; +} + +/****************************************************************************** +* Name: CRC-24/FLEXRAY-B +* Poly: 0x5D6DCB ( x24+x22+x20+x19+x18+x16+x14+x13+x11+x10+x8+x7+x6+x3+x1+1 ) +* Init: 0xABCDEF +* Refin: True +* Refout: True +* Xorout: 0x000000 +*****************************************************************************/ +uint32_t crc24_flexrayb(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint32_t crc = 0xF7B3D5; // Initial value: 0xF7B3D5 = revbit24(0xABCDEF) + while (length--) + { + crc ^= *data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0xD3B6BA; // 0xD3B6BA = revbit24(0x5D6DCB) + else + crc = (crc >> 1); + } + } + return crc; +} + +/****************************************************************************** +* Name: CRC-24/LTE-A +* Poly: 0x864CFB ( x24+x23+x18+x17+x14+x11+x10+x7+x6+x5+x4+x3+x1+1 ) +* Init: 0x000000 +* Refin: False +* Refout: False +* Xorout: 0x000000 +*****************************************************************************/ +uint32_t crc24_lte_a(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint32_t crc = 0x000000; // Initial value + while (length--) + { + crc ^= (uint32_t)(*data++) << 16; + for (i = 0; i < 8; ++i) + { + if ( crc & 0x800000 ) + crc = (crc << 1) ^ 0x864CFB; + else + crc <<= 1; + } + } + return (crc & 0xFFFFFF); +} + +/****************************************************************************** +* Name: CRC-24/LTE-B +* Poly: 0x800063 ( x24+x23+x6+x5+x1+1 ) +* Init: 0x000000 +* Refin: False +* Refout: False +* Xorout: 0x000000 +*****************************************************************************/ +uint32_t crc24_lte_b(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint32_t crc = 0x000000; // Initial value + while (length--) + { + crc ^= (uint32_t)(*data++) << 16; + for (i = 0; i < 8; ++i) + { + if ( crc & 0x800000 ) + crc = (crc << 1) ^ 0x800063; + else + crc <<= 1; + } + } + return (crc & 0xFFFFFF); +} + +/****************************************************************************** +* Name: CRC-24/OS-9 +* Poly: 0x800063 ( x24+x23+x6+x5+x1+1 ) +* Init: 0xFFFFFF +* Refin: False +* Refout: False +* Xorout: 0xFFFFFF +*****************************************************************************/ +uint32_t crc24_os9(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint32_t crc = 0xFFFFFF; // Initial value + while (length--) + { + crc ^= (uint32_t)(*data++) << 16; + for (i = 0; i < 8; ++i) + { + if ( crc & 0x800000 ) + crc = (crc << 1) ^ 0x800063; + else + crc <<= 1; + } + } + return (crc & 0xFFFFFF) ^ 0xFFFFFF; +} + +/****************************************************************************** +* Name: CRC-24/INTERLAKEN +* Poly: 0x328B63 ( x24+x21+x20+x17+x15+x11+x9+x8+x6+x5+x1+1 ) +* Init: 0xFFFFFF +* Refin: False +* Refout: False +* Xorout: 0xFFFFFF +*****************************************************************************/ +uint32_t crc24_interlaken(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint32_t crc = 0xFFFFFF; // Initial value + while (length--) + { + crc ^= (uint32_t)(*data++) << 16; + for (i = 0; i < 8; ++i) + { + if ( crc & 0x800000 ) + crc = (crc << 1) ^ 0x328B63; + else + crc <<= 1; + } + } + return (crc & 0xFFFFFF) ^ 0xFFFFFF; +} + + +/****************************************************************************** +* Name: CRC-32 +* Poly: 0x4C11DB7 ( x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1 ) +* Init: 0xFFFFFFF +* Refin: True +* Refout: True +* Xorout: 0xFFFFFFF +* Alias: CRC_32/ADCCP +* Use: WinRAR,ect. +*****************************************************************************/ +uint32_t crc32(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint32_t crc = 0xffffffff; // Initial value + while (length--) + { + crc ^= *data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0xEDB88320; // 0xEDB88320= reverse 0x04C11DB7 + else + crc = (crc >> 1); + } + } + return ~crc; +} + +/****************************************************************************** +* Name: CRC-32/MPEG-2 +* Poly: 0x4C11DB7 ( x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1 ) +* Init: 0xFFFFFFF +* Refin: False +* Refout: False +* Xorout: 0x0000000 +*****************************************************************************/ +uint32_t crc32_mpeg2(uint8_t *data, ulen_t length) +{ + uint8_t i; + uint32_t crc = 0xffffffff; // Initial value + while(length--) + { + crc ^= (uint32_t)(*data++) << 24; + for (i = 0; i < 8; ++i) + { + if ( crc & 0x80000000 ) + crc = (crc << 1) ^ 0x04C11DB7; + else + crc <<= 1; + } + } + return crc; +} diff --git a/modules/src/adpcm.c b/modules/src/adpcm.c new file mode 100644 index 0000000..73507d4 --- /dev/null +++ b/modules/src/adpcm.c @@ -0,0 +1,312 @@ +/* +** Intel/DVI ADPCM coder/decoder. +** +** The algorithm for this coder was taken from the IMA Compatability Project +** proceedings, Vol 2, Number 2; May 1992. +** +** Version 1.2, 18-Dec-92. +** +** Change log: +** - Fixed a stupid bug, where the delta was computed as +** stepsize*code/4 in stead of stepsize*(code+0.5)/4. +** - There was an off-by-one error causing it to pick +** an incorrect delta once in a blue moon. +** - The NODIVMUL define has been removed. Computations are now always done +** using shifts, adds and subtracts. It turned out that, because the standard +** is defined using shift/add/subtract, you needed bits of fixup code +** (because the div/mul simulation using shift/add/sub made some rounding +** errors that real div/mul don't make) and all together the resultant code +** ran slower than just using the shifts all the time. +** - Changed some of the variable names to be more meaningful. +*/ + +#include "adpcm.h" +#include "stdint.h" + +/* Intel ADPCM step variation table */ +const int8_t indexTable[16] = { + -1, -1, -1, -1, 2, 4, 6, 8, + -1, -1, -1, -1, 2, 4, 6, 8, +}; + +const uint16_t stepsizeTable[89] = { + 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, + 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, + 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, + 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, + 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, + 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, + 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358, + 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, + 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767 +}; + + +int adpcm_coder(short* indata, char* outdata, int len, struct adpcm_state* state) +{ + int val; /* Current input sample value */ + unsigned int delta; /* Current adpcm output value */ + int diff; /* Difference between val and valprev */ + int step; /* Stepsize */ + int valpred; /* Predicted output value */ + int vpdiff; /* Current change to valpred */ + int index; /* Current step change index */ + unsigned int outputbuffer = 0;/* place to keep previous 4-bit value */ + int count = 0; /* the number of bytes encoded */ + + valpred = state->valprev; + index = (int)state->index; + step = stepsizeTable[index]; + + while (len > 0) { + /* Step 1 - compute difference with previous value */ + val = *indata++; + diff = val - valpred; + if (diff < 0) + { + delta = 8; + diff = (-diff); + } + else + { + delta = 0; + } + + /* Step 2 - Divide and clamp */ + /* Note: + ** This code *approximately* computes: + ** delta = diff*4/step; + ** vpdiff = (delta+0.5)*step/4; + ** but in shift step bits are dropped. The net result of this is + ** that even if you have fast mul/div hardware you cannot put it to + ** good use since the fixup would be too expensive. + */ + vpdiff = (step >> 3); + + if (diff >= step) { + delta |= 4; + diff -= step; + vpdiff += step; + } + step >>= 1; + if (diff >= step) { + delta |= 2; + diff -= step; + vpdiff += step; + } + step >>= 1; + if (diff >= step) { + delta |= 1; + vpdiff += step; + } + + /* Phil Frisbie combined steps 3 and 4 */ + /* Step 3 - Update previous value */ + /* Step 4 - Clamp previous value to 16 bits */ + if ((delta & 8) != 0) + { + valpred -= vpdiff; + if (valpred < -32768) + valpred = -32768; + } + else + { + valpred += vpdiff; + if (valpred > 32767) + valpred = 32767; + } + + /* Step 5 - Assemble value, update index and step values */ + index += indexTable[delta]; + if (index < 0) index = 0; + else if (index > 88) index = 88; + step = stepsizeTable[index]; + + /* Step 6 - Output value */ + outputbuffer = (delta << 4); + + /* Step 1 - compute difference with previous value */ + val = *indata++; + diff = val - valpred; + if (diff < 0) + { + delta = 8; + diff = (-diff); + } + else + { + delta = 0; + } + + /* Step 2 - Divide and clamp */ + /* Note: + ** This code *approximately* computes: + ** delta = diff*4/step; + ** vpdiff = (delta+0.5)*step/4; + ** but in shift step bits are dropped. The net result of this is + ** that even if you have fast mul/div hardware you cannot put it to + ** good use since the fixup would be too expensive. + */ + vpdiff = (step >> 3); + + if (diff >= step) { + delta |= 4; + diff -= step; + vpdiff += step; + } + step >>= 1; + if (diff >= step) { + delta |= 2; + diff -= step; + vpdiff += step; + } + step >>= 1; + if (diff >= step) { + delta |= 1; + vpdiff += step; + } + + /* Phil Frisbie combined steps 3 and 4 */ + /* Step 3 - Update previous value */ + /* Step 4 - Clamp previous value to 16 bits */ + if ((delta & 8) != 0) + { + valpred -= vpdiff; + if (valpred < -32768) + valpred = -32768; + } + else + { + valpred += vpdiff; + if (valpred > 32767) + valpred = 32767; + } + + /* Step 5 - Assemble value, update index and step values */ + index += indexTable[delta]; + if (index < 0) index = 0; + else if (index > 88) index = 88; + step = stepsizeTable[index]; + + /* Step 6 - Output value */ + *outdata++ = (unsigned char)(delta | outputbuffer); + count++; + len -= 2; + } + + state->valprev = (short)valpred; + state->index = (char)index; + + return count; +} + +// 解码 +int adpcm_decoder(char* indata, short* outdata, int len, struct adpcm_state* state) +{ + unsigned int delta; /* Current adpcm output value */ + int step; /* Stepsize */ + int valpred; /* Predicted value */ + int vpdiff; /* Current change to valpred */ + int index; /* Current step change index */ + unsigned int inputbuffer = 0;/* place to keep next 4-bit value */ + int count = 0; + + valpred = state->valprev; + index = (int)state->index; + step = stepsizeTable[index]; + + /* Loop unrolling by Phil Frisbie */ + /* This assumes there are ALWAYS an even number of samples */ + while (len-- > 0) { + + /* Step 1 - get the delta value */ + inputbuffer = (unsigned int)*indata++; + delta = (inputbuffer >> 4) & 0xf;// &0xf 防止溢出 + + /* Step 2 - Find new index value (for later) */ + + index += indexTable[delta]; + if (index < 0) index = 0; + else if (index > 88) index = 88; + + + + /* Phil Frisbie combined steps 3, 4, and 5 */ + /* Step 3 - Separate sign and magnitude */ + /* Step 4 - Compute difference and new predicted value */ + /* Step 5 - clamp output value */ + /* + ** Computes 'vpdiff = (delta+0.5)*step/4', but see comment + ** in adpcm_coder. + */ + vpdiff = step >> 3; + if ((delta & 4) != 0) vpdiff += step; + if ((delta & 2) != 0) vpdiff += step >> 1; + if ((delta & 1) != 0) vpdiff += step >> 2; + + if ((delta & 8) != 0) + { + valpred -= vpdiff; + if (valpred < -32768) + valpred = -32768; + } + else + { + valpred += vpdiff; + if (valpred > 32767) + valpred = 32767; + } + + /* Step 6 - Update step value */ + step = stepsizeTable[index]; + + /* Step 7 - Output value */ + *outdata++ = (short)valpred; + + /* Step 1 - get the delta value */ + delta = inputbuffer & 0xf; + + /* Step 2 - Find new index value (for later) */ + index += indexTable[delta]; + if (index < 0) index = 0; + else if (index > 88) index = 88; + + /* Phil Frisbie combined steps 3, 4, and 5 */ + /* Step 3 - Separate sign and magnitude */ + /* Step 4 - Compute difference and new predicted value */ + /* Step 5 - clamp output value */ + /* + ** Computes 'vpdiff = (delta+0.5)*step/4', but see comment + ** in adpcm_coder. + */ + vpdiff = step >> 3; + if ((delta & 4) != 0) vpdiff += step; + if ((delta & 2) != 0) vpdiff += step >> 1; + if ((delta & 1) != 0) vpdiff += step >> 2; + + if ((delta & 8) != 0) + { + valpred -= vpdiff; + if (valpred < -32768) + valpred = -32768; + } + else + { + valpred += vpdiff; + if (valpred > 32767) + valpred = 32767; + } + + /* Step 6 - Update step value */ + step = stepsizeTable[index]; + + /* Step 7 - Output value */ + *outdata++ = (short)valpred; + count += 2; + } + + state->valprev = (short)valpred; + state->index = (char)index; + + return count; +} diff --git a/modules/src/btns.c b/modules/src/btns.c new file mode 100644 index 0000000..22534ac --- /dev/null +++ b/modules/src/btns.c @@ -0,0 +1,233 @@ +/** + **************************************************************************************** + * + * @file btns.c + * + * @brief Demo of Button Module via soft-timer. *User should override it* + * + **************************************************************************************** + */ + +#include +#include "string.h" +#include "sftmr.h" +#include "gpio.h" +#include "btns.h" + + +/* + * USER CUSTOMIZE + **************************************************************************************** + */ + +/// iopad of Btns, total number NB_BTNS not excced 8. +const uint8_t PA_BTNS[] = +{ + PA14, // btn0 + PA15, // btn1 +}; + +#define IO_BTNS (BIT(PA14) | BIT(PA15)) // *same PA_BTNS* +#define NB_BTNS sizeof(PA_BTNS) + +/// iopad input mode(pull-up or pull-down) +#define IE_MODE (IOM_INPUT | IOM_PULLUP) +#define IN_PRESS (0) // pull-up 1 -> 0 + +/// time for events +#define SCAN_INTV _MS(20) +#define TCNT_DCLK (_MS( 200) / SCAN_INTV) +#define TCNT_LONG (_MS(1000) / SCAN_INTV) +#define TCNT_LLONG (_MS(3000) / SCAN_INTV) + + +/* + * DEFINES + **************************************************************************************** + */ + +#define BTN(n) (1 << (n)) // Bit of Btn index + +#if !defined(TRIG_BTN) +#define TRIG_BTN (1) // Triggle Event: Press or Release +#endif +#if !defined(DCLK_BTN) +#define DCLK_BTN (1) // Double Click +#endif +#if !defined(LONG_BTN) +#define LONG_BTN (1) // Long Press +#endif + +typedef struct { + uint16_t tcnt :12; + uint16_t event: 4; +} btn_sta_t; + +typedef struct btn_env_tag { + btn_func_t func; // event call + uint8_t tmrid; // softTimer ID + uint8_t level; // gpio val + uint8_t keys; // real keys + uint8_t trig; // trigger + btn_sta_t state[NB_BTNS]; +} btn_env_t; + +/// global variables +static btn_env_t btn_env; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +static __forceinline void btns_io_init(void) +{ + GPIO_DIR_CLR(IO_BTNS); // OE=0 + + // enable input mode + for (uint8_t n = 0; n < NB_BTNS; n++) + { + iom_ctrl(PA_BTNS[n], IE_MODE); + } +} + +static __forceinline uint8_t btns_get_level(void) +{ + uint8_t level = 0; + uint32_t iostat = GPIO_PIN_GET() & IO_BTNS; + + for (uint8_t n = 0; n < NB_BTNS; n++) + { + if (((iostat >> PA_BTNS[n]) & 0x01) == IN_PRESS) + { + level |= BTN(n); + } + } + + return level; +} + +static void btns_scan(void) +{ + uint8_t level, keys; + + // debounce + level = btns_get_level(); // gpio value + keys = (level & btn_env.level) | ((level ^ btn_env.level) & btn_env.keys); // real value + + // trigger + btn_env.trig = keys ^ btn_env.keys; + btn_env.keys = keys; + btn_env.level = level; + + for (uint8_t n = 0; n < NB_BTNS; n++) + { + if (btn_env.keys & BTN(n)) // key press + { + if (btn_env.trig & BTN(n)) // on trig + { + #if (TRIG_BTN) + btn_env.func(n, BTN_PRESS); + #endif + + #if (DCLK_BTN) + if (btn_env.state[n].event == BTN_CLICK) + { + if (btn_env.state[n].tcnt < TCNT_DCLK) + { + btn_env.state[n].event = BTN_DCLICK; + } + } + else + #endif + { + btn_env.state[n].event = BTN_CLICK; + } + btn_env.state[n].tcnt = 0; + } + else + { + if (btn_env.state[n].event != BTN_IDLE) + { + btn_env.state[n].tcnt++; + #if (LONG_BTN) + if (btn_env.state[n].tcnt == TCNT_LONG) + { + btn_env.state[n].event = BTN_LONG; + btn_env.func(n, BTN_LONG); + } + else if (btn_env.state[n].tcnt >= TCNT_LLONG) + { + btn_env.state[n].event = BTN_IDLE; + btn_env.func(n, BTN_LLONG); + } + #endif + } + } + } + else // key release + { + if (btn_env.trig & BTN(n)) // on trig + { + #if (TRIG_BTN) + btn_env.func(n, BTN_RELEASE); + #endif + + #if (DCLK_BTN) + if (btn_env.state[n].event == BTN_DCLICK) + { + btn_env.state[n].event = BTN_IDLE; + btn_env.func(n, BTN_DCLICK); + } + #endif + btn_env.state[n].tcnt = 0; + } + else + { + if ((btn_env.state[n].event == BTN_CLICK) && (++btn_env.state[n].tcnt >= TCNT_DCLK)) + { + btn_env.state[n].event = BTN_IDLE; + btn_env.func(n, BTN_CLICK); + } + } + } + } +} + +static tmr_tk_t btns_timer_handler(tmr_id_t id) +{ + // peroid scan + btns_scan(); + + return SCAN_INTV; +} + +void btns_conf(btn_func_t hdl) +{ + // clear curr timer + if (btn_env.tmrid != TMR_ID_NONE) + { + sftmr_clear(btn_env.tmrid); + + memset(&btn_env, 0, sizeof(btn_env_t)); + //btn_env.tmrid = TMR_ID_NONE; + } + + if (hdl) + { + // update handler, start timer + btn_env.func = hdl; + btn_env.tmrid = sftmr_start(SCAN_INTV, btns_timer_handler); + } +} + +void btns_init(void) +{ + // init gpio + btns_io_init(); + + // init btn_env + memset(&btn_env, 0, sizeof(btn_env_t)); + //btn_env.tmrid = TMR_ID_NONE; +} diff --git a/modules/src/debug.c b/modules/src/debug.c new file mode 100644 index 0000000..aad64b5 --- /dev/null +++ b/modules/src/debug.c @@ -0,0 +1,76 @@ +/** + **************************************************************************************** + * + * @file debug.c + * + * @brief Debug Interface of Application + * + **************************************************************************************** + */ + +#include "dbg.h" + +#if (DBG_MODE == DBG_VIA_UART) +#include "uart.h" + +#if !defined(DBG_UART_BAUD) +#if (SYS_CLK == 1) + #define DBG_UART_BAUD BRR_DIV(115200, 32M) +#elif (SYS_CLK == 2) + #define DBG_UART_BAUD BRR_DIV(115200, 48M) +#elif (SYS_CLK == 3) + #define DBG_UART_BAUD BRR_DIV(115200, 64M) +#else + #define DBG_UART_BAUD (BRR_115200) +#endif //SYS_CLK +#endif + +#if !defined(DBG_UART_PORT) + #define DBG_UART_PORT (0) //UART1 +#endif +#if !defined(DBG_UART_TXD) + #define DBG_UART_TXD (6) //PA06 +#endif +#if !defined(DBG_UART_RXD) + #define DBG_UART_RXD (7) //PA07 +#endif + +#if !defined(DBG_HARDFAULT) + #define DBG_HARDFAULT (0) +#endif + +// mdk(__CC_ARM) & iar(__ICCARM__) +#if defined ( __CC_ARM ) || defined ( __ICCARM__ ) +int fputc(int ch, FILE *f) { + // Remap printf(...) to UART + uart_putc(DBG_UART_PORT, ch); + return ch; +} +#else +// gcc(__GNUC__) +int _write (int fd, char *ptr, int len) +{ + for( int i = 0; i < len; i++) + { + uart_putc(DBG_UART_PORT, ptr[i]); + } + + return len; +} +#endif + +void dbgInit(void) +{ + uart_init(DBG_UART_PORT, DBG_UART_TXD, DBG_UART_RXD); + uart_conf(DBG_UART_PORT, DBG_UART_BAUD, LCR_BITS_DFLT); + + #if (DBG_UART_RXEN) + uart_fctl(DBG_UART_PORT, FCR_FIFOEN_BIT | FCR_RXTL_8BYTE, 20, UART_IR_RXRD_BIT | UART_IR_RTO_BIT); + #endif + + #if (DBG_HARDFAULT) + trace_init(); + #endif +} + +#endif // (DBG_VIA_UART) diff --git a/modules/src/leds.c b/modules/src/leds.c new file mode 100644 index 0000000..e84e015 --- /dev/null +++ b/modules/src/leds.c @@ -0,0 +1,244 @@ +/** + **************************************************************************************** + * + * @file leds.c + * + * @brief Demo of LED Display via soft-timer. *User should override it* + * + **************************************************************************************** + */ + +#if (LED_PLAY) + +#include +#include "sftmr.h" +#include "gpio.h" +#include "leds.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +#define LED(n) (1 << (n)) // Bit of Led index +#define ON(n) (1 << (n)) // Bit of On state +#define OFF(n) (0 << (n)) // Bit of Off state +#if !defined(_MS) +#define _MS(n) ((n) / 10) // Time in uint of 10ms +#endif + +typedef struct { + uint8_t leds; // iopad bits: LED0~7 + uint8_t stat; // state bits: ON or OFF + uint16_t time; // hold times: _MS +} led_item_t; + +typedef struct { + const led_item_t* items; + uint8_t count; + uint8_t repeat; +} led_mode_t; + +typedef struct +{ + uint8_t tmrid; // soft-timer ID + uint8_t cidx; // curr item index + uint8_t mcurr; // curr led mode + uint8_t mlast; // last repeat mode +} led_env_t; + +/// global variables +static led_env_t led_env; + + +/* + * USER CUSTOMIZE + **************************************************************************************** + */ + +/// iopad of Leds, total number not excced 8. +const uint8_t PA_LEDS[] = +{ + PA08, // led0 + PA09, // led1 + PA10, // led2 +}; + +#define IO_LEDS (BIT(PA08) | BIT(PA09) | BIT(PA10)) // *same PA_LEDS* +#define NB_LEDS sizeof(PA_LEDS) + +/// set leds state, note polar (VCC-->LED-->IO) or (IO-->LED-->GND) +#define SET_LEDS_ON(bits) GPIO_DAT_CLR(bits) +#define SET_LEDS_OFF(bits) GPIO_DAT_SET(bits) + +/// slow blink mode +const led_item_t LED_SLOW_BL_ITEM[] = { + {LED(0)|LED(1)|LED(2), ON(0)|OFF(1)|ON(2), _MS(200)}, + {LED(0)|LED(2), OFF(0)|OFF(2), _MS(2000)} +}; + +/// fast blink mode +const led_item_t LED_FAST_BL_ITEM[] = { + {LED(0)|LED(1)|LED(2), ON(0)|OFF(1)|OFF(2), _MS(250)}, + {LED(0)|LED(2), OFF(0)|ON(2), _MS(250)}, +}; + +/// busy blink mode, more fast +const led_item_t LED_BUSY_BL_ITEM[] = { + {LED(0)|LED(1)|LED(2), OFF(0)|ON(1)|OFF(2), _MS(50)}, + {LED(0)|LED(1)|LED(2), OFF(0)|OFF(1)|OFF(2), _MS(50)}, +}; + +/// continued ON mode +const led_item_t LED_CONT_ON_ITEM[] = { + {LED(0)|LED(1)|LED(2), ON(0)|ON(1)|ON(2), 0}, +}; + +/// blink twice mode +const led_item_t LED_HINT_BL_ITEM[] = { + {LED(0), ON(0), _MS(100)}, + {LED(0), OFF(0), _MS(100)}, + {LED(0), ON(0), _MS(100)}, + {LED(0), OFF(0), _MS(100)} +}; + +/// modes table +#define LED_MODE(rep, mode) [mode]={mode##_ITEM, sizeof(mode##_ITEM)/sizeof(led_item_t), rep} + +const led_mode_t LED_MODE_TAB[] = +{ + LED_MODE(1, LED_SLOW_BL), + LED_MODE(1, LED_FAST_BL), + LED_MODE(1, LED_BUSY_BL), + LED_MODE(1, LED_CONT_ON), + LED_MODE(0, LED_HINT_BL), +}; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +/// gpio as output enable +static __forceinline void leds_io_init(void) +{ + SET_LEDS_OFF(IO_LEDS); + GPIO_DIR_SET(IO_LEDS); +} + +/// set curidx state +static uint16_t leds_set_state(uint8_t patt, uint8_t idx) +{ + const led_item_t *item = &(LED_MODE_TAB[patt].items[idx]); + uint8_t leds = item->leds; + uint8_t stat = item->stat; + + #if (LED_GROUP) + uint32_t iomsk = 0; + uint32_t iosta = 0; + + for (uint8_t n = 0; n < NB_LEDS; n++) + { + if (leds & LED(n)) + { + iomsk |= BIT(PA_LEDS[n]); + iosta |= ((stat >> n) & 1UL) << PA_LEDS[n]; + } + } + + // set together + SET_LEDS_ON(iosta); + SET_LEDS_OFF(iomsk ^ iosta); + #else + for (uint8_t n = 0; n < NB_LEDS; n++) + { + // set one by one + if (leds & LED(n)) + { + if (stat & ON(n)) + SET_LEDS_ON(BIT(PA_LEDS[n])); + else + SET_LEDS_OFF(BIT(PA_LEDS[n])); + } + } + #endif + + return item->time; +} + +static tmr_tk_t leds_timer_handler(tmr_id_t id) +{ + // update mode index + led_env.cidx++; + if (led_env.cidx >= LED_MODE_TAB[led_env.mcurr].count) + { + led_env.cidx = 0; + + if (!LED_MODE_TAB[led_env.mcurr].repeat) + { + if (led_env.mlast == LED_MODE_MAX) + { + led_env.tmrid = TMR_ID_NONE; // over to free + return 0; + } + + // recover last repeat-mode + led_env.mcurr = led_env.mlast; + } + } + + // set leds state + tmr_tk_t time = leds_set_state(led_env.mcurr, led_env.cidx); + if (time == 0) + { + led_env.tmrid = TMR_ID_NONE; // over to free + return 0; + } + + return time; +} + +void leds_play(uint8_t mode) +{ + if ((mode >= LED_MODE_MAX) || (mode == led_env.mcurr)) + return; + + // clear curr timer + if (led_env.tmrid != TMR_ID_NONE) + { + sftmr_clear(led_env.tmrid); + led_env.tmrid = TMR_ID_NONE; + } + + // record last repeat-mode + if ((led_env.mcurr != LED_MODE_MAX) && (LED_MODE_TAB[led_env.mcurr].repeat)) + { + led_env.mlast = led_env.mcurr; + } + + // update mode, start timer if need + led_env.mcurr = mode; + led_env.cidx = 0; + + tmr_tk_t time = leds_set_state(led_env.mcurr, led_env.cidx); + if (time) + { + led_env.tmrid = sftmr_start(time, leds_timer_handler); + } +} + +void leds_init(void) +{ + // init gpio + leds_io_init(); + + // init led_env + led_env.tmrid = TMR_ID_NONE; + led_env.cidx = 0; + led_env.mcurr = LED_MODE_MAX; + led_env.mlast = LED_MODE_MAX; +} + +#endif //LED_PLAY diff --git a/modules/src/revbit.c b/modules/src/revbit.c new file mode 100644 index 0000000..ede6b23 --- /dev/null +++ b/modules/src/revbit.c @@ -0,0 +1,105 @@ +/** + **************************************************************************************** + * + * @file revbit.c + * + * @brief Reversing the bits in an integer v. + * + **************************************************************************************** + */ + +#include +#include + + +uint8_t revbit8(uint8_t v) +{ + #if (OPTM_SIZE) + uint8_t t = 0; + + for (uint32_t i = 0; i < 8; i++) + { + t |= ((v >> i) & 0x01) << (7 - i); + } + + return t; + #else + v = (((v >> 1) & 0x55) | ((v & 0x55) << 1)); + v = (((v >> 2) & 0x33) | ((v & 0x33) << 2)); + + return ((v >> 4) | (v << 4)); + #endif +} + +uint16_t revbit16(uint16_t v) +{ + #if (OPTM_SIZE) + uint16_t t = 0; + + for (uint32_t i = 0; i < 16; i++) + { + t |= ((v >> i) & 0x01) << (15 - i); + } + + return t; + #else + v = (((v >> 1) & 0x5555) | ((v & 0x5555) << 1)); + v = (((v >> 2) & 0x3333) | ((v & 0x3333) << 2)); + v = (((v >> 4) & 0x0f0f) | ((v & 0x0f0f) << 4)); + + return ((v >> 8) | (v << 8)); + #endif +} + +uint32_t revbit24(uint32_t v) +{ + #if (OPTM_SIZE) + uint32_t t = 0; + + for (uint32_t i = 0; i < 24; i++) + { + t |= ((v >> i) & 0x01) << (23 - i); + } + + return t; + #else + v = (((v >> 1) & 0x555555) | ((v & 0x555555) << 1)); + v = (((v >> 2) & 0x333333) | ((v & 0x333333) << 2)); + v = (((v >> 4) & 0x0f0f0f) | ((v & 0x0f0f0f) << 4)); + + return (((v >> 16) & 0x0000ff) | ((v & 0x0000ff) << 16) | (v & 0x00ff00)); + #endif +} + +uint32_t revbit32(uint32_t v) +{ + #if (OPTM_SIZE) + uint32_t t = 0; + + for (uint32_t i = 0; i < 32; i++) + { + t |= ((v >> i) & 0x01) << (31 - i); + } + + return t; + #else + v = (((v >> 1) & 0x55555555) | ((v & 0x55555555) << 1)); + v = (((v >> 2) & 0x33333333) | ((v & 0x33333333) << 2)); + v = (((v >> 4) & 0x0f0f0f0f) | ((v & 0x0f0f0f0f) << 4)); + v = (((v >> 8) & 0x00ff00ff) | ((v & 0x00ff00ff) << 8)); + + return ((v >> 16) | (v << 16)); + #endif +} + +uint32_t revbit(uint8_t n, uint32_t v) +{ + uint32_t t = 0; + + for (uint32_t i = 0; i < n; i++) + { + t |= ((v >> i) & 0x01) << (n - 1 - i); + } + + return t; +} diff --git a/modules/src/sftmr.c b/modules/src/sftmr.c new file mode 100644 index 0000000..6e0e7f3 --- /dev/null +++ b/modules/src/sftmr.c @@ -0,0 +1,332 @@ +/** + **************************************************************************************** + * + * @file sftmr.h + * + * @brief Demo of Soft Timer Module. *User should override it* + * + **************************************************************************************** + */ + +#include +#include "string.h" +#include "b6x.h" +#include "sftmr.h" + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// Number of Soft-Timer Instances +#if !defined(SFTMR_NUM) +#define SFTMR_NUM (4) +#endif + +#if (SFTMR_NUM > 15) + #error "Number of Soft-Timer instances exceed 'field' bits(@see struct sftmr_env_tag)" +#endif + +/// Timer Source - Interrupt Mode(SysTick, CTMR) +#define TMS_SysTick 0 +#define TMS_CTMR 1 +/// Timer Source - Polling Mode(BLE, RTC), Run in background when core in sleep. +#define TMS_BLE 2 +#define TMS_RTC 3 + +#if !defined(SFTMR_SRC) +#define SFTMR_SRC (TMS_SysTick) +#endif + +/// Tick add operation +#define TMR_TICK_ADD(tk1, tk2) (((tk1) + (tk2)) & SFTMR_TICKS_MSK) +/// Tick timeout arrived +#define TMR_TICK_OUT(now, out) ((tmr_tk_t)((now) - (out)) <= SFTMR_DELAY_MAX) + +/// Timer ID valid +#define TMR_ID_VALID(tmid) (((tmid) > 0) && ((tmid) <= SFTMR_NUM)) +/// Timer TK range +#define TMR_TK_RANGE(delay) ((delay) = ((delay) > SFTMR_DELAY_MAX) ? SFTMR_DELAY_MAX : (delay)) + +/// Timer interrupt flag bit, MSB of 'sftmr_env.field' +#define TMR_SRC_IFLG_BIT (1 << 15) + +/// Soft-Timer environment structure +typedef struct sftmr_env_tag +{ + // timer tick of source + volatile tmr_tk_t ticks; + // timer field of each instance + uint16_t field; + + // timer tables of func and time + tmr_cb_t func[SFTMR_NUM]; + tmr_tk_t time[SFTMR_NUM]; +} sftmr_env_t; + +/// global variables +static struct sftmr_env_tag sftmr_env; + + +/* + * TIMER DRIVER + **************************************************************************************** + */ + +/// Interrupt Mode Timer (SysTick, ) +#if ((SFTMR_SRC == TMS_CTMR) || (SFTMR_SRC == TMS_SysTick)) + +static __forceinline void _timer_irq(void) +{ + ++sftmr_env.ticks; + sftmr_env.field |= TMR_SRC_IFLG_BIT; +} + +static __forceinline bool _timer_arise(void) +{ + if (sftmr_env.field & TMR_SRC_IFLG_BIT) + { + sftmr_env.field &= ~TMR_SRC_IFLG_BIT; + return true; + } + return false; +} + +#if (SFTMR_SRC == TMS_CTMR) +#include "timer.h" + +/// CTMR prescaler and Auto-reload value +#if !defined(TMS_CTMR_PSC) + #define TMS_CTMR_PSC (159) // 159=(16MHz/100000 - 1), 10us +#endif +#if !defined(TMS_CTMR_ARR) + #define TMS_CTMR_ARR (999) // 999=(1000 - 1), 1000x10us=10ms +#endif + +// configure as auto-reload and update interrupt +static __forceinline void _timer_init(void) +{ + ctmr_init(TMS_CTMR_PSC, TMS_CTMR_ARR); + ctmr_ctrl(TMR_PERIOD_MODE, TMR_IR_UI_BIT); + + NVIC_EnableIRQ(CTMR_IRQn); +} + +void CTMR_IRQHandler(void) +{ + // Disable UI Interrupt + CTMR->IDR.Word = TMR_IR_UI_BIT; + + if (CTMR->RIF.Word & TMR_IR_UI_BIT) + { + // Clear Interrupt Flag + CTMR->ICR.Word = TMR_IR_UI_BIT; + + _timer_irq(); + } + + // Enable UI Interrupt + CTMR->IER.Word = TMR_IR_UI_BIT; +} + +#elif (SFTMR_SRC == TMS_SysTick) + +#if !defined(TMS_SysTick_ARR) + #define TMS_SysTick_ARR (16 * 10000) // 10ms(16MHz CLK) +#endif + +// SysTick configure +static __forceinline void _timer_init(void) +{ + SysTick_Config(TMS_SysTick_ARR); +} + +void SysTick_Handler(void) +{ + _timer_irq(); +} +#endif + +#elif ((SFTMR_SRC == TMS_BLE) || (SFTMR_SRC == TMS_RTC)) +/// Polling Mode Timer (BLE, RTC) + +#if (SFTMR_SRC == TMS_BLE) +#include "bledef.h" + +static __forceinline uint16_t _timer_tick(void) +{ + // 10ms = 312.5us * 32 + return (uint16_t)((ble_time_get() + 16) >> 5); +} + +static __forceinline void _timer_init(void) +{ + // Must Call ble_init() before here! + + // Retrieve curr ticks + sftmr_env.ticks = _timer_tick(); +} + +#elif (SFTMR_SRC == TMS_RTC) +#include "rtc.h" + +static __forceinline uint16_t _timer_tick(void) +{ + rtc_time_t time = rtc_time_get(); + + return (uint16_t)((time.sec * 1000 + time.ms) / 10); +} + +static __forceinline void _timer_init(void) +{ + // Enable RTC first + rtc_conf(true); + + // Retrieve curr ticks + sftmr_env.ticks = _timer_tick(); +} +#endif + +static __forceinline bool _timer_arise(void) +{ + uint16_t ticks = _timer_tick(); + + if (ticks != sftmr_env.ticks) + { + sftmr_env.ticks = ticks; + return true; + } + + return false; +} +#endif + + +/* + * EXPORT FUNCTIONS + **************************************************************************************** + */ + +/// Init timer source +void sftmr_init(void) +{ + // clear env + sftmr_env.ticks = 0; + sftmr_env.field = 0; + + // init timer + _timer_init(); +} + +/// Schedule timer event of callback. +void sftmr_schedule(void) +{ + if (!_timer_arise()) + return; + + if (sftmr_env.field) + { + tmr_tk_t now = sftmr_env.ticks; + + for (tmr_id_t idx = 0; idx < SFTMR_NUM; idx++) + { + if (sftmr_env.field & (1 << idx)) + { + // Call func, if time has arrived + if ((sftmr_env.func[idx] != NULL) && (TMR_TICK_OUT(now, sftmr_env.time[idx]))) + { + tmr_tk_t delay = (sftmr_env.func[idx])(idx + 1); + + if (delay > 0) + { + // continue mode, reload + sftmr_env.time[idx] = TMR_TICK_ADD(now, delay); + } + else + { + // single mode, stop + sftmr_env.field &= ~(1 << idx); + //sftmr_env.func[idx] = NULL; + } + } + } + } + } +} + +/// Find free/unused timer +static __forceinline tmr_id_t find_free_tmr(void) +{ + for (tmr_id_t idx = 0; idx < SFTMR_NUM; idx++) + { + if (((sftmr_env.field & (1 << idx)) == 0) /*&& (sftmr_env.func[idx] == NULL)*/) + { + return idx + 1; // found timer + } + } + + return 0; +} + +/// Start timer, callback 'func' after 'delay' ticks post. +tmr_id_t sftmr_start(tmr_tk_t delay, tmr_cb_t func) +{ + tmr_id_t tmr_id = find_free_tmr(); + + if (func && tmr_id) + { + tmr_id_t idx = tmr_id - 1; + + TMR_TK_RANGE(delay); + + // set delay time, enable timer + sftmr_env.func[idx] = func; + sftmr_env.time[idx] = TMR_TICK_ADD(sftmr_env.ticks, delay); + sftmr_env.field |= (1 << idx); + } + + return tmr_id; +} + +// ˢ¶ʱʱ +void sftmr_Refresh(tmr_id_t tmr_id, tmr_tk_t delay) +{ + if (TMR_ID_VALID(tmr_id)){ + tmr_id_t idx = tmr_id - 1; + TMR_TK_RANGE(delay); + // set delay time, enable timer + sftmr_env.time[idx] = TMR_TICK_ADD(sftmr_env.ticks, delay); + sftmr_env.field |= (1 << idx); + } +} + +/// Clear/Free 'tmr_id' timer instance +void sftmr_clear(tmr_id_t tmr_id) +{ + if (TMR_ID_VALID(tmr_id)) + { + tmr_id_t idx = tmr_id - 1; + + sftmr_env.field &= ~(1 << idx); + sftmr_env.func[idx] = NULL; + } +} + +/// Get current ticks +tmr_tk_t sftmr_tick(void) +{ + return sftmr_env.ticks; +} + +/// Blocking to wait 'delay' ticks arrived +void sftmr_wait(tmr_tk_t delay) +{ + tmr_tk_t time = TMR_TICK_ADD(sftmr_env.ticks, delay); + + // Wait time arrived, should keep schedule + while (!TMR_TICK_OUT(sftmr_env.ticks, time)) + { + sftmr_schedule(); + } +} diff --git a/modules/src/uart1Rb.c b/modules/src/uart1Rb.c new file mode 100644 index 0000000..fa5ef81 --- /dev/null +++ b/modules/src/uart1Rb.c @@ -0,0 +1,125 @@ +/** + **************************************************************************************** + * + * @file uart1Rb.c + * + * @brief Demo of UART1 Interrupt-Mode with RingBuffer. *User should override it* + * + **************************************************************************************** + */ + +#include +#include "b6x.h" +#include "uartRb.h" + +#if (USE_UART1) // Remove UARTx_IRQHandler if unused + +/* + * DEFINES + **************************************************************************************** + */ + +#if !defined(UART1_RBUF_SIZE) + #define UART1_RBUF_SIZE 0x100 +#endif + +#if !defined(UART1_CONF_LCRS) + #define UART1_CONF_LCRS LCR_BITS(8, 1, none) //default +#endif + +#if !defined(UART1_CONF_BAUD) +#if (SYS_CLK == 1) + #define UART1_CONF_BAUD BRR_DIV(115200, 32M) +#elif (SYS_CLK == 2) + #define UART1_CONF_BAUD BRR_DIV(115200, 48M) +#elif (SYS_CLK == 3) + #define UART1_CONF_BAUD BRR_DIV(115200, 64M) +#else + #define UART1_CONF_BAUD BRR_115200 +#endif //SYS_CLK +#endif + +#define UART1_FIFO_RXTL 8 + + +/* + * IMPORT MODULES + **************************************************************************************** + */ + +#undef RBUF_SIZE +#define RBUF_SIZE UART1_RBUF_SIZE +#include "rbuf.h" + +/// RingBuffer for UART1 +static rbuf_t uart1RbRx; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +void uart1Rb_Init(void) +{ + // uart init & conf + uart_init(UART1_PORT, PA_UART1_TX, PA_UART1_RX); + uart_conf(UART1_PORT, UART1_CONF_BAUD, UART1_CONF_LCRS); + + // enable uart IR + uart_fctl(UART1_PORT, FCR_FIFOEN_BIT | FCR_RXTL_8BYTE, + 20/*bits_rto*/, UART_IR_RXRD_BIT | UART_IR_RTO_BIT); + + // empty buffer + rbuf_init(&uart1RbRx); + + NVIC_EnableIRQ(UART1_IRQn); +} + +void uart1Rb_Reset(void) +{ + rbuf_init(&uart1RbRx); +} + +uint16_t uart1Rb_Len(void) +{ + return rbuf_len(&uart1RbRx); +} + +uint16_t uart1Rb_Read(uint8_t *buff, uint16_t max) +{ + return rbuf_gets(&uart1RbRx, buff, max); +} + +void UART1_IRQHandler(void) +{ + uint32_t state = UART1->IFM.Word; // UART1->RIF.Word; + + if (state & 0x01) //(BIT_RXRD) + { + UART1->IDR.RXRD = 1; // Disable RXRD Interrupt + + for (uint8_t i = 0; i < UART1_FIFO_RXTL; i++) + { + rbuf_putc(&uart1RbRx, UART1->RBR); + } + + UART1->ICR.RXRD = 1; // Clear RXRD Interrupt Flag + UART1->IER.RXRD = 1; // Enable RXRD Interrupt + } + + if (state & 0x10) //(BIT_RTO) + { + UART1->IDR.RTO = 1; // Disable RTO Interrupt + + while (UART1->SR.RFNE) + { + rbuf_putc(&uart1RbRx, UART1->RBR); + } + + UART1->ICR.RTO = 1; // Clear RTO Interrupt Flag + UART1->IER.RTO = 1; // Enable RTO Interrupt + } +} + +#endif //(USE_UART1) diff --git a/modules/src/uart2Rb.c b/modules/src/uart2Rb.c new file mode 100644 index 0000000..b5d0070 --- /dev/null +++ b/modules/src/uart2Rb.c @@ -0,0 +1,125 @@ +/** + **************************************************************************************** + * + * @file uart2Rb.c + * + * @brief Demo of UART2 Interrupt-Mode with RingBuffer. *User should override it* + * + **************************************************************************************** + */ + +#include +#include "b6x.h" +#include "uartRb.h" + +#if (USE_UART2) // Remove UARTx_IRQHandler if unused + +/* + * DEFINES + **************************************************************************************** + */ + +#if !defined(UART2_RBUF_SIZE) + #define UART2_RBUF_SIZE 0x100 +#endif + +#if !defined(UART2_CONF_LCRS) + #define UART2_CONF_LCRS LCR_BITS(8, 1, none) //default +#endif + +#if !defined(UART2_CONF_BAUD) +#if (SYS_CLK == 1) + #define UART2_CONF_BAUD BRR_DIV(115200, 32M) +#elif (SYS_CLK == 2) + #define UART2_CONF_BAUD BRR_DIV(115200, 48M) +#elif (SYS_CLK == 3) + #define UART2_CONF_BAUD BRR_DIV(115200, 64M) +#else + #define UART2_CONF_BAUD BRR_115200 +#endif //SYS_CLK +#endif + +#define UART2_FIFO_RXTL 8 + + +/* + * IMPORT MODULES + **************************************************************************************** + */ + +#undef RBUF_SIZE +#define RBUF_SIZE UART2_RBUF_SIZE +#include "rbuf.h" + +/// RingBuffer for UART2 +static rbuf_t uart2RbRx; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +void uart2Rb_Init(void) +{ + // uart init & conf + uart_init(UART2_PORT, PA_UART2_TX, PA_UART2_RX); + uart_conf(UART2_PORT, UART2_CONF_BAUD, UART2_CONF_LCRS); + + // enable uart IR + uart_fctl(UART2_PORT, FCR_FIFOEN_BIT | FCR_RXTL_8BYTE, + 20/*bits_rto*/, UART_IR_RXRD_BIT | UART_IR_RTO_BIT); + + // empty buffer + rbuf_init(&uart2RbRx); + + NVIC_EnableIRQ(UART2_IRQn); +} + +void uart2Rb_Reset(void) +{ + rbuf_init(&uart2RbRx); +} + +uint16_t uart2Rb_Len(void) +{ + return rbuf_len(&uart2RbRx); +} + +uint16_t uart2Rb_Read(uint8_t *buff, uint16_t max) +{ + return rbuf_gets(&uart2RbRx, buff, max); +} + +void UART2_IRQHandler(void) +{ + uint32_t state = UART2->IFM.Word; // UART2->RIF.Word; + + if (state & 0x01) //(BIT_RXRD) + { + UART2->IDR.RXRD = 1; // Disable RXRD Interrupt + + for (uint8_t i = 0; i < UART2_FIFO_RXTL; i++) + { + rbuf_putc(&uart2RbRx, UART2->RBR); + } + + UART2->ICR.RXRD = 1; // Clear RXRD Interrupt Flag + UART2->IER.RXRD = 1; // Enable RXRD Interrupt + } + + if (state & 0x10) //(BIT_RTO) + { + UART2->IDR.RTO = 1; // Disable RTO Interrupt + + while (UART2->SR.RFNE) + { + rbuf_putc(&uart2RbRx, UART2->RBR); + } + + UART2->ICR.RTO = 1; // Clear RTO Interrupt Flag + UART2->IER.RTO = 1; // Enable RTO Interrupt + } +} + +#endif //(USE_UART2) diff --git a/projects/bleAdv_change/mdk/JLinkSettings.ini b/projects/bleAdv_change/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/projects/bleAdv_change/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/projects/bleAdv_change/mdk/bleAdv_change.uvoptx b/projects/bleAdv_change/mdk/bleAdv_change.uvoptx new file mode 100644 index 0000000..ca972f8 --- /dev/null +++ b/projects/bleAdv_change/mdk/bleAdv_change.uvoptx @@ -0,0 +1,515 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + bleAdv_change + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC1000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 2 + 1 + 0x18004000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\src\myapp.c + myapp.c + 0 + 0 + + + 2 + 5 + 1 + 0 + 0 + 0 + ..\src\proc.c + proc.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 6 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 7 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + modules + 1 + 0 + 0 + 0 + + 4 + 8 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\leds.c + leds.c + 0 + 0 + + + 4 + 9 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\sftmr.c + sftmr.c + 0 + 0 + + + 4 + 10 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\uart1Rb.c + uart1Rb.c + 0 + 0 + + + + + ble\app + 1 + 0 + 0 + 0 + + 5 + 11 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app.c + app.c + 0 + 0 + + + 5 + 12 + 1 + 0 + 0 + 0 + ..\src\app_actv.c + app_actv.c + 0 + 0 + + + 5 + 13 + 1 + 0 + 0 + 0 + ..\src\app_msg.c + app_msg.c + 0 + 0 + + + 5 + 14 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gapm.c + app_gapm.c + 0 + 0 + + + 5 + 15 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gapc.c + app_gapc.c + 0 + 0 + + + 5 + 16 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gatt.c + app_gatt.c + 0 + 0 + + + + + ble\prf + 1 + 0 + 0 + 0 + + 6 + 17 + 1 + 0 + 0 + 0 + ..\..\..\ble\prf\prf_diss.c + prf_diss.c + 0 + 0 + + + 6 + 18 + 1 + 0 + 0 + 0 + ..\..\..\ble\prf\prf_sess.c + prf_sess.c + 0 + 0 + + + + + ble\lib + 1 + 0 + 0 + 0 + + 7 + 19 + 4 + 0 + 0 + 0 + ..\..\..\ble\lib\ble6.lib + ble6.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 8 + 20 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/projects/bleAdv_change/mdk/bleAdv_change.uvprojx b/projects/bleAdv_change/mdk/bleAdv_change.uvprojx new file mode 100644 index 0000000..bfb0f6b --- /dev/null +++ b/projects/bleAdv_change/mdk/bleAdv_change.uvprojx @@ -0,0 +1,530 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + bleAdv_change + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + bleAdv_change + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --thumb --gnu --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip_ble.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + myapp.c + 1 + ..\src\myapp.c + + + proc.c + 1 + ..\src\proc.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + modules + + + leds.c + 1 + ..\..\..\modules\src\leds.c + + + sftmr.c + 1 + ..\..\..\modules\src\sftmr.c + + + uart1Rb.c + 1 + ..\..\..\modules\src\uart1Rb.c + + + + + ble\app + + + app.c + 1 + ..\..\..\ble\app\app.c + + + app_actv.c + 1 + ..\src\app_actv.c + + + app_msg.c + 1 + ..\src\app_msg.c + + + app_gapm.c + 1 + ..\..\..\ble\app\app_gapm.c + + + app_gapc.c + 1 + ..\..\..\ble\app\app_gapc.c + + + app_gatt.c + 1 + ..\..\..\ble\app\app_gatt.c + + + + + ble\prf + + + prf_diss.c + 1 + ..\..\..\ble\prf\prf_diss.c + + + prf_sess.c + 1 + ..\..\..\ble\prf\prf_sess.c + + + + + ble\lib + + + ble6.lib + 4 + ..\..\..\ble\lib\ble6.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/projects/bleAdv_change/mdk/clean.bat b/projects/bleAdv_change/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/projects/bleAdv_change/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/projects/bleAdv_change/src/app_actv.c b/projects/bleAdv_change/src/app_actv.c new file mode 100644 index 0000000..6e5d8ae --- /dev/null +++ b/projects/bleAdv_change/src/app_actv.c @@ -0,0 +1,904 @@ +/** + **************************************************************************************** + * + * @file app_actv.c + * + * @brief Application Activity(Advertising, Scanning and Initiating) - Example + * + * < If want to modify it, recommend to copy the file to 'user porject'/src > + **************************************************************************************** + */ + +#include "drvs.h" +#include "app.h" +#include "gapm_api.h" + +#if (DBG_ACTV) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Index & State of activities - User Customize +struct actv_env_tag +{ + #if (BLE_EN_ADV) + /// Advertising index and state + uint8_t advidx; + uint8_t advsta; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + /// Scanning index and state + uint8_t scanidx; + uint8_t scansta; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + /// Initiating index and state + uint8_t initidx; + uint8_t initsta; + #endif //(BLE_EN_INIT) +}; + +/// Activities environment +struct actv_env_tag actv_env; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @section Advertising Activity - Example for User Customize + * enable via pre-define @see BLE_EN_ADV + **************************************************************************************** + */ +#if (BLE_EN_ADV) + +#undef DEBUG +#if (DBG_ACTV) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// Advertising duration - 0 mean Always ON (in multiple of 10ms) +#if !defined(APP_ADV_DURATION) + #define APP_ADV_DURATION (0) +#endif + +/// Advertising channel map - 37, 38, 39 +#if !defined(APP_ADV_CHMAP) + #define APP_ADV_CHMAP (0x07) +#endif + +/// Advertising minimum interval - (n)*0.625ms +#if !defined(APP_ADV_INT_MIN) + #define APP_ADV_INT_MIN (64) +#endif + +/// Advertising maximum interval - (n)*0.625ms +#if !defined(APP_ADV_INT_MAX) + #define APP_ADV_INT_MAX (160) +#endif + +#if (APP_ADV_INT_MIN > APP_ADV_INT_MAX) + #error "ADV_INT_MIN must not exceed ADV_INT_MAX" +#endif + +/// Fast advertising interval +#define APP_ADV_FAST_INT (32) + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +static void app_adv_create(void) +{ + struct gapm_adv_create_param adv_param; + + // Advertising type (@see enum gapm_adv_type) + adv_param.type = GAPM_ADV_TYPE_LEGACY; + // Discovery mode (@see enum gapm_adv_disc_mode) + adv_param.disc_mode = GAPM_ADV_MODE_GEN_DISC; + // Advertising properties (@see enum gapm_adv_prop) + adv_param.prop = GAPM_ADV_PROP_UNDIR_CONN_MASK; + + // Filtering policy (@see enum gapm_adv_filter_policy) + adv_param.filter_pol = GAPM_ADV_ALLOW_SCAN_ANY_CON_ANY; + // Config primary advertising (@see gapm_adv_prim_cfg) + adv_param.prim_cfg.phy = GAP_PHY_LE_1MBPS; + adv_param.prim_cfg.chnl_map = APP_ADV_CHMAP; + adv_param.prim_cfg.adv_intv_min = APP_ADV_INT_MIN; + adv_param.prim_cfg.adv_intv_max = APP_ADV_INT_MAX; + + DEBUG("create(disc:%d,prop:%d)\r\n", adv_param.disc_mode, adv_param.prop); + + gapm_create_advertising(GAPM_STATIC_ADDR, &adv_param); +} + +uint32_t g_rand_num; + +static void app_adv_set_adv_data(void) +{ + // Reserve 3Bytes for AD_TYPE_FLAGS + uint8_t adv_data[GAP_ADV_DATA_LEN]; + uint8_t length = 9; + + g_rand_num = sadc_rand_num(); + + // Set flags: 3B + adv_data[0] = 0x02; + adv_data[1] = GAP_AD_TYPE_FLAGS; + adv_data[2] = 0x06; + + adv_data[3] = 0x05; + adv_data[4] = GAP_AD_TYPE_MANU_SPECIFIC_DATA; + write32p(adv_data + 5, g_rand_num); + + gapm_set_adv_data(actv_env.advidx, GAPM_SET_ADV_DATA, length, adv_data); +} + +static void app_adv_set_scan_rsp(void) +{ + uint8_t length; + uint8_t rsp_data[DEV_NAME_MAX_LEN+2]; + + // Set device name + length = app_name_get(DEV_NAME_MAX_LEN, &rsp_data[2]); + rsp_data[0] = length + 6; + rsp_data[1] = GAP_AD_TYPE_COMPLETE_NAME; // 0x09 + length += 2; + + rsp_data[length++] = '-'; + rsp_data[length++] = co_hex((g_rand_num >> 12) & 0x0F); + rsp_data[length++] = co_hex((g_rand_num >> 8) & 0x0F); + rsp_data[length++] = co_hex((g_rand_num >> 4) & 0x0F); + rsp_data[length++] = co_hex((g_rand_num >> 0) & 0x0F); + + gapm_set_adv_data(actv_env.advidx, GAPM_SET_SCAN_RSP_DATA, length, rsp_data); +} + +/** + **************************************************************************************** + * @brief Action/Command of Advertising + * + * @param[in] actv_op Operation of activity + **************************************************************************************** + */ +void app_adv_action(uint8_t actv_op) +{ + switch (actv_op) + { + case ACTV_CREATE: + { + if (actv_env.advsta == ACTV_STATE_OFF) + { + //DEBUG("Creating"); + app_adv_create(); + actv_env.advsta = ACTV_STATE_CREATE; + } + } break; + + case ACTV_START: + { + if (actv_env.advsta == ACTV_STATE_READY) + { + DEBUG("Starting"); + gapm_start_advertising(actv_env.advidx, APP_ADV_DURATION); + actv_env.advsta = ACTV_STATE_START; + } + } break; + + case ACTV_STOP: + { + if (actv_env.advsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_STOP; + } + } break; + + case ACTV_DELETE: + { + if ((actv_env.advsta != ACTV_STATE_OFF) && (actv_env.advsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_OFF; + } + } break; + + case ACTV_RELOAD: + { + if (actv_env.advsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_STOP; + } + + if ((actv_env.advsta != ACTV_STATE_OFF) && (actv_env.advsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_OFF; + } + + app_adv_create(); + actv_env.advsta = ACTV_STATE_CREATE; + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Event Procedure of Advertising + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_adv_event(uint8_t gapm_op, uint8_t status) +{ + DEBUG("Evt(op:0x%X,sta:0x%X)", gapm_op, status); + + switch (gapm_op) + { + case (GAPM_CREATE_ADV_ACTIVITY): + { + app_adv_set_adv_data(); + } break; + + case (GAPM_SET_ADV_DATA): + { + app_adv_set_scan_rsp(); + } break; + + case (GAPM_SET_SCAN_RSP_DATA): + { + actv_env.advsta = ACTV_STATE_READY; + + app_adv_action(ACTV_START); + app_state_set(APP_READY); + } break; + + case (GAPM_STOP_ACTIVITY): + { + if ((actv_env.advsta == ACTV_STATE_START) || (actv_env.advsta == ACTV_STATE_STOP)) + { + actv_env.advsta = ACTV_STATE_READY; + } + } break; + + default: + break; + } +} + +#endif //(BLE_EN_ADV) + + +/** + **************************************************************************************** + * @section Scanning Activity - Example for User Customize + * enable via pre-define @see BLE_EN_SCAN + **************************************************************************************** + */ +#if (BLE_EN_SCAN) + +#undef DEBUG +#if (DBG_ACTV) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +#define SCAN_NUM_MAX (5) + +uint8_t scan_cnt = 0; +struct gap_bdaddr scan_addr_list[SCAN_NUM_MAX]; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +static void app_start_scanning(void) +{ + struct gapm_scan_param scan_param; + + /// Type of scanning to be started (@see enum gapm_scan_type) + scan_param.type = GAPM_SCAN_TYPE_CONN_DISC; + /// Properties for the scan procedure (@see enum gapm_scan_prop) + scan_param.prop = GAPM_SCAN_PROP_PHY_1M_BIT | GAPM_SCAN_PROP_ACTIVE_1M_BIT | GAPM_SCAN_PROP_FILT_TRUNC_BIT; + /// Duplicate packet filtering policy (@see enum gapm_dup_filter_pol) + scan_param.dup_filt_pol = GAPM_DUP_FILT_EN; + /// Scan window opening parameters for LE 1M PHY (in unit of 625us) + scan_param.scan_param_1m.scan_intv = GAP_SCAN_FAST_INTV; + scan_param.scan_param_1m.scan_wd = GAP_SCAN_FAST_WIND; + /// Scan window opening parameters for LE Coded PHY + //scan_param.scan_param_coded.scan_intv = GAP_SCAN_SLOW_INTV1; + //scan_param.scan_param_coded.scan_wd = GAP_SCAN_SLOW_WIND1; + /// Scan duration (in unit of 10ms). 0 means that the controller will scan continuously until + /// reception of a stop command from the application + scan_param.duration = 500;//GAP_TMR_GEN_DISC_SCAN; + /// Scan period (in unit of 1.28s). Time interval betweem two consequent starts of a scan duration + /// by the controller. 0 means that the scan procedure is not periodic + scan_param.period = 0; + + gapm_start_activity(actv_env.scanidx, sizeof(struct gapm_scan_param), &scan_param); +} + +/** + **************************************************************************************** + * @brief Action/Command of Scanning + * + * @param[in] actv_op Operation of activity + **************************************************************************************** + */ +void app_scan_action(uint8_t actv_op) +{ + switch (actv_op) + { + case ACTV_CREATE: + { + if (actv_env.scansta == ACTV_STATE_OFF) + { + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_SCAN, GAPM_STATIC_ADDR); + actv_env.scansta = ACTV_STATE_CREATE; + } + } break; + + case ACTV_START: + { + scan_cnt = 0; + + if (actv_env.scansta == ACTV_STATE_READY) + { + DEBUG("Starting"); + app_start_scanning(); + actv_env.scansta = ACTV_STATE_START; + } + } break; + + case ACTV_STOP: + { + if (actv_env.scansta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_STOP; + } + } break; + + case ACTV_DELETE: + { + if ((actv_env.scansta != ACTV_STATE_OFF) && (actv_env.scansta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_OFF; + } + } break; + + case ACTV_RELOAD: + { + if (actv_env.scansta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_STOP; + } + + if ((actv_env.scansta != ACTV_STATE_OFF) && (actv_env.scansta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_OFF; + } + + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_SCAN, GAPM_STATIC_ADDR); + actv_env.scansta = ACTV_STATE_CREATE; + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Event Procedure of Scanning + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_scan_event(uint8_t gapm_op, uint8_t status) +{ + DEBUG("Evt(op:0x%X,sta:0x%X)", gapm_op, status); + + switch (gapm_op) + { + case GAPM_CREATE_SCAN_ACTIVITY: + { + actv_env.scansta = ACTV_STATE_READY; + } break; + + case GAPM_STOP_ACTIVITY: + { + if ((actv_env.scansta == ACTV_STATE_START) || (actv_env.scansta == ACTV_STATE_STOP)) + { + actv_env.scansta = ACTV_STATE_READY; + } + + DEBUG("-->Filter DevAddr"); + for (uint8_t idx = 0; idx < scan_cnt; idx++) + { + DEBUG("Scan List[%d]-->", idx); + debugHex((uint8_t *)(&scan_addr_list[idx]), sizeof(struct gap_bdaddr)); + } + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Store result of Scanning when filter by app_actv_report_ind + * + * @param[in] paddr gap_bdaddr of peer device + **************************************************************************************** + */ +void app_scan_result(const struct gap_bdaddr* paddr) +{ + for (uint8_t i = 0; i < scan_cnt; i++) + { + if (!memcmp(&scan_addr_list[i], paddr,sizeof(struct gap_bdaddr)))//save addr but diffrent + { + return; + } + } + + if (scan_cnt < SCAN_NUM_MAX) //get null array + { + memcpy(&scan_addr_list[scan_cnt], paddr,sizeof(struct gap_bdaddr)); + scan_cnt++; + } +} + +/** + **************************************************************************************** + * @brief Handles activity report. (@see GAPM_EXT_ADV_REPORT_IND) + * + * @param[in] report Report of Advertising data be scanned + **************************************************************************************** + */ +void app_actv_report_ind(struct gapm_ext_adv_report_ind const* report) +{ + // filter report + if ((report->info & GAPM_REPORT_INFO_REPORT_TYPE_MASK) == GAPM_REPORT_TYPE_ADV_LEG) + { + const uint8_t *p_cursor = report->data; + const uint8_t *p_end_cusor = report->data + report->length; + + while (p_cursor < p_end_cusor) + { + // Extract AD type + uint8_t ad_type = *(p_cursor + 1); + + if (ad_type == GAP_AD_TYPE_APPEARANCE) + { + uint16_t icon = read16p(p_cursor+2); + + // Filter special appearance device + if ((icon == 0x03C1) || (icon == 0x03C5)) // HID Gamepad + { + app_scan_result(&report->trans_addr); + break; + } + } + else if ((ad_type == GAP_AD_TYPE_COMPLETE_LIST_16_BIT_UUID) || (ad_type == GAP_AD_TYPE_MORE_16_BIT_UUID)) + { + uint16_t uuid = read16p(p_cursor+2); + + // Filter special uuid device + if (((uuid == 0x18F0) || (uuid == 0xFF00)))// && (param->trans_addr.addr.addr[0] == 0x04)) + { + app_scan_result(&report->trans_addr); + break; + } + } + else + { + // Filter Rule more... + } + + /* Go to next advertising info */ + p_cursor += (*p_cursor + 1); + } + } +} +#endif //(BLE_EN_SCAN) + + +/** + **************************************************************************************** + * @section Initiating Activity - Example for User Customize + * enable via pre-define @see BLE_EN_INIT + **************************************************************************************** + */ +#if (BLE_EN_INIT) + +#undef DEBUG +#if (DBG_ACTV) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +const struct gap_bdaddr dflt_peer = +{ + .addr = {{0x11, 0x22, 0x33, 0xa1, 0x01, 0xd3}}, + .addr_type = ADDR_RAND, +}; + +const struct gapm_conn_param dflt_conn_param = +{ + /// Minimum value for the connection interval (in unit of 1.25ms). Allowed range is 7.5ms to 4s. + .conn_intv_min = 10, + /// Maximum value for the connection interval (in unit of 1.25ms). Allowed range is 7.5ms to 4s. + .conn_intv_max = 10, + /// Slave latency. Number of events that can be missed by a connected slave device + .conn_latency = 0, + /// Link supervision timeout (in unit of 10ms). Allowed range is 100ms to 32s + .supervision_to = 300, + /// Recommended minimum duration of connection events (in unit of 625us) + .ce_len_min = 2, + /// Recommended maximum duration of connection events (in unit of 625us) + .ce_len_max = 4, +}; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Start initiating to peer device + * + * @param[in] paddr gap_bdaddr of peer device + **************************************************************************************** + */ +void app_start_initiating(const struct gap_bdaddr* paddr) +{ + if ((actv_env.initsta == ACTV_STATE_READY) || (actv_env.initsta == ACTV_STATE_STOP)) + { + struct gapm_init_param init_param; + + if (paddr == NULL) + { + paddr = &dflt_peer; + } + + init_param.type = GAPM_INIT_TYPE_DIRECT_CONN_EST; + init_param.prop = GAPM_INIT_PROP_1M_BIT; + init_param.conn_to = 100; // timeout unit in 10ms, update from v1.3 + init_param.scan_param_1m.scan_intv = GAP_SCAN_FAST_INTV; + init_param.scan_param_1m.scan_wd = GAP_SCAN_FAST_WIND; + + memcpy(&init_param.conn_param_1m, &dflt_conn_param, sizeof(struct gapm_conn_param)); + memcpy(&init_param.peer_addr, paddr, sizeof(struct gap_bdaddr)); + + gapm_start_activity(actv_env.initidx, sizeof(struct gapm_init_param), &init_param); + + DEBUG("Starting"); + actv_env.initsta = ACTV_STATE_START; + } +} + +/** + **************************************************************************************** + * @brief Action/Command of Initiating + * + * @param[in] actv_op Operation of activity + **************************************************************************************** + */ +void app_init_action(uint8_t actv_op) +{ + switch (actv_op) + { + case ACTV_CREATE: + { + if (actv_env.initsta == ACTV_STATE_OFF) + { + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_INIT, GAPM_STATIC_ADDR); + actv_env.initsta = ACTV_STATE_CREATE; + } + } break; + + case ACTV_START: + { + app_start_initiating(NULL); + } break; + + case ACTV_STOP: + { + if (actv_env.initsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_STOP; + } + } break; + + case ACTV_DELETE: + { + if ((actv_env.initsta != ACTV_STATE_OFF) && (actv_env.initsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_OFF; + } + } break; + + case ACTV_RELOAD: + { + if (actv_env.initsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_STOP; + } + + if ((actv_env.initsta != ACTV_STATE_OFF) && (actv_env.initsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_OFF; + } + + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_INIT, GAPM_STATIC_ADDR); + actv_env.initsta = ACTV_STATE_CREATE; + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Event Procedure of Initiating + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_init_event(uint8_t gapm_op, uint8_t status) +{ + DEBUG("Evt(op:0x%X,sta:0x%X)", gapm_op, status); + + switch (gapm_op) + { + case GAPM_CREATE_INIT_ACTIVITY: + { + actv_env.initsta = ACTV_STATE_READY; + } break; + + case GAPM_STOP_ACTIVITY: + { + if ((actv_env.initsta == ACTV_STATE_START) || (actv_env.initsta == ACTV_STATE_STOP)) + { + actv_env.initsta = ACTV_STATE_READY; + } + } break; + + default: + break; + } +} + +#endif //(BLE_EN_INIT) + + +/** + **************************************************************************************** + * @brief Create activities when Initialization complete. + **************************************************************************************** + */ +void app_actv_create(void) +{ + memset(&actv_env, 0, sizeof(actv_env)); + #if (BLE_EN_ADV) + app_adv_action(ACTV_CREATE); + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + app_scan_action(ACTV_CREATE); + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + app_init_action(ACTV_CREATE); + #endif //(BLE_EN_INIT) +} + +/** + **************************************************************************************** + * @brief Handles activity command complete event. + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_actv_cmp_evt(uint8_t operation, uint8_t status) +{ + switch (operation) + { + #if (BLE_EN_ADV) + case (GAPM_CREATE_ADV_ACTIVITY): + case (GAPM_SET_ADV_DATA): + case (GAPM_SET_SCAN_RSP_DATA): + { + app_adv_event(operation, status); + } break; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + case GAPM_CREATE_SCAN_ACTIVITY: + { + app_scan_event(operation, status); + } break; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + case GAPM_CREATE_INIT_ACTIVITY: + { + app_init_event(operation, status); + } break; + #endif //(BLE_EN_INIT) + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Handles activity created. (@see GAPM_ACTIVITY_CREATED_IND) + * + * @param[in] actv_type Type of activities(@see enum gapm_actv_type) + * @param[in] actv_idx Index of activities created + **************************************************************************************** + */ +void app_actv_created_ind(uint8_t actv_type, uint8_t actv_idx) +{ + switch (actv_type) + { + #if (BLE_EN_ADV) + case GAPM_ACTV_TYPE_ADV: + { + actv_env.advidx = actv_idx; + } break; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + case GAPM_ACTV_TYPE_SCAN: + { + actv_env.scanidx = actv_idx; + } break; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + case GAPM_ACTV_TYPE_INIT: + { + actv_env.initidx = actv_idx; + } break; + #endif //(BLE_EN_INIT) + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Handles activity stopped. (@see GAPM_ACTIVITY_STOPPED_IND) + * + * @param[in] actv_type Type of activity(@see enum gapm_actv_type) + * @param[in] reason Reason of stopped + **************************************************************************************** + */ +void app_actv_stopped_ind(uint8_t actv_type, uint8_t actv_idx, uint8_t reason) +{ + switch (actv_type) + { + #if (BLE_EN_ADV) + case GAPM_ACTV_TYPE_ADV: + { + // Advertising Stopped by slave connection or duration timeout + app_adv_event(GAPM_STOP_ACTIVITY, reason); + + if (app_state_get() == APP_READY) + { + // Duration timeout, go IDLE + app_state_set(APP_IDLE); + } + #if (BLE_MULTI_CONN) + else if (app_state_get() == APP_CONNECTED) + { + if (ONE_BITS(app_env.conrole) < BLE_NB_SLAVE) + { + // Restart Advertising for more connections + app_adv_action(ACTV_START); + } + } + #endif //(BLE_MULTI_CONN) + } break; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + case GAPM_ACTV_TYPE_SCAN: + { + app_scan_event(GAPM_STOP_ACTIVITY, reason); + } break; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + case GAPM_ACTV_TYPE_INIT: + { + app_init_event(GAPM_STOP_ACTIVITY, reason); + } break; + #endif //(BLE_EN_INIT) + + default: + break; + } +} diff --git a/projects/bleAdv_change/src/app_msg.c b/projects/bleAdv_change/src/app_msg.c new file mode 100644 index 0000000..7bf3898 --- /dev/null +++ b/projects/bleAdv_change/src/app_msg.c @@ -0,0 +1,179 @@ +/** + **************************************************************************************** + * + * @file app_msg.c + * + * @brief Application Messages Handler - Example + * + * < If want to modify it, recommend to copy the file to 'user porject'/src > + **************************************************************************************** + */ + +#include "app.h" +#include "drvs.h" +#include "gapm_api.h" + +#if (DBG_APP) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + +enum user_app_msg_id +{ + APP_ADV_CHNG = APP_BASE_MSG + 3, +}; + +extern uint32_t g_rand_num; + +/* + * MESSAGE HANDLERS + **************************************************************************************** + */ + +/// SubTask Declaration, User add more... +extern APP_SUBTASK_HANDLER(gapm_msg); +extern APP_SUBTASK_HANDLER(gapc_msg); +extern APP_SUBTASK_HANDLER(gatt_msg); +extern APP_SUBTASK_HANDLER(l2cc_msg); +extern APP_SUBTASK_HANDLER(mesh_msg); + +/** + **************************************************************************************** + * @brief SubTask Handler of Custom or Unknow Message. (__weak func) + **************************************************************************************** + */ +__weak APP_SUBTASK_HANDLER(custom) +{ + if (msgid == APP_ADV_CHNG) + { + DEBUG("ADV Change:%X", g_rand_num); + + if (app_state_get() < APP_CONNECTED) + { + app_adv_action(ACTV_RELOAD); + } + + ke_timer_set(APP_ADV_CHNG, TASK_APP, ADV_CHNG_PERIOD); + } + else + { + uint16_t length = ke_param2msg(param)->param_len; + DEBUG("Unknow MsgId:0x%X", msgid); + debugHex((uint8_t *)param, length); + } + + return (MSG_STATUS_FREE); +} + +/** + **************************************************************************************** + * @brief Dispatch TASK_APP message to sub-handler. + * + * @param[in] msgid Id of the message received. + * @param[in] task_idx Index of the receiving task instance. + * + * @return Handler of the message or NULL. + **************************************************************************************** + */ +__TASKFN void* app_task_dispatch(msg_id_t msgid, uint8_t task_idx) +{ + msg_func_t handler = NULL; + + switch (MSG_TYPE(msgid)) + { + case (TID_GAPM): + handler = app_gapm_msg_handler; + break; + + case (TID_GAPC): + handler = app_gapc_msg_handler; + break; + + #if (GATT_CLI) + case (TID_GATT): + handler = app_gatt_msg_handler; + break; + #endif + + #if (L2CC_LECB) + case (TID_L2CC): + handler = app_l2cc_msg_handler; + break; + #endif + + #if (PRF_MESH) + case TID_MESH: + status = app_mesh_msg_handler; + break; + #endif + + default: + { + handler = app_custom_handler; + } break; + } + + return handler; +} + +/** + **************************************************************************************** + * @brief Finite state machine for Device Configure, maybe User Override! (__weak func) + * + * @param[in] evt configure event @see enum ble_event + **************************************************************************************** + */ +void app_conf_fsm(uint8_t evt) +{ + if (evt == BLE_RESET) + { + memset(&app_env, 0, sizeof(app_env)); + + // Set device config + gapm_set_dev(&ble_dev_config, &ble_dev_addr, NULL); + } + else /*if (evt == BLE_CONFIGURED)*/ + { + app_state_set(APP_IDLE); + + // Create Profiles + app_prf_create(); + + // Create Activities + app_actv_create(); + + ke_timer_set(APP_ADV_CHNG, TASK_APP, ADV_CHNG_PERIOD); + } +} + +/** + **************************************************************************************** + * @brief API to Get Device Name, maybe User Override! (__weak func) + * + * @param[in] size Length of name Buffer + * @param[out] name Pointer of name buffer + * + * @return Length of device name + **************************************************************************************** + */ +uint8_t app_name_get(uint8_t size, uint8_t *name) +{ + uint8_t len = sizeof(BLE_DEV_NAME) - 1; + + // eg. prefix(BLE_DEV_NAME) + suffix(Addr[0]) + if (DEV_NAME_MAX_LEN < len) + { + // no enough buffer, short copy + len = DEV_NAME_MAX_LEN; + memcpy(name, BLE_DEV_NAME, len); + } + else + { + memcpy(name, BLE_DEV_NAME, len); + } + + return len; +} diff --git a/projects/bleAdv_change/src/cfg.h b/projects/bleAdv_change/src/cfg.h new file mode 100644 index 0000000..02c9c27 --- /dev/null +++ b/projects/bleAdv_change/src/cfg.h @@ -0,0 +1,55 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// System Clock(0=16MHz, 1=32MHz, 2=48MHz, 3=64MHz) +#define SYS_CLK (0) + +/// Debug Mode(0=Disable, 1=via UART, 2=via RTT) +#define DBG_MODE (1) + +/// BLE Configure (Single or Multi-Connections) +#define BLE_NB_SLAVE (1) +#define BLE_NB_MASTER (0) +#define BLE_EN_SMP (0) + +#define BLE_ADDR {0x00, 0x08, 0x33, 0xA1, 0x01, 0xD2} +#define BLE_DEV_NAME "myBle-Chng" +#define BLE_DEV_ICON 0x0000 + +#define APP_ADV_INT_MIN (32) // unit in 0.625ms +#define APP_ADV_INT_MAX (32) // unit in 0.625ms + +/// Profile Configure +#define PRF_DISS (1) +#define PRF_SESS (1) + +/// Serial Service @see prf_sess.h +#define SES_UUID_128 (1) +#define SES_READ_SUP (0) + +/// Debug Configure +#if (DBG_MODE) + #define DBG_APP (1) + #define DBG_PROC (0) + #define DBG_ACTV (1) + #define DBG_GAPM (0) + #define DBG_GAPC (1) + #define DBG_DISS (0) + #define DBG_SESS (0) +#endif + +/// Misc Options +#define LED_PLAY (1) +#define CFG_SLEEP (0) +#define ADV_CHNG_PERIOD (2000) // unit 1ms +#endif //_APP_CFG_H_ diff --git a/projects/bleAdv_change/src/main.c b/projects/bleAdv_change/src/main.c new file mode 100644 index 0000000..9a527dd --- /dev/null +++ b/projects/bleAdv_change/src/main.c @@ -0,0 +1,84 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" +#include "app.h" +#include "sftmr.h" +#include "leds.h" +#include "uartRb.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +extern void user_procedure(void); + +static void sysInit(void) +{ + iwdt_disable(); + + rcc_ble_en(); + rcc_adc_en(); + + rcc_fshclk_set(FSH_CLK_DPSC42); +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + uart1Rb_Init(); //dbgInit(); + debug("Start(rsn:%X)...\r\n", rsn); + + #if (LED_PLAY) + sftmr_init(); + leds_init(); + leds_play(LED_FAST_BL); + #endif //(LED_PLAY) + + // Init BLE App + app_init(rsn); + +} + +int main(void) +{ + sysInit(); + devInit(); + + // Global Interrupt Enable + GLOBAL_INT_START(); + + // main loop + while (1) + { + // Schedule Messages & Events + ble_schedule(); + + #if (LED_PLAY) + // SoftTimer Polling + sftmr_schedule(); + #endif //(LED_PLAY) + + // User's Procedure + user_procedure(); + } +} diff --git a/projects/bleAdv_change/src/myapp.c b/projects/bleAdv_change/src/myapp.c new file mode 100644 index 0000000..20ad799 --- /dev/null +++ b/projects/bleAdv_change/src/myapp.c @@ -0,0 +1,72 @@ +/** + **************************************************************************************** + * + * @file myapp.c + * + * @brief User Application - Override func + * + **************************************************************************************** + */ + +#include "app.h" +#include "bledef.h" +#include "drvs.h" +#include "leds.h" + +#if (DBG_APP) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * VARIABLES DEFINITIONS + **************************************************************************************** + */ + + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +#if (LED_PLAY) +/** + **************************************************************************************** + * @brief API to Set State of Application, add leds Indication + * + * @param[in] state new state + **************************************************************************************** + */ +void app_state_set(uint8_t state) +{ + DEBUG("State(old:%d,new:%d)", app_state_get(), state); + + app_env.state = state; + + // Indication, User add more... + if (state == APP_IDLE) + { + leds_play(LED_SLOW_BL); + } + else if (state == APP_READY) + { + leds_play(LED_FAST_BL); + } + else if (state == APP_CONNECTED) + { + leds_play(LED_CONT_ON); + } +} +#endif //(LED_PLAY) + diff --git a/projects/bleAdv_change/src/proc.c b/projects/bleAdv_change/src/proc.c new file mode 100644 index 0000000..dae7ec0 --- /dev/null +++ b/projects/bleAdv_change/src/proc.c @@ -0,0 +1,133 @@ +/** + **************************************************************************************** + * + * @file proc.c + * + * @brief user procedure. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" + +#include "app.h" +#include "prf_sess.h" +#include "uartRb.h" + +#if (DBG_PROC) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +#define BLE_MAX_LEN 20 +#define NULL_CNT 20 + +static uint8_t buff[BLE_MAX_LEN]; +static uint16_t buff_len = 0; + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +#if !(DBG_SESS) +/// Override - Callback on received data from peer device +void sess_cb_rxd(uint8_t conidx, uint16_t len, const uint8_t *data) +{ + uart_send(UART1_PORT, len, data); +} +#endif //!(DBG_SESS) + +/// Uart Data procedure +static void data_proc(void) +{ + // Todo Loop-Proc + static uint8_t null_cnt = 0; + uint16_t len; + + len = uart1Rb_Read(&buff[buff_len], BLE_MAX_LEN - buff_len); + if (len > 0) + { + buff_len += len; + if (buff_len < BLE_MAX_LEN) + { + return; // wait full + } + } + else + { + if ((buff_len > 0) && (null_cnt++ > NULL_CNT)) + { + //finish = true; + null_cnt = 0; + } + else + { + return; // wait again + } + } + + if (app_state_get() == APP_CONNECTED) + { + if (buff[0] == 0xAA) + { + DEBUG("GAP Disc!\r\n"); + gapc_disconnect(app_env.curidx); + buff_len = 0; + } + else if (sess_txd_send(app_env.curidx, buff_len, buff) == LE_SUCCESS) + { + debugHex(buff, buff_len); + buff_len = 0; + } + } + else + { + // goto reset + if (buff[0] == 0xAA) + { + DEBUG("GAP Reset!\r\n"); + gapm_reset(); + } + + buff_len = 0; + } +} + +#if (CFG_SLEEP) +static void sleep_proc(void) +{ + uint8_t lpsta = ble_sleep(BLE_SLP_TWOSC, BLE_SLP_DURMAX); + + if (lpsta == BLE_IN_SLEEP) + { + uint16_t lpret = core_sleep(CFG_WKUP_BLE_EN); + //DEBUG("ble sta:%d, wksrc:%X", lpsta, lpret); + } + else + { + //DEBUG("ble sta:%d", lpsta); + } +} +#endif //(CFG_SLEEP) + +void user_procedure(void) +{ + #if (CFG_SLEEP) + sleep_proc(); + #endif //(CFG_SLEEP) + + data_proc(); +} diff --git a/projects/bleFCC/ReadMe.txt b/projects/bleFCC/ReadMe.txt new file mode 100644 index 0000000..e996419 --- /dev/null +++ b/projects/bleFCC/ReadMe.txt @@ -0,0 +1,16 @@ +RF FCC测试 + +uart指令说明 +A0 : FCC初始化配置 +A1 : FCC Stop + +B0 xx : RF Tx单载波模式(xx: 00 ~ 27)(00 ~ 27对应tx频率2402 ~ 2480) +B1 xx : RF Rx单载波模式(xx: 00 ~ 27) + +C0 xx : RF Tx调制数据模式(xx: 00 ~ 27)(00 ~ 27对应tx频率2402 ~ 2480) +C1 xx : RF Rx调制数据模式(xx: 00 ~ 27) + +D0 : RF Tx单载波跳频模式, 跳频间隔200ms, 从2402MHz~2480MHz + +E0 xx : 在RF单载波模式下调晶振频偏(xx: 00 ~ 3F) +E1 : 获取当前晶振频偏配置值 \ No newline at end of file diff --git a/projects/bleFCC/mdk/JLinkSettings.ini b/projects/bleFCC/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/projects/bleFCC/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/projects/bleFCC/mdk/bleFCC.uvoptx b/projects/bleFCC/mdk/bleFCC.uvoptx new file mode 100644 index 0000000..d72bd87 --- /dev/null +++ b/projects/bleFCC/mdk/bleFCC.uvoptx @@ -0,0 +1,439 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + bleFCC + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + DLGUARM + + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC1000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 0 + 1 + g_hopping_timer_id + + + 1 + 1 + g_hopping_idx + + + 2 + 1 + sftmr_env + + + + + 1 + 1 + 0x500000d0 + 0 + + + + + 2 + 1 + 0x50000000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + System Viewer\APBMISC + 35902 + + + System Viewer\Modem + 35903 + + + System Viewer\RCC + 35904 + + + System Viewer\RF + 35905 + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\src\proc.c + proc.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 5 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 6 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + modules + 1 + 0 + 0 + 0 + + 4 + 7 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\leds.c + leds.c + 0 + 0 + + + 4 + 8 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\sftmr.c + sftmr.c + 0 + 0 + + + 4 + 9 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\uart1Rb.c + uart1Rb.c + 0 + 0 + + + + + ble\lib + 1 + 0 + 0 + 0 + + 5 + 10 + 4 + 0 + 0 + 0 + ..\..\..\ble\lib\ble6.lib + ble6.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 6 + 11 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/projects/bleFCC/mdk/bleFCC.uvprojx b/projects/bleFCC/mdk/bleFCC.uvprojx new file mode 100644 index 0000000..11bbe6b --- /dev/null +++ b/projects/bleFCC/mdk/bleFCC.uvprojx @@ -0,0 +1,475 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + bleFCC + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + bleFCC + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --thumb --gnu --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip_ble.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + proc.c + 1 + ..\src\proc.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + modules + + + leds.c + 1 + ..\..\..\modules\src\leds.c + + + sftmr.c + 1 + ..\..\..\modules\src\sftmr.c + + + uart1Rb.c + 1 + ..\..\..\modules\src\uart1Rb.c + + + + + ble\lib + + + ble6.lib + 4 + ..\..\..\ble\lib\ble6.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/projects/bleFCC/mdk/clean.bat b/projects/bleFCC/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/projects/bleFCC/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/projects/bleFCC/src/cfg.h b/projects/bleFCC/src/cfg.h new file mode 100644 index 0000000..3f8c036 --- /dev/null +++ b/projects/bleFCC/src/cfg.h @@ -0,0 +1,29 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// System Clock(0=16MHz, 1=32MHz, 2=48MHz, 3=64MHz) +#define SYS_CLK (0) + +/// Debug Mode(0=Disable, 1=via UART, 2=via RTT) +#define DBG_MODE (1) + +/// Debug Configure +#if (DBG_MODE) + #define DBG_PROC (1) +#endif + +/// Misc Options +#define LED_PLAY (1) + + +#endif //_APP_CFG_H_ diff --git a/projects/bleFCC/src/main.c b/projects/bleFCC/src/main.c new file mode 100644 index 0000000..c93c271 --- /dev/null +++ b/projects/bleFCC/src/main.c @@ -0,0 +1,80 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "sftmr.h" +#include "leds.h" +#include "uartRb.h" +#include "dbg.h" +#include "fcc.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +extern void user_procedure(void); + +static void sysInit(void) +{ + iwdt_disable(); + + rcc_ble_en(); + rcc_adc_en(); + + rcc_fshclk_set(FSH_CLK_DPSC42); +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + uart1Rb_Init(); //dbgInit(); + debug("Start(rsn:%X)...\r\n", rsn); + + #if (LED_PLAY) + sftmr_init(); + leds_init(); + leds_play(LED_FAST_BL); + #endif //(LED_PLAY) + + fcc_init(); + +// ioBleTxRx(2, 3); +} + +int main(void) +{ + sysInit(); + devInit(); + + // Global Interrupt Enable + GLOBAL_INT_START(); + + // main loop + while (1) + { + #if (LED_PLAY) + // SoftTimer Polling + sftmr_schedule(); + #endif //(LED_PLAY) + + // User's Procedure + user_procedure(); + } +} diff --git a/projects/bleFCC/src/myapp.c b/projects/bleFCC/src/myapp.c new file mode 100644 index 0000000..20ad799 --- /dev/null +++ b/projects/bleFCC/src/myapp.c @@ -0,0 +1,72 @@ +/** + **************************************************************************************** + * + * @file myapp.c + * + * @brief User Application - Override func + * + **************************************************************************************** + */ + +#include "app.h" +#include "bledef.h" +#include "drvs.h" +#include "leds.h" + +#if (DBG_APP) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * VARIABLES DEFINITIONS + **************************************************************************************** + */ + + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +#if (LED_PLAY) +/** + **************************************************************************************** + * @brief API to Set State of Application, add leds Indication + * + * @param[in] state new state + **************************************************************************************** + */ +void app_state_set(uint8_t state) +{ + DEBUG("State(old:%d,new:%d)", app_state_get(), state); + + app_env.state = state; + + // Indication, User add more... + if (state == APP_IDLE) + { + leds_play(LED_SLOW_BL); + } + else if (state == APP_READY) + { + leds_play(LED_FAST_BL); + } + else if (state == APP_CONNECTED) + { + leds_play(LED_CONT_ON); + } +} +#endif //(LED_PLAY) + diff --git a/projects/bleFCC/src/proc.c b/projects/bleFCC/src/proc.c new file mode 100644 index 0000000..23b0a9b --- /dev/null +++ b/projects/bleFCC/src/proc.c @@ -0,0 +1,207 @@ +/** + **************************************************************************************** + * + * @file proc.c + * + * @brief user procedure. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" + +#include "fcc.h" +#include "uartRb.h" +#include "sftmr.h" + +#if (DBG_PROC) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +#define BLE_MAX_LEN 20 +#define NULL_CNT 20 +#define HOPPING_INV _MS(200) + +enum uart_cmd +{ + CMD_FCC_START = 0xA0, + CMD_FCC_STOP, + + CMD_FCC_TX_CARR = 0xB0, + CMD_FCC_RX_CARR, + + CMD_FCC_TX_MOD = 0xC0, + CMD_FCC_RX_MOD, + + CMD_FCC_TX_HOP = 0xD0, + + CMD_SET_XOSC16_TR = 0xE0, + CMD_GET_XOSC16_TR, +}; + +static uint8_t buff[BLE_MAX_LEN]; +static uint16_t buff_len = 0; + +volatile uint8_t g_hopping_idx, g_hopping_timer_id; + +static tmr_tk_t hopping_timer(uint8_t id) +{ + // 0 ~ 39 (2402M ~ 2480M) + g_hopping_idx = (g_hopping_idx % 40); + + fcc_tx_carr(g_hopping_idx); + + ++g_hopping_idx; + + return HOPPING_INV; +} + +static void hopping_mode(void) +{ + if ((g_hopping_timer_id & 0x80) == 0) + { + g_hopping_timer_id = sftmr_start(HOPPING_INV, hopping_timer); + + g_hopping_timer_id |= 0x80; + } +} +/* + * FUNCTIONS + **************************************************************************************** + */ +/// Uart Data procedure +static void data_proc(void) +{ + // Todo Loop-Proc + static uint8_t null_cnt = 0; + uint16_t len; + bool finish = true; + + len = uart1Rb_Read(&buff[buff_len], BLE_MAX_LEN - buff_len); + + if (len > 0) + { + buff_len += len; + if (buff_len < BLE_MAX_LEN) + { + return; // wait full + } + } + else + { + if ((buff_len > 0) && (null_cnt++ > NULL_CNT)) + { + //finish = true; + null_cnt = 0; + } + else + { + return; // wait again + } + } + + if ((buff[0] != CMD_FCC_TX_HOP) && (g_hopping_timer_id != 0)) + { + g_hopping_timer_id &= ~0x80U; + sftmr_clear(g_hopping_timer_id); + g_hopping_timer_id = 0; + } + + switch (buff[0]) + { + case CMD_FCC_START: + { + DEBUG("fcc_start"); + fcc_init(); + } break; + + case CMD_FCC_STOP: + { + DEBUG("fcc_stop"); + fcc_stop(); + } break; + + case CMD_FCC_TX_CARR: + { + DEBUG("fcc_tx_carr"); + if (buff_len > 1) + { + fcc_tx_carr(buff[1]); + } + } break; + + case CMD_FCC_RX_CARR: + { + DEBUG("fcc_rx_carr"); + if (buff_len > 1) + { + fcc_rx_carr(buff[1]); + } + } break; + + case CMD_FCC_TX_MOD: + { + DEBUG("fcc_tx_mod"); + if (buff_len > 1) + { + fcc_tx_mod(buff[1]); + } + } break; + + case CMD_FCC_RX_MOD: + { + DEBUG("fcc_rx_mod"); + if (buff_len > 1) + { + fcc_rx_mod(buff[1]); + } + } break; + + case CMD_FCC_TX_HOP: + { + DEBUG("hopping_mode"); + g_hopping_idx = 0; + hopping_mode(); + } break; + + case CMD_SET_XOSC16_TR: + { + if (buff_len > 1) + { + DEBUG("SET_XOSC_TR:0x%02x", buff[1]); + APBMISC->XOSC16M_CTRL.XOSC16M_CAP_TR = buff[1]; + } + } break; + + case CMD_GET_XOSC16_TR: + { + DEBUG("GET_XOSC_TR:0x%02x", APBMISC->XOSC16M_CTRL.XOSC16M_CAP_TR); + } break; + + default: + { + + } break; + } + + if (finish) + { + buff_len = 0; + } +} + +void user_procedure(void) +{ + data_proc(); +} diff --git a/projects/bleHid/mdk/JLinkSettings.ini b/projects/bleHid/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/projects/bleHid/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/projects/bleHid/mdk/bleHid.uvoptx b/projects/bleHid/mdk/bleHid.uvoptx new file mode 100644 index 0000000..32d0aaf --- /dev/null +++ b/projects/bleHid/mdk/bleHid.uvoptx @@ -0,0 +1,544 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + bleHid + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FN1 -FC1000 -FD20003000 -FF0B6x_256kB_PY_D -FL040000 -FS018000000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + JL2CM3 + -U59701305 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC1000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 2 + 1 + 0x40010000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + src + 1 + 0 + 0 + 0 + + 1 + 1 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 1 + 2 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 1 + 3 + 1 + 0 + 0 + 0 + ..\src\myapp.c + myapp.c + 0 + 0 + + + 1 + 4 + 1 + 0 + 0 + 0 + ..\src\batt.c + batt.c + 0 + 0 + + + 1 + 5 + 1 + 0 + 0 + 0 + ..\src\proc.c + proc.c + 0 + 0 + + + 1 + 6 + 1 + 0 + 0 + 0 + ..\src\hid_desc.c + hid_desc.c + 0 + 0 + + + + + core + 1 + 0 + 0 + 0 + + 2 + 7 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 8 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 9 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + modules + 1 + 0 + 0 + 0 + + 4 + 10 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\leds.c + leds.c + 0 + 0 + + + 4 + 11 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\sftmr.c + sftmr.c + 0 + 0 + + + 4 + 12 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\uart1Rb.c + uart1Rb.c + 0 + 0 + + + + + ble\app + 1 + 0 + 0 + 0 + + 5 + 13 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app.c + app.c + 0 + 0 + + + 5 + 14 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_actv.c + app_actv.c + 0 + 0 + + + 5 + 15 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_msg.c + app_msg.c + 0 + 0 + + + 5 + 16 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gapm.c + app_gapm.c + 0 + 0 + + + 5 + 17 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gapc.c + app_gapc.c + 0 + 0 + + + + + ble\prf + 1 + 0 + 0 + 0 + + 6 + 18 + 1 + 0 + 0 + 0 + ..\..\..\ble\prf\prf_diss.c + prf_diss.c + 0 + 0 + + + 6 + 19 + 1 + 0 + 0 + 0 + ..\..\..\ble\prf\prf_bass.c + prf_bass.c + 0 + 0 + + + 6 + 20 + 1 + 0 + 0 + 0 + ..\..\..\ble\prf\prf_hids.c + prf_hids.c + 0 + 0 + + + + + ble\lib + 1 + 0 + 0 + 0 + + 7 + 21 + 4 + 0 + 0 + 0 + ..\..\..\ble\lib\ble6.lib + ble6.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 8 + 22 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/projects/bleHid/mdk/bleHid.uvprojx b/projects/bleHid/mdk/bleHid.uvprojx new file mode 100644 index 0000000..e20fc4c --- /dev/null +++ b/projects/bleHid/mdk/bleHid.uvprojx @@ -0,0 +1,540 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + bleHid + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20003000 -FC1000 -FN1 -FF0B6x_256kB_PY_D -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM)) + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + bleHid + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + -REMAP + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 16 + 1 + 0 + 0 + 0 + 4 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x1000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip_ble.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + myapp.c + 1 + ..\src\myapp.c + + + batt.c + 1 + ..\src\batt.c + + + proc.c + 1 + ..\src\proc.c + + + hid_desc.c + 1 + ..\src\hid_desc.c + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + modules + + + leds.c + 1 + ..\..\..\modules\src\leds.c + + + sftmr.c + 1 + ..\..\..\modules\src\sftmr.c + + + uart1Rb.c + 1 + ..\..\..\modules\src\uart1Rb.c + + + + + ble\app + + + app.c + 1 + ..\..\..\ble\app\app.c + + + app_actv.c + 1 + ..\..\..\ble\app\app_actv.c + + + app_msg.c + 1 + ..\..\..\ble\app\app_msg.c + + + app_gapm.c + 1 + ..\..\..\ble\app\app_gapm.c + + + app_gapc.c + 1 + ..\..\..\ble\app\app_gapc.c + + + + + ble\prf + + + prf_diss.c + 1 + ..\..\..\ble\prf\prf_diss.c + + + prf_bass.c + 1 + ..\..\..\ble\prf\prf_bass.c + + + prf_hids.c + 1 + ..\..\..\ble\prf\prf_hids.c + + + + + ble\lib + + + ble6.lib + 4 + ..\..\..\ble\lib\ble6.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/projects/bleHid/mdk/clean.bat b/projects/bleHid/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/projects/bleHid/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/projects/bleHid/src/batt.c b/projects/bleHid/src/batt.c new file mode 100644 index 0000000..455f864 --- /dev/null +++ b/projects/bleHid/src/batt.c @@ -0,0 +1,46 @@ +/** + **************************************************************************************** + * + * @file batt.c + * + * @brief Battery voltage detection + * + **************************************************************************************** + */ + +#include "batt.h" +#include "sadc.h" + +#if (DBG_BATT) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +#define ADC_CHAN_VDD12 (14) // 1200mV +#define ADC_READ_CNT (0x07) + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +void batt_init(void) +{ + +} + +uint8_t batt_level(void) +{ + uint8_t lvl = 100; + + return lvl; +} diff --git a/projects/bleHid/src/batt.h b/projects/bleHid/src/batt.h new file mode 100644 index 0000000..761f188 --- /dev/null +++ b/projects/bleHid/src/batt.h @@ -0,0 +1,13 @@ +#ifndef _BATT_H_ +#define _BATT_H_ + +#include + +#define BATT_LVL_MAX 100 +#define BATT_LVL_MIN 0 + +void batt_init(void); + +uint8_t batt_level(void); + +#endif //_BATT_H_ diff --git a/projects/bleHid/src/cfg.h b/projects/bleHid/src/cfg.h new file mode 100644 index 0000000..261f815 --- /dev/null +++ b/projects/bleHid/src/cfg.h @@ -0,0 +1,50 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// System Clock(0=16MHz, 1=32MHz, 2=48MHz, 3=64MHz) +#define SYS_CLK (0) + +/// Debug Mode(0=Disable, 1=via UART, 2=via RTT) +#define DBG_MODE (1) + +/// BLE Configure (Single or Multi-Connections) +#define BLE_NB_SLAVE (1) +#define BLE_NB_MASTER (0) + +#define BLE_ADDR {0x29, 0x08, 0x33, 0xA1, 0x01, 0xD2} +#define BLE_DEV_NAME "B6x-HID" +#define BLE_DEV_ICON 0x03C1 // 03C0-Generic HID,03C1-Keyboard,03C2-Mouse,03C4-Gamepad +#define BLE_PHY (GAP_PHY_LE_1MBPS) +#define BLE_AUTH (GAP_AUTH_REQ_NO_MITM_BOND) +#define BLE_DBG_LTK (1) + +/// Profile Configure +#define PRF_DISS (1) +#define PRF_BASS (1) +#define PRF_HIDS (1) + +/// Debug Configure +#if (DBG_MODE) + #define DBG_APP (1) + #define DBG_PROC (1) + #define DBG_ACTV (0) + #define DBG_GAPM (1) + #define DBG_GAPC (1) + #define DBG_HIDS (1) + #define DBG_BASS (0) +#endif + +/// Misc Options +#define LED_PLAY (1) + +#endif //_APP_CFG_H_ diff --git a/projects/bleHid/src/hid_desc.c b/projects/bleHid/src/hid_desc.c new file mode 100644 index 0000000..de4bcc8 --- /dev/null +++ b/projects/bleHid/src/hid_desc.c @@ -0,0 +1,427 @@ +/** + **************************************************************************************** + * + * @file hid_desc.c + * + * @brief HID Report Map, descriptions. + * + * < Implementation according to user's application-specific > + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "hid_desc.h" + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// HID Report Map description +const uint8_t hid_report_map[] = +{ + #if (HID_RPT_KB) + 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) + 0x09, 0x06, // Usage (Keyboard) + 0xA1, 0x01, // Collection (Application) + 0x85, RPT_ID_KB, // Report ID + 0x75, 0x01, // Report Size (1) + 0x95, 0x08, // Report Count (8) + 0x05, 0x07, // Usage Page (Kbrd/Keypad) + 0x19, 0xE0, // Usage Minimum (0xE0) + 0x29, 0xE7, // Usage Maximum (0xE7) + 0x15, 0x00, // Logical Minimum (0) + 0x25, 0x01, // Logical Maximum (1) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x75, 0x08, // Report Size (8) + 0x95, 0x01, // Report Count (1) + 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x75, 0x08, // Report Size (8) + 0x95, 0x06, // Report Count (6) + 0x15, 0x00, // Logical Minimum (0) + 0x26, 0xFF, 0x00, // Logical Maximum (255) + 0x05, 0x07, // Usage Page (Kbrd/Keypad) + 0x19, 0x00, // Usage Minimum (0x00) + 0x29, 0xFF, // Usage Maximum (0xFF) + 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x75, 0x01, // Report Size (1) + 0x95, 0x05, // Report Count (5) + 0x05, 0x08, // Usage Page (LEDs) + 0x19, 0x01, // Usage Minimum (Num Lock) + 0x29, 0x05, // Usage Maximum (Kana) + 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) + 0x75, 0x03, // Report Size (3) + 0x95, 0x01, // Report Count (1) + 0x91, 0x03, // Output (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) + 0xC0, // End Collection + #endif //(HID_RPT_KB) + + #if (HID_RPT_MEDIA) + 0x05, 0x0C, // Usage Page (Consumer) + 0x09, 0x01, // Usage (Consumer Control) + 0xA1, 0x01, // Collection (Application) + 0x85, RPT_ID_MEDIA,// Report ID + 0x15, 0x00, // Logical Minimum (0) + 0x25, 0x01, // Logical Maximum (1) + 0x75, 0x01, // Report Size (1) + 0x95, 0x10, // Report Count (16) + + 0x09, 0x6F, // Usage (Display Brightness Increment) + 0x09, 0x70, // Usage (Display Brightness Decrement ) + 0x09, 0xE9, // Usage (Volume Increment) + 0x09, 0xEA, // Usage (Volume Decrement) + 0x09, 0xB5, // Usage (Scan Next Track) + 0x09, 0xB6, // Usage (Scan Previous Track) + 0x09, 0xB7, // Usage (Stop) + 0x09, 0xCD, // Usage (Play/Pause) + + 0x09, 0xE2, // Usage (Mute) + 0x0A, 0x21, 0x02, // Usage (AC Search) + 0x0A, 0x92, 0x01, // Usage (AL Calculator) + 0x0A, 0x24, 0x02, // Usage (AC Back) + 0x0A, 0x8A, 0x01, // Usage (AL Email Reader) + 0x0A, 0xAE, 0x01, // Usage (AL Keyboard Layout) + 0x0A, 0x23, 0x02, // Usage (AC Home) + 0x0A, 0x96, 0x01, // Usage (AL Internet Browser) + + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0xC0, // End Collection + #endif //(HID_RPT_MEDIA) + + #if (HID_RPT_SYSTEM) + 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) + 0x09, 0x80, // Usage (Sys Control) + 0xA1, 0x01, // Collection (Application) + 0x85, RPT_ID_SYSTEM,// Report ID + 0x15, 0x00, // Logical Minimum (0) + 0x25, 0x01, // Logical Maximum (1) + 0x75, 0x01, // Report Size (1) + 0x95, 0x03, // Report Count (3) + 0x09, 0x81, // Usage (Sys Power Down) + 0x09, 0x82, // Usage (Sys Sleep) + 0x09, 0x83, // Usage (Sys Wake Up) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x95, 0x05, // Report Count (5) + 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0xC0, // End Collection + #endif //(HID_RPT_SYSTEM) + + #if (HID_RPT_MOUSE) + 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) + 0x09, 0x02, // Usage (Mouse) + 0xA1, 0x01, // Collection (Application) + 0x85, RPT_ID_MOUSE,// Report ID + 0x09, 0x01, // Usage (Pointer) + 0xA1, 0x00, // Collection (Physical) + 0x05, 0x09, // Usage Page (Button) + 0x19, 0x01, // Usage Minimum (0x01) + 0x29, 0x08, // Usage Maximum (0x08) + 0x15, 0x00, // Logical Minimum (0) + 0x25, 0x01, // Logical Maximum (1) + 0x75, 0x01, // Report Size (1) + 0x95, 0x08, // Report Count (8) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) + 0x16, 0x08, 0xFF, // Logical Minimum (-248) + 0x26, 0xFF, 0x00, // Logical Maximum (255) + 0x75, 0x10, // Report Size (16) + 0x95, 0x02, // Report Count (2) + 0x09, 0x30, // Usage (X) + 0x09, 0x31, // Usage (Y) + 0x81, 0x06, // Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position) + 0x15, 0x81, // Logical Minimum (-127) + 0x25, 0x7F, // Logical Maximum (127) + 0x75, 0x08, // Report Size (8) + 0x95, 0x01, // Report Count (1) + 0x09, 0x38, // Usage (Wheel) + 0x81, 0x06, // Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position) + 0xC0, // End Collection + 0xC0, // End Collection + #endif //(HID_RPT_MOUSE) + + #if (HID_RPT_PTP) + 0x05, 0x0D, // Usage Page (Digitizer) + 0x09, 0x05, // Usage (Touch Pad) + 0xA1, 0x01, // Collection (Application) + 0x85, RPT_ID_TP, // Report ID + 0x05, 0x0D, // Usage Page (Digitizer) + 0x09, 0x22, // Usage (Finger) + 0xA1, 0x02, // Collection (Logical) + 0x15, 0x00, // Logical Minimum (0) + 0x25, 0x01, // Logical Maximum (1) + 0x09, 0x47, // Usage (0x47) + 0x09, 0x42, // Usage (Tip Switch) + 0x95, 0x02, // Report Count (2) + 0x75, 0x01, // Report Size (1) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x95, 0x01, // Report Count (1) + 0x75, 0x03, // Report Size (3) + 0x25, 0x05, // Logical Maximum (5) + 0x09, 0x51, // Usage (0x51) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x75, 0x01, // Report Size (1) + 0x95, 0x03, // Report Count (3) + 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) + 0x15, 0x00, // Logical Minimum (0) + 0x26, 0x54, 0x0B, // Logical Maximum (2900) + 0x75, 0x10, // Report Size (16) + 0x55, 0x0E, // Unit Exponent (-2) + 0x65, 0x11, // Unit (System: SI Linear, Length: Centimeter) + 0x09, 0x30, // Usage (X) + 0x35, 0x00, // Physical Minimum (0) + 0x46, 0x06, 0x04, // Physical Maximum (1030) + 0x95, 0x01, // Report Count (1) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x46, 0x49, 0x02, // Physical Maximum (585) + 0x26, 0xA4, 0x06, // Logical Maximum (1700) + 0x09, 0x31, // Usage (Y) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0xC0, // End Collection + 0x05, 0x0D, // Usage Page (Digitizer) + 0x09, 0x22, // Usage (Finger) + 0xA1, 0x02, // Collection (Logical) + 0x15, 0x00, // Logical Minimum (0) + 0x25, 0x01, // Logical Maximum (1) + 0x09, 0x47, // Usage (0x47) + 0x09, 0x42, // Usage (Tip Switch) + 0x95, 0x02, // Report Count (2) + 0x75, 0x01, // Report Size (1) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x95, 0x01, // Report Count (1) + 0x75, 0x03, // Report Size (3) + 0x25, 0x05, // Logical Maximum (5) + 0x09, 0x51, // Usage (0x51) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x75, 0x01, // Report Size (1) + 0x95, 0x03, // Report Count (3) + 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) + 0x15, 0x00, // Logical Minimum (0) + 0x26, 0x54, 0x0B, // Logical Maximum (2900) + 0x75, 0x10, // Report Size (16) + 0x55, 0x0E, // Unit Exponent (-2) + 0x65, 0x11, // Unit (System: SI Linear, Length: Centimeter) + 0x09, 0x30, // Usage (X) + 0x35, 0x00, // Physical Minimum (0) + 0x46, 0x06, 0x04, // Physical Maximum (1030) + 0x95, 0x01, // Report Count (1) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x46, 0x49, 0x02, // Physical Maximum (585) + 0x26, 0xA4, 0x06, // Logical Maximum (1700) + 0x09, 0x31, // Usage (Y) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0xC0, // End Collection + 0x05, 0x0D, // Usage Page (Digitizer) + 0x09, 0x22, // Usage (Finger) + 0xA1, 0x02, // Collection (Logical) + 0x15, 0x00, // Logical Minimum (0) + 0x25, 0x01, // Logical Maximum (1) + 0x09, 0x47, // Usage (0x47) + 0x09, 0x42, // Usage (Tip Switch) + 0x95, 0x02, // Report Count (2) + 0x75, 0x01, // Report Size (1) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x95, 0x01, // Report Count (1) + 0x75, 0x03, // Report Size (3) + 0x25, 0x05, // Logical Maximum (5) + 0x09, 0x51, // Usage (0x51) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x75, 0x01, // Report Size (1) + 0x95, 0x03, // Report Count (3) + 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) + 0x15, 0x00, // Logical Minimum (0) + 0x26, 0x54, 0x0B, // Logical Maximum (2900) + 0x75, 0x10, // Report Size (16) + 0x55, 0x0E, // Unit Exponent (-2) + 0x65, 0x11, // Unit (System: SI Linear, Length: Centimeter) + 0x09, 0x30, // Usage (X) + 0x35, 0x00, // Physical Minimum (0) + 0x46, 0x06, 0x04, // Physical Maximum (1030) + 0x95, 0x01, // Report Count (1) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x46, 0x49, 0x02, // Physical Maximum (585) + 0x26, 0xA4, 0x06, // Logical Maximum (1700) + 0x09, 0x31, // Usage (Y) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0xC0, // End Collection + 0x05, 0x0D, // Usage Page (Digitizer) + 0x09, 0x22, // Usage (Finger) + 0xA1, 0x02, // Collection (Logical) + 0x15, 0x00, // Logical Minimum (0) + 0x25, 0x01, // Logical Maximum (1) + 0x09, 0x47, // Usage (0x47) + 0x09, 0x42, // Usage (Tip Switch) + 0x95, 0x02, // Report Count (2) + 0x75, 0x01, // Report Size (1) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x95, 0x01, // Report Count (1) + 0x75, 0x03, // Report Size (3) + 0x25, 0x05, // Logical Maximum (5) + 0x09, 0x51, // Usage (0x51) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x75, 0x01, // Report Size (1) + 0x95, 0x03, // Report Count (3) + 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) + 0x15, 0x00, // Logical Minimum (0) + 0x26, 0x54, 0x0B, // Logical Maximum (2900) + 0x75, 0x10, // Report Size (16) + 0x55, 0x0E, // Unit Exponent (-2) + 0x65, 0x11, // Unit (System: SI Linear, Length: Centimeter) + 0x09, 0x30, // Usage (X) + 0x35, 0x00, // Physical Minimum (0) + 0x46, 0x06, 0x04, // Physical Maximum (1030) + 0x95, 0x01, // Report Count (1) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x46, 0x49, 0x02, // Physical Maximum (585) + 0x26, 0xA4, 0x06, // Logical Maximum (1700) + 0x09, 0x31, // Usage (Y) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0xC0, // End Collection + 0x05, 0x0D, // Usage Page (Digitizer) + 0x09, 0x22, // Usage (Finger) + 0xA1, 0x02, // Collection (Logical) + 0x15, 0x00, // Logical Minimum (0) + 0x25, 0x01, // Logical Maximum (1) + 0x09, 0x47, // Usage (0x47) + 0x09, 0x42, // Usage (Tip Switch) + 0x95, 0x02, // Report Count (2) + 0x75, 0x01, // Report Size (1) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x95, 0x01, // Report Count (1) + 0x75, 0x03, // Report Size (3) + 0x25, 0x05, // Logical Maximum (5) + 0x09, 0x51, // Usage (0x51) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x75, 0x01, // Report Size (1) + 0x95, 0x03, // Report Count (3) + 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) + 0x15, 0x00, // Logical Minimum (0) + 0x26, 0x54, 0x0B, // Logical Maximum (2900) + 0x75, 0x10, // Report Size (16) + 0x55, 0x0E, // Unit Exponent (-2) + 0x65, 0x11, // Unit (System: SI Linear, Length: Centimeter) + 0x09, 0x30, // Usage (X) + 0x35, 0x00, // Physical Minimum (0) + 0x46, 0x06, 0x04, // Physical Maximum (1030) + 0x95, 0x01, // Report Count (1) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x46, 0x49, 0x02, // Physical Maximum (585) + 0x26, 0xA4, 0x06, // Logical Maximum (1700) + 0x09, 0x31, // Usage (Y) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0xC0, // End Collection + 0x05, 0x0D, // Usage Page (Digitizer) + 0x55, 0x0C, // Unit Exponent (-4) + 0x66, 0x01, 0x10, // Unit (System: SI Linear, Time: Seconds) + 0x47, 0xFF, 0xFF, 0x00, 0x00, // Physical Maximum (65534) + 0x27, 0xFF, 0xFF, 0x00, 0x00, // Logical Maximum (65534) + 0x75, 0x10, // Report Size (16) + 0x95, 0x01, // Report Count (1) + 0x09, 0x56, // Usage (0x56) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x09, 0x54, // Usage (0x54) + 0x25, 0x7F, // Logical Maximum (127) + 0x95, 0x01, // Report Count (1) + 0x75, 0x08, // Report Size (8) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x05, 0x09, // Usage Page (Button) + 0x09, 0x01, // Usage (0x01) + 0x09, 0x02, // Usage (0x02) + 0x09, 0x03, // Usage (0x03) + 0x25, 0x01, // Logical Maximum (1) + 0x75, 0x01, // Report Size (1) + 0x95, 0x03, // Report Count (3) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x95, 0x05, // Report Count (5) + 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x05, 0x0D, // Usage Page (Digitizer) + 0x85, RPT_ID_MAXCNT,// Report ID + 0x09, 0x55, // Usage (0x55) + 0x09, 0x59, // Usage (0x59) + 0x75, 0x04, // Report Size (4) + 0x95, 0x02, // Report Count (2) + 0x25, 0x0F, // Logical Maximum (15) + 0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) + 0x06, 0x00, 0xFF, // Usage Page (Vendor Defined 0xFF00) + 0x85, RPT_ID_PTPHQA, // Report ID + 0x09, 0xC5, // Usage (0xC5) + 0x15, 0x00, // Logical Minimum (0) + 0x26, 0xFF, 0x00, // Logical Maximum (255) + 0x75, 0x08, // Report Size (8) + 0x96, 0x00, 0x01, // Report Count (256) + 0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) + 0xC0, // End Collection + #endif //(HID_RPT_PTP) +}; + +#if (HID_RPT_PTP) +/// HID PTP HQA description, host read feature +/// https://learn.microsoft.com/zh-cn/windows-hardware/design/component-guidelines/windows-precision-touchpad-required-hid-top-level-collections +const uint8_t ptphqa_blob[] = +{ + 0xFC, 0x28, 0xFE, 0x84, 0x40, 0xCB, 0x9A, 0x87, 0x0D, 0xBE, 0x57, 0x3C, 0xB6, 0x70, 0x09, 0x88, + 0x07, 0x97, 0x2D, 0x2B, 0xE3, 0x38, 0x34, 0xB6, 0x6C, 0xED, 0xB0, 0xF7, 0xE5, 0x9C, 0xF6, 0xC2, + 0x2E, 0x84, 0x1B, 0xE8, 0xB4, 0x51, 0x78, 0x43, 0x1F, 0x28, 0x4B, 0x7C, 0x2D, 0x53, 0xAF, 0xFC, + 0x47, 0x70, 0x1B, 0x59, 0x6F, 0x74, 0x43, 0xC4, 0xF3, 0x47, 0x18, 0x53, 0x1A, 0xA2, 0xA1, 0x71, + 0xC7, 0x95, 0x0E, 0x31, 0x55, 0x21, 0xD3, 0xB5, 0x1E, 0xE9, 0x0C, 0xBA, 0xEC, 0xB8, 0x89, 0x19, + 0x3E, 0xB3, 0xAF, 0x75, 0x81, 0x9D, 0x53, 0xB9, 0x41, 0x57, 0xF4, 0x6D, 0x39, 0x25, 0x29, 0x7C, + 0x87, 0xD9, 0xB4, 0x98, 0x45, 0x7D, 0xA7, 0x26, 0x9C, 0x65, 0x3B, 0x85, 0x68, 0x89, 0xD7, 0x3B, + 0xBD, 0xFF, 0x14, 0x67, 0xF2, 0x2B, 0xF0, 0x2A, 0x41, 0x54, 0xF0, 0xFD, 0x2C, 0x66, 0x7C, 0xF8, + 0xC0, 0x8F, 0x33, 0x13, 0x03, 0xF1, 0xD3, 0xC1, 0x0B, 0x89, 0xD9, 0x1B, 0x62, 0xCD, 0x51, 0xB7, + 0x80, 0xB8, 0xAF, 0x3A, 0x10, 0xC1, 0x8A, 0x5B, 0xE8, 0x8A, 0x56, 0xF0, 0x8C, 0xAA, 0xFA, 0x35, + 0xE9, 0x42, 0xC4, 0xD8, 0x55, 0xC3, 0x38, 0xCC, 0x2B, 0x53, 0x5C, 0x69, 0x52, 0xD5, 0xC8, 0x73, + 0x02, 0x38, 0x7C, 0x73, 0xB6, 0x41, 0xE7, 0xFF, 0x05, 0xD8, 0x2B, 0x79, 0x9A, 0xE2, 0x34, 0x60, + 0x8F, 0xA3, 0x32, 0x1F, 0x09, 0x78, 0x62, 0xBC, 0x80, 0xE3, 0x0F, 0xBD, 0x65, 0x20, 0x08, 0x13, + 0xC1, 0xE2, 0xEE, 0x53, 0x2D, 0x86, 0x7E, 0xA7, 0x5A, 0xC5, 0xD3, 0x7D, 0x98, 0xBE, 0x31, 0x48, + 0x1F, 0xFB, 0xDA, 0xAF, 0xA2, 0xA8, 0x6A, 0x89, 0xD6, 0xBF, 0xF2, 0xD3, 0x32, 0x2A, 0x9A, 0xE4, + 0xCF, 0x17, 0xB7, 0xB8, 0xF4, 0xE1, 0x33, 0x08, 0x24, 0x8B, 0xC4, 0x43, 0xA5, 0xE5, 0x24, 0xC2 +}; +#endif //(HID_RPT_PTP) + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Get HID Report Map description. + * + * @param[out] plen Retrieved Length of description + * + * @return Pointer of the description + **************************************************************************************** + */ +const uint8_t *hid_get_report_map(uint16_t *plen) +{ + *plen = sizeof(hid_report_map); + + return hid_report_map; +} + +#if (HID_RPT_PTP) +/** + **************************************************************************************** + * @brief Get HID PTP HQA description. + * + * @param[out] plen Retrieved Length of description + * + * @return Pointer of the description + **************************************************************************************** + */ +const uint8_t *hid_get_ptphqa_blob(uint16_t *plen) +{ + *plen = sizeof(ptphqa_blob); + return ptphqa_blob; +} +#endif //(HID_RPT_PTP) diff --git a/projects/bleHid/src/hid_desc.h b/projects/bleHid/src/hid_desc.h new file mode 100644 index 0000000..c65bcd1 --- /dev/null +++ b/projects/bleHid/src/hid_desc.h @@ -0,0 +1,122 @@ +/** + **************************************************************************************** + * + * @file hid_desc.h + * + * @brief Header file - HID Report Map, Descriptions. + * + * < Implementation according to user's application-specific > + **************************************************************************************** + */ + +#ifndef HID_DESC_H_ +#define HID_DESC_H_ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +#define HID_BOOT_SUP (1) +#define HID_REPORT_SUP (1) + +#if (HID_BOOT_SUP) + #define HID_BOOT_KB (0) + #define HID_BOOT_MOUSE (0) +#endif //(HID_BOOT_SUP) + +#if (HID_REPORT_SUP) + #define HID_RPT_KB (1) + #define HID_RPT_MEDIA (1) + #define HID_RPT_SYSTEM (1) + #define HID_RPT_MOUSE (1) + #define HID_RPT_PTP (0) +#endif //(HID_REPORT_SUP) + +/// HID Report ID and Length, declared in Report Map (User Customize) +#define RPT_ID_KB (1) +#define RPT_LEN_KB (8) // 1B(ctlkeys) + 1B(resv) + 6B(keycode) + +#define RPT_ID_MEDIA (2) +#define RPT_LEN_MEDIA (2) // 16bits + +#define RPT_ID_SYSTEM (3) +#define RPT_LEN_SYSTEM (1) // 8bits + +#define RPT_ID_MOUSE (4) +#define RPT_LEN_MOUSE (6) // 1B(button) + 2B(X) + 2B(Y) + 1B(Wheel) + +#define RPT_ID_TP (5) +#define RPT_ID_MAXCNT (6) // Feature - Finger count +#define RPT_ID_PTPHQA (7) // Feature - HQA +#define RPT_LEN_TP (29) // Touch point +#define PTP_MAX_FINGER_CNT (5) + +/// HID Report Index of Notification +#define RPT_NTF_STOP (0x00) +#define RPT_NTF_ALL ((1 << RPT_IDX_NB) - 1) + +enum rpt_ntf_idx +{ + // Indexes of HID BOOT + RPT_IDX_BOOT_KB, + RPT_IDX_BOOT_MOUSE, + // Indexes of HID REPORT + RPT_IDX_KB, + RPT_IDX_MEDIA, + RPT_IDX_SYSTEM, + RPT_IDX_MOUSE, + RPT_IDX_TP, + + // Max Index, *NOTE* not excced Bits of rpt_ntfs + RPT_IDX_NB, +}; + + +/* + * MACRO DEFINITIONS + **************************************************************************************** + */ + +#include "prf_hids.h" + +#define mouse_report_send(conidx, p_data) hids_report_send(conidx, RPT_IDX_MOUSE, RPT_LEN_MOUSE, p_data) +#define keybd_report_send(conidx, p_data) hids_report_send(conidx, RPT_IDX_KB, RPT_LEN_KB, p_data) +#define media_report_send(conidx, p_data) hids_report_send(conidx, RPT_IDX_MEDIA, RPT_LEN_MEDIA, p_data) +#define system_report_send(conidx, p_data) hids_report_send(conidx, RPT_IDX_SYSTEM, RPT_LEN_SYSTEM, p_data) + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Get HID Report Map description. + * + * @param[out] plen Retrieved Length of description + * + * @return Pointer of the description + **************************************************************************************** + */ +const uint8_t *hid_get_report_map(uint16_t *plen); + +#if (HID_RPT_PTP) +/** + **************************************************************************************** + * @brief Get HID PTP HQA description. + * + * @param[out] plen Retrieved Length of description + * + * @return Pointer of the description + **************************************************************************************** + */ +const uint8_t *hid_get_ptphqa_blob(uint16_t *plen); +#endif //(HID_RPT_PTP) + + +#endif /* HID_DESC_H_ */ diff --git a/projects/bleHid/src/main.c b/projects/bleHid/src/main.c new file mode 100644 index 0000000..5371952 --- /dev/null +++ b/projects/bleHid/src/main.c @@ -0,0 +1,86 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" +#include "app.h" +#include "sftmr.h" +#include "leds.h" +#include "batt.h" +#include "uartRb.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +extern void user_procedure(void); + +static void sysInit(void) +{ + iwdt_disable(); + + rcc_ble_en(); + rcc_adc_en(); + + rcc_fshclk_set(FSH_CLK_DPSC42); +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + uart1Rb_Init(); //dbgInit(); + debug("Start(rsn:%X)...\r\n", rsn); + + #if (LED_PLAY) + sftmr_init(); + leds_init(); + leds_play(LED_FAST_BL); + #endif //(LED_PLAY) + + batt_init(); + + // Init BLE App + app_init(rsn); +} + +int main(void) +{ + sysInit(); + devInit(); + + // Global Interrupt Enable + GLOBAL_INT_START(); + + // main loop + while (1) + { + // Schedule Messages & Events + ble_schedule(); + + #if (LED_PLAY) + // SoftTimer Polling + sftmr_schedule(); + #endif //(LED_PLAY) + + // User's Procedure + user_procedure(); + } +} diff --git a/projects/bleHid/src/myapp.c b/projects/bleHid/src/myapp.c new file mode 100644 index 0000000..741f298 --- /dev/null +++ b/projects/bleHid/src/myapp.c @@ -0,0 +1,73 @@ +/** + **************************************************************************************** + * + * @file myapp.c + * + * @brief User Application - Override func + * + **************************************************************************************** + */ + +#include "app.h" +#include "bledef.h" +#include "drvs.h" +#include "leds.h" + +#if (DBG_APP) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat,len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * VARIABLES DEFINITIONS + **************************************************************************************** + */ + + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +#if (LED_PLAY) +/** + **************************************************************************************** + * @brief API to Set State of Application, add leds Indication + * + * @param[in] state new state + **************************************************************************************** + */ +void app_state_set(uint8_t state) +{ + DEBUG("State(old:%d,new:%d)", app_state_get(), state); + + app_env.state = state; + + // Indication, User add more... + if (state == APP_IDLE) + { + leds_play(LED_SLOW_BL); + } + else if (state == APP_READY) + { + leds_play(LED_FAST_BL); + } + else if (state == APP_CONNECTED) + { + leds_play(LED_CONT_ON); + } +} +#endif //(LED_PLAY) + diff --git a/projects/bleHid/src/proc.c b/projects/bleHid/src/proc.c new file mode 100644 index 0000000..911489e --- /dev/null +++ b/projects/bleHid/src/proc.c @@ -0,0 +1,204 @@ +/** + **************************************************************************************** + * + * @file proc.c + * + * @brief user procedure. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" + +#include "app.h" +#include "uartRb.h" +#include "prf_bass.h" +#include "hid_desc.h" + +#if (DBG_PROC) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +enum uart_cmd +{ + CMD_KB_REP = 0xC0, + CMD_MEDIA_REP, + CMD_SYSTEM_REP, + + CMD_MOUSE_REP = 0xD0, + CMD_MOUSE_BTN, + CMD_MOUSE_X, + CMD_MOUSE_Y, + CMD_MOUSE_WHEEL, + + CMD_CONN_INTERVAL = 0xE0, + CMD_SVC_CHG, + + CMD_BATT_LVL = 0xF0, + CMD_BATT_PWR_STA +}; + +#define CMD_MAX_LEN 20 +#define NULL_CNT 20 + +static uint8_t buff[CMD_MAX_LEN]; +static uint16_t buff_len = 0; + +uint8_t hid_keybd_send_report(uint8_t code); +uint8_t hid_mouse_send_report(int8_t x); + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +static void uart_proc(void) +{ + static uint8_t null_cnt = 0; + uint16_t len; + bool finish = true; + + len = uart1Rb_Read(&buff[buff_len], CMD_MAX_LEN - buff_len); + if (len > 0) + { + buff_len += len; + if (buff_len < CMD_MAX_LEN) + { + return; // wait full + } + } + else + { + if ((buff_len > 0) && (null_cnt++ > NULL_CNT)) + { + //finish = true; + null_cnt = 0; + } + else + { + return; // wait again + } + } + + if (app_state_get() == APP_CONNECTED) + { + switch (buff[0]) + { + case CMD_KB_REP: + { + DEBUG("key_code:0x%02x", buff[1]); + uint8_t kyebd_report[] = {0x00, 0x00, buff[1], 0x00, 0x00, 0x00, 0x00, 0x00 }; //6 + keybd_report_send(app_env.curidx, kyebd_report); + keybd_report_send(app_env.curidx, NULL); + } break; + + case CMD_MEDIA_REP: + { + if (buff_len >= 4) + { + DEBUG("MEDIA: %02X %02X %02X", buff[1], buff[2], buff[3]); + + media_report_send(app_env.curidx, &buff[1]); + media_report_send(app_env.curidx, NULL); + } + } break; + + case CMD_SYSTEM_REP: + { + DEBUG("CMD_SYSTEM_REP:%x", buff[1]); + + system_report_send(app_env.curidx, &buff[1]); + system_report_send(app_env.curidx, NULL); + } break; + + case CMD_MOUSE_REP: + { + // Simple move X (offset=10) + buff[0] = CMD_MOUSE_X; + buff[1] = 10; + } //no break; + case CMD_MOUSE_BTN: + case CMD_MOUSE_X: + case CMD_MOUSE_Y: + case CMD_MOUSE_WHEEL: + { + uint8_t mouse_data[] = {0, 0, 0, 0, 0, 0}; + uint8_t idx = buff[0]-CMD_MOUSE_BTN; + if (idx) idx = (idx*2) - 1; // 2X 2Y + + mouse_data[idx] = buff[1]; + DEBUG("MOUSE(1Btn,2X,2Y,1Wheel)[%d]:0x%02x", idx, buff[1]); + + mouse_report_send(app_env.curidx, mouse_data); + mouse_report_send(app_env.curidx, NULL); // release + } break; + + case CMD_BATT_LVL: + { + DEBUG("Batt Lvl"); + bass_bat_lvl_update(buff[1]); + } break; + + case CMD_BATT_PWR_STA: + { + DEBUG("Batt Power State"); + bass_pwr_sta_update(buff[1]); + } break; + + case CMD_CONN_INTERVAL: + { + struct gapc_conn_param conn_pref = + { + /// Connection interval minimum unit in 1.25ms + .intv_min = 6, + /// Connection interval maximum unit in 1.25ms + .intv_max = 6, + /// Slave latency + .latency = 0, + /// Connection supervision timeout multiplier unit in 10ms + .time_out = 300, + }; + + conn_pref.intv_min = buff[1]; + conn_pref.intv_max = buff[2]; + conn_pref.latency = buff[3]; + + DEBUG("intvn:%d, intvm:%d, lat:%d", conn_pref.intv_min, conn_pref.intv_max, conn_pref.latency); + gapc_update_param(app_env.curidx, &conn_pref); + } break; + + case CMD_SVC_CHG: + { + DEBUG("service change"); + //gatt_svc_chg(app_env.curidx, 0, 0xFFFF); + } break; + + default: + { + } break; + } + } + + if (finish) + { + buff_len = 0; + } +} + +void user_procedure(void) +{ + uart_proc(); +} diff --git a/projects/bleHid_Keybd/mdk/JLinkSettings.ini b/projects/bleHid_Keybd/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/projects/bleHid_Keybd/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/projects/bleHid_Keybd/mdk/bleHid_Keybd.uvoptx b/projects/bleHid_Keybd/mdk/bleHid_Keybd.uvoptx new file mode 100644 index 0000000..48e5e71 --- /dev/null +++ b/projects/bleHid_Keybd/mdk/bleHid_Keybd.uvoptx @@ -0,0 +1,571 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + bleHid_Keybd + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FN1 -FC1000 -FD20003000 -FF0B6x_256kB_PY_D -FL040000 -FS018000000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC1000 -FN1 -FF0B6x_256kB_PY_D -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 0 + 1 + hid_env + + + + + 1 + 1 + 0x20003000 + 0 + + + + + 2 + 1 + 0x40010000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + src + 1 + 0 + 0 + 0 + + 1 + 1 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 1 + 2 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 1 + 3 + 1 + 0 + 0 + 0 + ..\src\myapp.c + myapp.c + 0 + 0 + + + 1 + 4 + 1 + 0 + 0 + 0 + ..\src\batt.c + batt.c + 0 + 0 + + + 1 + 5 + 1 + 0 + 0 + 0 + ..\src\proc.c + proc.c + 0 + 0 + + + 1 + 6 + 1 + 0 + 0 + 0 + ..\src\keys.c + keys.c + 0 + 0 + + + 1 + 7 + 1 + 0 + 0 + 0 + ..\src\hid_desc.c + hid_desc.c + 0 + 0 + + + + + core + 0 + 0 + 0 + 0 + + 2 + 8 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 9 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 10 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + modules + 1 + 0 + 0 + 0 + + 4 + 11 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\leds.c + leds.c + 0 + 0 + + + 4 + 12 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\sftmr.c + sftmr.c + 0 + 0 + + + 4 + 13 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\uart1Rb.c + uart1Rb.c + 0 + 0 + + + + + ble\app + 1 + 0 + 0 + 0 + + 5 + 14 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app.c + app.c + 0 + 0 + + + 5 + 15 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_actv.c + app_actv.c + 0 + 0 + + + 5 + 16 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_msg.c + app_msg.c + 0 + 0 + + + 5 + 17 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gapm.c + app_gapm.c + 0 + 0 + + + 5 + 18 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gapc.c + app_gapc.c + 0 + 0 + + + + + ble\prf + 1 + 0 + 0 + 0 + + 6 + 19 + 1 + 0 + 0 + 0 + ..\..\..\ble\prf\prf_diss.c + prf_diss.c + 0 + 0 + + + 6 + 20 + 1 + 0 + 0 + 0 + ..\..\..\ble\prf\prf_bass.c + prf_bass.c + 0 + 0 + + + 6 + 21 + 1 + 0 + 0 + 0 + ..\..\..\ble\prf\prf_hids.c + prf_hids.c + 0 + 0 + + + + + ble\lib + 1 + 0 + 0 + 0 + + 7 + 22 + 4 + 0 + 0 + 0 + ..\..\..\ble\lib\ble6.lib + ble6.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 8 + 23 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/projects/bleHid_Keybd/mdk/bleHid_Keybd.uvprojx b/projects/bleHid_Keybd/mdk/bleHid_Keybd.uvprojx new file mode 100644 index 0000000..d38ea5a --- /dev/null +++ b/projects/bleHid_Keybd/mdk/bleHid_Keybd.uvprojx @@ -0,0 +1,545 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + bleHid_Keybd + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20003000 -FC1000 -FN1 -FF0B6x_256kB_PY_D -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM)) + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + bleHid_Keybd + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + -REMAP + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 16 + 1 + 0 + 0 + 0 + 4 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x1000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip_ble.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + myapp.c + 1 + ..\src\myapp.c + + + batt.c + 1 + ..\src\batt.c + + + proc.c + 1 + ..\src\proc.c + + + keys.c + 1 + ..\src\keys.c + + + hid_desc.c + 1 + ..\src\hid_desc.c + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + modules + + + leds.c + 1 + ..\..\..\modules\src\leds.c + + + sftmr.c + 1 + ..\..\..\modules\src\sftmr.c + + + uart1Rb.c + 1 + ..\..\..\modules\src\uart1Rb.c + + + + + ble\app + + + app.c + 1 + ..\..\..\ble\app\app.c + + + app_actv.c + 1 + ..\..\..\ble\app\app_actv.c + + + app_msg.c + 1 + ..\..\..\ble\app\app_msg.c + + + app_gapm.c + 1 + ..\..\..\ble\app\app_gapm.c + + + app_gapc.c + 1 + ..\..\..\ble\app\app_gapc.c + + + + + ble\prf + + + prf_diss.c + 1 + ..\..\..\ble\prf\prf_diss.c + + + prf_bass.c + 1 + ..\..\..\ble\prf\prf_bass.c + + + prf_hids.c + 1 + ..\..\..\ble\prf\prf_hids.c + + + + + ble\lib + + + ble6.lib + 4 + ..\..\..\ble\lib\ble6.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/projects/bleHid_Keybd/mdk/clean.bat b/projects/bleHid_Keybd/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/projects/bleHid_Keybd/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/projects/bleHid_Keybd/src/batt.c b/projects/bleHid_Keybd/src/batt.c new file mode 100644 index 0000000..455f864 --- /dev/null +++ b/projects/bleHid_Keybd/src/batt.c @@ -0,0 +1,46 @@ +/** + **************************************************************************************** + * + * @file batt.c + * + * @brief Battery voltage detection + * + **************************************************************************************** + */ + +#include "batt.h" +#include "sadc.h" + +#if (DBG_BATT) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +#define ADC_CHAN_VDD12 (14) // 1200mV +#define ADC_READ_CNT (0x07) + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +void batt_init(void) +{ + +} + +uint8_t batt_level(void) +{ + uint8_t lvl = 100; + + return lvl; +} diff --git a/projects/bleHid_Keybd/src/batt.h b/projects/bleHid_Keybd/src/batt.h new file mode 100644 index 0000000..761f188 --- /dev/null +++ b/projects/bleHid_Keybd/src/batt.h @@ -0,0 +1,13 @@ +#ifndef _BATT_H_ +#define _BATT_H_ + +#include + +#define BATT_LVL_MAX 100 +#define BATT_LVL_MIN 0 + +void batt_init(void); + +uint8_t batt_level(void); + +#endif //_BATT_H_ diff --git a/projects/bleHid_Keybd/src/cfg.h b/projects/bleHid_Keybd/src/cfg.h new file mode 100644 index 0000000..c5cd2a9 --- /dev/null +++ b/projects/bleHid_Keybd/src/cfg.h @@ -0,0 +1,50 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// System Clock(0=16MHz, 1=32MHz, 2=48MHz, 3=64MHz) +#define SYS_CLK (0) + +/// Debug Mode(0=Disable, 1=via UART, 2=via RTT) +#define DBG_MODE (1) + +/// BLE Configure (Single or Multi-Connections) +#define BLE_NB_SLAVE (1) +#define BLE_NB_MASTER (0) + +#define BLE_ADDR {0x1F, 0x06, 0x23, 0xA1, 0x01, 0xD2} +#define BLE_DEV_NAME "B6x-KB_" +#define BLE_DEV_ICON 0x03C1 // 03C0-Generic HID,03C1-Keyboard,03C2-Mouse,03C4-Gamepad +#define BLE_PHY (GAP_PHY_LE_1MBPS) +#define BLE_AUTH (GAP_AUTH_REQ_NO_MITM_BOND) + +/// Profile Configure +#define PRF_DISS (1) +#define PRF_BASS (1) +#define PRF_HIDS (1) + +/// Debug Configure +#if (DBG_MODE) + #define DBG_APP (1) + #define DBG_PROC (1) + #define DBG_ACTV (0) + #define DBG_GAPM (0) + #define DBG_GAPC (1) + #define DBG_KEYS (0) + #define DBG_HIDS (0) + #define DBG_BASS (0) +#endif + +/// Misc Options +#define LED_PLAY (1) + +#endif //_APP_CFG_H_ diff --git a/projects/bleHid_Keybd/src/hid_desc.c b/projects/bleHid_Keybd/src/hid_desc.c new file mode 100644 index 0000000..f2776d9 --- /dev/null +++ b/projects/bleHid_Keybd/src/hid_desc.c @@ -0,0 +1,135 @@ +/** + **************************************************************************************** + * + * @file hid_desc.c + * + * @brief HID Report Map, descriptions. + * + * < Implementation according to user's application-specific > + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "hid_desc.h" + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// HID Report Map description +const uint8_t hid_report_map[] = +{ + #if (HID_RPT_KB) + 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) + 0x09, 0x06, // Usage (Keyboard) + 0xA1, 0x01, // Collection (Application) + 0x85, RPT_ID_KB, // Report ID + 0x75, 0x01, // Report Size (1) + 0x95, 0x08, // Report Count (8) + 0x05, 0x07, // Usage Page (Kbrd/Keypad) + 0x19, 0xE0, // Usage Minimum (0xE0) + 0x29, 0xE7, // Usage Maximum (0xE7) + 0x15, 0x00, // Logical Minimum (0) + 0x25, 0x01, // Logical Maximum (1) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x75, 0x08, // Report Size (8) + 0x95, 0x01, // Report Count (1) + 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x75, 0x08, // Report Size (8) + 0x95, 0x06, // Report Count (6) + 0x15, 0x00, // Logical Minimum (0) + 0x26, 0xFF, 0x00, // Logical Maximum (255) + 0x05, 0x07, // Usage Page (Kbrd/Keypad) + 0x19, 0x00, // Usage Minimum (0x00) + 0x29, 0xFF, // Usage Maximum (0xFF) + 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x75, 0x01, // Report Size (1) + 0x95, 0x05, // Report Count (5) + 0x05, 0x08, // Usage Page (LEDs) + 0x19, 0x01, // Usage Minimum (Num Lock) + 0x29, 0x05, // Usage Maximum (Kana) + 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) + 0x75, 0x03, // Report Size (3) + 0x95, 0x01, // Report Count (1) + 0x91, 0x03, // Output (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) + 0xC0, // End Collection + #endif //(HID_RPT_KB) + + #if (HID_RPT_MEDIA) + 0x05, 0x0C, // Usage Page (Consumer) + 0x09, 0x01, // Usage (Consumer Control) + 0xA1, 0x01, // Collection (Application) + 0x85, RPT_ID_MEDIA,// Report ID + 0x15, 0x00, // Logical Minimum (0) + 0x25, 0x01, // Logical Maximum (1) + 0x75, 0x01, // Report Size (1) + 0x95, 0x10, // Report Count (16) + + 0x09, 0x6F, // Usage (Display Brightness Increment) + 0x09, 0x70, // Usage (Display Brightness Decrement ) + 0x09, 0xE9, // Usage (Volume Increment) + 0x09, 0xEA, // Usage (Volume Decrement) + 0x09, 0xB5, // Usage (Scan Next Track) + 0x09, 0xB6, // Usage (Scan Previous Track) + 0x09, 0xB7, // Usage (Stop) + 0x09, 0xCD, // Usage (Play/Pause) + + 0x09, 0xE2, // Usage (Mute) + 0x0A, 0x21, 0x02, // Usage (AC Search) + 0x0A, 0x92, 0x01, // Usage (AL Calculator) + 0x0A, 0x24, 0x02, // Usage (AC Back) + 0x0A, 0x8A, 0x01, // Usage (AL Email Reader) + 0x0A, 0xAE, 0x01, // Usage (AL Keyboard Layout) + 0x0A, 0x23, 0x02, // Usage (AC Home) + 0x0A, 0x96, 0x01, // Usage (AL Internet Browser) + + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0xC0, // End Collection + #endif //(HID_RPT_MEDIA) + + #if (HID_RPT_SYSTEM) + 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) + 0x09, 0x80, // Usage (Sys Control) + 0xA1, 0x01, // Collection (Application) + 0x85, RPT_ID_SYSTEM,// Report ID + 0x15, 0x00, // Logical Minimum (0) + 0x25, 0x01, // Logical Maximum (1) + 0x75, 0x01, // Report Size (1) + 0x95, 0x03, // Report Count (3) + 0x09, 0x81, // Usage (Sys Power Down) + 0x09, 0x82, // Usage (Sys Sleep) + 0x09, 0x83, // Usage (Sys Wake Up) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x95, 0x05, // Report Count (5) + 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0xC0, // End Collection + #endif //(HID_RPT_SYSTEM) +}; + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Get HID Report Map description. + * + * @param[out] plen Retrieved Length of description + * + * @return Pointer of the description + **************************************************************************************** + */ +const uint8_t *hid_get_report_map(uint16_t *plen) +{ + *plen = sizeof(hid_report_map); + + return hid_report_map; +} diff --git a/projects/bleHid_Keybd/src/hid_desc.h b/projects/bleHid_Keybd/src/hid_desc.h new file mode 100644 index 0000000..59a5743 --- /dev/null +++ b/projects/bleHid_Keybd/src/hid_desc.h @@ -0,0 +1,122 @@ +/** + **************************************************************************************** + * + * @file hid_desc.h + * + * @brief Header file - HID Report Map, Descriptions. + * + * < Implementation according to user's application-specific > + **************************************************************************************** + */ + +#ifndef HID_DESC_H_ +#define HID_DESC_H_ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +#define HID_BOOT_SUP (0) +#define HID_REPORT_SUP (1) + +#if (HID_BOOT_SUP) + #define HID_BOOT_KB (0) + #define HID_BOOT_MOUSE (0) +#endif //(HID_BOOT_SUP) + +#if (HID_REPORT_SUP) + #define HID_RPT_KB (1) + #define HID_RPT_MEDIA (1) + #define HID_RPT_SYSTEM (1) + #define HID_RPT_MOUSE (0) + #define HID_RPT_PTP (0) +#endif //(HID_REPORT_SUP) + +/// HID Report ID and Length, declared in Report Map (User Customize) +#define RPT_ID_KB (1) +#define RPT_LEN_KB (8) // 1B(ctlkeys) + 1B(resv) + 6B(keycode) + +#define RPT_ID_MEDIA (2) +#define RPT_LEN_MEDIA (2) // 16bits + +#define RPT_ID_SYSTEM (3) +#define RPT_LEN_SYSTEM (1) // 8bits + +#define RPT_ID_MOUSE (4) +#define RPT_LEN_MOUSE (6) // 1B(button) + 2B(X) + 2B(Y) + 1B(Wheel) + +#define RPT_ID_TP (5) +#define RPT_ID_MAXCNT (6) // Feature - Finger count +#define RPT_ID_PTPHQA (7) // Feature - HQA +#define RPT_LEN_TP (29) // Touch point +#define PTP_MAX_FINGER_CNT (5) + +/// HID Report Index of Notification +#define RPT_NTF_STOP (0x00) +#define RPT_NTF_ALL ((1 << RPT_IDX_NB) - 1) + +enum rpt_ntf_idx +{ + // Indexes of HID BOOT + RPT_IDX_BOOT_KB, + RPT_IDX_BOOT_MOUSE, + // Indexes of HID REPORT + RPT_IDX_KB, + RPT_IDX_MEDIA, + RPT_IDX_SYSTEM, + RPT_IDX_MOUSE, + RPT_IDX_TP, + + // Max Index, *NOTE* not excced Bits of rpt_ntfs + RPT_IDX_NB, +}; + + +/* + * MACRO DEFINITIONS + **************************************************************************************** + */ + +#include "prf_hids.h" + +#define mouse_report_send(conidx, p_data) hids_report_send(conidx, RPT_IDX_MOUSE, RPT_LEN_MOUSE, p_data) +#define keybd_report_send(conidx, p_data) hids_report_send(conidx, RPT_IDX_KB, RPT_LEN_KB, p_data) +#define media_report_send(conidx, p_data) hids_report_send(conidx, RPT_IDX_MEDIA, RPT_LEN_MEDIA, p_data) +#define system_report_send(conidx, p_data) hids_report_send(conidx, RPT_IDX_SYSTEM, RPT_LEN_SYSTEM, p_data) + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Get HID Report Map description. + * + * @param[out] plen Retrieved Length of description + * + * @return Pointer of the description + **************************************************************************************** + */ +const uint8_t *hid_get_report_map(uint16_t *plen); + +#if (HID_RPT_PTP) +/** + **************************************************************************************** + * @brief Get HID PTP HQA description. + * + * @param[out] plen Retrieved Length of description + * + * @return Pointer of the description + **************************************************************************************** + */ +const uint8_t *hid_get_ptphqa_blob(uint16_t *plen); +#endif //(HID_RPT_PTP) + + +#endif /* HID_DESC_H_ */ diff --git a/projects/bleHid_Keybd/src/keys.c b/projects/bleHid_Keybd/src/keys.c new file mode 100644 index 0000000..777678b --- /dev/null +++ b/projects/bleHid_Keybd/src/keys.c @@ -0,0 +1,162 @@ +/** + **************************************************************************************** + * + * @file keys.c + * + * @brief keys operation. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "app.h" +#include "hid_desc.h" + +#if (DBG_KEYS) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +#define PA_LED0 PA08 +#define PA_LED1 PA09 +#define PA_BTN0 PA15 +#define PA_BTN1 PA16 +#define PA_BTN2 PA17 + +#define LED0 BIT(PA_LED0) +#define LED1 BIT(PA_LED1) +#define LEDS (LED1 | LED0) + +#define BTN0 BIT(PA_BTN0) +#define BTN1 BIT(PA_BTN1) +#define BTN2 BIT(PA_BTN2) +#define BTNS (BTN0 | BTN1 | BTN2) + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +void hids_led_lock(uint8_t leds) +{ + if (leds & 0x01/*NUM_LOCK*/) + { + GPIO_DAT_CLR(LED0); + } + else + { + GPIO_DAT_SET(LED0); + } + + if (leds & 0x02/*CAPS_LOCK*/) + { + GPIO_DAT_CLR(LED1); + } + else + { + GPIO_DAT_SET(LED1); + } +} + +uint8_t hid_keybd_send_report(uint8_t code) +{ + uint8_t ret = 0; + + uint8_t kyebd_report[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; //A + + kyebd_report[2] = code; + + ret = keybd_report_send(app_env.curidx, kyebd_report); + + return ret; +} + +struct mouse_rep +{ + uint8_t btns; + int16_t xoft; + int16_t yoft; + int8_t wheel; +} __attribute__((packed)); + +uint8_t hid_mouse_send_report(int8_t x) +{ + uint8_t ret = 0; + + #if (HID_RPT_MOUSE) + struct mouse_rep mouse_report; + + mouse_report.btns = 0; + mouse_report.xoft = x; + mouse_report.yoft = 0; + mouse_report.wheel = 0; + + ret = mouse_report_send(app_env.curidx, (const uint8_t *)&mouse_report); + #endif + + return ret; +} + +void keys_init(void) +{ + GPIO_DIR_SET_HI(LEDS); + + GPIO_DAT_CLR(BTNS); + GPIO_DIR_CLR(BTNS); + + iom_ctrl(PA_BTN0, IOM_PULLUP | IOM_INPUT); + iom_ctrl(PA_BTN1, IOM_PULLUP | IOM_INPUT); + iom_ctrl(PA_BTN2, IOM_PULLUP | IOM_INPUT); +} + +void keys_scan(void) +{ + static uint32_t btn_lvl = BTNS; + uint8_t ret = 0; + uint32_t value = GPIO_PIN_GET() & BTNS; + uint32_t chng = btn_lvl ^ value; + btn_lvl = value; + + if (chng) { + uint8_t code = 0; + + if ((chng & BTN0) && ((value & BTN0) == 0)) { + code = 40;//HID_KEY_ENTER; + } + if ((chng & BTN1) && ((value & BTN1) == 0)) { + code = 82;//HID_KEY_UP; + } + if ((chng & BTN2) && ((value & BTN2) == 0)) { + code = 81;//HID_KEY_DOWN; + } + + DEBUG("keys(val:%X,chng:%X,code:%d)\r\n", btn_lvl, chng, code); + + if (app_state_get() >= APP_CONNECTED) + { + ret = hid_keybd_send_report(code); + if (ret == 0) { + DEBUG("keys Fail(sta:%d)\r\n", ret); + } + + if (code) { + //GPIO_DAT_CLR(LED0); + hid_mouse_send_report(10); + } + else { + //GPIO_DAT_SET(LED0); + hid_mouse_send_report(-10); + } + } + } +} diff --git a/projects/bleHid_Keybd/src/keys.h b/projects/bleHid_Keybd/src/keys.h new file mode 100644 index 0000000..0d1dd4d --- /dev/null +++ b/projects/bleHid_Keybd/src/keys.h @@ -0,0 +1,23 @@ +/** + **************************************************************************************** + * + * @file keys.h + * + * @brief Header file - Keys Scanning and Report + * + **************************************************************************************** + */ + +#ifndef _KEYS_H_ +#define _KEYS_H_ + +#include +#include +#include "hidkey.h" + + +void keys_init(void); + +void keys_scan(void); + +#endif //_KEYS_H_ diff --git a/projects/bleHid_Keybd/src/main.c b/projects/bleHid_Keybd/src/main.c new file mode 100644 index 0000000..0153a68 --- /dev/null +++ b/projects/bleHid_Keybd/src/main.c @@ -0,0 +1,93 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" +#include "app.h" +#include "sftmr.h" +#include "leds.h" +#include "batt.h" +#include "keys.h" +#include "uartRb.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +extern void user_procedure(void); + +static void sysInit(void) +{ + iwdt_disable(); + + rcc_ble_en(); + rcc_adc_en(); + + rcc_fshclk_set(FSH_CLK_DPSC42); +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + #if (UART_CMD) + uart1Rb_Init(); + #else + dbgInit(); + #endif //(UART_CMD) + debug("Start(rsn:%X)...\r\n", rsn); + trace_init(); + + #if (LED_PLAY) + sftmr_init(); + leds_init(); + leds_play(LED_FAST_BL); + #endif //(LED_PLAY) + + batt_init(); + keys_init(); + + // Init BLE App + app_init(rsn); +} + +int main(void) +{ + sysInit(); + devInit(); + + // Global Interrupt Enable + GLOBAL_INT_START(); + + // main loop + while (1) + { + // Schedule Messages & Events + ble_schedule(); + + #if (LED_PLAY) + // SoftTimer Polling + sftmr_schedule(); + #endif //(LED_PLAY) + + // User's Procedure + user_procedure(); + } +} diff --git a/projects/bleHid_Keybd/src/myapp.c b/projects/bleHid_Keybd/src/myapp.c new file mode 100644 index 0000000..91abdaf --- /dev/null +++ b/projects/bleHid_Keybd/src/myapp.c @@ -0,0 +1,150 @@ +/** + **************************************************************************************** + * + * @file myapp.c + * + * @brief User Application - Override func + * + **************************************************************************************** + */ + +#include "app.h" +#include "bledef.h" +#include "drvs.h" +#include "leds.h" + +#if (DBG_APP) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat,len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ +#ifndef CFG_LTK_STORE + #define CFG_LTK_STORE (1) +#endif + +#ifndef LTK_STORE_OFFSET + #define LTK_STORE_OFFSET (0x1100) +#endif + +#if (LTK_STORE_OFFSET < 0x1000) + #error "User Store Data Offset Must Greater Than or Equal 0x1000" +#endif + +struct gapc_ltk gLTK; + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +#if (LED_PLAY) +/** + **************************************************************************************** + * @brief API to Set State of Application, add leds Indication + * + * @param[in] state new state + **************************************************************************************** + */ +void app_state_set(uint8_t state) +{ + DEBUG("State(old:%d,new:%d)", app_state_get(), state); + + app_env.state = state; + + // Indication, User add more... + if (state == APP_IDLE) + { + leds_play(LED_SLOW_BL); + } + else if (state == APP_READY) + { + leds_play(LED_FAST_BL); + } + else if (state == APP_CONNECTED) + { + leds_play(LED_CONT_ON); + } +} +#endif //(LED_PLAY) + +/** + **************************************************************************************** + * @brief API to Generate LTK for bonding, maybe User Override! (__weak func) + * + * @param[in] conidx connection index + * @param[in|out] ltk Pointer of ltk buffer + **************************************************************************************** + */ +void app_ltk_gen(uint8_t conidx, struct gapc_ltk *ltk) +{ + DEBUG("LTK Gen"); + + // Generate all the values + gLTK.key_size = GAP_KEY_LEN; + gLTK.ext_info = 0; + + gLTK.ediv = rand_hword(); + + for (int i = 0; i < GAP_RAND_NB_LEN; i++) + { + gLTK.ltk.key[i] = (uint8_t)rand_word(); + gLTK.ltk.key[i + 8] = (uint8_t)rand_word(); + gLTK.randnb.nb[i] = (uint8_t)rand_word(); + } + + memcpy(ltk, &gLTK, sizeof(struct gapc_ltk)); + debugHex((uint8_t *)ltk, sizeof(struct gapc_ltk)); +} + +/** + **************************************************************************************** + * @brief API to Save LTK when bonded, maybe User Override! (__weak func) + * + * @param[in] conidx connection index + * @param[in] ltk Pointer of LTK data + **************************************************************************************** + */ +void app_ltk_save(uint8_t conidx, const struct gapc_ltk *ltk) +{ + DEBUG("LTK Saved Start"); + + #if (CFG_LTK_STORE) + flash_page_erase(LTK_STORE_OFFSET); + flash_byte_write(LTK_STORE_OFFSET, (uint8_t *)&gLTK, sizeof(struct gapc_ltk)); + #endif + + DEBUG("LTK Saved Done"); +} + +/** + **************************************************************************************** + * @brief API to Find LTK when re-encryption, maybe User Override! (__weak func) + * + * @param[in] ediv EDIV value for matching + * @param[in] rand_nb Rand Nb values for matching + * + * @return NULL for not matched, else return Pointer of LTK found. + **************************************************************************************** + */ +const uint8_t *app_ltk_find(uint16_t ediv, const uint8_t *rand_nb) +{ + DEBUG("Read LTK"); + +#if (CFG_LTK_STORE) + flash_byte_read(LTK_STORE_OFFSET, (uint8_t *)&gLTK, sizeof(struct gapc_ltk)); + debugHex((uint8_t *)&gLTK, sizeof(struct gapc_ltk)); +#endif + + if ((ediv == gLTK.ediv) && (memcmp(rand_nb, gLTK.randnb.nb, 8) == 0)) + return &gLTK.ltk.key[0]; + else + return NULL; +} diff --git a/projects/bleHid_Keybd/src/proc.c b/projects/bleHid_Keybd/src/proc.c new file mode 100644 index 0000000..5e2d2f5 --- /dev/null +++ b/projects/bleHid_Keybd/src/proc.c @@ -0,0 +1,173 @@ +/** + **************************************************************************************** + * + * @file proc.c + * + * @brief user procedure. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" + +#include "app.h" +#include "keys.h" +#include "uartRb.h" +#include "prf_bass.h" +#include "hid_desc.h" + +#if (DBG_PROC) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +#if (UART_CMD) +enum uart_cmd +{ + CMD_KB_REP = 0xC0, + CMD_MEDIA_REP, + CMD_SYSTEM_REP, + + CMD_CONN_INTERVAL = 0xE0, + + CMD_BATT_LVL = 0xF0, + CMD_BATT_PWR_STA +}; + +#define CMD_MAX_LEN 20 +#define NULL_CNT 20 + +static uint8_t buff[CMD_MAX_LEN]; +static uint16_t buff_len = 0; + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +static void uart_proc(void) +{ + static uint8_t null_cnt = 0; + uint16_t len; + bool finish = true; + + len = uart1Rb_Read(&buff[buff_len], CMD_MAX_LEN - buff_len); + if (len > 0) + { + buff_len += len; + if (buff_len < CMD_MAX_LEN) + { + return; // wait full + } + } + else + { + if ((buff_len > 0) && (null_cnt++ > NULL_CNT)) + { + //finish = true; + null_cnt = 0; + } + else + { + return; // wait again + } + } + + if (app_state_get() == APP_CONNECTED) + { + switch (buff[0]) + { + case CMD_KB_REP: + { + DEBUG("key_code:0x%02x", buff[1]); + uint8_t kyebd_report[] = {0x00, 0x00, buff[1], 0x00, 0x00, 0x00, 0x00, 0x00 }; //6 + keybd_report_send(app_env.curidx, kyebd_report); + keybd_report_send(app_env.curidx, NULL); + } break; + + case CMD_MEDIA_REP: + { + if (buff_len >= 4) + { + DEBUG("MEDIA: %02X %02X %02X", buff[1], buff[2], buff[3]); + + media_report_send(app_env.curidx, &buff[1]); + media_report_send(app_env.curidx, NULL); + } + } break; + + case CMD_SYSTEM_REP: + { + DEBUG("CMD_SYSTEM_REP:%x", buff[1]); + + system_report_send(app_env.curidx, &buff[1]); + system_report_send(app_env.curidx, NULL); + } break; + + case CMD_BATT_LVL: + { + DEBUG("Batt Lvl"); + bass_bat_lvl_update(buff[1]); + } break; + + case CMD_BATT_PWR_STA: + { + DEBUG("Batt Power State"); + bass_pwr_sta_update(buff[1]); + } break; + + case CMD_CONN_INTERVAL: + { + struct gapc_conn_param conn_pref = + { + /// Connection interval minimum unit in 1.25ms + .intv_min = 6, + /// Connection interval maximum unit in 1.25ms + .intv_max = 6, + /// Slave latency + .latency = 0, + /// Connection supervision timeout multiplier unit in 10ms + .time_out = 300, + }; + + conn_pref.intv_min = buff[1]; + conn_pref.intv_max = buff[2]; + conn_pref.latency = buff[3]; + + DEBUG("intvn:%d, intvm:%d, lat:%d", conn_pref.intv_min, conn_pref.intv_max, conn_pref.latency); + gapc_update_param(app_env.curidx, &conn_pref); + } break; + + default: + { + } break; + } + } + + if (finish) + { + buff_len = 0; + } +} +#endif //(UART_CMD) + +void user_procedure(void) +{ + #if (UART_CMD) + uart_proc(); + #endif //(UART_CMD) + + keys_scan(); +} diff --git a/projects/bleHid_Mouse/mdk/JLinkSettings.ini b/projects/bleHid_Mouse/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/projects/bleHid_Mouse/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/projects/bleHid_Mouse/mdk/bleHid_Mouse.uvoptx b/projects/bleHid_Mouse/mdk/bleHid_Mouse.uvoptx new file mode 100644 index 0000000..cb4339f --- /dev/null +++ b/projects/bleHid_Mouse/mdk/bleHid_Mouse.uvoptx @@ -0,0 +1,581 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + bleHid_Mouse + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + DLGUARM + + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FN1 -FC1000 -FD20003000 -FF0B6x_256kB_PY_D -FL040000 -FS018000000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC1000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 0 + 1 + lld_env + + + 1 + 1 + ble_env + + + + + 1 + 1 + 0x20009934 + 0 + + + + + 2 + 1 + 0x20003000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\src\myapp.c + myapp.c + 0 + 0 + + + 2 + 5 + 1 + 0 + 0 + 0 + ..\src\proc.c + proc.c + 0 + 0 + + + 2 + 6 + 1 + 0 + 0 + 0 + ..\src\batt.c + batt.c + 0 + 0 + + + 2 + 7 + 1 + 0 + 0 + 0 + ..\src\mouse.c + mouse.c + 0 + 0 + + + 2 + 8 + 1 + 0 + 0 + 0 + ..\src\hid_desc.c + hid_desc.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 9 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 10 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + modules + 1 + 0 + 0 + 0 + + 4 + 11 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\uart1Rb.c + uart1Rb.c + 0 + 0 + + + 4 + 12 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\leds.c + leds.c + 0 + 0 + + + 4 + 13 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\sftmr.c + sftmr.c + 0 + 0 + + + + + ble\app + 1 + 0 + 0 + 0 + + 5 + 14 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app.c + app.c + 0 + 0 + + + 5 + 15 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_actv.c + app_actv.c + 0 + 0 + + + 5 + 16 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_msg.c + app_msg.c + 0 + 0 + + + 5 + 17 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gapm.c + app_gapm.c + 0 + 0 + + + 5 + 18 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gapc.c + app_gapc.c + 0 + 0 + + + + + ble\prf + 0 + 0 + 0 + 0 + + 6 + 19 + 1 + 0 + 0 + 0 + ..\..\..\ble\prf\prf_diss.c + prf_diss.c + 0 + 0 + + + 6 + 20 + 1 + 0 + 0 + 0 + ..\..\..\ble\prf\prf_bass.c + prf_bass.c + 0 + 0 + + + 6 + 21 + 1 + 0 + 0 + 0 + ..\..\..\ble\prf\prf_hids.c + prf_hids.c + 0 + 0 + + + + + ble\lib + 1 + 0 + 0 + 0 + + 7 + 22 + 4 + 0 + 0 + 0 + ..\..\..\ble\lib\ble6_lite.lib + ble6_lite.lib + 0 + 0 + + + + + debug + 0 + 0 + 0 + 0 + + 8 + 23 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/projects/bleHid_Mouse/mdk/bleHid_Mouse.uvprojx b/projects/bleHid_Mouse/mdk/bleHid_Mouse.uvprojx new file mode 100644 index 0000000..2fe1770 --- /dev/null +++ b/projects/bleHid_Mouse/mdk/bleHid_Mouse.uvprojx @@ -0,0 +1,545 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + bleHid_Mouse + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20003000 -FC1000 -FN1 -FF0B6x_256kB_PY_D -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM)) + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + bleHid_Mouse + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + -REMAP + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 16 + 1 + 0 + 0 + 0 + 4 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x1000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip_blelite.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + myapp.c + 1 + ..\src\myapp.c + + + proc.c + 1 + ..\src\proc.c + + + batt.c + 1 + ..\src\batt.c + + + mouse.c + 1 + ..\src\mouse.c + + + hid_desc.c + 1 + ..\src\hid_desc.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + modules + + + uart1Rb.c + 1 + ..\..\..\modules\src\uart1Rb.c + + + leds.c + 1 + ..\..\..\modules\src\leds.c + + + sftmr.c + 1 + ..\..\..\modules\src\sftmr.c + + + + + ble\app + + + app.c + 1 + ..\..\..\ble\app\app.c + + + app_actv.c + 1 + ..\..\..\ble\app\app_actv.c + + + app_msg.c + 1 + ..\..\..\ble\app\app_msg.c + + + app_gapm.c + 1 + ..\..\..\ble\app\app_gapm.c + + + app_gapc.c + 1 + ..\..\..\ble\app\app_gapc.c + + + + + ble\prf + + + prf_diss.c + 1 + ..\..\..\ble\prf\prf_diss.c + + + prf_bass.c + 1 + ..\..\..\ble\prf\prf_bass.c + + + prf_hids.c + 1 + ..\..\..\ble\prf\prf_hids.c + + + + + ble\lib + + + ble6_lite.lib + 4 + ..\..\..\ble\lib\ble6_lite.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/projects/bleHid_Mouse/mdk/clean.bat b/projects/bleHid_Mouse/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/projects/bleHid_Mouse/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/projects/bleHid_Mouse/src/batt.c b/projects/bleHid_Mouse/src/batt.c new file mode 100644 index 0000000..455f864 --- /dev/null +++ b/projects/bleHid_Mouse/src/batt.c @@ -0,0 +1,46 @@ +/** + **************************************************************************************** + * + * @file batt.c + * + * @brief Battery voltage detection + * + **************************************************************************************** + */ + +#include "batt.h" +#include "sadc.h" + +#if (DBG_BATT) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +#define ADC_CHAN_VDD12 (14) // 1200mV +#define ADC_READ_CNT (0x07) + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +void batt_init(void) +{ + +} + +uint8_t batt_level(void) +{ + uint8_t lvl = 100; + + return lvl; +} diff --git a/projects/bleHid_Mouse/src/batt.h b/projects/bleHid_Mouse/src/batt.h new file mode 100644 index 0000000..761f188 --- /dev/null +++ b/projects/bleHid_Mouse/src/batt.h @@ -0,0 +1,13 @@ +#ifndef _BATT_H_ +#define _BATT_H_ + +#include + +#define BATT_LVL_MAX 100 +#define BATT_LVL_MIN 0 + +void batt_init(void); + +uint8_t batt_level(void); + +#endif //_BATT_H_ diff --git a/projects/bleHid_Mouse/src/cfg.h b/projects/bleHid_Mouse/src/cfg.h new file mode 100644 index 0000000..a2fb2b3 --- /dev/null +++ b/projects/bleHid_Mouse/src/cfg.h @@ -0,0 +1,56 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// System Clock(0=16MHz, 1=32MHz, 2=48MHz, 3=64MHz) +#define SYS_CLK (0) + +/// Debug Mode(0=Disable, 1=via UART, 2=via RTT) +#define DBG_MODE (0) + +/// Use ble6_lite.lib +#define BLE_LITELIB (1) + +/// BLE Configure (Single or Multi-Connections) +#define BLE_NB_SLAVE (1) +#define BLE_NB_MASTER (0) + +#define BLE_ADDR {0x31, 0x06, 0x23, 0xA1, 0x01, 0xD2} +#define BLE_DEV_NAME "B6x-Mouse" +#define BLE_DEV_ICON 0x03C2 // 03C0-Generic HID,03C1-Keyboard,03C2-Mouse,03C4-Gamepad +#define BLE_PHY (GAP_PHY_LE_1MBPS) +#define BLE_AUTH (GAP_AUTH_REQ_NO_MITM_BOND) + +/// Profile Configure +#define PRF_DISS (1) +#define PRF_BASS (1) +#define PRF_HIDS (1) + +/// Debug Configure +#if (DBG_MODE) + #define DBG_APP (1) + #define DBG_PROC (0) + #define DBG_ACTV (0) + #define DBG_GAPM (0) + #define DBG_GAPC (1) + #define DBG_KEYS (0) + #define DBG_HIDS (1) + #define DBG_BASS (0) +#endif + +/// Misc Options +#define LED_PLAY (0) +#define CFG_SLEEP (1) +#define CFG_POWEROFF (BLE_LITELIB) +#define RC32K_CALIB_PERIOD (0) + +#endif //_APP_CFG_H_ diff --git a/projects/bleHid_Mouse/src/hid_desc.c b/projects/bleHid_Mouse/src/hid_desc.c new file mode 100644 index 0000000..561e858 --- /dev/null +++ b/projects/bleHid_Mouse/src/hid_desc.c @@ -0,0 +1,82 @@ +/** + **************************************************************************************** + * + * @file hid_desc.c + * + * @brief HID Report Map, descriptions. + * + * < Implementation according to user's application-specific > + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "hid_desc.h" + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// HID Report Map description +const uint8_t hid_report_map[] = +{ + #if (HID_RPT_MOUSE) + 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) + 0x09, 0x02, // Usage (Mouse) + 0xA1, 0x01, // Collection (Application) + 0x85, RPT_ID_MOUSE,// Report ID + 0x09, 0x01, // Usage (Pointer) + 0xA1, 0x00, // Collection (Physical) + 0x05, 0x09, // Usage Page (Button) + 0x19, 0x01, // Usage Minimum (0x01) + 0x29, 0x08, // Usage Maximum (0x08) + 0x15, 0x00, // Logical Minimum (0) + 0x25, 0x01, // Logical Maximum (1) + 0x75, 0x01, // Report Size (1) + 0x95, 0x08, // Report Count (8) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) + 0x16, 0x08, 0xFF, // Logical Minimum (-248) + 0x26, 0xFF, 0x00, // Logical Maximum (255) + 0x75, 0x10, // Report Size (16) + 0x95, 0x02, // Report Count (2) + 0x09, 0x30, // Usage (X) + 0x09, 0x31, // Usage (Y) + 0x81, 0x06, // Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position) + 0x15, 0x81, // Logical Minimum (-127) + 0x25, 0x7F, // Logical Maximum (127) + 0x75, 0x08, // Report Size (8) + 0x95, 0x01, // Report Count (1) + 0x09, 0x38, // Usage (Wheel) + 0x81, 0x06, // Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position) + 0xC0, // End Collection + 0xC0, // End Collection + #endif //(HID_RPT_MOUSE) +}; + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Get HID Report Map description. + * + * @param[out] plen Retrieved Length of description + * + * @return Pointer of the description + **************************************************************************************** + */ +const uint8_t *hid_get_report_map(uint16_t *plen) +{ + *plen = sizeof(hid_report_map); + + return hid_report_map; +} diff --git a/projects/bleHid_Mouse/src/hid_desc.h b/projects/bleHid_Mouse/src/hid_desc.h new file mode 100644 index 0000000..dd875a1 --- /dev/null +++ b/projects/bleHid_Mouse/src/hid_desc.h @@ -0,0 +1,122 @@ +/** + **************************************************************************************** + * + * @file hid_desc.h + * + * @brief Header file - HID Report Map, Descriptions. + * + * < Implementation according to user's application-specific > + **************************************************************************************** + */ + +#ifndef HID_DESC_H_ +#define HID_DESC_H_ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +#define HID_BOOT_SUP (0) +#define HID_REPORT_SUP (1) + +#if (HID_BOOT_SUP) + #define HID_BOOT_KB (0) + #define HID_BOOT_MOUSE (0) +#endif //(HID_BOOT_SUP) + +#if (HID_REPORT_SUP) + #define HID_RPT_KB (0) + #define HID_RPT_MEDIA (0) + #define HID_RPT_SYSTEM (0) + #define HID_RPT_MOUSE (1) + #define HID_RPT_PTP (0) +#endif //(HID_REPORT_SUP) + +/// HID Report ID and Length, declared in Report Map (User Customize) +#define RPT_ID_KB (1) +#define RPT_LEN_KB (8) // 1B(ctlkeys) + 1B(resv) + 6B(keycode) + +#define RPT_ID_MEDIA (2) +#define RPT_LEN_MEDIA (2) // 16bits + +#define RPT_ID_SYSTEM (3) +#define RPT_LEN_SYSTEM (1) // 8bits + +#define RPT_ID_MOUSE (4) +#define RPT_LEN_MOUSE (6) // 1B(button) + 2B(X) + 2B(Y) + 1B(Wheel) + +#define RPT_ID_TP (5) +#define RPT_ID_MAXCNT (6) // Feature - Finger count +#define RPT_ID_PTPHQA (7) // Feature - HQA +#define RPT_LEN_TP (29) // Touch point +#define PTP_MAX_FINGER_CNT (5) + +/// HID Report Index of Notification +#define RPT_NTF_STOP (0x00) +#define RPT_NTF_ALL ((1 << RPT_IDX_NB) - 1) + +enum rpt_ntf_idx +{ + // Indexes of HID BOOT + RPT_IDX_BOOT_KB, + RPT_IDX_BOOT_MOUSE, + // Indexes of HID REPORT + RPT_IDX_KB, + RPT_IDX_MEDIA, + RPT_IDX_SYSTEM, + RPT_IDX_MOUSE, + RPT_IDX_TP, + + // Max Index, *NOTE* not excced Bits of rpt_ntfs + RPT_IDX_NB, +}; + + +/* + * MACRO DEFINITIONS + **************************************************************************************** + */ + +#include "prf_hids.h" + +#define mouse_report_send(conidx, p_data) hids_report_send(conidx, RPT_IDX_MOUSE, RPT_LEN_MOUSE, p_data) +#define keybd_report_send(conidx, p_data) hids_report_send(conidx, RPT_IDX_KB, RPT_LEN_KB, p_data) +#define media_report_send(conidx, p_data) hids_report_send(conidx, RPT_IDX_MEDIA, RPT_LEN_MEDIA, p_data) +#define system_report_send(conidx, p_data) hids_report_send(conidx, RPT_IDX_SYSTEM, RPT_LEN_SYSTEM, p_data) + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Get HID Report Map description. + * + * @param[out] plen Retrieved Length of description + * + * @return Pointer of the description + **************************************************************************************** + */ +const uint8_t *hid_get_report_map(uint16_t *plen); + +#if (HID_RPT_PTP) +/** + **************************************************************************************** + * @brief Get HID PTP HQA description. + * + * @param[out] plen Retrieved Length of description + * + * @return Pointer of the description + **************************************************************************************** + */ +const uint8_t *hid_get_ptphqa_blob(uint16_t *plen); +#endif //(HID_RPT_PTP) + + +#endif /* HID_DESC_H_ */ diff --git a/projects/bleHid_Mouse/src/main.c b/projects/bleHid_Mouse/src/main.c new file mode 100644 index 0000000..bc599f7 --- /dev/null +++ b/projects/bleHid_Mouse/src/main.c @@ -0,0 +1,94 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" +#include "app.h" +#include "sftmr.h" +#include "leds.h" +#include "batt.h" +#include "mouse.h" +#include "uartRb.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +extern void user_procedure(void); + +static void sysInit(void) +{ + iwdt_disable(); + + rcc_ble_en(); + rcc_adc_en(); + + rcc_fshclk_set(FSH_CLK_DPSC42); + + core_release_io_latch(); +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + #if (UART_CMD) + uart1Rb_Init(); + #else + dbgInit(); + #endif //(UART_CMD) + //debug("Start(rsn:%X)...\r\n", rsn); + + #if (LED_PLAY) + sftmr_init(); + leds_init(); + leds_play(LED_FAST_BL); + #endif //(LED_PLAY) + + batt_init(); + mouse_init(); + + // Init BLE App + app_init(rsn); +} + +int main(void) +{ + sysInit(); + devInit(); + + // Global Interrupt Enable + GLOBAL_INT_START(); + + // main loop + while (1) + { + // Schedule Messages & Events + ble_schedule(); + + #if (LED_PLAY) + // SoftTimer Polling + sftmr_schedule(); + #endif //(LED_PLAY) + + // User's Procedure + user_procedure(); + } +} diff --git a/projects/bleHid_Mouse/src/mouse.c b/projects/bleHid_Mouse/src/mouse.c new file mode 100644 index 0000000..8222046 --- /dev/null +++ b/projects/bleHid_Mouse/src/mouse.c @@ -0,0 +1,125 @@ +/** + **************************************************************************************** + * + * @file keys.c + * + * @brief keys operation. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "app.h" +#include "hid_desc.h" + +#if (DBG_KEYS) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +#define PA_LED0 PA08 +#define PA_LED1 PA09 +#define PA_BTN0 PA15 +#define PA_BTN1 PA16 +#define PA_BTN2 PA17 + +#define LED0 BIT(PA_LED0) +#define LED1 BIT(PA_LED1) +#define LEDS (LED1 | LED0) + +#define BTN0 BIT(PA_BTN0) +#define BTN1 BIT(PA_BTN1) +#define BTN2 BIT(PA_BTN2) +#define BTNS (BTN0 | BTN1 | BTN2) + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +struct mouse_rep +{ + uint8_t btns; + int16_t xoft; + int16_t yoft; + int8_t wheel; +} __attribute__((packed)); + +static uint32_t btn_lvl; + +uint8_t hid_mouse_send_report(int8_t x) +{ + uint8_t ret = 0; + + #if (HID_RPT_MOUSE) + struct mouse_rep mouse_report; + + mouse_report.btns = 0; + mouse_report.xoft = x; + mouse_report.yoft = 0; + mouse_report.wheel = 0; + + ret = mouse_report_send(app_env.curidx, (const uint8_t *)&mouse_report); + #endif + + return ret; +} + +void mouse_init(void) +{ + GPIO_DIR_SET_HI(LEDS); + + GPIO_DAT_CLR(BTNS); + GPIO_DIR_CLR(BTNS); + + iom_ctrl(PA_BTN0, IOM_PULLUP | IOM_INPUT); + iom_ctrl(PA_BTN1, IOM_PULLUP | IOM_INPUT); + iom_ctrl(PA_BTN2, IOM_PULLUP | IOM_INPUT); + + btn_lvl = BTNS; +} + +void mouse_scan(void) +{ + uint32_t value = GPIO_PIN_GET() & BTNS; + uint32_t chng = btn_lvl ^ value; + btn_lvl = value; + + if (chng) { + uint8_t code = 0; + + if ((chng & BTN0) && ((value & BTN0) == 0)) { + code = 40;//HID_KEY_ENTER; + } + if ((chng & BTN1) && ((value & BTN1) == 0)) { + code = 82;//HID_KEY_UP; + } + if ((chng & BTN2) && ((value & BTN2) == 0)) { + code = 81;//HID_KEY_DOWN; + } + + DEBUG("keys(val:%X,chng:%X,code:%d)\r\n", btn_lvl, chng, code); + + if (app_state_get() >= APP_CONNECTED) + { + if (code) { + GPIO_DAT_CLR(LED0); + hid_mouse_send_report(10); + } + else { + GPIO_DAT_SET(LED0); + hid_mouse_send_report(-10); + } + } + } +} diff --git a/projects/bleHid_Mouse/src/mouse.h b/projects/bleHid_Mouse/src/mouse.h new file mode 100644 index 0000000..642dcb6 --- /dev/null +++ b/projects/bleHid_Mouse/src/mouse.h @@ -0,0 +1,22 @@ +/** + **************************************************************************************** + * + * @file mouse.h + * + * @brief Header file - Mouse Scanning and Report + * + **************************************************************************************** + */ + +#ifndef _MOUSE_H_ +#define _MOUSE_H_ + +#include +#include + + +void mouse_init(void); + +void mouse_scan(void); + +#endif //_MOUSE_H_ diff --git a/projects/bleHid_Mouse/src/myapp.c b/projects/bleHid_Mouse/src/myapp.c new file mode 100644 index 0000000..3fa4f31 --- /dev/null +++ b/projects/bleHid_Mouse/src/myapp.c @@ -0,0 +1,149 @@ +/** + **************************************************************************************** + * + * @file myapp.c + * + * @brief User Application - Override func + * + **************************************************************************************** + */ + +#include "app.h" +#include "bledef.h" +#include "drvs.h" +#include "leds.h" + +#if (DBG_APP) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat,len) +#endif + +/* + * DEFINES + **************************************************************************************** + */ +#ifndef CFG_LTK_STORE + #define CFG_LTK_STORE (1) +#endif + +#ifndef LTK_STORE_OFFSET + #define LTK_STORE_OFFSET (0x1100) +#endif + +#if (LTK_STORE_OFFSET < 0x1000) + #error "User Store Data Offset Must Greater Than or Equal 0x1000" +#endif + +struct gapc_ltk gLTK; + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +#if (LED_PLAY) +/** + **************************************************************************************** + * @brief API to Set State of Application, add leds Indication + * + * @param[in] state new state + **************************************************************************************** + */ +void app_state_set(uint8_t state) +{ + DEBUG("State(old:%d,new:%d)", app_state_get(), state); + + app_env.state = state; + + // Indication, User add more... + if (state == APP_IDLE) + { + leds_play(LED_SLOW_BL); + } + else if (state == APP_READY) + { + leds_play(LED_FAST_BL); + } + else if (state == APP_CONNECTED) + { + leds_play(LED_CONT_ON); + } +} +#endif //(LED_PLAY) + +/** + **************************************************************************************** + * @brief API to Generate LTK for bonding, maybe User Override! (__weak func) + * + * @param[in] conidx connection index + * @param[in|out] ltk Pointer of ltk buffer + **************************************************************************************** + */ +void app_ltk_gen(uint8_t conidx, struct gapc_ltk *ltk) +{ + DEBUG("LTK Gen"); + + // Generate all the values + gLTK.key_size = GAP_KEY_LEN; + gLTK.ext_info = 0; + + gLTK.ediv = rand_hword(); + + for (int i = 0; i < GAP_RAND_NB_LEN; i++) + { + gLTK.ltk.key[i] = (uint8_t)rand_word(); + gLTK.ltk.key[i + 8] = (uint8_t)rand_word(); + gLTK.randnb.nb[i] = (uint8_t)rand_word(); + } + + memcpy(ltk, &gLTK, sizeof(struct gapc_ltk)); + debugHex((uint8_t *)ltk, sizeof(struct gapc_ltk)); +} + +/** + **************************************************************************************** + * @brief API to Save LTK when bonded, maybe User Override! (__weak func) + * + * @param[in] conidx connection index + * @param[in] ltk Pointer of LTK data + **************************************************************************************** + */ +void app_ltk_save(uint8_t conidx, const struct gapc_ltk *ltk) +{ + DEBUG("LTK Saved Start"); + + #if (CFG_LTK_STORE) + flash_page_erase(LTK_STORE_OFFSET); + flash_byte_write(LTK_STORE_OFFSET, (uint8_t *)&gLTK, sizeof(struct gapc_ltk)); + #endif + + DEBUG("LTK Saved Done"); +} + +/** + **************************************************************************************** + * @brief API to Find LTK when re-encryption, maybe User Override! (__weak func) + * + * @param[in] ediv EDIV value for matching + * @param[in] rand_nb Rand Nb values for matching + * + * @return NULL for not matched, else return Pointer of LTK found. + **************************************************************************************** + */ +const uint8_t *app_ltk_find(uint16_t ediv, const uint8_t *rand_nb) +{ + DEBUG("Read LTK"); + +#if (CFG_LTK_STORE) + flash_byte_read(LTK_STORE_OFFSET, (uint8_t *)&gLTK, sizeof(struct gapc_ltk)); + debugHex((uint8_t *)&gLTK, sizeof(struct gapc_ltk)); +#endif + + if ((ediv == gLTK.ediv) && (memcmp(rand_nb, gLTK.randnb.nb, 8) == 0)) + return &gLTK.ltk.key[0]; + else + return NULL; +} diff --git a/projects/bleHid_Mouse/src/proc.c b/projects/bleHid_Mouse/src/proc.c new file mode 100644 index 0000000..9c259f4 --- /dev/null +++ b/projects/bleHid_Mouse/src/proc.c @@ -0,0 +1,195 @@ +/** + **************************************************************************************** + * + * @file proc.c + * + * @brief user procedure. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" + +#include "app.h" +#include "mouse.h" +#include "uartRb.h" +#include "prf_bass.h" +#include "hid_desc.h" + +#if (DBG_PROC) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +#if (UART_CMD) +enum uart_cmd +{ + CMD_MOUSE_REP = 0xD0, + + CMD_CONN_INTERVAL = 0xE0, + + CMD_BATT_LVL = 0xF0, + CMD_BATT_PWR_STA +}; + +#define CMD_MAX_LEN 20 +#define NULL_CNT 20 + +static uint8_t buff[CMD_MAX_LEN]; +static uint16_t buff_len = 0; + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +void uart_proc(void) +{ + static uint8_t null_cnt = 0; + uint16_t len; + bool finish = true; + + len = uart1Rb_Read(&buff[buff_len], CMD_MAX_LEN - buff_len); + if (len > 0) + { + buff_len += len; + if (buff_len < CMD_MAX_LEN) + { + return; // wait full + } + } + else + { + if ((buff_len > 0) && (null_cnt++ > NULL_CNT)) + { + //finish = true; + null_cnt = 0; + } + else + { + return; // wait again + } + } + + if (app_state_get() == APP_CONNECTED) + { + switch (buff[0]) + { + case CMD_MOUSE_REP: + { + DEBUG("MOUSE"); + uint8_t mouse_data[] = {0, 10, 0, 0, 0, 0}; + mouse_report_send(app_env.curidx, mouse_data); + mouse_report_send(app_env.curidx, NULL); + } break; + + case CMD_BATT_LVL: + { + DEBUG("Batt Lvl"); + bass_bat_lvl_update(buff[1]); + } break; + + case CMD_BATT_PWR_STA: + { + DEBUG("Batt Power State"); + bass_pwr_sta_update(buff[1]); + } break; + + case CMD_CONN_INTERVAL: + { + struct gapc_conn_param conn_pref = + { + /// Connection interval minimum unit in 1.25ms + .intv_min = 6, + /// Connection interval maximum unit in 1.25ms + .intv_max = 6, + /// Slave latency + .latency = 0, + /// Connection supervision timeout multiplier unit in 10ms + .time_out = 300, + }; + + conn_pref.intv_min = buff[1]; + conn_pref.intv_max = buff[2]; + conn_pref.latency = buff[3]; + + DEBUG("intvn:%d, intvm:%d, lat:%d", conn_pref.intv_min, conn_pref.intv_max, conn_pref.latency); + gapc_update_param(app_env.curidx, &conn_pref); + } break; + + default: + { + } break; + } + } + + if (finish) + { + buff_len = 0; + } +} +#endif //(UART_CMD) + +#if (CFG_SLEEP) +static void sleep_proc(void) +{ + //uint8_t lpsta = ble_sleep(BLE_SLP_TWOSC, BLE_SLP_DURMAX); + #if (CFG_POWEROFF) + uint32_t slpdur = ble_slpdur_get(); + + if (slpdur > 200) + { + // Core enter poweroff mode + if (ble_sleep(120, slpdur) == BLE_IN_SLEEP) + { + core_pwroff(CFG_WKUP_BLE_EN | WKUP_IO_LATCH_N_BIT); + } + } + else if (slpdur > 100) + { + // Core enter deepsleep mode + if (ble_sleep(64, slpdur) == BLE_IN_SLEEP) + { + core_sleep(CFG_WKUP_BLE_EN); + } + } + #else //!(CFG_POWEROFF) + uint8_t lpsta = ble_sleep(BLE_SLP_TWOSC, BLE_SLP_DURMAX); + + if (lpsta == BLE_IN_SLEEP) + { + uint16_t lpret = core_sleep(CFG_WKUP_BLE_EN); + DEBUG("ble sta:%d, wksrc:%X", lpsta, lpret); + } + else + { + DEBUG("ble sta:%d", lpsta); + } + #endif //(CFG_POWEROFF) +} +#endif //(CFG_SLEEP) + +void user_procedure(void) +{ + #if (CFG_SLEEP) + sleep_proc(); + #endif + + #if (UART_CMD) + uart_proc(); + #endif //(UART_CMD) + + mouse_scan(); +} diff --git a/projects/bleMaster/mdk/JLinkSettings.ini b/projects/bleMaster/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/projects/bleMaster/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/projects/bleMaster/mdk/bleMaster.uvoptx b/projects/bleMaster/mdk/bleMaster.uvoptx new file mode 100644 index 0000000..7753cbc --- /dev/null +++ b/projects/bleMaster/mdk/bleMaster.uvoptx @@ -0,0 +1,496 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + bleMaster + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FN1 -FC1000 -FD20003000 -FF0B6x_256kB_PY_D -FL040000 -FS018000000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC1000 -FN1 -FF0B6x_256kB_PY_D -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\src\myapp.c + myapp.c + 0 + 0 + + + 2 + 5 + 1 + 0 + 0 + 0 + ..\src\proc.c + proc.c + 0 + 0 + + + 2 + 6 + 1 + 0 + 0 + 0 + ..\src\keys.c + keys.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 7 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 8 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + modules + 1 + 0 + 0 + 0 + + 4 + 9 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\uart1Rb.c + uart1Rb.c + 0 + 0 + + + 4 + 10 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\leds.c + leds.c + 0 + 0 + + + 4 + 11 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\sftmr.c + sftmr.c + 0 + 0 + + + + + ble\app + 1 + 0 + 0 + 0 + + 5 + 12 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app.c + app.c + 0 + 0 + + + 5 + 13 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_actv.c + app_actv.c + 0 + 0 + + + 5 + 14 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_msg.c + app_msg.c + 0 + 0 + + + 5 + 15 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gapm.c + app_gapm.c + 0 + 0 + + + 5 + 16 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gapc.c + app_gapc.c + 0 + 0 + + + 5 + 17 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gatt.c + app_gatt.c + 0 + 0 + + + + + ble\prf + 1 + 0 + 0 + 0 + + 6 + 18 + 1 + 0 + 0 + 0 + ..\..\..\ble\prf\prf_diss.c + prf_diss.c + 0 + 0 + + + + + ble\lib + 1 + 0 + 0 + 0 + + 7 + 19 + 4 + 0 + 0 + 0 + ..\..\..\ble\lib\ble6.lib + ble6.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 8 + 20 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/projects/bleMaster/mdk/bleMaster.uvprojx b/projects/bleMaster/mdk/bleMaster.uvprojx new file mode 100644 index 0000000..3f6308b --- /dev/null +++ b/projects/bleMaster/mdk/bleMaster.uvprojx @@ -0,0 +1,530 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + bleMaster + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20003000 -FC1000 -FN1 -FF0B6x_256kB_PY_D -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM)) + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + bleMaster + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + -REMAP + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 4 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x1000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip_ble.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + myapp.c + 1 + ..\src\myapp.c + + + proc.c + 1 + ..\src\proc.c + + + keys.c + 1 + ..\src\keys.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + modules + + + uart1Rb.c + 1 + ..\..\..\modules\src\uart1Rb.c + + + leds.c + 1 + ..\..\..\modules\src\leds.c + + + sftmr.c + 1 + ..\..\..\modules\src\sftmr.c + + + + + ble\app + + + app.c + 1 + ..\..\..\ble\app\app.c + + + app_actv.c + 1 + ..\..\..\ble\app\app_actv.c + + + app_msg.c + 1 + ..\..\..\ble\app\app_msg.c + + + app_gapm.c + 1 + ..\..\..\ble\app\app_gapm.c + + + app_gapc.c + 1 + ..\..\..\ble\app\app_gapc.c + + + app_gatt.c + 1 + ..\..\..\ble\app\app_gatt.c + + + + + ble\prf + + + prf_diss.c + 1 + ..\..\..\ble\prf\prf_diss.c + + + + + ble\lib + + + ble6.lib + 4 + ..\..\..\ble\lib\ble6.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/projects/bleMaster/mdk/clean.bat b/projects/bleMaster/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/projects/bleMaster/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/projects/bleMaster/src/cfg.h b/projects/bleMaster/src/cfg.h new file mode 100644 index 0000000..33c8363 --- /dev/null +++ b/projects/bleMaster/src/cfg.h @@ -0,0 +1,52 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// System Clock(0=16MHz, 1=32MHz, 2=48MHz, 3=64MHz) +#define SYS_CLK (0) + +/// Debug Mode(0=Disable, 1=via UART, 2=via RTT) +#define DBG_MODE (1) + +/// BLE Configure (Single or Multi-Connections) +#define BLE_NB_SLAVE (0) +#define BLE_NB_MASTER (1) + +#define BLE_ADDR {0x11, 0x08, 0x33, 0xA1, 0x01, 0xD2} +#define BLE_DEV_NAME "myBle-Master" +#define BLE_DEV_ICON 0x0000 // 03C0-Generic HID,03C1-Keyboard,03C2-Mouse,03C4-Gamepad + +/// Profile Configure +#define PRF_DISS (0) + +/// GATT Client and debugLTK Used +#define GATT_CLI (BLE_NB_MASTER) +#define BLE_DBG_LTK (BLE_NB_MASTER) + +/// Debug Configure +#if (DBG_MODE) + #define DBG_APP (1) + #define DBG_PROC (0) + #define DBG_ACTV (1) + #define DBG_GAPM (1) + #define DBG_GAPC (1) + #define DBG_GATT (1) + + #define DBG_KEYS (1) + +#endif + +/// Misc Options +#define LED_PLAY (0) + + +#endif //_APP_CFG_H_ diff --git a/projects/bleMaster/src/keys.c b/projects/bleMaster/src/keys.c new file mode 100644 index 0000000..1433dcb --- /dev/null +++ b/projects/bleMaster/src/keys.c @@ -0,0 +1,95 @@ +/** + **************************************************************************************** + * + * @file keys.c + * + * @brief keys operation. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "app.h" + +#if (DBG_KEYS) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +#define PA_LED1 (PA09) +#define PA_LED2 (PA10) +#define PA_BTN1 (PA16) +#define PA_BTN2 (PA17) + +#define LED1 BIT(PA_LED1) +#define LED2 BIT(PA_LED2) +#define LEDS (LED1 | LED2) + +#define BTN1 BIT(PA_BTN1) +#define BTN2 BIT(PA_BTN2) +#define BTNS (BTN1 | BTN2) + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +void keys_init(void) +{ + GPIO_DIR_SET_HI(LEDS); + + GPIO_DAT_CLR(BTNS); + GPIO_DIR_CLR(BTNS); + + iom_ctrl(PA_BTN1, IOM_PULLUP | IOM_INPUT); + iom_ctrl(PA_BTN2, IOM_PULLUP | IOM_INPUT); +} + +void keys_scan(void) +{ + static uint32_t btn_lvl = BTNS; + uint32_t value = GPIO_PIN_GET() & BTNS; + uint32_t chng = btn_lvl ^ value; + btn_lvl = value; + + if (chng) + { + if (chng & BTN1) + { + if ((value & BTN1) == 0) + { + GPIO_DAT_CLR(LED1); + app_scan_action(ACTV_START); + } + else + { + GPIO_DAT_SET(LED1); + } + } + + if (chng & BTN2) + { + if ((value & BTN2) == 0) + { + GPIO_DAT_CLR(LED2); + app_start_initiating(&scan_addr_list[0]); + } + else + { + GPIO_DAT_SET(LED2); + } + } + + DEBUG("keys(val:%X,chng:%X,)\r\n", btn_lvl, chng); + } +} diff --git a/projects/bleMaster/src/keys.h b/projects/bleMaster/src/keys.h new file mode 100644 index 0000000..0d1dd4d --- /dev/null +++ b/projects/bleMaster/src/keys.h @@ -0,0 +1,23 @@ +/** + **************************************************************************************** + * + * @file keys.h + * + * @brief Header file - Keys Scanning and Report + * + **************************************************************************************** + */ + +#ifndef _KEYS_H_ +#define _KEYS_H_ + +#include +#include +#include "hidkey.h" + + +void keys_init(void); + +void keys_scan(void); + +#endif //_KEYS_H_ diff --git a/projects/bleMaster/src/main.c b/projects/bleMaster/src/main.c new file mode 100644 index 0000000..7cd7f5c --- /dev/null +++ b/projects/bleMaster/src/main.c @@ -0,0 +1,73 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" +#include "app.h" +#include "keys.h" +#include "uartRb.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +extern void user_procedure(void); + +static void sysInit(void) +{ + iwdt_disable(); + + rcc_ble_en(); + rcc_adc_en(); + + rcc_fshclk_set(FSH_CLK_DPSC42); +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + uart1Rb_Init(); //dbgInit(); + debug("Start(rsn:%X)...\r\n", rsn); + + keys_init(); + + // Init BLE App + app_init(rsn); +} + +int main(void) +{ + sysInit(); + devInit(); + + // Global Interrupt Enable + GLOBAL_INT_START(); + + // main loop + while (1) + { + // Schedule Messages & Events + ble_schedule(); + + // User's Procedure + user_procedure(); + } +} diff --git a/projects/bleMaster/src/myapp.c b/projects/bleMaster/src/myapp.c new file mode 100644 index 0000000..b04139c --- /dev/null +++ b/projects/bleMaster/src/myapp.c @@ -0,0 +1,75 @@ +/** + **************************************************************************************** + * + * @file myapp.c + * + * @brief User Application - Override func + * + **************************************************************************************** + */ + +#include "app.h" +#include "bledef.h" +#include "drvs.h" + +#if (DBG_APP) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * VARIABLES DEFINITIONS + **************************************************************************************** + */ + + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Finite state machine for Device Configure, maybe User Override! (__weak func) + * + * @param[in] evt configure event @see enum ble_event + **************************************************************************************** + */ +void app_conf_fsm(uint8_t evt) +{ + if (evt == BLE_RESET) + { + memset(&app_env, 0, sizeof(app_env)); + + // Set device config + gapm_set_dev(&ble_dev_config, &ble_dev_addr, NULL); + } + else /*if (evt == BLE_CONFIGURED)*/ + { + ble_txmd_set(1); + + #if (BLE_2G4_MODE) + ble_2G4_set(0x2022, 0x0816); + #endif + + app_state_set(APP_IDLE); + + // Create Profiles + app_prf_create(); + + // Create Activities + app_actv_create(); + } +} + diff --git a/projects/bleMaster/src/proc.c b/projects/bleMaster/src/proc.c new file mode 100644 index 0000000..28eeab1 --- /dev/null +++ b/projects/bleMaster/src/proc.c @@ -0,0 +1,266 @@ +/** + **************************************************************************************** + * + * @file proc.c + * + * @brief user procedure. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" + +#include "app.h" +#include "keys.h" +#include "uartRb.h" + +#if (DBG_PROC) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +enum uart_cmd +{ + CMD_DISCONNECT = 0xA0, + CMD_CONNECT = 0xA1, + CMD_SCAN = 0xA2, + + CMD_GATT_EXMTU = 0xB0, + CMD_GATT_DISC, + CMD_GATT_READ, + CMD_GATT_WRITE, +}; + +#define CMD_MAX_LEN 20 +#define NULL_CNT 20 + +static uint8_t buff[CMD_MAX_LEN]; +static uint16_t buff_len = 0; + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +static void uart_proc(void) +{ + static uint8_t null_cnt = 0; + uint16_t len; + bool finish = true; + + len = uart1Rb_Read(&buff[buff_len], CMD_MAX_LEN - buff_len); + if (len > 0) + { + buff_len += len; + if (buff_len < CMD_MAX_LEN) + { + return; // wait full + } + } + else + { + if ((buff_len > 0) && (null_cnt++ > NULL_CNT)) + { + //finish = true; + null_cnt = 0; + } + else + { + return; // wait again + } + } + + switch (buff[0]) + { + case CMD_DISCONNECT: + { + DEBUG("Disconnect"); + gapc_disconnect(app_env.curidx); + } break; + + case CMD_CONNECT: + { + app_init_action(ACTV_STOP); //20211101 + + if (buff_len == 1) + { + DEBUG("CONN Dflt"); + app_start_initiating(NULL); + } + else if (buff_len == 2) + { + if (scan_cnt > buff[1]) + { + app_start_initiating(&scan_addr_list[buff[1]]); + } + } + else if (buff_len >= 8) + { + struct gap_bdaddr peer; + for(int i = 0; i < 6; i++) + { + //peer.addr.addr[i] = buff[6-i]; + peer.addr.addr[i] = buff[i+1]; + } + peer.addr_type = buff[7]; + + DEBUG("CONN Peer:"); + debugHex((uint8_t *)&peer, sizeof(peer)); + app_start_initiating(&peer); + + finish = true; + } + else + { + finish = false; + } + } break; + + case CMD_SCAN: + { + DEBUG("Scan"); + app_scan_action(ACTV_START); + } break; + + case CMD_GATT_DISC: + { + if ((buff_len >= 6) && (buff[1] < 6)) + { + uint8_t disc_op = buff[1] + GATT_DISC_ALL_SVC; + + if ((disc_op == GATT_DISC_BY_UUID_SVC) || (disc_op == GATT_DISC_BY_UUID_CHAR)) + { + if (buff_len >= 7) + { + uint8_t ulen = buff[6]; + if (ulen == 0x02 || ulen == 0x04 || ulen == 0x10) + { + if (buff_len >= 7 + ulen) + { + DEBUG("GATT DISC Uuid(typ:%d,shdl:0x%X,ehdl:0x%X,ulen:%d)", buff[1], read16p(&buff[2]), read16p(&buff[4]), ulen); + gatt_disc(app_env.curidx, disc_op, read16p(&buff[2]), read16p(&buff[4]), ulen, &buff[7]); + } + else + finish = false; + } + } + else + finish = false; + } + else + { + DEBUG("GATT DISC(typ:%d,shdl:0x%X,ehdl:0x%X)", buff[1], read16p(&buff[2]), read16p(&buff[4])); + gatt_disc(app_env.curidx, disc_op, read16p(&buff[2]), read16p(&buff[4]), 2, NULL); + } + } + } break; + + case CMD_GATT_READ: + { + if (buff_len >= 5) + { + if (buff[1] == 0x00) + { + DEBUG("GATT READ(hdl:0x%X,len:%d)", read16p(&buff[2]), buff[4]); + gatt_read(app_env.curidx, read16p(&buff[2]), buff[4]); + } + else if (buff[1] == 0x01) + { + uint8_t offset = (buff_len >= 6)? buff[5] : 0x00; + DEBUG("GATT READ Long(hdl:0x%X,len:%d,oft:%d)", read16p(&buff[2]), buff[4], offset); + gatt_read_long(app_env.curidx, read16p(&buff[2]), buff[4], offset); + } + else if (buff[1] == 0x02) + { + uint8_t ulen = buff[2] & 0xFE; + if (ulen == 0x02 || ulen == 0x04 || ulen == 0x10) + { + if (buff[2] & 0x01) + { + if (buff_len >= ulen+7) + { + DEBUG("GATT READ Uuid(len:%d,shdl:0x%X,ehdl:0x%X)", ulen, read16p(&buff[ulen+3]), read16p(&buff[ulen+5])); + gatt_read_by_uuid(app_env.curidx, ulen, &buff[3], read16p(&buff[ulen+3]), read16p(&buff[ulen+5])); + } + else + finish = false; + } + else + { + if (buff_len >= ulen+3) + { + DEBUG("GATT READ Uuid(len:%d)", ulen); + gatt_read_by_uuid(app_env.curidx, ulen, &buff[3], 0x0001, 0xFFFF); + } + else + finish = false; + } + } + } + else if (buff[1] == 0x03) + { + if (buff_len >= buff[2]+3) + { + DEBUG("GATT READ Multi(hdls:%d)", buff[2]); + gatt_read_by_multiple(app_env.curidx, buff[2], &buff[3]); + } + else + finish = false; + } + } + } break; + + case CMD_GATT_WRITE: + { + if (buff_len >= 5) + { + if (buff[1] <= 0x02) + { + DEBUG("GATT WRITE(typ:%d,hdl:0x%X,len:%d)", buff[1], read16p(&buff[2]),buff_len-4); + gatt_write(app_env.curidx, buff[1]+GATT_WRITE, read16p(&buff[2]), &buff[4], buff_len-4); + } + else if (buff[1] == 0x03) + { + DEBUG("GATT PreWR(hdl:0x%X,len:%d,oft:%d)", read16p(&buff[2]), buff[4], (buff_len == 5)?0x00:buff[5]); + gatt_pre_write(app_env.curidx, read16p(&buff[2]), NULL, buff[4], (buff_len == 5)?0x00:buff[5]); + } + } + } break; + + case CMD_GATT_EXMTU: + { + uint16_t mtu = (buff_len == 3) ? read16p(&buff[1]) : BLE_MTU; + + DEBUG("GATT ExMTU:%d(23~512,blen:%d)", mtu, buff_len); + gatt_exmtu(app_env.curidx, mtu); + } break; + + default: + { + + } break; + } + + if (finish) + { + buff_len = 0; + } +} + +void user_procedure(void) +{ + uart_proc(); + keys_scan(); +} diff --git a/projects/bleMaster/指令说明.docx b/projects/bleMaster/指令说明.docx new file mode 100644 index 0000000..d1e74ec Binary files /dev/null and b/projects/bleMaster/指令说明.docx differ diff --git a/projects/bleMesh/mdk/JLinkSettings.ini b/projects/bleMesh/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/projects/bleMesh/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/projects/bleMesh/mdk/attach.ini b/projects/bleMesh/mdk/attach.ini new file mode 100644 index 0000000..9881461 --- /dev/null +++ b/projects/bleMesh/mdk/attach.ini @@ -0,0 +1 @@ +LOAD %L INCREMENTAL diff --git a/projects/bleMesh/mdk/bleMesh.uvoptx b/projects/bleMesh/mdk/bleMesh.uvoptx new file mode 100644 index 0000000..1c2416e --- /dev/null +++ b/projects/bleMesh/mdk/bleMesh.uvoptx @@ -0,0 +1,573 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + bleMesh + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + .\attach.ini + Segger\JL2CM3.dll + + + + 0 + JL2CM3 + -U59701305 -O70 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC1000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000) + + + 0 + DLGUARM + + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 1 + 1 + 0x20005c40 + 0 + + + + + 2 + 1 + 0x20003000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup_mesh.s + startup_mesh.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\src\proc.c + proc.c + 0 + 0 + + + 2 + 5 + 1 + 0 + 0 + 0 + ..\src\app_mesh.c + app_mesh.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 6 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 7 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + modules + 1 + 0 + 0 + 0 + + 4 + 8 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\leds.c + leds.c + 0 + 0 + + + 4 + 9 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\sftmr.c + sftmr.c + 0 + 0 + + + + + ble\app + 1 + 0 + 0 + 0 + + 5 + 10 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app.c + app.c + 0 + 0 + + + 5 + 11 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_actv.c + app_actv.c + 0 + 0 + + + 5 + 12 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_msg.c + app_msg.c + 0 + 0 + + + 5 + 13 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gapm.c + app_gapm.c + 0 + 0 + + + 5 + 14 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gapc.c + app_gapc.c + 0 + 0 + + + 5 + 15 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gatt.c + app_gatt.c + 0 + 0 + + + + + ble\prf + 1 + 0 + 0 + 0 + + + + mesh\genie + 1 + 0 + 0 + 0 + + 7 + 16 + 1 + 0 + 0 + 0 + ..\..\..\mesh\genie\genie_mesh.c + genie_mesh.c + 0 + 0 + + + 7 + 17 + 1 + 0 + 0 + 0 + ..\..\..\mesh\genie\sha256.c + sha256.c + 0 + 0 + + + + + mesh\model + 1 + 0 + 0 + 0 + + 8 + 18 + 5 + 0 + 0 + 0 + ..\..\..\mesh\lib\sig_model.h + sig_model.h + 0 + 0 + + + 8 + 19 + 4 + 0 + 0 + 0 + ..\..\..\mesh\lib\sig_model.lib + sig_model.lib + 0 + 0 + + + + + mesh\lib + 1 + 0 + 0 + 0 + + 9 + 20 + 5 + 0 + 0 + 0 + ..\..\..\mesh\api\mesh.h + mesh.h + 0 + 0 + + + 9 + 21 + 4 + 0 + 0 + 0 + ..\..\..\mesh\lib\ble6_mesh.lib + ble6_mesh.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 10 + 22 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/projects/bleMesh/mdk/bleMesh.uvprojx b/projects/bleMesh/mdk/bleMesh.uvprojx new file mode 100644 index 0000000..7ae290b --- /dev/null +++ b/projects/bleMesh/mdk/bleMesh.uvprojx @@ -0,0 +1,549 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + bleMesh + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(12000000) ELITTLE + + + + 0 + + + + + + + + + + + + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + bleMesh + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 1 + fromelf.exe --bin -o "$L@L.bin" "#L" + fromelf.exe --text -a -c -o "$L@L.asm" "#L" + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 0 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x20000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 3 + 3 + 1 + 1 + 0 + 0 + 0 + + --c99 --thumb --gnu --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf;..\..\..\mesh\api;..\..\..\mesh\lib;..\..\..\mesh\genie;..\..\..\mesh\model\api + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip_mesh.sct + + + --diag_suppress=L6312,L6314,L6329 --largeregions + + + + + + + + core + + + startup_mesh.s + 2 + ..\..\..\core\mdk\startup_mesh.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + proc.c + 1 + ..\src\proc.c + + + app_mesh.c + 1 + ..\src\app_mesh.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + modules + + + leds.c + 1 + ..\..\..\modules\src\leds.c + + + sftmr.c + 1 + ..\..\..\modules\src\sftmr.c + + + + + ble\app + + + app.c + 1 + ..\..\..\ble\app\app.c + + + app_actv.c + 1 + ..\..\..\ble\app\app_actv.c + + + app_msg.c + 1 + ..\..\..\ble\app\app_msg.c + + + app_gapm.c + 1 + ..\..\..\ble\app\app_gapm.c + + + app_gapc.c + 1 + ..\..\..\ble\app\app_gapc.c + + + app_gatt.c + 1 + ..\..\..\ble\app\app_gatt.c + + + + + ble\prf + + + mesh\genie + + + genie_mesh.c + 1 + ..\..\..\mesh\genie\genie_mesh.c + + + sha256.c + 1 + ..\..\..\mesh\genie\sha256.c + + + + + mesh\model + + + sig_model.h + 5 + ..\..\..\mesh\lib\sig_model.h + + + sig_model.lib + 4 + ..\..\..\mesh\lib\sig_model.lib + + + + + mesh\lib + + + mesh.h + 5 + ..\..\..\mesh\api\mesh.h + + + ble6_mesh.lib + 4 + ..\..\..\mesh\lib\ble6_mesh.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/projects/bleMesh/mdk/clean.bat b/projects/bleMesh/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/projects/bleMesh/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/projects/bleMesh/src/app_mesh.c b/projects/bleMesh/src/app_mesh.c new file mode 100644 index 0000000..7614925 --- /dev/null +++ b/projects/bleMesh/src/app_mesh.c @@ -0,0 +1,349 @@ +/** + **************************************************************************************** + * + * @file app_mesh.c + * + * @brief App SubTask of GATT Message - Example + * + * < If want to modify it, recommend to copy the file to 'user porject'/src > + **************************************************************************************** + */ + +#if (PRF_MESH) + +#include "app.h" +#include "drvs.h" +#include "mesh.h" +#include "sig_model.h" +#include "genie_mesh.h" + +#if (DBG_MESH) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + + +/* +* GLOBAL VARIABLES DECLARATIONS +**************************************************************************************** +*/ + +const tri_tuple_t genie_triple = +{ + /* pid - 4B */ + .pid = 0x006653de, + /* key - 16B */ + .key = {0x4e, 0x14, 0x96, 0x96, 0xfc, 0x16, 0x41, 0xca, 0x3b, 0x8d, 0x0b, 0x5a, 0xaf, 0x5f, 0xee, 0xba}, + /* mac - 6B MSB */ + .mac = {0xfc, 0x42, 0x65, 0x49, 0x1e, 0x2e}, // *MUST Changed for multi device + /* crc - 2B */ + .crc = 0x0000, +}; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +static void genie_triple_init(void) +{ + // Read value from storage, here use const data for demo. + +} + +static void genie_prov_param_conf(ms_prov_param_t *param) +{ + genie_gen_uuid(param->dev_uuid, &genie_triple); + + DEBUG("Dev UUID:"); + debugHex(param->dev_uuid, 16); + + param->static_oob = 0x01; + param->uri_hash = 0x0000; + param->oob_info = 0x00; + param->pub_key_oob = 0x00; + param->out_oob_size = 0x00; + param->in_oob_size = 0x00; + param->out_oob_action = 0x00; + param->in_oob_action = 0x00; + param->info = 0x00; +} + +static void genie_oob_auth_conf(uint8_t *p_oob) +{ + genie_calc_auth(p_oob, &genie_triple); + + DEBUG("OOB Data:"); + debugHex(p_oob, 16); +} + +void app_mesh_create(void) +{ + m_lid_t mdl_lid; + + genie_triple_init(); + + // Config SSID + ms_set_ssid(GENIE_MESH_CID, 0/*pid*/, 0/*vid*/, 0/*loc*/); + + // Register Models + mdl_lid = mm_gens_oo_register(1, true); + DEBUG("mm_gens_oo, mdl_lid=%d", mdl_lid); + + mdl_lid = mm_genc_oo_register(); + DEBUG("mm_genc_oo, mdl_lid=%d", mdl_lid); + + // Start Mesh Bearer + mesh_enable(); +} + + +/* + * MESSAGE HANDLERS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief MESH Service Message Handler + **************************************************************************************** + */ + +APP_MSG_HANDLER(ms_state_ind) +{ + DEBUG("ms_state_ind(op:%d,v1:%d,v2:%d)", param->ind_code, param->state, param->status); + + switch (param->ind_code) + { + case MS_PROV_STATE_IND: + { + DEBUG(" PROV_STATE:%d", param->state); + } break; + + case MS_PROXY_ADV_UPD_IND: + { + DEBUG(" PROXY_ADV(sta:%d,rsn:%d)", param->state, param->status); + } break; + + default: + { + // todo more... + } break; + } +} + +APP_MSG_HANDLER(ms_fndh_fault_ind) +{ + DEBUG("ms_fault_ind(op:%d,tst:%d,cid:0x%X)", param->ind_code, param->test_id, param->comp_id); + + if ( (param->ind_code == MS_FAULT_GET_REQ_IND) + || (param->ind_code == MS_FAULT_TEST_REQ_IND) ) + { + //ms_fndh_fault_rsp(true, param->comp_id, param->test_id, , ); + } +} + +APP_MSG_HANDLER(ms_fndh_period_ind) +{ + DEBUG("ms_period_ind(ms:%d,fault_ms:%d)", param->period_ms, param->period_fault_ms); + +} + +APP_MSG_HANDLER(ms_prov_data_req_ind) +{ + DEBUG("ms_prov_data_req(op:%d,val1:0x%02x,val2:0x%04X)", param->req_code, param->value1, param->value2); + + switch (param->req_code) + { + case MS_PROV_PARAM_DATA_REQ_IND: + { + ms_prov_param_t param; + + genie_prov_param_conf(¶m); + // Provide provisioning parameters + ms_prov_param_rsp(¶m); + } break; + + case MS_PROV_COMPO_DATA_REQ_IND: + { + // only occur when nb_compo_data_page > 1 + //ms_compo_data_rsp(param->value1/*page*/, /*length*/, /*p_data*/); + } break; + + default: //MS_PROV_AUTH_DATA_REQ_IND + { + uint8_t oob_auth[16]; + + genie_oob_auth_conf(oob_auth); + // Provide authentication data + ms_prov_auth_rsp(true, 16, oob_auth); + } break; + } +} + +#if (BLE_MESH_LPN) +APP_MSG_HANDLER(ms_lpn_offer_ind) +{ + DEBUG("ms_lpn_offer_ind(addr:0x%X,cnt:%d,offer:0x%X)", param->frd_addr, param->frd_cnt, param->wd_offer); + +} +#endif //(BLE_MESH_LPN) + +APP_MSG_HANDLER(ms_conf_load_ind) +{ + DEBUG("ms_conf_load_ind(typ:0x%X,idx:%d,sta:0x%X)", param->cfg_type, param->index, param->status); + +} + +APP_MSG_HANDLER(ms_conf_update_ind) +{ + DEBUG("ms_conf_update_ind(typ:0x%X,val1:%d,val2:0x%X)", param->upd_type, param->value1, param->value2); + +} + +/** + **************************************************************************************** + * @brief MESH Model Message Handler + **************************************************************************************** + */ + +APP_MSG_HANDLER(mm_ind) +{ + DEBUG("mm_ind(op:%d)", param->ind_code); + + switch (param->ind_code) + { + case MM_SRV_STATE_UPD_IND: + { + struct mm_srv_state_upd_ind *p_ind = (struct mm_srv_state_upd_ind *)param; + + DEBUG(" SRV_STATE_UPD(elt:%d,sid:%d,state:0x%X,ttms:%d)", + p_ind->elmt_idx, p_ind->state_id, p_ind->state, p_ind->trans_time_ms); + + if (p_ind->state_id == MM_STATE_GEN_ONOFF) + { + if (p_ind->state) + { + GPIO_DAT_CLR(GPIO08); // LED0 on + } + else + { + GPIO_DAT_SET(GPIO08); // LED0 off + } + } + } break; + + case MM_CLI_STATE_IND: + { + struct mm_cli_state_ind *p_ind = (struct mm_cli_state_ind *)param; + + DEBUG(" CLI_STATE(src:%04X,sid:%d,sv1:%d,sv2:%d,rms:%d)", + p_ind->src, p_ind->state_id, p_ind->state_1, p_ind->state_2, p_ind->rem_time_ms); + + if (p_ind->state_id == MM_STATE_GEN_ONOFF) + { + if (p_ind->state_1) + { + GPIO_DAT_CLR(GPIO09); // LED1 on + } + else + { + GPIO_DAT_SET(GPIO09); // LED1 off + } + } + } break; + + default: + { + // todo more... + } break; + } +} + +APP_MSG_HANDLER(mm_req_ind) +{ + DEBUG("mm_req_ind(op:%d)", param->req_code); +} + + +/** + **************************************************************************************** + * @brief SubTask Handler of MESH Message. + **************************************************************************************** + */ +APP_SUBTASK_HANDLER(mesh_msg) +{ + switch (msgid) + { + /**** Mesh Service Message ****/ + case MESH_STATE_IND: + { + APP_MSG_FUNCTION(ms_state_ind); + } break; + + case MESH_FNDH_FAULT_IND: + { + APP_MSG_FUNCTION(ms_fndh_fault_ind); + } break; + + case MESH_FNDH_PERIOD_IND: + { + APP_MSG_FUNCTION(ms_fndh_period_ind); + } break; + + case MESH_PROV_DATA_REQ_IND: + { + APP_MSG_FUNCTION(ms_prov_data_req_ind); + } break; + + #if (BLE_MESH_LPN) + case MESH_LPN_OFFER_IND: + { + APP_MSG_FUNCTION(ms_lpn_offer_ind); + } break; + #endif //(BLE_MESH_LPN) + + case MESH_CONF_LOAD_IND: + { + APP_MSG_FUNCTION(ms_conf_load_ind); + } break; + + case MESH_CONF_UPDATE_IND: + { + APP_MSG_FUNCTION(ms_conf_update_ind); + } break; + + /**** Mesh Model Message ****/ + case MESH_MDL_IND: + { + APP_MSG_FUNCTION(mm_ind); + } break; + + case MESH_MDL_REQ_IND: + { + APP_MSG_FUNCTION(mm_req_ind); + } break; + + default: + { + uint16_t length = ke_param2msg(param)->param_len; + + DEBUG("Unknow MsgId:0x%X, MsgLen:%d", msgid, length); + debugHex((uint8_t *)param, length); + } break; + } + + return (MSG_STATUS_FREE); +} + +#endif //(PRF_MESH) diff --git a/projects/bleMesh/src/cfg.h b/projects/bleMesh/src/cfg.h new file mode 100644 index 0000000..544af64 --- /dev/null +++ b/projects/bleMesh/src/cfg.h @@ -0,0 +1,71 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// System Clock(0=16MHz, 1=32MHz, 2=48MHz, 3=64MHz) +#define SYS_CLK (0) + +/// Debug Mode(0=Disable, 1=via UART, 2=via RTT) +#define DBG_MODE (1) +#define DBG_UART_BAUD (BRR_921600) +#define UART1_CONF_BAUD (BRR_921600) +#define DBG_HARDFAULT (0) + +/// Redefine BLE Heap Size, Note: Mesh's STACK Size ~2.5K +#define BLE_HEAP_BASE (0x20004800) +#define BLE_HEAP_ENV_SIZE (0xD00) +#define BLE_HEAP_MSG_SIZE (0x2000) + +#define BLE_PHY (GAP_PHY_LE_1MBPS) +#define BLE_ROLE (GAP_ROLE_PERIPHERAL | GAP_ROLE_OBSERVER) + +/// BLE Configure (Single or Multi-Connections) +#define BLE_NB_SLAVE (0) +#define BLE_NB_MASTER (0) + +#define BLE_ADDR {0x2e, 0x1e, 0x49, 0x65, 0x42, 0xFC} // *MUST Changed for multi devices +#define BLE_DEV_NAME "myBle-Mesh" +#define BLE_DEV_ICON 0x0000 + +#define APP_ADV_INT_MIN (32) // unit in 0.625ms +#define APP_ADV_INT_MAX (32) // unit in 0.625ms + +/// Profile Configure +#define PRF_GATT (0) +#define PRF_DISS (0) +#define PRF_SESS (0) +#define PRF_MESH (1) + +/// Serial Service @see prf_sess.h +#define SES_UUID_128 (1) +#define SES_READ_SUP (0) + +/// Debug Configure +#if (DBG_MODE) + #define DBG_APP (1) + #define DBG_PROC (0) + #define DBG_ACTV (0) + #define DBG_GAPM (0) + #define DBG_GAPC (1) + #define DBG_MESH (1) + + #define DBG_DISS (0) + #define DBG_SESS (0) + +#endif + +/// Misc Options +#define LED_PLAY (0) +#define CFG_SLEEP (0) + + +#endif //_APP_CFG_H_ diff --git a/projects/bleMesh/src/main.c b/projects/bleMesh/src/main.c new file mode 100644 index 0000000..f62292e --- /dev/null +++ b/projects/bleMesh/src/main.c @@ -0,0 +1,96 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "bledef.h" +#include "mesh.h" +#include "drvs.h" +#include "regs.h" +#include "app.h" +#include "sftmr.h" +#include "leds.h" +#include "uartRb.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +extern void user_procedure(void); + +static void sysInit(void) +{ + iwdt_disable(); + + rcc_ble_en(); + rcc_adc_en(); + + rcc_fshclk_set(FSH_CLK_DPSC42); + + // more todo, eg. Set xosc cap + +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + dbgInit(); + debug("Start(rsn:%X)...\r\n", rsn); + + //uart1Rb_Init(); + + // Init BLE App + app_init(rsn); + + mesh_init(0); + + #if (LED_PLAY) + sftmr_init(); + leds_init(); + leds_play(LED_FAST_BL); + #endif //(LED_PLAY) + + // Init KEY0 & LED0~2 (@see B6-32D DKit-Board) + gpio_dir_input(PA15, IE_UP); // (PA15-->KEY-->GND) + GPIO_DIR_SET_HI(GPIO08 | GPIO09 | GPIO10); // (VDD33-->LEDx-->PA08) +} + +int main(void) +{ + sysInit(); + devInit(); + + // Global Interrupt Enable + GLOBAL_INT_START(); + + // main loop + while (1) + { + // Schedule Messages & Events + ble_schedule(); + + #if (LED_PLAY) + // SoftTimer Polling + sftmr_schedule(); + #endif //(LED_PLAY) + + // User's Procedure + user_procedure(); + } +} diff --git a/projects/bleMesh/src/proc.c b/projects/bleMesh/src/proc.c new file mode 100644 index 0000000..776c1d3 --- /dev/null +++ b/projects/bleMesh/src/proc.c @@ -0,0 +1,69 @@ +/** + **************************************************************************************** + * + * @file proc.c + * + * @brief user procedure. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" +#include "mesh.h" + + +#if (DBG_PROC) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +#define GPIO_KEY0 GPIO15 + +static bool key0_press = false; + +/* + * FUNCTIONS + **************************************************************************************** + */ + +/// Simple detect key0 click +static bool key0_is_clicked() +{ + // current state (true: pressed, false: released) + bool key0_state = ((GPIO_PIN_GET() & GPIO_KEY0) == 0); + + // click action: pressed, then released + bool click = (key0_press & !key0_state); + + // update current state + key0_press = key0_state; + + return click; +} + +void user_procedure(void) +{ + if (key0_is_clicked()) + { + // Restart proxy adv + uint8_t status = ms_proxy_ctrl(MS_PROXY_ADV_NODE_START); + + if (status) + { + DEBUG("ms_proxy_ctrl fail(status:0x%X)", status); + } + } + + // add user more... +} diff --git a/projects/bleOTA/mdk/JLinkSettings.ini b/projects/bleOTA/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/projects/bleOTA/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/projects/bleOTA/mdk/bleOTA.uvoptx b/projects/bleOTA/mdk/bleOTA.uvoptx new file mode 100644 index 0000000..53e1496 --- /dev/null +++ b/projects/bleOTA/mdk/bleOTA.uvoptx @@ -0,0 +1,508 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + bleOTA + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC1000 -FN1 -FF0B6x_256kB_PY_D -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + DLGUARM + (106=-1,-1,-1,-1,0)(107=-1,-1,-1,-1,0) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\src\myapp.c + myapp.c + 0 + 0 + + + 2 + 5 + 1 + 0 + 0 + 0 + ..\src\proc.c + proc.c + 0 + 0 + + + 2 + 6 + 1 + 0 + 0 + 0 + ..\src\ota.c + ota.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 7 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 8 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + modules + 1 + 0 + 0 + 0 + + 4 + 9 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\uart1Rb.c + uart1Rb.c + 0 + 0 + + + 4 + 10 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\leds.c + leds.c + 0 + 0 + + + 4 + 11 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\sftmr.c + sftmr.c + 0 + 0 + + + + + ble\app + 1 + 0 + 0 + 0 + + 5 + 12 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app.c + app.c + 0 + 0 + + + 5 + 13 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_actv.c + app_actv.c + 0 + 0 + + + 5 + 14 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_msg.c + app_msg.c + 0 + 0 + + + 5 + 15 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gapm.c + app_gapm.c + 0 + 0 + + + 5 + 16 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gapc.c + app_gapc.c + 0 + 0 + + + + + ble\prf + 1 + 0 + 0 + 0 + + 6 + 17 + 1 + 0 + 0 + 0 + ..\..\..\ble\prf\prf_diss.c + prf_diss.c + 0 + 0 + + + 6 + 18 + 1 + 0 + 0 + 0 + ..\..\..\ble\prf\prf_sess.c + prf_sess.c + 0 + 0 + + + 6 + 19 + 1 + 0 + 0 + 0 + ..\..\..\ble\prf\prf_otas.c + prf_otas.c + 0 + 0 + + + + + ble\lib + 1 + 0 + 0 + 0 + + 7 + 20 + 4 + 0 + 0 + 0 + ..\..\..\ble\lib\ble6.lib + ble6.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 8 + 21 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/projects/bleOTA/mdk/bleOTA.uvprojx b/projects/bleOTA/mdk/bleOTA.uvprojx new file mode 100644 index 0000000..4a865e3 --- /dev/null +++ b/projects/bleOTA/mdk/bleOTA.uvprojx @@ -0,0 +1,535 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + bleOTA + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + bleOTA + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --thumb --gnu --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip_ble.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + myapp.c + 1 + ..\src\myapp.c + + + proc.c + 1 + ..\src\proc.c + + + ota.c + 1 + ..\src\ota.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + modules + + + uart1Rb.c + 1 + ..\..\..\modules\src\uart1Rb.c + + + leds.c + 1 + ..\..\..\modules\src\leds.c + + + sftmr.c + 1 + ..\..\..\modules\src\sftmr.c + + + + + ble\app + + + app.c + 1 + ..\..\..\ble\app\app.c + + + app_actv.c + 1 + ..\..\..\ble\app\app_actv.c + + + app_msg.c + 1 + ..\..\..\ble\app\app_msg.c + + + app_gapm.c + 1 + ..\..\..\ble\app\app_gapm.c + + + app_gapc.c + 1 + ..\..\..\ble\app\app_gapc.c + + + + + ble\prf + + + prf_diss.c + 1 + ..\..\..\ble\prf\prf_diss.c + + + prf_sess.c + 1 + ..\..\..\ble\prf\prf_sess.c + + + prf_otas.c + 1 + ..\..\..\ble\prf\prf_otas.c + + + + + ble\lib + + + ble6.lib + 4 + ..\..\..\ble\lib\ble6.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/projects/bleOTA/mdk/clean.bat b/projects/bleOTA/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/projects/bleOTA/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/projects/bleOTA/src/cfg.h b/projects/bleOTA/src/cfg.h new file mode 100644 index 0000000..e7776cb --- /dev/null +++ b/projects/bleOTA/src/cfg.h @@ -0,0 +1,51 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// System Clock(0=16MHz, 1=32MHz, 2=48MHz, 3=64MHz) +#define SYS_CLK (0) + +/// Debug Mode(0=Disable, 1=via UART, 2=via RTT) +#define DBG_MODE (1) + +/// BLE Configure (Single or Multi-Connections) +#define BLE_NB_SLAVE (1) +#define BLE_NB_MASTER (0) + +#define BLE_ADDR {0x00, 0x09, 0x22, 0x20, 0x01, 0xD3} +#define BLE_DEV_NAME "myBle-OTA" +#define BLE_DEV_ICON 0x0000 + +#define APP_ADV_INT_MIN (32) // unit in 0.625ms +#define APP_ADV_INT_MAX (32) // unit in 0.625ms + +/// Profile Configure +#define PRF_DISS (1) +#define PRF_SESS (1) +#define PRF_OTAS (1) + +/// Debug Configure +#if (DBG_MODE) + #define DBG_APP (0) + #define DBG_PROC (0) + #define DBG_ACTV (0) + #define DBG_GAPM (0) + #define DBG_GAPC (0) + #define DBG_SESS (0) + #define DBG_OTAS (1) +#endif + +/// Misc Options +#define LED_PLAY (1) +#define CFG_SLEEP (0) + +#endif //_APP_CFG_H_ diff --git a/projects/bleOTA/src/main.c b/projects/bleOTA/src/main.c new file mode 100644 index 0000000..c3af4ef --- /dev/null +++ b/projects/bleOTA/src/main.c @@ -0,0 +1,83 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "bledef.h" +#include "app.h" +#include "sftmr.h" +#include "leds.h" +#include "uartRb.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +extern void user_procedure(void); + +static void sysInit(void) +{ + iwdt_disable(); + + rcc_ble_en(); + rcc_adc_en(); + + rcc_fshclk_set(FSH_CLK_DPSC42); +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + uart1Rb_Init(); //dbgInit(); + debug("Start(rsn:%X)...\r\n", rsn); + + #if (LED_PLAY) + sftmr_init(); + leds_init(); + leds_play(LED_FAST_BL); + #endif //(LED_PLAY) + + // Init BLE App + app_init(rsn); +} + +int main(void) +{ + sysInit(); + devInit(); + + // Global Interrupt Enable + GLOBAL_INT_START(); + + // main loop + while (1) + { + // Schedule Messages & Events + ble_schedule(); + + #if (LED_PLAY) + // SoftTimer Polling + sftmr_schedule(); + #endif //(LED_PLAY) + + // User's Procedure + user_procedure(); + } +} diff --git a/projects/bleOTA/src/myapp.c b/projects/bleOTA/src/myapp.c new file mode 100644 index 0000000..9a3d5bc --- /dev/null +++ b/projects/bleOTA/src/myapp.c @@ -0,0 +1,104 @@ +/** + **************************************************************************************** + * + * @file myapp.c + * + * @brief User Application - Override func + * + **************************************************************************************** + */ + +#include "app.h" +#include "bledef.h" +#include "drvs.h" +#include "leds.h" +#include "ota.h" + +#if (DBG_APP) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * VARIABLES DEFINITIONS + **************************************************************************************** + */ + + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief API to Init Application, add ota_init + * + * @param[in] rsn reset reason @see enum rst_src_bfs + **************************************************************************************** + */ +void app_init(uint16_t rsn) +{ + heap_cfg_t heap; + + // Config Heap, resized with special mode + heap.base[MEM_ENV] = BLE_HEAP_BASE; + heap.size[MEM_ENV] = BLE_HEAP_ENV_SIZE; + heap.base[MEM_MSG] = BLE_HEAP_BASE + BLE_HEAP_ENV_SIZE; + heap.size[MEM_MSG] = BLE_HEAP_MSG_SIZE; + + ble_heap(&heap); + + // Init Ble Stack + ble_init(); + + // Init RF & Modem + rfmdm_init(); + + // Init App Task + ble_app(); + + ota_init(); +} + +#if (LED_PLAY) +/** + **************************************************************************************** + * @brief API to Set State of Application, add leds Indication + * + * @param[in] state new state + **************************************************************************************** + */ +void app_state_set(uint8_t state) +{ + DEBUG("State(old:%d,new:%d)", app_state_get(), state); + + app_env.state = state; + + // Indication, User add more... + if (state == APP_IDLE) + { + leds_play(LED_SLOW_BL); + } + else if (state == APP_READY) + { + leds_play(LED_FAST_BL); + } + else if (state == APP_CONNECTED) + { + leds_play(LED_CONT_ON); + } +} +#endif //(LED_PLAY) + diff --git a/projects/bleOTA/src/ota.c b/projects/bleOTA/src/ota.c new file mode 100644 index 0000000..e48c150 --- /dev/null +++ b/projects/bleOTA/src/ota.c @@ -0,0 +1,523 @@ +/** + **************************************************************************************** + * + * @file ota.c + * + * @brief Main loop of the application. + * + **************************************************************************************** + */ +#include "drvs.h" +#include "regs.h" +#include "prf_otas.h" +#include "app.h" +#include "sftmr.h" +#include "leds.h" +#include "ota.h" + +/* + * DEFINES + **************************************************************************************** + */ +/// examples\loader +#define CFG_USE_LOAD 0 + +#if (DBG_OTAS) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + +#ifndef OTA_LED +#define OTA_LED (GPIO08|GPIO10) +#endif + +#ifndef FLASH_BASE +#define FLASH_BASE (0x18000000) +#endif + +#define FLASH_SIZE (0x40000) // 256KB +#define FLASH_PAGE_SIZE (0x100) // 256B +#define FLASH_SECTOR_SIZE (0x1000) // 4KB +#define FLASH_PAGE_SIZE_WLEN (FLASH_PAGE_SIZE >> 2) + +#define FLASH_INFO_PAGE (0x00) +#define FLASH_INFO_MAGIC (FLASH_BASE + 0x00) +#define FLASH_INFO_CODE_LEN (FLASH_BASE + 0x04) +#define FLASH_INFO_CODE_ADDR (FLASH_BASE + 0x08) + +#define OTA_BANK_A_BASE (0x18004000) +#if (CFG_USE_LOAD) +#define OTA_BANK_B_BASE (0x18020100) +#else +#define OTA_BANK_B_BASE (0x18020000) +#endif +#define OTA_BANK_A (OTA_BANK_A_BASE - FLASH_BASE) +#define OTA_BANK_B (OTA_BANK_B_BASE - FLASH_BASE) + +#define FLASH_ADDR_INVALID (0xFFFFFFFF) + +#define OTA_FW_SECTOR_MAX_SIZE ((FLASH_SIZE - OTA_BANK_B) / FLASH_SECTOR_SIZE) +#define OTA_FW_MAX_SIZE (OTA_FW_SECTOR_MAX_SIZE * FLASH_SECTOR_SIZE) / 16 // 112K + +#define OTA_BUFF_LEN (64) +#define OTA_PKT_LEN (20) // 2B index + 16B ota data + 2B CRC +#define OTA_DATA_LEN (OTA_PKT_LEN - 4) +#define OTA_DATA_OLD (0x55) +#define OTA_DATA_NEW (0xAA) +#define OTA_TIMER_TICK _MS(3000) // 3s +#define OTA_MAX_TIMEOUT (1000) // 3000s + +enum ota_state +{ + OTA_IDLE, + OTA_START, + OTA_BUSY, + OTA_ERROR, + OTA_END, +}; + +enum ota_cmd +{ + OTA_CMD_START = 0xFF01, + OTA_CMD_END = 0xFF02, +}; + +enum ota_err_code +{ + OTA_ERR_NONE = 0, // No error + OTA_ERR_BANK_ADDR = 0x5501, + OTA_ERR_PKT_LEN = 0x5502, + OTA_ERR_CRC = 0x5504, + OTA_ERR_FW = 0x5508, + OTA_ERR_TIMEOUT = 0x5510, + OTA_ERR_INDEX = 0x5512, + OTA_ERR_MAC = 0x5514, + OTA_ERR_FAIL = 0x55AA, +}; + +struct ota_env_tag +{ + uint32_t bank; + uint16_t data_len; + uint16_t err_info; + uint16_t local_data_idx; + uint16_t peer_data_idx; + uint8_t data_sta; + uint8_t proc_sta; + tmr_tk_t tcnt; + tmr_id_t tid; + uint8_t rsv; +}; + +uint8_t ota_recv_buf[OTA_BUFF_LEN]; +uint32_t ota_wr_data[FLASH_PAGE_SIZE_WLEN]; + + +volatile struct ota_env_tag ota_env; + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ +__attribute__((section("ram_func.ota.124"))) +static void flash_sector_erase(uint32_t offset) +{ + GLOBAL_INT_DISABLE(); + + while (SYSCFG->ACC_CCR_BUSY); + + fshc_erase(offset, FSH_CMD_ER_SECTOR); + + GLOBAL_INT_RESTORE(); +} + +__attribute__((section("ram_func.ota.136"))) +static void flash_wr_protect(uint8_t val) +{ + GLOBAL_INT_DISABLE(); + + while (SYSCFG->ACC_CCR_BUSY); + + uint8_t sta_reg0 = fshc_rd_sta(FSH_CMD_RD_STA0, 1); + + if (val != sta_reg0) + { + // д0x000-0xFFF (4KB) + // write en singal + fshc_en_cmd(FSH_CMD_WR_EN); + + // send write sta cmd + fshc_wr_sta(FSH_CMD_WR_STA, 1, val); + + bootDelayUs(12000); + } + + GLOBAL_INT_RESTORE(); +} + +/** + **************************************************************************************** + * @brief Swap bytes of a 16 bits value. + * The swap is done in every case. Should not be called directly. + * @param[in] val16 The 16 bit value to swap. + * @return The 16 bit swapped value. + **************************************************************************************** + */ +__INLINE__ uint16_t co_bswap16(uint16_t val16) +{ + return ((val16 << 8) & 0xFF00) | ((val16 >> 8) & 0x00FF); +} + +static void ota_env_init(void) +{ + ota_env.bank = FLASH_ADDR_INVALID; + ota_env.data_len = 0; + ota_env.data_sta = OTA_DATA_OLD; + ota_env.err_info = OTA_ERR_NONE; + ota_env.proc_sta = OTA_IDLE; + ota_env.local_data_idx = 0; + ota_env.peer_data_idx = 0xFFFF; + ota_env.tid = TMR_ID_NONE; + ota_env.tcnt = 0; +} + +void ota_init(void) +{ + ota_env_init(); + + #if (CFG_USE_LOAD) + ota_env.bank = OTA_BANK_B; + #else + uint32_t curr_code_addr = RD_32(FLASH_INFO_CODE_ADDR); + DEBUG("Curr Addr:0x%x", curr_code_addr); + ota_env.bank = FLASH_ADDR_INVALID; + if(curr_code_addr == OTA_BANK_A_BASE) + { + ota_env.bank = OTA_BANK_B; + } + else if(curr_code_addr == OTA_BANK_B_BASE) + { + ota_env.bank = OTA_BANK_A; + } + #endif + + DEBUG("OTA_BANK:0x%x", ota_env.bank); +} + +/****************************************************************************** + * Name: CRC-16/MODBUS + * Poly: 0x8005 ( x16+x15+x2+1 ) + * Init: 0xFFFF + * Refin: True + * Refout: True + * Xorout: 0x0000 + *****************************************************************************/ +static uint16_t crc16_modbus(uint8_t *data, uint16_t length) +{ + uint8_t i; + uint16_t crc = 0xFFFF; // Initial value + + while (length--) + { + crc ^= *data++; + + for (i = 0; i < 8; ++i) + { + if (crc & 1) + { + crc = (crc >> 1) ^ 0xA001; // 0xA001 = reverse 0x8005 + } + else + { + crc = (crc >> 1); + } + } + } + + return crc; +} + +void otas_cb_rxd(uint8_t conidx, uint16_t len, const uint8_t *data) +{ + app_env.curidx = conidx; + ota_env.data_len = len; + + if (ota_env.data_len > OTA_BUFF_LEN) + { + ota_env.data_len = OTA_BUFF_LEN; + } + + memcpy(ota_recv_buf, data, ota_env.data_len); + + ota_env.data_sta = OTA_DATA_NEW; +} + +tmr_tk_t ota_time_handle(uint8_t timeid) +{ + ota_env.tcnt++; + + if (ota_env.tcnt > OTA_MAX_TIMEOUT) + { + ota_env.tcnt = 0; + ota_env.proc_sta = OTA_ERROR; + ota_env.err_info = OTA_ERR_TIMEOUT; + + DEBUG("OTA_TIMEOUT"); + sftmr_clear(ota_env.tid); + } + + return OTA_TIMER_TICK; +} + +void ota_ok_led(void) +{ + for (uint8_t i = 0; i < 6; i++) + { + GPIO_DAT_TOG(OTA_LED); + sftmr_wait(20); + } +} + +void ota_proc(void) +{ + uint16_t peer_crc16, local_crc16; + + switch (ota_env.proc_sta) + { + case OTA_IDLE: + { + if ((co_bswap16(read16p(ota_recv_buf)) == OTA_CMD_START) && (ota_env.data_len == OTA_PKT_LEN)) + { + ota_env.data_sta = OTA_DATA_OLD; + + peer_crc16 = read16p(ota_recv_buf + OTA_PKT_LEN - 2); + local_crc16 = crc16_modbus(ota_recv_buf, OTA_PKT_LEN - 2); + + ota_env.proc_sta = OTA_ERROR; + ota_env.err_info = OTA_ERR_CRC; + + if (local_crc16 == peer_crc16) + { + uint8_t i = 0; + for (; i < 6; i++) + { + // First Packet Check Connect BLE Mac + if (ota_recv_buf[2 + i] != ble_dev_addr.addr[5 - i]) + { + break; + } + } + + if (i == 6) + { + if (ota_env.bank != FLASH_ADDR_INVALID) + { + // Erase + uint32_t erase_offset = (ota_env.bank & 0xFFFFF000UL); + uint32_t erase_end = (ota_env.bank == OTA_BANK_B ? FLASH_SIZE : OTA_BANK_B); + for (;erase_offset < erase_end; erase_offset += FLASH_SECTOR_SIZE) + { + flash_sector_erase(erase_offset); + } + + ota_env.proc_sta = OTA_START; + ota_env.err_info = OTA_ERR_NONE; + otas_txd_send(app_env.curidx, 2, ota_recv_buf); + } + else + { + ota_env.err_info = OTA_ERR_BANK_ADDR; + DEBUG("OTA_ERR_BANK_ADDR"); + return; + } + } + else + { + ota_env.err_info = OTA_ERR_MAC; + DEBUG("OTA_ERR_MAC"); + return; + } + } + } + } break; + + case OTA_START: + { + ota_env.err_info = OTA_ERR_NONE; + ota_env.proc_sta = OTA_BUSY; + ota_env.local_data_idx = 0; + ota_env.peer_data_idx = 0xFFFF; + ota_env.tcnt = 0; + ota_env.tid = sftmr_start(OTA_TIMER_TICK, ota_time_handle); + + leds_play(LED_BUSY_BL); + } break; + + case OTA_BUSY: + { + if (app_state_get() < APP_CONNECTED) + { + ota_env.err_info = OTA_ERR_NONE; + ota_env.proc_sta = OTA_IDLE; + ota_env.local_data_idx = 0; + ota_env.peer_data_idx = 0xFFFF; + ota_env.tcnt = 0; + sftmr_clear(ota_env.tid); + + return; + } + + if (ota_env.data_sta == OTA_DATA_OLD) + { + return; + } + + ota_env.proc_sta = OTA_ERROR; + ota_env.data_sta = OTA_DATA_OLD; + + //(ota_recv_buf[OTA_PKT_LEN - 1] << 8) | ota_recv_buf[OTA_PKT_LEN - 2]); + peer_crc16 = read16p(ota_recv_buf + OTA_PKT_LEN - 2); + + if (ota_env.data_len == OTA_PKT_LEN) + { + local_crc16 = crc16_modbus(ota_recv_buf, OTA_PKT_LEN - 2); + + if (co_bswap16(read16p(ota_recv_buf)) == OTA_CMD_END) + { + if (local_crc16 == peer_crc16) + { + otas_txd_send(app_env.curidx, 2, ota_recv_buf); + + if (ota_env.local_data_idx > OTA_FW_MAX_SIZE) + { + ota_env.err_info = OTA_ERR_FW; + } + else + { + uint16_t index_check = co_bswap16(read16p(ota_recv_buf+4));//((ota_recv_buf[4] << 8) | ota_recv_buf[5]); + index_check = ~index_check; + ota_env.peer_data_idx = co_bswap16(read16p(ota_recv_buf+2));//((ota_recv_buf[2] << 8) | ota_recv_buf[3]); + + if ((index_check == ota_env.peer_data_idx) && (ota_env.local_data_idx == (ota_env.peer_data_idx + 1))) + { + // write remain data + if ((ota_env.local_data_idx % OTA_DATA_LEN) != 0) + { + uint32_t wr_addr = (ota_env.peer_data_idx / OTA_DATA_LEN) * FLASH_PAGE_SIZE + ota_env.bank; + DEBUG("ADDRW:0x%X,ota_app_idx:%d", wr_addr, ota_env.peer_data_idx); + flash_write(wr_addr, ota_wr_data, FLASH_PAGE_SIZE_WLEN); + } + + ota_env.err_info = OTA_ERR_NONE; + ota_env.proc_sta = OTA_END; + leds_play(LED_CONT_ON); + } + else + { + ota_env.err_info = OTA_ERR_INDEX; + DEBUG("OTA_ERR_INDEX"); + } + } + + return; + } + else + { + ota_env.err_info = OTA_ERR_CRC; + DEBUG("OTA_ERR_CRC"); + return; + } + } + } + else + { + ota_env.err_info = OTA_ERR_PKT_LEN; + DEBUG("OTA_ERR_PKT_LEN"); + return; + } + + ota_env.peer_data_idx = co_bswap16(read16p(ota_recv_buf));//((ota_recv_buf[0] << 8) | ota_recv_buf[1]); + if ((ota_env.local_data_idx == ota_env.peer_data_idx) && (ota_env.proc_sta != OTA_END)) + { + if (local_crc16 == peer_crc16) + { + ota_env.proc_sta = OTA_BUSY; + ota_env.err_info = OTA_ERR_NONE; + uint8_t wr_data_pos = (ota_env.local_data_idx % OTA_DATA_LEN) * OTA_DATA_LEN; + memcpy(((uint8_t *)ota_wr_data + wr_data_pos), ota_recv_buf + 2, OTA_DATA_LEN); + + uint32_t wr_addr = (ota_env.peer_data_idx / OTA_DATA_LEN) * FLASH_PAGE_SIZE + ota_env.bank; + + if ((ota_env.local_data_idx % OTA_DATA_LEN) == (OTA_DATA_LEN - 1)) + { + DEBUG("ADDRW:0x%X,peer_idx:%d", wr_addr, ota_env.peer_data_idx); + flash_write(wr_addr, ota_wr_data, FLASH_PAGE_SIZE_WLEN); + } + } + else + { + ota_env.err_info = OTA_ERR_CRC; + DEBUG("CRC_ERROR"); + } + + ota_env.local_data_idx++; + } + else + { + ota_env.err_info = OTA_ERR_INDEX; + DEBUG("INDEX_ERROR"); + } + } break; + + case OTA_ERROR: + { + DEBUG("ERROR_CODE:0x%x", ota_env.err_info); + otas_txd_send(app_env.curidx, 2, (uint8_t *)&ota_env.err_info); + ota_env.err_info = OTA_ERR_FAIL; + otas_txd_send(app_env.curidx, 2, (uint8_t *)&ota_env.err_info); + + NVIC_SystemReset(); + } break; + + case OTA_END: + { + DEBUG("OTA_success"); + + ota_env.proc_sta = OTA_IDLE; + ota_env.err_info = OTA_ERR_NONE; + +#if (CFG_USE_LOAD) + DEBUG("data_idx:%d", ota_env.local_data_idx); + memset((uint8_t *)ota_wr_data, 0xFF, sizeof(ota_wr_data)); + ota_wr_data[0] = 0x55AA5AA5; + ota_wr_data[1] = (ota_env.local_data_idx * 16); + ota_wr_data[2] = OTA_BANK_B_BASE; + + flash_page_erase(OTA_BANK_B - FLASH_PAGE_SIZE); + flash_write(OTA_BANK_B - FLASH_PAGE_SIZE, ota_wr_data, FLASH_PAGE_SIZE_WLEN); +#else + flash_wr_protect(0x00); + + flash_read(FLASH_INFO_PAGE, ota_wr_data, FLASH_PAGE_SIZE_WLEN); + ota_wr_data[1] = ota_env.local_data_idx * 16; + ota_wr_data[2] = ota_env.bank | FLASH_BASE; + + flash_page_erase(FLASH_INFO_PAGE); + flash_write(FLASH_INFO_PAGE, ota_wr_data, FLASH_PAGE_SIZE_WLEN); + + flash_wr_protect(0x64); +#endif + ota_ok_led(); + + NVIC_SystemReset(); + } break; + } +} + +bool is_ota_proc(void) +{ + return (ota_env.proc_sta != OTA_IDLE); +} diff --git a/projects/bleOTA/src/ota.h b/projects/bleOTA/src/ota.h new file mode 100644 index 0000000..fe8a21f --- /dev/null +++ b/projects/bleOTA/src/ota.h @@ -0,0 +1,9 @@ +#ifndef _OTA_H_ +#define _OTA_H_ + +#include + +void ota_init(void); +void ota_proc(void); +bool is_ota_proc(void); +#endif diff --git a/projects/bleOTA/src/proc.c b/projects/bleOTA/src/proc.c new file mode 100644 index 0000000..f9a7299 --- /dev/null +++ b/projects/bleOTA/src/proc.c @@ -0,0 +1,129 @@ +/** + **************************************************************************************** + * + * @file proc.c + * + * @brief user procedure. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" + +#include "app.h" +#include "prf_sess.h" +#include "prf_otas.h" +#include "uartRb.h" +#include "ota.h" + +#if (DBG_PROC) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +#define BLE_MAX_LEN 20 +#define NULL_CNT 20 + +static uint8_t buff[BLE_MAX_LEN]; +static uint16_t buff_len = 0; + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +/// Override - Callback on received data from peer device +void sess_cb_rxd(uint8_t conidx, uint16_t len, const uint8_t *data) +{ + uart_send(UART1_PORT, len, data); +} + +/// Uart Data procedure +static void data_proc(void) +{ + // Todo Loop-Proc + static uint8_t null_cnt = 0; + uint16_t len; + + len = uart1Rb_Read(&buff[buff_len], BLE_MAX_LEN - buff_len); + if (len > 0) + { + buff_len += len; + if (buff_len < BLE_MAX_LEN) + { + return; // wait full + } + } + else + { + if ((buff_len > 0) && (null_cnt++ > NULL_CNT)) + { + //finish = true; + null_cnt = 0; + } + else + { + return; // wait again + } + } + + if (app_state_get() == APP_CONNECTED) + { + if (sess_txd_send(app_env.curidx, buff_len, buff) == LE_SUCCESS) + { + buff_len = 0; + } + } + else + { + // goto reset + if (buff[0] == 0xAA) + { + DEBUG("GAP Reset!\r\n"); + gapm_reset(); + } + buff_len = 0; + } +} + +#if (CFG_SLEEP) +static void sleep_proc(void) +{ + uint8_t lpsta = ble_sleep(BLE_SLP_TWOSC, BLE_SLP_DURMAX); + + if (lpsta == BLE_IN_SLEEP) + { + uint16_t lpret = core_sleep(CFG_WKUP_BLE_EN); + //DEBUG("ble sta:%d, wksrc:%X", lpsta, lpret); + } + else + { + //DEBUG("ble sta:%d", lpsta); + } +} +#endif //(CFG_SLEEP) + +void user_procedure(void) +{ + #if (CFG_SLEEP) + sleep_proc(); + #endif //(CFG_SLEEP) + + data_proc(); + + #if (PRF_OTAS) + ota_proc(); + #endif +} diff --git a/projects/bleRemoteControl/Master/mdk/JLinkSettings.ini b/projects/bleRemoteControl/Master/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/projects/bleRemoteControl/Master/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/projects/bleRemoteControl/Master/mdk/bleRC_M.uvoptx b/projects/bleRemoteControl/Master/mdk/bleRC_M.uvoptx new file mode 100644 index 0000000..54f7c8a --- /dev/null +++ b/projects/bleRemoteControl/Master/mdk/bleRC_M.uvoptx @@ -0,0 +1,483 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + bleRC_M + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + DLGUARM + d + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20003000 -FC1000 -FN1 -FF0B6x_256kB_PY_D -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM)) + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC1000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 1 + 1 + 0x20003a7c + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + System Viewer\AON + 35905 + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 5 + 0 + 0 + 0 + ..\src\app_user.h + app_user.h + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 5 + 5 + 0 + 0 + 0 + ..\..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 6 + 4 + 0 + 0 + 0 + ..\..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + ble\app + 1 + 0 + 0 + 0 + + 4 + 7 + 1 + 0 + 0 + 0 + ..\src\app.c + app.c + 0 + 0 + + + 4 + 8 + 1 + 0 + 0 + 0 + ..\src\app_actv.c + app_actv.c + 0 + 0 + + + 4 + 9 + 1 + 0 + 0 + 0 + ..\src\app_msg.c + app_msg.c + 0 + 0 + + + 4 + 10 + 1 + 0 + 0 + 0 + ..\..\..\..\ble\app\app_gapm.c + app_gapm.c + 0 + 0 + + + 4 + 11 + 1 + 0 + 0 + 0 + ..\src\app_gapc.c + app_gapc.c + 0 + 0 + + + 4 + 12 + 1 + 0 + 0 + 0 + ..\src\app_gatt.c + app_gatt.c + 0 + 0 + + + + + ble\lib + 1 + 0 + 0 + 0 + + 5 + 13 + 4 + 0 + 0 + 0 + ..\..\..\..\ble\lib\ble6.lib + ble6.lib + 0 + 0 + + + + + usbd + 1 + 0 + 0 + 0 + + 6 + 14 + 4 + 0 + 0 + 0 + ..\..\..\..\usb\lib\usbd.lib + usbd.lib + 0 + 0 + + + 6 + 15 + 5 + 0 + 0 + 0 + ..\..\..\..\usb\api\usbd.h + usbd.h + 0 + 0 + + + 6 + 16 + 1 + 0 + 0 + 0 + ..\src\usbd_hid.c + usbd_hid.c + 0 + 0 + + + 6 + 17 + 1 + 0 + 0 + 0 + ..\src\hid_boot.c + hid_boot.c + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 7 + 18 + 1 + 0 + 0 + 0 + ..\..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/projects/bleRemoteControl/Master/mdk/bleRC_M.uvprojx b/projects/bleRemoteControl/Master/mdk/bleRC_M.uvprojx new file mode 100644 index 0000000..69c1e01 --- /dev/null +++ b/projects/bleRemoteControl/Master/mdk/bleRC_M.uvprojx @@ -0,0 +1,515 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + bleRC_M + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + bleRC_M + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --thumb --gnu --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\..\core;..\..\..\..\core\reg;..\..\..\..\drivers\api;..\..\..\..\modules\api;..\..\..\..\ble\api;..\..\..\..\ble\app;..\..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\src\link_xip_ble.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + app_user.h + 5 + ..\src\app_user.h + + + main.c + 1 + ..\src\main.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\..\drivers\lib\drvs.lib + + + + + ble\app + + + app.c + 1 + ..\src\app.c + + + app_actv.c + 1 + ..\src\app_actv.c + + + app_msg.c + 1 + ..\src\app_msg.c + + + app_gapm.c + 1 + ..\..\..\..\ble\app\app_gapm.c + + + app_gapc.c + 1 + ..\src\app_gapc.c + + + app_gatt.c + 1 + ..\src\app_gatt.c + + + + + ble\lib + + + ble6.lib + 4 + ..\..\..\..\ble\lib\ble6.lib + + + + + usbd + + + usbd.lib + 4 + ..\..\..\..\usb\lib\usbd.lib + + + usbd.h + 5 + ..\..\..\..\usb\api\usbd.h + + + usbd_hid.c + 1 + ..\src\usbd_hid.c + + + hid_boot.c + 1 + ..\src\hid_boot.c + + + + + debug + + + debug.c + 1 + ..\..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/projects/bleRemoteControl/Master/mdk/clean.bat b/projects/bleRemoteControl/Master/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/projects/bleRemoteControl/Master/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/projects/bleRemoteControl/Master/src/app.c b/projects/bleRemoteControl/Master/src/app.c new file mode 100644 index 0000000..cfded0f --- /dev/null +++ b/projects/bleRemoteControl/Master/src/app.c @@ -0,0 +1,448 @@ +/** + **************************************************************************************** + * + * @file app.c + * + * @brief Application entry point - Example + * + * < __weak func as demo, recommend to Override its in 'user porject'/src/myapp.c > + **************************************************************************************** + */ + +#include "app.h" +#include "bledef.h" +#include "drvs.h" +#include "prf_api.h" +#include "app_user.h" + +#if (DBG_APP) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFAULT CONFIGURATION + **************************************************************************************** + */ + +#if !defined(BLE_DEV_NAME) + #define BLE_DEV_NAME "myBle6" +#endif + +#if !defined(BLE_ADDR) + #define BLE_ADDR { 0x30, 0x06, 0x23, 0x20, 0x01, 0xD2 } +#endif + +#if !defined(BLE_ROLE) +#if (BLE_NB_SLAVE && BLE_NB_MASTER) + #define BLE_ROLE (GAP_ROLE_CENTRAL | GAP_ROLE_PERIPHERAL) +#elif (BLE_NB_MASTER) + #define BLE_ROLE (GAP_ROLE_CENTRAL) +#else // Only Slave + #define BLE_ROLE (GAP_ROLE_PERIPHERAL) +#endif +#endif + +#if !defined(BLE_PHY) + #define BLE_PHY (GAP_PHY_LE_1MBPS) // | GAP_PHY_LE_2MBPS) +#endif + +#if !defined(BLE_PAIRING) + #define BLE_PAIRING (GAPM_PAIRING_LEGACY) +#endif + +#if !defined(BLE_AUTH) + #define BLE_AUTH (GAP_AUTH_REQ_NO_MITM_NO_BOND) +#endif + +#if !defined(BLE_SECREQ) + #define BLE_SECREQ (GAP_NO_SEC) +#endif + +#if !defined(BLE_SYNC_WORD) +#define BLE_SYNC_WORD (0x8E89BED6) +#endif + +#define SYNC_WORD_L ((BLE_SYNC_WORD >> 0) & 0xFFFF) +#define SYNC_WORD_H ((BLE_SYNC_WORD >> 16) & 0xFFFF) + +/* + * VARIABLES DEFINITIONS + **************************************************************************************** + */ + +/// Application Environment +__VAR_ENV struct app_env_tag app_env; + +/// Ble local address (user customize) +bd_addr_t ble_dev_addr = { BLE_ADDR }; + +/// GAP device configuration +const struct gapm_dev_config ble_dev_config = +{ + // Device Role: Central, Peripheral (@see gap_role) + .gap_role = BLE_ROLE, + + // Pairing mode authorized (@see enum gapm_pairing_mode) + .pairing = BLE_PAIRING, + + // Preferred LE PHY for data (@see enum gap_phy) + .pref_phy = BLE_PHY, + + // Maximal MTU acceptable for device (23~512) + .max_mtu = BLE_MTU, +}; + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @section Profile Interface + **************************************************************************************** + */ + +// Connection interval unit in 1.25ms +#define SLV_PREF_INTV_MIN (10) +#define SLV_PREF_INTV_MAX (10) +// Slave latency +#define SLV_PREF_LATENCY (0) +// Connection supervision timeout multiplier unit in 10ms +#define SLV_PREF_TIME_OUT (300) + +/** + **************************************************************************************** + * @brief Retrieve Dev Info to Generic Access Profile, User implement for Callback. + * + * @param[in] conidx connection index + * @param[in] req iequest of info type @see enum gapc_dev_info + * @param[in] maxlen buffer length, DEV_NAME_MAX_LEN or size of gapc_conn_param + * @param[out] info pointer of buffer + * + * @return Length of device information, 0 means an error occurs. + **************************************************************************************** + */ +__weak uint16_t gap_svc_get_dev_info(uint8_t conidx, uint8_t req, uint16_t maxlen, uint8_t *info) +{ + if (req == GAPC_DEV_NAME) + { + return app_name_get(DEV_NAME_MAX_LEN, info); + } + else if (req == GAPC_DEV_APPEARANCE) + { + write16(info, app_icon_get()); + return sizeof(uint16_t); + } + #if (GAP_ATT_CFG & 0x40/*PCP_EN*/) + else if (req == GAPC_DEV_SLV_PREF_PARAMS) + { + struct gapc_conn_param *slv_pref = (struct gapc_conn_param *)info; + // Peripheral Preferred Connection Parameters + slv_pref->intv_min = SLV_PREF_INTV_MIN; + slv_pref->intv_max = SLV_PREF_INTV_MAX; + slv_pref->latency = SLV_PREF_LATENCY; + slv_pref->time_out = SLV_PREF_TIME_OUT; + return sizeof(struct gapc_conn_param); + } + #endif + + return 0; +} + +/** + **************************************************************************************** + * @brief Create profiles, maybe User Override! (__weak func) + * Added in order and judged status in each profile-func. + **************************************************************************************** + */ +__weak void app_prf_create(void) +{ + // Generic Access Profile(0x1800) + gap_svc_init(GAP_START_HDL, GAP_ATT_CFG); +} + + +/** + **************************************************************************************** + * @section App Interface + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief API to Init Application, maybe User Override! (__weak func) + * + * @param[in] rsn reset reason @see enum rst_src_bfs + **************************************************************************************** + */ +__weak void app_init(uint16_t rsn) +{ + // Init BLE and App to startup or Resume BLE to continue if it wakeup from poweroff. + #if (BLE_LITELIB) + if (RSN_IS_BLE_WKUP(rsn)) + { + // Resume BLE (Only supported in LiteLib) + ble_resume(); + } + else + #endif //(BLE_LITELIB) + { + heap_cfg_t heap; + + // Config Heap, resized with special lib + heap.base[MEM_ENV] = BLE_HEAP_BASE; + heap.size[MEM_ENV] = BLE_HEAP_ENV_SIZE; + heap.base[MEM_MSG] = BLE_HEAP_BASE + BLE_HEAP_ENV_SIZE; + heap.size[MEM_MSG] = BLE_HEAP_MSG_SIZE; + ble_heap(&heap); + + // Init BLE and App + ble_init(); + ble_app(); + } + + // Init RF & Modem + rfmdm_init(); + + NVIC_EnableIRQ(BLE_IRQn); +} + +/** + **************************************************************************************** + * @brief API to Set State of Application, maybe User Override! (__weak func) + * + * @param[in] state new state + **************************************************************************************** + */ +__weak void app_state_set(uint8_t state) +{ + DEBUG("State(old:%d,new:%d)", app_state_get(), state); + + app_env.state = state; + + // Indication, User add more... + +} + +/** + **************************************************************************************** + * @brief API to Get Device Name, maybe User Override! (__weak func) + * + * @param[in] size Length of name Buffer + * @param[out] name Pointer of name buffer + * + * @return Length of device name + **************************************************************************************** + */ +__weak uint8_t app_name_get(uint8_t size, uint8_t *name) +{ + uint8_t len = sizeof(BLE_DEV_NAME) - 1; + + // eg. prefix(BLE_DEV_NAME) + suffix(Addr[0]) + if (size < len + 2) + { + // no enough buffer, short copy + len = size; + memcpy(name, BLE_DEV_NAME, len); + } + else + { + // prefix + suffix + memcpy(name, BLE_DEV_NAME, len); + name[len++] = co_hex(ble_dev_addr.addr[0] >> 4); + name[len++] = co_hex(ble_dev_addr.addr[0] & 0x0F); + } + + return len; +} + + +/** + **************************************************************************************** + * @section FSM Interface + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Finite state machine for Device Configure, maybe User Override! (__weak func) + * + * @param[in] evt configure event @see enum ble_event + **************************************************************************************** + */ +__weak void app_conf_fsm(uint8_t evt) +{ + if (evt == BLE_RESET) + { + memset(&app_env, 0, sizeof(app_env)); + + // Set device config + gapm_set_dev(&ble_dev_config, &ble_dev_addr, NULL); + } + else /*if (evt == BLE_CONFIGURED)*/ + { + app_state_set(APP_IDLE); + // Create Profiles + app_prf_create(); + + // Create Activities + app_actv_create(); + + ble_2G4_set(SYNC_WORD_L, SYNC_WORD_H); + + init_timer_start(); + } +} + +/** + **************************************************************************************** + * @brief Finite state machine for connection event, maybe User Override! (__weak func) + * + * @param[in] evt connection event @see enum ble_event + * @param[in] conidx connection index + * @param[in] param param of connection event + **************************************************************************************** + */ +__weak void app_conn_fsm(uint8_t evt, uint8_t conidx, const void* param) +{ + switch (evt) + { + case BLE_CONNECTED: + { + // Connected state, record Index + app_env.curidx = conidx; + app_state_set(APP_CONNECTED); + + gapc_connect_rsp(conidx, BLE_AUTH); + +// app_scan_action(ACTV_STOP); +// init_timer_stop(); +// memset((uint8_t *)scan_addr_list, 0x00, (sizeof(struct gap_bdaddr) * SCAN_NUM_MAX)); +// scan_cnt = 0; + } break; + + case BLE_DISCONNECTED: + { + init_timer_start(); + app_scan_action(ACTV_START); + app_state_set(APP_READY); + } break; + + case BLE_BONDED: + { + // todo, eg. save the generated slave's LTK to flash + } break; + + case BLE_ENCRYPTED: + { + // todo + } break; + + default: + break; + } +} + + +/** + **************************************************************************************** + * @section SMP Interface + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief API to Get Pairing Feature, maybe User Override! (__weak func) + * + * @param[out] feat Pointer of pairing buffer to fill + **************************************************************************************** + */ +__weak void app_pairing_get(struct gapc_pairing *feat) +{ + // IO capabilities (@see gap_io_cap) + feat->iocap = GAP_IO_CAP_NO_INPUT_NO_OUTPUT; + // OOB information (@see gap_oob) + feat->oob = GAP_OOB_AUTH_DATA_NOT_PRESENT; + // Authentication (@see gap_auth) + feat->auth = BLE_AUTH; + // Encryption key size (7 to 16) + feat->key_size = GAP_KEY_LEN; + //Initiator key distribution (@see gap_kdist) + feat->ikey_dist = GAP_KDIST_NONE; + //Responder key distribution (@see gap_kdist) + feat->rkey_dist = GAP_KDIST_ENCKEY; + // Device security requirements (@see gap_sec_req) + feat->sec_req = BLE_SECREQ; +} + +/** + **************************************************************************************** + * @brief API to Generate LTK for bonding, maybe User Override! (__weak func) + * + * @param[in] conidx connection index + * @param[in|out] ltk Pointer of ltk buffer + **************************************************************************************** + */ +__weak void app_ltk_gen(uint8_t conidx, struct gapc_ltk *ltk) +{ + // generate key values, User need record it to save later + // ltk->ediv = (uint16_t)rand_word(); + // ltk->key_size = GAP_KEY_LEN; + // ltk->ext_info = 0; + // for (uint8_t i = 0; i < GAP_RAND_NB_LEN; i++) + // { + // ltk->randnb.nb[i] = (uint8_t)rand_word(); + // } + // for (uint8_t i = 0; i < GAP_KEY_LEN; i++) + // { + // ltk->ltk.key[i] = (uint8_t)rand_word(); + // } + + #if (BLE_DBG_LTK) + // (here use debugLTK as testing) + memcpy(ltk, &debugLTK, sizeof(struct gapc_ltk)); + #endif +} + +/** + **************************************************************************************** + * @brief API to Save LTK when bonded, maybe User Override! (__weak func) + * + * @param[in] conidx connection index + * @param[in] ltk Pointer of LTK data + **************************************************************************************** + */ +__weak void app_ltk_save(uint8_t conidx, const struct gapc_ltk *ltk) +{ + // todo, save slave's LTK to flash +} + +/** + **************************************************************************************** + * @brief API to Find LTK when re-encryption, maybe User Override! (__weak func) + * + * @param[in] ediv EDIV value for matching + * @param[in] rand_nb Rand Nb values for matching + * + * @return NULL for not matched, else return Pointer of LTK found. + **************************************************************************************** + */ +__weak const uint8_t *app_ltk_find(uint16_t ediv, const uint8_t *rand_nb) +{ + // Compare ediv and rand_nb (here use debugLTK as testing) + #if (BLE_DBG_LTK) + if ((ediv == debugLTK.ediv) + && (memcmp(rand_nb, debugLTK.randnb.nb, GAP_RAND_NB_LEN) == 0)) + { + return debugLTK.ltk.key; + } + #endif + + // Not found + return NULL; +} diff --git a/projects/bleRemoteControl/Master/src/app.h b/projects/bleRemoteControl/Master/src/app.h new file mode 100644 index 0000000..e4e45d5 --- /dev/null +++ b/projects/bleRemoteControl/Master/src/app.h @@ -0,0 +1,335 @@ +/** + **************************************************************************************** + * + * @file app.h + * + * @brief Header file - Application Defines + * + **************************************************************************************** + */ + +#ifndef _APP_H_ +#define _APP_H_ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include +#include "string.h" +#include "blelib.h" +#include "ke_api.h" +#include "app_actv.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Number of Roles, Local Device act as Slave or Master +#if !defined(BLE_NB_SLAVE) + #define BLE_NB_SLAVE (1) +#endif + +#if !defined(BLE_NB_MASTER) + #define BLE_NB_MASTER (0) +#endif + +#if (BLE_NB_SLAVE + BLE_NB_MASTER > BLE_CONNECTION_MAX) + #error "Number of roles must not exceed BLE_CONNECTION_MAX" +#endif + +/// Single or Multiple Connections +#if (BLE_NB_SLAVE + BLE_NB_MASTER > 1) + #define BLE_MULTI_CONN (1) +#else + #define BLE_MULTI_CONN (0) +#endif + +/// Enable of Activities(adv/scan/init) +#if !defined(BLE_EN_ADV) + #define BLE_EN_ADV (BLE_NB_SLAVE) +#endif + +#if !defined(BLE_EN_SCAN) + #define BLE_EN_SCAN (BLE_NB_MASTER) +#endif + +#if !defined(BLE_EN_INIT) + #define BLE_EN_INIT (BLE_NB_MASTER) +#endif + +/// Enable Pairing and Bond, used debugLTK +#if !defined(BLE_EN_SMP) + #define BLE_EN_SMP (1) +#endif + +#if !defined(BLE_DBG_LTK) + #define BLE_DBG_LTK (0) +#endif + +/// Maximal Transmission Unit +#if !defined(BLE_MTU) + #define BLE_MTU (124) +#endif + +/// Maximal length of the Device Name value +#define DEV_NAME_MAX_LEN (20) + +/// Generic Access Service +#if !defined(BLE_DEV_ICON) + #define BLE_DEV_ICON (0x0000) // Unknow appearance +#endif + +/// Period of RC32K Calibration(0 means only calib once when init) +#if !defined(RC32K_CALIB_PERIOD) && (CFG_SLEEP) + #define RC32K_CALIB_PERIOD (15000) // unit in 1ms +#endif + + +/* + * MACROS + **************************************************************************************** + */ + +/// Macro of Application Handler Functions +#define APP_SUBTASK_HANDLER(sub) int app_##sub##_handler(msg_id_t msgid, const void *param, \ + task_id_t dest_id, task_id_t src_id) + +#define APP_MSG_HANDLER(msg) static void app_##msg##_handler(msg_id_t msgid, struct msg const *param, \ + task_id_t dest_id, task_id_t src_id) + +#define APP_MSG_HANDLER_T(msg) static void app_##msg##_handler(msg_id_t msgid, const void *param, \ + task_id_t dest_id, task_id_t src_id) + +#define APP_MSG_FUNCTION(msg) app_##msg##_handler(msgid, param, dest_id, src_id) + + +/* + * ENUMERATIONS + **************************************************************************************** + */ + +/// APP Task messages +enum app_msg_id +{ + APP_BASE_MSG = MSG_ID(APP, 0), + + /* Add more messages, such as TIMEOUT */ +}; + +/// States of APP task +enum app_state_type +{ + // Init state + APP_INIT, + // Idle state + APP_IDLE, + // Ready State + APP_READY, + // Connected state + APP_CONNECTED, + APP_PAIRING, + APP_BONDED, + APP_ENCRYPTED, + + // Number of defined states. + APP_STATE_MAX +}; + +/// Event of Ble Finite state machine +enum ble_event +{ + // Configure Events + BLE_RESET, + BLE_CONFIGURED, + + // Connection Events + BLE_CONNECTED, + BLE_DISCONNECTED, + BLE_BONDED, + BLE_ENCRYPTED, +}; + + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Application environment structure +struct app_env_tag +{ + // Application State + state_t state; + + // Curr Connection Index + uint8_t curidx; + + #if (BLE_MULTI_CONN) + // Bits of Connection Index(0:Not Connect, 1:Connected) + uint8_t conbits; + // Bits of Connection Roles(0:Master or None, 1:Slave) + uint8_t conrole; + #endif //(BLE_MULTI_CONN) +}; + + +/* + * VARIABLE DECLARATION + **************************************************************************************** + */ + +/// Application environment +extern struct app_env_tag app_env; + +/// Ble local address (user customize) +extern bd_addr_t ble_dev_addr; + +/// GAP device configuration +extern const struct gapm_dev_config ble_dev_config; + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief API to Init Application, maybe User Override! (__weak func) + * + * @param[in] rsn reset reason @see enum rst_src_bfs + **************************************************************************************** + */ +void app_init(uint16_t rsn); + +/** + **************************************************************************************** + * @brief API to Create Profiles, maybe User Override! (__weak func) + * Added in order and judged status in each profile-func. + **************************************************************************************** + */ +void app_prf_create(void); + +/** + **************************************************************************************** + * @brief Finite state machine for Device Configure, maybe User Override! (__weak func) + * + * @param[in] evt configure event @see enum ble_event + **************************************************************************************** + */ +void app_conf_fsm(uint8_t evt); + +/** + **************************************************************************************** + * @brief Finite state machine for connection event, maybe User Override! (__weak func) + * + * @param[in] evt connection event @see enum ble_event + * @param[in] conidx connection index + * @param[in] param param of connection event + **************************************************************************************** + */ +void app_conn_fsm(uint8_t evt, uint8_t conidx, const void*param); + +/** + **************************************************************************************** + * @brief API to Set State of Application, maybe User Override! (__weak func) + * + * @param[in] state new state + **************************************************************************************** + */ +void app_state_set(uint8_t state); + +/** + **************************************************************************************** + * @brief Macro API to Get Application State + * + * @return state type - 1 octets + **************************************************************************************** + */ +static __inline state_t app_state_get(void) +{ + return app_env.state; +} + +/** + **************************************************************************************** + * @brief Macro API to Get Device Appearance + * + * @return icon type - 2 octets + **************************************************************************************** + */ +static __inline uint16_t app_icon_get(void) +{ + return BLE_DEV_ICON; +} + +/** + **************************************************************************************** + * @brief API to Get Device Name, maybe User Override! (__weak func) + * + * @param[in] size Length of name Buffer + * @param[out] name Pointer of name buffer + * + * @return Length of device name + **************************************************************************************** + */ +uint8_t app_name_get(uint8_t size, uint8_t *name); + +/** + **************************************************************************************** + * @brief API to Get Pairing Feature, maybe User Override! (__weak func) + * + * @param[out] feat Pointer of pairing buffer to fill + **************************************************************************************** + */ +void app_pairing_get(struct gapc_pairing *feat); + +/** + **************************************************************************************** + * @brief API to Generate LTK for bonding, maybe User Override! (__weak func) + * + * @param[in] conidx connection index + * @param[out] ltk Pointer of LTK buffer to fill + **************************************************************************************** + */ +void app_ltk_gen(uint8_t conidx, struct gapc_ltk *ltk); + +/** + **************************************************************************************** + * @brief API to Save LTK when bonded, maybe User Override! (__weak func) + * + * @param[in] conidx connection index + * @param[in] ltk Pointer of LTK data + **************************************************************************************** + */ +void app_ltk_save(uint8_t conidx, const struct gapc_ltk *ltk); + +/** + **************************************************************************************** + * @brief API to Find LTK when re-encryption, maybe User Override! (__weak func) + * + * @param[in] ediv EDIV value for matching + * @param[in] rand_nb Rand Nb values for matching + * + * @return NULL for not matched, else return Pointer of LTK found. + **************************************************************************************** + */ +const uint8_t *app_ltk_find(uint16_t ediv, const uint8_t *rand_nb); + +/** + **************************************************************************************** + * @brief Dispatch TASK_APP message to sub-handler. + * + * @param[in] msgid Id of the message received. + * @param[in] task_idx Index of the receiving task instance. + * + * @return Handler of the message or NULL. + **************************************************************************************** + */ +void* app_task_dispatch(msg_id_t msgid, uint8_t task_idx); + +#endif // _APP_H_ diff --git a/projects/bleRemoteControl/Master/src/app_actv.c b/projects/bleRemoteControl/Master/src/app_actv.c new file mode 100644 index 0000000..85c5375 --- /dev/null +++ b/projects/bleRemoteControl/Master/src/app_actv.c @@ -0,0 +1,942 @@ +/** + **************************************************************************************** + * + * @file app_actv.c + * + * @brief Application Activity(Advertising, Scanning and Initiating) - Example + * + * < If want to modify it, recommend to copy the file to 'user porject'/src > + **************************************************************************************** + */ +#include "drvs.h" +#include "app.h" +#include "gapm_api.h" +#include "app_user.h" +#include "bledef.h" + +#if (DBG_ACTV) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Index & State of activities - User Customize +struct actv_env_tag +{ + #if (BLE_EN_ADV) + /// Advertising index and state + uint8_t advidx; + uint8_t advsta; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + /// Scanning index and state + uint8_t scanidx; + uint8_t scansta; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + /// Initiating index and state + uint8_t initidx; + uint8_t initsta; + #endif //(BLE_EN_INIT) +}; + +/// Activities environment +struct actv_env_tag actv_env; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @section Advertising Activity - Example for User Customize + * enable via pre-define @see BLE_EN_ADV + **************************************************************************************** + */ +#if (BLE_EN_ADV) + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// Advertising duration - 0 mean Always ON (in multiple of 10ms) +#if !defined(APP_ADV_DURATION) + #define APP_ADV_DURATION (0) +#endif + +/// Advertising channel map - 37, 38, 39 +#if !defined(APP_ADV_CHMAP) + #define APP_ADV_CHMAP (0x07) +#endif + +/// Advertising minimum interval - (n)*0.625ms +#if !defined(APP_ADV_INT_MIN) + #define APP_ADV_INT_MIN (64) +#endif + +/// Advertising maximum interval - (n)*0.625ms +#if !defined(APP_ADV_INT_MAX) + #define APP_ADV_INT_MAX (160) +#endif + +#if (APP_ADV_INT_MIN > APP_ADV_INT_MAX) + #error "ADV_INT_MIN must not exceed ADV_INT_MAX" +#endif + +/// Fast advertising interval +#define APP_ADV_FAST_INT (32) + +/// Flag of Fixed data +//#define APP_ADV_FIXED_DATA (0) + +#if (APP_ADV_FIXED_DATA) +/** + * ADV Unit: 1B(Len=1+n) 1B(Type) nB(Data), @see gap_ad_type + * -------------------------------------------------------------------------------------- + * x03 - Length + * x03 - Service 16-bit UUIDs List type + * x00\xFF - Custom Serial Profile:0xFF00 + * x03 - Length + * x19 - Appearance type + * x00\x00 - Unknow Device + * x09 - Length + * x09 - Complete Name type + * myBle5.2 - Device Name + * -------------------------------------------------------------------------------------- + */ +#define APP_ADV_DATA "\x03\x03\x00\xFF\x03\x19\x00\x00\x09\x09myBle5.2" +#define APP_ADV_DATA_LEN (sizeof(APP_ADV_DATA)-1) + +/** + * Scan response data (ADV Unit), @see gap_ad_type + * -------------------------------------------------------------------------------------- + * x09 - Length + * xFF - Vendor specific advertising type + * xC5\x09\x48\x59\x2D\x42\x4C\x45 - CompId(0x09C5) + Serial(BLE) + * x09 - Length + * x09 - Complete Name type + * myBle5.2 - Device Name + * -------------------------------------------------------------------------------------- + */ +#define APP_SCNRSP_DATA "\x09\xFF\xC5\x09\x48\x59\x2D\x42\x4C\x45" +#define APP_SCNRSP_DATA_LEN (sizeof(APP_SCNRSP_DATA)-1) +#endif // (APP_ADV_FIXED_DATA) + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +static void app_adv_create(void) +{ + struct gapm_adv_create_param adv_param; + + // Advertising type (@see enum gapm_adv_type) + adv_param.type = GAPM_ADV_TYPE_LEGACY; + // Discovery mode (@see enum gapm_adv_disc_mode) + adv_param.disc_mode = GAPM_ADV_MODE_GEN_DISC; + // Advertising properties (@see enum gapm_adv_prop) + #if (DBG_GAPM) + adv_param.prop = GAPM_ADV_PROP_UNDIR_CONN_MASK/* | GAPM_ADV_PROP_SCAN_REQ_NTF_EN_BIT*/; + #else + adv_param.prop = GAPM_ADV_PROP_UNDIR_CONN_MASK; + #endif + // Filtering policy (@see enum gapm_adv_filter_policy) + adv_param.filter_pol = GAPM_ADV_ALLOW_SCAN_ANY_CON_ANY; + // Config primary advertising (@see gapm_adv_prim_cfg) + adv_param.prim_cfg.phy = GAP_PHY_LE_1MBPS; + adv_param.prim_cfg.chnl_map = APP_ADV_CHMAP; + adv_param.prim_cfg.adv_intv_min = APP_ADV_INT_MIN; + adv_param.prim_cfg.adv_intv_max = APP_ADV_INT_MAX; + + DEBUG("create(disc:%d,prop:%d)\r\n", adv_param.disc_mode, adv_param.prop); + + gapm_create_advertising(GAPM_STATIC_ADDR, &adv_param); +} + +static void app_adv_set_adv_data(void) +{ +#if (APP_ADV_FIXED_DATA) + gapm_set_adv_data(actv_env.advidx, GAPM_SET_ADV_DATA, + APP_ADV_DATA_LEN, (const uint8_t *)APP_ADV_DATA); +#else + // Reserve 3Bytes for AD_TYPE_FLAGS + uint8_t adv_data[GAP_ADV_DATA_LEN]; + uint8_t length = 11; + + // Set flags: 3B + adv_data[0] = 0x02; + adv_data[1] = GAP_AD_TYPE_FLAGS; // 0x01 0xFF;// + adv_data[2] = 0x06; + + // Set list of UUIDs: 4B + adv_data[3] = 0x03; + adv_data[4] = GAP_AD_TYPE_COMPLETE_LIST_16_BIT_UUID; // 0x03 + #if (PRF_HIDS) + write16p(&adv_data[5], 0x1812); // HID Service + #else + write16p(&adv_data[5], 0xFF00); // Serial Service + #endif + + // Set appearance: 4B + uint16_t icon = app_icon_get(); + adv_data[7] = 0x03; + adv_data[8] = GAP_AD_TYPE_APPEARANCE; // 0x19 + write16p(&adv_data[9], icon); + + gapm_set_adv_data(actv_env.advidx, GAPM_SET_ADV_DATA, length, adv_data); +#endif +} + +static void app_adv_set_scan_rsp(void) +{ +#if (APP_ADV_FIXED_DATA) + gapm_set_adv_data(actv_env.advidx, GAPM_SET_SCAN_RSP_DATA, + APP_SCNRSP_DATA_LEN, (const uint8_t *)APP_SCNRSP_DATA); +#else + uint8_t length; + uint8_t rsp_data[DEV_NAME_MAX_LEN+2]; + + // Set device name + length = app_name_get(DEV_NAME_MAX_LEN, &rsp_data[2]); + rsp_data[0] = length + 1; + rsp_data[1] = GAP_AD_TYPE_COMPLETE_NAME; // 0x09 + + gapm_set_adv_data(actv_env.advidx, GAPM_SET_SCAN_RSP_DATA, length + 2, rsp_data); +#endif +} + +/** + **************************************************************************************** + * @brief Action/Command of Advertising + * + * @param[in] actv_op Operation of activity + **************************************************************************************** + */ +void app_adv_action(uint8_t actv_op) +{ + switch (actv_op) + { + case ACTV_CREATE: + { + if (actv_env.advsta == ACTV_STATE_OFF) + { + //DEBUG("Creating"); + app_adv_create(); + actv_env.advsta = ACTV_STATE_CREATE; + } + } break; + + case ACTV_START: + { + if (actv_env.advsta == ACTV_STATE_READY) + { + DEBUG("Starting"); + gapm_start_advertising(actv_env.advidx, APP_ADV_DURATION); + actv_env.advsta = ACTV_STATE_START; + } + } break; + + case ACTV_STOP: + { + if (actv_env.advsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_STOP; + } + } break; + + case ACTV_DELETE: + { + if ((actv_env.advsta != ACTV_STATE_OFF) && (actv_env.advsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_OFF; + } + } break; + + case ACTV_RELOAD: + { + if (actv_env.advsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_STOP; + } + + if ((actv_env.advsta != ACTV_STATE_OFF) && (actv_env.advsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_OFF; + } + + app_adv_create(); + actv_env.advsta = ACTV_STATE_CREATE; + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Event Procedure of Advertising + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_adv_event(uint8_t gapm_op, uint8_t status) +{ + DEBUG("Evt(op:0x%X,sta:0x%X)", gapm_op, status); + + switch (gapm_op) + { + case (GAPM_CREATE_ADV_ACTIVITY): + { + app_adv_set_adv_data(); + } break; + + case (GAPM_SET_ADV_DATA): + { + app_adv_set_scan_rsp(); + } break; + + case (GAPM_SET_SCAN_RSP_DATA): + { + actv_env.advsta = ACTV_STATE_READY; + + app_adv_action(ACTV_START); + app_state_set(APP_READY); + } break; + + case (GAPM_STOP_ACTIVITY): + { + if ((actv_env.advsta == ACTV_STATE_START) || (actv_env.advsta == ACTV_STATE_STOP)) + { + actv_env.advsta = ACTV_STATE_READY; + } + } break; + + default: + break; + } +} + +#endif //(BLE_EN_ADV) + + +/** + **************************************************************************************** + * @section Scanning Activity - Example for User Customize + * enable via pre-define @see BLE_EN_SCAN + **************************************************************************************** + */ +#if (BLE_EN_SCAN) + +/* + * DEFINITIONS + **************************************************************************************** + */ + +uint8_t scan_cnt = 0; +struct gap_bdaddr scan_addr_list[SCAN_NUM_MAX]; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +static void app_start_scanning(void) +{ + struct gapm_scan_param scan_param; + + /// Type of scanning to be started (@see enum gapm_scan_type) + scan_param.type = GAPM_SCAN_TYPE_CONN_DISC; + /// Properties for the scan procedure (@see enum gapm_scan_prop) + scan_param.prop = GAPM_SCAN_PROP_PHY_1M_BIT | GAPM_SCAN_PROP_ACTIVE_1M_BIT | GAPM_SCAN_PROP_FILT_TRUNC_BIT; + /// Duplicate packet filtering policy (@see enum gapm_dup_filter_pol) + scan_param.dup_filt_pol = GAPM_DUP_FILT_EN; + /// Scan window opening parameters for LE 1M PHY (in unit of 625us) + scan_param.scan_param_1m.scan_intv = 4;//GAP_SCAN_FAST_INTV; + scan_param.scan_param_1m.scan_wd = 4;//GAP_SCAN_FAST_WIND; + /// Scan window opening parameters for LE Coded PHY + //scan_param.scan_param_coded.scan_intv = GAP_SCAN_SLOW_INTV1; + //scan_param.scan_param_coded.scan_wd = GAP_SCAN_SLOW_WIND1; + /// Scan duration (in unit of 10ms). 0 means that the controller will scan continuously until + /// reception of a stop command from the application + scan_param.duration = 0;//GAP_TMR_GEN_DISC_SCAN; + /// Scan period (in unit of 1.28s). Time interval betweem two consequent starts of a scan duration + /// by the controller. 0 means that the scan procedure is not periodic + scan_param.period = 0; + + gapm_start_activity(actv_env.scanidx, sizeof(struct gapm_scan_param), &scan_param); +} + +/** + **************************************************************************************** + * @brief Action/Command of Scanning + * + * @param[in] actv_op Operation of activity + **************************************************************************************** + */ +void app_scan_action(uint8_t actv_op) +{ + switch (actv_op) + { + case ACTV_CREATE: + { + if (actv_env.scansta == ACTV_STATE_OFF) + { + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_SCAN, GAPM_STATIC_ADDR); + actv_env.scansta = ACTV_STATE_CREATE; + } + } break; + + case ACTV_START: + { + scan_cnt = 0; + + if (actv_env.scansta == ACTV_STATE_READY) + { + DEBUG("Starting"); + app_start_scanning(); + actv_env.scansta = ACTV_STATE_START; + } + } break; + + case ACTV_STOP: + { + if (actv_env.scansta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_STOP; + } + } break; + + case ACTV_DELETE: + { + if ((actv_env.scansta != ACTV_STATE_OFF) && (actv_env.scansta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_OFF; + } + } break; + + case ACTV_RELOAD: + { + if (actv_env.scansta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_STOP; + } + + if ((actv_env.scansta != ACTV_STATE_OFF) && (actv_env.scansta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_OFF; + } + + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_SCAN, GAPM_STATIC_ADDR); + actv_env.scansta = ACTV_STATE_CREATE; + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Event Procedure of Scanning + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_scan_event(uint8_t gapm_op, uint8_t status) +{ + DEBUG("Evt(op:0x%X,sta:0x%X)", gapm_op, status); + + switch (gapm_op) + { + case GAPM_CREATE_SCAN_ACTIVITY: + { + actv_env.scansta = ACTV_STATE_READY; + + if (status == GAP_ERR_NO_ERROR) + { + DEBUG("Scan start..."); + app_scan_action(ACTV_START); + } + } break; + + case GAPM_STOP_ACTIVITY: + { + if ((actv_env.scansta == ACTV_STATE_START) || (actv_env.scansta == ACTV_STATE_STOP)) + { + actv_env.scansta = ACTV_STATE_READY; + } + + DEBUG("-->Filter DevAddr:%d, sta:%d", scan_cnt, app_state_get()); + +// if (app_state_get() < APP_CONNECTED) +// { +// init_timer_start(); +// app_scan_action(ACTV_START); +// } +// +// for (uint8_t idx = 0; idx < scan_cnt; idx++) +// { +// DEBUG("Scan List[%d]-->", idx); +// debugHex((uint8_t *)(&scan_addr_list[idx]), sizeof(struct gap_bdaddr)); +// } + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Store result of Scanning when filter by app_actv_report_ind + * + * @param[in] paddr gap_bdaddr of peer device + **************************************************************************************** + */ +void app_scan_result(const struct gap_bdaddr* paddr) +{ + for (uint8_t i = 0; i < scan_cnt; i++) + { + if (!memcmp(&scan_addr_list[i], paddr,sizeof(struct gap_bdaddr)))//save addr but diffrent + { + return; + } + } + + if (scan_cnt < SCAN_NUM_MAX) //get null array + { + memcpy(&scan_addr_list[scan_cnt], paddr,sizeof(struct gap_bdaddr)); + scan_cnt++; + DEBUG("FIND_NEW----------------"); + } +} + +/** + **************************************************************************************** + * @brief Handles activity report. (@see GAPM_EXT_ADV_REPORT_IND) + * + * @param[in] report Report of Advertising data be scanned + **************************************************************************************** + */ +void app_actv_report_ind(struct gapm_ext_adv_report_ind const* report) +{ +// uint16_t icon; + + // filter report + if ((report->info & GAPM_REPORT_INFO_REPORT_TYPE_MASK) == GAPM_REPORT_TYPE_ADV_LEG) + { + const uint8_t *p_cursor = report->data; + const uint8_t *p_end_cusor = report->data + report->length; + + while (p_cursor < p_end_cusor) + { + // Extract AD type + uint8_t ad_type = *(p_cursor + 1); + +// if (ad_type == GAP_AD_TYPE_APPEARANCE) +// { +// icon = read16p(p_cursor+2); +// +//// // Filter special appearance device +//// if ((icon > GAP_APPEARANCE_GENERIC_HID) && (icon < GAP_APPEARANCE_HID_BARCODE_SCANNER)) +//// { +//// app_scan_result(&report->trans_addr); +//// break; +//// } +// } + + if (/*(icon == GAP_APPEARANCE_HID_KEYBOARD) && */(ad_type == GAP_AD_TYPE_SHORTENED_NAME) && (*p_cursor == 6) && (0 == memcmp(p_cursor+2, "MI RC", 5))) + { + DEBUG("---Find:%d", report->length); + debugHex(report->data, report->length); + app_scan_result(&report->trans_addr); + break; + } + + /* Go to next advertising info */ + p_cursor += (*p_cursor + 1); + } + } +} +#endif //(BLE_EN_SCAN) + + +/** + **************************************************************************************** + * @section Initiating Activity - Example for User Customize + * enable via pre-define @see BLE_EN_INIT + **************************************************************************************** + */ +#if (BLE_EN_INIT) + +/* + * DEFINITIONS + **************************************************************************************** + */ + +//const struct gap_bdaddr dflt_peer = +//{ +// .addr = {{0x00, 0x31, 0x08, 0x23, 0x20, 0xD2}}, +// .addr_type = ADDR_RAND, +//}; + +const struct gapm_conn_param dflt_conn_param = +{ + /// Minimum value for the connection interval (in unit of 1.25ms). Allowed range is 7.5ms to 4s. + .conn_intv_min = 16,//10,//6, + /// Maximum value for the connection interval (in unit of 1.25ms). Allowed range is 7.5ms to 4s. + .conn_intv_max = 16,//10,//6, + /// Slave latency. Number of events that can be missed by a connected slave device + .conn_latency = 49, + /// Link supervision timeout (in unit of 10ms). Allowed range is 100ms to 32s + .supervision_to = 300, + /// Recommended minimum duration of connection events (in unit of 625us) + .ce_len_min = 4, + /// Recommended maximum duration of connection events (in unit of 625us) + .ce_len_max = 6, +}; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Start initiating to peer device + * + * @param[in] paddr gap_bdaddr of peer device + **************************************************************************************** + */ +void app_start_initiating(const struct gap_bdaddr* paddr) +{ + if ((actv_env.initsta == ACTV_STATE_READY) || (actv_env.initsta == ACTV_STATE_STOP)) + { + struct gapm_init_param init_param; + +// if (paddr == NULL) +// { +// paddr = &dflt_peer; +// } + + init_param.type = GAPM_INIT_TYPE_DIRECT_CONN_EST; + init_param.prop = GAPM_INIT_PROP_1M_BIT; + init_param.scan_param_1m.scan_intv = GAP_SCAN_FAST_INTV; + init_param.scan_param_1m.scan_wd = GAP_SCAN_FAST_WIND; + + init_param.conn_param_1m = dflt_conn_param; + init_param.peer_addr = *paddr; + // timeout unit in 10ms, update from v1.3 + init_param.conn_to = 300; + + gapm_start_activity(actv_env.initidx, sizeof(struct gapm_init_param), &init_param); + DEBUG("Init Starting"); + actv_env.initsta = ACTV_STATE_START; + + ble_latency_applied(false); + } +} + +/** + **************************************************************************************** + * @brief Action/Command of Initiating + * + * @param[in] actv_op Operation of activity + **************************************************************************************** + */ +void app_init_action(uint8_t actv_op) +{ + switch (actv_op) + { + case ACTV_CREATE: + { + if (actv_env.initsta == ACTV_STATE_OFF) + { + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_INIT, GAPM_STATIC_ADDR); + actv_env.initsta = ACTV_STATE_CREATE; + } + } break; + + case ACTV_START: + { + app_start_initiating(NULL); + } break; + + case ACTV_STOP: + { + if (actv_env.initsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_STOP; + } + } break; + + case ACTV_DELETE: + { + if ((actv_env.initsta != ACTV_STATE_OFF) && (actv_env.initsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_OFF; + } + } break; + + case ACTV_RELOAD: + { + if (actv_env.initsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_STOP; + } + + if ((actv_env.initsta != ACTV_STATE_OFF) && (actv_env.initsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_OFF; + } + + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_INIT, GAPM_STATIC_ADDR); + actv_env.initsta = ACTV_STATE_CREATE; + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Event Procedure of Initiating + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_init_event(uint8_t gapm_op, uint8_t status) +{ + DEBUG("Evt(op:0x%X,sta:0x%X)", gapm_op, status); + + switch (gapm_op) + { + case GAPM_CREATE_INIT_ACTIVITY: + { + actv_env.initsta = ACTV_STATE_READY; + } break; + + case GAPM_STOP_ACTIVITY: + { + if ((actv_env.initsta == ACTV_STATE_START) || (actv_env.initsta == ACTV_STATE_STOP)) + { + actv_env.initsta = ACTV_STATE_READY; + } + + if (status == GAP_ERR_TIMEOUT) + { + scan_cnt = 0; + } + } break; + + default: + break; + } +} + +#endif //(BLE_EN_INIT) + + +/** + **************************************************************************************** + * @brief Create activities when Initialization complete. + **************************************************************************************** + */ +void app_actv_create(void) +{ + memset(&actv_env, 0, sizeof(actv_env)); + #if (BLE_EN_ADV) + app_adv_action(ACTV_CREATE); + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + app_scan_action(ACTV_CREATE); + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + app_init_action(ACTV_CREATE); + #endif //(BLE_EN_INIT) +} + +/** + **************************************************************************************** + * @brief Handles activity command complete event. + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_actv_cmp_evt(uint8_t operation, uint8_t status) +{ + switch (operation) + { + #if (BLE_EN_ADV) + case (GAPM_CREATE_ADV_ACTIVITY): + case (GAPM_SET_ADV_DATA): + case (GAPM_SET_SCAN_RSP_DATA): + { + app_adv_event(operation, status); + } break; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + case GAPM_CREATE_SCAN_ACTIVITY: + { + app_scan_event(operation, status); + } break; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + case GAPM_CREATE_INIT_ACTIVITY: + { + app_init_event(operation, status); + } break; + #endif //(BLE_EN_INIT) + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Handles activity created. (@see GAPM_ACTIVITY_CREATED_IND) + * + * @param[in] actv_type Type of activities(@see enum gapm_actv_type) + * @param[in] actv_idx Index of activities created + **************************************************************************************** + */ +void app_actv_created_ind(uint8_t actv_type, uint8_t actv_idx) +{ + switch (actv_type) + { + #if (BLE_EN_ADV) + case GAPM_ACTV_TYPE_ADV: + { + actv_env.advidx = actv_idx; + } break; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + case GAPM_ACTV_TYPE_SCAN: + { + actv_env.scanidx = actv_idx; + } break; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + case GAPM_ACTV_TYPE_INIT: + { + actv_env.initidx = actv_idx; + } break; + #endif //(BLE_EN_INIT) + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Handles activity stopped. (@see GAPM_ACTIVITY_STOPPED_IND) + * + * @param[in] actv_type Type of activity(@see enum gapm_actv_type) + * @param[in] reason Reason of stopped + **************************************************************************************** + */ +void app_actv_stopped_ind(uint8_t actv_type, uint8_t actv_idx, uint8_t reason) +{ + switch (actv_type) + { + #if (BLE_EN_ADV) + case GAPM_ACTV_TYPE_ADV: + { + // Advertising Stopped by slave connection or duration timeout + app_adv_event(GAPM_STOP_ACTIVITY, reason); + + if (app_state_get() == APP_READY) + { + // Duration timeout, go IDLE + app_state_set(APP_IDLE); + } + #if (BLE_MULTI_CONN) + else if (app_state_get() == APP_CONNECTED) + { + if (ONE_BITS(app_env.conrole) < BLE_NB_SLAVE) + { + // Restart Advertising for more connections + app_adv_action(ACTV_START); + } + } + #endif //(BLE_MULTI_CONN) + } break; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + case GAPM_ACTV_TYPE_SCAN: + { + app_scan_event(GAPM_STOP_ACTIVITY, reason); + } break; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + case GAPM_ACTV_TYPE_INIT: + { + app_init_event(GAPM_STOP_ACTIVITY, reason); + } break; + #endif //(BLE_EN_INIT) + + default: + break; + } +} diff --git a/projects/bleRemoteControl/Master/src/app_gapc.c b/projects/bleRemoteControl/Master/src/app_gapc.c new file mode 100644 index 0000000..94128dc --- /dev/null +++ b/projects/bleRemoteControl/Master/src/app_gapc.c @@ -0,0 +1,391 @@ +/** + **************************************************************************************** + * + * @file app_gapc.c + * + * @brief App SubTask of GAP Controller Message - Example + * + * < If want to modify it, recommend to copy the file to 'user porject'/src > + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "drvs.h" + +#include "bledef.h" +#include "app.h" +#include "app_user.h" + +#if (DBG_GAPC) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat,len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +/* + * MESSAGE HANDLERS + **************************************************************************************** + */ + +APP_MSG_HANDLER(gapc_cmp_evt) +{ + // Command complete, may ignore + DEBUG("CMP_EVT(op:%d,sta:0x%x)", param->operation, param->status); +} + +APP_MSG_HANDLER(gapc_connection_req_ind) +{ + #if (DBG_GAPC) + uint8_t conidx = TASK_IDX(src_id); + #endif + + DEBUG("gapc_connection_req_ind(cid:%d,chdl:%d,conn[intv:%d,late:%d,to:%d],acc:%d,caddr:%d)", conidx, param->conhdl, + param->con_interval, param->con_latency, param->sup_to, param->clk_accuracy, param->peer_addr_type); + debugHex(param->peer_addr.addr, GAP_BD_ADDR_LEN); + + // Indicate Connect_Req_Pkt be send, need wait to sync (try 6 times of conn_event). + // If synced, goto gapc_connection_ind. Otherwise, goto gapc_disconnect_ind(reason=0x3E) + //app_conn_fsm(BLE_CONNECTING, conidx, param); + +//GPIO_DAT_CLR(GPIO14); + app_scan_action(ACTV_STOP); + init_timer_stop(); + memset((uint8_t *)scan_addr_list, 0x00, (sizeof(struct gap_bdaddr) * SCAN_NUM_MAX)); + scan_cnt = 0; +//GPIO_DAT_SET(GPIO14); +} + +APP_MSG_HANDLER(gapc_connection_ind) +{ + uint8_t conidx = TASK_IDX(src_id); + + DEBUG("gapc_connection_ind(cid:%d,chdl:%d,role:%d)", conidx, param->conhdl, param->role); + + // Connection established, update from v1.3 + app_conn_fsm(BLE_CONNECTED, conidx, param); +} + +APP_MSG_HANDLER(gapc_disconnect_ind) +{ + uint8_t conidx = TASK_IDX(src_id); + + DEBUG("gapc_disconnect_ind(cid:%d,hdl:%d,reason:0x%X)", conidx, param->conhdl, param->reason); + + app_conn_fsm(BLE_DISCONNECTED, conidx, param); +} + +APP_MSG_HANDLER(gapc_param_update_req_ind) +{ + uint8_t conidx = TASK_IDX(src_id); + + DEBUG("param_update(cid:%d,invM:%d,invI:%d,late:%d,timo:%d)", conidx, + param->intv_max, param->intv_min, param->latency, param->time_out); + + // Connection param accept or reject + gapc_param_update_rsp(conidx, true, 0x2, 0x4); +} + +APP_MSG_HANDLER(gapc_param_updated_ind) +{ + DEBUG("param_updated_ind(cid:%d,intv:%d,late:%d,timo:%d)", TASK_IDX(src_id), + param->con_interval, param->con_latency, param->sup_to); + + // Current param, may update to slaves + +} + +APP_MSG_HANDLER(gapc_le_pkt_size_ind) +{ + DEBUG("le_pkt_size_ind(cid:%d,txB:%d,txT:%d,rxB:%d,rxT:%d)", TASK_IDX(src_id), + param->max_tx_octets, param->max_tx_time, param->max_rx_octets, param->max_rx_time); +} + +#if (BLE_EN_SMP) +APP_MSG_HANDLER(gapc_bond_req_ind) +{ + uint8_t conidx = TASK_IDX(src_id); + + DEBUG("bond_req_ind(req:%d)", param->request); + + switch (param->request) + { + case (GAPC_PAIRING_REQ): + { + struct gapc_pairing feat; + + // Retrieve pairing feature to response + app_pairing_get(&feat); + gapc_smp_pairing_rsp(conidx, &feat); + + DEBUG("PAIRING_REQ(auth:0x%X)", param->data.auth_req); + debugHex((uint8_t *)&feat, sizeof(struct gapc_pairing)); + } break; + + case (GAPC_LTK_EXCH): + { + struct gapc_ltk ltk; + + // Generate all rand values to exchange + app_ltk_gen(conidx, <k); + gapc_smp_pairing_ltk_exch(conidx, <k); + + DEBUG("LTK_EXCH(size:%d)", param->data.key_size); + debugHex((uint8_t *)<k, sizeof(struct gapc_ltk)); + } break; + + case (GAPC_IRK_EXCH): + { + DEBUG("IRK_EXCH"); + + // Load IRK + //memcpy(&(data.irk.irk), gapm_get_irk(), GAP_KEY_LEN); + + // load device address + //memcpy(&(data.irk.addr.addr), gapm_get_bdaddr(), GAP_BD_ADDR_LEN); + //data.irk.addr.addr_type = (data.irk.addr.addr.addr[5] & 0xC0) ? ADDR_RAND : ADDR_PUBLIC; + } break; + + case (GAPC_TK_EXCH): + { + DEBUG("TK_EXCH(type:%d)", param->data.tk_type); + + if (param->data.tk_type == GAP_TK_OOB) + { + DEBUG("TK_OOB>>>"); + return; + } + else if (param->data.tk_type == GAP_TK_DISPLAY) + { + struct gap_sec_key tk; + // Generate a PIN Code- (Between 100000 and 999999) + uint32_t pin_code = (100000 + (rand_word() % 900000)); + // Set the TK value + memset(&tk.key, 0, GAP_KEY_LEN); + write32p(&tk.key, pin_code); + + DEBUG("TK_DISPLAY:%06d", pin_code); + gapc_smp_pairing_tk_exch(conidx, true, &tk); + } + else //if (param->data.tk_type == GAP_TK_KEY_ENTRY) + { + DEBUG("TK_KEY_ENTRY>>>"); + return; + } + } break; + + case (GAPC_CSRK_EXCH): + { + struct gap_sec_key csrk; + DEBUG("CSRK_EXCH"); + memset(&csrk.key, 0, GAP_KEY_LEN); + gapc_smp_pairing_csrk_exch(conidx, &csrk); + } break; + + #if (SEC_CON_ENB) + case (GAPC_OOB_EXCH): + { + DEBUG("OOB_EXCH(conf,rand)>>>"); + debugHex(param->data.oob_data.conf, GAP_KEY_LEN); + debugHex(param->data.oob_data.rand, GAP_KEY_LEN); + + return; + } //break; + + case (GAPC_NC_EXCH): + { + DEBUG("NC_EXCH(%06d)", read32p(param->data.nc_data.value)); + gapc_smp_pairing_nc_exch(conidx, true); + } break; + #endif //(SEC_CON_ENB) + + default: + { + // not happen + } break; + } +} + +APP_MSG_HANDLER(gapc_bond_ind) +{ + uint8_t conidx = TASK_IDX(src_id); + DEBUG("bond_ind(info:%d)", param->info); + + switch (param->info) + { + case (GAPC_PAIRING_SUCCEED): + { + DEBUG("PAIRING_SUCCEED(auth:%X,ltk:%d)", param->data.auth.info, param->data.auth.ltk_present); + // Update the bonding status + app_conn_fsm(BLE_BONDED, conidx, param); + } break; + + case (GAPC_PAIRING_FAILED): + { + DEBUG("PAIRING_FAILED(reason:0x%X)", param->data.reason); + //gapc_smp_security_req(conidx, GAP_AUTH_REQ_NO_MITM_NO_BOND); + } break; + + case (GAPC_REPEATED_ATTEMPT): + { + DEBUG("REPEATED_ATTEMPT"); + gapc_disconnect(conidx); + } break; + + case (GAPC_IRK_EXCH): + { + DEBUG("IRK_EXCH(irk,addr)"); + debugHex(param->data.irk.irk.key, GAP_KEY_LEN); + debugHex(param->data.irk.addr.addr.addr, GAP_BD_ADDR_LEN); + // Store peer identity + } break; + + // In Secure Connections we get BOND_IND with SMPC calculated LTK + case (GAPC_LTK_EXCH) : + { + DEBUG("Bond LTK_EXCH(size:%d)", param->data.ltk.key_size); + debugHex(param->data.ltk.ltk.key, sizeof(struct gapc_ltk)); + + // Store peer LTK + // if ((gapc_auth_get(conidx) & GAP_AUTH_SEC_CON) || (gapc_get_role(conidx) == ROLE_MASTER)) + // { + // app_ltk_save(conidx, ¶m->data.ltk); + // } + } break; + + default: + break; + } +} + +APP_MSG_HANDLER(gapc_encrypt_req_ind) +{ + uint8_t conidx = TASK_IDX(src_id); + + DEBUG("encrypt_req_ind(ediv:0x%X,rand)", param->ediv); + debugHex(param->rand_nb.nb, GAP_RAND_NB_LEN); + + // Check if the provided EDIV and Rand Nb values match with the stored values + struct gap_sec_key *ltk = (struct gap_sec_key *)app_ltk_find(param->ediv, param->rand_nb.nb); + if (ltk != NULL) + { + DEBUG("->Find Same LTK"); + gapc_smp_encrypt_cfm(conidx, GAP_KEY_LEN, ltk); + } + else + { + // bonded with another device, disconnect the link + DEBUG("->Find Diff LTK"); + gapc_smp_encrypt_cfm(conidx, 0, NULL); + //gapc_smp_security_req(conidx, GAP_AUTH_REQ_NO_MITM_BOND); + gapc_disconnect(conidx); + } +} + +APP_MSG_HANDLER(gapc_encrypt_ind) +{ + uint8_t conidx = TASK_IDX(src_id); + DEBUG("encryp_ind(auth:%d)", param->auth); + + // encryption/ re-encryption succeeded + app_conn_fsm(BLE_ENCRYPTED, conidx, param); +} + +APP_MSG_HANDLER(gapc_security_ind) +{ + // slave request security + DEBUG("security_ind(auth:%d)", param->auth); +} +#endif //(BLE_EN_SMP) + +/** + **************************************************************************************** + * @brief SubTask Handler of GAP controller Message. + **************************************************************************************** + */ +APP_SUBTASK_HANDLER(gapc_msg) +{ + switch (msgid) + { + case GAPC_CMP_EVT: + { + APP_MSG_FUNCTION(gapc_cmp_evt); + } break; + + case GAPC_CONNECTION_REQ_IND: + { + APP_MSG_FUNCTION(gapc_connection_req_ind); + } break; + + case GAPC_CONNECTION_IND: + { + // Connection established, update from v1.3 + APP_MSG_FUNCTION(gapc_connection_ind); + } break; + + case GAPC_DISCONNECT_IND: + { + APP_MSG_FUNCTION(gapc_disconnect_ind); + } break; + + case GAPC_PARAM_UPDATE_REQ_IND: + { + APP_MSG_FUNCTION(gapc_param_update_req_ind); + } break; + + case GAPC_PARAM_UPDATED_IND: + { + APP_MSG_FUNCTION(gapc_param_updated_ind); + } break; + + #if (BLE_EN_SMP) + case GAPC_BOND_REQ_IND: + { + APP_MSG_FUNCTION(gapc_bond_req_ind); + } break; + + case GAPC_BOND_IND: + { + APP_MSG_FUNCTION(gapc_bond_ind); + } break; + + case GAPC_ENCRYPT_REQ_IND: + { + APP_MSG_FUNCTION(gapc_encrypt_req_ind); + } break; + + case GAPC_ENCRYPT_IND: + { + APP_MSG_FUNCTION(gapc_encrypt_ind); + } break; + + case GAPC_SECURITY_IND: + { + APP_MSG_FUNCTION(gapc_security_ind); + } break; + #endif //(BLE_EN_SMP) + + case GAPC_LE_PKT_SIZE_IND: + { + APP_MSG_FUNCTION(gapc_le_pkt_size_ind); + } break; + + default: + { + DEBUG("Unknow MsgId:0x%X", msgid); + } break; + } + + return (MSG_STATUS_FREE); +} diff --git a/projects/bleRemoteControl/Master/src/app_gatt.c b/projects/bleRemoteControl/Master/src/app_gatt.c new file mode 100644 index 0000000..e550268 --- /dev/null +++ b/projects/bleRemoteControl/Master/src/app_gatt.c @@ -0,0 +1,221 @@ +/** + **************************************************************************************** + * + * @file app_gatt.c + * + * @brief App SubTask of GATT Message - Example + * + * < If want to modify it, recommend to copy the file to 'user porject'/src > + **************************************************************************************** + */ + +#if (GATT_CLI) + +#include "drvs.h" +#include "app.h" +#include "gatt.h" +#include "gatt_api.h" +#include "usbd_hid.h" +#include "app_user.h" + +#if (DBG_GATT) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ +#if (CFG_USB) +#ifndef NB_PKT_MAX +#define NB_PKT_MAX 32 // 2**n +#endif + +uint8_t pkt_kb[NB_PKT_MAX][KB_LEN]; +volatile uint16_t pkt_sidx, pkt_eidx; + +uint8_t pkt_mic[64][MIC_LEN]; +volatile uint16_t pkt_mic_sidx, pkt_mic_eidx; +#endif + +/* + * MESSAGE HANDLERS + **************************************************************************************** + */ + +APP_MSG_HANDLER(gatt_cmp_evt) +{ + DEBUG("Cmp_evt(op:%d,sta:0x%02x)", param->operation, param->status); +} + +APP_MSG_HANDLER(gatt_mtu_changed_ind) +{ + DEBUG("mtu_chg:%d,seq:%d", param->mtu, param->seq_num); +} + +APP_MSG_HANDLER(gatt_disc_svc_ind) +{ + DEBUG("disc_svc(shdl:0x%X,ehdl:0x%X,ulen:%d)", param->start_hdl, param->end_hdl, param->uuid_len); + debugHex(param->uuid, param->uuid_len); +} + +APP_MSG_HANDLER(gatt_disc_svc_incl_ind) +{ + DEBUG("disc_incl(ahdl:0x%X,shdl:0x%X,ehdl:0x%X,ulen:%d)", param->attr_hdl, param->start_hdl, param->end_hdl, param->uuid_len); + debugHex(param->uuid, param->uuid_len); +} + +APP_MSG_HANDLER(gatt_disc_char_ind) +{ + DEBUG("disc_char(ahdl:0x%X,phdl:0x%X,prop:0x%X,ulen:%d)", param->attr_hdl, param->pointer_hdl, param->prop, param->uuid_len); + debugHex(param->uuid, param->uuid_len); +} + +APP_MSG_HANDLER(gatt_disc_char_desc_ind) +{ + DEBUG("disc_desc(ahdl:0x%X,ulen:%d)", param->attr_hdl, param->uuid_len); + debugHex(param->uuid, param->uuid_len); +} + +APP_MSG_HANDLER(gatt_read_ind) +{ + DEBUG("Read_ind(hdl:0x%02x,oft:%d,len:%d)", param->handle, param->offset, param->length); + debugHex(param->value, param->length); +} + +#if (CFG_USB) +uint8_t *get_kb_pkt(void) +{ + uint8_t *pkt = NULL; + + if (pkt_eidx != pkt_sidx) + { + pkt = pkt_kb[pkt_eidx]; + pkt_eidx = (pkt_eidx + 1) % NB_PKT_MAX; + } + + return pkt; +} + +uint8_t *get_mic_pkt(void) +{ + uint8_t *pkt = NULL; + + if (pkt_mic_eidx != pkt_mic_sidx) + { + pkt = pkt_mic[pkt_mic_eidx]; + pkt_mic_eidx = (pkt_mic_eidx + 1) % NB_PKT_MAX; + } + + return pkt; +} +#endif + +APP_MSG_HANDLER(gatt_event_ind) +{ + DEBUG("Evt_ind(typ:%d,hdl:0x%02x,len:%d)", param->type, param->handle, param->length); + debugHex(param->value, param->length); + +#if (CFG_USB) + if (param->handle == GATT_KB_HDL) + { + xmemcpy(pkt_kb[pkt_sidx], param->value, KB_LEN); + pkt_sidx = (pkt_sidx + 1) % NB_PKT_MAX; + + usbd_kb_report(); + } + else if (param->handle == GATT_MIC_HDL) + { + if (param->length == 128) + { + xmemcpy(pkt_mic[pkt_mic_sidx], param->value, MIC_LEN); + pkt_mic_sidx = (pkt_mic_sidx + 1) % NB_PKT_MAX; + usbd_mic_report(); + + xmemcpy(pkt_mic[pkt_mic_sidx], param->value+MIC_LEN, MIC_LEN); + pkt_mic_sidx = (pkt_mic_sidx + 1) % NB_PKT_MAX; + usbd_mic_report(); + } + } +#endif +} + +APP_MSG_HANDLER(gatt_event_req_ind) +{ + uint8_t conidx = TASK_IDX(src_id); + + DEBUG("Evt_req_ind(typ:%d,hdl:0x%02x,len:%d)", param->type, param->handle, param->length); + debugHex(param->value, param->length); + + gatt_evt_cfm(conidx, param->handle); +} + +/** + **************************************************************************************** + * @brief SubTask Handler of GATT Message. + **************************************************************************************** + */ +APP_SUBTASK_HANDLER(gatt_msg) +{ + switch (msgid) + { + case GATT_CMP_EVT: + { + APP_MSG_FUNCTION(gatt_cmp_evt); + } break; + + case GATT_MTU_CHANGED_IND: + { + APP_MSG_FUNCTION(gatt_mtu_changed_ind); + } break; + + case GATT_DISC_SVC_IND: + { + APP_MSG_FUNCTION(gatt_disc_svc_ind); + } break; + + case GATT_DISC_SVC_INCL_IND: + { + APP_MSG_FUNCTION(gatt_disc_svc_incl_ind); + } break; + + case GATT_DISC_CHAR_IND: + { + APP_MSG_FUNCTION(gatt_disc_char_ind); + } break; + + case GATT_DISC_CHAR_DESC_IND: + { + APP_MSG_FUNCTION(gatt_disc_char_desc_ind); + } break; + + case GATT_READ_IND: + { + APP_MSG_FUNCTION(gatt_read_ind); + } break; + + case GATT_EVENT_IND: + { + APP_MSG_FUNCTION(gatt_event_ind); + } break; + + case GATT_EVENT_REQ_IND: + { + APP_MSG_FUNCTION(gatt_event_req_ind); + } break; + + default: + { + DEBUG("Unknow MsgId:0x%X", msgid); + } break; + } + + return (MSG_STATUS_FREE); +} + +#endif //(GATT_CLI) diff --git a/projects/bleRemoteControl/Master/src/app_msg.c b/projects/bleRemoteControl/Master/src/app_msg.c new file mode 100644 index 0000000..d804088 --- /dev/null +++ b/projects/bleRemoteControl/Master/src/app_msg.c @@ -0,0 +1,147 @@ +/** + **************************************************************************************** + * + * @file app_msg.c + * + * @brief Application Messages Handler - Example + * + * < If want to modify it, recommend to copy the file to 'user porject'/src > + **************************************************************************************** + */ + +#include "app.h" +#include "drvs.h" +#include "usbd_hid.h" + +#if (DBG_APP) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + +#define APP_INIT_TIMEOUT 30 +/* + * MESSAGE HANDLERS + **************************************************************************************** + */ + +/// SubTask Declaration, User add more... +extern APP_SUBTASK_HANDLER(gapm_msg); +extern APP_SUBTASK_HANDLER(gapc_msg); +extern APP_SUBTASK_HANDLER(gatt_msg); + +enum app_custom_msg_id +{ + APP_INIT_TIMER = APP_BASE_MSG + 3, +}; + +void app_init_start(void) +{ + if (app_state_get() < APP_CONNECTED) + { + struct gap_bdaddr invalid_mac = {{0}, 0}; + if (memcmp((uint8_t *)&invalid_mac, scan_addr_list, 7)) + { + DEBUG("init timer-->"); + app_start_initiating(scan_addr_list + 0); + } + } +} + +#if (CFG_HW_TIMER) + +#define SCAN_INV _MS(APP_INIT_TIMEOUT) + +static uint32_t app_init_timer(uint8_t id) +{ + app_init_start(); + + return SCAN_INV; +} +#endif + +void init_timer_start(void) +{ + #if (CFG_HW_TIMER) + sfTmrStart(SCAN_INV, app_init_timer); + #else + ke_timer_set(APP_INIT_TIMER, TASK_APP, APP_INIT_TIMEOUT); + #endif + + DEBUG("init_timer_start"); +} + +void init_timer_stop(void) +{ + #if !(CFG_HW_TIMER) + ke_timer_clear(APP_INIT_TIMER, TASK_APP); + #endif + DEBUG("init_timer_stop"); +} + +/** + **************************************************************************************** + * @brief SubTask Handler of Custom or Unknow Message. (__weak func) + **************************************************************************************** + */ +//uint8_t mouse_data[4] = {0, 1, 0, 0}; +__weak APP_SUBTASK_HANDLER(custom) +{ + #if !(CFG_HW_TIMER) + if (msgid == APP_INIT_TIMER) + { + ke_timer_set(APP_INIT_TIMER, TASK_APP, APP_INIT_TIMEOUT); + + app_init_start(); + } + else + #endif + { + uint16_t length = ke_param2msg(param)->param_len; + DEBUG("Unknow MsgId:0x%X\r\n", msgid); + debugHex((uint8_t *)param, length); + } + + return (MSG_STATUS_FREE); +} + +/** + **************************************************************************************** + * @brief Dispatch TASK_APP message to sub-handler. + * + * @param[in] msgid Id of the message received. + * @param[in] task_idx Index of the receiving task instance. + * + * @return Handler of the message or NULL. + **************************************************************************************** + */ +__TASKFN void* app_task_dispatch(msg_id_t msgid, uint8_t task_idx) +{ + msg_func_t handler = NULL; + + switch (MSG_TYPE(msgid)) + { + case (TID_GAPM): + handler = app_gapm_msg_handler; + break; + + case (TID_GAPC): + handler = app_gapc_msg_handler; + break; + + #if (GATT_CLI) + case (TID_GATT): + handler = app_gatt_msg_handler; + break; + #endif + + default: + { + handler = app_custom_handler; + } break; + } + + return handler; +} diff --git a/projects/bleRemoteControl/Master/src/app_user.h b/projects/bleRemoteControl/Master/src/app_user.h new file mode 100644 index 0000000..bcc0bf9 --- /dev/null +++ b/projects/bleRemoteControl/Master/src/app_user.h @@ -0,0 +1,33 @@ +#ifndef APP_USER_H_ +#define APP_USER_H_ + +#include +#define KBD_IN_EP 0x81 +#define RAW_IN_EP 0x82 +#define RAW_IN_EP_SIZE 64 + +/* + * VARIABLE DECLARATION + **************************************************************************************** + */ +extern volatile uint16_t pkt_sidx, pkt_eidx; + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +void usbdInit(void); + +void usbd_wakeup(void); + +void init_timer_start(void); + +void init_timer_stop(void); + +uint8_t usbd_kb_report(void); +uint8_t usbd_mic_report(void); +uint8_t *get_kb_pkt(void); +uint8_t *get_mic_pkt(void); + +#endif // APP_USER_H_ diff --git a/projects/bleRemoteControl/Master/src/cfg.h b/projects/bleRemoteControl/Master/src/cfg.h new file mode 100644 index 0000000..6f7588f --- /dev/null +++ b/projects/bleRemoteControl/Master/src/cfg.h @@ -0,0 +1,76 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +#define CFG_USB (1) + +#define CFG_USE_RPT_ID (0) + +/// System Clock(0=16MHz, 1=32MHz, 2=48MHz, 3=64MHz) +#define SYS_CLK (2) + +/// Debug Mode(0=Disable, 1=via UART, 2=via RTT) +#define DBG_MODE (0) +#if (CFG_USB) +#define DBG_UART_TXD (13) +#define DBG_UART_RXD (18) +#else +#define DBG_UART_TXD (6) +#define DBG_UART_RXD (18) +#endif + +#define PA_UART1_TX (DBG_UART_TXD) +#define PA_UART1_RX (DBG_UART_RXD) +//#if (SYS_CLK) +//#define DBG_UART_BAUD BRR_DIV(2000000, 48M) +//#else +//#define DBG_UART_BAUD BRR_DIV(2000000, 48M) +//#endif +//#define UART1_CONF_BAUD DBG_UART_BAUD + +/// BLE Configure (Single or Multi-Connections) +#define BLE_NB_SLAVE (0) +#define BLE_NB_MASTER (1) +#define BLE_ADDR {0x2C, 0x06, 0x01, 0x24, 0x20, 0xD2} +#define BLE_DEV_NAME "usb_receiver_" +#define BLE_DEV_ICON 0x0000 +#define BLE_AUTH (GAP_AUTH_REQ_NO_MITM_NO_BOND) +#define BLE_EN_SMP (0) +//#define BLE_SYNC_WORD (0x26D5EF45) +#define BLE_MTU (251) +#define SCAN_NUM_MAX (1) +#define CFG_HW_TIMER (0) +#define BLE_HEAP_BASE (0x20004E00) + +#define BT_MAC_STORE_OFFSET (0x1200) + +/// Profile Configure +#define GATT_CLI (1) + +/// Debug Configure +#if (DBG_MODE) + #define DBG_APP (1) + #define DBG_PROC (0) + #define DBG_ACTV (1) + #define DBG_GAPM (0) + #define DBG_GAPC (1) + #define DBG_GATT (1) + #define DBG_USB (0) +#endif + +/// USB&BLE CFG +#define GATT_KB_HDL (45) +#define GATT_MIC_HDL (56) +#define KB_LEN (8) +#define MIC_LEN (64) + +#endif //_APP_CFG_H_ diff --git a/projects/bleRemoteControl/Master/src/hid_boot.c b/projects/bleRemoteControl/Master/src/hid_boot.c new file mode 100644 index 0000000..d11f788 --- /dev/null +++ b/projects/bleRemoteControl/Master/src/hid_boot.c @@ -0,0 +1,378 @@ +#if (CFG_USB) + +#include "usbd.h" +#include "usbd_hid.h" +#include "regs.h" +#include "drvs.h" +#define USBD_BCD USB_1_1 // Version +#define USBD_VID 0xFFFF // Vendor ID +#define USBD_PID 0xFF00 // Product ID +#define USBD_MAX_POWER 100 // unit in mA +#define USBD_LANGID_STRING 0x0409 // English(US) + +#if (DBG_USB) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + +/* + * Descriptor + **************************************************************************** + */ + +/*!< count of hid interface descriptor */ +#define USB_HID_INTF_CNT 2 +#define USB_HID_INTF_END (USB_HID_INTF_CNT - 1) + +/*!< config descriptor size (in & out endpoints) */ +#define USB_HID_CONFIG_SIZE (9+(18+7+7)*USB_HID_INTF_CNT) + +/*!< keyboard interface config */ +#define KBD_INTF_NUM 0 /*!< interfaceNumber */ +#ifndef KBD_IN_EP +#define KBD_IN_EP 0x81 /*!< address */ +#endif +#define KBD_IN_EP_SIZE 8 /*!< max packet length */ +#define KBD_IN_EP_INTERVAL 4 /*!< polling time */ +#define KBD_OUT_EP 0x01 +#define KBD_OUT_EP_SIZE 1 +#define KBD_OUT_EP_INTERVAL 4 +#define KBD_REPORT_DESC_SIZE sizeof(hid_kbd_report_desc) + +/*!< custom-raw interface config */ +#define RAW_INTF_NUM 1 +#ifndef RAW_IN_EP +#define RAW_IN_EP 0x82 +#endif +#ifndef RAW_IN_EP_SIZE +#define RAW_IN_EP_SIZE 64 +#endif +#define RAW_IN_EP_INTERVAL 1 +#define RAW_OUT_EP 0x02 +#define RAW_OUT_EP_SIZE 64 +#define RAW_OUT_EP_INTERVAL 1 +#define RAW_REPORT_DESC_SIZE sizeof(hid_raw_report_desc) + +/*!< Declaration of endpoint Handlers */ +void usbd_hid_kbd_out_handler(uint8_t ep); +void usbd_hid_raw_out_handler(uint8_t ep); + +/*!< hid keyboard report descriptor */ +static const uint8_t hid_kbd_report_desc[] = { +#if (0) + 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) + 0x09, 0x06, // Usage (Keyboard) + 0xA1, 0x01, // Collection (Application) +// 0x85, 0x01, // Report ID (1) + 0x05, 0x07, // Usage Page (Kbrd/Keypad) + 0x19, 0xE0, // Usage Minimum (0xE0) + 0x29, 0xE7, // Usage Maximum (0xE7) + 0x15, 0x00, // Logical Minimum (0) + 0x25, 0x01, // Logical Maximum (1) + 0x75, 0x01, // Report Size (1) + 0x95, 0x08, // Report Count (8) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x95, 0x01, // Report Count (1) + 0x75, 0x08, // Report Size (8) + 0x81, 0x01, // Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x95, 0x05, // Report Count (5) + 0x75, 0x01, // Report Size (1) + 0x05, 0x08, // Usage Page (LEDs) + 0x19, 0x01, // Usage Minimum (Num Lock) + 0x29, 0x05, // Usage Maximum (Kana) + 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) + 0x95, 0x01, // Report Count (1) + 0x75, 0x03, // Report Size (3) + 0x91, 0x01, // Output (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) + 0x95, 0x06, // Report Count (6) + 0x75, 0x08, // Report Size (8) + 0x15, 0x28, // Logical Minimum (40) + 0x25, 0xFE, // Logical Maximum (-2) + 0x05, 0x07, // Usage Page (Kbrd/Keypad) + 0x19, 0x28, // Usage Minimum (0x28) + 0x29, 0xFE, // Usage Maximum (0xFE) + 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) +#if (0) + 0x05, 0x0C, // Usage Page (Consumer) + 0x09, 0x01, // Usage (Consumer Control) + 0xA1, 0x01, // Collection (Application) + 0x85, 0xF1, // Report ID (-15) + 0x15, 0x00, // Logical Minimum (0) + 0x25, 0x01, // Logical Maximum (1) + 0x75, 0x01, // Report Size (1) + 0x95, 0x18, // Report Count (24) + 0x09, 0xB5, // Usage (Scan Next Track) + 0x09, 0xB6, // Usage (Scan Previous Track) + 0x09, 0xB7, // Usage (Stop) + 0x09, 0xCD, // Usage (Play/Pause) + 0x09, 0xE2, // Usage (Mute) + 0x09, 0xE5, // Usage (Bass Boost) + 0x09, 0xE7, // Usage (Loudness) + 0x09, 0xE9, // Usage (Volume Increment) + 0x09, 0xEA, // Usage (Volume Decrement) + 0x0A, 0x52, 0x01, // Usage (Bass Increment) + 0x0A, 0x53, 0x01, // Usage (Bass Decrement) + 0x0A, 0x54, 0x01, // Usage (Treble Increment) + 0x0A, 0x55, 0x01, // Usage (Treble Decrement) + 0x0A, 0x83, 0x01, // Usage (AL Consumer Control Configuration) + 0x0A, 0x8A, 0x01, // Usage (AL Email Reader) + 0x0A, 0x92, 0x01, // Usage (AL Calculator) + 0x0A, 0x94, 0x01, // Usage (AL Local Machine Browser) + 0x0A, 0x21, 0x02, // Usage (AC Search) + 0x0A, 0x23, 0x02, // Usage (AC Home) + 0x0A, 0x24, 0x02, // Usage (AC Back) + 0x0A, 0x25, 0x02, // Usage (AC Forward) + 0x0A, 0x26, 0x02, // Usage (AC Stop) + 0x0A, 0x27, 0x02, // Usage (AC Refresh) + 0x0A, 0x2A, 0x02, // Usage (AC Bookmarks) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0xC0, // End Collection +#endif + 0xC0, // End Collection +#else + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x06, // USAGE (Keyboard) + 0xa1, 0x01, // COLLECTION (Application) + 0x05, 0x07, // USAGE_PAGE (Keyboard) + 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl) + 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0x01, // LOGICAL_MAXIMUM (1) + 0x75, 0x01, // REPORT_SIZE (1) + 0x95, 0x08, // REPORT_COUNT (8) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0x95, 0x01, // REPORT_COUNT (1) + 0x75, 0x08, // REPORT_SIZE (8) + 0x81, 0x03, // INPUT (Cnst,Var,Abs) + 0x95, 0x05, // REPORT_COUNT (5) + 0x75, 0x01, // REPORT_SIZE (1) + 0x05, 0x08, // USAGE_PAGE (LEDs) + 0x19, 0x01, // USAGE_MINIMUM (Num Lock) + 0x29, 0x05, // USAGE_MAXIMUM (Kana) + 0x91, 0x02, // OUTPUT (Data,Var,Abs) + 0x95, 0x01, // REPORT_COUNT (1) + 0x75, 0x03, // REPORT_SIZE (3) + 0x91, 0x03, // OUTPUT (Cnst,Var,Abs) + 0x95, 0x06, // REPORT_COUNT (6) + 0x75, 0x08, // REPORT_SIZE (8) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0xFF, // LOGICAL_MAXIMUM (255) + 0x05, 0x07, // USAGE_PAGE (Keyboard) + 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated)) + 0x29, 0xFF, // USAGE_MAXIMUM (Keyboard Application) + 0x81, 0x00, // INPUT (Data,Ary,Abs) + 0xc0 // END_COLLECTION +#endif +}; + +/*!< hid custom-raw report descriptor */ +static const uint8_t hid_raw_report_desc[] = { + 0x06, 0x00, 0xff, // USAGE_PAGE (Vendor Defined Page 1) + 0x09, 0x01, // USAGE (Vendor Usage 1) + 0xa1, 0x01, // COLLECTION (Application) + 0x09, 0x01, // USAGE (Vendor Usage 1) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) + 0x95, 0x40, // REPORT_COUNT (64) + 0x75, 0x08, // REPORT_SIZE (8) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0x09, 0x01, // USAGE (Vendor Usage 1) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) + 0x95, 0x40, // REPORT_COUNT (64) + 0x75, 0x08, // REPORT_SIZE (8) + 0x91, 0x02, // OUTPUT (Data,Var,Abs) + 0xC0 // END_COLLECTION +}; + +/*!< hid device descriptor */ +static const uint8_t hid_descriptor[] = { + /* Descriptor - Device (Size:18) */ + USB_DEVICE_DESCRIPTOR_INIT(USBD_BCD, 0x00, 0x00, 0x00, USBD_VID, USBD_PID, 0x0002, 0x01), + + /* Descriptor - Configuration (Total Size:9+Intf_Size) */ + USB_CONFIG_DESCRIPTOR_INIT(USB_HID_CONFIG_SIZE, USB_HID_INTF_CNT, + 0x01, USB_CONFIG_BUS_POWERED, USBD_MAX_POWER), + + /* Descriptor - Keyboard Interface (Size:18+7*2) */ + HID_INTERFACE_INIT(KBD_INTF_NUM, 2, HID_SUBCLASS_BOOTIF, HID_PROTOCOL_KEYBOARD, 0, KBD_REPORT_DESC_SIZE), + HID_ENDPOINT_DESC(KBD_IN_EP, KBD_IN_EP_SIZE, KBD_IN_EP_INTERVAL), + HID_ENDPOINT_DESC(KBD_OUT_EP, KBD_OUT_EP_SIZE, KBD_OUT_EP_INTERVAL), + + /* Descriptor - Custom-Raw Interface (Size:18+7*2) */ + HID_INTERFACE_INIT(RAW_INTF_NUM, 2, HID_SUBCLASS_BOOTIF, HID_PROTOCOL_NONE, 0, RAW_REPORT_DESC_SIZE), + HID_ENDPOINT_DESC(RAW_IN_EP, RAW_IN_EP_SIZE, RAW_IN_EP_INTERVAL), + HID_ENDPOINT_DESC(RAW_OUT_EP, RAW_OUT_EP_SIZE, RAW_OUT_EP_INTERVAL), + + /* Descriptor - String */ + // String0 - Language ID (Size:4) + USB_LANGID_INIT(USBD_LANGID_STRING), + + // String1 - iManufacturer + 0x02, /* bLength */ + USB_DESC_TYPE_STRING, /* bDescriptorType */ + + // String2 - iProduct + 0x20, /* bLength */ + USB_DESC_TYPE_STRING, /* bDescriptorType */ + WCHAR('U'), + WCHAR('S'), + WCHAR('B'), + WCHAR(' '), + WCHAR('R'), + WCHAR('e'), + WCHAR('c'), + WCHAR('e'), + WCHAR('i'), + WCHAR('v'), + WCHAR('e'), + WCHAR(' '), + WCHAR('M'), + WCHAR('i'), + WCHAR('c'), + + // String3 - iSerialNumber + 0x10, /* bLength */ + USB_DESC_TYPE_STRING, /* bDescriptorType */ + WCHAR('6'), + WCHAR('.'), + WCHAR('2'), + WCHAR('2'), + WCHAR('.'), + WCHAR('0'), + WCHAR('8'), + + /* Descriptor - Device Qualifier (Size:10) */ + #if (USBD_BCD == USB_2_0) + USB_QUALIFIER_INIT(0x01), + #endif + + /* Descriptor - EOF */ + 0x00 +}; + + +/* + * Configuration + **************************************************************************** + */ + +/*!< table of hid interface */ +static const hid_intf_t hid_interface[] = { + HID_INTF_T(KBD_INTF_NUM, KBD_IN_EP, hid_kbd_report_desc), + HID_INTF_T(RAW_INTF_NUM, RAW_IN_EP, hid_raw_report_desc), +}; + +/*!< table of endpoints */ +static const usbd_ep_t endpoint_tab[] = { + USBD_EP_T(KBD_IN_EP, USB_EP_TYPE_INTERRUPT, KBD_IN_EP_SIZE, &usbd_hid_ep_in_handler), + USBD_EP_T(KBD_OUT_EP, USB_EP_TYPE_INTERRUPT, KBD_OUT_EP_SIZE, &usbd_hid_kbd_out_handler), + + USBD_EP_T(RAW_IN_EP, USB_EP_TYPE_INTERRUPT, RAW_IN_EP_SIZE, &usbd_hid_ep_in_handler), + USBD_EP_T(RAW_OUT_EP, USB_EP_TYPE_INTERRUPT, RAW_OUT_EP_SIZE, &usbd_hid_raw_out_handler), +}; + +/*!< table of class */ +static const usbd_class_t class_tab[] = { + USBD_CLASS_T(0, USB_HID_INTF_END, &usbd_hid_class_handler), +}; + +/*!< USBD Configuration */ +static const usbd_config_t hid_configuration[] = { + USBD_CONFIG_T(1, USB_HID_INTF_CNT, class_tab, endpoint_tab) +}; + +/* + * Handlers + **************************************************************************** + */ + +void usbd_hid_kbd_out_handler(uint8_t ep) +{ + uint8_t led_state; + + /*!< read the led data from host send */ + usbd_ep_read(ep, KBD_OUT_EP_SIZE, &led_state); + DEBUG("led_state:%02X\r\n", led_state); + + /*!< here you can write the LED processing from the host */ + usbd_hid_leds(led_state); +} + +void usbd_hid_raw_out_handler(uint8_t ep) +{ + uint8_t custom_data[RAW_OUT_EP_SIZE]; + + /*!< read the data from host send */ + usbd_ep_read(RAW_OUT_EP, RAW_OUT_EP_SIZE, custom_data); + + /*!< you can use the data do some thing you like */ +} + +bool suspend; + +__USBIRQ void usbd_notify_handler(uint8_t event, void *arg) +{ + DEBUG("evt:%d", event); + switch (event) + { + case USBD_EVENT_RESET: + { + suspend = false; + usbd_hid_reset(); + } break; + + case USBD_EVENT_SUSPEND: + { + suspend = true; + } break; + + case USBD_EVENT_RESUME: + case USBD_EVENT_CLR_REMOTE_WAKEUP: + { + suspend = false; + } break; + + default: + break; + } +} + +void usbd_wakeup(void) +{ + if (suspend && usbd_resume(1)) + { + btmr_delay(48000, 30); + usbd_resume(0); + } +} + +void usbdInit(void) +{ + suspend = false; + // enable USB clk and iopad + rcc_usb_en(); + // .DIG_USB_PU = 1, 1.87K + // .DIG_USB_PU = 2, 1.32K + // .DIG_USB_PU = 3, 1.27K + SYSCFG->USB_CTRL.Word = 0x14; +// CSC->CSC_OUTPUT[6].Word = 0; +// CSC->CSC_OUTPUT[7].Word = 0; +// CSC->CSC_INPUT[CSC_UART1_TXD].Word = 0; +// CSC->CSC_INPUT[CSC_UART1_RXD].Word = 0; + + usbd_init(); + usbd_register(hid_descriptor, hid_configuration); + + NVIC_SetPriority(BLE_IRQn, 1); + NVIC_EnableIRQ(USB_IRQn); + + for (uint8_t idx = 0; idx < USB_HID_INTF_CNT; idx++) + { + usbd_hid_init(idx, &hid_interface[idx]); + } +} +#endif // (CFG_USB) diff --git a/projects/bleRemoteControl/Master/src/hid_custom.c b/projects/bleRemoteControl/Master/src/hid_custom.c new file mode 100644 index 0000000..d0a93ea --- /dev/null +++ b/projects/bleRemoteControl/Master/src/hid_custom.c @@ -0,0 +1,301 @@ +#include "usbd.h" +#include "usbd_hid.h" +#include "drvs.h" + +#if (DEMO_HID_CUSTOM) + +#define USBD_BCD USB_2_0 // Version +#define USBD_VID 0xFFFF // Vendor ID +#define USBD_PID 0xFFFF // Product ID +#define USBD_MAX_POWER 100 // unit in mA +#define USBD_LANGID_STRING 0x0409 // English(US) + + +/* + * Descriptor + **************************************************************************** + */ + +/*!< count of hid interface descriptor */ +#define USB_HID_INTF_CNT 2 +#define USB_HID_INTF_END (USB_HID_INTF_CNT - 1) + +/*!< config descriptor size (in & out endpoints) */ +#define USB_HID_CONFIG_SIZE (9+(18+7+7)*USB_HID_INTF_CNT) + +/*!< keyboard interface config */ +#define KBD_INTF_NUM 0 /*!< interfaceNumber */ +#define KBD_IN_EP 0x81 /*!< address */ +#define KBD_IN_EP_SIZE 8 /*!< max packet length */ +#define KBD_IN_EP_INTERVAL 10 /*!< polling time */ +#define KBD_OUT_EP 0x01 +#define KBD_OUT_EP_SIZE 1 +#define KBD_OUT_EP_INTERVAL 10 +#define KBD_REPORT_DESC_SIZE sizeof(hid_kbd_report_desc) + +/*!< custom-raw interface config */ +#define RAW_INTF_NUM 1 +#define RAW_IN_EP 0x82 +#define RAW_IN_EP_SIZE 64 +#define RAW_IN_EP_INTERVAL 10 +#define RAW_OUT_EP 0x02 +#define RAW_OUT_EP_SIZE 64 +#define RAW_OUT_EP_INTERVAL 10 +#define RAW_REPORT_DESC_SIZE sizeof(hid_raw_report_desc) + +/*!< Declaration of endpoint Handlers */ +void usbd_hid_kbd_out_handler(uint8_t ep); +void usbd_hid_raw_out_handler(uint8_t ep); + +/*!< hid keyboard report descriptor */ +static const uint8_t hid_kbd_report_desc[] = { + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x06, // USAGE (Keyboard) + 0xa1, 0x01, // COLLECTION (Application) + 0x05, 0x07, // USAGE_PAGE (Keyboard) + 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl) + 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0x01, // LOGICAL_MAXIMUM (1) + 0x75, 0x01, // REPORT_SIZE (1) + 0x95, 0x08, // REPORT_COUNT (8) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0x95, 0x01, // REPORT_COUNT (1) + 0x75, 0x08, // REPORT_SIZE (8) + 0x81, 0x03, // INPUT (Cnst,Var,Abs) + 0x95, 0x05, // REPORT_COUNT (5) + 0x75, 0x01, // REPORT_SIZE (1) + 0x05, 0x08, // USAGE_PAGE (LEDs) + 0x19, 0x01, // USAGE_MINIMUM (Num Lock) + 0x29, 0x05, // USAGE_MAXIMUM (Kana) + 0x91, 0x02, // OUTPUT (Data,Var,Abs) + 0x95, 0x01, // REPORT_COUNT (1) + 0x75, 0x03, // REPORT_SIZE (3) + 0x91, 0x03, // OUTPUT (Cnst,Var,Abs) + 0x95, 0x06, // REPORT_COUNT (6) + 0x75, 0x08, // REPORT_SIZE (8) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0xFF, // LOGICAL_MAXIMUM (255) + 0x05, 0x07, // USAGE_PAGE (Keyboard) + 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated)) + 0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application) + 0x81, 0x00, // INPUT (Data,Ary,Abs) + 0xc0 // END_COLLECTION +}; + +/*!< hid custom-raw report descriptor */ +static const uint8_t hid_raw_report_desc[] = { + 0x06, 0x00, 0xff, // USAGE_PAGE (Vendor Defined Page 1) + 0x09, 0x01, // USAGE (Vendor Usage 1) + 0xa1, 0x01, // COLLECTION (Application) + 0x09, 0x01, // USAGE (Vendor Usage 1) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) + 0x95, 0x40, // REPORT_COUNT (64) + 0x75, 0x08, // REPORT_SIZE (8) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0x09, 0x01, // USAGE (Vendor Usage 1) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) + 0x95, 0x40, // REPORT_COUNT (64) + 0x75, 0x08, // REPORT_SIZE (8) + 0x91, 0x02, // OUTPUT (Data,Var,Abs) + 0xC0 // END_COLLECTION +}; + +/*!< hid device descriptor */ +static const uint8_t hid_descriptor[] = { + /* Descriptor - Device (Size:18) */ + USB_DEVICE_DESCRIPTOR_INIT(USBD_BCD, 0x00, 0x00, 0x00, USBD_VID, USBD_PID, 0x0002, 0x01), + + /* Descriptor - Configuration (Total Size:9+Intf_Size) */ + USB_CONFIG_DESCRIPTOR_INIT(USB_HID_CONFIG_SIZE, USB_HID_INTF_CNT, + 0x01, USB_CONFIG_BUS_POWERED, USBD_MAX_POWER), + + /* Descriptor - Keyboard Interface (Size:18+7*2) */ + HID_INTERFACE_INIT(KBD_INTF_NUM, 2, HID_SUBCLASS_BOOTIF, HID_PROTOCOL_KEYBOARD, 0, KBD_REPORT_DESC_SIZE), + HID_ENDPOINT_DESC(KBD_IN_EP, KBD_IN_EP_SIZE, KBD_IN_EP_INTERVAL), + HID_ENDPOINT_DESC(KBD_OUT_EP, KBD_OUT_EP_SIZE, KBD_OUT_EP_INTERVAL), + + /* Descriptor - Custom-Raw Interface (Size:18+7*2) */ + HID_INTERFACE_INIT(RAW_INTF_NUM, 2, HID_SUBCLASS_BOOTIF, HID_PROTOCOL_NONE, 0, RAW_REPORT_DESC_SIZE), + HID_ENDPOINT_DESC(RAW_IN_EP, RAW_IN_EP_SIZE, RAW_IN_EP_INTERVAL), + HID_ENDPOINT_DESC(RAW_OUT_EP, RAW_OUT_EP_SIZE, RAW_OUT_EP_INTERVAL), + + /* Descriptor - String */ + // String0 - Language ID (Size:4) + USB_LANGID_INIT(USBD_LANGID_STRING), + // String1 - iManufacturer + 0x14, /* bLength */ + USB_DESC_TYPE_STRING, /* bDescriptorType */ + WCHAR('H'), /* wcChar0 */ + WCHAR('Y'), /* wcChar1 */ + WCHAR('I'), /* wcChar2 */ + WCHAR('C'), /* wcChar3 */ + WCHAR(' '), /* wcChar4 */ + WCHAR('I'), /* wcChar5 */ + WCHAR('n'), /* wcChar6 */ + WCHAR('c'), /* wcChar7 */ + WCHAR('.'), /* wcChar8 */ + // String2 - iProduct + 0x1C, /* bLength */ + USB_DESC_TYPE_STRING, /* bDescriptorType */ + WCHAR('H'), /* wcChar0 */ + WCHAR('Y'), /* wcChar1 */ + WCHAR('-'), /* wcChar2 */ + WCHAR('U'), /* wcChar3 */ + WCHAR('S'), /* wcChar4 */ + WCHAR('B'), /* wcChar5 */ + WCHAR(' '), /* wcChar6 */ + WCHAR('R'), /* wcChar7 */ + WCHAR('a'), /* wcChar8 */ + WCHAR('w'), /* wcChar9 */ + WCHAR('H'), /* wcChar10 */ + WCHAR('I'), /* wcChar11 */ + WCHAR('D'), /* wcChar12 */ + // String3 - iSerialNumber + 0x10, /* bLength */ + USB_DESC_TYPE_STRING, /* bDescriptorType */ + WCHAR('6'), /* wcChar0 */ + WCHAR('.'), /* wcChar1 */ + WCHAR('2'), /* wcChar2 */ + WCHAR('2'), /* wcChar3 */ + WCHAR('.'), /* wcChar4 */ + WCHAR('0'), /* wcChar5 */ + WCHAR('8'), /* wcChar6 */ + + /* Descriptor - Device Qualifier (Size:10) */ + #if (USBD_BCD == USB_2_0) + USB_QUALIFIER_INIT(0x01), + #endif + + /* Descriptor - EOF */ + 0x00 +}; + + +/* + * Configuration + **************************************************************************** + */ + +/*!< table of hid interface */ +static const hid_intf_t hid_interface[] = { + HID_INTF_T(KBD_INTF_NUM, KBD_IN_EP, hid_kbd_report_desc), + HID_INTF_T(RAW_INTF_NUM, RAW_IN_EP, hid_raw_report_desc), +}; + +/*!< table of endpoints */ +static const usbd_ep_t endpoint_tab[] = { + USBD_EP_T(KBD_IN_EP, USB_EP_TYPE_INTERRUPT, KBD_IN_EP_SIZE, &usbd_hid_ep_in_handler), + USBD_EP_T(KBD_OUT_EP, USB_EP_TYPE_INTERRUPT, KBD_OUT_EP_SIZE, &usbd_hid_kbd_out_handler), + + USBD_EP_T(RAW_IN_EP, USB_EP_TYPE_INTERRUPT, RAW_IN_EP_SIZE, &usbd_hid_ep_in_handler), + USBD_EP_T(RAW_OUT_EP, USB_EP_TYPE_INTERRUPT, RAW_OUT_EP_SIZE, &usbd_hid_raw_out_handler), +}; + +/*!< table of class */ +static const usbd_class_t class_tab[] = { + USBD_CLASS_T(0, USB_HID_INTF_END, &usbd_hid_class_handler), +}; + +/*!< USBD Configuration */ +static const usbd_config_t hid_configuration[] = { + USBD_CONFIG_T(1, USB_HID_INTF_CNT, class_tab, endpoint_tab) +}; + + +/* + * Handlers + **************************************************************************** + */ + +void usbd_hid_kbd_out_handler(uint8_t ep) +{ + uint8_t led_state; + + /*!< read the led data from host send */ + usbd_ep_read(ep, KBD_OUT_EP_SIZE, &led_state); + USB_LOG_RAW("led_state:%02X\r\n", led_state); + + /*!< here you can write the LED processing from the host */ + usbd_hid_leds(led_state); +} + +void usbd_hid_raw_out_handler(uint8_t ep) +{ + uint8_t custom_data[RAW_OUT_EP_SIZE]; + + /*!< read the data from host send */ + usbd_ep_read(RAW_OUT_EP, RAW_OUT_EP_SIZE, custom_data); + + /*!< you can use the data do some thing you like */ +} + +__USBIRQ void usbd_notify_handler(uint8_t event, void *arg) +{ + switch (event) { + case USBD_EVENT_RESET: + usbd_hid_reset(); + break; + case USBD_EVENT_RESUME: + break; + case USBD_EVENT_SUSPEND: + break; + + default: + break; + } +} + + +/* + * Test Functions + **************************************************************************** + */ + +void usbdInit(void) +{ + usbd_init(); + usbd_register(hid_descriptor, hid_configuration); + + for (uint8_t idx = 0; idx < USB_HID_INTF_CNT; idx++) { + usbd_hid_init(idx, &hid_interface[idx]); + } +} + +void usbdTest(void) +{ + // circle polling to send report + static uint8_t keynum = 0; + + if (!usbd_is_configured()) + return; + + /*!< keyboard test */ + { + uint8_t sendbuffer1[KBD_IN_EP_SIZE] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; //A + + sendbuffer1[2] = HID_KEY_A + keynum; + usbd_hid_send_report(KBD_IN_EP, KBD_IN_EP_SIZE, sendbuffer1); + /*!< delay 10ms */ + bootDelayMs(10); + /*!< send button up */ + sendbuffer1[2] = 0; + usbd_hid_send_report(KBD_IN_EP, KBD_IN_EP_SIZE, sendbuffer1); + } + + /*!< delay 100ms the custom test */ + { + bootDelayMs(100); + /*!< custom test */ + uint8_t sendbuffer2[RAW_IN_EP_SIZE]; + + memset(sendbuffer2, keynum, RAW_IN_EP_SIZE); + usbd_hid_send_report(RAW_IN_EP, RAW_IN_EP_SIZE, sendbuffer2); + } + + if (++keynum > 94) keynum = 0; +} + +#endif // (DEMO_HID_CUSTOM) diff --git a/projects/bleRemoteControl/Master/src/link_xip_ble.sct b/projects/bleRemoteControl/Master/src/link_xip_ble.sct new file mode 100644 index 0000000..10f9e70 --- /dev/null +++ b/projects/bleRemoteControl/Master/src/link_xip_ble.sct @@ -0,0 +1,51 @@ +#! armcc -E -I ..\src\ -I ..\..\..\..\ble\api +#include "cfg.h" +#include "blelib.h" + +#define SCT_FLASH_BASE (0x18004000) +#define SCT_FLASH_END (0x18020000) +#define SCT_FLASH_LEN (SCT_FLASH_END - SCT_FLASH_BASE) + +LR_IROM1 SCT_FLASH_BASE SCT_FLASH_LEN +{ + ER_IROM1 SCT_FLASH_BASE SCT_FLASH_LEN + { + *.o (RESET, +First) + *(InRoot$$Sections) + + .ANY (+RO) + } + + RW_IRAM_VECT 0x20003000 EMPTY 152 + { + ; sram vector + } + + RW_IRAM_USER +0 + { + *.o(ram_func*) + *.o(usb_irq) + .ANY (+RW +ZI) + } + + RW_IRAM_STACK 0x20008000-0x600 UNINIT 0x600 + { + .ANY (STACK) + } + + RW_IRAM_EXCH BLE_EXCH_BASE EMPTY BLE_EXCH_SIZE + { + ; configured with BLE HW + } + + RW_IRAM_HEAP BLE_HEAP_BASE EMPTY BLE_HEAP_SIZE + { + ; configured with ble_heap() + } + + RW_IRAM_RWZI BLE_RWZI_BASE UNINIT BLE_RWZI_SIZE + { + ; ZI data, manual inited in lib + *ble6*.lib (+RW +ZI) + } +} diff --git a/projects/bleRemoteControl/Master/src/main.c b/projects/bleRemoteControl/Master/src/main.c new file mode 100644 index 0000000..8d665d5 --- /dev/null +++ b/projects/bleRemoteControl/Master/src/main.c @@ -0,0 +1,132 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "regs.h" +#include "drvs.h" +#include "bledef.h" +#include "app.h" +#include "sysdbg.h" +#include "dbg.h" +#include "app_user.h" + +/* + * DEFINES + **************************************************************************************** + */ + +/* + * FUNCTIONS + **************************************************************************************** + */ +static void sysInit(void) +{ + rcc_sysclk_set(SYS_CLK); + + iwdt_disable(); + + rcc_ble_en(); + + rcc_adc_en(); + + /***************************************/ + uint8_t fid = flashReadId() & 0xFF; + + if (fid == FSH_VID_BOYA) + { + rcc_fshclk_set(FSH_CLK_DPSC25); + + boya_flash_quad_mode(); + + boya_enter_hpm(); + } + else + { + rcc_fshclk_set(FSH_CLK_DPSC42); + + puya_enter_dual_read(); + } + /***************************************/ + + // 2414.000MHz +// APBMISC->XOSC16M_CTRL.XOSC16M_CAP_TR = 0x1C; + +// // sop8-3, +// APBMISC->XOSC16M_CTRL.XOSC16M_CAP_TR = 0x1A; + +// // shenzhen,shao XOSC, 2478MHz, +14KHz +// APBMISC->XOSC16M_CTRL.XOSC16M_CAP_TR = 0x10; + + // QKIE, SOP8-1, 2440MHz, +4KHz +// APBMISC->XOSC16M_CTRL.XOSC16M_CAP_TR = 0x10; + + // SOP8-VDD12, 2440MHz, +2KHz +// APBMISC->XOSC16M_CTRL.XOSC16M_CAP_TR = 0x15; + + // Dongle,QFN20, Rx-2144MHz, +1KHz +// APBMISC->XOSC16M_CTRL.XOSC16M_CAP_TR = 0x22; + + // Dongle V1.2,QFN20, Rx-2144MHz, +1KHz +// APBMISC->XOSC16M_CTRL.XOSC16M_CAP_TR = 0x20; + + // eSOP8-VDD12, 2440MHz, +0.7KHz +// APBMISC->XOSC16M_CTRL.XOSC16M_CAP_TR = 0x1E; + + // eSOP8-VDD33+VDD12, 2144MHZ, +2.1KHz + APBMISC->XOSC16M_CTRL.XOSC16M_CAP_TR = 0x20; +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + uint32_t store_mac = RD_32(FLASH_BASE + BT_MAC_STORE_OFFSET); + +#if (DBG_MODE) + #if (DBG_UART_TXD == 19) + iospc_rstpin(true); + #endif + dbgInit(); + debug("\r\n---Start(rsn:%X)...\r\n", rsn); +#endif + + if (store_mac != 0xFFFFFFFF) + { + write32p(ble_dev_addr.addr, store_mac); + } + + // Init BLE App + app_init(rsn); + rf_pa_set(0x0C); + + #if (CFG_USB) + bootDelayMs(4); + usbdInit(); + #endif +} + +int main(void) +{ + sysInit(); + devInit(); + + // Global Interrupt Enable + GLOBAL_INT_START(); + + // main loop + while (1) + { + // Schedule Messages & Events + ble_schedule(); + + #if (CFG_USB) + usbd_mic_report(); + usbd_kb_report(); + #endif + } +} diff --git a/projects/bleRemoteControl/Master/src/myapp.c b/projects/bleRemoteControl/Master/src/myapp.c new file mode 100644 index 0000000..20ad799 --- /dev/null +++ b/projects/bleRemoteControl/Master/src/myapp.c @@ -0,0 +1,72 @@ +/** + **************************************************************************************** + * + * @file myapp.c + * + * @brief User Application - Override func + * + **************************************************************************************** + */ + +#include "app.h" +#include "bledef.h" +#include "drvs.h" +#include "leds.h" + +#if (DBG_APP) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * VARIABLES DEFINITIONS + **************************************************************************************** + */ + + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +#if (LED_PLAY) +/** + **************************************************************************************** + * @brief API to Set State of Application, add leds Indication + * + * @param[in] state new state + **************************************************************************************** + */ +void app_state_set(uint8_t state) +{ + DEBUG("State(old:%d,new:%d)", app_state_get(), state); + + app_env.state = state; + + // Indication, User add more... + if (state == APP_IDLE) + { + leds_play(LED_SLOW_BL); + } + else if (state == APP_READY) + { + leds_play(LED_FAST_BL); + } + else if (state == APP_CONNECTED) + { + leds_play(LED_CONT_ON); + } +} +#endif //(LED_PLAY) + diff --git a/projects/bleRemoteControl/Master/src/proc.c b/projects/bleRemoteControl/Master/src/proc.c new file mode 100644 index 0000000..7e16a68 --- /dev/null +++ b/projects/bleRemoteControl/Master/src/proc.c @@ -0,0 +1,124 @@ +/** + **************************************************************************************** + * + * @file proc.c + * + * @brief user procedure. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" + +#include "app.h" +#include "prf_sess.h" +#include "uartRb.h" +#include "usbd_hid.h" + +#if (DBG_PROC) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +enum uart_cmd +{ + CMD_USBD = 0xA0, + CMD_BLE_SESS = 0xB0, +}; + +#define CDC0_IN_EP 0x81 +#define BLE_MAX_LEN 20 +#define NULL_CNT 20 + +static uint8_t buff[BLE_MAX_LEN]; +static uint16_t buff_len = 0; + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +/// Override - Callback on received data from peer device +void sess_cb_rxd(uint8_t conidx, uint16_t len, const uint8_t *data) +{ + uint8_t state = 0xFF; + uint8_t usb_rpt[8] = {0}; + + if (data[0] == 0xA0) + { + memcpy(usb_rpt, data + 1, len > 8 ? 8 : len - 1); + state = usbd_hid_send_report(KEYBD_IN_EP, 8, usb_rpt); // key code + memset(usb_rpt, 0x00, 8); + state = usbd_hid_send_report(KEYBD_IN_EP, 8, usb_rpt); // release + } + + if (data[0] == 0xA1) + { + memcpy(usb_rpt, data + 1, len > 4 ? 4 : len - 1); + state = usbd_hid_send_report(MOUSE_IN_EP, 4, data + 1); + } + + DEBUG("USBD(sta:%x)", state); + debugHex(data, len); +} + +/// Uart Data procedure +void user_procedure(void) +{ + // Todo Loop-Proc + static uint8_t null_cnt = 0; + uint16_t len; + + len = uart1Rb_Read(&buff[buff_len], BLE_MAX_LEN - buff_len); + if (len > 0) + { + buff_len += len; + if (buff_len < BLE_MAX_LEN) + { + return; // wait full + } + } + else + { + if ((buff_len > 0) && (null_cnt++ > NULL_CNT)) + { + //finish = true; + null_cnt = 0; + } + else + { + return; // wait again + } + } + + switch (buff[0]) + { + case CMD_USBD: + { + uint8_t mouse_report[4] = {0}; + mouse_report[1] = buff[1]; + uint8_t state = usbd_hid_send_report(MOUSE_IN_EP, 4, mouse_report); + + DEBUG("USBD(sta:%x)", state); + debugHex(buff, buff_len); + } break; + + default: + { + } break; + } + + buff_len = 0; +} diff --git a/projects/bleRemoteControl/Master/src/rf_vbg_cal.c b/projects/bleRemoteControl/Master/src/rf_vbg_cal.c new file mode 100644 index 0000000..9275bcb --- /dev/null +++ b/projects/bleRemoteControl/Master/src/rf_vbg_cal.c @@ -0,0 +1,53 @@ +uint16_t ft_rfbandgap_test(void) +{ + // coreldo replace aonldo + APBMISC->AON_PMU_CTRL.AON_PWR_SEL_RUN = 1; + + uint16_t adc_data = 0, trim_val = 0x10; + uint16_t max_rfbandgap_voleage = 0, min_rfbandgap_voleage = 0, rfbandgap_voleage = 0, coreldo_voltage = 0; + +#if 1//(DBG_MODE) + RF->ANA_TRIM.LDO_RX_TRIM = 0; + RF->ANAMISC_CTRL1.AT0_SEL = 0; + RF->ANA_PWR_CTRL.TEST_EN_LDO_IF = 1; + RF->DIG_CTRL.LDO_TEST_EN = 1; + RF->ANA_EN_CTRL.EN_BG = 1; + + GPIO->DIR_CLR = 1 << 18; + iom_ctrl(18, IOM_ANALOG); +#endif + +// coreldo_voltage = RD_32(CORELDO_VOLTAGE_ADDR); + coreldo_voltage = 1220;//1194;//get_trim_vdd12_voltage();//1200; + + max_rfbandgap_voleage = 1170 * 1024 / coreldo_voltage; + min_rfbandgap_voleage = 1130 * 1024 / coreldo_voltage; + rfbandgap_voleage = (max_rfbandgap_voleage + min_rfbandgap_voleage) >> 1; + + debug("0---max:%d, min:%d, rf_vbg:%d\r\n\r\n",max_rfbandgap_voleage, min_rfbandgap_voleage, rfbandgap_voleage); + sadc_init(SADC_ANA_VREF_1V2); + sadc_conf(SADC_CR_DFLT); + bootDelayMs(2); + + RF->RF_RSV |= 1 << 1; + + for (uint8_t step = 0x10; step > 0; step >>= 1) + { + RF->ANA_TRIM.BG_RES_TRIM = trim_val; + bootDelayMs(2); + + adc_data = sadc_read(15, 10); + debug("0---step:%02x, trim_val:%02X,adc:%d\r\n",step, trim_val,adc_data); + + if ((adc_data > min_rfbandgap_voleage) && (adc_data < max_rfbandgap_voleage)) + break; + + trim_val = trim_val + (step >> 1) - ((adc_data > rfbandgap_voleage) ? step : 0); + } + + RF->RF_RSV &= ~(1UL << 1); + + debug("0---trim_val:0x%02X\r\n\r\n",trim_val); + + return trim_val; +} \ No newline at end of file diff --git a/projects/bleRemoteControl/Master/src/usb_def.h b/projects/bleRemoteControl/Master/src/usb_def.h new file mode 100644 index 0000000..1b1c71d --- /dev/null +++ b/projects/bleRemoteControl/Master/src/usb_def.h @@ -0,0 +1,913 @@ +/** + **************************************************************************************** + * + * @file usb_def.h + * + * @brief Header file of USB Definitions(types and macros and structs) + * + **************************************************************************************** + */ + +#ifndef _USB_DEF_H +#define _USB_DEF_H + +#include + + +/******************************************************************************* + * CMSIS Util definitions + ******************************************************************************/ + +#if defined(__CC_ARM) +#ifndef __USED + #define __USED __attribute__((used)) +#endif +#ifndef __WEAK + #define __WEAK __attribute__((weak)) +#endif +#ifndef __PACKED + #define __PACKED __attribute__((packed)) +#endif +#ifndef __PACKED_STRUCT + #define __PACKED_STRUCT __packed struct +#endif +#ifndef __PACKED_UNION + #define __PACKED_UNION __packed union +#endif +#ifndef __ALIGNED + #define __ALIGNED(x) __attribute__((aligned(x))) +#endif +#elif defined(__GNUC__) +#ifndef __USED + #define __USED __attribute__((used)) +#endif +#ifndef __WEAK + #define __WEAK __attribute__((weak)) +#endif +#ifndef __PACKED + #define __PACKED __attribute__((packed, aligned(1))) +#endif +#ifndef __PACKED_STRUCT + #define __PACKED_STRUCT struct __attribute__((packed, aligned(1))) +#endif +#ifndef __PACKED_UNION + #define __PACKED_UNION union __attribute__((packed, aligned(1))) +#endif +#ifndef __ALIGNED + #define __ALIGNED(x) __attribute__((aligned(x))) +#endif +#elif defined(__ICCARM__) +#ifndef __USED +#if __ICCARM_V8 + #define __USED __attribute__((used)) +#else + #define __USED _Pragma("__root") +#endif +#endif + +#ifndef __WEAK +#if __ICCARM_V8 + #define __WEAK __attribute__((weak)) +#else + #define __WEAK _Pragma("__weak") +#endif +#endif + +#ifndef __PACKED +#if __ICCARM_V8 + #define __PACKED __attribute__((packed, aligned(1))) +#else + #define __PACKED __packed /* Needs IAR language extensions */ +#endif +#endif + +#ifndef __PACKED_STRUCT +#if __ICCARM_V8 + #define __PACKED_STRUCT struct __attribute__((packed, aligned(1))) +#else + #define __PACKED_STRUCT __packed struct /* Needs IAR language extensions */ +#endif +#endif + +#ifndef __PACKED_UNION +#if __ICCARM_V8 + #define __PACKED_UNION union __attribute__((packed, aligned(1))) +#else + #define __PACKED_UNION __packed union /* Needs IAR language extensions */ +#endif +#endif + +#ifndef __ALIGNED +#if __ICCARM_V8 + #define __ALIGNED(x) __attribute__((aligned(x))) +#elif (__VER__ >= 7080000) + #define __ALIGNED(x) __attribute__((aligned(x))) /* Needs IAR language extensions */ +#else + #warning No compiler specific solution for __ALIGNED.__ALIGNED is ignored. + #define __ALIGNED(x) +#endif +#endif + +#endif + +#ifndef __ALIGN_BEGIN + #define __ALIGN_BEGIN +#endif +#ifndef __ALIGN_END + #define __ALIGN_END __attribute__((aligned(4))) +#endif + +#define __USBIRQ __attribute__((section("usb_irq"))) +#define __USBDESC __attribute__((section("usb_desc"))) __USED __ALIGNED(1) + +// The unused argument @p x. +#ifndef ARG_UNUSED +#define ARG_UNUSED(x) (void)(x) +#endif +// The low byte of 16bits @p x. +#ifndef LO_BYTE +#define LO_BYTE(x) ((uint8_t)(x & 0x00FF)) +#endif +// The high byte of 16bits @p x. +#ifndef HI_BYTE +#define HI_BYTE(x) ((uint8_t)((x & 0xFF00) >> 8)) +#endif +// The larger value between @p a and @p b. +#ifndef MAX +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#endif +// The smaller value between @p a and @p b. +#ifndef MIN +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#endif +// The Binary-Coded Decimal @p x. +#ifndef BCD +#define BCD(x) ((((x) / 10) << 4) | ((x) % 10)) +#endif +// The bit of left-shift @p n. +#ifndef BIT +#define BIT(n) (1UL << (n)) +#endif +// The elements count in @p array. +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(array) ((sizeof(array) / sizeof((array)[0]))) +#endif +// Bytes swap @p u16. +#ifndef BSWAP16 +#define BSWAP16(u16) (__builtin_bswap16(u16)) +#endif +// Bytes swap @p u32. +#ifndef BSWAP32 +#define BSWAP32(u32) (__builtin_bswap32(u32)) +#endif + +// Get or Set BigEndian value +#define GET_BE16(field) \ + (((uint16_t)(field)[0] << 8) | ((uint16_t)(field)[1])) + +#define GET_BE32(field) \ + (((uint32_t)(field)[0] << 24) | ((uint32_t)(field)[1] << 16) | ((uint32_t)(field)[2] << 8) | ((uint32_t)(field)[3] << 0)) + +#define SET_BE16(field, value) \ + do { \ + (field)[0] = (uint8_t)((value) >> 8); \ + (field)[1] = (uint8_t)((value) >> 0); \ + } while (0) + +#define SET_BE24(field, value) \ + do { \ + (field)[0] = (uint8_t)((value) >> 16); \ + (field)[1] = (uint8_t)((value) >> 8); \ + (field)[2] = (uint8_t)((value) >> 0); \ + } while (0) + +#define SET_BE32(field, value) \ + do { \ + (field)[0] = (uint8_t)((value) >> 24); \ + (field)[1] = (uint8_t)((value) >> 16); \ + (field)[2] = (uint8_t)((value) >> 8); \ + (field)[3] = (uint8_t)((value) >> 0); \ + } while (0) + +// Convert value to byte elements. +#define WCHAR(c) (c & 0xFF), ((c >> 8) & 0xFF) +#define WBVAL(x) (x & 0xFF), ((x >> 8) & 0xFF) +#define DBVAL(x) (x & 0xFF), ((x >> 8) & 0xFF), ((x >> 16) & 0xFF), ((x >> 24) & 0xFF) + +// Type and index of the descriptor +#define GET_DESC_TYPE(x) (((x) >> 8) & 0xFF) +#define GET_DESC_INDEX(x) ((x) & 0xFF) + +// The Number of arguments, max 63. +#define PP_NARG(...) \ + PP_NARG_(__VA_ARGS__, PP_RSEQ_N()) +#define PP_NARG_(...) \ + PP_ARG_N(__VA_ARGS__) +#define PP_ARG_N( \ + _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \ + _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, \ + _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, \ + _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, \ + _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, \ + _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, \ + _61, _62, _63, N, ...) N +#define PP_RSEQ_N() \ + 63, 62, 61, 60, \ + 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, \ + 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, \ + 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, \ + 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, \ + 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, \ + 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 + + +/******************************************************************************* + * USB Core definitions + ******************************************************************************/ + +/**< maximum packet size (MPS) for EP 0~NUM */ +#ifndef USB_EP0_MPS + #define USB_EP0_MPS 64 +#endif + +#ifndef USB_EP_MPS + #define USB_EP_MPS 64 +#endif + +/* Version define */ +#define USB_1_1 0x0110 +#define USB_2_0 0x0200 +#define USB_2_1 0x0210 + +/* Device speeds */ +#define USB_SPEED_UNKNOWN 0 /* Transfer rate not yet set */ +#define USB_SPEED_LOW 1 /* USB 1.1 */ +#define USB_SPEED_FULL 2 /* USB 1.1 */ +#define USB_SPEED_HIGH 3 /* USB 2.0 */ +#define USB_SPEED_VARIABLE 4 /* Wireless USB 2.5 */ + +// USB PID Types +#define USB_PID_OUT (0x01) /* Tokens */ +#define USB_PID_IN (0x09) +#define USB_PID_SOF (0x05) +#define USB_PID_SETUP (0x0d) + +#define USB_PID_DATA0 (0x03) /* Data */ +#define USB_PID_DATA1 (0x0b) +#define USB_PID_DATA2 (0x07) +#define USB_PID_MDATA (0x0f) + +#define USB_PID_ACK (0x02) /* Handshake */ +#define USB_PID_NAK (0x0a) +#define USB_PID_STALL (0x0e) +#define USB_PID_NYET (0x06) + +#define USB_PID_PRE (0x0c) /* Special */ +#define USB_PID_ERR (0x0c) +#define USB_PID_SPLIT (0x08) +#define USB_PID_PING (0x04) +#define USB_PID_RESERVED (0x00) + +#define USB_REQUEST_DIR_LSB 7U /* Bits 7: Request dir */ +#define USB_REQUEST_DIR_OUT (0U << USB_REQUEST_DIR_LSB) /* Bit 7=0: Host-to-device */ +#define USB_REQUEST_DIR_IN (1U << USB_REQUEST_DIR_LSB) /* Bit 7=1: Device-to-host */ +#define USB_REQUEST_DIR_MASK (1U << USB_REQUEST_DIR_LSB) /* Bit 7=1: Direction bit */ + +#define USB_REQUEST_TYPE_LSB 5U /* Bits 5:6: Request type */ +#define USB_REQUEST_STANDARD (0U << USB_REQUEST_TYPE_LSB) +#define USB_REQUEST_CLASS (1U << USB_REQUEST_TYPE_LSB) +#define USB_REQUEST_VENDOR (2U << USB_REQUEST_TYPE_LSB) +#define USB_REQUEST_RESERVED (3U << USB_REQUEST_TYPE_LSB) +#define USB_REQUEST_TYPE_MASK (3U << USB_REQUEST_TYPE_LSB) + +#define USB_REQUEST_RECIP_LSB 0U /* Bits 0:4: Recipient */ +#define USB_REQUEST_RECIP_DEVICE (0U << USB_REQUEST_RECIP_LSB) +#define USB_REQUEST_RECIP_INTERFACE (1U << USB_REQUEST_RECIP_LSB) +#define USB_REQUEST_RECIP_ENDPOINT (2U << USB_REQUEST_RECIP_LSB) +#define USB_REQUEST_RECIP_OTHER (3U << USB_REQUEST_RECIP_LSB) +#define USB_REQUEST_RECIP_MASK (3U << USB_REQUEST_RECIP_LSB) + +/* USB Standard Request Codes */ +#define USB_REQUEST_GET_STATUS 0x00 +#define USB_REQUEST_CLEAR_FEATURE 0x01 +#define USB_REQUEST_SET_FEATURE 0x03 +#define USB_REQUEST_SET_ADDRESS 0x05 +#define USB_REQUEST_GET_DESCRIPTOR 0x06 +#define USB_REQUEST_SET_DESCRIPTOR 0x07 +#define USB_REQUEST_GET_CONFIGURATION 0x08 +#define USB_REQUEST_SET_CONFIGURATION 0x09 +#define USB_REQUEST_GET_INTERFACE 0x0A +#define USB_REQUEST_SET_INTERFACE 0x0B +#define USB_REQUEST_SYNCH_FRAME 0x0C +#define USB_REQUEST_SET_ENCRYPTION 0x0D +#define USB_REQUEST_GET_ENCRYPTION 0x0E +#define USB_REQUEST_RPIPE_ABORT 0x0E +#define USB_REQUEST_SET_HANDSHAKE 0x0F +#define USB_REQUEST_RPIPE_RESET 0x0F +#define USB_REQUEST_GET_HANDSHAKE 0x10 +#define USB_REQUEST_SET_CONNECTION 0x11 +#define USB_REQUEST_SET_SECURITY_DATA 0x12 +#define USB_REQUEST_GET_SECURITY_DATA 0x13 +#define USB_REQUEST_SET_WUSB_DATA 0x14 +#define USB_REQUEST_LOOPBACK_DATA_WRITE 0x15 +#define USB_REQUEST_LOOPBACK_DATA_READ 0x16 +#define USB_REQUEST_SET_INTERFACE_DS 0x17 + +/* USB Standard Feature selectors */ +#define USB_FEATURE_ENDPOINT_HALT 0 +#define USB_FEATURE_SELF_POWERED 0 +#define USB_FEATURE_REMOTE_WAKEUP 1 +#define USB_FEATURE_TEST_MODE 2 +#define USB_FEATURE_BATTERY 2 +#define USB_FEATURE_BHNPENABLE 3 +#define USB_FEATURE_WUSBDEVICE 3 +#define USB_FEATURE_AHNPSUPPORT 4 +#define USB_FEATURE_AALTHNPSUPPORT 5 +#define USB_FEATURE_DEBUGMODE 6 + +/* USB GET_STATUS Bit Values */ +#define USB_GETSTATUS_ENDPOINT_HALT 0x01 +#define USB_GETSTATUS_SELF_POWERED 0x01 +#define USB_GETSTATUS_REMOTE_WAKEUP 0x02 + +/* USB Descriptor Types */ +#define USB_DESC_TYPE_DEVICE 0x01U +#define USB_DESC_TYPE_CONFIGURATION 0x02U +#define USB_DESC_TYPE_STRING 0x03U +#define USB_DESC_TYPE_INTERFACE 0x04U +#define USB_DESC_TYPE_ENDPOINT 0x05U +#define USB_DESC_TYPE_DEVICE_QUALIFIER 0x06U +#define USB_DESC_TYPE_OTHER_SPEED 0x07U +#define USB_DESC_TYPE_INTERFACE_POWER 0x08U +#define USB_DESC_TYPE_OTG 0x09U +#define USB_DESC_TYPE_DEBUG 0x0AU +#define USB_DESC_TYPE_INTERFACE_ASSOCIATION 0x0BU +#define USB_DESC_TYPE_BINARY_OBJECT_STORE 0x0FU +#define USB_DESC_TYPE_DEVICE_CAPABILITY 0x10U +#define USB_DESC_TYPE_WIRELESS_ENDPOINTCOMP 0x11U + +/* Class Specific Descriptor */ +#define USB_CLASS_DESC_TYPE_DEVICE 0x21U +#define USB_CLASS_DESC_TYPE_CONFIGURATION 0x22U +#define USB_CLASS_DESC_TYPE_STRING 0x23U +#define USB_CLASS_DESC_TYPE_INTERFACE 0x24U +#define USB_CLASS_DESC_TYPE_ENDPOINT 0x25U + +#define USB_DESC_TYPE_SUPERSPEED_ENDPOINT_COMPANION 0x30U +#define USB_DESC_TYPE_SUPERSPEED_ISO_ENDPOINT_COMPANION 0x31U + +/* USB Device Classes */ +#define USB_DEVICE_CLASS_RESERVED 0x00 +#define USB_DEVICE_CLASS_AUDIO 0x01 +#define USB_DEVICE_CLASS_CDC 0x02 +#define USB_DEVICE_CLASS_HID 0x03 +#define USB_DEVICE_CLASS_MONITOR 0x04 +#define USB_DEVICE_CLASS_PHYSICAL 0x05 +#define USB_DEVICE_CLASS_IMAGE 0x06 +#define USB_DEVICE_CLASS_PRINTER 0x07 +#define USB_DEVICE_CLASS_MASS_STORAGE 0x08 +#define USB_DEVICE_CLASS_HUB 0x09 +#define USB_DEVICE_CLASS_CDC_DATA 0x0a +#define USB_DEVICE_CLASS_SMART_CARD 0x0b +#define USB_DEVICE_CLASS_SECURITY 0x0d +#define USB_DEVICE_CLASS_VIDEO 0x0e +#define USB_DEVICE_CLASS_HEALTHCARE 0x0f +#define USB_DEVICE_CLASS_DIAG_DEVICE 0xdc +#define USB_DEVICE_CLASS_WIRELESS 0xe0 +#define USB_DEVICE_CLASS_MISC 0xef +#define USB_DEVICE_CLASS_APP_SPECIFIC 0xfe +#define USB_DEVICE_CLASS_VEND_SPECIFIC 0xff + +/* usb string index define */ +#define USB_STRING_LANGID_INDEX 0x00 +#define USB_STRING_MFC_INDEX 0x01 +#define USB_STRING_PRODUCT_INDEX 0x02 +#define USB_STRING_SERIAL_INDEX 0x03 +#define USB_STRING_CONFIG_INDEX 0x04 +#define USB_STRING_INTERFACE_INDEX 0x05 +#define USB_STRING_OS_INDEX 0x06 +#define USB_STRING_MAX USB_STRING_OS_INDEX +/* + * Devices supporting Microsoft OS Descriptors store special string + * descriptor at fixed index (0xEE). It is read when a new device is + * attached to a computer for the first time. + */ +#define USB_OSDESC_STRING_DESC_INDEX 0xEE + +/* bmAttributes in Configuration Descriptor */ +#define USB_CONFIG_REMOTE_WAKEUP 0x20 +#define USB_CONFIG_POWERED_MASK 0x40 +#define USB_CONFIG_BUS_POWERED 0x80 +#define USB_CONFIG_SELF_POWERED 0xC0 + +/* bMaxPower in Configuration Descriptor */ +#define USB_CONFIG_POWER_MA(mA) ((mA) / 2) + +/* bEndpointAddress in Endpoint Descriptor */ +#define USB_EP_DIR_MASK 0x80 +#define USB_EP_DIR_IN 0x80 +#define USB_EP_DIR_OUT 0x00 +#define USB_EP_OUT(idx) ((idx) | USB_EP_DIR_OUT) +#define USB_EP_IN(idx) ((idx) | USB_EP_DIR_IN) + +/** + * USB endpoint direction and number. + */ +/** Get endpoint index (number) from endpoint address */ +#define USB_EP_GET_IDX(ep) ((ep) & ~USB_EP_DIR_MASK) +/** Get direction from endpoint address */ +#define USB_EP_GET_DIR(ep) ((ep) & USB_EP_DIR_MASK) +/** Get endpoint address from endpoint index and direction */ +#define USB_EP_GET_ADDR(idx, dir) ((idx) | ((dir) & USB_EP_DIR_MASK)) +/** True if the endpoint is an IN endpoint */ +#define USB_EP_DIR_IS_IN(ep) (USB_EP_GET_DIR(ep) == USB_EP_DIR_IN) +/** True if the endpoint is an OUT endpoint */ +#define USB_EP_DIR_IS_OUT(ep) (USB_EP_GET_DIR(ep) == USB_EP_DIR_OUT) + +/* bmAttributes in Endpoint Descriptor */ +#define USB_EP_TYPE_LSB 0 +#define USB_EP_TYPE_CONTROL (0 << USB_EP_TYPE_LSB) +#define USB_EP_TYPE_ISOCHRONOUS (1 << USB_EP_TYPE_LSB) +#define USB_EP_TYPE_BULK (2 << USB_EP_TYPE_LSB) +#define USB_EP_TYPE_INTERRUPT (3 << USB_EP_TYPE_LSB) +#define USB_EP_TYPE_MASK (3 << USB_EP_TYPE_LSB) + +#define USB_EP_SYNC_LSB 2 +#define USB_EP_SYNC_NO_SYNCHRONIZATION (0 << USB_EP_SYNC_LSB) +#define USB_EP_SYNC_ASYNCHRONOUS (1 << USB_EP_SYNC_LSB) +#define USB_EP_SYNC_ADAPTIVE (2 << USB_EP_SYNC_LSB) +#define USB_EP_SYNC_SYNCHRONOUS (3 << USB_EP_SYNC_LSB) +#define USB_EP_SYNC_MASK (3 << USB_EP_SYNC_LSB) + +#define USB_EP_USAGE_LSB 4 +#define USB_EP_USAGE_DATA (0 << USB_EP_USAGE_LSB) +#define USB_EP_USAGE_FEEDBACK (1 << USB_EP_USAGE_LSB) +#define USB_EP_USAGE_IMPLICIT_FEEDBACK (2 << USB_EP_USAGE_LSB) +#define USB_EP_USAGE_MASK (3 << USB_EP_USAGE_LSB) + +#define USB_EP_MAX_ADJUSTABLE (1 << 7) + +/* wMaxPacketSize in Endpoint Descriptor */ +#define USB_MAXPACKETSIZE_LSB 0 +#define USB_MAXPACKETSIZE_MASK (0x7ff << USB_MAXPACKETSIZE_LSB) +#define USB_MAXPACKETSIZE_EXTRA_TRANSCATION_LSB 11 +#define USB_MAXPACKETSIZE_EXTRA_TRANSCATION_NONE (0 << USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_LSB) +#define USB_MAXPACKETSIZE_EXTRA_TRANSCATION_ONE (1 << USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_LSB) +#define USB_MAXPACKETSIZE_EXTRA_TRANSCATION_TWO (2 << USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_LSB) +#define USB_MAXPACKETSIZE_EXTRA_TRANSCATION_MASK (3 << USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_LSB) + +/* bDevCapabilityType in Device Capability Descriptor */ +#define USB_DEVICE_CAP_WIRELESS_USB 1 +#define USB_DEVICE_CAP_USB_2_0_EXTENSION 2 +#define USB_DEVICE_CAP_SUPERSPEED_USB 3 +#define USB_DEVICE_CAP_CONTAINER_ID 4 +#define USB_DEVICE_CAP_PLATFORM 5 +#define USB_DEVICE_CAP_POWER_DELIVERY_CAPABILITY 6 +#define USB_DEVICE_CAP_BATTERY_INFO_CAPABILITY 7 +#define USB_DEVICE_CAP_PD_CONSUMER_PORT_CAPABILITY 8 +#define USB_DEVICE_CAP_PD_PROVIDER_PORT_CAPABILITY 9 +#define USB_DEVICE_CAP_SUPERSPEED_PLUS 10 +#define USB_DEVICE_CAP_PRECISION_TIME_MEASUREMENT 11 +#define USB_DEVICE_CAP_WIRELESS_USB_EXT 12 + +#define USB_BOS_CAP_EXTENSION 0x02 +#define USB_BOS_CAP_PLATFORM 0x05 + +/* OTG SET FEATURE Constants */ +#define USB_OTG_FEATURE_B_HNP_ENABLE 3 /* Enable B device to perform HNP */ +#define USB_OTG_FEATURE_A_HNP_SUPPORT 4 /* A device supports HNP */ +#define USB_OTG_FEATURE_A_ALT_HNP_SUPPORT 5 /* Another port on the A device supports HNP */ + +/* WinUSB Microsoft OS 2.0 descriptor request codes */ +#define WINUSB_REQUEST_GET_DESCRIPTOR_SET 0x07 +#define WINUSB_REQUEST_SET_ALT_ENUM 0x08 + +/* WinUSB Microsoft OS 2.0 descriptor sizes */ +#define WINUSB_DESCRIPTOR_SET_HEADER_SIZE 10 +#define WINUSB_FUNCTION_SUBSET_HEADER_SIZE 8 +#define WINUSB_FEATURE_COMPATIBLE_ID_SIZE 20 + +/* WinUSB Microsoft OS 2.0 Descriptor Types */ +#define WINUSB_SET_HEADER_DESCRIPTOR_TYPE 0x00 +#define WINUSB_SUBSET_HEADER_CONFIGURATION_TYPE 0x01 +#define WINUSB_SUBSET_HEADER_FUNCTION_TYPE 0x02 +#define WINUSB_FEATURE_COMPATIBLE_ID_TYPE 0x03 +#define WINUSB_FEATURE_REG_PROPERTY_TYPE 0x04 +#define WINUSB_FEATURE_MIN_RESUME_TIME_TYPE 0x05 +#define WINUSB_FEATURE_MODEL_ID_TYPE 0x06 +#define WINUSB_FEATURE_CCGP_DEVICE_TYPE 0x07 + +#define WINUSB_PROP_DATA_TYPE_REG_SZ 0x01 +#define WINUSB_PROP_DATA_TYPE_REG_MULTI_SZ 0x07 + +/* WebUSB Descriptor Types */ +#define WEBUSB_DESCRIPTOR_SET_HEADER_TYPE 0x00 +#define WEBUSB_CONFIGURATION_SUBSET_HEADER_TYPE 0x01 +#define WEBUSB_FUNCTION_SUBSET_HEADER_TYPE 0x02 +#define WEBUSB_URL_TYPE 0x03 + +/* WebUSB Request Codes */ +#define WEBUSB_REQUEST_GET_URL 0x02 + +/* bScheme in URL descriptor */ +#define WEBUSB_URL_SCHEME_HTTP 0x00 +#define WEBUSB_URL_SCHEME_HTTPS 0x01 + +/* WebUSB Descriptor sizes */ +#define WEBUSB_DESCRIPTOR_SET_HEADER_SIZE 5 +#define WEBUSB_CONFIGURATION_SUBSET_HEADER_SIZE 4 +#define WEBUSB_FUNCTION_SUBSET_HEADER_SIZE 3 + + +/* Setup packet definition used to read raw data from USB line */ +struct usb_setup_packet { + /** Request type. Bits 0:4 determine recipient, see + * \ref usb_request_recipient. Bits 5:6 determine type, see + * \ref usb_request_type. Bit 7 determines data transfer direction, see + * \ref usb_endpoint_direction. + */ + uint8_t bmRequestType; + + /** Request. If the type bits of bmRequestType are equal to + * \ref usb_request_type::LIBUSB_REQUEST_TYPE_STANDARD + * "USB_REQUEST_TYPE_STANDARD" then this field refers to + * \ref usb_standard_request. For other cases, use of this field is + * application-specific. */ + uint8_t bRequest; + + /** Value. Varies according to request */ + uint16_t wValue; + + /** Index. Varies according to request, typically used to pass an index + * or offset */ + uint16_t wIndex; + + /** Number of bytes to transfer */ + uint16_t wLength; +} __PACKED; + +#define USB_SETUP_PACKET_SIZE 8 + +/** USB descriptor header */ +struct usb_desc_header { + uint8_t bLength; /* descriptor length */ + uint8_t bDescriptorType; /* descriptor type */ +}; + +/** Standard Device Descriptor */ +struct usb_device_descriptor { + uint8_t bLength; /* Descriptor size in bytes = 18 */ + uint8_t bDescriptorType; /* DEVICE descriptor type = 1 */ + uint16_t bcdUSB; /* USB spec in BCD, e.g. 0x0200 */ + uint8_t bDeviceClass; /* Class code, if 0 see interface */ + uint8_t bDeviceSubClass; /* Sub-Class code, 0 if class = 0 */ + uint8_t bDeviceProtocol; /* Protocol, if 0 see interface */ + uint8_t bMaxPacketSize0; /* Endpoint 0 max. size */ + uint16_t idVendor; /* Vendor ID per USB-IF */ + uint16_t idProduct; /* Product ID per manufacturer */ + uint16_t bcdDevice; /* Device release # in BCD */ + uint8_t iManufacturer; /* Index to manufacturer string */ + uint8_t iProduct; /* Index to product string */ + uint8_t iSerialNumber; /* Index to serial number string */ + uint8_t bNumConfigurations; /* Number of possible configurations */ +} __PACKED; + +#define USB_DEVICE_DESC_SIZE 18 + +/** Standard Configuration Descriptor */ +struct usb_configuration_descriptor { + uint8_t bLength; /* Descriptor size in bytes = 9 */ + uint8_t bDescriptorType; /* CONFIGURATION type = 2 or 7 */ + uint16_t wTotalLength; /* Length of concatenated descriptors */ + uint8_t bNumInterfaces; /* Number of interfaces, this config. */ + uint8_t bConfigurationValue; /* Value to set this config. */ + uint8_t iConfiguration; /* Index to configuration string */ + uint8_t bmAttributes; /* Config. characteristics */ + uint8_t bMaxPower; /* Max.power from bus, 2mA units */ +} __PACKED; + +#define USB_CONFIG_DESC_SIZE 9 + +/** Standard Interface Descriptor */ +struct usb_interface_descriptor { + uint8_t bLength; /* Descriptor size in bytes = 9 */ + uint8_t bDescriptorType; /* INTERFACE descriptor type = 4 */ + uint8_t bInterfaceNumber; /* Interface no.*/ + uint8_t bAlternateSetting; /* Value to select this IF */ + uint8_t bNumEndpoints; /* Number of endpoints excluding 0 */ + uint8_t bInterfaceClass; /* Class code, 0xFF = vendor */ + uint8_t bInterfaceSubClass; /* Sub-Class code, 0 if class = 0 */ + uint8_t bInterfaceProtocol; /* Protocol, 0xFF = vendor */ + uint8_t iInterface; /* Index to interface string */ +} __PACKED; + +#define USB_INTERFACE_DESC_SIZE 9 + +/** Standard Endpoint Descriptor */ +struct usb_endpoint_descriptor { + uint8_t bLength; /* Descriptor size in bytes = 7 */ + uint8_t bDescriptorType; /* ENDPOINT descriptor type = 5 */ + uint8_t bEndpointAddress; /* Endpoint # 0 - 15 | IN/OUT */ + uint8_t bmAttributes; /* Transfer type */ + uint16_t wMaxPacketSize; /* Bits 10:0 = max. packet size */ + uint8_t bInterval; /* Polling interval in (micro) frames */ +} __PACKED; + +#define USB_ENDPOINT_DESC_SIZE 7 + +/** Unicode (UTF16LE) String Descriptor */ +struct usb_string_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint16_t bString; +} __PACKED; + +#define USB_STRING_LANGID_DESC_SIZE 4 + +/* USB Interface Association Descriptor */ +struct usb_interface_association_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bFirstInterface; + uint8_t bInterfaceCount; + uint8_t bFunctionClass; + uint8_t bFunctionSubClass; + uint8_t bFunctionProtocol; + uint8_t iFunction; +} __PACKED; + +#define USB_IAD_DESC_SIZE 8 + +/** USB device_qualifier descriptor */ +struct usb_device_qualifier_descriptor { + uint8_t bLength; /* Descriptor size in bytes = 10 */ + uint8_t bDescriptorType; /* DEVICE QUALIFIER type = 6 */ + uint16_t bcdUSB; /* USB spec in BCD, e.g. 0x0200 */ + uint8_t bDeviceClass; /* Class code, if 0 see interface */ + uint8_t bDeviceSubClass; /* Sub-Class code, 0 if class = 0 */ + uint8_t bDeviceProtocol; /* Protocol, if 0 see interface */ + uint8_t bMaxPacketSize; /* Endpoint 0 max. size */ + uint8_t bNumConfigurations; /* Number of possible configurations */ + uint8_t bReserved; /* Reserved = 0 */ +} __PACKED; + +#define USB_DEVICE_QUALIFIER_DESC_SIZE 10 + +/* Microsoft OS function descriptor. + * This can be used to request a specific driver (such as WINUSB) to be + * loaded on Windows. Unlike other descriptors, it is requested by a special + * request USB_REQ_GETMSFTOSDESCRIPTOR. + * More details: + * https://msdn.microsoft.com/en-us/windows/hardware/gg463179 + * + * The device will have exactly one "Extended Compat ID Feature Descriptor", + * which may contain multiple "Function Descriptors" associated with + * different interfaces. + */ + +/* MS OS 1.0 string descriptor */ +struct usb_msosv1_string_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bString[14]; + uint8_t bMS_VendorCode; /* Vendor Code, used for a control request */ + uint8_t bPad; /* Padding byte for VendorCode look as UTF16 */ +} __PACKED; + +/* MS OS 1.0 Header descriptor */ +struct usb_msosv1_compat_id_header_descriptor { + uint32_t dwLength; + uint16_t bcdVersion; + uint16_t wIndex; + uint8_t bCount; + uint8_t reserved[7]; +} __PACKED; + +/* MS OS 1.0 Function descriptor */ +struct usb_msosv1_comp_id_function_descriptor { + uint8_t bFirstInterfaceNumber; + uint8_t reserved1; + uint8_t compatibleID[8]; + uint8_t subCompatibleID[8]; + uint8_t reserved2[6]; +} __PACKED; + +#define usb_msosv1_comp_id_create(x) \ + struct usb_msosv1_comp_id { \ + struct usb_msosv1_compat_id_header_descriptor compat_id_header; \ + struct usb_msosv1_comp_id_function_descriptor compat_id_function[x]; \ + }; + +struct usb_msosv1_descriptor { + uint8_t *string; + uint8_t string_len; + uint8_t vendor_code; + uint8_t *compat_id; + uint16_t compat_id_len; + uint8_t *comp_id_property; + uint16_t comp_id_property_len; +}; + +/* MS OS 2.0 Header descriptor */ +struct usb_msosv2_header_descriptor { + uint32_t dwLength; + uint16_t bcdVersion; + uint16_t wIndex; + uint8_t bCount; +} __PACKED; + +/*Microsoft OS 2.0 set header descriptor*/ +struct usb_msosv2_set_header_descriptor { + uint16_t wLength; + uint16_t wDescriptorType; + uint32_t dwWindowsVersion; + uint16_t wDescriptorSetTotalLength; +} __PACKED; + +/* Microsoft OS 2.0 compatibleID descriptor*/ +struct usb_msosv2_comp_id_descriptor { + uint16_t wLength; + uint16_t wDescriptorType; + uint8_t compatibleID[8]; + uint8_t subCompatibleID[8]; +} __PACKED; + +/* MS OS 2.0 property descriptor */ +struct usb_msosv2_property_descriptor { + uint16_t wLength; + uint16_t wDescriptorType; + uint32_t dwPropertyDataType; + uint16_t wPropertyNameLength; + const char *bPropertyName; + uint32_t dwPropertyDataLength; + const char *bPropertyData; +}; + +/* Microsoft OS 2.0 subset function descriptor */ +struct usb_msosv2_subset_function_descriptor { + uint16_t wLength; + uint16_t wDescriptorType; + uint8_t bFirstInterface; + uint8_t bReserved; + uint16_t wSubsetLength; +} __PACKED; + +struct usb_msosv2_descriptor { + uint8_t *compat_id; + uint16_t compat_id_len; + uint8_t vendor_code; +}; + +/* BOS header Descriptor */ +struct usb_bos_header_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint16_t wTotalLength; + uint8_t bNumDeviceCaps; +} __PACKED; + +/* BOS Capability platform Descriptor */ +struct usb_bos_capability_platform_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bDevCapabilityType; + uint8_t bReserved; + uint8_t PlatformCapabilityUUID[16]; +} __PACKED; + +/* BOS Capability MS OS Descriptors version 2 */ +struct usb_bos_capability_msosv2_descriptor { + uint32_t dwWindowsVersion; + uint16_t wMSOSDescriptorSetTotalLength; + uint8_t bVendorCode; + uint8_t bAltEnumCode; +} __PACKED; + +/* BOS Capability webusb */ +struct usb_bos_capability_webusb_descriptor { + uint16_t bcdVersion; + uint8_t bVendorCode; + uint8_t iLandingPage; +} __PACKED; + +/* BOS Capability extension Descriptor*/ +struct usb_bos_capability_extension_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bDevCapabilityType; + uint32_t bmAttributes; +} __PACKED; + +/* Microsoft OS 2.0 Platform Capability Descriptor */ +struct usb_bos_capability_platform_msosv2_descriptor { + struct usb_bos_capability_platform_descriptor platform_msos; + struct usb_bos_capability_msosv2_descriptor data_msosv2; +} __PACKED; + +/* WebUSB Platform Capability Descriptor */ +struct usb_bos_capability_platform_webusb_descriptor { + struct usb_bos_capability_platform_descriptor platform_webusb; + struct usb_bos_capability_webusb_descriptor data_webusb; +} __PACKED; + +struct usb_webusb_url_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bScheme; + char URL[]; +} __PACKED; + +struct usb_bos_descriptor { + uint8_t *string; + uint16_t string_len; +}; + +/* USB Device Capability Descriptor */ +struct usb_device_capability_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bDevCapabilityType; +} __PACKED; + + +/* Macro for USB Device Descriptor */ +#define USB_DEVICE_DESCRIPTOR_INIT(bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, idVendor, idProduct, bcdDevice, bNumConfigurations) \ + 0x12, /* bLength */ \ + USB_DESC_TYPE_DEVICE, /* bDescriptorType */ \ + WBVAL(bcdUSB), /* bcdUSB */ \ + bDeviceClass, /* bDeviceClass */ \ + bDeviceSubClass, /* bDeviceSubClass */ \ + bDeviceProtocol, /* bDeviceProtocol */ \ + USB_EP0_MPS, /* bMaxPacketSize */ \ + WBVAL(idVendor), /* idVendor */ \ + WBVAL(idProduct), /* idProduct */ \ + WBVAL(bcdDevice), /* bcdDevice */ \ + USB_STRING_MFC_INDEX, /* iManufacturer */ \ + USB_STRING_PRODUCT_INDEX, /* iProduct */ \ + 0/*USB_STRING_SERIAL_INDEX*/, /* iSerial */ \ + bNumConfigurations /* bNumConfigurations */ + +/* Macro for USB Configuration Descriptor */ +#define USB_CONFIG_DESCRIPTOR_INIT(wTotalLength, bNumInterfaces, bConfigurationValue, bmAttributes, bMaxPower) \ + 0x09, /* bLength */ \ + USB_DESC_TYPE_CONFIGURATION, /* bDescriptorType */ \ + WBVAL(wTotalLength), /* wTotalLength */ \ + bNumInterfaces, /* bNumInterfaces */ \ + bConfigurationValue, /* bConfigurationValue */ \ + 0x00, /* iConfiguration */ \ + bmAttributes, /* bmAttributes */ \ + USB_CONFIG_POWER_MA(bMaxPower) /* bMaxPower */ + +/* Macro for USB Interface Descriptor */ +#define USB_INTERFACE_DESCRIPTOR_INIT(bInterfaceNumber, bAlternateSetting, bNumEndpoints, \ + bInterfaceClass, bInterfaceSubClass, bInterfaceProtocol, iInterface) \ + 0x09, /* bLength */ \ + USB_DESC_TYPE_INTERFACE, /* bDescriptorType */ \ + bInterfaceNumber, /* bInterfaceNumber */ \ + bAlternateSetting, /* bAlternateSetting */ \ + bNumEndpoints, /* bNumEndpoints */ \ + bInterfaceClass, /* bInterfaceClass */ \ + bInterfaceSubClass, /* bInterfaceSubClass */ \ + bInterfaceProtocol, /* bInterfaceProtocol */ \ + iInterface /* iInterface */ + +/* Macro for USB Endpoint Descriptor */ +#define USB_EP_DESCRIPTOR_INIT(bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval) \ + 0x07, /* bLength */ \ + USB_DESC_TYPE_ENDPOINT, /* bDescriptorType */ \ + bEndpointAddress, /* bEndpointAddress */ \ + bmAttributes, /* bmAttributes */ \ + WBVAL(wMaxPacketSize), /* wMaxPacketSize */ \ + bInterval /* bInterval */ + +/* Macro for USB Interface Association Descriptor */ +#define USB_IAD_INIT(bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass, bFunctionProtocol) \ + 0x08, /* bLength */ \ + USB_DESC_TYPE_INTERFACE_ASSOCIATION, /* bDescriptorType */ \ + bFirstInterface, /* bFirstInterface */ \ + bInterfaceCount, /* bInterfaceCount */ \ + bFunctionClass, /* bFunctionClass */ \ + bFunctionSubClass, /* bFunctionSubClass */ \ + bFunctionProtocol, /* bFunctionProtocol */ \ + 0x00 /* iFunction */ + +/* Macro for USB LangID Descriptor */ +#define USB_LANGID_INIT(id) \ + 0x04, /* bLength */ \ + USB_DESC_TYPE_STRING, /* bDescriptorType */ \ + WBVAL(id) /* wLangID0 */ + +/* Macro for USB Device Qualifier Descriptor(usb2.0) */ +#define USB_QUALIFIER_INIT(bNumConfigurations) \ + 0x0A, /* bLength */ \ + USB_DESC_TYPE_DEVICE_QUALIFIER, /* bDescriptorType */ \ + 0x00, 0x02, /* bcdUSB */ \ + 0x00, /* bDeviceClass */ \ + 0x00, /* bDeviceSubClass */ \ + 0x00, /* bDeviceProtocol */ \ + USB_EP0_MPS, /* bMaxPacketSize */ \ + bNumConfigurations, /* bNumConfigurations */ \ + 0 /* bReserved */ + + +#endif // _USB_DEF_H diff --git a/projects/bleRemoteControl/Master/src/usb_hid.h b/projects/bleRemoteControl/Master/src/usb_hid.h new file mode 100644 index 0000000..bdfbeee --- /dev/null +++ b/projects/bleRemoteControl/Master/src/usb_hid.h @@ -0,0 +1,716 @@ +/** + **************************************************************************************** + * + * @file usb_hid.h + * + * @brief Human Interface Device (HID) Class public header + * + * Header follows Device Class Definition for Human Interface Devices (HID) + * Version 1.11 document (HID1_11-1.pdf). + **************************************************************************************** + */ + +#ifndef _USB_HID_H_ +#define _USB_HID_H_ + +#include "usb_def.h" + +/* Subclass codes (HID 4.2) */ +#define HID_SUBCLASS_NONE 0 /* No subclass */ +#define HID_SUBCLASS_BOOTIF 1 /* Boot Interface Subclass */ + +/* HID Protocol Codes (HID 4.3) */ +#define HID_PROTOCOL_NONE 0x00 +#define HID_PROTOCOL_BOOT 0x00 +#define HID_PROTOCOL_KEYBOARD 0x01 +#define HID_PROTOCOL_REPORT 0x01 +#define HID_PROTOCOL_MOUSE 0x02 + +/* HID Class Descriptor Types (HID 7.1) */ +#define HID_DESC_TYPE_HID 0x21 +#define HID_DESC_TYPE_HID_REPORT 0x22 +#define HID_DESC_TYPE_HID_PHYSICAL 0x23 + +/* HID Class Specific Requests (HID 7.2) */ +#define HID_REQUEST_GET_REPORT 0x01 +#define HID_REQUEST_GET_IDLE 0x02 +#define HID_REQUEST_GET_PROTOCOL 0x03 +#define HID_REQUEST_SET_REPORT 0x09 +#define HID_REQUEST_SET_IDLE 0x0A +#define HID_REQUEST_SET_PROTOCOL 0x0B + +/* Report Type (MS byte of wValue for GET_REPORT) (HID 7.2.1) */ +#define HID_REPORT_INPUT 0x01 +#define HID_REPORT_OUTPUT 0x02 +#define HID_REPORT_FEATURE 0x03 + +/* HID Descriptor ***********************************************************/ + +#define HID_COUNTRY_NONE 0x00 /* Not Supported */ +#define HID_COUNTRY_ARABIC 0x01 /* Arabic */ +#define HID_COUNTRY_BELGIAN 0x02 /* Belgian */ +#define HID_COUNTRY_CANADA 0x03 /* Canadian-Bilingual */ +#define HID_COUNTRY_CANADRFR 0x04 /* Canadian-French */ +#define HID_COUNTRY_CZECH 0x05 /* Czech Republic */ +#define HID_COUNTRY_DANISH 0x06 /* Danish */ +#define HID_COUNTRY_FINNISH 0x07 /* Finnish */ +#define HID_COUNTRY_FRENCH 0x08 /* French */ +#define HID_COUNTRY_GERMAN 0x09 /* German */ +#define HID_COUNTRY_GREEK 0x10 /* Greek */ +#define HID_COUNTRY_HEBREW 0x11 /* Hebrew */ +#define HID_COUNTRY_HUNGARY 0x12 /* Hungary */ +#define HID_COUNTRY_ISO 0x13 /* International (ISO) */ +#define HID_COUNTRY_ITALIAN 0x14 /* Italian */ +#define HID_COUNTRY_JAPAN 0x15 /* Japan (Katakana) */ +#define HID_COUNTRY_KOREAN 0x16 /* Korean */ +#define HID_COUNTRY_LATINAM 0x17 /* Latin American */ +#define HID_COUNTRY_DUTCH 0x18 /* Netherlands/Dutch */ +#define HID_COUNTRY_NORWEGIAN 0x19 /* Norwegian */ +#define HID_COUNTRY_PERSIAN 0x20 /* Persian (Farsi) */ +#define HID_COUNTRY_POLAND 0x21 /* Poland */ +#define HID_COUNTRY_PORTUGUESE 0x22 /* Portuguese */ +#define HID_COUNTRY_RUSSIA 0x23 /* Russia */ +#define HID_COUNTRY_SLOVAKIA 0x24 /* Slovakia */ +#define HID_COUNTRY_SPANISH 0x25 /* Spanish */ +#define HID_COUNTRY_SWEDISH 0x26 /* Swedish */ +#define HID_COUNTRY_SWISSFR 0x27 /* Swiss/French */ +#define HID_COUNTRY_SWISSGR 0x28 /* Swiss/German */ +#define HID_COUNTRY_SWITZERLAND 0x29 /* Switzerland */ +#define HID_COUNTRY_TAIWAN 0x30 /* Taiwan */ +#define HID_COUNTRY_TURKISHQ 0x31 /* Turkish-Q */ +#define HID_COUNTRY_UK 0x32 /* UK */ +#define HID_COUNTRY_US 0x33 /* US */ +#define HID_COUNTRY_YUGOSLAVIA 0x34 /* Yugoslavia */ +#define HID_COUNTRY_TURKISHF 0x35 /* Turkish-F */ + +/* HID report items */ +#define HID_REPORT_ITEM_SIZE_MASK 0x03 +#define HID_REPORT_ITEM_SIZE_0 0x00 /* No data follows */ +#define HID_REPORT_ITEM_SIZE_1 0x01 /* 1 byte of data follows */ +#define HID_REPORT_ITEM_SIZE_2 0x02 /* 2 bytes of data follow */ +#define HID_REPORT_ITEM_SIZE_4 0x03 /* 4 bytes of data follow */ +#define HID_REPORT_ITEM_TYPE_MASK 0x0c +#define HID_REPORT_ITEM_TYPE_MAIN 0x00 +#define HID_REPORT_ITEM_TYPE_GLOBAL 0x04 +#define HID_REPORT_ITEM_TYPE_LOCAL 0x08 +#define HID_REPORT_ITEM_TAG_MASK 0xf0 + +/* Main Items (HID 6.2.2.4) */ +#define HID_MAIN_ITEM_CONSTANT (1 << 0) /* Constant(1) vs Data(0) */ +#define HID_MAIN_ITEM_VARIABLE (1 << 1) /* Variable(1) vs Array(0) */ +#define HID_MAIN_ITEM_RELATIVE (1 << 2) /* Relative(1) vs Absolute(0) */ +#define HID_MAIN_ITEM_WRAP (1 << 3) /* Wrap(1) vs No Wrap(0) */ +#define HID_MAIN_ITEM_NONLINEAR (1 << 4) /* Non Linear(1) vs Linear(0) */ +#define HID_MAIN_ITEM_NOPREFERRED (1 << 5) /* No Preferred (1) vs Preferred State(0) */ +#define HID_MAIN_ITEM_NULLSTATE (1 << 6) /* Null state(1) vs No Null position(0) */ +#define HID_MAIN_ITEM_VOLATILE (1 << 7) /* Volatile(1) vs Non volatile(0) */ +#define HID_MAIN_ITEM_BUFFEREDBYTES (1 << 8) /* Buffered Bytes(1) vs Bit Field(0) */ + +#define HID_MAIN_ITEM_SIZE(pfx) ((pfx)&HID_REPORT_ITEM_SIZE_MASK) +#define HID_MAIN_ITEM_INPUT_PREFIX 0x80 +#define HID_MAIN_ITEM_INPUT_CONSTANT HID_MAIN_ITEM_CONSTANT +#define HID_MAIN_ITEM_INPUT_VARIABLE HID_MAIN_ITEM_VARIABLE +#define HID_MAIN_ITEM_INPUT_RELATIVE HID_MAIN_ITEM_RELATIVE +#define HID_MAIN_ITEM_INPUT_WRAP HID_MAIN_ITEM_WRAP +#define HID_MAIN_ITEM_INPUT_NONLINEAR HID_MAIN_ITEM_NONLINEAR +#define HID_MAIN_ITEM_INPUT_NOPREFERRED HID_MAIN_ITEM_NOPREFERRED +#define HID_MAIN_ITEM_INPUT_NULLSTATE HID_MAIN_ITEM_NULLSTATE +#define HID_MAIN_ITEM_INPUT_BUFFEREDBYTES HID_MAIN_ITEM_BUFFEREDBYTES + +#define HID_MAIN_ITEM_OUTPUT_PREFIX 0x90 +#define HID_MAIN_ITEM_OUTPUT_CONSTANT HID_MAIN_ITEM_CONSTANT +#define HID_MAIN_ITEM_OUTPUT_VARIABLE HID_MAIN_ITEM_VARIABLE +#define HID_MAIN_ITEM_OUTPUT_RELATIVE HID_MAIN_ITEM_RELATIVE +#define HID_MAIN_ITEM_OUTPUT_WRAP HID_MAIN_ITEM_WRAP +#define HID_MAIN_ITEM_OUTPUT_NONLINEAR HID_MAIN_ITEM_NONLINEAR +#define HID_MAIN_ITEM_OUTPUT_NOPREFERRED HID_MAIN_ITEM_NOPREFERRED +#define HID_MAIN_ITEM_OUTPUT_NULLSTATE HID_MAIN_ITEM_NULLSTATE +#define HID_MAIN_ITEM_OUTPUT_VOLATILE HID_MAIN_ITEM_VOLATILE +#define HID_MAIN_ITEM_OUTPUT_BUFFEREDBYTES HID_MAIN_ITEM_BUFFEREDBYTES + +#define HID_MAIN_ITEM_FEATURE_PREFIX 0xb0 +#define HID_MAIN_ITEM_FEATURE_CONSTANT HID_MAIN_ITEM_CONSTANT +#define HID_MAIN_ITEM_FEATURE_VARIABLE HID_MAIN_ITEM_VARIABLE +#define HID_MAIN_ITEM_FEATURE_RELATIVE HID_MAIN_ITEM_RELATIVE +#define HID_MAIN_ITEM_FEATURE_WRAP HID_MAIN_ITEM_WRAP +#define HID_MAIN_ITEM_FEATURE_NONLINEAR HID_MAIN_ITEM_NONLINEAR +#define HID_MAIN_ITEM_FEATURE_NOPREFERRED HID_MAIN_ITEM_NOPREFERRED +#define HID_MAIN_ITEM_FEATURE_NULLSTATE HID_MAIN_ITEM_NULLSTATE +#define HID_MAIN_ITEM_FEATURE_VOLATILE HID_MAIN_ITEM_VOLATILE +#define HID_MAIN_ITEM_FEATURE_BUFFEREDBYTES HID_MAIN_ITEM_BUFFEREDBYTES + +#define HID_MAIN_ITEM_COLLECTION_PREFIX 0xa0 +#define HID_MAIN_ITEM_COLLECTION_PHYSICAL 0x00 /* Physical (group of axes) */ +#define HID_MAIN_ITEM_COLLECTION_APPL 0x01 /* Application (mouse, keyboard) */ +#define HID_MAIN_ITEM_COLLECTION_LOGICAL 0x02 /* Logical (interrelated data) */ +#define HID_MAIN_ITEM_COLLECTION_REPORT 0x03 /* Report */ +#define HID_MAIN_ITEM_COLLECTION_ARRAY 0x04 /* Named Array */ +#define HID_MAIN_ITEM_COLLECTION_SWITCH 0x05 /* Usage Switch */ +#define HID_MAIN_ITEM_COLLECTION_MODIFIER 0x06 /* Usage Modifier */ +#define HID_MAIN_ITEM_ENDCOLLECTION_PREFIX 0xc0 + +/* Global Items (HID 6.2.2.7) */ +#define HID_GLOBAL_ITEM_SIZE(pfx) ((pfx)&HID_REPORT_ITEM_SIZE_MASK) +#define HID_GLOBAL_ITEM_USAGEPAGE_PREFIX 0x04 /* Usage Page */ +#define HID_GLOBAL_ITEM_LOGICALMIN_PREFIX 0x14 /* Logical Minimum */ +#define HID_GLOBAL_ITEM_LOGICALMAX_PREFIX 0x24 /* Logical Maximum */ +#define HID_GLOBAL_ITEM_PHYSICALMIN_PREFIX 0x34 /* Physical Minimum */ +#define HID_GLOBAL_ITEM_PHYSMICALAX_PREFIX 0x44 /* Physical Maximum */ +#define HID_GLOBAL_ITEM_UNITEXP_PREFIX 0x54 /* Unit Exponent */ +#define HID_GLOBAL_ITEM_UNIT_PREFIX 0x64 /* Unit */ +#define HID_GLOBAL_ITEM_REPORTSIZE_PREFIX 0x74 /* Report Size */ +#define HID_GLOBAL_ITEM_REPORTID_PREFIX 0x84 /* Report ID */ +#define HID_GLOBAL_ITEM_REPORTCOUNT_PREFIX 0x94 /* Report Count */ +#define HID_GLOBAL_ITEM_PUSH_PREFIX 0xa4 /* Push */ +#define HID_GLOBAL_ITEM_POP_PREFIX 0xb4 /* Pop */ + +/* Local Items (HID 6.2.2.8) */ +#define HID_LOCAL_ITEM_SIZE(pfx) ((pfx)&HID_REPORT_ITEM_SIZE_MASK) +#define HID_LOCAL_ITEM_USAGE_PREFIX 0x08 /* Usage */ +#define HID_LOCAL_ITEM_USAGEMIN_PREFIX 0x18 /* Usage Minimum */ +#define HID_LOCAL_ITEM_USAGEMAX_PREFIX 0x28 /* Usage Maximum */ +#define HID_LOCAL_ITEM_DESIGNATORIDX_PREFIX 0x38 /* Designator Index */ +#define HID_LOCAL_ITEM_DESIGNATORMIN_PREFIX 0x48 /* Designator Minimum */ +#define HID_LOCAL_ITEM_DESIGNATORMAX_PREFIX 0x58 /* Designator Maximum */ +#define HID_LOCAL_ITEM_STRINGIDX_PREFIX 0x78 /* String Index */ +#define HID_LOCAL_ITEM_STRINGMIN_PREFIX 0x88 /* String Minimum */ +#define HID_LOCAL_ITEM_STRINGMAX_PREFIX 0x98 /* xx */ +#define HID_LOCAL_ITEM_DELIMITER_PREFIX 0xa8 /* Delimiter */ + +/* Modifier Keys (HID 8.3) */ +#define HID_MODIFER_LCTRL (1 << 0) /* Left Ctrl */ +#define HID_MODIFER_LSHIFT (1 << 1) /* Left Shift */ +#define HID_MODIFER_LALT (1 << 2) /* Left Alt */ +#define HID_MODIFER_LGUI (1 << 3) /* Left GUI */ +#define HID_MODIFER_RCTRL (1 << 4) /* Right Ctrl */ +#define HID_MODIFER_RSHIFT (1 << 5) /* Right Shift */ +#define HID_MODIFER_RALT (1 << 6) /* Right Alt */ +#define HID_MODIFER_RGUI (1 << 7) /* Right GUI */ + +/* Keyboard output report (1 byte) (HID B.1) */ +#define HID_KBD_OUTPUT_REPORT_NUMLOCK (1 << 0) +#define HID_KBD_OUTPUT_REPORT_CAPSLOCK (1 << 1) +#define HID_KBD_OUTPUT_REPORT_SCROLLLOCK (1 << 2) +#define HID_KBD_OUTPUT_REPORT_COMPOSE (1 << 3) +#define HID_KBD_OUTPUT_REPORT_KANA (1 << 4) + +/* Mouse input report (HID B.2) */ +#define HID_MOUSE_INPUT_REPORT_BUTTON1 (1 << 0) +#define HID_MOUSE_INPUT_REPORT_BUTTON2 (1 << 1) +#define HID_MOUSE_INPUT_REPORT_BUTTON3 (1 << 2) +#define HID_MOUSE_INPUT_REPORT_BUTTON_MASK (7) + +/* Joystick input report (4 bytes) (HID D.1) */ +#define HID_JS_INPUT_REPORT_HATSWITCH_LSB (0) +#define HID_JS_INPUT_REPORT_HATSWITCH_MASK (15 << HID_JSIN_HATSWITCH_SHIFT) +#define HID_JS_INPUT_REPORT_BUTTON1 (1 << 4) +#define HID_JS_INPUT_REPORT_BUTTON2 (1 << 5) +#define HID_JS_INPUT_REPORT_BUTTON3 (1 << 6) +#define HID_JS_INPUT_REPORT_BUTTON4 (1 << 7) + +/* Usage pages (HuT 3) */ +#define HID_USAGE_PAGE_UNDEFINED 0x00 /* Undefined */ +#define HID_USAGE_PAGE_GENERIC_DCTRL 0x01 /* Generic Desktop Controls */ +#define HID_USAGE_PAGE_SIMCTRL 0x02 /* Simulation Controls */ +#define HID_USAGE_PAGE_VRCTRL 0x03 /* VR Controls */ +#define HID_USAGE_PAGE_SPORTCTRL 0x04 /* Sport Controls */ +#define HID_USAGE_PAGE_GAMECTRL 0x05 /* Game Controls */ +#define HID_USAGE_PAGE_GENERIC_DEVCTRL 0x06 /* Generic Device Controls */ +#define HID_USAGE_PAGE_KBD 0x07 /* Keyboard/Keypad */ +#define HID_USAGE_PAGE_LEDS 0x08 /* LEDs */ +#define HID_USAGE_PAGE_BUTTON 0x09 /* Button */ +#define HID_USAGE_PAGE_ORDINAL 0x0a /* Ordinal */ +#define HID_USAGE_PAGE_TELEPHONY 0x0b /* Telephony */ +#define HID_USAGE_PAGE_CONSUMER 0x0c /* Consumer */ +#define HID_USAGE_PAGE_DIGITIZER 0x0d /* Digitizer */ + /* 0x0e Reserved */ +#define HID_USAGE_PAGE_PIDPAGE 0x0f /* PID Page Physical Interface Device */ +#define HID_USAGE_PAGE_UNICODE 0x10 /* Unicode */ + /* 0x11-13 Reserved */ +#define HID_USAGE_PAGE_ALPHA_DISPLAY 0x14 /* Alphanumeric Display */ + /* 0x15-3f Reserved */ +#define HID_USAGE_PAGE_MEDICAL 0x40 /* Medical Instruments */ + /* 0x41-7f Reserved */ + /* 0x80-83 Monitor Devices */ + /* 0x84-87 Power Devices */ + /* 0x88-8b Reserved */ +#define HID_USAGE_PAGE_BARCODE_SCANNER 0x8c /* Bar Code Scanner page */ +#define HID_USAGE_PAGE_SCALE 0x8d /* Scale page */ +#define HID_USAGE_PAGE_MSR 0x8e /* Magnetic Stripe Reading (MSR) Devices */ +#define HID_USAGE_PAGE_POS 0x8f /* Point of Sale devices */ +#define HID_USAGE_PAGE_CAMERA_CTRL 0x90 /* Camera Control Page */ + +/* Generic Desktop Page Usage IDs (HuT 4) */ +#define HID_DESKTOP_USAGE_UNDEFINED 0x00 /* Undefined */ +#define HID_DESKTOP_USAGE_POINTER 0x01 /* Pointer */ +#define HID_DESKTOP_USAGE_MOUSE 0x02 /* Mouse */ + /* 0x03 Reserved */ +#define HID_DESKTOP_USAGE_JOYSTICK 0x04 /* Joystick */ +#define HID_DESKTOP_USAGE_GAMEPAD 0x05 /* Game Pad */ +#define HID_DESKTOP_USAGE_KEYBOARD 0x06 /* Keyboard */ +#define HID_DESKTOP_USAGE_KEYPAD 0x07 /* Keypad */ +#define HID_DESKTOP_USAGE_MULTIAXIS 0x08 /* Multi-axis Controller */ +#define HID_DESKTOP_USAGE_TABLET 0x09 /* Tablet PC System Controls */ + /* 0x0a-2f Reserved */ +#define HID_DESKTOP_USAGE_X 0x30 /* X */ +#define HID_DESKTOP_USAGE_Y 0x31 /* Y */ +#define HID_DESKTOP_USAGE_Z 0x32 /* Z */ +#define HID_DESKTOP_USAGE_RX 0x33 /* Rx */ +#define HID_DESKTOP_USAGE_RY 0x34 /* Ry */ +#define HID_DESKTOP_USAGE_RZ 0x35 /* Rz */ +#define HID_DESKTOP_USAGE_SLIDER 0x36 /* Slider */ +#define HID_DESKTOP_USAGE_DIAL 0x37 /* Dial */ +#define HID_DESKTOP_USAGE_WHEEL 0x38 /* Wheel */ +#define HID_DESKTOP_USAGE_HATSWITCH 0x39 /* Hat switch */ +#define HID_DESKTOP_USAGE_COUNTED 0x3a /* Counted Buffer */ +#define HID_DESKTOP_USAGE_BYTECOUNT 0x3b /* Byte Count */ +#define HID_DESKTOP_USAGE_MOTION 0x3c /* Motion Wakeup */ +#define HID_DESKTOP_USAGE_START 0x3d /* Start */ +#define HID_DESKTOP_USAGE_SELECT 0x3e /* Select */ + /* 0x3f Reserved */ +#define HID_DESKTOP_USAGE_VX 0x40 /* Vx */ +#define HID_DESKTOP_USAGE_VY 0x41 /* Vy */ +#define HID_DESKTOP_USAGE_VZ 0x42 /* Vz */ +#define HID_DESKTOP_USAGE_VBRX 0x43 /* Vbrx */ +#define HID_DESKTOP_USAGE_VBRY 0x44 /* Vbry */ +#define HID_DESKTOP_USAGE_VBRZ 0x45 /* Vbrz */ +#define HID_DESKTOP_USAGE_VNO 0x46 /* Vno */ +#define HID_DESKTOP_USAGE_FEATURE 0x47 /* Feature Notification */ +#define HID_DESKTOP_USAGE_RESOLUTION 0x48 /* Resolution Multiplier */ + /* 0x49-7f Reserved */ +#define HID_DESKTOP_USAGE_CONTROL 0x80 /* System Control */ +#define HID_DESKTOP_USAGE_POWERDOWN 0x81 /* System Power Down */ +#define HID_DESKTOP_USAGE_SLEEP 0x82 /* System Sleep */ +#define HID_DESKTOP_USAGE_WAKEUP 0x83 /* System Wake Up */ +#define HID_DESKTOP_USAGE_CONTEXT_MENU 0x84 /* System Context Menu */ +#define HID_DESKTOP_USAGE_MAIN_MENU 0x85 /* System Main Menu */ +#define HID_DESKTOP_USAGE_APP_MENU 0x86 /* System App Menu */ +#define HID_DESKTOP_USAGE_MENU_HELP 0x87 /* System Menu Help */ +#define HID_DESKTOP_USAGE_MENU_EXIT 0x88 /* System Menu Exit */ +#define HID_DESKTOP_USAGE_MENU_SELECT 0x89 /* System Menu Select */ +#define HID_DESKTOP_USAGE_MENU_RIGHT 0x8a /* System Menu Right */ +#define HID_DESKTOP_USAGE_MENU_LEFT 0x8b /* System Menu Left */ +#define HID_DESKTOP_USAGE_MENU_UP 0x8c /* System Menu Up */ +#define HID_DESKTOP_USAGE_MENU_DOWN 0x8d /* System Menu Down */ +#define HID_DESKTOP_USAGE_COLD_RESTART 0x8e /* System Cold Restart */ +#define HID_DESKTOP_USAGE_WARM_RESTART 0x8f /* System Warm Restart */ +#define HID_DESKTOP_USAGE_DPAD_UP 0x90 /* D-pad Up */ +#define HID_DESKTOP_USAGE_DPAD_DOWN 0x91 /* D-pad Down */ +#define HID_DESKTOP_USAGE_DPAD_RIGHT 0x92 /* D-pad Right */ +#define HID_DESKTOP_USAGE_DPAD_LEFT 0x93 /* D-pad Left */ + /* 0x94-9f Reserved */ +#define HID_DESKTOP_USAGE_DOCK 0xa0 /* System Dock */ +#define HID_DESKTOP_USAGE_UNDOCK 0xa1 /* System Undock */ +#define HID_DESKTOP_USAGE_SETUP 0xa2 /* System Setup */ +#define HID_DESKTOP_USAGE_BREAK 0xa3 /* System Break */ +#define HID_DESKTOP_USAGE_DEBUG_BREAK 0xa4 /* System Debugger Break */ +#define HID_DESKTOP_USAGE_APP_BREAK 0xa5 /* Application Break */ +#define HID_DESKTOP_USAGE_APP_DEBUG_BREAK 0xa6 /* Application Debugger Break */ +#define HID_DESKTOP_USAGE_MUTE 0xa7 /* System Speaker Mute */ +#define HID_DESKTOP_USAGE_HIBERNATE 0xa8 /* System Hibernate */ + /* 0xa9-af Reserved */ +#define HID_DESKTOP_USAGE_DISPLAY_INVERT 0xb0 /* System Display Invert */ +#define HID_DESKTOP_USAGE_DISPALY_INTERNAL 0xb1 /* System Display Internal */ +#define HID_DESKTOP_USAGE_DISPLAY_EXTERNAL 0xb2 /* System Display External */ +#define HID_DESKTOP_USAGE_DISPLAY_BOTH 0xb3 /* System Display Both */ +#define HID_DESKTOP_USAGE_DISPLAY_DUAL 0xb4 /* System Display Dual */ +#define HID_DESKTOP_USAGE_DISPLAY_TOGGLE 0xb5 /* System Display Toggle Int/Ext */ +#define HID_DESKTOP_USAGE_DISPLAY_SWAP 0xb6 /* System Display Swap */ +#define HID_DESKTOP_USAGE_ 0xb7 /* System Display LCD Autoscale */ + /* 0xb8-ffff Reserved */ + +/* Keyboard usage IDs (HuT 10) */ +#define HID_KBD_USAGE_NONE 0x00 /* Reserved (no event indicated) */ +#define HID_KBD_USAGE_ERRORROLLOVER 0x01 /* Keyboard ErrorRollOver */ +#define HID_KBD_USAGE_POSTFAIL 0x02 /* Keyboard POSTFail */ +#define HID_KBD_USAGE_ERRUNDEF 0x03 /* Keyboard ErrorUndefined */ +#define HID_KBD_USAGE_A 0x04 /* Keyboard a or A (B-Z follow) */ +#define HID_KBD_USAGE_1 0x1e /* Keyboard 1 (2-9 follow) */ +#define HID_KBD_USAGE_EXCLAM 0x1e /* Keyboard 1 and ! */ +#define HID_KBD_USAGE_AT 0x1f /* Keyboard 2 and @ */ +#define HID_KBD_USAGE_POUND 0x20 /* Keyboard 3 and # */ +#define HID_KBD_USAGE_DOLLAR 0x21 /* Keyboard 4 and $ */ +#define HID_KBD_USAGE_PERCENT 0x22 /* Keyboard 5 and % */ +#define HID_KBD_USAGE_CARAT 0x23 /* Keyboard 6 and ^ */ +#define HID_KBD_USAGE_AMPERSAND 0x24 /* Keyboard 7 and & */ +#define HID_KBD_USAGE_ASTERISK 0x25 /* Keyboard 8 and * */ +#define HID_KBD_USAGE_LPAREN 0x26 /* Keyboard 9 and ( */ +#define HID_KBD_USAGE_0 0x27 /* Keyboard 0 and ) */ +#define HID_KBD_USAGE_RPAREN 0x27 /* Keyboard 0 and ) */ +#define HID_KBD_USAGE_ENTER 0x28 /* Keyboard Return (ENTER) */ +#define HID_KBD_USAGE_ESCAPE 0x29 /* Keyboard ESCAPE */ +#define HID_KBD_USAGE_DELETE 0x2a /* Keyboard DELETE (Backspace) */ +#define HID_KBD_USAGE_TAB 0x2b /* Keyboard Tab */ +#define HID_KBD_USAGE_SPACE 0x2c /* Keyboard Spacebar */ +#define HID_KBD_USAGE_HYPHEN 0x2d /* Keyboard - and (underscore) */ +#define HID_KBD_USAGE_UNDERSCORE 0x2d /* Keyboard - and (underscore) */ +#define HID_KBD_USAGE_EQUAL 0x2e /* Keyboard = and + */ +#define HID_KBD_USAGE_PLUS 0x2e /* Keyboard = and + */ +#define HID_KBD_USAGE_LBRACKET 0x2f /* Keyboard [ and { */ +#define HID_KBD_USAGE_LBRACE 0x2f /* Keyboard [ and { */ +#define HID_KBD_USAGE_RBRACKET 0x30 /* Keyboard ] and } */ +#define HID_KBD_USAGE_RBRACE 0x30 /* Keyboard ] and } */ +#define HID_KBD_USAGE_BSLASH 0x31 /* Keyboard \ and | */ +#define HID_KBD_USAGE_VERTBAR 0x31 /* Keyboard \ and | */ +#define HID_KBD_USAGE_NONUSPOUND 0x32 /* Keyboard Non-US # and ~ */ +#define HID_KBD_USAGE_TILDE 0x32 /* Keyboard Non-US # and ~ */ +#define HID_KBD_USAGE_SEMICOLON 0x33 /* Keyboard ; and : */ +#define HID_KBD_USAGE_COLON 0x33 /* Keyboard ; and : */ +#define HID_KBD_USAGE_SQUOTE 0x34 /* Keyboard ' and " */ +#define HID_KBD_USAGE_DQUOUTE 0x34 /* Keyboard ' and " */ +#define HID_KBD_USAGE_GACCENT 0x35 /* Keyboard Grave Accent and Tilde */ +#define HID_KBD_USAGE_GTILDE 0x35 /* Keyboard Grave Accent and Tilde */ +#define HID_KBD_USAGE_COMMON 0x36 /* Keyboard , and < */ +#define HID_KBD_USAGE_LT 0x36 /* Keyboard , and < */ +#define HID_KBD_USAGE_PERIOD 0x37 /* Keyboard . and > */ +#define HID_KBD_USAGE_GT 0x37 /* Keyboard . and > */ +#define HID_KBD_USAGE_DIV 0x38 /* Keyboard / and ? */ +#define HID_KBD_USAGE_QUESTION 0x38 /* Keyboard / and ? */ +#define HID_KBD_USAGE_CAPSLOCK 0x39 /* Keyboard Caps Lock */ +#define HID_KBD_USAGE_F1 0x3a /* Keyboard F1 */ +#define HID_KBD_USAGE_F2 0x3b /* Keyboard F2 */ +#define HID_KBD_USAGE_F3 0x3c /* Keyboard F3 */ +#define HID_KBD_USAGE_F4 0x3d /* Keyboard F4 */ +#define HID_KBD_USAGE_F5 0x3e /* Keyboard F5 */ +#define HID_KBD_USAGE_F6 0x3f /* Keyboard F6 */ +#define HID_KBD_USAGE_F7 0x40 /* Keyboard F7 */ +#define HID_KBD_USAGE_F8 0x41 /* Keyboard F8 */ +#define HID_KBD_USAGE_F9 0x42 /* Keyboard F9 */ +#define HID_KBD_USAGE_F10 0x43 /* Keyboard F10 */ +#define HID_KBD_USAGE_F11 0x44 /* Keyboard F11 */ +#define HID_KBD_USAGE_F12 0x45 /* Keyboard F12 */ +#define HID_KBD_USAGE_PRINTSCN 0x46 /* Keyboard PrintScreen */ +#define HID_KBD_USAGE_SCROLLLOCK 0x47 /* Keyboard Scroll Lock */ +#define HID_KBD_USAGE_PAUSE 0x48 /* Keyboard Pause */ +#define HID_KBD_USAGE_INSERT 0x49 /* Keyboard Insert */ +#define HID_KBD_USAGE_HOME 0x4a /* Keyboard Home */ +#define HID_KBD_USAGE_PAGEUP 0x4b /* Keyboard PageUp */ +#define HID_KBD_USAGE_DELFWD 0x4c /* Keyboard Delete Forward */ +#define HID_KBD_USAGE_END 0x4d /* Keyboard End */ +#define HID_KBD_USAGE_PAGEDOWN 0x4e /* Keyboard PageDown */ +#define HID_KBD_USAGE_RIGHT 0x4f /* eyboard RightArrow */ +#define HID_KBD_USAGE_LEFT 0x50 /* Keyboard LeftArrow */ +#define HID_KBD_USAGE_DOWN 0x5a /* Keyboard DownArrow */ +#define HID_KBD_USAGE_UP 0x52 /* Keyboard UpArrow */ +#define HID_KBD_USAGE_KPDNUMLOCK 0x53 /* Keypad Num Lock and Clear */ +#define HID_KBD_USAGE_KPDNUMLOCKCLEAR 0x53 /* Keypad Num Lock and Clear */ +#define HID_KBD_USAGE_KPDDIV 0x54 /* Keypad / */ +#define HID_KBD_USAGE_KPDMUL 0x55 /* Keypad * */ +#define HID_KBD_USAGE_KPDHMINUS 0x56 /* Keypad - */ +#define HID_KBD_USAGE_KPDPLUS 0x57 /* Keypad + */ +#define HID_KBD_USAGE_KPDEMTER 0x58 /* Keypad ENTER */ +#define HID_KBD_USAGE_KPD1 0x59 /* Keypad 1 (2-9 follow) */ +#define HID_KBD_USAGE_KPDEND 0x59 /* Keypad 1 and End */ +#define HID_KBD_USAGE_KPDDOWN 0x5a /* Keypad 2 and Down Arrow */ +#define HID_KBD_USAGE_KPDPAGEDN 0x5b /* Keypad 3 and PageDn */ +#define HID_KBD_USAGE_KPDLEFT 0x5c /* Keypad 4 and Left Arrow */ +#define HID_KBD_USAGE_KPDRIGHT 0x5e /* Keypad 6 and Right Arrow */ +#define HID_KBD_USAGE_KPDHOME 0x5f /* Keypad 7 and Home */ +#define HID_KBD_USAGE_KPDUP 0x60 /* Keypad 8 and Up Arrow */ +#define HID_KBD_USAGE_KPDPAGEUP 0x61 /* Keypad 9 and PageUp */ +#define HID_KBD_USAGE_KPD0 0x62 /* Keypad 0 and Insert */ +#define HID_KBD_USAGE_KPDINSERT 0x62 /* Keypad 0 and Insert */ +#define HID_KBD_USAGE_KPDDECIMALPT 0x63 /* Keypad . and Delete */ +#define HID_KBD_USAGE_KPDDELETE 0x63 /* Keypad . and Delete */ +#define HID_KBD_USAGE_NONSLASH 0x64 /* Keyboard Non-US \ and | */ +#define HID_KBD_USAGE_NONUSVERT 0x64 /* Keyboard Non-US \ and | */ +#define HID_KBD_USAGE_APPLICATION 0x65 /* Keyboard Application */ +#define HID_KBD_USAGE_POWER 0x66 /* Keyboard Power */ +#define HID_KBD_USAGE_KPDEQUAL 0x67 /* Keypad = */ +#define HID_KBD_USAGE_F13 0x68 /* Keyboard F13 */ +#define HID_KBD_USAGE_F14 0x69 /* Keyboard F14 */ +#define HID_KBD_USAGE_F15 0x6a /* Keyboard F15 */ +#define HID_KBD_USAGE_F16 0x6b /* Keyboard F16 */ +#define HID_KBD_USAGE_F17 0x6c /* Keyboard F17 */ +#define HID_KBD_USAGE_F18 0x6d /* Keyboard F18 */ +#define HID_KBD_USAGE_F19 0x6e /* Keyboard F19 */ +#define HID_KBD_USAGE_F20 0x6f /* Keyboard F20 */ +#define HID_KBD_USAGE_F21 0x70 /* Keyboard F21 */ +#define HID_KBD_USAGE_F22 0x71 /* Keyboard F22 */ +#define HID_KBD_USAGE_F23 0x72 /* Keyboard F23 */ +#define HID_KBD_USAGE_F24 0x73 /* Keyboard F24 */ +#define HID_KBD_USAGE_EXECUTE 0x74 /* Keyboard Execute */ +#define HID_KBD_USAGE_HELP 0x75 /* Keyboard Help */ +#define HID_KBD_USAGE_MENU 0x76 /* Keyboard Menu */ +#define HID_KBD_USAGE_SELECT 0x77 /* Keyboard Select */ +#define HID_KBD_USAGE_STOP 0x78 /* Keyboard Stop */ +#define HID_KBD_USAGE_AGAIN 0x79 /* Keyboard Again */ +#define HID_KBD_USAGE_UNDO 0x7a /* Keyboard Undo */ +#define HID_KBD_USAGE_CUT 0x7b /* Keyboard Cut */ +#define HID_KBD_USAGE_COPY 0x7c /* Keyboard Copy */ +#define HID_KBD_USAGE_PASTE 0x7d /* Keyboard Paste */ +#define HID_KBD_USAGE_FIND 0x7e /* Keyboard Find */ +#define HID_KBD_USAGE_MUTE 0x7f /* Keyboard Mute */ +#define HID_KBD_USAGE_VOLUP 0x80 /* Keyboard Volume Up */ +#define HID_KBD_USAGE_VOLDOWN 0x81 /* Keyboard Volume Down */ +#define HID_KBD_USAGE_LCAPSLOCK 0x82 /* Keyboard Locking Caps Lock */ +#define HID_KBD_USAGE_LNUMLOCK 0x83 /* Keyboard Locking Num Lock */ +#define HID_KBD_USAGE_LSCROLLLOCK 0x84 /* Keyboard Locking Scroll Lock */ +#define HID_KBD_USAGE_KPDCOMMA 0x85 /* Keypad Comma */ +#define HID_KBD_USAGE_KPDEQUALSIGN 0x86 /* Keypad Equal Sign */ +#define HID_KBD_USAGE_INTERNATIONAL1 0x87 /* Keyboard International 1 */ +#define HID_KBD_USAGE_INTERNATIONAL2 0x88 /* Keyboard International 2 */ +#define HID_KBD_USAGE_INTERNATIONAL3 0x89 /* Keyboard International 3 */ +#define HID_KBD_USAGE_INTERNATIONAL4 0x8a /* Keyboard International 4 */ +#define HID_KBD_USAGE_INTERNATIONAL5 0x8b /* Keyboard International 5 */ +#define HID_KBD_USAGE_INTERNATIONAL6 0x8c /* Keyboard International 6 */ +#define HID_KBD_USAGE_INTERNATIONAL7 0x8d /* Keyboard International 7 */ +#define HID_KBD_USAGE_INTERNATIONAL8 0x8e /* Keyboard International 8 */ +#define HID_KBD_USAGE_INTERNATIONAL9 0x8f /* Keyboard International 9 */ +#define HID_KBD_USAGE_LANG1 0x90 /* Keyboard LANG1 */ +#define HID_KBD_USAGE_LANG2 0x91 /* Keyboard LANG2 */ +#define HID_KBD_USAGE_LANG3 0x92 /* Keyboard LANG3 */ +#define HID_KBD_USAGE_LANG4 0x93 /* Keyboard LANG4 */ +#define HID_KBD_USAGE_LANG5 0x94 /* Keyboard LANG5 */ +#define HID_KBD_USAGE_LANG6 0x95 /* Keyboard LANG6 */ +#define HID_KBD_USAGE_LANG7 0x96 /* Keyboard LANG7 */ +#define HID_KBD_USAGE_LANG8 0x97 /* Keyboard LANG8 */ +#define HID_KBD_USAGE_LANG9 0x98 /* Keyboard LANG9 */ +#define HID_KBD_USAGE_ALTERASE 0x99 /* Keyboard Alternate Erase */ +#define HID_KBD_USAGE_SYSREQ 0x9a /* Keyboard SysReq/Attention */ +#define HID_KBD_USAGE_CANCEL 0x9b /* Keyboard Cancel */ +#define HID_KBD_USAGE_CLEAR 0x9c /* Keyboard Clear */ +#define HID_KBD_USAGE_PRIOR 0x9d /* Keyboard Prior */ +#define HID_KBD_USAGE_RETURN 0x9e /* Keyboard Return */ +#define HID_KBD_USAGE_SEPARATOR 0x9f /* Keyboard Separator */ +#define HID_KBD_USAGE_OUT 0xa0 /* Keyboard Out */ +#define HID_KBD_USAGE_OPER 0xa1 /* Keyboard Oper */ +#define HID_KBD_USAGE_CLEARAGAIN 0xa2 /* Keyboard Clear/Again */ +#define HID_KBD_USAGE_CLRSEL 0xa3 /* Keyboard CrSel/Props */ +#define HID_KBD_USAGE_EXSEL 0xa4 /* Keyboard ExSel */ +#define HID_KBD_USAGE_KPD00 0xb0 /* Keypad 00 */ +#define HID_KBD_USAGE_KPD000 0xb1 /* Keypad 000 */ +#define HID_KBD_USAGE_THOUSEPARATOR 0xb2 /* Thousands Separator */ +#define HID_KBD_USAGE_DECSEPARATOR 0xb3 /* Decimal Separator */ +#define HID_KBD_USAGE_CURRUNIT 0xb4 /* Currency Unit */ +#define HID_KBD_USAGE_CURRSUBUNIT 0xb5 /* Currency Sub-unit */ +#define HID_KBD_USAGE_KPDLPAREN 0xb6 /* Keypad ( */ +#define HID_KBD_USAGE_KPDRPAREN 0xb7 /* Keypad ) */ +#define HID_KBD_USAGE_KPDLBRACE 0xb8 /* Keypad { */ +#define HID_KBD_USAGE_KPDRBRACE 0xb9 /* Keypad } */ +#define HID_KBD_USAGE_KPDTAB 0xba /* Keypad Tab */ +#define HID_KBD_USAGE_KPDBACKSPACE 0xbb /* Keypad Backspace */ +#define HID_KBD_USAGE_KPDA 0xbc /* Keypad A (B-F follow) */ +#define HID_KBD_USAGE_KPDXOR 0xc2 /* Keypad XOR */ +#define HID_KBD_USAGE_KPDEXP 0xc3 /* Keypad ^ */ +#define HID_KBD_USAGE_KPDPERCENT 0xc4 /* Keypad % */ +#define HID_KBD_USAGE_KPDLT 0xc5 /* Keypad < */ +#define HID_KBD_USAGE_KPDGT 0xc6 /* Keypad > */ +#define HID_KBD_USAGE_KPDAMPERSAND 0xc7 /* Keypad & */ +#define HID_KBD_USAGE_KPDAND 0xc8 /* Keypad && */ +#define HID_KBD_USAGE_KPDVERT 0xc9 /* Keypad | */ +#define HID_KBD_USAGE_KPDOR 0xca /* Keypad || */ +#define HID_KBD_USAGE_KPDCOLON 0xcb /* Keypad : */ +#define HID_KBD_USAGE_KPDPOUND 0xcc /* Keypad # */ +#define HID_KBD_USAGE_KPDSPACE 0xcd /* Keypad Space */ +#define HID_KBD_USAGE_KPDAT 0xce /* Keypad @ */ +#define HID_KBD_USAGE_KPDEXCLAM 0xcf /* Keypad ! */ +#define HID_KBD_USAGE_KPDMEMSTORE 0xd0 /* Keypad Memory Store */ +#define HID_KBD_USAGE_KPDMEMRECALL 0xd1 /* Keypad Memory Recall */ +#define HID_KBD_USAGE_KPDMEMCLEAR 0xd2 /* Keypad Memory Clear */ +#define HID_KBD_USAGE_KPDMEMADD 0xd3 /* Keypad Memory Add */ +#define HID_KBD_USAGE_KPDMEMSUB 0xd4 /* Keypad Memory Subtract */ +#define HID_KBD_USAGE_KPDMEMMULT 0xd5 /* Keypad Memory Multiply */ +#define HID_KBD_USAGE_KPDMEMDIV 0xd6 /* Keypad Memory Divide */ +#define HID_KBD_USAGE_KPDPLUSMINUS 0xd7 /* Keypad +/- */ +#define HID_KBD_USAGE_KPDCLEAR 0xd8 /* Keypad Clear */ +#define HID_KBD_USAGE_KPDCLEARENTRY 0xd9 /* Keypad Clear Entry */ +#define HID_KBD_USAGE_KPDBINARY 0xda /* Keypad Binary */ +#define HID_KBD_USAGE_KPDOCTAL 0xdb /* Keypad Octal */ +#define HID_KBD_USAGE_KPDDECIMAL 0xdc /* Keypad Decimal */ +#define HID_KBD_USAGE_KPDHEXADECIMAL 0xdd /* Keypad Hexadecimal */ +#define HID_KBD_USAGE_LCTRL 0xe0 /* Keyboard LeftControl */ +#define HID_KBD_USAGE_LSHIFT 0xe1 /* Keyboard LeftShift */ +#define HID_KBD_USAGE_LALT 0xe2 /* Keyboard LeftAlt */ +#define HID_KBD_USAGE_LGUI 0xe3 /* Keyboard Left GUI */ +#define HID_KBD_USAGE_RCTRL 0xe4 /* Keyboard RightControl */ +#define HID_KBD_USAGE_RSHIFT 0xe5 /* Keyboard RightShift */ +#define HID_KBD_USAGE_RALT 0xe6 /* Keyboard RightAlt */ +#define HID_KBD_USAGE_RGUI 0xe7 /* Keyboard Right GUI */ + +#define HID_KBD_USAGE_MAX 0xe7 + +/** + * @brief HID keyboard button codes. + */ +enum hid_kbd_code { + HID_KEY_A = 4, + HID_KEY_B = 5, + HID_KEY_C = 6, + HID_KEY_D = 7, + HID_KEY_E = 8, + HID_KEY_F = 9, + HID_KEY_G = 10, + HID_KEY_H = 11, + HID_KEY_I = 12, + HID_KEY_J = 13, + HID_KEY_K = 14, + HID_KEY_L = 15, + HID_KEY_M = 16, + HID_KEY_N = 17, + HID_KEY_O = 18, + HID_KEY_P = 19, + HID_KEY_Q = 20, + HID_KEY_R = 21, + HID_KEY_S = 22, + HID_KEY_T = 23, + HID_KEY_U = 24, + HID_KEY_V = 25, + HID_KEY_W = 26, + HID_KEY_X = 27, + HID_KEY_Y = 28, + HID_KEY_Z = 29, + HID_KEY_1 = 30, + HID_KEY_2 = 31, + HID_KEY_3 = 32, + HID_KEY_4 = 33, + HID_KEY_5 = 34, + HID_KEY_6 = 35, + HID_KEY_7 = 36, + HID_KEY_8 = 37, + HID_KEY_9 = 38, + HID_KEY_0 = 39, + HID_KEY_ENTER = 40, + HID_KEY_ESC = 41, + HID_KEY_BACKSPACE = 42, + HID_KEY_TAB = 43, + HID_KEY_SPACE = 44, + HID_KEY_MINUS = 45, + HID_KEY_EQUAL = 46, + HID_KEY_LEFTBRACE = 47, + HID_KEY_RIGHTBRACE = 48, + HID_KEY_BACKSLASH = 49, + HID_KEY_HASH = 50, /* Non-US # and ~ */ + HID_KEY_SEMICOLON = 51, + HID_KEY_APOSTROPHE = 52, + HID_KEY_GRAVE = 53, + HID_KEY_COMMA = 54, + HID_KEY_DOT = 55, + HID_KEY_SLASH = 56, + HID_KEY_CAPSLOCK = 57, + HID_KEY_F1 = 58, + HID_KEY_F2 = 59, + HID_KEY_F3 = 60, + HID_KEY_F4 = 61, + HID_KEY_F5 = 62, + HID_KEY_F6 = 63, + HID_KEY_F7 = 64, + HID_KEY_F8 = 65, + HID_KEY_F9 = 66, + HID_KEY_F10 = 67, + HID_KEY_F11 = 68, + HID_KEY_F12 = 69, + HID_KEY_SYSRQ = 70, /* PRINTSCREEN */ + HID_KEY_SCROLLLOCK = 71, + HID_KEY_PAUSE = 72, + HID_KEY_INSERT = 73, + HID_KEY_HOME = 74, + HID_KEY_PAGEUP = 75, + HID_KEY_DELETE = 76, + HID_KEY_END = 77, + HID_KEY_PAGEDOWN = 78, + HID_KEY_RIGHT = 79, + HID_KEY_LEFT = 80, + HID_KEY_DOWN = 81, + HID_KEY_UP = 82, + HID_KEY_NUMLOCK = 83, + HID_KEY_KPSLASH = 84, /* NUMPAD DIVIDE */ + HID_KEY_KPASTERISK = 85, /* NUMPAD MULTIPLY */ + HID_KEY_KPMINUS = 86, + HID_KEY_KPPLUS = 87, + HID_KEY_KPENTER = 88, + HID_KEY_KP_1 = 89, + HID_KEY_KP_2 = 90, + HID_KEY_KP_3 = 91, + HID_KEY_KP_4 = 92, + HID_KEY_KP_5 = 93, + HID_KEY_KP_6 = 94, + HID_KEY_KP_7 = 95, + HID_KEY_KP_8 = 96, + HID_KEY_KP_9 = 97, + HID_KEY_KP_0 = 98, +}; + +/** + * @brief HID keyboard modifiers. + */ +enum hid_kbd_modifier { + HID_KBD_MODIFIER_NONE = 0x00, + HID_KBD_MODIFIER_LEFT_CTRL = 0x01, + HID_KBD_MODIFIER_LEFT_SHIFT = 0x02, + HID_KBD_MODIFIER_LEFT_ALT = 0x04, + HID_KBD_MODIFIER_LEFT_UI = 0x08, + HID_KBD_MODIFIER_RIGHT_CTRL = 0x10, + HID_KBD_MODIFIER_RIGHT_SHIFT = 0x20, + HID_KBD_MODIFIER_RIGHT_ALT = 0x40, + HID_KBD_MODIFIER_RIGHT_UI = 0x80, +}; + +/** + * @brief HID keyboard LEDs. + */ +enum hid_kbd_led { + HID_KBD_LED_NUM_LOCK = 0x01, + HID_KBD_LED_CAPS_LOCK = 0x02, + HID_KBD_LED_SCROLL_LOCK = 0x04, + HID_KBD_LED_COMPOSE = 0x08, + HID_KBD_LED_KANA = 0x10, +}; + +/* HID Report Definitions */ +struct usb_hid_class_subdescriptor { + uint8_t bDescriptorType; /* Class descriptor type (See 7.1) */ + uint16_t wDescriptorLength; /* Size of the report descriptor */ +} __PACKED; + +struct usb_hid_descriptor { + uint8_t bLength; /* Size of the HID descriptor */ + uint8_t bDescriptorType; /* HID descriptor type */ + uint16_t bcdHID; /* HID class specification release */ + uint8_t bCountryCode; /* Country code */ + uint8_t bNumDescriptors; /* Number of descriptors (>=1) */ + + /* + * Specification says at least one Class Descriptor needs to + * be present (Report Descriptor). + */ + struct usb_hid_class_subdescriptor subdesc[1]; +} __PACKED; + +/** + * @brief Standard Report. + */ +/* Keyboard input report (8 bytes) (HID B.1) */ +struct usb_hid_kbd_report { + uint8_t modifier; /* Modifier keys. See USBHID_MODIFIER_* definitions */ + uint8_t reserved; + uint8_t key[6]; /* Keycode 1-6 */ +}; + +/* Keyboard output report (1 byte) (HID B.1), + * see USBHID_KBDOUT_* definitions + */ + +/* Mouse input report (HID B.2) */ +struct usb_hid_mouse_send_report +{ + uint8_t buttons; /* See USBHID_MOUSEIN_* definitions */ + uint8_t xdisp; /* X displacement */ + uint8_t ydisp; /* y displacement */ + + /* Device specific additional bytes may follow */ + #ifdef CONFIG_INPUT_MOUSE_WHEEL + uint8_t wdisp; /* Wheel displacement */ + #endif +}; + +/* Joystick input report (1 bytes) (HID D.1) */ +struct usb_hid_js_report +{ + uint8_t xpos; /* X position */ + uint8_t ypos; /* X position */ + uint8_t buttons; /* See USBHID_JSIN_* definitions */ + uint8_t throttle; /* Throttle */ +}; + +#endif // _USB_HID_H_ diff --git a/projects/bleRemoteControl/Master/src/usbd.h b/projects/bleRemoteControl/Master/src/usbd.h new file mode 100644 index 0000000..f6db052 --- /dev/null +++ b/projects/bleRemoteControl/Master/src/usbd.h @@ -0,0 +1,220 @@ +/** + * @file usbd.h + * + * @brief Header file of USB Device Descriptors & Interface + * + */ + +#ifndef _USBD_H_ +#define _USBD_H_ + +#include +#include +#include "string.h" + +#include "usb_def.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +enum usbd_event_type { + /** USB error reported by the controller */ + USBD_EVENT_ERROR, + /** USB reset */ + USBD_EVENT_RESET, + /** Start of Frame received */ + USBD_EVENT_SOF, + /** USB enumeration completed */ + USBD_EVENT_CONNECTED, + /** USB configuration done */ + USBD_EVENT_CONFIGURED, + /** USB suspended by the HOST */ + USBD_EVENT_SUSPEND, //5 + /** USB connection lost */ + USBD_EVENT_DISCONNECTED, + /** USB resumed by the HOST */ + USBD_EVENT_RESUME, + + /** USB interface selected */ + USBD_EVENT_SET_INTERFACE, + /** Set Feature REMOTE_WAKEUP received */ + USBD_EVENT_SET_REMOTE_WAKEUP, + /** Clear Feature REMOTE_WAKEUP received */ + USBD_EVENT_CLR_REMOTE_WAKEUP, //10 + /** Set Feature ENDPOINT_HALT received */ + USBD_EVENT_SET_ENDPOINT_HALT, + /** Clear Feature ENDPOINT_HALT received */ + USBD_EVENT_CLR_ENDPOINT_HALT, + + /** Initial USB connection status */ + USBD_EVENT_UNKNOWN +}; + +enum usbd_status_type { + USBD_OK, + USBD_BUSY, + USBD_FAIL, + USBD_ERR_INVAILD, + USBD_ERR_STATE, + USBD_ERR_UNDRN, + USBD_ERR_OVER, + USBD_ERR_TIMEOUT, +}; + +/* Callback function for the USB Endpoint status */ +typedef void (*usbd_endpoint_handler)(uint8_t ep); + +/* Callback function for specific setup requests */ +typedef uint8_t (*usbd_request_handler)(struct usb_setup_packet *setup, + uint8_t **data, uint16_t *dlen); + +/** + * @brief USB Endpoint Structure. + * + * Structure containing the USB endpoint. + */ +typedef struct usbd_ep_tag { + /** Endpoint Address: IN = 0x80|, OUT = 0x00| */ + uint8_t ep_addr; + /** Endpoint Transfer Type: Bulk, Interrupt, Control or Isochronous */ + uint8_t ep_type; + /** Endpoint max packet size <= USB_EP_MPS */ + uint16_t ep_mps; + /** Endpoint status callback function */ + usbd_endpoint_handler ep_cb; +} usbd_ep_t; + +#define USBD_EP_T(addr, type, mps, func) \ + { .ep_addr=addr, .ep_type=type, .ep_mps=mps, .ep_cb=func } + + +/** + * @brief USB Class Structure. + * + * Structure containing the USB class. + */ +typedef struct usbd_class_tag { + /** Interface start number */ + uint8_t intf_start; + /** Interface end number */ + uint8_t intf_end; + /** Handler for USB Class specific commands */ + usbd_request_handler class_handler; +} usbd_class_t; + +#define USBD_CLASS_T(istart, iend, ihandler) \ + { .intf_start=istart, .intf_end=iend, .class_handler=ihandler } + + +/** + * @brief USB Configuration Structure. + * + * Structure containing the USB configuration. + */ +typedef struct usbd_config_tag { + uint8_t conf_val; + uint8_t intf_cnt; + uint8_t class_cnt; + uint8_t ep_cnt; + const usbd_class_t *class_tab; + const usbd_ep_t *ep_tab; +} usbd_config_t; + +#define USBD_CONFIG_T(_conf_val, _intf_cnt, classes, endpoints) \ + { .conf_val=_conf_val, .intf_cnt=_intf_cnt, \ + .class_tab=classes, .class_cnt=ARRAY_SIZE(classes), \ + .ep_tab=endpoints, .ep_cnt=ARRAY_SIZE(endpoints) } + + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ + +/** + * @brief Init device controller. + * @return N/A. + */ +void usbd_init(void); + +/** + * @brief Deinit device controller. + * @return N/A. + */ +void usbd_deinit(void); + +bool usbd_resume(bool en); +/** + * @brief Register Device Description and Configuration. + * + * @param[in] desc Pointer of description array + * @param[in] conf Pointer of configuration struct + * + * @return N/A. + */ +void usbd_register(const uint8_t *desc, const usbd_config_t *conf); + +/** + * @brief Device be configured or not. + * @return 0 on not, other on conf_num + */ +uint8_t usbd_is_configured(void); + +/** + * @brief Write data to the specified endpoint with poll mode. + * + * This function is called to write data to the specified endpoint. The + * supplied usbd_endpoint_handler function will be called when data is transmitted + * out. + * + * @param[in] ep Endpoint address corresponding to the one + * listed in the device configuration table + * @param[in] data Pointer to data to write + * @param[in] data_len Length of the data requested to write. This may + * be zero for a zero length status packet. + * @param[out] wr_bytes Bytes scheduled for transmission. This value + * may be NULL if the application expects all + * bytes to be written + * + * @return 0 on success, errno code on fail. + */ +uint8_t usbd_ep_write(uint8_t ep, uint16_t data_len, const uint8_t *data, uint16_t *wr_bytes); + +/** + * @brief Read data from the specified endpoint + * + * This function is called by the endpoint handler function, after an OUT + * interrupt has been received for that EP. The application must only call this + * function through the supplied usbd_ep_callback function. This function clears + * the ENDPOINT NAK when max_data_len is 0, if all data in the endpoint FIFO has been read, + * so as to accept more data from host. + * + * @param[in] ep Endpoint address corresponding to the one + * listed in the device configuration table + * @param[in] buff Pointer to data buffer to write to + * @param[in] max_len Max length of data to read + * + * @return Number of bytes read. + */ +uint16_t usbd_ep_read(uint8_t ep, uint16_t max_len, uint8_t *buff); + +/** + * @brief USB interrupt handler. + * @return N/A. + */ +__USBIRQ void USB_IRQHandler(void); + +/** Handler for Application to notify events */ +/* + * USB Event Notify Handler + **************************************************************************** + */ +__USBIRQ void usbd_notify_handler(uint8_t event, void *arg); + +/** Handler for USB Vendor specific commands */ +__USBIRQ uint8_t usbd_vendor_handler(struct usb_setup_packet *setup, uint8_t **data, uint16_t *dlen); + +#endif // _USBD_H_ diff --git a/projects/bleRemoteControl/Master/src/usbd_hid.c b/projects/bleRemoteControl/Master/src/usbd_hid.c new file mode 100644 index 0000000..920468d --- /dev/null +++ b/projects/bleRemoteControl/Master/src/usbd_hid.c @@ -0,0 +1,307 @@ +/** + **************************************************************************************** + * + * @file usbd_hid.c + * + * @brief Function of USB Human Interface Device (HID) + * + **************************************************************************************** + */ +#if (CFG_USB) +#include "usbd.h" +#include "usbd_hid.h" +#include "drvs.h" +#include "utils.h" +#include "app_user.h" + +#if (DBG_USB) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + +/// HID global environment +static usbd_hid_t usbd_hids[HID_INST_CNT]; + +/// Interface number convert to hid instance +static usbd_hid_t *find_hid_by_intf(uint8_t intf_num) +{ + for (uint8_t i = 0; i < HID_INST_CNT; i++) + { + if (usbd_hids[i].hid_intf && (usbd_hids[i].hid_intf->intf_num == intf_num)) + { + return &usbd_hids[i]; + } + } + + return NULL; +} + +/// Endpoint address convert to hid instance +static usbd_hid_t *find_hid_by_ep(uint8_t ep_addr) +{ + for (uint8_t i = 0; i < HID_INST_CNT; i++) + { + if (usbd_hids[i].hid_intf && (usbd_hids[i].hid_intf->ep_in == ep_addr)) + { + return &usbd_hids[i]; + } + } + + return NULL; +} + +void usbd_hid_init(uint8_t idx, const hid_intf_t *intf) +{ + if (idx < HID_INST_CNT) + { + usbd_hids[idx].hid_intf = intf; + // memset(&usbd_hids[idx].hid_state, 0, 4); + usbd_hids[idx].hid_info = 0; + } +} + +void usbd_hid_reset(void) +{ + for (uint8_t idx = 0; idx < HID_INST_CNT; idx++) + { + // memset(&usbd_hids[idx].hid_state, 0, 4); + usbd_hids[idx].hid_info = 0; +// usbd_hids[idx].hid_state = HID_STATE_IDLE; + } +} + +__WEAK void usbd_hid_leds(uint8_t state) +{ + /*!< here you can write the LED processing from the host */ + if (state & HID_KBD_LED_NUM_LOCK) + { + /*!< num lock */ + } + else + { + } + + if (state & HID_KBD_LED_CAPS_LOCK) + { + /*!< caps lock */ + } + else + { + } + + if (state & HID_KBD_LED_SCROLL_LOCK) + { + /*!< scroll lock */ + } + else + { + } +} + +//uint8_t ms_empty[4];// = {0}; + +//uint8_t usbd_hid_send_report(uint8_t ep, uint8_t len, const uint8_t *data) +uint8_t usbd_kb_report(void) +{ + uint8_t status = USBD_FAIL; + if (usbd_is_configured()) + { + usbd_hid_t *curr_hid = find_hid_by_ep(KBD_IN_EP); + + if ((curr_hid) && (curr_hid->hid_state == HID_STATE_IDLE)) { + //if (curr_hid) { + uint8_t *pkt = get_kb_pkt(); + +// if (!pkt) +// { +// pkt = ms_empty; +// } + if (pkt) + { + usbd_wakeup(); + + curr_hid->hid_state = HID_STATE_BUSY; // Update before isr occure + + //status = usbd_ep_write(ep, len, data, NULL); + status = usbd_ep_write(KBD_IN_EP, KB_LEN, pkt, NULL); + + if (status != USBD_OK) + { + curr_hid->hid_state = HID_STATE_IDLE; // fail to recover + } + } + } + } + + return status; +} + +uint8_t usbd_mic_report(void) +{ + uint8_t status = USBD_FAIL; + if (usbd_is_configured()) + { + usbd_hid_t *curr_hid = find_hid_by_ep(RAW_IN_EP); + + if ((curr_hid) && (curr_hid->hid_state == HID_STATE_IDLE)) { + //if (curr_hid) { + uint8_t *pkt = get_mic_pkt(); + +// if (!pkt) +// { +// pkt = ms_empty; +// } + if (pkt) + { + usbd_wakeup(); + + curr_hid->hid_state = HID_STATE_BUSY; // Update before isr occure + + //status = usbd_ep_write(ep, len, data, NULL); + status = usbd_ep_write(RAW_IN_EP, MIC_LEN, pkt, NULL); + + if (status != USBD_OK) + { + curr_hid->hid_state = HID_STATE_IDLE; // fail to recover + } + } + } + } + + return status; +} + +void usbd_hid_ep_in_handler(uint8_t ep) +{ + usbd_hid_t *curr_hid = find_hid_by_ep(ep); + + if (curr_hid && (curr_hid->hid_state == HID_STATE_BUSY)) + { + /*!< transfer successfully, update the state */ + curr_hid->hid_state = HID_STATE_IDLE; + } +} + +/** + * @brief Handler called for Class requests. + * + * @param setup Information about the request to execute. + * @param data Buffer containing the request result. + * @param len Size of the buffer. + * + * @return 0 on success, errno code on fail. + */ +uint8_t usbd_hid_class_handler(struct usb_setup_packet *setup, uint8_t **data, uint16_t *len) +{ + uint8_t intf_num; + usbd_hid_t *curr_hid; +// DEBUG("bmRequestType:%02x,bRequest:%02x,wValue:%04x,wIndex:%04x,wLength:%04x", setup->bmRequestType, +// setup->bRequest, setup->wValue, setup->wIndex, setup->wLength); + + if ((setup->bmRequestType & USB_REQUEST_RECIP_MASK) != USB_REQUEST_RECIP_INTERFACE) + { + return USBD_FAIL; + } + + intf_num = (uint8_t)setup->wIndex; + curr_hid = find_hid_by_intf(intf_num); + + if (!curr_hid) + { + return USBD_FAIL; + } + + // Standard Request - Get Hid Report Descriptor + if ((setup->bmRequestType & USB_REQUEST_TYPE_MASK) == USB_REQUEST_STANDARD) + { + if (setup->bRequest == USB_REQUEST_GET_DESCRIPTOR) + { + uint8_t desc_typ = (uint8_t)(setup->wValue >> 8); + + DEBUG("HID Get_Desc(type:%x,intf:%d)", desc_typ, intf_num); + if (desc_typ == HID_DESC_TYPE_HID_REPORT) + { + if (curr_hid) + { + *len = curr_hid->hid_intf->desc_size; + *data = (uint8_t *)curr_hid->hid_intf->report_desc; + } + return USBD_OK; + } + } + + return USBD_FAIL; + } + + // Class Request - HID Get/Set + switch (setup->bRequest) + { + case HID_REQUEST_GET_REPORT: + { + DEBUG("HID Get_Report(report_id:%d,report_type:%d)", LO_BYTE(setup->wValue), HI_BYTE(setup->wValue)); + + *data = (uint8_t *)&curr_hid->report; + *len = 1; + } + break; + + case HID_REQUEST_GET_IDLE: + { + DEBUG("HID Get_Idle(report_id:%d)", LO_BYTE(setup->wValue)); + + *data = (uint8_t *)&curr_hid->idle_state; + *len = 1; + } + break; + + case HID_REQUEST_GET_PROTOCOL: + { + DEBUG("HID Get_Protocol"); + + *data = (uint8_t *)&curr_hid->protocol; + *len = 1; + } + break; + + case HID_REQUEST_SET_REPORT: + { + DEBUG("HID Set_Report(report_id:%d,report_type:%d,report_len:%d,report_data:%02X)", LO_BYTE(setup->wValue), + HI_BYTE(setup->wValue), *len, (*data)[0]); + + if (*len == 1) + { + curr_hid->report = (*data)[0]; + usbd_hid_leds((*data)[0]); + } + } + break; + + case HID_REQUEST_SET_IDLE: + { + DEBUG("HID Set_Idle(report_id:%d,duration:%d)", LO_BYTE(setup->wValue), HI_BYTE(setup->wIndex)); + + curr_hid->idle_state = HI_BYTE(setup->wIndex); + } + break; + + case HID_REQUEST_SET_PROTOCOL: + { + DEBUG("HID Set_Protocol(%d)", LO_BYTE(setup->wValue)); /*protocol*/ + + curr_hid->protocol = LO_BYTE(setup->wValue); + } + break; + + default: + { + DEBUG("Unhandled HID Class bRequest 0x%02x", setup->bRequest); + return USBD_FAIL; + } + } + + return USBD_OK; +} +#endif // CFG_USB diff --git a/projects/bleRemoteControl/Master/src/usbd_hid.h b/projects/bleRemoteControl/Master/src/usbd_hid.h new file mode 100644 index 0000000..ec1a992 --- /dev/null +++ b/projects/bleRemoteControl/Master/src/usbd_hid.h @@ -0,0 +1,98 @@ +/** + **************************************************************************************** + * + * @file usbd_hid.h + * + * @brief Header file of USB HID function + * + **************************************************************************************** + */ + +#ifndef _USBD_HID_H_ +#define _USBD_HID_H_ + +#include +#include "usb_hid.h" + +#if !defined(HID_INST_CNT) +// MAX Count of HID Instances +#define HID_INST_CNT (2) +#endif + +/* Macro for template descriptor */ +#define HID_INTERFACE_INIT(intf_num, ep_cnt, subclass, proto, str_idx, desc_size) \ + /* Descriptor of interface */ \ + 0x09, /* bLength: Interface Descriptor size */ \ + USB_DESC_TYPE_INTERFACE, /* bDescriptorType: Interface descriptor type */ \ + intf_num, /* bInterfaceNumber: Number of Interface */ \ + 0x00, /* bAlternateSetting: Alternate setting */ \ + ep_cnt, /* bNumEndpoints */ \ + 0x03, /* bInterfaceClass: HID */ \ + subclass, /* bInterfaceSubClass : 1=BOOT, 0=no boot */ \ + proto, /* bInterfaceProtocol : 0=none, 1=keyboard, 2=mouse */ \ + str_idx, /* iInterface: Index of string descriptor */ \ + /* Descriptor of HID Report */ \ + 0x09, /* bLength: HID Descriptor size */ \ + HID_DESC_TYPE_HID, /* bDescriptorType: HID */ \ + 0x11, /* bcdHID: HID Class Spec release number */ \ + 0x01, \ + 0x00, /* bCountryCode: Hardware target country */ \ + 0x01, /* bNumDescriptors: Number of HID class descriptors */ \ + HID_DESC_TYPE_HID_REPORT, /* bDescriptorType */ \ + desc_size, /* wItemLength: Total length of Report descriptor */ \ + 0x00 \ + +#define HID_ENDPOINT_DESC(ep_addr, ep_mps, interval) \ + 0x07, /* bLength: Endpoint Descriptor size */ \ + USB_DESC_TYPE_ENDPOINT, /* bDescriptorType: */ \ + ep_addr, /* bEndpointAddress: Endpoint Address (IN) */ \ + 0x03, /* bmAttributes: Interrupt endpoint */ \ + ep_mps, /* wMaxPacketSize: 4 Byte max */ \ + 0x00, \ + interval /* bInterval: Polling Interval */ + + +enum hid_state_type { + HID_STATE_IDLE, + HID_STATE_BUSY, +}; + +typedef struct hid_intf_tag { + uint8_t intf_num; + uint8_t ep_in; + uint16_t desc_size; + const uint8_t *report_desc; +} hid_intf_t; + +#define HID_INTF_T(_intf_num, _ep_in, _desc) \ + { .intf_num=_intf_num, .ep_in=_ep_in, \ + .desc_size=sizeof(_desc), .report_desc=_desc } + +typedef struct usbd_hid_tag { + const hid_intf_t *hid_intf; + union + { + struct + { + volatile uint8_t hid_state; + uint8_t report; + uint8_t idle_state; + uint8_t protocol; + }; + uint32_t hid_info; + }; +} usbd_hid_t; + +void usbd_hid_init(uint8_t idx, const hid_intf_t *intf); + +void usbd_hid_reset(void); + +void usbd_hid_leds(uint8_t state); + +uint8_t usbd_hid_send_report(uint8_t ep, uint8_t len, const uint8_t *data); + +void usbd_hid_ep_in_handler(uint8_t ep); + +uint8_t usbd_hid_class_handler(struct usb_setup_packet *setup, uint8_t **data, uint16_t *len); + +#endif // _USBD_HID_H_ diff --git a/projects/bleRemoteControl/Master/说明.txt b/projects/bleRemoteControl/Master/说明.txt new file mode 100644 index 0000000..171aa1a --- /dev/null +++ b/projects/bleRemoteControl/Master/说明.txt @@ -0,0 +1,7 @@ +语音遥控器-主机工程: +需使用USB连接上位机软件,进行调试. + +上位机调试软件: +sdk6\tools\HidVoc\hidVoc.exe +上位机调试软件源码: +sdk6\tools\HidVoc\\projects \ No newline at end of file diff --git a/projects/bleRemoteControl/Slave/mdk/JLinkSettings.ini b/projects/bleRemoteControl/Slave/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/projects/bleRemoteControl/Slave/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/projects/bleRemoteControl/Slave/mdk/bleRC_S.uvoptx b/projects/bleRemoteControl/Slave/mdk/bleRC_S.uvoptx new file mode 100644 index 0000000..566d7ce --- /dev/null +++ b/projects/bleRemoteControl/Slave/mdk/bleRC_S.uvoptx @@ -0,0 +1,623 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + bleRC_S + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + DLGUARM + + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FN1 -FC1000 -FD20003000 -FF0B6x_256kB_PY_D -FL040000 -FS018000000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + JL2CM3 + -U59701306 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC1000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 0 + 1 + hid_env + + + 1 + 1 + key_env + + + + + 1 + 1 + 0x20003000 + 0 + + + + + 2 + 1 + 0x40010000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + System Viewer\ADC + 35905 + + + + + + + src + 1 + 0 + 0 + 0 + + 1 + 1 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 1 + 2 + 5 + 0 + 0 + 0 + ..\src\app_user.h + app_user.h + 0 + 0 + + + 1 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 1 + 4 + 1 + 0 + 0 + 0 + ..\src\myapp.c + myapp.c + 0 + 0 + + + 1 + 5 + 1 + 0 + 0 + 0 + ..\src\batt.c + batt.c + 0 + 0 + + + 1 + 6 + 1 + 0 + 0 + 0 + ..\src\proc.c + proc.c + 0 + 0 + + + 1 + 7 + 1 + 0 + 0 + 0 + ..\src\keys.c + keys.c + 0 + 0 + + + 1 + 8 + 1 + 0 + 0 + 0 + ..\src\hid_desc.c + hid_desc.c + 0 + 0 + + + 1 + 9 + 1 + 0 + 0 + 0 + ..\src\micphone.c + micphone.c + 0 + 0 + + + + + core + 1 + 0 + 0 + 0 + + 2 + 10 + 2 + 0 + 0 + 0 + ..\..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 11 + 5 + 0 + 0 + 0 + ..\..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 12 + 4 + 0 + 0 + 0 + ..\..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + modules + 1 + 0 + 0 + 0 + + 4 + 13 + 1 + 0 + 0 + 0 + ..\..\..\..\modules\src\sftmr.c + sftmr.c + 0 + 0 + + + 4 + 14 + 1 + 0 + 0 + 0 + ..\..\..\..\modules\src\uart1Rb.c + uart1Rb.c + 0 + 0 + + + 4 + 15 + 1 + 0 + 0 + 0 + ..\..\..\..\modules\src\btns.c + btns.c + 0 + 0 + + + 4 + 16 + 1 + 0 + 0 + 0 + ..\..\..\..\modules\src\adpcm.c + adpcm.c + 0 + 0 + + + + + ble\app + 1 + 0 + 0 + 0 + + 5 + 17 + 1 + 0 + 0 + 0 + ..\src\app.c + app.c + 0 + 0 + + + 5 + 18 + 1 + 0 + 0 + 0 + ..\src\app_actv.c + app_actv.c + 0 + 0 + + + 5 + 19 + 1 + 0 + 0 + 0 + ..\..\..\..\ble\app\app_gapm.c + app_gapm.c + 0 + 0 + + + 5 + 20 + 1 + 0 + 0 + 0 + ..\..\..\..\ble\app\app_gapc.c + app_gapc.c + 0 + 0 + + + 5 + 21 + 1 + 0 + 0 + 0 + ..\src\app_msg.c + app_msg.c + 0 + 0 + + + + + ble\prf + 1 + 0 + 0 + 0 + + 6 + 22 + 1 + 0 + 0 + 0 + ..\..\..\..\ble\prf\prf_diss.c + prf_diss.c + 0 + 0 + + + 6 + 23 + 1 + 0 + 0 + 0 + ..\..\..\..\ble\prf\prf_bass.c + prf_bass.c + 0 + 0 + + + 6 + 24 + 1 + 0 + 0 + 0 + ..\src\prf_hids.c + prf_hids.c + 0 + 0 + + + + + ble\lib + 1 + 0 + 0 + 0 + + 7 + 25 + 4 + 0 + 0 + 0 + ..\..\..\..\ble\lib\ble6_lite.lib + ble6_lite.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 8 + 26 + 1 + 0 + 0 + 0 + ..\..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/projects/bleRemoteControl/Slave/mdk/bleRC_S.uvprojx b/projects/bleRemoteControl/Slave/mdk/bleRC_S.uvprojx new file mode 100644 index 0000000..9cdea00 --- /dev/null +++ b/projects/bleRemoteControl/Slave/mdk/bleRC_S.uvprojx @@ -0,0 +1,560 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + bleRC_S + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20003000 -FC1000 -FN1 -FF0B6x_256kB_PY_D -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM)) + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + bleRC_S + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + -REMAP + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 4 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x1000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + CACHE_USE_SRAM + + ..\src;..\..\..\..\core;..\..\..\..\core\reg;..\..\..\..\drivers\api;..\..\..\..\modules\api;..\..\..\..\ble\api;..\..\..\..\ble\app;..\..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\src\link_xip_blelite.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + app_user.h + 5 + ..\src\app_user.h + + + main.c + 1 + ..\src\main.c + + + myapp.c + 1 + ..\src\myapp.c + + + batt.c + 1 + ..\src\batt.c + + + proc.c + 1 + ..\src\proc.c + + + keys.c + 1 + ..\src\keys.c + + + hid_desc.c + 1 + ..\src\hid_desc.c + + + micphone.c + 1 + ..\src\micphone.c + + + + + core + + + startup.s + 2 + ..\..\..\..\core\mdk\startup.s + + + + + drivers + + + drvs.h + 5 + ..\..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\..\drivers\lib\drvs.lib + + + + + modules + + + sftmr.c + 1 + ..\..\..\..\modules\src\sftmr.c + + + uart1Rb.c + 1 + ..\..\..\..\modules\src\uart1Rb.c + + + btns.c + 1 + ..\..\..\..\modules\src\btns.c + + + adpcm.c + 1 + ..\..\..\..\modules\src\adpcm.c + + + + + ble\app + + + app.c + 1 + ..\src\app.c + + + app_actv.c + 1 + ..\src\app_actv.c + + + app_gapm.c + 1 + ..\..\..\..\ble\app\app_gapm.c + + + app_gapc.c + 1 + ..\..\..\..\ble\app\app_gapc.c + + + app_msg.c + 1 + ..\src\app_msg.c + + + + + ble\prf + + + prf_diss.c + 1 + ..\..\..\..\ble\prf\prf_diss.c + + + prf_bass.c + 1 + ..\..\..\..\ble\prf\prf_bass.c + + + prf_hids.c + 1 + ..\src\prf_hids.c + + + + + ble\lib + + + ble6_lite.lib + 4 + ..\..\..\..\ble\lib\ble6_lite.lib + + + + + debug + + + debug.c + 1 + ..\..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
diff --git a/projects/bleRemoteControl/Slave/mdk/clean.bat b/projects/bleRemoteControl/Slave/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/projects/bleRemoteControl/Slave/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/projects/bleRemoteControl/Slave/src/app.c b/projects/bleRemoteControl/Slave/src/app.c new file mode 100644 index 0000000..056e091 --- /dev/null +++ b/projects/bleRemoteControl/Slave/src/app.c @@ -0,0 +1,536 @@ +/** + **************************************************************************************** + * + * @file app.c + * + * @brief Application entry point - Example + * + * < __weak func as demo, recommend to Override its in 'user porject'/src/myapp.c > + **************************************************************************************** + */ + +#include "app.h" +#include "bledef.h" +#include "drvs.h" +#include "prf_api.h" +#include "app_user.h" + +#if (DBG_APP) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFAULT CONFIGURATION + **************************************************************************************** + */ + +#if !defined(BLE_DEV_NAME) + #define BLE_DEV_NAME "myBle6" +#endif + +#if !defined(BLE_ADDR) + #define BLE_ADDR { 0x30, 0x06, 0x23, 0x20, 0x01, 0xD2 } +#endif + +#if !defined(BLE_ROLE) +#if (BLE_NB_SLAVE && BLE_NB_MASTER) + #define BLE_ROLE (GAP_ROLE_CENTRAL | GAP_ROLE_PERIPHERAL) +#elif (BLE_NB_MASTER) + #define BLE_ROLE (GAP_ROLE_CENTRAL) +#else // Only Slave + #define BLE_ROLE (GAP_ROLE_PERIPHERAL) +#endif +#endif + +#if !defined(BLE_PHY) + #define BLE_PHY (GAP_PHY_LE_1MBPS) // | GAP_PHY_LE_2MBPS) +#endif + +#if !defined(BLE_PAIRING) + #define BLE_PAIRING (GAPM_PAIRING_LEGACY) +#endif + +#if !defined(BLE_AUTH) + #define BLE_AUTH (GAP_AUTH_REQ_NO_MITM_NO_BOND) +#endif + +#if !defined(BLE_SECREQ) + #define BLE_SECREQ (GAP_NO_SEC) +#endif + + +/* + * VARIABLES DEFINITIONS + **************************************************************************************** + */ + +/// Application Environment +__VAR_ENV struct app_env_tag app_env; + +/// Ble local address (user customize) +const bd_addr_t ble_dev_addr = { BLE_ADDR }; + +/// GAP device configuration +const struct gapm_dev_config ble_dev_config = +{ + // Device Role: Central, Peripheral (@see gap_role) + .gap_role = BLE_ROLE, + + // Pairing mode authorized (@see enum gapm_pairing_mode) + .pairing = BLE_PAIRING, + + // Preferred LE PHY for data (@see enum gap_phy) + .pref_phy = BLE_PHY, + + // Maximal MTU acceptable for device (23~512) + .max_mtu = BLE_MTU, +}; + +/// GAP debug LTK for testing +#if (BLE_DBG_LTK) +const struct gapc_ltk debugLTK = +{ + /// Long Term Key + .ltk = {{0x88, 0x0D, 0x00, 0x20, 0xAC, 0x32, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00}}, + /// Encryption Diversifier + .ediv = 0xB951, + /// Random Number + .randnb = {{0x02, 0x18, 0xAC, 0x32, 0x00, 0x20, 0x00, 0x00}}, + /// Encryption key size (7 to 16) + .key_size = 16, + /// Extend Info + .ext_info =0, +}; +#endif + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @section Profile Interface + **************************************************************************************** + */ + +// Connection interval unit in 1.25ms +#define SLV_PREF_INTV_MIN (SLV_INTV_MIN) +#define SLV_PREF_INTV_MAX (SLV_INTV_MIN) +// Slave latency +#define SLV_PREF_LATENCY (49) +// Connection supervision timeout multiplier unit in 10ms +#define SLV_PREF_TIME_OUT (300) + +const struct gapc_conn_param dft_conn_param = +{ + .intv_min = SLV_PREF_INTV_MIN, + .intv_max = SLV_PREF_INTV_MAX, + .latency = SLV_PREF_LATENCY, + .time_out = SLV_PREF_TIME_OUT, +}; +/** + **************************************************************************************** + * @brief Retrieve Dev Info to Generic Access Profile, User implement for Callback. + * + * @param[in] conidx connection index + * @param[in] req iequest of info type @see enum gapc_dev_info + * @param[in] maxlen buffer length, DEV_NAME_MAX_LEN or size of gapc_conn_param + * @param[out] info pointer of buffer + * + * @return Length of device information, 0 means an error occurs. + **************************************************************************************** + */ +__weak uint16_t gap_svc_get_dev_info(uint8_t conidx, uint8_t req, uint16_t maxlen, uint8_t *info) +{ + if (req == GAPC_DEV_NAME) + { + return app_name_get(DEV_NAME_MAX_LEN, info); + } + else if (req == GAPC_DEV_APPEARANCE) + { + write16(info, app_icon_get()); + return sizeof(uint16_t); + } + #if (GAP_ATT_CFG & 0x40/*PCP_EN*/) + else if (req == GAPC_DEV_SLV_PREF_PARAMS) + { + // Peripheral Preferred Connection Parameters + memcpy(info, (uint8_t *)&dft_conn_param, sizeof(struct gapc_conn_param)); + return sizeof(struct gapc_conn_param); + } + #endif + + return 0; +} + +/** + **************************************************************************************** + * @brief Create profiles, maybe User Override! (__weak func) + * Added in order and judged status in each profile-func. + **************************************************************************************** + */ +__weak void app_prf_create(void) +{ + // Generic Access Profile(0x1800) + gap_svc_init(GAP_START_HDL, GAP_ATT_CFG); + + // Generic Attribute Profile(0x1801) + #if (BLE_NB_SLAVE) + gatt_svc_init(GATT_START_HDL); + #endif + + // Standard Profiles + #if (PRF_DISS) + diss_svc_init(); + #endif + + #if (PRF_BASS) + bass_svc_init(); + #endif + + #if (PRF_HIDS) + hids_prf_init(); + #endif + + #if (PRF_SCPS) + scps_svc_init(); + #endif + + #if (PRF_MESH) + mal_svc_init(MAL_START_HDL, MAL_SVC_CFG); + #endif + + // Customize Profiles + #if (PRF_SESS) + sess_svc_init(); + #endif + + #if (PRF_OTAS) + otas_svc_init(); + #endif + + #if (PRF_PTSS) + ptss_svc_init(); + #endif +} + + +/** + **************************************************************************************** + * @section App Interface + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief API to Init Application, maybe User Override! (__weak func) + * + * @param[in] rsn reset reason @see enum rst_src_bfs + **************************************************************************************** + */ +__weak void app_init(uint16_t rsn) +{ + // Init BLE and App to startup or Resume BLE to continue if it wakeup from poweroff. + #if (BLE_LITELIB) +// if (RSN_IS_BLE_WKUP(rsn)) + if ((rsn & RSN_POR12_CORE_BIT) && (AON->PMU_WKUP_CTRL.Word & CFG_WKUP_BLE_EN)) + { + // Resume BLE (Only supported in LiteLib) + ble_resume(); + rc32k_conf(RCLK_DPLL, 7); + + if (rsn & RSN_IO_WKUP_BIT) + { + ble_wakeup(); + } + + keys_proc(); + } + else + #endif //(BLE_LITELIB) + { + heap_cfg_t heap; + + // Config Heap, resized with special lib + heap.base[MEM_ENV] = BLE_HEAP_BASE; + heap.size[MEM_ENV] = BLE_HEAP_ENV_SIZE; + heap.base[MEM_MSG] = BLE_HEAP_BASE + BLE_HEAP_ENV_SIZE; + heap.size[MEM_MSG] = BLE_HEAP_MSG_SIZE; + ble_heap(&heap); + + // Init BLE and App + ble_init(); + ble_app(); + + // Init RC32K with Calibration + #if (CFG_SLEEP || RC32K_CALIB_PERIOD) + //rc32k_init(); - replace to watch calib result + rc32k_conf(RCLK_DPLL, 7); + + uint16_t trim = rc32k_calib(); + DEBUG("RC32K Calib(Msb:%d,Lsb:%d)", trim & 0xF, trim >> 4); + #endif //(CFG_SLEEP || RC32K_CALIB_PERIOD) + + #if (CFG_SLEEP) + ble_drift_set(1200); + #endif + + adv_dir_flag = true;// 㲥 + } + + // Init RF & Modem + rfmdm_init(); + + NVIC_EnableIRQ(BLE_IRQn); +} + +/** + **************************************************************************************** + * @brief API to Set State of Application, maybe User Override! (__weak func) + * + * @param[in] state new state + **************************************************************************************** + */ +__weak void app_state_set(uint8_t state) +{ + DEBUG("State(old:%d,new:%d)", app_state_get(), state); + + app_env.state = state; + + // Indication, User add more... + +} + +/** + **************************************************************************************** + * @brief API to Get Device Name, maybe User Override! (__weak func) + * + * @param[in] size Length of name Buffer + * @param[out] name Pointer of name buffer + * + * @return Length of device name + **************************************************************************************** + */ +__weak uint8_t app_name_get(uint8_t size, uint8_t *name) +{ + uint8_t BLE_DEV_NAME_A[] = BLE_DEV_NAME; + + uint8_t len = sizeof(BLE_DEV_NAME_A) - 1; + + memcpy(name, BLE_DEV_NAME_A, len); + + return len; +} + + +/** + **************************************************************************************** + * @section FSM Interface + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Finite state machine for Device Configure, maybe User Override! (__weak func) + * + * @param[in] evt configure event @see enum ble_event + **************************************************************************************** + */ +__weak void app_conf_fsm(uint8_t evt) +{ + if (evt == BLE_RESET) + { + memset(&app_env, 0, sizeof(app_env)); + + // Set device config + gapm_set_dev(&ble_dev_config, &ble_dev_addr, NULL); + } + else /*if (evt == BLE_CONFIGURED)*/ + { + #if (CFG_SLEEP) + // Set Sleep duration if need + + #if (RC32K_CALIB_PERIOD) + ke_timer_set(APP_TIMER_RC32K_CORR, TASK_APP, RC32K_CALIB_PERIOD); + #endif //(RC32K_CALIB_PERIOD) + #endif //(CFG_SLEEP) + + app_state_set(APP_IDLE); + // Create Profiles + app_prf_create(); + + // Create Activities + app_actv_create(); + + ke_timer_set(APP_TIMER_KEY_SCAN, TASK_APP, KEY_SCAN_PERIOD); + } +} + +/** + **************************************************************************************** + * @brief Finite state machine for connection event, maybe User Override! (__weak func) + * + * @param[in] evt connection event @see enum ble_event + * @param[in] conidx connection index + * @param[in] param param of connection event + **************************************************************************************** + */ +__weak void app_conn_fsm(uint8_t evt, uint8_t conidx, const void* param) +{ + switch (evt) + { + case BLE_CONNECTED: + { + // Connected state, record Index + app_env.curidx = conidx; + app_state_set(APP_CONNECTED); + + gatt_exmtu(conidx, 247); + gapc_update_dle(app_env.curidx,247,LE_MAX_TIME); + + gapc_connect_rsp(conidx, BLE_AUTH); + // Enable profiles by role + } break; + + case BLE_DISCONNECTED: + { + rc32k_calib(); + + app_state_set(APP_IDLE); + + struct gapc_disconnect_ind *dis_param = (struct gapc_disconnect_ind *)param; +// if (dis_param->reason == LE_ERR_HL2HCI(LL_ERR_REMOTE_USER_TERM_CON) || +// dis_param->reason == LE_ERR_HL2HCI(LL_ERR_REMOTE_DEV_POWER_OFF)) + if (dis_param->reason == LE_ERR_HL2HCI(LL_ERR_CON_TERM_BY_LOCAL_HOST)) + { + app_adv_action(ACTV_START); + app_state_set(APP_READY); + } + else + { + keys_sleep(); + } + } break; + + case BLE_BONDED: + { + // todo, eg. save the generated slave's LTK to flash + app_ltk_save(conidx, NULL); + app_state_set(APP_BONDED); + } break; + + case BLE_ENCRYPTED: + { + app_state_set(APP_ENCRYPTED); + // todo + } break; + + default: + break; + } +} + + +/** + **************************************************************************************** + * @section SMP Interface + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief API to Get Pairing Feature, maybe User Override! (__weak func) + * + * @param[out] feat Pointer of pairing buffer to fill + **************************************************************************************** + */ +__weak void app_pairing_get(struct gapc_pairing *feat) +{ + // IO capabilities (@see gap_io_cap) + feat->iocap = GAP_IO_CAP_NO_INPUT_NO_OUTPUT; + // OOB information (@see gap_oob) + feat->oob = GAP_OOB_AUTH_DATA_NOT_PRESENT; + // Authentication (@see gap_auth) + feat->auth = BLE_AUTH; + // Encryption key size (7 to 16) + feat->key_size = GAP_KEY_LEN; + //Initiator key distribution (@see gap_kdist) + feat->ikey_dist = GAP_KDIST_NONE; + //Responder key distribution (@see gap_kdist) + feat->rkey_dist = GAP_KDIST_ENCKEY; + // Device security requirements (@see gap_sec_req) + feat->sec_req = BLE_SECREQ; +} + +/** + **************************************************************************************** + * @brief API to Generate LTK for bonding, maybe User Override! (__weak func) + * + * @param[in] conidx connection index + * @param[in|out] ltk Pointer of ltk buffer + **************************************************************************************** + */ +__weak void app_ltk_gen(uint8_t conidx, struct gapc_ltk *ltk) +{ + // generate key values, User need record it to save later + // ltk->ediv = (uint16_t)rand_word(); + // ltk->key_size = GAP_KEY_LEN; + // ltk->ext_info = 0; + // for (uint8_t i = 0; i < GAP_RAND_NB_LEN; i++) + // { + // ltk->randnb.nb[i] = (uint8_t)rand_word(); + // } + // for (uint8_t i = 0; i < GAP_KEY_LEN; i++) + // { + // ltk->ltk.key[i] = (uint8_t)rand_word(); + // } + + #if (BLE_DBG_LTK) + // (here use debugLTK as testing) + memcpy(ltk, &debugLTK, sizeof(struct gapc_ltk)); + #endif +} + +/** + **************************************************************************************** + * @brief API to Save LTK when bonded, maybe User Override! (__weak func) + * + * @param[in] conidx connection index + * @param[in] ltk Pointer of LTK data + **************************************************************************************** + */ +__weak void app_ltk_save(uint8_t conidx, const struct gapc_ltk *ltk) +{ + // todo, save slave's LTK to flash +} + +/** + **************************************************************************************** + * @brief API to Find LTK when re-encryption, maybe User Override! (__weak func) + * + * @param[in] ediv EDIV value for matching + * @param[in] rand_nb Rand Nb values for matching + * + * @return NULL for not matched, else return Pointer of LTK found. + **************************************************************************************** + */ +__weak const uint8_t *app_ltk_find(uint16_t ediv, const uint8_t *rand_nb) +{ + // Compare ediv and rand_nb (here use debugLTK as testing) + #if (BLE_DBG_LTK) + if ((ediv == debugLTK.ediv) + && (memcmp(rand_nb, debugLTK.randnb.nb, GAP_RAND_NB_LEN) == 0)) + { + return debugLTK.ltk.key; + } + #endif + + // Not found + return NULL; +} diff --git a/projects/bleRemoteControl/Slave/src/app.h b/projects/bleRemoteControl/Slave/src/app.h new file mode 100644 index 0000000..13faaba --- /dev/null +++ b/projects/bleRemoteControl/Slave/src/app.h @@ -0,0 +1,346 @@ +/** + **************************************************************************************** + * + * @file app.h + * + * @brief Header file - Application Defines + * + **************************************************************************************** + */ + +#ifndef _APP_H_ +#define _APP_H_ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include +#include "string.h" +#include "blelib.h" +#include "ke_api.h" +#include "app_actv.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Number of Roles, Local Device act as Slave or Master +#if !defined(BLE_NB_SLAVE) + #define BLE_NB_SLAVE (1) +#endif + +#if !defined(BLE_NB_MASTER) + #define BLE_NB_MASTER (0) +#endif + +#if (BLE_NB_SLAVE + BLE_NB_MASTER > BLE_CONNECTION_MAX) + #error "Number of roles must not exceed BLE_CONNECTION_MAX" +#endif + +/// Single or Multiple Connections +#if (BLE_NB_SLAVE + BLE_NB_MASTER > 1) + #define BLE_MULTI_CONN (1) +#else + #define BLE_MULTI_CONN (0) +#endif + +/// Enable of Activities(adv/scan/init) +#if !defined(BLE_EN_ADV) + #define BLE_EN_ADV (BLE_NB_SLAVE) +#endif + +#if !defined(BLE_EN_SCAN) + #define BLE_EN_SCAN (BLE_NB_MASTER) +#endif + +#if !defined(BLE_EN_INIT) + #define BLE_EN_INIT (BLE_NB_MASTER) +#endif + +#if !defined(APP_ACTV_EN) + #define APP_ACTV_EN (BLE_EN_ADV || BLE_EN_SCAN || BLE_EN_INIT) +#endif + +/// Enable Pairing and Bond, used debugLTK +#if !defined(BLE_EN_SMP) + #define BLE_EN_SMP (1) +#endif + +#if !defined(BLE_DBG_LTK) + #define BLE_DBG_LTK (0) +#endif + +/// Maximal Transmission Unit +#if !defined(BLE_MTU) + #define BLE_MTU (128) +#endif + +/// Maximal length of the Device Name value +#define DEV_NAME_MAX_LEN (40) + +/// Generic Access Service +#if !defined(BLE_DEV_ICON) + #define BLE_DEV_ICON (0x0000) // Unknow appearance +#endif + +/// Period of RC32K Calibration(0 means only calib once when init) +#if !defined(RC32K_CALIB_PERIOD) && (CFG_SLEEP) + #define RC32K_CALIB_PERIOD (15000) // unit in 1ms +#endif + +#if ((RC32K_CALIB_PERIOD > 0) && (RC32K_CALIB_PERIOD < 1000) && (CFG_SLEEP)) + #error "RC32K_CALIB_PERIOD Less than 1000ms" +#endif + +/* + * MACROS + **************************************************************************************** + */ + +/// Macro of Application Handler Functions +#define APP_SUBTASK_HANDLER(sub) int app_##sub##_handler(msg_id_t msgid, const void *param, \ + task_id_t dest_id, task_id_t src_id) + +#define APP_MSG_HANDLER(msg) static void app_##msg##_handler(msg_id_t msgid, struct msg const *param, \ + task_id_t dest_id, task_id_t src_id) + +#define APP_MSG_HANDLER_T(msg) static void app_##msg##_handler(msg_id_t msgid, const void *param, \ + task_id_t dest_id, task_id_t src_id) + +#define APP_MSG_FUNCTION(msg) app_##msg##_handler(msgid, param, dest_id, src_id) + + +/* + * ENUMERATIONS + **************************************************************************************** + */ + +/// APP Task messages +enum app_msg_id +{ + APP_BASE_MSG = MSG_ID(APP, 0), + + /* Add more messages, such as TIMEOUT */ + APP_TIMER_RC32K_CORR, + APP_TIMER_NO_KEY_PRESS, + APP_TIMER_KEY_SCAN, + APP_TIMER_KEY_ADV_DIR, +}; + +/// States of APP task +enum app_state_type +{ + // Init state + APP_INIT, + // Idle state + APP_IDLE, + // Ready State + APP_READY, + // Connected state + APP_CONNECTED, + APP_PAIRING, + APP_BONDED, + APP_ENCRYPTED, + + // Number of defined states. + APP_STATE_MAX +}; + +/// Event of Ble Finite state machine +enum ble_event +{ + // Configure Events + BLE_RESET, + BLE_CONFIGURED, + + // Connection Events + BLE_CONNECTED, + BLE_DISCONNECTED, + BLE_BONDED, + BLE_ENCRYPTED, +}; + + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// Application environment structure +struct app_env_tag +{ + // Application State + state_t state; + + // Curr Connection Index + uint8_t curidx; + + #if (BLE_MULTI_CONN) + // Bits of Connection Index(0:Not Connect, 1:Connected) + uint8_t conbits; + // Bits of Connection Roles(0:Master or None, 1:Slave) + uint8_t conrole; + #endif //(BLE_MULTI_CONN) +}; + + +/* + * VARIABLE DECLARATION + **************************************************************************************** + */ + +/// Application environment +extern struct app_env_tag app_env; + +/// Ble local address (user customize) +extern const bd_addr_t ble_dev_addr; + +/// GAP device configuration +extern const struct gapm_dev_config ble_dev_config; + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief API to Init Application, maybe User Override! (__weak func) + * + * @param[in] rsn reset reason @see enum rst_src_bfs + **************************************************************************************** + */ +void app_init(uint16_t rsn); + +/** + **************************************************************************************** + * @brief API to Create Profiles, maybe User Override! (__weak func) + * Added in order and judged status in each profile-func. + **************************************************************************************** + */ +void app_prf_create(void); + +/** + **************************************************************************************** + * @brief Finite state machine for Device Configure, maybe User Override! (__weak func) + * + * @param[in] evt configure event @see enum ble_event + **************************************************************************************** + */ +void app_conf_fsm(uint8_t evt); + +/** + **************************************************************************************** + * @brief Finite state machine for connection event, maybe User Override! (__weak func) + * + * @param[in] evt connection event @see enum ble_event + * @param[in] conidx connection index + * @param[in] param param of connection event + **************************************************************************************** + */ +void app_conn_fsm(uint8_t evt, uint8_t conidx, const void*param); + +/** + **************************************************************************************** + * @brief API to Set State of Application, maybe User Override! (__weak func) + * + * @param[in] state new state + **************************************************************************************** + */ +void app_state_set(uint8_t state); + +/** + **************************************************************************************** + * @brief Macro API to Get Application State + * + * @return state type - 1 octets + **************************************************************************************** + */ +static __inline state_t app_state_get(void) +{ + return app_env.state; +} + +/** + **************************************************************************************** + * @brief Macro API to Get Device Appearance + * + * @return icon type - 2 octets + **************************************************************************************** + */ +static __inline uint16_t app_icon_get(void) +{ + return BLE_DEV_ICON; +} + +/** + **************************************************************************************** + * @brief API to Get Device Name, maybe User Override! (__weak func) + * + * @param[in] size Length of name Buffer + * @param[out] name Pointer of name buffer + * + * @return Length of device name + **************************************************************************************** + */ +uint8_t app_name_get(uint8_t size, uint8_t *name); + +/** + **************************************************************************************** + * @brief API to Get Pairing Feature, maybe User Override! (__weak func) + * + * @param[out] feat Pointer of pairing buffer to fill + **************************************************************************************** + */ +void app_pairing_get(struct gapc_pairing *feat); + +/** + **************************************************************************************** + * @brief API to Generate LTK for bonding, maybe User Override! (__weak func) + * + * @param[in] conidx connection index + * @param[out] ltk Pointer of LTK buffer to fill + **************************************************************************************** + */ +void app_ltk_gen(uint8_t conidx, struct gapc_ltk *ltk); + +/** + **************************************************************************************** + * @brief API to Save LTK when bonded, maybe User Override! (__weak func) + * + * @param[in] conidx connection index + * @param[in] ltk Pointer of LTK data + **************************************************************************************** + */ +void app_ltk_save(uint8_t conidx, const struct gapc_ltk *ltk); + +/** + **************************************************************************************** + * @brief API to Find LTK when re-encryption, maybe User Override! (__weak func) + * + * @param[in] ediv EDIV value for matching + * @param[in] rand_nb Rand Nb values for matching + * + * @return NULL for not matched, else return Pointer of LTK found. + **************************************************************************************** + */ +const uint8_t *app_ltk_find(uint16_t ediv, const uint8_t *rand_nb); + +/** + **************************************************************************************** + * @brief Dispatch TASK_APP message to sub-handler. + * + * @param[in] msgid Id of the message received. + * @param[in] task_idx Index of the receiving task instance. + * + * @return Handler of the message or NULL. + **************************************************************************************** + */ +void* app_task_dispatch(msg_id_t msgid, uint8_t task_idx); + +#endif // _APP_H_ diff --git a/projects/bleRemoteControl/Slave/src/app_actv.c b/projects/bleRemoteControl/Slave/src/app_actv.c new file mode 100644 index 0000000..a82ced1 --- /dev/null +++ b/projects/bleRemoteControl/Slave/src/app_actv.c @@ -0,0 +1,984 @@ +/** + **************************************************************************************** + * + * @file app_actv.c + * + * @brief Application Activity(Advertising, Scanning and Initiating) - Example + * + * < If want to modify it, recommend to copy the file to 'user porject'/src > + **************************************************************************************** + */ + +#include "app.h" +#include "gapm_api.h" +#include "app_user.h" + +#if (DBG_ACTV) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Index & State of activities - User Customize +struct actv_env_tag +{ + #if (BLE_EN_ADV) + /// Advertising index and state + uint8_t advidx; + uint8_t advsta; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + /// Scanning index and state + uint8_t scanidx; + uint8_t scansta; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + /// Initiating index and state + uint8_t initidx; + uint8_t initsta; + #endif //(BLE_EN_INIT) +}; + +/// Activities environment +struct actv_env_tag actv_env; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @section Advertising Activity - Example for User Customize + * enable via pre-define @see BLE_EN_ADV + **************************************************************************************** + */ +#if (BLE_EN_ADV) + +#undef DEBUG +#if (DBG_ACTV) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// Advertising duration - 0 mean Always ON (in multiple of 10ms) +#if !defined(APP_ADV_DURATION) + #define APP_ADV_DURATION (0) +#endif + +/// Advertising channel map - 37, 38, 39 +#if !defined(APP_ADV_CHMAP) + #define APP_ADV_CHMAP (0x07) +#endif + +/// Advertising minimum interval - (n)*0.625ms +#if !defined(APP_ADV_INT_MIN) + #define APP_ADV_INT_MIN (36) +#endif + +/// Advertising maximum interval - (n)*0.625ms +#if !defined(APP_ADV_INT_MAX) + #define APP_ADV_INT_MAX (36) +#endif + +#if (APP_ADV_INT_MIN > APP_ADV_INT_MAX) + #error "ADV_INT_MIN must not exceed ADV_INT_MAX" +#endif + +/// Fast advertising interval +#define APP_ADV_FAST_INT (32) + +/// Flag of Fixed data +//#define APP_ADV_FIXED_DATA (0) + +#if (APP_ADV_FIXED_DATA) +/** + * ADV Unit: 1B(Len=1+n) 1B(Type) nB(Data), @see gap_ad_type + * -------------------------------------------------------------------------------------- + * x03 - Length + * x03 - Service 16-bit UUIDs List type + * x00\xFF - Custom Serial Profile:0xFF00 + * x03 - Length + * x19 - Appearance type + * x00\x00 - Unknow Device + * x09 - Length + * x09 - Complete Name type + * myBle5.2 - Device Name + * -------------------------------------------------------------------------------------- + */ +#define APP_ADV_DATA "\x03\x03\x00\xFF\x03\x19\x00\x00\x09\x09myBle5.2" +#define APP_ADV_DATA_LEN (sizeof(APP_ADV_DATA)-1) + +/** + * Scan response data (ADV Unit), @see gap_ad_type + * -------------------------------------------------------------------------------------- + * x09 - Length + * xFF - Vendor specific advertising type + * xC5\x09\x48\x59\x2D\x42\x4C\x45 - CompId(0x09C5) + Serial(BLE) + * x09 - Length + * x09 - Complete Name type + * myBle5.2 - Device Name + * -------------------------------------------------------------------------------------- + */ +#define APP_SCNRSP_DATA "\x09\xFF\xC5\x09\x48\x59\x2D\x42\x4C\x45" +#define APP_SCNRSP_DATA_LEN (sizeof(APP_SCNRSP_DATA)-1) +#endif // (APP_ADV_FIXED_DATA) + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ +static void app_adv_create(void) +{ + struct gapm_adv_create_param adv_param; + + // Advertising type (@see enum gapm_adv_type) + adv_param.type = GAPM_ADV_TYPE_LEGACY; + // Discovery mode (@see enum gapm_adv_disc_mode) + adv_param.disc_mode = GAPM_ADV_MODE_GEN_DISC; + // Advertising properties (@see enum gapm_adv_prop) + #if 0//(DBG_GAPM) + adv_param.prop = GAPM_ADV_PROP_UNDIR_CONN_MASK | GAPM_ADV_PROP_SCAN_REQ_NTF_EN_BIT; + #else + adv_param.prop = GAPM_ADV_PROP_UNDIR_CONN_MASK; + #endif + // Filtering policy (@see enum gapm_adv_filter_policy) + adv_param.filter_pol = GAPM_ADV_ALLOW_SCAN_ANY_CON_ANY; + // Config primary advertising (@see gapm_adv_prim_cfg) + adv_param.prim_cfg.phy = GAP_PHY_LE_1MBPS; + adv_param.prim_cfg.chnl_map = APP_ADV_CHMAP; + adv_param.prim_cfg.adv_intv_min = APP_ADV_INT_MIN; + adv_param.prim_cfg.adv_intv_max = APP_ADV_INT_MAX; + + if (adv_dir_flag) + { + uint8_t masterAddr[6] = {0x11, 0x88, 0x3F, 0xA1, 0x01, 0xf3}; + adv_param.prop = GAPM_ADV_PROP_DIR_CONN_MASK; + memcpy(&adv_param.peer_addr.addr.addr[0], masterAddr, GAP_BD_ADDR_LEN); + adv_param.peer_addr.addr_type = 0; + adv_param.disc_mode = GAPM_ADV_MODE_NON_DISC; + // debug("0000\r\n"); + + adv_param.prim_cfg.adv_intv_min = 6; + adv_param.prim_cfg.adv_intv_max = 6; + ke_timer_set(APP_TIMER_KEY_ADV_DIR, TASK_APP, 1300); // 1.3s + } + + DEBUG("create(disc:%d,prop:%d,flag:%d)\r\n", adv_param.disc_mode, adv_param.prop, wakeup_flag); + + gapm_create_advertising(GAPM_STATIC_ADDR, &adv_param); +} + +static void app_adv_set_adv_data(void) +{ +#if (APP_ADV_FIXED_DATA) + gapm_set_adv_data(actv_env.advidx, GAPM_SET_ADV_DATA, + APP_ADV_DATA_LEN, (const uint8_t *)APP_ADV_DATA); +#else + // Reserve 3Bytes for AD_TYPE_FLAGS + uint8_t adv_data[GAP_ADV_DATA_LEN]; + uint8_t length = 26; + + // Set flags: 3B + adv_data[0] = 0x02; + adv_data[1] = GAP_AD_TYPE_FLAGS; // 0x01 0xFF;// + adv_data[2] = 0x05; + + adv_data[3] = 0x03; + adv_data[4] = GAP_AD_TYPE_MANU_SPECIFIC_DATA; //0xFF + adv_data[5] = 0x00; + adv_data[6] = 0x00; + + adv_data[7] = 0x06; + adv_data[8] = GAP_AD_TYPE_SHORTENED_NAME; //0x08 + adv_data[9] = 0x4D; + adv_data[10] = 0x49; + adv_data[11] = 0x20; + adv_data[12] = 0x52; + adv_data[13] = 0x43; + + // Set list of UUIDs: 4B + adv_data[14] = 0x03; + adv_data[15] = GAP_AD_TYPE_MORE_16_BIT_UUID; // 0x02 + #if (PRF_HIDS) + write16p(&adv_data[16], 0x1812); // HID Service + #else + write16p(&adv_data[5], 0xFF00); // Serial Service + #endif + + adv_data[18] = 0x04; + adv_data[19] = GAP_AD_TYPE_CLASS_OF_DEVICE; //0x0D + adv_data[20] = 0x04; + adv_data[21] = 0x05; + adv_data[22] = 0x00; + + adv_data[23] = 0x02; + adv_data[24] = GAP_AD_TYPE_TRANSMIT_POWER; //0x0A + adv_data[25] = 0x00; + + // Set appearance: 4B +// uint16_t icon = app_icon_get(); +// adv_data[7] = 0x03; +// adv_data[8] = GAP_AD_TYPE_APPEARANCE; // 0x19 +// write16p(&adv_data[9], icon); + + gapm_set_adv_data(actv_env.advidx, GAPM_SET_ADV_DATA, length, adv_data); +#endif +} + +static void app_adv_set_scan_rsp(void) +{ +#if (APP_ADV_FIXED_DATA) + gapm_set_adv_data(actv_env.advidx, GAPM_SET_SCAN_RSP_DATA, + APP_SCNRSP_DATA_LEN, (const uint8_t *)APP_SCNRSP_DATA); +#else + uint8_t length; + uint8_t rsp_data[DEV_NAME_MAX_LEN+2]; + + // Set device name + length = app_name_get(DEV_NAME_MAX_LEN, &rsp_data[2]); + rsp_data[0] = length + 1; + rsp_data[1] = GAP_AD_TYPE_COMPLETE_NAME; // 0x09 + + gapm_set_adv_data(actv_env.advidx, GAPM_SET_SCAN_RSP_DATA, length + 2, rsp_data); +#endif +} + +/** + **************************************************************************************** + * @brief Action/Command of Advertising + * + * @param[in] actv_op Operation of activity + **************************************************************************************** + */ +void app_adv_action(uint8_t actv_op) +{ + switch (actv_op) + { + case ACTV_CREATE: + { + if (actv_env.advsta == ACTV_STATE_OFF) + { + //DEBUG("Creating"); + app_adv_create(); + actv_env.advsta = ACTV_STATE_CREATE; + } + } break; + + case ACTV_START: + { + if (actv_env.advsta == ACTV_STATE_READY) + { + DEBUG("Starting"); + gapm_start_advertising(actv_env.advidx, APP_ADV_DURATION); + actv_env.advsta = ACTV_STATE_START; + } + } break; + + case ACTV_STOP: + { + if (actv_env.advsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_STOP; + } + } break; + + case ACTV_DELETE: + { + if ((actv_env.advsta != ACTV_STATE_OFF) && (actv_env.advsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_OFF; + } + } break; + + case ACTV_RELOAD: + { + if (actv_env.advsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_STOP; + } + + if ((actv_env.advsta != ACTV_STATE_OFF) && (actv_env.advsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_OFF; + } + + app_adv_create(); + actv_env.advsta = ACTV_STATE_CREATE; + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Event Procedure of Advertising + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_adv_event(uint8_t gapm_op, uint8_t status) +{ + DEBUG("Evt(op:0x%X,sta:0x%X)", gapm_op, status); + + switch (gapm_op) + { + case (GAPM_CREATE_ADV_ACTIVITY): + { + app_adv_set_adv_data(); + } break; + + case (GAPM_SET_ADV_DATA): + { + app_adv_set_scan_rsp(); + } break; + + case (GAPM_SET_SCAN_RSP_DATA): + { + actv_env.advsta = ACTV_STATE_READY; + + app_adv_action(ACTV_START); + app_state_set(APP_READY); + } break; + + case (GAPM_STOP_ACTIVITY): + { + if ((actv_env.advsta == ACTV_STATE_START) || (actv_env.advsta == ACTV_STATE_STOP)) + { + actv_env.advsta = ACTV_STATE_READY; + } + } break; + + default: + break; + } +} + +#endif //(BLE_EN_ADV) + + +/** + **************************************************************************************** + * @section Scanning Activity - Example for User Customize + * enable via pre-define @see BLE_EN_SCAN + **************************************************************************************** + */ +#if (BLE_EN_SCAN) + +#undef DEBUG +#if (DBG_ACTV) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +#define SCAN_NUM_MAX (5) + +uint8_t scan_cnt = 0; +struct gap_bdaddr scan_addr_list[SCAN_NUM_MAX]; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +static void app_start_scanning(void) +{ + struct gapm_scan_param scan_param; + + /// Type of scanning to be started (@see enum gapm_scan_type) + scan_param.type = GAPM_SCAN_TYPE_CONN_DISC; + /// Properties for the scan procedure (@see enum gapm_scan_prop) + scan_param.prop = GAPM_SCAN_PROP_PHY_1M_BIT | GAPM_SCAN_PROP_ACTIVE_1M_BIT | GAPM_SCAN_PROP_FILT_TRUNC_BIT; + /// Duplicate packet filtering policy (@see enum gapm_dup_filter_pol) + scan_param.dup_filt_pol = GAPM_DUP_FILT_EN; + /// Scan window opening parameters for LE 1M PHY (in unit of 625us) + scan_param.scan_param_1m.scan_intv = GAP_SCAN_FAST_INTV; + scan_param.scan_param_1m.scan_wd = GAP_SCAN_FAST_WIND; + /// Scan window opening parameters for LE Coded PHY + //scan_param.scan_param_coded.scan_intv = GAP_SCAN_SLOW_INTV1; + //scan_param.scan_param_coded.scan_wd = GAP_SCAN_SLOW_WIND1; + /// Scan duration (in unit of 10ms). 0 means that the controller will scan continuously until + /// reception of a stop command from the application + scan_param.duration = 500;//GAP_TMR_GEN_DISC_SCAN; + /// Scan period (in unit of 1.28s). Time interval betweem two consequent starts of a scan duration + /// by the controller. 0 means that the scan procedure is not periodic + scan_param.period = 0; + + gapm_start_activity(actv_env.scanidx, sizeof(struct gapm_scan_param), &scan_param); +} + +/** + **************************************************************************************** + * @brief Action/Command of Scanning + * + * @param[in] actv_op Operation of activity + **************************************************************************************** + */ +void app_scan_action(uint8_t actv_op) +{ + switch (actv_op) + { + case ACTV_CREATE: + { + if (actv_env.scansta == ACTV_STATE_OFF) + { + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_SCAN, GAPM_STATIC_ADDR); + actv_env.scansta = ACTV_STATE_CREATE; + } + } break; + + case ACTV_START: + { + scan_cnt = 0; + + if (actv_env.scansta == ACTV_STATE_READY) + { + DEBUG("Starting"); + app_start_scanning(); + actv_env.scansta = ACTV_STATE_START; + } + } break; + + case ACTV_STOP: + { + if (actv_env.scansta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_STOP; + } + } break; + + case ACTV_DELETE: + { + if ((actv_env.scansta != ACTV_STATE_OFF) && (actv_env.scansta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_OFF; + } + } break; + + case ACTV_RELOAD: + { + if (actv_env.scansta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_STOP; + } + + if ((actv_env.scansta != ACTV_STATE_OFF) && (actv_env.scansta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_OFF; + } + + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_SCAN, GAPM_STATIC_ADDR); + actv_env.scansta = ACTV_STATE_CREATE; + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Event Procedure of Scanning + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_scan_event(uint8_t gapm_op, uint8_t status) +{ + DEBUG("Evt(op:0x%X,sta:0x%X)", gapm_op, status); + + switch (gapm_op) + { + case GAPM_CREATE_SCAN_ACTIVITY: + { + actv_env.scansta = ACTV_STATE_READY; + } break; + + case GAPM_STOP_ACTIVITY: + { + if ((actv_env.scansta == ACTV_STATE_START) || (actv_env.scansta == ACTV_STATE_STOP)) + { + actv_env.scansta = ACTV_STATE_READY; + } + + DEBUG("-->Filter DevAddr"); + for (uint8_t idx = 0; idx < scan_cnt; idx++) + { + DEBUG("Scan List[%d]-->", idx); + debugHex((uint8_t *)(&scan_addr_list[idx]), sizeof(struct gap_bdaddr)); + } + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Store result of Scanning when filter by app_actv_report_ind + * + * @param[in] paddr gap_bdaddr of peer device + **************************************************************************************** + */ +void app_scan_result(const struct gap_bdaddr* paddr) +{ + for (uint8_t i = 0; i < scan_cnt; i++) + { + if (!memcmp(&scan_addr_list[i], paddr,sizeof(struct gap_bdaddr)))//save addr but diffrent + { + return; + } + } + + if (scan_cnt < SCAN_NUM_MAX) //get null array + { + memcpy(&scan_addr_list[scan_cnt], paddr,sizeof(struct gap_bdaddr)); + scan_cnt++; + } +} + +/** + **************************************************************************************** + * @brief Handles activity report. (@see GAPM_EXT_ADV_REPORT_IND) + * + * @param[in] report Report of Advertising data be scanned + **************************************************************************************** + */ +void app_actv_report_ind(struct gapm_ext_adv_report_ind const* report) +{ + // filter report + if ((report->info & GAPM_REPORT_INFO_REPORT_TYPE_MASK) == GAPM_REPORT_TYPE_ADV_LEG) + { + const uint8_t *p_cursor = report->data; + const uint8_t *p_end_cusor = report->data + report->length; + + while (p_cursor < p_end_cusor) + { + // Extract AD type + uint8_t ad_type = *(p_cursor + 1); + + if (ad_type == GAP_AD_TYPE_APPEARANCE) + { + uint16_t icon = read16p(p_cursor+2); + + // Filter special appearance device + if ((icon == 0x03C1) || (icon == 0x03C5)) // HID Gamepad + { + app_scan_result(&report->trans_addr); + break; + } + } + else if ((ad_type == GAP_AD_TYPE_COMPLETE_LIST_16_BIT_UUID) || (ad_type == GAP_AD_TYPE_MORE_16_BIT_UUID)) + { + uint16_t uuid = read16p(p_cursor+2); + + // Filter special uuid device + if (((uuid == 0x18F0) || (uuid == 0xFF00)))// && (param->trans_addr.addr.addr[0] == 0x04)) + { + app_scan_result(&report->trans_addr); + break; + } + } + else + { + // Filter Rule more... + } + + /* Go to next advertising info */ + p_cursor += (*p_cursor + 1); + } + } +} +#endif //(BLE_EN_SCAN) + + +/** + **************************************************************************************** + * @section Initiating Activity - Example for User Customize + * enable via pre-define @see BLE_EN_INIT + **************************************************************************************** + */ +#if (BLE_EN_INIT) + +#undef DEBUG +#if (DBG_ACTV) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + +#if !defined(APP_INIT_TIMEOUT) +#define APP_INIT_TIMEOUT 100 // timeout unit in 10ms +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +const struct gap_bdaddr dflt_peer = +{ + .addr = {{0x11, 0x22, 0x33, 0xa1, 0x01, 0xd3}}, + .addr_type = ADDR_RAND, +}; + +const struct gapm_conn_param dflt_conn_param = +{ + /// Minimum value for the connection interval (in unit of 1.25ms). Allowed range is 7.5ms to 4s. + .conn_intv_min = 10, + /// Maximum value for the connection interval (in unit of 1.25ms). Allowed range is 7.5ms to 4s. + .conn_intv_max = 10, + /// Slave latency. Number of events that can be missed by a connected slave device + .conn_latency = 0, + /// Link supervision timeout (in unit of 10ms). Allowed range is 100ms to 32s + .supervision_to = 300, + /// Recommended minimum duration of connection events (in unit of 625us) + .ce_len_min = 2, + /// Recommended maximum duration of connection events (in unit of 625us) + .ce_len_max = 4, +}; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Start initiating to peer device + * + * @param[in] paddr gap_bdaddr of peer device + **************************************************************************************** + */ +void app_start_initiating(const struct gap_bdaddr* paddr) +{ + if ((actv_env.initsta == ACTV_STATE_READY) || (actv_env.initsta == ACTV_STATE_STOP)) + { + struct gapm_init_param init_param; + + if (paddr == NULL) + { + paddr = &dflt_peer; + } + + init_param.type = GAPM_INIT_TYPE_DIRECT_CONN_EST; + init_param.prop = GAPM_INIT_PROP_1M_BIT; + init_param.conn_to = APP_INIT_TIMEOUT; // timeout unit in 10ms, update from v1.3 + init_param.scan_param_1m.scan_intv = GAP_SCAN_FAST_INTV; + init_param.scan_param_1m.scan_wd = GAP_SCAN_FAST_WIND; + + memcpy(&init_param.conn_param_1m, &dflt_conn_param, sizeof(struct gapm_conn_param)); + memcpy(&init_param.peer_addr, paddr, sizeof(struct gap_bdaddr)); + + gapm_start_activity(actv_env.initidx, sizeof(struct gapm_init_param), &init_param); + + DEBUG("Starting"); + actv_env.initsta = ACTV_STATE_START; + } +} + +/** + **************************************************************************************** + * @brief Action/Command of Initiating + * + * @param[in] actv_op Operation of activity + **************************************************************************************** + */ +void app_init_action(uint8_t actv_op) +{ + switch (actv_op) + { + case ACTV_CREATE: + { + if (actv_env.initsta == ACTV_STATE_OFF) + { + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_INIT, GAPM_STATIC_ADDR); + actv_env.initsta = ACTV_STATE_CREATE; + } + } break; + + case ACTV_START: + { + app_start_initiating(NULL); + } break; + + case ACTV_STOP: + { + if (actv_env.initsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_STOP; + } + } break; + + case ACTV_DELETE: + { + if ((actv_env.initsta != ACTV_STATE_OFF) && (actv_env.initsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_OFF; + } + } break; + + case ACTV_RELOAD: + { + if (actv_env.initsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_STOP; + } + + if ((actv_env.initsta != ACTV_STATE_OFF) && (actv_env.initsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_OFF; + } + + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_INIT, GAPM_STATIC_ADDR); + actv_env.initsta = ACTV_STATE_CREATE; + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Event Procedure of Initiating + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_init_event(uint8_t gapm_op, uint8_t status) +{ + DEBUG("Evt(op:0x%X,sta:0x%X)", gapm_op, status); + + switch (gapm_op) + { + case GAPM_CREATE_INIT_ACTIVITY: + { + actv_env.initsta = ACTV_STATE_READY; + } break; + + case GAPM_STOP_ACTIVITY: + { + if ((actv_env.initsta == ACTV_STATE_START) || (actv_env.initsta == ACTV_STATE_STOP)) + { + actv_env.initsta = ACTV_STATE_READY; + } + } break; + + default: + break; + } +} + +#endif //(BLE_EN_INIT) + + +/** + **************************************************************************************** + * @brief Create activities when Initialization complete. + **************************************************************************************** + */ +void app_actv_create(void) +{ + memset(&actv_env, 0, sizeof(actv_env)); + #if (BLE_EN_ADV) + app_adv_action(ACTV_CREATE); + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + app_scan_action(ACTV_CREATE); + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + app_init_action(ACTV_CREATE); + #endif //(BLE_EN_INIT) +} + +/** + **************************************************************************************** + * @brief Handles activity command complete event. + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_actv_cmp_evt(uint8_t operation, uint8_t status) +{ + switch (operation) + { + #if (BLE_EN_ADV) + case (GAPM_CREATE_ADV_ACTIVITY): + case (GAPM_SET_ADV_DATA): + case (GAPM_SET_SCAN_RSP_DATA): + { + app_adv_event(operation, status); + } break; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + case GAPM_CREATE_SCAN_ACTIVITY: + { + app_scan_event(operation, status); + } break; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + case GAPM_CREATE_INIT_ACTIVITY: + { + app_init_event(operation, status); + } break; + #endif //(BLE_EN_INIT) + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Handles activity created. (@see GAPM_ACTIVITY_CREATED_IND) + * + * @param[in] actv_type Type of activities(@see enum gapm_actv_type) + * @param[in] actv_idx Index of activities created + **************************************************************************************** + */ +void app_actv_created_ind(uint8_t actv_type, uint8_t actv_idx) +{ + switch (actv_type) + { + #if (BLE_EN_ADV) + case GAPM_ACTV_TYPE_ADV: + { + actv_env.advidx = actv_idx; + } break; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + case GAPM_ACTV_TYPE_SCAN: + { + actv_env.scanidx = actv_idx; + } break; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + case GAPM_ACTV_TYPE_INIT: + { + actv_env.initidx = actv_idx; + } break; + #endif //(BLE_EN_INIT) + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Handles activity stopped. (@see GAPM_ACTIVITY_STOPPED_IND) + * + * @param[in] actv_type Type of activity(@see enum gapm_actv_type) + * @param[in] reason Reason of stopped + **************************************************************************************** + */ +void app_actv_stopped_ind(uint8_t actv_type, uint8_t actv_idx, uint8_t reason) +{ + switch (actv_type) + { + #if (BLE_EN_ADV) + case GAPM_ACTV_TYPE_ADV: + { + // Advertising Stopped by slave connection or duration timeout + app_adv_event(GAPM_STOP_ACTIVITY, reason); + + // Duration timeout, go IDLE - update from v1.3 + if ((reason == GAP_ERR_TIMEOUT) && (app_state_get() == APP_READY)) + { + app_state_set(APP_IDLE); + } + } break; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + case GAPM_ACTV_TYPE_SCAN: + { + app_scan_event(GAPM_STOP_ACTIVITY, reason); + } break; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + case GAPM_ACTV_TYPE_INIT: + { + app_init_event(GAPM_STOP_ACTIVITY, reason); + } break; + #endif //(BLE_EN_INIT) + + default: + break; + } +} diff --git a/projects/bleRemoteControl/Slave/src/app_msg.c b/projects/bleRemoteControl/Slave/src/app_msg.c new file mode 100644 index 0000000..2d87e93 --- /dev/null +++ b/projects/bleRemoteControl/Slave/src/app_msg.c @@ -0,0 +1,185 @@ +/** + **************************************************************************************** + * + * @file app_msg.c + * + * @brief Application Messages Handler - Example + * + * < If want to modify it, recommend to copy the file to 'user porject'/src > + **************************************************************************************** + */ +#include "drvs.h" +#include "gapc_api.h" +#include "bledef.h" +#include "app_user.h" + +#if (DBG_APP) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + +__RETENTION uint16_t g_no_action_cnt; +__RETENTION bool last_sta; +/* + * MESSAGE HANDLERS + **************************************************************************************** + */ + +/// SubTask Declaration, User add more... +extern APP_SUBTASK_HANDLER(gapm_msg); +extern APP_SUBTASK_HANDLER(gapc_msg); +extern APP_SUBTASK_HANDLER(gatt_msg); +extern APP_SUBTASK_HANDLER(l2cc_msg); +extern APP_SUBTASK_HANDLER(mesh_msg); + +void app_conn_param_update(bool key_change) +{ + if ((app_state_get() >= APP_BONDED) && (last_sta != key_change)) + { + DEBUG("ls:%d,%d", last_sta, key_change); + + last_sta = key_change; + + if (!key_change) + { + DEBUG("update"); + ke_timer_set(APP_TIMER_NO_KEY_PRESS, TASK_APP, NOKEY_PRESS_UPDATE_PARAM); + } + else + { + g_no_action_cnt = 0; + + if (ke_timer_active(APP_TIMER_NO_KEY_PRESS, TASK_APP)) + { + DEBUG("clear timer"); + ke_timer_clear(APP_TIMER_NO_KEY_PRESS, TASK_APP); + } + DEBUG("default"); + ble_latency_applied(false); + } + } + +} +/** + **************************************************************************************** + * @brief SubTask Handler of Custom or Unknow Message. (__weak func) + **************************************************************************************** + */ +__weak APP_SUBTASK_HANDLER(custom) +{ + switch (msgid) + { + #if (RC32K_CALIB_PERIOD) + case APP_TIMER_RC32K_CORR: + { + DEBUG("rc32k_calib"); + rc32k_calib(); + ke_timer_set(APP_TIMER_RC32K_CORR, TASK_APP, RC32K_CALIB_PERIOD); + + if (++g_no_action_cnt > G_NO_ACTION_CNT) + { +// if (app_state_get() < APP_CONNECTED) +// { +// keys_sleep(); +// } + } + } break; + #endif + + case APP_TIMER_NO_KEY_PRESS: + { + ble_latency_applied(true); + ke_timer_clear(APP_TIMER_NO_KEY_PRESS, TASK_APP); + } break; + + case APP_TIMER_KEY_SCAN: + { + if (app_state_get() < APP_READY) + { + keys_proc(); + ke_timer_set(APP_TIMER_KEY_SCAN, TASK_APP, KEY_SCAN_PERIOD); + } + else + { + if (ke_timer_active(APP_TIMER_KEY_SCAN, TASK_APP)) + { + ke_timer_clear(APP_TIMER_KEY_SCAN, TASK_APP); + } + } + } break; + + case APP_TIMER_KEY_ADV_DIR: + { + if (app_state_get() < APP_CONNECTED) + { + // ȡ㲥 + adv_dir_flag = false; // ȡ㲥 + app_adv_action(ACTV_RELOAD); + } + ke_timer_clear(APP_TIMER_KEY_ADV_DIR, TASK_APP); + } break; + + default: + { + uint16_t length = ke_param2msg(param)->param_len; + DEBUG("Unknow MsgId:0x%X", msgid); + debugHex((uint8_t *)param, length); + } break; + } + + return (MSG_STATUS_FREE); +} + +/** + **************************************************************************************** + * @brief Dispatch TASK_APP message to sub-handler. + * + * @param[in] msgid Id of the message received. + * @param[in] task_idx Index of the receiving task instance. + * + * @return Handler of the message or NULL. + **************************************************************************************** + */ +__TASKFN void* app_task_dispatch(msg_id_t msgid, uint8_t task_idx) +{ + msg_func_t handler = NULL; + + switch (MSG_TYPE(msgid)) + { + case (TID_GAPM): + handler = app_gapm_msg_handler; + break; + + case (TID_GAPC): + handler = app_gapc_msg_handler; + break; + + #if (GATT_CLI) + case (TID_GATT): + handler = app_gatt_msg_handler; + break; + #endif + + #if (L2CC_LECB) + case (TID_L2CC): + handler = app_l2cc_msg_handler; + break; + #endif + + #if (PRF_MESH) + case TID_MESH: + status = app_mesh_msg_handler; + break; + #endif + + default: + { + handler = app_custom_handler; + } break; + } + + return handler; +} diff --git a/projects/bleRemoteControl/Slave/src/app_user.h b/projects/bleRemoteControl/Slave/src/app_user.h new file mode 100644 index 0000000..9f92120 --- /dev/null +++ b/projects/bleRemoteControl/Slave/src/app_user.h @@ -0,0 +1,43 @@ +#ifndef _APP_USER_H_ +#define _APP_USER_H_ + +#include +#include + +#include "regs.h" +#include "micphone.h" +#include "app.h" +#include "keys.h" +#include "sadc.h" +/***************************************/ +/*************** KEY CFG ***************/ +/***************************************/ +/// Number of Key Row and Column +#define KEY_C0 PA04 +#define KEY_C1 PA12 +#define KEY_C2 PA11 +#define KEY_C3 PA10 + +#define KEY_R0 PA09 +#define KEY_R1 PA05 +#define KEY_R2 PA08 +#define KEY_R3 PA13 + +/// Macro for Number of keyboard row&column +#define KEY_ROW_NB (4) +#define KEY_COL_NB (4) +#define KEY_COL_MSK (BIT(KEY_C0)|BIT(KEY_C1)|BIT(KEY_C2)|BIT(KEY_C3)) +#define KEY_ROW_MSK (BIT(KEY_R0)|BIT(KEY_R1)|BIT(KEY_R2)|BIT(KEY_R3)) +/***************************************/ + +extern bool last_sta; +extern uint16_t g_no_action_cnt; +extern const struct gapc_conn_param dft_conn_param; +extern bool key_press; +extern uint8_t adv_dir_flag; +extern uint16_t voiceSendNB; +extern uint16_t voiceSendOK; + +void app_conn_param_update(bool key_change); +void deletePairInfo(void); +#endif // _APP_USER_H_ diff --git a/projects/bleRemoteControl/Slave/src/batt.c b/projects/bleRemoteControl/Slave/src/batt.c new file mode 100644 index 0000000..455f864 --- /dev/null +++ b/projects/bleRemoteControl/Slave/src/batt.c @@ -0,0 +1,46 @@ +/** + **************************************************************************************** + * + * @file batt.c + * + * @brief Battery voltage detection + * + **************************************************************************************** + */ + +#include "batt.h" +#include "sadc.h" + +#if (DBG_BATT) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +#define ADC_CHAN_VDD12 (14) // 1200mV +#define ADC_READ_CNT (0x07) + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +void batt_init(void) +{ + +} + +uint8_t batt_level(void) +{ + uint8_t lvl = 100; + + return lvl; +} diff --git a/projects/bleRemoteControl/Slave/src/batt.h b/projects/bleRemoteControl/Slave/src/batt.h new file mode 100644 index 0000000..761f188 --- /dev/null +++ b/projects/bleRemoteControl/Slave/src/batt.h @@ -0,0 +1,13 @@ +#ifndef _BATT_H_ +#define _BATT_H_ + +#include + +#define BATT_LVL_MAX 100 +#define BATT_LVL_MIN 0 + +void batt_init(void); + +uint8_t batt_level(void); + +#endif //_BATT_H_ diff --git a/projects/bleRemoteControl/Slave/src/cfg.h b/projects/bleRemoteControl/Slave/src/cfg.h new file mode 100644 index 0000000..236de45 --- /dev/null +++ b/projects/bleRemoteControl/Slave/src/cfg.h @@ -0,0 +1,69 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// System Clock(0=16MHz, 1=32MHz, 2=48MHz, 3=64MHz) +#define SYS_CLK (0) +#define BLE_LITELIB (1) + +/// Debug Mode(0=Disable, 1=via UART, 2=via RTT) +#define DBG_MODE (1) +#define DBG_UART_BAUD (BRR_921600) +/// BLE Configure (Single or Multi-Connections) +#define BLE_NB_SLAVE (1) +#define BLE_NB_MASTER (0) + +#define BLE_ADDR {0xE0, 0x74, 0x69, 0x56, 0xAB, 0x14} +#if (1) +#define VOICE (1) +#define BLE_DEV_NAME {0xE8,0x93,0x9D,0xE7,0x89,0x99,0xE8,0xAF,0xAD,0xE9,0x9F,0xB3,0xE9,0x81,0xA5,0xE6,0x8E,0xA7,0xE5,0x99,0xA8,0x00} // ң +//#define BLE_DEV_NAME "BluetoothRemote" +#endif + +#define BLE_DEV_ICON 0x03C1 // 03C0-Generic HID,03C1-Keyboard,03C2-Mouse,03C4-Gamepad +#define BLE_PHY (GAP_PHY_LE_1MBPS) +#define BLE_AUTH (GAP_AUTH_REQ_NO_MITM_BOND) +#define BLE_EN_SMP (1) +#define BLE_MTU (247) + +#define SLV_INTV_MIN (16) +#define SLV_LATENCY (49) +#define SLV_TIME_OUT (1600) +#define GAP_ATT_CFG (0x40) //(GAP_ATT_SLV_PREF_PAR_BIT) + +/// Profile Configure +#define PRF_DISS (1) +#define PRF_BASS (1) +#define PRF_HIDS (1) + +/// Debug Configure +#if (DBG_MODE) + #define DBG_APP (0) + #define DBG_PROC (0) + #define DBG_ACTV (0) + #define DBG_GAPM (0) + #define DBG_GAPC (1) + #define DBG_KEYS (1) + #define DBG_HIDS (0) + #define DBG_BASS (0) +#endif + +/// Misc Options +#define CFG_SFT_TMR (0) +#define CFG_SLEEP (1) +#define CFG_POWEROFF (1) +#define RC32K_CALIB_PERIOD (10000) +#define NOKEY_PRESS_UPDATE_PARAM (3000) // 10s(unit in 1ms) +#define KEY_SCAN_PERIOD (50) + +#define G_NO_ACTION_CNT (10) // ޲n*RC32K_CALIB_PERIOD, ˯ +#endif //_APP_CFG_H_ diff --git a/projects/bleRemoteControl/Slave/src/hid_desc.c b/projects/bleRemoteControl/Slave/src/hid_desc.c new file mode 100644 index 0000000..65a9218 --- /dev/null +++ b/projects/bleRemoteControl/Slave/src/hid_desc.c @@ -0,0 +1,135 @@ +/** + **************************************************************************************** + * + * @file hid_desc.c + * + * @brief HID Report Map, descriptions. + * + * < Implementation according to user's application-specific > + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "hid_desc.h" + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// HID Report Map description +const uint8_t hid_report_map[] = +{ + #if (HID_RPT_KB) + 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) + 0x09, 0x06, // Usage (Keyboard) + 0xA1, 0x01, // Collection (Application) + 0x85, RPT_ID_KB, // Report ID + 0x75, 0x01, // Report Size (1) + 0x95, 0x08, // Report Count (8) + 0x05, 0x07, // Usage Page (Kbrd/Keypad) + 0x19, 0xE0, // Usage Minimum (0xE0) + 0x29, 0xE7, // Usage Maximum (0xE7) + 0x15, 0x00, // Logical Minimum (0) + 0x25, 0x01, // Logical Maximum (1) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x75, 0x08, // Report Size (8) + 0x95, 0x01, // Report Count (1) + 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x75, 0x08, // Report Size (8) + 0x95, 0x06, // Report Count (6) + 0x15, 0x00, // Logical Minimum (0) + 0x26, 0xFF, 0x00, // Logical Maximum (255) + 0x05, 0x07, // Usage Page (Kbrd/Keypad) + 0x19, 0x00, // Usage Minimum (0x00) + 0x29, 0xFF, // Usage Maximum (0xFF) + 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x75, 0x01, // Report Size (1) + 0x95, 0x05, // Report Count (5) + 0x05, 0x08, // Usage Page (LEDs) + 0x19, 0x01, // Usage Minimum (Num Lock) + 0x29, 0x05, // Usage Maximum (Kana) + 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) + 0x75, 0x03, // Report Size (3) + 0x95, 0x01, // Report Count (1) + 0x91, 0x03, // Output (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) + 0xC0, // End Collection + #endif //(HID_RPT_KB) + + #if (HID_RPT_MEDIA) + 0x05, 0x0C, // Usage Page (Consumer) + 0x09, 0x01, // Usage (Consumer Control) + 0xA1, 0x01, // Collection (Application) + 0x85, RPT_ID_MEDIA,// Report ID + 0x15, 0x00, // Logical Minimum (0) + 0x25, 0x01, // Logical Maximum (1) + 0x75, 0x01, // Report Size (1) + 0x95, 0x10, // Report Count (16) + + 0x09, 0x6F, // Usage (Display Brightness Increment) + 0x09, 0x70, // Usage (Display Brightness Decrement) + 0x09, 0xE9, // Usage (Volume Increment) + 0x09, 0xEA, // Usage (Volume Decrement) + 0x09, 0xB5, // Usage (Scan Next Track) + 0x09, 0xB6, // Usage (Scan Previous Track) + 0x09, 0xB7, // Usage (Stop) + 0x09, 0xCD, // Usage (Play/Pause) + + 0x09, 0xE2, // Usage (Mute) + 0x0A, 0x21, 0x02, // Usage (AC Search) + 0x0A, 0x92, 0x01, // Usage (AL Calculator) + 0x0A, 0x24, 0x02, // Usage (AC Back) + 0x0A, 0x8A, 0x01, // Usage (AL Email Reader) + 0x0A, 0xAE, 0x01, // Usage (AL Keyboard Layout) + 0x0A, 0x23, 0x02, // Usage (AC Home) + 0x0A, 0x96, 0x01, // Usage (AL Internet Browser) + + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0xC0, // End Collection + #endif //(HID_RPT_MEDIA) + + #if (HID_RPT_SYSTEM) + 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) + 0x09, 0x80, // Usage (Sys Control) + 0xA1, 0x01, // Collection (Application) + 0x85, RPT_ID_SYSTEM,// Report ID + 0x15, 0x00, // Logical Minimum (0) + 0x25, 0x01, // Logical Maximum (1) + 0x75, 0x01, // Report Size (1) + 0x95, 0x03, // Report Count (3) + 0x09, 0x81, // Usage (Sys Power Down) + 0x09, 0x82, // Usage (Sys Sleep) + 0x09, 0x83, // Usage (Sys Wake Up) + 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x95, 0x05, // Report Count (5) + 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0xC0, // End Collection + #endif //(HID_RPT_SYSTEM) +}; + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Get HID Report Map description. + * + * @param[out] plen Retrieved Length of description + * + * @return Pointer of the description + **************************************************************************************** + */ +const uint8_t *hid_get_report_map(uint16_t *plen) +{ + *plen = sizeof(hid_report_map); + + return hid_report_map; +} diff --git a/projects/bleRemoteControl/Slave/src/hid_desc.h b/projects/bleRemoteControl/Slave/src/hid_desc.h new file mode 100644 index 0000000..a89ca1e --- /dev/null +++ b/projects/bleRemoteControl/Slave/src/hid_desc.h @@ -0,0 +1,126 @@ +/** + **************************************************************************************** + * + * @file hid_desc.h + * + * @brief Header file - HID Report Map, Descriptions. + * + * < Implementation according to user's application-specific > + **************************************************************************************** + */ + +#ifndef HID_DESC_H_ +#define HID_DESC_H_ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +#define HID_BOOT_SUP (1) +#define HID_REPORT_SUP (1) + +#if (HID_BOOT_SUP) + #define HID_BOOT_KB (1) + #define HID_BOOT_MOUSE (0) +#endif //(HID_BOOT_SUP) + +#if (HID_REPORT_SUP) + #define HID_RPT_KB (1) + #define HID_RPT_MEDIA (1) + #define HID_RPT_SYSTEM (0) + #define HID_RPT_MOUSE (0) + #define HID_RPT_PTP (0) + #define HID_RPT_MIC (1) +#endif //(HID_REPORT_SUP) + +/// HID Report ID and Length, declared in Report Map (User Customize) +#define RPT_ID_KB (1) +#define RPT_LEN_KB (8) // 1B(ctlkeys) + 1B(resv) + 6B(keycode) + +#define RPT_ID_MEDIA (2) +#define RPT_LEN_MEDIA (2) // 16bits + +#define RPT_ID_SYSTEM (3) +#define RPT_LEN_SYSTEM (1) // 8bits + +#define RPT_ID_MOUSE (4) +#define RPT_LEN_MOUSE (6) // 1B(button) + 2B(X) + 2B(Y) + 1B(Wheel) + +#define RPT_ID_TP (5) +#define RPT_ID_MAXCNT (6) // Feature - Finger count +#define RPT_ID_PTPHQA (7) // Feature - HQA +#define RPT_LEN_TP (29) // Touch point +#define PTP_MAX_FINGER_CNT (5) + +#define RPT_ID_MIC (6) +#define RPT_LEN_MIC (128) // adpcm + +/// HID Report Index of Notification +#define RPT_NTF_STOP (0x00) +#define RPT_NTF_ALL ((1 << RPT_IDX_NB) - 1) + +enum rpt_ntf_idx +{ + // Indexes of HID BOOT + RPT_IDX_BOOT_KB, +// RPT_IDX_BOOT_MOUSE, + // Indexes of HID REPORT + RPT_IDX_KB, + RPT_IDX_MEDIA, +// RPT_IDX_SYSTEM, +// RPT_IDX_MOUSE, +// RPT_IDX_TP, + RPT_IDX_MIC, + // Max Index, *NOTE* not excced Bits of rpt_ntfs + RPT_IDX_NB, +}; + + +/* + * MACRO DEFINITIONS + **************************************************************************************** + */ + +#include "prf_hids.h" + +#define mouse_report_send(conidx, p_data) hids_report_send(conidx, RPT_IDX_MOUSE, RPT_LEN_MOUSE, p_data) +#define keybd_report_send(conidx, p_data) hids_report_send(conidx, RPT_IDX_KB, RPT_LEN_KB, p_data) +#define media_report_send(conidx, p_data) hids_report_send(conidx, RPT_IDX_MEDIA, RPT_LEN_MEDIA, p_data) +#define system_report_send(conidx, p_data) hids_report_send(conidx, RPT_IDX_SYSTEM, RPT_LEN_SYSTEM, p_data) + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Get HID Report Map description. + * + * @param[out] plen Retrieved Length of description + * + * @return Pointer of the description + **************************************************************************************** + */ +const uint8_t *hid_get_report_map(uint16_t *plen); + +#if (HID_RPT_PTP) +/** + **************************************************************************************** + * @brief Get HID PTP HQA description. + * + * @param[out] plen Retrieved Length of description + * + * @return Pointer of the description + **************************************************************************************** + */ +const uint8_t *hid_get_ptphqa_blob(uint16_t *plen); +#endif //(HID_RPT_PTP) + + +#endif /* HID_DESC_H_ */ diff --git a/projects/bleRemoteControl/Slave/src/keys.c b/projects/bleRemoteControl/Slave/src/keys.c new file mode 100644 index 0000000..76ff50b --- /dev/null +++ b/projects/bleRemoteControl/Slave/src/keys.c @@ -0,0 +1,548 @@ +/** + **************************************************************************************** + * + * @file keys.c + * + * @brief keys operation. + * + **************************************************************************************** + */ +#include "drvs.h" +#include "app.h" +#include "hid_desc.h" +#include "keys.h" +#include "app_user.h" +#include "gapc_api.h" + +#if (CFG_SFT_TMR) +#include "sftmr.h" +#endif + +#if (DBG_KEYS) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ +#define RPT_IDX_NONE (RPT_IDX_NB) +/// Macro for ghost-key detection (0-disable, 1-enable) +#define KEY_GHOST (1) + +/// Macro for key debounce (0-disable, else (1 << n) - 1) +#define KEY_DEBOUNCE (0x00) + +const uint8_t Key_Row[KEY_ROW_NB] = { KEY_R0, KEY_R1, KEY_R2, KEY_R3 }; + +const uint8_t Key_Col[KEY_COL_NB] = { KEY_C0, KEY_C1, KEY_C2, KEY_C3 }; + +const uint8_t Key_Map[KEY_ROW_NB][KEY_COL_NB] = +{ + {KEY_UP, KEY_RIGHT, KEY_APP, KEY_DOWN }, + {KEY_F5, KEY_ENTER, KEY_LED, KEY_VOL_UP}, + {KEY_POWER, KEY_LEFT, KEY_HOME, KEY_VOL_DN}, + {KEY_F6, KEY_F16, KEY_MUTE, KEY_ESC }, +}; + +/// Key Buffer for ghost-detect and debounce +#if (KEY_GHOST || KEY_DEBOUNCE) +struct key_buf_tag +{ + #if (KEY_GHOST) + uint8_t rowCnt[KEY_ROW_NB]; + #endif + + #if (KEY_GHOST || KEY_DEBOUNCE) + uint8_t colSta[KEY_COL_NB]; + #endif + + #if (KEY_DEBOUNCE) + uint8_t shake[KEY_ROW_NB][KEY_COL_NB]; + #endif +}; + +__RETENTION struct key_buf_tag key_buf; +#endif + +/// Key Enveriment +__RETENTION struct key_env_tag key_env; + +#if (CFG_SFT_TMR) +#define KEYS_HOLD_TIME _MS(300) + +tmr_tk_t tm_keys_local; +__RETENTION volatile uint16_t proc_flag; + +enum proc_fields +{ + PF_KEYS_HOLD_BIT = (1 << 0), + PF_BATT_LOW_BIT = (1 << 1), + PF_BATT_LVL_BIT = (1 << 2), + PF_RC32K_CAL_BIT = (1 << 3), +}; + +#define PF_GET_BIT(field) (proc_flag & (PF_##field##_BIT)) +#define PF_SET_BIT(field) (proc_flag |= (PF_##field##_BIT)) +#define PF_CLR_BIT(field) (proc_flag &= (~PF_##field##_BIT)) +#endif + +/* + * FUNCTIONS + **************************************************************************************** + */ +static void rows_init(void) +{ + // Row GPIOs as HiZ(no Output no Input) + GPIO_DIR_CLR(KEY_ROW_MSK); + GPIO_DAT_SET(KEY_ROW_MSK); + for (uint8_t r = 0; r < KEY_ROW_NB; r++) + { + iom_ctrl(Key_Row[r], IOM_HIZ); + } +} + +static void cols_init(void) +{ + // Column GPIOs as Input(Ext PullDown) + GPIO_DIR_CLR(KEY_COL_MSK); + GPIO_DAT_CLR(KEY_COL_MSK); + for (uint8_t c = 0; c < KEY_COL_NB; c++) + { + iom_ctrl(Key_Col[c], IE_DOWN); + } +} + +static uint8_t keys_info(const keys_t *keys) +{ + if (keys->gcnt == 0) + return KI_NOKEY; + +// DEBUG("keys_info:%d, %d", keys->mcnt, keys->gcnt); +// debugHex(keys->code, RPT_LEN_KB); + + uint8_t kcode = keys->code[2]; + if (keys->gcnt == 1) + { + if (kcode == KEY_HOME) + { + return KI_HOTKEY_HOME; + } + + if (kcode == KEY_ESC) + { + return KI_HOTKEY_MUTE; + } + + if (kcode == KEY_F5) + { + return KI_HOTKEY_VOICE; + } + + if (kcode == KEY_LED) + { + return KI_HOTKEY_BACK; + } + } + // HOME+APP + else if (keys->gcnt == 2) + { + if (((keys->code[2] == KEY_HOME) && (keys->code[3] == KEY_APP)) + || ((keys->code[2] == KEY_APP) && (keys->code[3] == KEY_HOME))) + { + return KI_HOTKEY_PAIR; + } + } + + return KI_GEKEY; +} + +static uint8_t keys_encode(const keys_t *keys, uint8_t *report) +{ + uint8_t rep_idx = RPT_IDX_NONE; + + memset(report, 0, RPT_LEN_KB); +// DEBUG("keys_info:%d, %d", keys->mcnt, keys->gcnt); +// debugHex(keys->code, RPT_LEN_KB); + switch (keys->info) + { + case KI_GEKEY: + { + // copy Modifier Keys(windows replace RGUI with RCTRL) + if ((keys->code[0] & KEY_BIT_RGUI) && (key_env.sys == WINDOWS)) + report[0] = (keys->code[0] | KEY_BIT_RCTRL) & ~KEY_BIT_RGUI; + else + report[0] = (keys->code[0]); + + // copy Generic Keys + memcpy(&report[2], &keys->code[2], keys->gcnt); + + rep_idx = RPT_IDX_KB; + } break; + + case KI_HOTKEY_HOME: + { + // HOME + rep_idx = RPT_IDX_MEDIA; + report[1] = 1 << 6; + } break; + + case KI_HOTKEY_BACK: + { + // Back + rep_idx = RPT_IDX_MEDIA; + report[1] = 1 << 3; + } break; + + case KI_HOTKEY_MUTE: + { + // Mute + rep_idx = RPT_IDX_MEDIA; + report[1] = 1 << 0; + } break; + + case KI_HOTKEY_VOICE: + { + // Mute + // copy Generic Keys + memcpy(&report[2], &keys->code[2], keys->gcnt); + rep_idx = RPT_IDX_KB; + + #if (VOICE) + micInit(); + #endif + } break; + + case KI_NOKEY: + case KI_ERROR: + case KI_HOTKEY_PAIR: + default: + { +// rep_idx = RPT_IDX_NONE; + } break; + } + + DEBUG("info:%d, rep_idx:%d", keys->info, rep_idx); + debugHex(report, RPT_LEN_KB); + return rep_idx; +} + +static bool keys_send(uint8_t repidx, const uint8_t *report) +{ + uint8_t replen; + + if (repidx == RPT_IDX_MEDIA) + { + replen = RPT_LEN_MEDIA; + } + #if (HID_RPT_SYSTEM) + else if (repidx == RPT_IDX_SYSTEM) + { + replen = RPT_LEN_SYSTEM; + } + #endif + else + { + replen = RPT_LEN_KB; + } + + DEBUG("keys_send(%d,%d)", repidx, replen); + return !hids_report_send(app_env.curidx, repidx, replen, report); +} + +/* + * EXPORT FUNCTIONS + **************************************************************************************** + */ + +void keys_init(void) +{ + rows_init(); + cols_init(); + + #if (KEY_GHOST || KEY_DEBOUNCE) + memset(&key_buf, 0, sizeof(struct key_buf_tag)); + #endif + + memset(&key_env, 0, sizeof(struct key_env_tag)); + key_env.rep_idx = RPT_IDX_NONE; + // no first report + key_env.repok = 1; + + #if (CFG_SFT_TMR) + proc_flag = 0; + #endif +} + +void keys_sleep(void) +{ + DEBUG("Poweroff"); + GPIO_DIR_SET_LO(KEY_COL_MSK); + wakeup_io_sw(KEY_ROW_MSK, KEY_ROW_MSK); + core_pwroff(CFG_WKUP_IO_EN | WKUP_IO_LATCH_N_BIT); +} + +void keys_conf(uint8_t os) +{ + key_env.sys = os; +} + +bool key_press = false; + + +static uint8_t keys_scan(void) +{ + uint8_t r, c, colSta; + uint8_t status = KS_SUCCESS; + keys_t *keys = &key_env.curr; + + // 0 - All Row GPIOs as HiZ + rows_init(); + + // 1 - Init keys env, first backup + key_env.last = *keys; + memset(keys, 0, sizeof(keys_t)); + + // 2 - Scan row by row + for (r = 0; r < KEY_ROW_NB; r++) + { + // Enable row Output(High) + GPIO_DIR_SET(1UL << Key_Row[r]); + + // Init keys buf + #if (KEY_GHOST) + key_buf.rowCnt[r] = 0; + #endif + + // Judge col by col + for (c = 0; c < KEY_COL_NB; c++) + { + uint8_t press = 0; + uint8_t kcode = Key_Map[r][c]; + + if (kcode == 0) continue; // empty code + + #if (KEY_DEBOUNCE) + // Shift right to update + key_buf.shake[r][c] <<= 1; + + if (gpio_input_get(Key_Col[c])) + { + key_buf.shake[r][c] |= 1; + } + + // Judge real state + press = ((key_buf.shake[r][c] & KEY_DEBOUNCE) == KEY_DEBOUNCE) + || (((key_buf.shake[r][c] & KEY_DEBOUNCE) != 0) && (key_buf.colSta[c] & (1 << r))); + #else + press = gpio_get(Key_Col[c]); + #endif + + if (press && Key_Map[r][c]) + { +// DEBUG("%X(r:%d,c:%d)", kcode, r, c); + + if (keys->gcnt >= 6) + { + DEBUG("exceed at(r:%d,c:%d)", r, c); + status = KS_ERR_EXCEED; + break; + } + + keys->code[2+keys->gcnt] = kcode; // Generic Keys + keys->gcnt++; + + #if (KEY_GHOST) + key_buf.rowCnt[r]++; // inc row keys + #endif + + #if (KEY_GHOST || KEY_DEBOUNCE) + key_buf.colSta[c] |= (1 << r); // press state + } + else + { + key_buf.colSta[c] &= ~(1 << r); // release state + #endif + } + } + + // disable row Output + GPIO_DIR_CLR(1UL << Key_Row[r]); + + if (c < KEY_COL_NB) break; // Over error + } + + if (keys->gcnt) + { + key_press = true; + } + else + { + key_press = false; + + #if (VOICE) + if (SADC->CTRL.SADC_DMAC_EN) + { + SADC->CTRL.SADC_DMAC_EN = 0; // voice stop + DEBUG("Voice:Send-%d OK-%d", voiceSendNB, voiceSendOK); + } + #endif + } + + // 3 - Detect ghost key + #if (KEY_GHOST) + if ((keys->mcnt + keys->gcnt >= 4) && (status == KS_SUCCESS)) + { + // ghost in 'L' style(3+1) or not + for (r = 0; r < KEY_ROW_NB; r++) + { + if (key_buf.rowCnt[r] >= 2) + { + uint8_t rowBit = (1 << r); + for (c = 0; c < KEY_COL_NB; c++) + { + colSta = key_buf.colSta[c]; + if ((colSta & (1 << r))/* && (ONE_BITS(key_buf.colSta[c]) >= 2)*/) + { + if ((rowBit & colSta) != (1 << r)) + { + DEBUG("ghost at(r:%d,c:%d,r:0x%x)", r, c, key_buf.colSta[c]); + status = KS_ERR_GHOST; + break; + } + else + { + rowBit |= colSta; + } + } + } + } + } + } + #endif + + for (uint8_t r = 0; r < KEY_ROW_NB; r++) + { + iom_ctrl(Key_Row[r], IOM_PULLDOWN); + } + + // 4 - Judge key info + keys->info = (status == KS_SUCCESS) ? keys_info(keys) : KI_ERROR; + + return keys->info; +} + +static bool keys_changed(void) +{ +// DEBUG("cinfo:%d, linfo:%d", key_env.curr.info,key_env.last.info); + if ((key_env.curr.info != key_env.last.info) + || ((key_env.curr.info <= KI_FNKEY) && (memcmp(key_env.curr.code, key_env.last.code, RPT_LEN_KB) != 0))) + { + return true; + } + else + { + return false; + } +} +bool key_change; + + +static void keys_report(void) +{ + uint8_t rep_idx, report[RPT_LEN_KB]; + + key_change = keys_changed(); +// DEBUG("key_change:%d", key_change); + app_conn_param_update(key_change); + + // 0 - ignore same with last(send ok) + if (key_env.repok && !key_change) + { + return; + } + + rep_idx = keys_encode(&key_env.curr, report); + + if (rep_idx == key_env.rep_idx) + { + // 1 - report same, only send curr pressed keys + if ((rep_idx != RPT_IDX_NONE) || (!key_env.repok)) + { + key_env.repok = keys_send(rep_idx, report); + } + } + else + { + // 2 - report diff, send curr or release last pressed keys + if (key_env.rep_idx == RPT_IDX_NONE) + { + key_env.repok = keys_send(rep_idx, report); + } + else + { + if (key_env.curr.info != KI_ERROR) + { + rep_idx = RPT_IDX_NONE; // release last + key_env.repok = keys_send(key_env.rep_idx, NULL); + } + } + } + + // 3 - update rep_idx when ok + if (key_env.repok) + { + if (key_env.curr.info != KI_ERROR) + { + key_env.rep_idx = rep_idx; + } + } +} + +/// Keys Procedure +static void hotkey_local(uint8_t info) +{ + DEBUG("hotkey_local:%d, app_sta:%d", info, app_state_get()); + switch (info) + { + // ͬʱ¿ʼģʽ + case KI_HOTKEY_PAIR: + { + g_no_action_cnt = 0; + + DEBUG("PAIR MODE"); + deletePairInfo(); + if (app_state_get() >= APP_CONNECTED) + { + gapc_disconnect(app_env.curidx); + } + } break; + + default: + { + } break; + } +} + +void keys_proc(void) +{ + uint8_t info = keys_scan(); +// DEBUG("info:%d :%d", info, app_state_get()); + if ((info >= KI_HOTKEY_LOCAL) && (info < KI_HOTKEY_HOST)) + { + // hotkey_local proc + if (keys_changed()) + { + hotkey_local(info); + } + } + else if (app_state_get() >= APP_CONNECTED) + { + keys_report(); + } +} diff --git a/projects/bleRemoteControl/Slave/src/keys.h b/projects/bleRemoteControl/Slave/src/keys.h new file mode 100644 index 0000000..1820825 --- /dev/null +++ b/projects/bleRemoteControl/Slave/src/keys.h @@ -0,0 +1,73 @@ +/** + **************************************************************************************** + * + * @file keys.h + * + * @brief Header file - Keys Scanning and Report + * + **************************************************************************************** + */ + +#ifndef _KEYS_H_ +#define _KEYS_H_ + +#include +#include +#include "hidkey.h" + + +typedef struct key_sca +{ + uint8_t info; // @see enum key_inf + uint8_t mcnt; // count of mk(@see enum key_bit) + uint8_t gcnt; // count of gk(@see enum generic_key) + uint8_t code[8]; // 0:Modifier Keys, 1:Fn Keys, 2~7:Generic Keys +} keys_t; + +struct key_env_tag +{ + uint8_t sys; + + keys_t curr; // current scanned keys + keys_t last; // last scanned keys, backup + uint8_t rep_idx; + uint8_t repok; +}; + +/// Error code of key +enum key_err +{ + KS_SUCCESS, // no error + KS_ERR_EXCEED, // exceed max count of keys + KS_ERR_GHOST, // exist ghost keys +}; + +/// Information of key +enum key_inf +{ + KI_NOKEY, // release (no key) + KI_ERROR, // error(key_err) + KI_GEKEY, // generic(normal key) + KI_FNKEY, // Fn press(without hot-key) + + // Hot Keys Group for local device, customize more... + KI_HOTKEY_LOCAL, // Local Base as split line + KI_HOTKEY_PAIR, // PAIR MODE, + + + // Hot Keys Group for host report, customize more... + KI_HOTKEY_HOST, // Host Base as split line + KI_HOTKEY_HOME, + KI_HOTKEY_BACK, + KI_HOTKEY_MUTE, + KI_HOTKEY_VOICE, // VOICE MODE, +}; + +void keys_init(void); + +void keys_sleep(void); + +void keys_conf(uint8_t os); + +void keys_proc(void); +#endif //_KEYS_H_ diff --git a/projects/bleRemoteControl/Slave/src/link_xip_blelite.sct b/projects/bleRemoteControl/Slave/src/link_xip_blelite.sct new file mode 100644 index 0000000..e3d0728 --- /dev/null +++ b/projects/bleRemoteControl/Slave/src/link_xip_blelite.sct @@ -0,0 +1,51 @@ +#! armcc -E -I ..\src\ -I ..\..\..\..\ble\api +#include "cfg.h" +#include "blelib.h" + +#define SCT_FLASH_BASE (0x18004000) +#define SCT_FLASH_END (0x18020000) +#define SCT_FLASH_LEN (SCT_FLASH_END - SCT_FLASH_BASE) + +LR_IROM1 SCT_FLASH_BASE SCT_FLASH_LEN +{ + ER_IROM1 SCT_FLASH_BASE SCT_FLASH_LEN + { + *.o (RESET, +First) + *(InRoot$$Sections) + startup*.o (+RO) + .ANY (+RO) + } + + RW_IRAM_VECT 0x20003000 EMPTY 152 + { + ; sram vector + } + + RW_IRAM_USER +0 + { + *.o(ram_func*) + ;.ANY (+RW +ZI) + } + + RW_IRAM_STACK 0x20008000-0x600 UNINIT 0x600 + { + .ANY (STACK) + } + + RW_IRAM_EXCH BLE_EXCH_BASE EMPTY BLE_EXCH_SIZE + { + ; configured with BLE HW + } + + RW_IRAM_HEAP BLE_HEAP_BASE EMPTY BLE_HEAP_SIZE + { + ; configured with ble_heap() + } + + RW_IRAM_RWZI BLE_RWZI_BASE UNINIT BLE_RWZI_SIZE + { + ; ZI data, manual inited in lib + *ble6*.lib (+RW +ZI) + .ANY (+RW +ZI) ; retention + } +} diff --git a/projects/bleRemoteControl/Slave/src/main.c b/projects/bleRemoteControl/Slave/src/main.c new file mode 100644 index 0000000..fb56143 --- /dev/null +++ b/projects/bleRemoteControl/Slave/src/main.c @@ -0,0 +1,92 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" +#include "app.h" +#include "sftmr.h" +#include "leds.h" +#include "batt.h" +#include "keys.h" +#include "uartRb.h" +#include "dbg.h" +#include "app_user.h" +/* + * DEFINES + **************************************************************************************** + */ + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +extern void user_procedure(void); + +static void sysInit(void) +{ + iwdt_disable(); + + rcc_ble_en(); + rcc_adc_en(); + + rcc_fshclk_set(FSH_CLK_DPSC42); + core_release_io_latch(); +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + if (rsn & (RSN_POR12_BK_BIT | RSN_PIN_RSTN_BIT | RSN_SYSRST_BIT)) + { + keys_sleep(); + } + + + dbgInit(); + + if (rsn != (RSN_BLE_WKUP_BIT | RSN_POR12_CORE_BIT)) + { + debug("Start(rsn:%X)...\r\n", rsn); + } + + keys_init(); + + if ((rsn & RSN_POR12_CORE_BIT) != RSN_POR12_CORE_BIT) + { + last_sta = true; + g_no_action_cnt = 0; + } + + // Init BLE App + app_init(rsn); +} + +int main(void) +{ + sysInit(); + devInit(); + + // Global Interrupt Enable + GLOBAL_INT_START(); + + // main loop + while (1) + { + // Schedule Messages & Events + ble_schedule(); + + // User's Procedure + user_procedure(); + } +} diff --git a/projects/bleRemoteControl/Slave/src/micphone.c b/projects/bleRemoteControl/Slave/src/micphone.c new file mode 100644 index 0000000..52909d7 --- /dev/null +++ b/projects/bleRemoteControl/Slave/src/micphone.c @@ -0,0 +1,148 @@ +#include "app_user.h" +#include "drvs.h" +#include "regs.h" +#include "adpcm.h" +#include "string.h" +#include "sadc.h" +#include "b6x.h" +#include "bledef.h" +#include "hid_desc.h" +#include "app.h" +#include "prf_sess.h" +#include "app_user.h" + +#if (VOICE) + +#define ADPCM_BLOCK_SIZE (128) +#define SAMPLE_DATA_SIZE (ADPCM_BLOCK_SIZE - 4) +#define READ_UNIT_SIZE (SAMPLE_DATA_SIZE * 4 + 2) + +struct ADPCMBlock +{ + short sample0; + char index; + char RESERVED; + char sampledata[SAMPLE_DATA_SIZE]; +}; + +#if (0) +#define PCM_SAMPLE_NB (216) // 256: 32ms 8000Hz +#else +#define PCM_SAMPLE_NB (READ_UNIT_SIZE/2) // 256: 32ms 8000Hz +#endif + + +#define MIC_IB_PAD 2 +#define MIC_IN_PAD 3 + +#define DMA_PCM_CHAN DMA_CH0 + +__ATTR_SRAM int16_t pcm_buff0[PCM_SAMPLE_NB]; +__ATTR_SRAM int16_t pcm_buff1[PCM_SAMPLE_NB]; + +__ATTR_SRAM struct ADPCMBlock adpcm_buff; + +struct adpcm_state state; + +void uartTxSend(const uint8_t *data, uint16_t len) +{ + while(len--) + { + uart_putc(0, *data++); + } +} + +uint16_t voiceSendNB; +uint16_t voiceSendOK; +uint8_t voiceSendFt; + +void micInit(void) +{ + GPIO_DIR_CLR(GPIO02 | GPIO03); + iom_ctrl(MIC_IB_PAD, IOM_HIZ); + iom_ctrl(MIC_IN_PAD, IOM_ANALOG); // 5 + + // sadc init + sadc_init(SADC_ANA_DFLT | SADC_INBUF_BYPSS_BIT); + + dma_init(); + + // DMA Conf: direct Init + SADC->CTRL.SADC_DMAC_EN = 0; + + DMA_SADC_INIT(DMA_PCM_CHAN); + DMA_SADC_PCM_CONF(DMA_PCM_CHAN, pcm_buff0, PCM_SAMPLE_NB, CCM_PING_PONG); + DMA_SADC_PCM_CONF(DMA_PCM_CHAN | DMA_CH_ALT, pcm_buff1, PCM_SAMPLE_NB, CCM_PING_PONG); + sadc_conf((SADC_CR_DFLT & ~(SADC_CR_HPF_COEF_MSK|SADC_CR_CLK_DIV_MSK)) | SADC_CR_HPF(3) | SADC_CR_CLK(0)); + sadc_pcm(SADC_MIC_DFLT & (~SADC_PGA_VOL_MSK | SADC_PGA_VOL(0))); + + state.index = 0; + state.valprev = 0; + + voiceSendNB = 0; + voiceSendOK = 0; + voiceSendFt = 4; +} + +void voice_send(uint16_t len, const uint8_t *data) +{ + voiceSendNB++; + if (hids_report_send(app_env.curidx, RPT_IDX_MIC, len, data) == LE_SUCCESS) + { + voiceSendOK++; + } +} + +#if (MODE_SELECT) +void micPut(void) +{ + // primary or alternate transfer done + if (dma_chnl_done(DMA_PCM_CHAN)) + { + if (dma_chnl_reload(DMA_PCM_CHAN)) // 0x100 + { + uartTxSend((uint8_t *)&pcm_buff1, PCM_SAMPLE_NB*2); + } + else + { + uartTxSend((uint8_t *)&pcm_buff0, PCM_SAMPLE_NB*2); + } + } +} +#else +void micPut(void) +{ + // primary or alternate transfer done + if (dma_chnl_done(DMA_PCM_CHAN)) + { + if (voiceSendFt) + { + // + dma_chnl_reload(DMA_PCM_CHAN); + voiceSendFt--; + return; + } + + adpcm_buff.index = state.index; + + if (dma_chnl_reload(DMA_PCM_CHAN)) // 0x100 + { + adpcm_buff.sample0 = pcm_buff1[0]; + state.valprev = pcm_buff1[0]; + adpcm_coder((short*)&pcm_buff1[1], (char *)adpcm_buff.sampledata, (PCM_SAMPLE_NB - 1), &state); + } + else + { + adpcm_buff.sample0 = pcm_buff0[0]; + state.valprev = pcm_buff0[0]; + adpcm_coder((short*)&pcm_buff0[1], (char *)adpcm_buff.sampledata, (PCM_SAMPLE_NB - 1), &state); + } + +// uartTxSend((uint8_t *)&adpcm_buff, ADPCM_BLOCK_SIZE); +// sess_txd_send(app_env.curidx, ADPCM_BLOCK_SIZE, (uint8_t *)&adpcm_buff); + voice_send(ADPCM_BLOCK_SIZE, (uint8_t *)&adpcm_buff); + } +} +#endif +#endif + diff --git a/projects/bleRemoteControl/Slave/src/micphone.h b/projects/bleRemoteControl/Slave/src/micphone.h new file mode 100644 index 0000000..643c9f3 --- /dev/null +++ b/projects/bleRemoteControl/Slave/src/micphone.h @@ -0,0 +1,25 @@ +/** + **************************************************************************************** + * + * @file micphone.h + * + * @brief Micphone Interface of Application + * + * @data 2022.05.13 + * + **************************************************************************************** + */ + +#ifndef MICPHONE_H_ +#define MICPHONE_H_ + +#include +#include + +#define MODE_SELECT (0) // 0:ADPCM TEST 1:PCM TEST + +void micInit(void); + +void micPut(void); + +#endif // SADC_H_ diff --git a/projects/bleRemoteControl/Slave/src/myapp.c b/projects/bleRemoteControl/Slave/src/myapp.c new file mode 100644 index 0000000..8f9e1fa --- /dev/null +++ b/projects/bleRemoteControl/Slave/src/myapp.c @@ -0,0 +1,159 @@ +/** + **************************************************************************************** + * + * @file myapp.c + * + * @brief User Application - Override func + * + **************************************************************************************** + */ + +#include "app.h" +#include "bledef.h" +#include "drvs.h" +#include "leds.h" + +#if (DBG_APP) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat,len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ +#ifndef CFG_LTK_STORE + #define CFG_LTK_STORE (1) +#endif + +#ifndef LTK_STORE_OFFSET + #define LTK_STORE_OFFSET (0x1100) +#endif + +#if (LTK_STORE_OFFSET < 0x1000) + #error "User Store Data Offset Must Greater Than or Equal 0x1000" +#endif + +struct gapc_ltk gLTK; + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +#if (LED_PLAY) +/** + **************************************************************************************** + * @brief API to Set State of Application, add leds Indication + * + * @param[in] state new state + **************************************************************************************** + */ +void app_state_set(uint8_t state) +{ + DEBUG("State(old:%d,new:%d)", app_state_get(), state); + + app_env.state = state; + + // Indication, User add more... + if (state == APP_IDLE) + { + leds_play(LED_SLOW_BL); + } + else if (state == APP_READY) + { + leds_play(LED_FAST_BL); + } + else if (state == APP_CONNECTED) + { + leds_play(LED_CONT_ON); + } +} +#endif //(LED_PLAY) + +/** + **************************************************************************************** + * @brief API to Generate LTK for bonding, maybe User Override! (__weak func) + * + * @param[in] conidx connection index + * @param[in|out] ltk Pointer of ltk buffer + **************************************************************************************** + */ +void app_ltk_gen(uint8_t conidx, struct gapc_ltk *ltk) +{ + DEBUG("LTK Gen"); + + // Generate all the values + gLTK.key_size = GAP_KEY_LEN; + gLTK.ext_info = 0; + + gLTK.ediv = rand_hword(); + + for (int i = 0; i < GAP_RAND_NB_LEN; i++) + { + gLTK.ltk.key[i] = (uint8_t)rand_word(); + gLTK.ltk.key[i + 8] = (uint8_t)rand_word(); + gLTK.randnb.nb[i] = (uint8_t)rand_word(); + } + + memcpy(ltk, &gLTK, sizeof(struct gapc_ltk)); + debugHex((uint8_t *)ltk, sizeof(struct gapc_ltk)); +} + +/** + **************************************************************************************** + * @brief API to Save LTK when bonded, maybe User Override! (__weak func) + * + * @param[in] conidx connection index + * @param[in] ltk Pointer of LTK data + **************************************************************************************** + */ +void app_ltk_save(uint8_t conidx, const struct gapc_ltk *ltk) +{ + DEBUG("LTK Saved Start"); + + #if (CFG_LTK_STORE) + flash_page_erase(LTK_STORE_OFFSET); + flash_byte_write(LTK_STORE_OFFSET, (uint8_t *)&gLTK, sizeof(struct gapc_ltk)); + #endif + + DEBUG("LTK Saved Done"); +} + +/** + **************************************************************************************** + * @brief API to Find LTK when re-encryption, maybe User Override! (__weak func) + * + * @param[in] ediv EDIV value for matching + * @param[in] rand_nb Rand Nb values for matching + * + * @return NULL for not matched, else return Pointer of LTK found. + **************************************************************************************** + */ +const uint8_t *app_ltk_find(uint16_t ediv, const uint8_t *rand_nb) +{ + DEBUG("Read LTK"); + +#if (CFG_LTK_STORE) + flash_byte_read(LTK_STORE_OFFSET, (uint8_t *)&gLTK, sizeof(struct gapc_ltk)); + debugHex((uint8_t *)&gLTK, sizeof(struct gapc_ltk)); +#endif + + if ((ediv == gLTK.ediv) && (memcmp(rand_nb, gLTK.randnb.nb, 8) == 0)) + return &gLTK.ltk.key[0]; + else + return NULL; +} + +// ɾϢ +void deletePairInfo(void) +{ + memset(&gLTK, 0xff, sizeof(struct gapc_ltk)); + // LTKFLASHռ +// flash_erase_write(LTK_STORE_OFFSET, (uint32_t *)ltk_Data); + flash_page_erase(LTK_STORE_OFFSET); +} diff --git a/projects/bleRemoteControl/Slave/src/prf_hids.c b/projects/bleRemoteControl/Slave/src/prf_hids.c new file mode 100644 index 0000000..5ebe183 --- /dev/null +++ b/projects/bleRemoteControl/Slave/src/prf_hids.c @@ -0,0 +1,945 @@ +/** + **************************************************************************************** + * + * @file prf_hids.c + * + * @brief HID Service Profile - Template Source. + * + * < Implementation according to user's application-specific > + **************************************************************************************** + */ + +#if (PRF_HIDS) + +/* + * INCLUDE FILES + **************************************************************************************** + */ +#include "prf.h" +#include "hid_desc.h" // application-specific, #include "prf_hids.h" +#include "app_user.h" +#include "dbg.h" +#include "bledef.h" +#if (DBG_HIDS) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +//#define debugHex(dat,len) +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// Support Boot Protocol Mode or Not +#if !defined(HID_BOOT_SUP) + #define HID_BOOT_SUP (0) + #define HID_BOOT_KB (0) + #define HID_BOOT_MOUSE (0) +#endif + +/// Support Report Protocol Mode or Not +#if !defined(HID_REPORT_SUP) + #define HID_REPORT_SUP (1) + #define HID_RPT_KB (1) + #define HID_RPT_MEDIA (1) + #define HID_RPT_SYSTEM (1) + #define HID_RPT_MOUSE (1) + #define HID_RPT_PTP (0) +#endif + +/// Support Number of HID Connections +#if !defined(HID_CONN_MAX) + #define HID_CONN_MAX (1) // always one, BLE_CONNECTION_MAX +#endif + +/// Macro for Client Config value operation +#define HID_RPT_NTF_GET(conidx, ntf_idx) \ + ((hids_env.conn[conidx].rpt_ntfs >> (ntf_idx)) & PRF_CLI_START_NTF) + +#define HID_RPT_NTF_CLR(conidx, ntf_idx) \ + hids_env.conn[conidx].rpt_ntfs &= ~(PRF_CLI_START_NTF << (ntf_idx)) + +#define HID_RPT_NTF_SET(conidx, ntf_idx, conf) \ + hids_env.conn[conidx].rpt_ntfs = (hids_env.conn[conidx].rpt_ntfs & ~(PRF_CLI_START_NTF << (ntf_idx))) | ((conf) << (ntf_idx)) + + +/** + **************************************************************************************** + * @section ENVIRONMENT DEFINITION + **************************************************************************************** + */ + +typedef struct hid_conn_tag +{ + // Client Config of peer devices, max_bits=RPT_IDX_NB + uint8_t rpt_ntfs; + // keyboard Locks (bit0:num lock, bit1:caps lock, bit2:scroll lock) + uint8_t led_lock; + // Control Point key @see enum hid_ctrl_pt + uint8_t ctrl_pt; + // Boot or Report mode, @see enum hid_proto_mode + uint8_t proto_mode; +} hid_conn_t; + +/// HIDS Server Environment Sariable +typedef struct hids_env_tag +{ + // Service Start Handle + uint16_t start_hdl; + // Number of notify pkt + uint8_t nb_pkt; + // Connection Info + hid_conn_t conn[HID_CONN_MAX]; +} hids_env_t; + +/// Global Variable Declarations +__VAR_ENV hids_env_t hids_env; + + +/** + **************************************************************************************** + * @section ATTRIBUTES DEFINITION + **************************************************************************************** + */ + +/// HID Attributes Index +enum hid_att_idx +{ + // Service Declaration, *MUST* Start at 0 + HID_IDX_SVC, + + // HID Information + HID_IDX_HID_INFO_CHAR, + HID_IDX_HID_INFO_VAL, + + // HID Control Point + HID_IDX_HID_CTRL_PT_CHAR, + HID_IDX_HID_CTRL_PT_VAL, + + // Protocol Mode(0-BOOT, 1-REPORT) + HID_IDX_PROTO_MODE_CHAR, + HID_IDX_PROTO_MODE_VAL, + + // Report Map + HID_IDX_REPORT_MAP_CHAR, + HID_IDX_REPORT_MAP_VAL, + + #if (HID_BOOT_KB) + // Boot Keyboard Input Report + HID_IDX_BOOT_KB_IN_RPT_CHAR, + HID_IDX_BOOT_KB_IN_RPT_VAL, + HID_IDX_BOOT_KB_IN_RPT_NTF_CFG, + // Boot Keyboard Output Report + HID_IDX_BOOT_KB_OUT_RPT_CHAR, + HID_IDX_BOOT_KB_OUT_RPT_VAL, + #endif //(HID_BOOT_KB) + + #if (HID_REPORT_SUP) + #if (HID_RPT_KB) + // Keyboard Report IN + HID_IDX_KB_IN_RPT_CHAR, + HID_IDX_KB_IN_RPT_VAL, + HID_IDX_KB_IN_RPT_NTF_CFG, + HID_IDX_KB_IN_RPT_REF, + // Keyboard Report OUT + HID_IDX_KB_OUT_RPT_CHAR, + HID_IDX_KB_OUT_RPT_VAL, + HID_IDX_KB_OUT_RPT_REF, + #endif //(HID_RPT_KB) + + #if (HID_RPT_MEDIA) + // Media IN Report + HID_IDX_MEDIA_IN_RPT_CHAR, + HID_IDX_MEDIA_IN_RPT_VAL, + HID_IDX_MEDIA_IN_RPT_NTF_CFG, + HID_IDX_MEDIA_IN_RPT_REF, + #endif //(HID_RPT_MEDIA) + + #if (HID_RPT_SYSTEM) + // System IN Report + HID_IDX_SYS_IN_RPT_CHAR, + HID_IDX_SYS_IN_RPT_VAL, + HID_IDX_SYS_IN_RPT_REF, + HID_IDX_SYS_IN_RPT_NTF_CFG, + #endif //(HID_RPT_SYSTEM) + + #if (HID_RPT_MOUSE) + // Mouse IN Report + HID_IDX_MOUSE_IN_RPT_CHAR, + HID_IDX_MOUSE_IN_RPT_VAL, + HID_IDX_MOUSE_IN_RPT_REF, + HID_IDX_MOUSE_IN_RPT_NTF_CFG, + #endif //(HID_RPT_MOUSE) + + #if (HID_RPT_PTP) + // TouchPad IN Report + HID_IDX_TP_IN_RPT_CHAR, + HID_IDX_TP_IN_RPT_VAL, + HID_IDX_TP_IN_RPT_REF, + HID_IDX_TP_IN_RPT_NTF_CFG, + // MaxCnt FEAT Report + HID_IDX_MAXCNT_FEAT_RPT_CHAR, + HID_IDX_MAXCNT_FEAT_RPT_VAL, + HID_IDX_MAXCNT_FEAT_RPT_REF, + // PTPHQA FEAT Report + HID_IDX_PTPHQA_FEAT_RPT_CHAR, + HID_IDX_PTPHQA_FEAT_RPT_VAL, + HID_IDX_PTPHQA_FEAT_RPT_REF, + #endif //(HID_RPT_PTP) + + #if (HID_RPT_MIC) + // MIC IN Report + HID_IDX_MIC_IN_RPT_CHAR, + HID_IDX_MIC_IN_RPT_VAL, + HID_IDX_MIC_IN_RPT_NTF_CFG, + HID_IDX_MIC_IN_RPT_REF, + #endif + #endif //(HID_REPORT_SUP) + + // Max Index, *NOTE* Minus 1(Svc Decl) is .nb_att + HID_IDX_NB, +}; + +/// Attributes Description +const att_decl_t hid_atts[] = +{ + // HID Information Char. Declaration and Value + ATT_ELMT_DECL_CHAR( HID_IDX_HID_INFO_CHAR ), + ATT_ELMT( HID_IDX_HID_INFO_VAL, ATT_CHAR_HID_INFO, PROP_RD, HID_INFO_SIZE ), + + // HID Control Point Char. Declaration + ATT_ELMT_DECL_CHAR( HID_IDX_HID_CTRL_PT_CHAR ), + ATT_ELMT( HID_IDX_HID_CTRL_PT_VAL, ATT_CHAR_HID_CTRL_PT, PROP_WC, HID_CTRL_PT_SIZE ), + + // Protocol Mode Char. Declaration and Value + ATT_ELMT_DECL_CHAR( HID_IDX_PROTO_MODE_CHAR ), + ATT_ELMT( HID_IDX_PROTO_MODE_VAL, ATT_CHAR_PROTOCOL_MODE, PROP_RD | PROP_WC, HID_PROTO_MODE_SIZE ), + + // Report Map Char. Declaration and Value + ATT_ELMT_DECL_CHAR( HID_IDX_REPORT_MAP_CHAR ), + ATT_ELMT( HID_IDX_REPORT_MAP_VAL, ATT_CHAR_REPORT_MAP, PROP_RD, HID_REPORT_MAP_MAX_LEN), + + #if (HID_BOOT_KB) + // Boot Keyboard Input Report Char. Declaration and Value and CCC Descriptor + ATT_ELMT_DECL_CHAR( HID_IDX_BOOT_KB_IN_RPT_CHAR ), + ATT_ELMT( HID_IDX_BOOT_KB_IN_RPT_VAL, ATT_CHAR_BOOT_KB_IN_REPORT, PROP_RD | PROP_NTF | PROP_WR, HID_BOOT_REPORT_MAX_LEN ), + ATT_ELMT_DESC_CLI_CHAR_CFG( HID_IDX_BOOT_KB_IN_RPT_NTF_CFG ), + + // Boot Keyboard Output Report Char. Declaration and Value + ATT_ELMT_DECL_CHAR( HID_IDX_BOOT_KB_OUT_RPT_CHAR ), + ATT_ELMT( HID_IDX_BOOT_KB_OUT_RPT_VAL, ATT_CHAR_BOOT_KB_OUT_REPORT, PROP_RD | PROP_WR | PROP_WC, HID_BOOT_REPORT_MAX_LEN ), + #endif //(HID_BOOT_KB) + + #if (HID_REPORT_SUP) + #if (HID_RPT_KB) + // Keyboard IN Report Char. Declaration and Value, Report Ref. and CCC Descriptor + ATT_ELMT_DECL_CHAR( HID_IDX_KB_IN_RPT_CHAR ), + ATT_ELMT( HID_IDX_KB_IN_RPT_VAL, ATT_CHAR_REPORT, PROP_RD | PROP_NTF | PROP_WR, HID_REPORT_MAX_LEN ), + ATT_ELMT_DESC_REPORT_REF( HID_IDX_KB_IN_RPT_REF ), + ATT_ELMT_DESC_CLI_CHAR_CFG( HID_IDX_KB_IN_RPT_NTF_CFG ), + + // Keyboard OUT Report Char. Declaration and Value, Report Ref. Descriptor + ATT_ELMT_DECL_CHAR( HID_IDX_KB_OUT_RPT_CHAR ), + // Report Characteristic Value + ATT_ELMT( HID_IDX_KB_OUT_RPT_VAL, ATT_CHAR_REPORT, PROP_RD | PROP_WR | PROP_WC, HID_REPORT_MAX_LEN ), + // Report Characteristic - Report Reference Descriptor + ATT_ELMT_DESC_REPORT_REF( HID_IDX_KB_OUT_RPT_REF ), + #endif //(HID_RPT_KB) + + #if (HID_RPT_MEDIA) + // Media IN Report Char. Declaration and Value, Report Ref. and CCC Descriptor + ATT_ELMT_DECL_CHAR( HID_IDX_MEDIA_IN_RPT_CHAR ), + ATT_ELMT( HID_IDX_MEDIA_IN_RPT_VAL, ATT_CHAR_REPORT, PROP_RD | PROP_NTF | PROP_WR, HID_REPORT_MAX_LEN ), + ATT_ELMT_DESC_REPORT_REF( HID_IDX_MEDIA_IN_RPT_REF ), + ATT_ELMT_DESC_CLI_CHAR_CFG( HID_IDX_MEDIA_IN_RPT_NTF_CFG ), + #endif //(HID_RPT_MEDIA) + + #if (HID_RPT_SYSTEM) + // System IN Report Char. Declaration and Value, Report Ref. and CCC Descriptor + ATT_ELMT_DECL_CHAR( HID_IDX_SYS_IN_RPT_CHAR ), + ATT_ELMT( HID_IDX_SYS_IN_RPT_VAL, ATT_CHAR_REPORT, PROP_RD | PROP_NTF, HID_REPORT_MAX_LEN ), + ATT_ELMT_DESC_REPORT_REF( HID_IDX_SYS_IN_RPT_REF ), + ATT_ELMT_DESC_CLI_CHAR_CFG( HID_IDX_SYS_IN_RPT_NTF_CFG ), + #endif //(HID_RPT_SYSTEM) + + #if (HID_RPT_MOUSE) + // Mouse IN Report Char. Declaration and Value, Report Ref. and CCC Descriptor + ATT_ELMT_DECL_CHAR( HID_IDX_MOUSE_IN_RPT_CHAR ), + ATT_ELMT( HID_IDX_MOUSE_IN_RPT_VAL, ATT_CHAR_REPORT, PROP_RD | PROP_NTF, HID_REPORT_MAX_LEN ), + ATT_ELMT_DESC_REPORT_REF( HID_IDX_MOUSE_IN_RPT_REF ), + ATT_ELMT_DESC_CLI_CHAR_CFG( HID_IDX_MOUSE_IN_RPT_NTF_CFG ), + #endif //(HID_RPT_MOUSE) + + #if (HID_RPT_PTP) + // TouchPad IN Report Char. Declaration and Value, Report Ref. and CCC Descriptor + ATT_ELMT_DECL_CHAR( HID_IDX_TP_IN_RPT_CHAR ), + ATT_ELMT( HID_IDX_TP_IN_RPT_VAL, ATT_CHAR_REPORT, PROP_RD | PROP_NTF, HID_REPORT_MAX_LEN ), + ATT_ELMT_DESC_REPORT_REF( HID_IDX_TP_IN_RPT_REF ), + ATT_ELMT_DESC_CLI_CHAR_CFG( HID_IDX_TP_IN_RPT_NTF_CFG ), + + // Max Count Feature Report Char. Declaration and Value, Report Ref. Descriptor + ATT_ELMT_DECL_CHAR( HID_IDX_MAXCNT_FEAT_RPT_CHAR ), + ATT_ELMT( HID_IDX_MAXCNT_FEAT_RPT_VAL, ATT_CHAR_REPORT, PROP_RD | PROP_WR, HID_REPORT_MAX_LEN ), + ATT_ELMT_DESC_REPORT_REF( HID_IDX_MAXCNT_FEAT_RPT_REF ), + + // PTPHQA Feature Report Char. Declaration and Value, Report Ref. Descriptor + ATT_ELMT_DECL_CHAR( HID_IDX_PTPHQA_FEAT_RPT_CHAR ), + ATT_ELMT( HID_IDX_PTPHQA_FEAT_RPT_VAL, ATT_CHAR_REPORT, PROP_RD | PROP_WR, HID_REPORT_MAX_LEN ), + ATT_ELMT_DESC_REPORT_REF( HID_IDX_PTPHQA_FEAT_RPT_REF ), + #endif //(HID_RPT_PTP) + + #if (HID_RPT_MIC) + // MIC IN + // Report Characteristic Declaration + ATT_ELMT_DECL_CHAR(HID_IDX_MIC_IN_RPT_CHAR), + // Report Characteristic Value + ATT_ELMT(HID_IDX_MIC_IN_RPT_VAL, ATT_CHAR_REPORT, PROP_RD | PROP_NTF | PROP_WR, HID_REPORT_MAX_LEN), + // Report Characteristic - Client Characteristic Configuration Descriptor + ATT_ELMT(HID_IDX_MIC_IN_RPT_NTF_CFG, ATT_DESC_CLIENT_CHAR_CFG, PROP_RD | PROP_WR | PROP(WC), 0), + // Report Characteristic - Report Reference Descriptor + ATT_ELMT(HID_IDX_MIC_IN_RPT_REF , ATT_DESC_REPORT_REF, PERM(RD, ENABLE), 0), + #endif + #endif //(HID_REPORT_SUP) +}; + +/// Service Description +const struct svc_decl hid_svc_db = +{ + .uuid = ATT_SVC_HID, + .info = SVC_UUID(16) | SVC_SEC(UNAUTH), + .atts = hid_atts, + .nb_att = HID_IDX_NB - 1, +}; + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @section SVC FUNCTIONS + **************************************************************************************** + */ + +/// Retrieve attribute index form handle +static uint8_t hids_get_att_idx(uint16_t handle) +{ + ASSERT_ERR((handle >= hids_env.start_hdl) && (handle < hids_env.start_hdl + HID_IDX_NB)); + + return (handle - hids_env.start_hdl); +} + +/// Retrieve Report attribute handle from rpt_idx (@see rpt_ntf_idx) or ATT_INVALID_HDL +static uint16_t hids_get_rpt_handle(uint8_t rpt_idx) +{ + uint8_t att_idx = 0; + + switch (rpt_idx) + { + #if (HID_BOOT_SUP) + #if (HID_BOOT_KB) + case RPT_IDX_BOOT_KB: + { + att_idx = HID_IDX_BOOT_KB_IN_RPT_VAL; + } break; + #endif //(HID_BOOT_KB) + + #if (HID_BOOT_MOUSE) + case RPT_IDX_BOOT_MOUSE: + { + att_idx = HID_IDX_BOOT_MOUSE_IN_RPT_VAL; + } break; + #endif //(HID_BOOT_MOUSE) + #endif //(HID_BOOT_SUP) + + #if (HID_REPORT_SUP) + #if (HID_RPT_KB) + case RPT_IDX_KB: + { + att_idx = HID_IDX_KB_IN_RPT_VAL; + } break; + #endif //(HID_RPT_KB) + + #if (HID_RPT_MEDIA) + case RPT_IDX_MEDIA: + { + att_idx = HID_IDX_MEDIA_IN_RPT_VAL; + } break; + #endif //(HID_RPT_MEDIA) + + #if (HID_RPT_SYSTEM) + case RPT_IDX_SYSTEM: + { + att_idx = HID_IDX_SYS_IN_RPT_VAL; + } break; + #endif //(HID_RPT_SYSTEM) + + #if (HID_RPT_MOUSE) + case RPT_IDX_MOUSE: + { + att_idx = HID_IDX_MOUSE_IN_RPT_VAL; + } break; + #endif //(HID_RPT_MOUSE) + + #if (HID_RPT_PTP) + case RPT_IDX_TP: + { + att_idx = HID_IDX_TP_IN_RPT_VAL; + } break; + #endif //(HID_RPT_PTP) + + #if (HID_RPT_MIC) + case RPT_IDX_MIC: + { + att_idx = HID_IDX_MIC_IN_RPT_VAL; + } break; + #endif + #endif //(HID_REPORT_SUP) + + default: + { + att_idx = 0; // error index + } break; + } + + return (att_idx) ? (hids_env.start_hdl + att_idx) : ATT_INVALID_HDL; +} + +/// update configuration if value for stop or NTF start +static uint8_t hids_rpt_ntf_cfg(uint8_t conidx, uint8_t rpt_idx, const struct atts_write_ind *ind) +{ + uint8_t status = PRF_ERR_APP_ERROR; + + if ((!ind->more) && (ind->length == sizeof(uint16_t))) + { + uint16_t cli_cfg = read16p(ind->value); + + //if ((cli_cfg == PRF_CLI_STOP_NTFIND) || (cli_cfg == PRF_CLI_START_NTF)) + if (cli_cfg <= PRF_CLI_START_NTF) + { + DEBUG(" RPT_NTF_CFG(idx:%d,cfg:%d)", rpt_idx, cli_cfg); + + HID_RPT_NTF_SET(conidx, rpt_idx, cli_cfg); + status = LE_SUCCESS; + } + } + + return status; +} + +/// Confirm ATTS_WRITE_REQ +static void hids_att_write_cfm(uint8_t conidx, uint8_t att_idx, uint16_t handle, const struct atts_write_ind *ind) +{ + uint8_t status = LE_SUCCESS; + + switch (att_idx) + { + case HID_IDX_HID_CTRL_PT_VAL: + { + ASSERT_ERR(ind->length == HID_CTRL_PT_SIZE); + + DEBUG(" HID_CTRL_PT:%d", ind->value[0]); + hids_env.conn[conidx].ctrl_pt = ind->value[0]; + } break; + + #if (HID_BOOT_SUP) + case HID_IDX_PROTO_MODE_VAL: + { + ASSERT_ERR(ind->length == HID_PROTO_MODE_SIZE); + + DEBUG(" PROTO_MODE:%d", ind->value[0]); + hids_env.conn[conidx].proto_mode = ind->value[0]; + } break; + + #if (HID_BOOT_KB) + case HID_IDX_BOOT_KB_IN_RPT_NTF_CFG: + { + status = hids_rpt_ntf_cfg(conidx, RPT_IDX_BOOT_KB, ind); + } break; + + case HID_IDX_BOOT_KB_OUT_RPT_VAL: + { + ASSERT_ERR(ind->length == HID_KB_OUT_RPT_SIZE); + + DEBUG(" Led_Lock(b0:num,b1:caps,b2:scroll):0x%02x", ind->value[0]); + hids_env.conn[conidx].led_lock = ind->value[0]; + hids_led_lock(ind->value[0]); + } break; + #endif //(HID_BOOT_KB) + + #endif //(HID_BOOT_SUP) + + #if (HID_REPORT_SUP) + #if (HID_RPT_KB) + case HID_IDX_KB_IN_RPT_NTF_CFG: + { + status = hids_rpt_ntf_cfg(conidx, RPT_IDX_KB, ind); + } break; + + case HID_IDX_KB_OUT_RPT_VAL: + { + ASSERT_ERR(ind->length == HID_KB_OUT_RPT_SIZE); + + DEBUG(" Led_Lock(b0:num,b1:caps,b2:scroll):0x%02x", ind->value[0]); + hids_env.conn[conidx].led_lock = ind->value[0]; + hids_led_lock(ind->value[0]); + } break; + #endif //(HID_RPT_KB) + + #if (HID_RPT_MEDIA) + case HID_IDX_MEDIA_IN_RPT_NTF_CFG: + { + status = hids_rpt_ntf_cfg(conidx, RPT_IDX_MEDIA, ind); + } break; + #endif //(HID_RPT_MEDIA) + + #if (HID_RPT_SYSTEM) + case HID_IDX_SYS_IN_RPT_NTF_CFG: + { + status = hids_rpt_ntf_cfg(conidx, RPT_IDX_SYSTEM, ind); + } break; + #endif //(HID_RPT_SYSTEM) + + #if (HID_RPT_MOUSE) + case HID_IDX_MOUSE_IN_RPT_NTF_CFG: + { + status = hids_rpt_ntf_cfg(conidx, RPT_IDX_MOUSE, ind); + } break; + #endif //(HID_RPT_MOUSE) + + #if (HID_RPT_TP) + case HID_IDX_TP_IN_RPT_NTF_CFG: + { + status = hids_rpt_ntf_cfg(conidx, RPT_IDX_TP, ind); + } break; + + case HID_IDX_MAXCNT_FEAT_RPT_VAL: + case HID_IDX_PTPHQA_FEAT_RPT_VAL: + { + // maybe do something + } break; + #endif //(HID_RPT_TP) + + #if (HID_RPT_MIC) + case HID_IDX_MIC_IN_RPT_NTF_CFG: + { + status = hids_rpt_ntf_cfg(conidx, RPT_IDX_MIC, ind); + } break; + #endif //(HID_MIC) + #endif //(HID_REPORT_SUP) + + default: + { + status = PRF_ERR_APP_ERROR; + } break; + } + + // Send write confirm, if no more data. + if (!ind->more) + gatt_write_cfm(conidx, status, handle); +} + +const uint8_t hid_report_feature6[] = +{ + 0x27, 0x17, 0x32, 0xb8, 0x36, 0x04, 0x64, 0x19, 0xa2, 0x00, 0x00, 0x00, +}; + +/// Confirm ATTS_READ_REQ +static void hids_att_read_cfm(uint8_t conidx, uint8_t att_idx, uint16_t handle) +{ + uint16_t length = 0; + + switch (att_idx) + { + case HID_IDX_HID_INFO_VAL: + { + struct hid_info_tag hid_info; + + hid_info.bcdHID = HID_INFO_BCDHID; + hid_info.bCountryCode = HID_INFO_BCODE; + hid_info.flags = HID_INFO_FLAGS; + DEBUG(" Read HID_INFO(bcd:0x%04X)", hid_info.bcdHID); + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_INFO_SIZE, (uint8_t *)&hid_info); + } break; + + case HID_IDX_REPORT_MAP_VAL: + { + const uint8_t *report_map = hid_get_report_map(&length); + + DEBUG(" Read REPORT_MAP(size:%d)", length); + gatt_read_cfm(conidx, LE_SUCCESS, handle, length, report_map); + } break; + + #if (HID_BOOT_SUP) + case HID_IDX_PROTO_MODE_VAL: + { + DEBUG(" Read PROTO_MODE(mode:%d)", hids_env.conn[conidx].proto_mode); + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_PROTO_MODE_SIZE, &(hids_env.conn[conidx].proto_mode)); + } break; + + #if (HID_BOOT_KB) + case HID_IDX_BOOT_KB_IN_RPT_VAL: + { + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_BOOT_KB_RPT_SIZE, NULL); // zero array + } break; + + case HID_IDX_BOOT_KB_IN_RPT_NTF_CFG: + { + uint16_t ntf_cfg = HID_RPT_NTF_GET(conidx, RPT_IDX_BOOT_KB); + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint16_t), (uint8_t *)&ntf_cfg); + } break; + + case HID_IDX_BOOT_KB_OUT_RPT_VAL: + { + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_KB_OUT_RPT_SIZE, &(hids_env.conn[conidx].led_lock)); + } break; + #endif //(HID_BOOT_KB) + #endif //(HID_BOOT_SUP) + + #if (HID_REPORT_SUP) + #if (HID_RPT_KB) + case HID_IDX_KB_IN_RPT_VAL: + { + gatt_read_cfm(conidx, LE_SUCCESS, handle, RPT_LEN_KB, NULL); // zero array + } break; + + case HID_IDX_KB_IN_RPT_REF: + { + struct hid_report_ref refer; + + refer.report_id = RPT_ID_KB; + refer.report_type = HID_REPORT_INPUT; + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_REPORT_REF_SIZE, (uint8_t *)&refer); + } break; + + case HID_IDX_KB_IN_RPT_NTF_CFG: + { + uint16_t ntf_cfg = HID_RPT_NTF_GET(conidx, RPT_IDX_KB); + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint16_t), (uint8_t *)&ntf_cfg); + } break; + + case HID_IDX_KB_OUT_RPT_VAL: + { + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_KB_OUT_RPT_SIZE, &(hids_env.conn[conidx].led_lock)); + } break; + + case HID_IDX_KB_OUT_RPT_REF: + { + struct hid_report_ref refer; + + refer.report_id = RPT_ID_KB; + refer.report_type = HID_REPORT_OUTPUT; + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_REPORT_REF_SIZE, (uint8_t *)&refer); + } break; + #endif //(HID_RPT_KB) + + #if (HID_RPT_MEDIA) + case HID_IDX_MEDIA_IN_RPT_VAL: + { + gatt_read_cfm(conidx, LE_SUCCESS, handle, RPT_LEN_MEDIA, NULL); // zero array + } break; + + case HID_IDX_MEDIA_IN_RPT_REF: + { + struct hid_report_ref refer; + + refer.report_id = RPT_ID_MEDIA; + refer.report_type = HID_REPORT_INPUT; + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_REPORT_REF_SIZE, (uint8_t *)&refer); + } break; + + case HID_IDX_MEDIA_IN_RPT_NTF_CFG: + { + uint16_t ntf_cfg = HID_RPT_NTF_GET(conidx, RPT_IDX_MEDIA); + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint16_t), (uint8_t *)&ntf_cfg); + } break; + #endif //(HID_RPT_MEDIA) + + #if (HID_RPT_SYSTEM) + case HID_IDX_SYS_IN_RPT_VAL: + { + gatt_read_cfm(conidx, LE_SUCCESS, handle, RPT_LEN_SYSTEM, NULL); // zero array + } break; + + case HID_IDX_SYS_IN_RPT_REF: + { + struct hid_report_ref refer; + + refer.report_id = RPT_ID_SYSTEM; + refer.report_type = HID_REPORT_INPUT; + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_REPORT_REF_SIZE, (uint8_t *)&refer); + } break; + + case HID_IDX_SYS_IN_RPT_NTF_CFG: + { + uint16_t ntf_cfg = HID_RPT_NTF_GET(conidx, RPT_IDX_SYSTEM); + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint16_t), (uint8_t *)&ntf_cfg); + } break; + #endif //(HID_RPT_SYSTEM) + + #if (HID_RPT_MOUSE) + case HID_IDX_MOUSE_IN_RPT_VAL: + { + gatt_read_cfm(conidx, LE_SUCCESS, handle, RPT_LEN_MOUSE, NULL); // zero array + } break; + + case HID_IDX_MOUSE_IN_RPT_REF: + { + struct hid_report_ref refer; + + refer.report_id = RPT_ID_MOUSE; + refer.report_type = HID_REPORT_INPUT; + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_REPORT_REF_SIZE, (uint8_t *)&refer); + } break; + + case HID_IDX_MOUSE_IN_RPT_NTF_CFG: + { + uint16_t ntf_cfg = HID_RPT_NTF_GET(conidx, RPT_IDX_MOUSE); + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint16_t), (uint8_t *)&ntf_cfg); + } break; + #endif //(HID_RPT_MOUSE) + + #if (HID_RPT_PTP) + case HID_IDX_TP_IN_RPT_VAL: + { + gatt_read_cfm(conidx, LE_SUCCESS, handle, RPT_LEN_TP, NULL); // zero array + } break; + + case HID_IDX_TP_IN_RPT_REF: + { + struct hid_report_ref refer; + + refer.report_id = RPT_ID_TP; + refer.report_type = HID_REPORT_INPUT; + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_REPORT_REF_SIZE, (uint8_t *)&refer); + } break; + + case HID_IDX_TP_IN_RPT_NTF_CFG: + { + uint16_t ntf_cfg = HID_RPT_NTF_GET(conidx, RPT_IDX_TP); + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint16_t), (uint8_t *)&ntf_cfg); + } break; + + case HID_IDX_MAXCNT_FEAT_RPT_VAL: + { + uint8_t finger = PTP_MAX_FINGER_CNT; + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint8_t), &finger); + } break; + + case HID_IDX_MAXCNT_FEAT_RPT_REF: + { + struct hid_report_ref refer; + + refer.report_id = RPT_ID_MAXCNT; + refer.report_type = HID_REPORT_FEATURE; + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_REPORT_REF_SIZE, (uint8_t *)&refer); + } break; + + case HID_IDX_PTPHQA_FEAT_RPT_VAL: + { + const uint8_t *ptp_hqa = hid_get_ptphqa_blob(&length); + gatt_read_cfm(conidx, LE_SUCCESS, handle, length, ptp_hqa); + } break; + + case HID_IDX_PTPHQA_FEAT_RPT_REF: + { + struct hid_report_ref refer; + + refer.report_id = RPT_ID_PTPHQA; + refer.report_type = HID_REPORT_FEATURE; + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_REPORT_REF_SIZE, (uint8_t *)&refer); + } break; + #endif //(HID_RPT_PTP) + + #if (HID_RPT_MIC) + case HID_IDX_MIC_IN_RPT_REF: + { + struct hid_report_ref refer; + refer.report_id = 6; + refer.report_type = HID_REPORT_FEATURE; + gatt_read_cfm(conidx, LE_SUCCESS, handle, HID_REPORT_REF_SIZE, (uint8_t *)&refer); + } break; + #endif //(HID_RPT_MIC) + #endif //(HID_REPORT_SUP) + + default: + { + // error response + gatt_read_cfm(conidx, PRF_ERR_APP_ERROR, handle, 0, NULL); + } break; + } +} + +/// Handles reception of the atts request from peer device +static void hids_svc_func(uint8_t conidx, uint8_t opcode, uint16_t handle, const void *param) +{ + uint8_t att_idx = hids_get_att_idx(handle); + + ASSERT_ERR(coindx < HID_CONN_MAX); + DEBUG("svc_func(cid:%d,op:0x%x,hdl:0x%x,att:%d)", conidx, opcode, handle, att_idx); + + switch (opcode) + { + case ATTS_READ_REQ: + { + hids_att_read_cfm(conidx, att_idx, handle); + } break; + + case ATTS_WRITE_REQ: + { + const struct atts_write_ind *ind = param; + + DEBUG(" write_req(hdl:0x%x,att:%d,wr:0x%x,len:%d)", handle, att_idx, ind->wrcode, ind->length); + hids_att_write_cfm(conidx, att_idx, handle, ind); + } break; + + case ATTS_INFO_REQ: + { + uint16_t length = ATT_MAX_LEN_GET(att_idx, hid_atts); + + // Send length-info confirm for prepWR judging. + DEBUG(" info_cfm(hdl:0x%x,att:%d,len:%d)", handle, att_idx, length); + gatt_info_cfm(conidx, LE_SUCCESS, handle, length); + } break; + + case ATTS_CMP_EVT: + { + const struct atts_cmp_evt *evt = param; + + hids_env.nb_pkt++; // release + + if (!SADC->CTRL.SADC_DMAC_EN) + { + ble_latency_applied(true); + } + + DEBUG(" cmp_evt(op:0x%x,sta:0x%x,nb:%d)", evt->operation, evt->status, hids_env.nb_pkt); + // add 'if' to avoid warning #117-D: "evt" never referenced + if (evt->operation == GATT_NOTIFY) + { + // Notify result + } + } break; + + default: + { + // nothing to do + } break; + } +} + + +/** + **************************************************************************************** + * @section API FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Add HID Service Profile in the DB + * Customize via pre-define @see HID_START_HDL + * + * @return Result status, LE_SUCCESS or Error Reason + **************************************************************************************** + */ +uint8_t hids_prf_init(void) +{ + uint8_t status = LE_SUCCESS; + + // Init Environment + hids_env.start_hdl = HID_START_HDL; + hids_env.nb_pkt = HID_NB_PKT_MAX; + + for (uint8_t conidx = 0; conidx < HID_CONN_MAX; conidx++) + { + hids_env.conn[conidx].rpt_ntfs = RPT_NTF_ALL; + hids_env.conn[conidx].led_lock = 0; + hids_env.conn[conidx].proto_mode = HID_REPORT_PROTOCOL_MODE; + hids_env.conn[conidx].ctrl_pt = HID_CTRL_PT_EXIT_SUSPEND; + } + + // Create Service in database + status = attmdb_svc_create(&hids_env.start_hdl, NULL, &hid_svc_db, hids_svc_func); + DEBUG("svc_init(sta:0x%X,shdl:%d,atts:%d)", status, hids_env.start_hdl, HID_IDX_NB-1); + debug("KB_HDL:%d MEDIA_HDL:%d MIC_HDL:%d\r\n", hids_get_rpt_handle(RPT_IDX_KB), hids_get_rpt_handle(RPT_IDX_MEDIA), hids_get_rpt_handle(RPT_IDX_MIC)); + return status; +} + +/** + **************************************************************************************** + * @brief Show LED Lock of Keyboard Output, User Implement! (__weak func) + * + * @param[in] leds Bits of Led_Lock(b0:num,b1:caps,b2:scroll) + **************************************************************************************** + */ +__weak void hids_led_lock(uint8_t leds) +{ + // todo LED play... +} + +/** + **************************************************************************************** + * @brief Enable HID Notification Configurations. + * + * @param[in] conidx Connection index + * @param[in] rpt_ntf Notification Config Bits @see enum rpt_ntf_idx + **************************************************************************************** + */ +void hids_set_ccc(uint8_t conidx, uint8_t rpt_ntf) +{ + //if (gapc_get_conhdl(conidx) != GAP_INVALID_CONHDL) + { + // update configuration + hids_env.conn[conidx].rpt_ntfs = rpt_ntf; + } +} + +/** + **************************************************************************************** + * @brief Send HID Report to Host peer. + * + * @param[in] conidx Connection Index + * @param[in] rep_idx Report Index + * @param[in] rep_len Report Length + * @param[in] rep_val Report Value + * + * @return Status of the operation @see prf_err + **************************************************************************************** + */ +uint8_t hids_report_send(uint8_t conidx, uint8_t rep_idx, uint16_t rep_len, const uint8_t* rep_val) +{ + uint8_t status = PRF_ERR_REQ_DISALLOWED; + + if ((rep_len > 0) && (hids_env.nb_pkt > 0)) + { + if (HID_RPT_NTF_GET(conidx, rep_idx) == PRF_CLI_START_NTF) + { + uint16_t handle = hids_get_rpt_handle(rep_idx); + + if (handle != ATT_INVALID_HDL) + { + hids_env.nb_pkt--; // allocate + DEBUG("hid_ntf_send(len:%d,nb:%d)", rep_len, hids_env.nb_pkt); +// debugHex(rep_val, rep_len); + gatt_ntf_send(conidx, handle, rep_len, rep_val); + status = LE_SUCCESS; + } + } + else + { + status = PRF_ERR_NTF_DISABLED; + } + } + + return status; +} + + +#endif //(PRF_HIDS) diff --git a/projects/bleRemoteControl/Slave/src/prf_hids.h b/projects/bleRemoteControl/Slave/src/prf_hids.h new file mode 100644 index 0000000..a0413da --- /dev/null +++ b/projects/bleRemoteControl/Slave/src/prf_hids.h @@ -0,0 +1,174 @@ +/** + **************************************************************************************** + * + * @file prf_hids.h + * + * @brief Header file - HID Service Server Role + * + **************************************************************************************** + */ + +#ifndef PRF_HIDS_H_ +#define PRF_HIDS_H_ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Server Start Handle(0 = dynamically allocated) +#if !defined(HID_START_HDL) + #define HID_START_HDL (0) +#endif + +/// Number of reports that can be sent +#if !defined(HID_NB_PKT_MAX) + #define HID_NB_PKT_MAX (10) +#endif + +/// Maximal length of Report/Boot Char. Value +#if !defined(HID_REPORT_MAX_LEN) + #define HID_REPORT_MAX_LEN (256) +#endif + +/// Size of HID BOOT keyboard/mouse report +#define HID_BOOT_REPORT_MAX_LEN (8) +#define HID_BOOT_KB_RPT_SIZE (8) // 1B(ctrlKeys) + 1B(resv0) + 6B(KeyCode) +#define HID_BOOT_MOUSE_RPT_SIZE (4) // 1B(button) + 1B(X) + 1B(Y) + 1B(Wheel) +/// Size of HID keyboard Output report +#define HID_KB_OUT_RPT_SIZE (1) // 1B(leds) + +/// Size of HID Information @see struct hid_info_tag +#define HID_INFO_SIZE (4) +/// Size of HID Control Point @see enum hid_ctrl_pt +#define HID_CTRL_PT_SIZE (1) +/// Size of HID Protocol Mode @see enum hid_proto_mode +#define HID_PROTO_MODE_SIZE (1) +/// Size of HID Report Ref. @see struct hid_report_ref +#define HID_REPORT_REF_SIZE (2) + +/// Maximal length of Report Map Char. Value +#define HID_REPORT_MAP_MAX_LEN (512) + +/// HID Information, default value +#define HID_INFO_BCDHID (0x0000) // HID Version 1.11 +#define HID_INFO_BCODE (0x00) // bCountryCode +#define HID_INFO_FLAGS (HID_REMOTE_WAKE_CAPABLE | HID_NORM_CONNECTABLE) + + +/* + * TYPE DEFINITIONS + **************************************************************************************** + */ + +/// HID Information flags +enum hid_info_flags +{ + /// Device capable of providing wake-up signal to a HID host + HID_REMOTE_WAKE_CAPABLE = 0x01, + /// Normally connectable support bit + HID_NORM_CONNECTABLE = 0x02, +}; + +/// Protocol Mode Char. value Keys +enum hid_proto_mode +{ + /// Boot Protocol Mode + HID_BOOT_PROTOCOL_MODE = 0x00, + /// Report Protocol Mode + HID_REPORT_PROTOCOL_MODE = 0x01, +}; + +/// HID Control Point Characteristic value keys +enum hid_ctrl_pt +{ + /// Suspend + HID_CTRL_PT_SUSPEND = 0x00, + /// Exit suspend + HID_CTRL_PT_EXIT_SUSPEND = 0x01, +}; + +/// Report Reference Char. Configuration Values +enum hid_report_type +{ + /// Input Report(RD & NTF) + HID_REPORT_INPUT = 0x01, + /// Output Report(RD & WR & WC) + HID_REPORT_OUTPUT = 0x02, + /// Feature Report(RD & WR) + HID_REPORT_FEATURE = 0x03, +}; + +/// HID Information structure +struct hid_info_tag +{ + /// bcdHID + uint16_t bcdHID; + /// bCountryCode + uint8_t bCountryCode; + /// Flags + uint8_t flags; +}; + +/// Report Reference structure +struct hid_report_ref +{ + /// Report ID + uint8_t report_id; + /// Report Type + uint8_t report_type; +}; + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Add HID Service Profile in the DB + * Customize via pre-define @see HID_START_HDL + * + * @return Result status, LE_SUCCESS or Error Reason + **************************************************************************************** + */ +uint8_t hids_prf_init(void); + +/** + **************************************************************************************** + * @brief Show LED Lock of Keyboard Output, User Implement! (__weak func) + * + * @param[in] leds Bits of Led_Lock(b0:num,b1:caps,b2:scroll) + **************************************************************************************** + */ +void hids_led_lock(uint8_t leds); + +/** + **************************************************************************************** + * @brief Enable HID Notification Configurations. + * + * @param[in] conidx Connection index + * @param[in] rpt_ntf Notification Config Bits @see enum rpt_ntf_idx. + **************************************************************************************** + */ +void hids_set_ccc(uint8_t conidx, uint8_t rpt_ntf); + +/** + **************************************************************************************** + * @brief Send HID Report to Host peer. + * + * @param[in] conidx Connection Index + * @param[in] rep_idx Report Index + * @param[in] rep_len Report Length + * @param[in] rep_val Report Value + * @return Status of the operation @see prf_err + **************************************************************************************** + */ +uint8_t hids_report_send(uint8_t conidx, uint8_t rep_idx, uint16_t rep_len, const uint8_t* rep_val); + + +#endif /* PRF_HIDS_H_ */ diff --git a/projects/bleRemoteControl/Slave/src/proc.c b/projects/bleRemoteControl/Slave/src/proc.c new file mode 100644 index 0000000..8e01673 --- /dev/null +++ b/projects/bleRemoteControl/Slave/src/proc.c @@ -0,0 +1,91 @@ +/** + **************************************************************************************** + * + * @file proc.c + * + * @brief user procedure. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" + +#include "app.h" +#include "keys.h" +#include "uartRb.h" +#include "prf_bass.h" +#include "hid_desc.h" +#include "app_user.h" + +#if (DBG_PROC) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + +#define BLE_SLP_MS(ms) ((ms) << 5) + +extern void kb_scan(void); +/* + * DEFINES + **************************************************************************************** + */ +uint8_t adv_dir_flag = 0; // 㲥 + +static void sleep_proc(void) +{ + uint32_t slpdur = ble_slpdur_get(); + + if (key_press) + { + #if (VOICE) + if (SADC->CTRL.SADC_DMAC_EN) + { + // ˯ + keys_proc(); + return; + } + #endif + + if (slpdur > 625) + { + slpdur = 625; + } + } + + // > 20ms + if (slpdur > BLE_SLP_MS(40)/*640*/) + { + // Core enter poweroff mode + if (ble_sleep(200, slpdur) == BLE_IN_SLEEP) + { + GPIO_DIR_SET_LO(KEY_COL_MSK); + wakeup_io_sw(KEY_ROW_MSK, KEY_ROW_MSK); + + core_pwroff(CFG_WKUP_BLE_EN | CFG_WKUP_IO_EN | WKUP_IO_LATCH_N_BIT); + } + } + else if (slpdur > 100) + { + // Core enter deepsleep mode + if (ble_sleep(64, slpdur) == BLE_IN_SLEEP) + { + core_sleep(CFG_WKUP_BLE_EN); + } + + keys_proc(); + } +} + +void user_procedure(void) +{ + sleep_proc(); + + #if (VOICE) + micPut(); + #endif +} diff --git a/projects/bleUart/mdk/JLinkLog.txt b/projects/bleUart/mdk/JLinkLog.txt new file mode 100644 index 0000000..0b95746 --- /dev/null +++ b/projects/bleUart/mdk/JLinkLog.txt @@ -0,0 +1,20201 @@ +T42A8 000:071.932 SEGGER J-Link V7.96b Log File +T42A8 000:072.184 DLL Compiled: Mar 20 2024 16:53:15 +T42A8 000:072.198 Logging started @ 2024-04-11 05:45 +T42A8 000:072.214 Process: C:\Keil_v5\UV4\UV4.exe +T42A8 000:072.240 - 72.232ms +T42A8 000:072.256 JLINK_SetWarnOutHandler(...) +T42A8 000:072.264 - 0.010ms +T42A8 000:072.273 JLINK_OpenEx(...) +T42A8 000:075.652 Firmware: J-Link V9 compiled May 7 2021 16:26:12 +T42A8 000:076.219 Firmware: J-Link V9 compiled May 7 2021 16:26:12 +T42A8 000:076.357 Decompressing FW timestamp took 119 us +T42A8 000:081.842 Hardware: V9.40 +T42A8 000:081.862 S/N: 59410384 +T42A8 000:081.870 OEM: SEGGER +T42A8 000:081.877 Feature(s): RDI, GDB, FlashDL, FlashBP, JFlash +T42A8 000:082.459 Bootloader: (Could not read) +T42A8 000:083.116 TELNET listener socket opened on port 19021 +T42A8 000:083.244 WEBSRV WEBSRV_Init(): Starting webserver thread(s) +T42A8 000:083.345 WEBSRV Webserver running on local port 19080 +T42A8 000:083.458 Looking for J-Link GUI Server exe at: C:\Keil_v5\ARM\Segger\JLinkGUIServer.exe +T42A8 000:083.508 Looking for J-Link GUI Server exe at: C:\Program Files\SEGGER\JLink_V796b\JLinkGUIServer.exe +T42A8 000:083.536 Forking J-Link GUI Server: C:\Program Files\SEGGER\JLink_V796b\JLinkGUIServer.exe +T42A8 000:087.379 J-Link GUI Server info: "J-Link GUI server V7.96b " +T42A8 000:087.600 - 15.315ms returns "O.K." +T42A8 000:087.623 JLINK_SetErrorOutHandler(...) +T42A8 000:087.632 - 0.008ms +T42A8 000:087.661 JLINK_ExecCommand("ProjectFile = "C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\projects\bleUart\mdk\JLinkSettings.ini"", ...). +T42A8 000:108.674 Ref file found at: C:\Keil_v5\ARM\Segger\JLinkDevices.ref +T42A8 000:108.770 REF file references invalid XML file: C:\Program Files\SEGGER\JLink_V796b\JLinkDevices.xml +T42A8 000:115.564 Device "CORTEX-M0" selected. +T42A8 000:115.936 - 28.274ms returns 0x00 +T42A8 000:119.282 JLINK_ExecCommand("Device = B6x", ...). +T42A8 000:122.844 Device "CORTEX-M0" selected. +T42A8 000:123.131 - 3.837ms returns 0x00 +T42A8 000:123.141 JLINK_ExecCommand("DisableConnectionTimeout", ...). +T42A8 000:123.150 - 0.002ms returns 0x01 +T42A8 000:123.156 JLINK_GetHardwareVersion() +T42A8 000:123.164 - 0.004ms returns 94000 +T42A8 000:123.170 JLINK_GetDLLVersion() +T42A8 000:123.175 - 0.004ms returns 79602 +T42A8 000:123.181 JLINK_GetOEMString(...) +T42A8 000:123.187 JLINK_GetFirmwareString(...) +T42A8 000:123.192 - 0.004ms +T42A8 000:138.051 JLINK_GetDLLVersion() +T42A8 000:138.067 - 0.016ms returns 79602 +T42A8 000:138.073 JLINK_GetCompileDateTime() +T42A8 000:138.078 - 0.004ms +T42A8 000:141.306 JLINK_GetFirmwareString(...) +T42A8 000:141.320 - 0.013ms +T42A8 000:147.751 JLINK_GetHardwareVersion() +T42A8 000:147.785 - 0.033ms returns 94000 +T42A8 000:150.673 JLINK_GetSN() +T42A8 000:150.685 - 0.011ms returns 59410384 +T42A8 000:153.493 JLINK_GetOEMString(...) +T42A8 000:158.900 JLINK_TIF_Select(JLINKARM_TIF_SWD) +T42A8 000:159.654 - 0.753ms returns 0x00 +T42A8 000:159.682 JLINK_HasError() +T42A8 000:159.694 JLINK_SetSpeed(1000) +T42A8 000:159.784 - 0.091ms +T42A8 000:159.794 JLINK_GetId() +T42A8 000:163.449 Found SW-DP with ID 0x0BC11477 +T42A8 000:170.372 DPIDR: 0x0BC11477 +T42A8 000:174.380 CoreSight SoC-400 or earlier +T42A8 000:179.152 Scanning AP map to find all available APs +T42A8 000:182.705 AP[1]: Stopped AP scan as end of AP map has been reached +T42A8 000:185.510 AP[0]: AHB-AP (IDR: 0x04770031) +T42A8 000:188.609 Iterating through AP map to find AHB-AP to use +T42A8 000:192.965 AP[0]: Core found +T42A8 000:195.768 AP[0]: AHB-AP ROM base: 0xE00FF000 +T42A8 000:199.250 CPUID register: 0x410CC601. Implementer code: 0x41 (ARM) +T42A8 000:202.116 Found Cortex-M0 r0p1, Little endian. +T42A8 000:202.528 -- Max. mem block: 0x00010C40 +T42A8 000:202.902 CPU_ReadMem(4 bytes @ 0xE000EDF0) +T42A8 000:203.393 CPU_WriteMem(4 bytes @ 0xE000EDF0) +T42A8 000:203.903 CPU_ReadMem(4 bytes @ 0xE0002000) +T42A8 000:207.405 FPUnit: 4 code (BP) slots and 0 literal slots +T42A8 000:207.519 CPU_ReadMem(4 bytes @ 0xE000EDFC) +T42A8 000:208.020 CPU_WriteMem(4 bytes @ 0xE000EDFC) +T42A8 000:208.561 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:209.034 CPU_WriteMem(4 bytes @ 0xE0001000) +T42A8 000:213.054 CoreSight components: +T42A8 000:215.667 ROMTbl[0] @ E00FF000 +T42A8 000:215.685 CPU_ReadMem(64 bytes @ 0xE00FF000) +T42A8 000:217.001 CPU_ReadMem(32 bytes @ 0xE000EFE0) +T42A8 000:220.485 [0][0]: E000E000 CID B105E00D PID 000BB008 SCS +T42A8 000:220.498 CPU_ReadMem(32 bytes @ 0xE0001FE0) +T42A8 000:223.949 [0][1]: E0001000 CID B105E00D PID 000BB00A DWT +T42A8 000:223.962 CPU_ReadMem(32 bytes @ 0xE0002FE0) +T42A8 000:227.641 [0][2]: E0002000 CID B105E00D PID 000BB00B FPB +T42A8 000:227.979 - 68.184ms returns 0x0BC11477 +T42A8 000:227.995 JLINK_GetDLLVersion() +T42A8 000:228.000 - 0.005ms returns 79602 +T42A8 000:228.007 JLINK_CORE_GetFound() +T42A8 000:228.012 - 0.004ms returns 0x60000FF +T42A8 000:228.018 JLINK_GetDebugInfo(0x100 = JLINKARM_ROM_TABLE_ADDR_INDEX) +T42A8 000:228.024 Value=0xE00FF000 +T42A8 000:228.030 - 0.012ms returns 0 +T42A8 000:231.071 JLINK_ReadMem(0xE00FF000, 0x20 Bytes, ...) +T42A8 000:231.095 CPU_ReadMem(32 bytes @ 0xE00FF000) +T42A8 000:232.039 Data: 03 F0 F0 FF 03 20 F0 FF 03 30 F0 FF 00 00 00 00 ... +T42A8 000:232.078 - 1.006ms returns 0 +T42A8 000:232.085 JLINK_ReadMem(0xE000EFF0, 0x10 Bytes, ...) +T42A8 000:232.093 CPU_ReadMem(16 bytes @ 0xE000EFF0) +T42A8 000:232.798 Data: 0D 00 00 00 E0 00 00 00 05 00 00 00 B1 00 00 00 +T42A8 000:232.808 - 0.722ms returns 0 +T42A8 000:232.815 JLINK_ReadMem(0xE000EFD0, 0x20 Bytes, ...) +T42A8 000:232.822 CPU_ReadMem(32 bytes @ 0xE000EFD0) +T42A8 000:233.721 Data: 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +T42A8 000:233.730 - 0.914ms returns 0 +T42A8 000:233.738 JLINK_ReadMem(0xE0001FF0, 0x10 Bytes, ...) +T42A8 000:233.745 CPU_ReadMem(16 bytes @ 0xE0001FF0) +T42A8 000:234.528 Data: 0D 00 00 00 E0 00 00 00 05 00 00 00 B1 00 00 00 +T42A8 000:234.537 - 0.799ms returns 0 +T42A8 000:234.545 JLINK_ReadMem(0xE0001FD0, 0x20 Bytes, ...) +T42A8 000:234.569 CPU_ReadMem(32 bytes @ 0xE0001FD0) +T42A8 000:235.431 Data: 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +T42A8 000:235.487 - 0.941ms returns 0 +T42A8 000:235.494 JLINK_ReadMem(0xE0002FF0, 0x10 Bytes, ...) +T42A8 000:235.501 CPU_ReadMem(16 bytes @ 0xE0002FF0) +T42A8 000:236.182 Data: 0D 00 00 00 E0 00 00 00 05 00 00 00 B1 00 00 00 +T42A8 000:236.237 - 0.743ms returns 0 +T42A8 000:236.245 JLINK_ReadMem(0xE0002FD0, 0x20 Bytes, ...) +T42A8 000:236.252 CPU_ReadMem(32 bytes @ 0xE0002FD0) +T42A8 000:237.176 Data: 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +T42A8 000:237.223 - 0.978ms returns 0 +T42A8 000:237.231 JLINK_ReadMemU32(0xE000ED00, 0x1 Items) +T42A8 000:237.238 CPU_ReadMem(4 bytes @ 0xE000ED00) +T42A8 000:237.827 Data: 01 C6 0C 41 +T42A8 000:237.838 Debug reg: CPUID +T42A8 000:237.845 - 0.614ms returns 1 (0x1) +T42A8 000:237.853 JLINK_HasError() +T42A8 000:237.860 JLINK_SetResetType(JLINKARM_CM3_RESET_TYPE_NORMAL) +T42A8 000:237.865 - 0.005ms returns JLINKARM_CM3_RESET_TYPE_NORMAL +T42A8 000:237.871 JLINK_Reset() +T42A8 000:237.881 CPU is running +T42A8 000:237.888 CPU_WriteMem(4 bytes @ 0xE000EDF0) +T42A8 000:238.474 CPU is running +T42A8 000:238.524 CPU_WriteMem(4 bytes @ 0xE000EDFC) +T42A8 000:241.876 Reset: Halt core after reset via DEMCR.VC_CORERESET. +T42A8 000:245.076 Reset: Reset device via AIRCR.SYSRESETREQ. +T42A8 000:245.093 CPU is running +T42A8 000:245.103 CPU_WriteMem(4 bytes @ 0xE000ED0C) +T42A8 000:300.030 CPU_ReadMem(4 bytes @ 0xE000EDF0) +T42A8 000:300.800 CPU_ReadMem(4 bytes @ 0xE000EDF0) +T42A8 000:307.859 CPU_WriteMem(4 bytes @ 0xE000EDFC) +T42A8 000:314.365 CPU_ReadMem(4 bytes @ 0xE000EDF0) +T42A8 000:321.308 CPU_WriteMem(4 bytes @ 0xE0002000) +T42A8 000:321.988 CPU_ReadMem(4 bytes @ 0xE000EDFC) +T42A8 000:322.648 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:323.232 CPU_WriteMem(4 bytes @ 0xE0001000) +T42A8 000:323.956 - 86.084ms +T42A8 000:323.974 JLINK_Halt() +T42A8 000:323.982 - 0.008ms returns 0x00 +T42A8 000:323.990 JLINK_IsHalted() +T42A8 000:323.995 - 0.005ms returns TRUE +T42A8 000:324.003 JLINK_ReadMemU32(0xE000EDF0, 0x1 Items) +T42A8 000:324.012 CPU_ReadMem(4 bytes @ 0xE000EDF0) +T42A8 000:324.561 Data: 03 00 03 00 +T42A8 000:324.571 Debug reg: DHCSR +T42A8 000:324.579 - 0.576ms returns 1 (0x1) +T42A8 000:324.592 JLINK_WriteU32_64(0xE000EDF0, 0xA05F0003) +T42A8 000:324.598 Debug reg: DHCSR +T42A8 000:325.045 CPU_WriteMem(4 bytes @ 0xE000EDF0) +T42A8 000:325.616 - 1.024ms returns 0 (0x00000000) +T42A8 000:325.629 JLINK_WriteU32_64(0xE000EDFC, 0x01000000) +T42A8 000:325.634 Debug reg: DEMCR +T42A8 000:325.644 CPU_WriteMem(4 bytes @ 0xE000EDFC) +T42A8 000:326.298 - 0.669ms returns 0 (0x00000000) +T42A8 000:337.703 JLINK_GetHWStatus(...) +T42A8 000:337.968 - 0.264ms returns 0 +T42A8 000:347.651 JLINK_GetNumBPUnits(Type = 0xFFFFFF00) +T42A8 000:347.670 - 0.019ms returns 0x04 +T42A8 000:347.677 JLINK_GetNumBPUnits(Type = 0xF0) +T42A8 000:347.682 - 0.004ms returns 0x2000 +T42A8 000:347.688 JLINK_GetNumWPUnits() +T42A8 000:347.692 - 0.004ms returns 1 +T42A8 000:354.770 JLINK_GetSpeed() +T42A8 000:354.781 - 0.011ms returns 1000 +T42A8 000:362.523 JLINK_ReadMemU32(0xE000E004, 0x1 Items) +T42A8 000:362.550 CPU_ReadMem(4 bytes @ 0xE000E004) +T42A8 000:363.287 Data: 00 00 00 00 +T42A8 000:363.311 - 0.788ms returns 1 (0x1) +T42A8 000:363.336 JLINK_Halt() +T42A8 000:363.358 - 0.022ms returns 0x00 +T42A8 000:363.365 JLINK_IsHalted() +T42A8 000:363.371 - 0.005ms returns TRUE +T42A8 000:367.585 JLINK_WriteMem(0x20003000, 0x9D4 Bytes, ...) +T42A8 000:367.594 Data: 00 BE 0A E0 0D 78 2D 06 68 40 08 24 40 00 00 D3 ... +T42A8 000:368.071 CPU_WriteMem(2516 bytes @ 0x20003000) +T42A8 000:399.865 - 32.279ms returns 0x9D4 +T42A8 000:399.916 JLINK_HasError() +T42A8 000:399.996 JLINK_WriteReg(R0, 0x18000000) +T42A8 000:400.009 - 0.019ms returns 0 +T42A8 000:400.017 JLINK_WriteReg(R1, 0x00F42400) +T42A8 000:400.022 - 0.005ms returns 0 +T42A8 000:400.028 JLINK_WriteReg(R2, 0x00000001) +T42A8 000:400.033 - 0.005ms returns 0 +T42A8 000:400.039 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:400.044 - 0.004ms returns 0 +T42A8 000:400.050 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:400.055 - 0.004ms returns 0 +T42A8 000:400.061 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:400.065 - 0.004ms returns 0 +T42A8 000:400.071 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:400.076 - 0.004ms returns 0 +T42A8 000:400.082 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:400.087 - 0.004ms returns 0 +T42A8 000:400.093 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:400.098 - 0.005ms returns 0 +T42A8 000:400.104 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:400.109 - 0.004ms returns 0 +T42A8 000:400.115 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:400.119 - 0.004ms returns 0 +T42A8 000:400.125 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:400.130 - 0.005ms returns 0 +T42A8 000:400.136 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:400.141 - 0.004ms returns 0 +T42A8 000:400.148 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:400.153 - 0.005ms returns 0 +T42A8 000:400.159 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:400.166 - 0.006ms returns 0 +T42A8 000:400.174 JLINK_WriteReg(R15 (PC), 0x200030E2) +T42A8 000:400.179 - 0.007ms returns 0 +T42A8 000:400.185 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:400.190 - 0.005ms returns 0 +T42A8 000:400.196 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:400.201 - 0.004ms returns 0 +T42A8 000:400.207 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:400.212 - 0.005ms returns 0 +T42A8 000:400.218 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:400.223 - 0.005ms returns 0 +T42A8 000:400.230 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:400.240 CPU_ReadMem(4 bytes @ 0x20003000) +T42A8 000:400.979 CPU_WriteMem(4 bytes @ 0x20003000) +T42A8 000:401.668 CPU_ReadMem(4 bytes @ 0x20003000) +T42A8 000:402.335 CPU_WriteMem(4 bytes @ 0x20003000) +T42A8 000:402.933 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:403.451 - 3.220ms returns 0x00000001 +T42A8 000:403.463 JLINK_Go() +T42A8 000:403.476 CPU_WriteMem(2 bytes @ 0x20003000) +T42A8 000:404.097 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:404.664 CPU_WriteMem(4 bytes @ 0xE0001000) +T42A8 000:405.278 CPU_WriteMem(4 bytes @ 0xE0002008) +T42A8 000:405.289 CPU_WriteMem(4 bytes @ 0xE000200C) +T42A8 000:405.297 CPU_WriteMem(4 bytes @ 0xE0002010) +T42A8 000:405.305 CPU_WriteMem(4 bytes @ 0xE0002014) +T42A8 000:407.037 CPU_WriteMem(4 bytes @ 0xE0001004) +T42A8 000:416.972 Memory map 'after startup completion point' is active +T42A8 000:416.993 - 13.529ms +T42A8 000:417.003 JLINK_IsHalted() +T42A8 000:422.973 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:423.606 - 6.602ms returns TRUE +T42A8 000:423.618 JLINK_ReadReg(R15 (PC)) +T42A8 000:423.626 - 0.007ms returns 0x20003000 +T42A8 000:423.632 JLINK_ClrBPEx(BPHandle = 0x00000001) +T42A8 000:423.638 - 0.005ms returns 0x00 +T42A8 000:423.644 JLINK_ReadReg(R0) +T42A8 000:423.649 - 0.005ms returns 0x00000000 +T42A8 000:423.995 JLINK_HasError() +T42A8 000:424.005 JLINK_WriteReg(R0, 0x18004000) +T42A8 000:424.011 - 0.006ms returns 0 +T42A8 000:424.017 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:424.022 - 0.005ms returns 0 +T42A8 000:424.028 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:424.033 - 0.004ms returns 0 +T42A8 000:424.039 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:424.043 - 0.004ms returns 0 +T42A8 000:424.049 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:424.054 - 0.004ms returns 0 +T42A8 000:424.062 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:424.067 - 0.004ms returns 0 +T42A8 000:424.072 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:424.078 - 0.005ms returns 0 +T42A8 000:424.083 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:424.088 - 0.004ms returns 0 +T42A8 000:424.098 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:424.102 - 0.004ms returns 0 +T42A8 000:424.108 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:424.113 - 0.004ms returns 0 +T42A8 000:424.119 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:424.123 - 0.004ms returns 0 +T42A8 000:424.141 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:424.146 - 0.005ms returns 0 +T42A8 000:424.173 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:424.178 - 0.004ms returns 0 +T42A8 000:424.184 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:424.189 - 0.005ms returns 0 +T42A8 000:424.195 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:424.213 - 0.017ms returns 0 +T42A8 000:424.219 JLINK_WriteReg(R15 (PC), 0x20003020) +T42A8 000:424.223 - 0.004ms returns 0 +T42A8 000:424.229 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:424.234 - 0.004ms returns 0 +T42A8 000:424.240 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:424.244 - 0.004ms returns 0 +T42A8 000:424.250 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:424.255 - 0.004ms returns 0 +T42A8 000:424.260 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:424.265 - 0.004ms returns 0 +T42A8 000:424.271 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:424.298 - 0.027ms returns 0x00000002 +T42A8 000:424.317 JLINK_Go() +T42A8 000:424.327 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:430.233 - 5.900ms +T42A8 000:430.264 JLINK_IsHalted() +T42A8 000:436.179 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:436.791 - 6.527ms returns TRUE +T42A8 000:436.804 JLINK_ReadReg(R15 (PC)) +T42A8 000:436.811 - 0.006ms returns 0x20003000 +T42A8 000:436.817 JLINK_ClrBPEx(BPHandle = 0x00000002) +T42A8 000:436.822 - 0.005ms returns 0x00 +T42A8 000:436.829 JLINK_ReadReg(R0) +T42A8 000:436.834 - 0.004ms returns 0x00000001 +T42A8 000:436.840 JLINK_HasError() +T42A8 000:436.908 JLINK_WriteReg(R0, 0x18004000) +T42A8 000:436.919 - 0.010ms returns 0 +T42A8 000:436.926 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:436.931 - 0.005ms returns 0 +T42A8 000:436.937 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:436.941 - 0.004ms returns 0 +T42A8 000:436.947 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:436.952 - 0.004ms returns 0 +T42A8 000:436.958 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:436.963 - 0.005ms returns 0 +T42A8 000:436.970 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:436.975 - 0.005ms returns 0 +T42A8 000:436.981 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:436.985 - 0.004ms returns 0 +T42A8 000:436.991 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:437.032 - 0.041ms returns 0 +T42A8 000:437.039 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:437.044 - 0.005ms returns 0 +T42A8 000:437.050 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:437.054 - 0.004ms returns 0 +T42A8 000:437.060 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:437.066 - 0.005ms returns 0 +T42A8 000:437.072 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:437.077 - 0.004ms returns 0 +T42A8 000:437.083 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:437.088 - 0.004ms returns 0 +T42A8 000:437.094 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:437.099 - 0.005ms returns 0 +T42A8 000:437.105 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:437.110 - 0.004ms returns 0 +T42A8 000:437.116 JLINK_WriteReg(R15 (PC), 0x200032CA) +T42A8 000:437.121 - 0.005ms returns 0 +T42A8 000:437.127 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:437.132 - 0.004ms returns 0 +T42A8 000:437.138 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:437.142 - 0.004ms returns 0 +T42A8 000:437.148 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:437.153 - 0.004ms returns 0 +T42A8 000:437.159 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:437.164 - 0.004ms returns 0 +T42A8 000:437.170 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:437.176 - 0.006ms returns 0x00000003 +T42A8 000:437.182 JLINK_Go() +T42A8 000:437.190 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:443.165 - 5.983ms +T42A8 000:443.191 JLINK_IsHalted() +T42A8 000:443.888 - 0.696ms returns FALSE +T42A8 000:443.898 JLINK_HasError() +T42A8 000:461.010 JLINK_IsHalted() +T42A8 000:467.081 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:467.671 - 6.660ms returns TRUE +T42A8 000:467.686 JLINK_ReadReg(R15 (PC)) +T42A8 000:467.693 - 0.007ms returns 0x20003000 +T42A8 000:467.700 JLINK_ClrBPEx(BPHandle = 0x00000003) +T42A8 000:467.705 - 0.005ms returns 0x00 +T42A8 000:467.711 JLINK_ReadReg(R0) +T42A8 000:467.717 - 0.004ms returns 0x00000000 +T42A8 000:468.248 JLINK_HasError() +T42A8 000:468.258 JLINK_WriteReg(R0, 0x18005000) +T42A8 000:468.264 - 0.006ms returns 0 +T42A8 000:468.270 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:468.275 - 0.004ms returns 0 +T42A8 000:468.281 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:468.285 - 0.004ms returns 0 +T42A8 000:468.291 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:468.296 - 0.004ms returns 0 +T42A8 000:468.301 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:468.306 - 0.004ms returns 0 +T42A8 000:468.312 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:468.316 - 0.004ms returns 0 +T42A8 000:468.322 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:468.327 - 0.004ms returns 0 +T42A8 000:468.333 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:468.337 - 0.004ms returns 0 +T42A8 000:468.343 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:468.348 - 0.004ms returns 0 +T42A8 000:468.353 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:468.358 - 0.004ms returns 0 +T42A8 000:468.364 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:468.368 - 0.004ms returns 0 +T42A8 000:468.374 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:468.379 - 0.004ms returns 0 +T42A8 000:468.384 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:468.389 - 0.004ms returns 0 +T42A8 000:468.395 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:468.400 - 0.005ms returns 0 +T42A8 000:468.406 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:468.411 - 0.004ms returns 0 +T42A8 000:468.416 JLINK_WriteReg(R15 (PC), 0x20003020) +T42A8 000:468.421 - 0.004ms returns 0 +T42A8 000:468.427 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:468.431 - 0.004ms returns 0 +T42A8 000:468.437 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:468.442 - 0.004ms returns 0 +T42A8 000:468.447 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:468.452 - 0.004ms returns 0 +T42A8 000:468.458 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:468.462 - 0.004ms returns 0 +T42A8 000:468.469 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:468.474 - 0.006ms returns 0x00000004 +T42A8 000:468.480 JLINK_Go() +T42A8 000:468.489 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:474.224 - 5.743ms +T42A8 000:474.236 JLINK_IsHalted() +T42A8 000:480.142 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:481.087 - 6.846ms returns TRUE +T42A8 000:481.206 JLINK_ReadReg(R15 (PC)) +T42A8 000:481.243 - 0.037ms returns 0x20003000 +T42A8 000:481.274 JLINK_ClrBPEx(BPHandle = 0x00000004) +T42A8 000:481.299 - 0.024ms returns 0x00 +T42A8 000:481.328 JLINK_ReadReg(R0) +T42A8 000:481.350 - 0.021ms returns 0x00000001 +T42A8 000:481.378 JLINK_HasError() +T42A8 000:481.407 JLINK_WriteReg(R0, 0x18005000) +T42A8 000:481.431 - 0.023ms returns 0 +T42A8 000:481.458 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:481.480 - 0.022ms returns 0 +T42A8 000:481.507 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:481.528 - 0.021ms returns 0 +T42A8 000:481.554 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:481.575 - 0.021ms returns 0 +T42A8 000:481.601 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:481.622 - 0.021ms returns 0 +T42A8 000:481.648 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:481.669 - 0.021ms returns 0 +T42A8 000:481.695 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:481.716 - 0.021ms returns 0 +T42A8 000:481.742 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:481.764 - 0.021ms returns 0 +T42A8 000:481.790 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:481.811 - 0.021ms returns 0 +T42A8 000:481.837 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:481.859 - 0.021ms returns 0 +T42A8 000:481.885 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:481.906 - 0.021ms returns 0 +T42A8 000:481.932 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:481.953 - 0.021ms returns 0 +T42A8 000:481.979 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:482.006 - 0.026ms returns 0 +T42A8 000:482.033 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:482.055 - 0.022ms returns 0 +T42A8 000:482.081 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:482.102 - 0.021ms returns 0 +T42A8 000:482.128 JLINK_WriteReg(R15 (PC), 0x200032CA) +T42A8 000:482.149 - 0.021ms returns 0 +T42A8 000:482.175 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:482.197 - 0.021ms returns 0 +T42A8 000:482.223 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:482.244 - 0.021ms returns 0 +T42A8 000:482.271 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:482.292 - 0.021ms returns 0 +T42A8 000:482.318 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:482.339 - 0.021ms returns 0 +T42A8 000:482.367 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:482.391 - 0.025ms returns 0x00000005 +T42A8 000:482.417 JLINK_Go() +T42A8 000:482.458 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:489.140 - 6.719ms +T42A8 000:489.230 JLINK_IsHalted() +T42A8 000:490.135 - 0.901ms returns FALSE +T42A8 000:490.203 JLINK_HasError() +T42A8 000:504.142 JLINK_IsHalted() +T42A8 000:510.761 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:511.690 - 7.545ms returns TRUE +T42A8 000:511.757 JLINK_ReadReg(R15 (PC)) +T42A8 000:511.788 - 0.031ms returns 0x20003000 +T42A8 000:511.817 JLINK_ClrBPEx(BPHandle = 0x00000005) +T42A8 000:511.841 - 0.024ms returns 0x00 +T42A8 000:511.869 JLINK_ReadReg(R0) +T42A8 000:511.892 - 0.022ms returns 0x00000000 +T42A8 000:513.858 JLINK_HasError() +T42A8 000:513.969 JLINK_WriteReg(R0, 0x18006000) +T42A8 000:514.001 - 0.070ms returns 0 +T42A8 000:514.030 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:514.052 - 0.022ms returns 0 +T42A8 000:514.078 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:514.099 - 0.021ms returns 0 +T42A8 000:514.126 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:514.148 - 0.022ms returns 0 +T42A8 000:514.174 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:514.195 - 0.021ms returns 0 +T42A8 000:514.221 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:514.242 - 0.021ms returns 0 +T42A8 000:514.268 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:514.289 - 0.021ms returns 0 +T42A8 000:514.315 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:514.336 - 0.021ms returns 0 +T42A8 000:514.362 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:514.383 - 0.021ms returns 0 +T42A8 000:514.409 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:514.430 - 0.021ms returns 0 +T42A8 000:514.457 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:514.478 - 0.021ms returns 0 +T42A8 000:514.504 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:514.525 - 0.021ms returns 0 +T42A8 000:514.551 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:514.572 - 0.021ms returns 0 +T42A8 000:514.607 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:514.635 - 0.028ms returns 0 +T42A8 000:514.661 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:514.682 - 0.021ms returns 0 +T42A8 000:514.709 JLINK_WriteReg(R15 (PC), 0x20003020) +T42A8 000:514.730 - 0.021ms returns 0 +T42A8 000:514.757 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:514.778 - 0.021ms returns 0 +T42A8 000:514.804 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:514.825 - 0.021ms returns 0 +T42A8 000:514.851 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:514.872 - 0.021ms returns 0 +T42A8 000:514.899 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:514.925 - 0.026ms returns 0 +T42A8 000:514.986 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:515.018 - 0.033ms returns 0x00000006 +T42A8 000:515.045 JLINK_Go() +T42A8 000:515.089 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:521.772 - 6.723ms +T42A8 000:521.843 JLINK_IsHalted() +T42A8 000:528.249 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:529.025 - 7.179ms returns TRUE +T42A8 000:529.088 JLINK_ReadReg(R15 (PC)) +T42A8 000:529.118 - 0.029ms returns 0x20003000 +T42A8 000:529.147 JLINK_ClrBPEx(BPHandle = 0x00000006) +T42A8 000:529.170 - 0.023ms returns 0x00 +T42A8 000:529.201 JLINK_ReadReg(R0) +T42A8 000:529.224 - 0.021ms returns 0x00000001 +T42A8 000:529.256 JLINK_HasError() +T42A8 000:529.461 JLINK_WriteReg(R0, 0x18006000) +T42A8 000:529.506 - 0.046ms returns 0 +T42A8 000:529.538 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:529.560 - 0.023ms returns 0 +T42A8 000:529.587 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:529.608 - 0.021ms returns 0 +T42A8 000:529.635 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:529.656 - 0.021ms returns 0 +T42A8 000:529.682 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:529.703 - 0.021ms returns 0 +T42A8 000:529.729 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:529.750 - 0.021ms returns 0 +T42A8 000:529.777 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:529.801 - 0.023ms returns 0 +T42A8 000:529.828 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:529.850 - 0.022ms returns 0 +T42A8 000:529.882 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:529.925 - 0.042ms returns 0 +T42A8 000:529.980 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:530.007 - 0.027ms returns 0 +T42A8 000:530.034 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:530.056 - 0.021ms returns 0 +T42A8 000:530.082 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:530.103 - 0.021ms returns 0 +T42A8 000:530.129 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:530.151 - 0.021ms returns 0 +T42A8 000:530.177 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:530.200 - 0.023ms returns 0 +T42A8 000:530.226 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:530.247 - 0.021ms returns 0 +T42A8 000:530.274 JLINK_WriteReg(R15 (PC), 0x200032CA) +T42A8 000:530.295 - 0.021ms returns 0 +T42A8 000:530.322 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:530.343 - 0.021ms returns 0 +T42A8 000:530.369 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:530.390 - 0.021ms returns 0 +T42A8 000:530.417 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:530.438 - 0.021ms returns 0 +T42A8 000:530.464 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:530.485 - 0.021ms returns 0 +T42A8 000:530.514 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:530.540 - 0.027ms returns 0x00000007 +T42A8 000:530.566 JLINK_Go() +T42A8 000:530.606 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:537.191 - 6.622ms +T42A8 000:537.255 JLINK_IsHalted() +T42A8 000:538.010 - 0.753ms returns FALSE +T42A8 000:538.063 JLINK_HasError() +T42A8 000:563.830 JLINK_IsHalted() +T42A8 000:569.998 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:570.757 - 6.926ms returns TRUE +T42A8 000:570.785 JLINK_ReadReg(R15 (PC)) +T42A8 000:570.797 - 0.012ms returns 0x20003000 +T42A8 000:570.807 JLINK_ClrBPEx(BPHandle = 0x00000007) +T42A8 000:570.814 - 0.007ms returns 0x00 +T42A8 000:570.823 JLINK_ReadReg(R0) +T42A8 000:570.830 - 0.007ms returns 0x00000000 +T42A8 000:571.460 JLINK_HasError() +T42A8 000:571.482 JLINK_WriteReg(R0, 0x18007000) +T42A8 000:571.493 - 0.010ms returns 0 +T42A8 000:571.501 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:571.508 - 0.007ms returns 0 +T42A8 000:571.521 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:571.530 - 0.009ms returns 0 +T42A8 000:571.538 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:571.545 - 0.006ms returns 0 +T42A8 000:571.553 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:571.559 - 0.006ms returns 0 +T42A8 000:571.567 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:571.574 - 0.006ms returns 0 +T42A8 000:571.582 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:571.589 - 0.006ms returns 0 +T42A8 000:571.597 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:571.604 - 0.007ms returns 0 +T42A8 000:571.612 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:571.619 - 0.006ms returns 0 +T42A8 000:571.627 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:571.633 - 0.006ms returns 0 +T42A8 000:571.642 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:571.648 - 0.006ms returns 0 +T42A8 000:571.656 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:571.663 - 0.006ms returns 0 +T42A8 000:571.671 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:571.677 - 0.006ms returns 0 +T42A8 000:571.685 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:571.692 - 0.007ms returns 0 +T42A8 000:571.701 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:571.707 - 0.006ms returns 0 +T42A8 000:571.716 JLINK_WriteReg(R15 (PC), 0x20003020) +T42A8 000:571.724 - 0.008ms returns 0 +T42A8 000:571.732 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:571.741 - 0.008ms returns 0 +T42A8 000:571.751 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:571.767 - 0.016ms returns 0 +T42A8 000:571.780 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:571.789 - 0.009ms returns 0 +T42A8 000:571.801 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:571.810 - 0.008ms returns 0 +T42A8 000:571.819 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:571.827 - 0.009ms returns 0x00000008 +T42A8 000:571.836 JLINK_Go() +T42A8 000:571.851 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:577.805 - 5.969ms +T42A8 000:577.818 JLINK_IsHalted() +T42A8 000:583.808 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:584.285 - 6.466ms returns TRUE +T42A8 000:584.297 JLINK_ReadReg(R15 (PC)) +T42A8 000:584.304 - 0.006ms returns 0x20003000 +T42A8 000:584.310 JLINK_ClrBPEx(BPHandle = 0x00000008) +T42A8 000:584.316 - 0.005ms returns 0x00 +T42A8 000:584.322 JLINK_ReadReg(R0) +T42A8 000:584.327 - 0.005ms returns 0x00000001 +T42A8 000:584.334 JLINK_HasError() +T42A8 000:584.404 JLINK_WriteReg(R0, 0x18007000) +T42A8 000:584.416 - 0.012ms returns 0 +T42A8 000:584.423 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:584.428 - 0.005ms returns 0 +T42A8 000:584.434 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:584.439 - 0.004ms returns 0 +T42A8 000:584.445 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:584.449 - 0.004ms returns 0 +T42A8 000:584.455 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:584.460 - 0.004ms returns 0 +T42A8 000:584.466 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:584.471 - 0.005ms returns 0 +T42A8 000:584.477 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:584.482 - 0.004ms returns 0 +T42A8 000:584.488 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:584.493 - 0.005ms returns 0 +T42A8 000:584.499 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:584.504 - 0.004ms returns 0 +T42A8 000:584.510 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:584.514 - 0.004ms returns 0 +T42A8 000:584.520 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:584.525 - 0.005ms returns 0 +T42A8 000:584.531 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:584.536 - 0.005ms returns 0 +T42A8 000:584.542 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:584.547 - 0.005ms returns 0 +T42A8 000:584.554 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:584.559 - 0.005ms returns 0 +T42A8 000:584.565 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:584.570 - 0.005ms returns 0 +T42A8 000:584.576 JLINK_WriteReg(R15 (PC), 0x200032CA) +T42A8 000:584.581 - 0.005ms returns 0 +T42A8 000:584.587 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:584.592 - 0.005ms returns 0 +T42A8 000:584.598 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:584.603 - 0.005ms returns 0 +T42A8 000:584.609 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:584.614 - 0.004ms returns 0 +T42A8 000:584.620 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:584.625 - 0.005ms returns 0 +T42A8 000:584.682 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:584.691 - 0.008ms returns 0x00000009 +T42A8 000:584.697 JLINK_Go() +T42A8 000:584.706 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:590.793 - 6.095ms +T42A8 000:590.804 JLINK_IsHalted() +T42A8 000:591.411 - 0.606ms returns FALSE +T42A8 000:591.422 JLINK_HasError() +T42A8 000:596.913 JLINK_IsHalted() +T42A8 000:597.739 - 0.825ms returns FALSE +T42A8 000:597.762 JLINK_HasError() +T42A8 000:600.781 JLINK_IsHalted() +T42A8 000:606.784 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:607.376 - 6.594ms returns TRUE +T42A8 000:607.393 JLINK_ReadReg(R15 (PC)) +T42A8 000:607.415 - 0.021ms returns 0x20003000 +T42A8 000:607.424 JLINK_ClrBPEx(BPHandle = 0x00000009) +T42A8 000:607.429 - 0.005ms returns 0x00 +T42A8 000:607.436 JLINK_ReadReg(R0) +T42A8 000:607.441 - 0.005ms returns 0x00000000 +T42A8 000:607.917 JLINK_HasError() +T42A8 000:607.927 JLINK_WriteReg(R0, 0x18008000) +T42A8 000:607.933 - 0.006ms returns 0 +T42A8 000:607.939 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:607.944 - 0.005ms returns 0 +T42A8 000:607.950 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:607.955 - 0.004ms returns 0 +T42A8 000:607.960 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:607.965 - 0.004ms returns 0 +T42A8 000:607.971 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:607.975 - 0.004ms returns 0 +T42A8 000:607.981 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:607.986 - 0.004ms returns 0 +T42A8 000:607.992 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:607.996 - 0.004ms returns 0 +T42A8 000:608.002 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:608.007 - 0.004ms returns 0 +T42A8 000:608.012 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:608.017 - 0.004ms returns 0 +T42A8 000:608.023 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:608.027 - 0.004ms returns 0 +T42A8 000:608.033 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:608.038 - 0.004ms returns 0 +T42A8 000:608.043 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:608.048 - 0.004ms returns 0 +T42A8 000:608.054 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:608.058 - 0.004ms returns 0 +T42A8 000:608.064 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:608.069 - 0.005ms returns 0 +T42A8 000:608.075 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:608.080 - 0.004ms returns 0 +T42A8 000:608.085 JLINK_WriteReg(R15 (PC), 0x20003020) +T42A8 000:608.090 - 0.004ms returns 0 +T42A8 000:608.096 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:608.100 - 0.004ms returns 0 +T42A8 000:608.106 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:608.111 - 0.004ms returns 0 +T42A8 000:608.117 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:608.121 - 0.004ms returns 0 +T42A8 000:608.127 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:608.132 - 0.004ms returns 0 +T42A8 000:608.138 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:608.144 - 0.006ms returns 0x0000000A +T42A8 000:608.150 JLINK_Go() +T42A8 000:608.159 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:613.962 - 5.811ms +T42A8 000:613.974 JLINK_IsHalted() +T42A8 000:620.005 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:620.773 - 6.797ms returns TRUE +T42A8 000:620.819 JLINK_ReadReg(R15 (PC)) +T42A8 000:620.829 - 0.009ms returns 0x20003000 +T42A8 000:620.956 JLINK_ClrBPEx(BPHandle = 0x0000000A) +T42A8 000:620.969 - 0.013ms returns 0x00 +T42A8 000:620.976 JLINK_ReadReg(R0) +T42A8 000:620.982 - 0.005ms returns 0x00000001 +T42A8 000:620.989 JLINK_HasError() +T42A8 000:620.996 JLINK_WriteReg(R0, 0x18008000) +T42A8 000:621.002 - 0.005ms returns 0 +T42A8 000:621.008 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:621.013 - 0.005ms returns 0 +T42A8 000:621.019 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:621.024 - 0.004ms returns 0 +T42A8 000:621.029 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:621.034 - 0.004ms returns 0 +T42A8 000:621.040 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:621.044 - 0.004ms returns 0 +T42A8 000:621.050 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:621.055 - 0.004ms returns 0 +T42A8 000:621.061 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:621.065 - 0.004ms returns 0 +T42A8 000:621.071 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:621.076 - 0.004ms returns 0 +T42A8 000:621.086 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:621.093 - 0.007ms returns 0 +T42A8 000:621.099 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:621.104 - 0.004ms returns 0 +T42A8 000:621.110 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:621.115 - 0.005ms returns 0 +T42A8 000:621.121 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:621.126 - 0.005ms returns 0 +T42A8 000:621.132 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:621.137 - 0.004ms returns 0 +T42A8 000:621.143 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:621.149 - 0.005ms returns 0 +T42A8 000:621.155 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:621.159 - 0.004ms returns 0 +T42A8 000:621.165 JLINK_WriteReg(R15 (PC), 0x200032CA) +T42A8 000:621.170 - 0.005ms returns 0 +T42A8 000:621.176 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:621.181 - 0.005ms returns 0 +T42A8 000:621.187 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:621.192 - 0.004ms returns 0 +T42A8 000:621.198 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:621.202 - 0.004ms returns 0 +T42A8 000:621.208 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:621.214 - 0.005ms returns 0 +T42A8 000:621.221 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:621.226 - 0.006ms returns 0x0000000B +T42A8 000:621.232 JLINK_Go() +T42A8 000:621.244 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:627.811 - 6.577ms +T42A8 000:627.849 JLINK_IsHalted() +T42A8 000:628.472 - 0.622ms returns FALSE +T42A8 000:628.494 JLINK_HasError() +T42A8 000:631.860 JLINK_IsHalted() +T42A8 000:632.469 - 0.606ms returns FALSE +T42A8 000:632.511 JLINK_HasError() +T42A8 000:633.929 JLINK_IsHalted() +T42A8 000:634.588 - 0.658ms returns FALSE +T42A8 000:634.599 JLINK_HasError() +T42A8 000:635.842 JLINK_IsHalted() +T42A8 000:641.760 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:642.440 - 6.598ms returns TRUE +T42A8 000:642.457 JLINK_ReadReg(R15 (PC)) +T42A8 000:642.465 - 0.007ms returns 0x20003000 +T42A8 000:642.471 JLINK_ClrBPEx(BPHandle = 0x0000000B) +T42A8 000:642.477 - 0.005ms returns 0x00 +T42A8 000:642.483 JLINK_ReadReg(R0) +T42A8 000:642.488 - 0.005ms returns 0x00000000 +T42A8 000:642.921 JLINK_HasError() +T42A8 000:642.932 JLINK_WriteReg(R0, 0x18009000) +T42A8 000:642.939 - 0.006ms returns 0 +T42A8 000:642.945 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:642.950 - 0.005ms returns 0 +T42A8 000:642.956 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:642.961 - 0.004ms returns 0 +T42A8 000:642.967 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:642.972 - 0.004ms returns 0 +T42A8 000:642.978 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:642.982 - 0.004ms returns 0 +T42A8 000:642.988 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:642.993 - 0.004ms returns 0 +T42A8 000:642.999 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:643.004 - 0.004ms returns 0 +T42A8 000:643.009 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:643.014 - 0.004ms returns 0 +T42A8 000:643.021 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:643.025 - 0.005ms returns 0 +T42A8 000:643.031 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:643.036 - 0.005ms returns 0 +T42A8 000:643.043 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:643.047 - 0.004ms returns 0 +T42A8 000:643.053 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:643.058 - 0.004ms returns 0 +T42A8 000:643.064 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:643.069 - 0.004ms returns 0 +T42A8 000:643.075 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:643.080 - 0.005ms returns 0 +T42A8 000:643.086 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:643.090 - 0.004ms returns 0 +T42A8 000:643.096 JLINK_WriteReg(R15 (PC), 0x20003020) +T42A8 000:643.101 - 0.004ms returns 0 +T42A8 000:643.107 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:643.112 - 0.004ms returns 0 +T42A8 000:643.118 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:643.122 - 0.004ms returns 0 +T42A8 000:643.128 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:643.133 - 0.004ms returns 0 +T42A8 000:643.139 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:643.144 - 0.004ms returns 0 +T42A8 000:643.150 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:643.156 - 0.005ms returns 0x0000000C +T42A8 000:643.162 JLINK_Go() +T42A8 000:643.172 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:649.345 - 6.180ms +T42A8 000:649.396 JLINK_IsHalted() +T42A8 000:655.303 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:656.061 - 6.661ms returns TRUE +T42A8 000:656.117 JLINK_ReadReg(R15 (PC)) +T42A8 000:656.147 - 0.029ms returns 0x20003000 +T42A8 000:656.330 JLINK_ClrBPEx(BPHandle = 0x0000000C) +T42A8 000:656.375 - 0.044ms returns 0x00 +T42A8 000:656.406 JLINK_ReadReg(R0) +T42A8 000:656.432 - 0.025ms returns 0x00000001 +T42A8 000:656.461 JLINK_HasError() +T42A8 000:656.491 JLINK_WriteReg(R0, 0x18009000) +T42A8 000:656.515 - 0.024ms returns 0 +T42A8 000:656.542 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:656.564 - 0.021ms returns 0 +T42A8 000:656.590 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:656.612 - 0.021ms returns 0 +T42A8 000:656.638 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:656.659 - 0.021ms returns 0 +T42A8 000:656.685 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:656.708 - 0.022ms returns 0 +T42A8 000:656.735 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:656.757 - 0.022ms returns 0 +T42A8 000:656.784 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:656.812 - 0.028ms returns 0 +T42A8 000:656.840 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:656.862 - 0.022ms returns 0 +T42A8 000:656.888 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:656.910 - 0.021ms returns 0 +T42A8 000:656.936 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:656.957 - 0.021ms returns 0 +T42A8 000:656.983 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:657.006 - 0.022ms returns 0 +T42A8 000:657.033 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:657.055 - 0.022ms returns 0 +T42A8 000:657.082 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:657.104 - 0.022ms returns 0 +T42A8 000:657.131 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:657.154 - 0.023ms returns 0 +T42A8 000:657.181 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:657.203 - 0.022ms returns 0 +T42A8 000:657.231 JLINK_WriteReg(R15 (PC), 0x200032CA) +T42A8 000:657.253 - 0.022ms returns 0 +T42A8 000:657.280 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:657.301 - 0.022ms returns 0 +T42A8 000:657.329 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:657.350 - 0.022ms returns 0 +T42A8 000:657.384 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:657.408 - 0.024ms returns 0 +T42A8 000:657.435 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:657.457 - 0.021ms returns 0 +T42A8 000:657.485 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:657.509 - 0.025ms returns 0x0000000D +T42A8 000:657.535 JLINK_Go() +T42A8 000:657.574 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:664.031 - 6.493ms +T42A8 000:664.095 JLINK_IsHalted() +T42A8 000:665.004 - 0.906ms returns FALSE +T42A8 000:665.067 JLINK_HasError() +T42A8 000:690.875 JLINK_IsHalted() +T42A8 000:697.150 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:697.789 - 6.913ms returns TRUE +T42A8 000:697.804 JLINK_ReadReg(R15 (PC)) +T42A8 000:697.813 - 0.008ms returns 0x20003000 +T42A8 000:697.820 JLINK_ClrBPEx(BPHandle = 0x0000000D) +T42A8 000:697.828 - 0.008ms returns 0x00 +T42A8 000:697.836 JLINK_ReadReg(R0) +T42A8 000:697.842 - 0.005ms returns 0x00000000 +T42A8 000:698.325 JLINK_HasError() +T42A8 000:698.341 JLINK_WriteReg(R0, 0x1800A000) +T42A8 000:698.349 - 0.007ms returns 0 +T42A8 000:698.355 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:698.360 - 0.005ms returns 0 +T42A8 000:698.366 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:698.371 - 0.004ms returns 0 +T42A8 000:698.377 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:698.382 - 0.004ms returns 0 +T42A8 000:698.388 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:698.392 - 0.004ms returns 0 +T42A8 000:698.398 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:698.403 - 0.004ms returns 0 +T42A8 000:698.409 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:698.414 - 0.004ms returns 0 +T42A8 000:698.420 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:698.424 - 0.004ms returns 0 +T42A8 000:698.431 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:698.435 - 0.004ms returns 0 +T42A8 000:698.441 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:698.446 - 0.004ms returns 0 +T42A8 000:698.452 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:698.457 - 0.004ms returns 0 +T42A8 000:698.463 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:698.472 - 0.008ms returns 0 +T42A8 000:698.480 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:698.485 - 0.004ms returns 0 +T42A8 000:698.491 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:698.496 - 0.005ms returns 0 +T42A8 000:698.502 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:698.507 - 0.004ms returns 0 +T42A8 000:698.513 JLINK_WriteReg(R15 (PC), 0x20003020) +T42A8 000:698.518 - 0.004ms returns 0 +T42A8 000:698.524 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:698.529 - 0.005ms returns 0 +T42A8 000:698.534 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:698.539 - 0.004ms returns 0 +T42A8 000:698.545 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:698.550 - 0.004ms returns 0 +T42A8 000:698.556 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:698.561 - 0.004ms returns 0 +T42A8 000:698.568 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:698.573 - 0.006ms returns 0x0000000E +T42A8 000:698.579 JLINK_Go() +T42A8 000:698.592 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:704.807 - 6.227ms +T42A8 000:704.829 JLINK_IsHalted() +T42A8 000:710.874 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:711.396 - 6.566ms returns TRUE +T42A8 000:711.410 JLINK_ReadReg(R15 (PC)) +T42A8 000:711.417 - 0.007ms returns 0x20003000 +T42A8 000:711.424 JLINK_ClrBPEx(BPHandle = 0x0000000E) +T42A8 000:711.430 - 0.005ms returns 0x00 +T42A8 000:711.436 JLINK_ReadReg(R0) +T42A8 000:711.441 - 0.005ms returns 0x00000001 +T42A8 000:711.504 JLINK_HasError() +T42A8 000:711.514 JLINK_WriteReg(R0, 0x1800A000) +T42A8 000:711.520 - 0.006ms returns 0 +T42A8 000:711.526 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:711.531 - 0.005ms returns 0 +T42A8 000:711.537 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:711.542 - 0.005ms returns 0 +T42A8 000:711.549 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:711.554 - 0.005ms returns 0 +T42A8 000:711.560 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:711.564 - 0.004ms returns 0 +T42A8 000:711.570 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:711.575 - 0.004ms returns 0 +T42A8 000:711.581 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:711.585 - 0.004ms returns 0 +T42A8 000:711.591 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:711.596 - 0.004ms returns 0 +T42A8 000:711.602 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:711.607 - 0.004ms returns 0 +T42A8 000:711.613 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:711.617 - 0.004ms returns 0 +T42A8 000:711.623 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:711.628 - 0.005ms returns 0 +T42A8 000:711.634 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:711.639 - 0.005ms returns 0 +T42A8 000:711.646 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:711.650 - 0.005ms returns 0 +T42A8 000:711.657 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:711.662 - 0.005ms returns 0 +T42A8 000:711.668 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:711.673 - 0.004ms returns 0 +T42A8 000:711.679 JLINK_WriteReg(R15 (PC), 0x200032CA) +T42A8 000:711.684 - 0.005ms returns 0 +T42A8 000:711.691 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:711.696 - 0.005ms returns 0 +T42A8 000:711.702 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:711.707 - 0.005ms returns 0 +T42A8 000:711.713 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:711.718 - 0.004ms returns 0 +T42A8 000:711.724 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:711.729 - 0.005ms returns 0 +T42A8 000:711.735 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:711.741 - 0.005ms returns 0x0000000F +T42A8 000:711.747 JLINK_Go() +T42A8 000:711.756 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:717.626 - 5.879ms +T42A8 000:717.637 JLINK_IsHalted() +T42A8 000:718.305 - 0.667ms returns FALSE +T42A8 000:718.315 JLINK_HasError() +T42A8 000:721.807 JLINK_IsHalted() +T42A8 000:722.521 - 0.714ms returns FALSE +T42A8 000:722.531 JLINK_HasError() +T42A8 000:723.831 JLINK_IsHalted() +T42A8 000:724.405 - 0.575ms returns FALSE +T42A8 000:724.415 JLINK_HasError() +T42A8 000:726.794 JLINK_IsHalted() +T42A8 000:733.008 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:733.780 - 6.985ms returns TRUE +T42A8 000:733.827 JLINK_ReadReg(R15 (PC)) +T42A8 000:733.837 - 0.010ms returns 0x20003000 +T42A8 000:733.857 JLINK_ClrBPEx(BPHandle = 0x0000000F) +T42A8 000:733.871 - 0.013ms returns 0x00 +T42A8 000:733.877 JLINK_ReadReg(R0) +T42A8 000:733.882 - 0.004ms returns 0x00000000 +T42A8 000:734.327 JLINK_HasError() +T42A8 000:734.343 JLINK_WriteReg(R0, 0x1800B000) +T42A8 000:734.350 - 0.007ms returns 0 +T42A8 000:734.357 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:734.362 - 0.004ms returns 0 +T42A8 000:734.367 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:734.372 - 0.004ms returns 0 +T42A8 000:734.378 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:734.383 - 0.004ms returns 0 +T42A8 000:734.388 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:734.393 - 0.004ms returns 0 +T42A8 000:734.399 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:734.403 - 0.004ms returns 0 +T42A8 000:734.409 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:734.414 - 0.004ms returns 0 +T42A8 000:734.419 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:734.424 - 0.004ms returns 0 +T42A8 000:734.430 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:734.435 - 0.004ms returns 0 +T42A8 000:734.440 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:734.445 - 0.004ms returns 0 +T42A8 000:734.451 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:734.455 - 0.004ms returns 0 +T42A8 000:734.461 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:734.466 - 0.004ms returns 0 +T42A8 000:734.472 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:734.476 - 0.004ms returns 0 +T42A8 000:734.482 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:734.487 - 0.005ms returns 0 +T42A8 000:734.493 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:734.498 - 0.004ms returns 0 +T42A8 000:734.503 JLINK_WriteReg(R15 (PC), 0x20003020) +T42A8 000:734.508 - 0.004ms returns 0 +T42A8 000:734.516 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:734.521 - 0.005ms returns 0 +T42A8 000:734.526 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:734.531 - 0.004ms returns 0 +T42A8 000:734.537 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:734.541 - 0.004ms returns 0 +T42A8 000:734.547 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:734.552 - 0.005ms returns 0 +T42A8 000:734.559 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:734.566 - 0.007ms returns 0x00000010 +T42A8 000:734.572 JLINK_Go() +T42A8 000:734.584 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:741.058 - 6.483ms +T42A8 000:741.113 JLINK_IsHalted() +T42A8 000:747.230 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:748.073 - 6.958ms returns TRUE +T42A8 000:748.112 JLINK_ReadReg(R15 (PC)) +T42A8 000:748.122 - 0.010ms returns 0x20003000 +T42A8 000:748.130 JLINK_ClrBPEx(BPHandle = 0x00000010) +T42A8 000:748.136 - 0.006ms returns 0x00 +T42A8 000:748.145 JLINK_ReadReg(R0) +T42A8 000:748.151 - 0.005ms returns 0x00000001 +T42A8 000:748.159 JLINK_HasError() +T42A8 000:748.274 JLINK_WriteReg(R0, 0x1800B000) +T42A8 000:748.294 - 0.020ms returns 0 +T42A8 000:748.302 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:748.308 - 0.005ms returns 0 +T42A8 000:748.315 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:748.320 - 0.005ms returns 0 +T42A8 000:748.326 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:748.331 - 0.005ms returns 0 +T42A8 000:748.338 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:748.342 - 0.005ms returns 0 +T42A8 000:748.349 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:748.353 - 0.004ms returns 0 +T42A8 000:748.359 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:748.364 - 0.004ms returns 0 +T42A8 000:748.370 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:748.375 - 0.005ms returns 0 +T42A8 000:748.382 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:748.387 - 0.005ms returns 0 +T42A8 000:748.393 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:748.398 - 0.004ms returns 0 +T42A8 000:748.404 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:748.409 - 0.005ms returns 0 +T42A8 000:748.415 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:748.419 - 0.004ms returns 0 +T42A8 000:748.425 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:748.430 - 0.004ms returns 0 +T42A8 000:748.436 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:748.442 - 0.005ms returns 0 +T42A8 000:748.448 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:748.453 - 0.005ms returns 0 +T42A8 000:748.459 JLINK_WriteReg(R15 (PC), 0x200032CA) +T42A8 000:748.464 - 0.005ms returns 0 +T42A8 000:748.476 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:748.481 - 0.005ms returns 0 +T42A8 000:748.487 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:748.492 - 0.004ms returns 0 +T42A8 000:748.498 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:748.503 - 0.005ms returns 0 +T42A8 000:748.509 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:748.514 - 0.005ms returns 0 +T42A8 000:748.521 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:748.528 - 0.006ms returns 0x00000011 +T42A8 000:748.534 JLINK_Go() +T42A8 000:748.547 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:754.382 - 5.847ms +T42A8 000:754.406 JLINK_IsHalted() +T42A8 000:754.953 - 0.546ms returns FALSE +T42A8 000:754.967 JLINK_HasError() +T42A8 000:764.132 JLINK_IsHalted() +T42A8 000:770.204 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:770.748 - 6.616ms returns TRUE +T42A8 000:770.760 JLINK_ReadReg(R15 (PC)) +T42A8 000:770.768 - 0.007ms returns 0x20003000 +T42A8 000:770.775 JLINK_ClrBPEx(BPHandle = 0x00000011) +T42A8 000:770.781 - 0.005ms returns 0x00 +T42A8 000:770.787 JLINK_ReadReg(R0) +T42A8 000:770.793 - 0.005ms returns 0x00000000 +T42A8 000:771.229 JLINK_HasError() +T42A8 000:771.240 JLINK_WriteReg(R0, 0x1800C000) +T42A8 000:771.246 - 0.006ms returns 0 +T42A8 000:771.253 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:771.258 - 0.005ms returns 0 +T42A8 000:771.264 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:771.269 - 0.004ms returns 0 +T42A8 000:771.275 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:771.279 - 0.004ms returns 0 +T42A8 000:771.285 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:771.290 - 0.004ms returns 0 +T42A8 000:771.296 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:771.301 - 0.004ms returns 0 +T42A8 000:771.307 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:771.312 - 0.004ms returns 0 +T42A8 000:771.318 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:771.323 - 0.004ms returns 0 +T42A8 000:771.329 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:771.334 - 0.004ms returns 0 +T42A8 000:771.340 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:771.344 - 0.004ms returns 0 +T42A8 000:771.351 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:771.355 - 0.004ms returns 0 +T42A8 000:771.361 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:771.366 - 0.004ms returns 0 +T42A8 000:771.372 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:771.377 - 0.004ms returns 0 +T42A8 000:771.383 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:771.388 - 0.005ms returns 0 +T42A8 000:771.394 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:771.399 - 0.004ms returns 0 +T42A8 000:771.405 JLINK_WriteReg(R15 (PC), 0x20003020) +T42A8 000:771.410 - 0.005ms returns 0 +T42A8 000:771.416 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:771.421 - 0.005ms returns 0 +T42A8 000:771.427 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:771.432 - 0.004ms returns 0 +T42A8 000:771.438 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:771.443 - 0.004ms returns 0 +T42A8 000:771.449 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:771.454 - 0.004ms returns 0 +T42A8 000:771.461 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:771.467 - 0.006ms returns 0x00000012 +T42A8 000:771.473 JLINK_Go() +T42A8 000:771.482 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:777.404 - 5.930ms +T42A8 000:777.417 JLINK_IsHalted() +T42A8 000:783.179 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:783.691 - 6.273ms returns TRUE +T42A8 000:783.704 JLINK_ReadReg(R15 (PC)) +T42A8 000:783.711 - 0.006ms returns 0x20003000 +T42A8 000:783.717 JLINK_ClrBPEx(BPHandle = 0x00000012) +T42A8 000:783.723 - 0.005ms returns 0x00 +T42A8 000:783.729 JLINK_ReadReg(R0) +T42A8 000:783.734 - 0.004ms returns 0x00000001 +T42A8 000:783.740 JLINK_HasError() +T42A8 000:783.748 JLINK_WriteReg(R0, 0x1800C000) +T42A8 000:783.753 - 0.005ms returns 0 +T42A8 000:783.760 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:783.765 - 0.005ms returns 0 +T42A8 000:783.771 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:783.776 - 0.005ms returns 0 +T42A8 000:783.782 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:783.787 - 0.005ms returns 0 +T42A8 000:783.793 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:783.798 - 0.005ms returns 0 +T42A8 000:783.822 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:783.835 - 0.013ms returns 0 +T42A8 000:783.842 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:783.847 - 0.005ms returns 0 +T42A8 000:783.853 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:783.858 - 0.005ms returns 0 +T42A8 000:783.865 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:783.870 - 0.005ms returns 0 +T42A8 000:783.950 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:783.961 - 0.010ms returns 0 +T42A8 000:783.968 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:783.973 - 0.005ms returns 0 +T42A8 000:783.979 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:783.984 - 0.005ms returns 0 +T42A8 000:783.992 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:783.997 - 0.005ms returns 0 +T42A8 000:784.003 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:784.008 - 0.005ms returns 0 +T42A8 000:784.014 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:784.019 - 0.005ms returns 0 +T42A8 000:784.025 JLINK_WriteReg(R15 (PC), 0x200032CA) +T42A8 000:784.031 - 0.005ms returns 0 +T42A8 000:784.037 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:784.042 - 0.005ms returns 0 +T42A8 000:784.048 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:784.053 - 0.005ms returns 0 +T42A8 000:784.059 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:784.064 - 0.005ms returns 0 +T42A8 000:784.071 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:784.076 - 0.005ms returns 0 +T42A8 000:784.082 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:784.088 - 0.006ms returns 0x00000013 +T42A8 000:784.094 JLINK_Go() +T42A8 000:784.103 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:790.233 - 6.137ms +T42A8 000:790.255 JLINK_IsHalted() +T42A8 000:790.860 - 0.605ms returns FALSE +T42A8 000:790.874 JLINK_HasError() +T42A8 000:794.161 JLINK_IsHalted() +T42A8 000:794.848 - 0.686ms returns FALSE +T42A8 000:794.859 JLINK_HasError() +T42A8 000:796.077 JLINK_IsHalted() +T42A8 000:796.721 - 0.643ms returns FALSE +T42A8 000:796.732 JLINK_HasError() +T42A8 000:799.190 JLINK_IsHalted() +T42A8 000:805.196 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:805.848 - 6.657ms returns TRUE +T42A8 000:805.859 JLINK_ReadReg(R15 (PC)) +T42A8 000:805.867 - 0.007ms returns 0x20003000 +T42A8 000:805.873 JLINK_ClrBPEx(BPHandle = 0x00000013) +T42A8 000:805.879 - 0.005ms returns 0x00 +T42A8 000:805.885 JLINK_ReadReg(R0) +T42A8 000:805.890 - 0.005ms returns 0x00000000 +T42A8 000:806.293 JLINK_HasError() +T42A8 000:806.303 JLINK_WriteReg(R0, 0x1800D000) +T42A8 000:806.310 - 0.006ms returns 0 +T42A8 000:806.316 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:806.321 - 0.005ms returns 0 +T42A8 000:806.327 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:806.332 - 0.004ms returns 0 +T42A8 000:806.338 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:806.342 - 0.004ms returns 0 +T42A8 000:806.348 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:806.353 - 0.004ms returns 0 +T42A8 000:806.359 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:806.364 - 0.004ms returns 0 +T42A8 000:806.370 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:806.375 - 0.004ms returns 0 +T42A8 000:806.380 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:806.385 - 0.004ms returns 0 +T42A8 000:806.391 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:806.396 - 0.004ms returns 0 +T42A8 000:806.402 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:806.407 - 0.004ms returns 0 +T42A8 000:806.412 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:806.417 - 0.004ms returns 0 +T42A8 000:806.423 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:806.428 - 0.004ms returns 0 +T42A8 000:806.434 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:806.438 - 0.004ms returns 0 +T42A8 000:806.444 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:806.449 - 0.005ms returns 0 +T42A8 000:806.455 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:806.460 - 0.004ms returns 0 +T42A8 000:806.466 JLINK_WriteReg(R15 (PC), 0x20003020) +T42A8 000:806.471 - 0.004ms returns 0 +T42A8 000:806.477 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:806.482 - 0.004ms returns 0 +T42A8 000:806.487 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:806.492 - 0.004ms returns 0 +T42A8 000:806.498 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:806.503 - 0.004ms returns 0 +T42A8 000:806.509 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:806.518 - 0.009ms returns 0 +T42A8 000:806.525 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:806.530 - 0.005ms returns 0x00000014 +T42A8 000:806.536 JLINK_Go() +T42A8 000:806.546 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:812.536 - 6.000ms +T42A8 000:812.550 JLINK_IsHalted() +T42A8 000:818.453 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:819.168 - 6.616ms returns TRUE +T42A8 000:819.197 JLINK_ReadReg(R15 (PC)) +T42A8 000:819.207 - 0.009ms returns 0x20003000 +T42A8 000:819.214 JLINK_ClrBPEx(BPHandle = 0x00000014) +T42A8 000:819.220 - 0.006ms returns 0x00 +T42A8 000:819.227 JLINK_ReadReg(R0) +T42A8 000:819.233 - 0.005ms returns 0x00000001 +T42A8 000:819.241 JLINK_HasError() +T42A8 000:819.317 JLINK_WriteReg(R0, 0x1800D000) +T42A8 000:819.330 - 0.013ms returns 0 +T42A8 000:819.338 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:819.343 - 0.005ms returns 0 +T42A8 000:819.350 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:819.355 - 0.005ms returns 0 +T42A8 000:819.361 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:819.366 - 0.005ms returns 0 +T42A8 000:819.372 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:819.377 - 0.005ms returns 0 +T42A8 000:819.384 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:819.389 - 0.005ms returns 0 +T42A8 000:819.395 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:819.400 - 0.005ms returns 0 +T42A8 000:819.406 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:819.411 - 0.005ms returns 0 +T42A8 000:819.417 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:819.422 - 0.005ms returns 0 +T42A8 000:819.429 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:819.434 - 0.005ms returns 0 +T42A8 000:819.440 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:819.446 - 0.005ms returns 0 +T42A8 000:819.452 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:819.457 - 0.005ms returns 0 +T42A8 000:819.463 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:819.469 - 0.005ms returns 0 +T42A8 000:819.475 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:819.481 - 0.005ms returns 0 +T42A8 000:819.487 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:819.493 - 0.005ms returns 0 +T42A8 000:819.499 JLINK_WriteReg(R15 (PC), 0x200032CA) +T42A8 000:819.504 - 0.005ms returns 0 +T42A8 000:819.511 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:819.516 - 0.005ms returns 0 +T42A8 000:819.523 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:819.528 - 0.005ms returns 0 +T42A8 000:819.534 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:819.539 - 0.005ms returns 0 +T42A8 000:819.546 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:819.551 - 0.005ms returns 0 +T42A8 000:819.558 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:819.564 - 0.007ms returns 0x00000015 +T42A8 000:819.571 JLINK_Go() +T42A8 000:819.583 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:825.628 - 6.056ms +T42A8 000:825.650 JLINK_IsHalted() +T42A8 000:826.297 - 0.647ms returns FALSE +T42A8 000:826.311 JLINK_HasError() +T42A8 000:831.162 JLINK_IsHalted() +T42A8 000:831.805 - 0.642ms returns FALSE +T42A8 000:831.815 JLINK_HasError() +T42A8 000:833.103 JLINK_IsHalted() +T42A8 000:833.766 - 0.678ms returns FALSE +T42A8 000:833.778 JLINK_HasError() +T42A8 000:835.078 JLINK_IsHalted() +T42A8 000:841.053 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:841.812 - 6.734ms returns TRUE +T42A8 000:841.836 JLINK_ReadReg(R15 (PC)) +T42A8 000:841.845 - 0.008ms returns 0x20003000 +T42A8 000:841.852 JLINK_ClrBPEx(BPHandle = 0x00000015) +T42A8 000:841.857 - 0.005ms returns 0x00 +T42A8 000:841.863 JLINK_ReadReg(R0) +T42A8 000:841.869 - 0.005ms returns 0x00000000 +T42A8 000:842.422 JLINK_HasError() +T42A8 000:842.439 JLINK_WriteReg(R0, 0x1800E000) +T42A8 000:842.447 - 0.007ms returns 0 +T42A8 000:842.453 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:842.458 - 0.004ms returns 0 +T42A8 000:842.463 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:842.468 - 0.004ms returns 0 +T42A8 000:842.474 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:842.479 - 0.004ms returns 0 +T42A8 000:842.484 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:842.489 - 0.004ms returns 0 +T42A8 000:842.495 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:842.499 - 0.004ms returns 0 +T42A8 000:842.547 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:842.553 - 0.005ms returns 0 +T42A8 000:842.561 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:842.566 - 0.004ms returns 0 +T42A8 000:842.572 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:842.576 - 0.004ms returns 0 +T42A8 000:842.582 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:842.587 - 0.004ms returns 0 +T42A8 000:842.593 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:842.598 - 0.005ms returns 0 +T42A8 000:842.604 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:842.609 - 0.004ms returns 0 +T42A8 000:842.615 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:842.619 - 0.004ms returns 0 +T42A8 000:842.625 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:842.631 - 0.005ms returns 0 +T42A8 000:842.637 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:842.641 - 0.004ms returns 0 +T42A8 000:842.647 JLINK_WriteReg(R15 (PC), 0x20003020) +T42A8 000:842.652 - 0.004ms returns 0 +T42A8 000:842.658 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:842.662 - 0.004ms returns 0 +T42A8 000:842.668 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:842.673 - 0.004ms returns 0 +T42A8 000:842.679 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:842.683 - 0.004ms returns 0 +T42A8 000:842.689 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:842.694 - 0.004ms returns 0 +T42A8 000:842.700 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:842.706 - 0.006ms returns 0x00000016 +T42A8 000:842.712 JLINK_Go() +T42A8 000:842.725 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:848.959 - 6.246ms +T42A8 000:848.984 JLINK_IsHalted() +T42A8 000:855.090 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:855.756 - 6.771ms returns TRUE +T42A8 000:855.775 JLINK_ReadReg(R15 (PC)) +T42A8 000:855.785 - 0.009ms returns 0x20003000 +T42A8 000:855.793 JLINK_ClrBPEx(BPHandle = 0x00000016) +T42A8 000:855.801 - 0.007ms returns 0x00 +T42A8 000:855.883 JLINK_ReadReg(R0) +T42A8 000:855.897 - 0.013ms returns 0x00000001 +T42A8 000:855.906 JLINK_HasError() +T42A8 000:855.915 JLINK_WriteReg(R0, 0x1800E000) +T42A8 000:855.922 - 0.007ms returns 0 +T42A8 000:855.930 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:855.936 - 0.006ms returns 0 +T42A8 000:855.944 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:855.950 - 0.006ms returns 0 +T42A8 000:855.957 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:855.963 - 0.006ms returns 0 +T42A8 000:855.970 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:855.976 - 0.006ms returns 0 +T42A8 000:855.984 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:855.992 - 0.008ms returns 0 +T42A8 000:856.000 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:856.006 - 0.006ms returns 0 +T42A8 000:856.013 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:856.020 - 0.006ms returns 0 +T42A8 000:856.027 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:856.034 - 0.006ms returns 0 +T42A8 000:856.041 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:856.048 - 0.006ms returns 0 +T42A8 000:856.056 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:856.062 - 0.006ms returns 0 +T42A8 000:856.070 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:856.077 - 0.006ms returns 0 +T42A8 000:856.084 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:856.091 - 0.006ms returns 0 +T42A8 000:856.099 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:856.106 - 0.006ms returns 0 +T42A8 000:856.114 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:856.121 - 0.006ms returns 0 +T42A8 000:856.129 JLINK_WriteReg(R15 (PC), 0x200032CA) +T42A8 000:856.136 - 0.006ms returns 0 +T42A8 000:856.144 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:856.151 - 0.007ms returns 0 +T42A8 000:856.158 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:856.164 - 0.006ms returns 0 +T42A8 000:856.172 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:856.178 - 0.006ms returns 0 +T42A8 000:856.186 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:856.193 - 0.007ms returns 0 +T42A8 000:856.202 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:856.209 - 0.007ms returns 0x00000017 +T42A8 000:856.217 JLINK_Go() +T42A8 000:856.232 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:862.457 - 6.239ms +T42A8 000:862.480 JLINK_IsHalted() +T42A8 000:863.066 - 0.585ms returns FALSE +T42A8 000:863.077 JLINK_HasError() +T42A8 000:872.093 JLINK_IsHalted() +T42A8 000:878.094 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:878.685 - 6.592ms returns TRUE +T42A8 000:878.696 JLINK_ReadReg(R15 (PC)) +T42A8 000:878.703 - 0.007ms returns 0x20003000 +T42A8 000:878.710 JLINK_ClrBPEx(BPHandle = 0x00000017) +T42A8 000:878.715 - 0.005ms returns 0x00 +T42A8 000:878.721 JLINK_ReadReg(R0) +T42A8 000:878.727 - 0.005ms returns 0x00000000 +T42A8 000:879.118 JLINK_HasError() +T42A8 000:879.128 JLINK_WriteReg(R0, 0x1800F000) +T42A8 000:879.134 - 0.006ms returns 0 +T42A8 000:879.140 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:879.144 - 0.004ms returns 0 +T42A8 000:879.150 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:879.155 - 0.004ms returns 0 +T42A8 000:879.161 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:879.165 - 0.004ms returns 0 +T42A8 000:879.171 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:879.176 - 0.004ms returns 0 +T42A8 000:879.181 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:879.186 - 0.004ms returns 0 +T42A8 000:879.192 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:879.196 - 0.004ms returns 0 +T42A8 000:879.202 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:879.207 - 0.004ms returns 0 +T42A8 000:879.213 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:879.217 - 0.004ms returns 0 +T42A8 000:879.223 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:879.228 - 0.004ms returns 0 +T42A8 000:879.234 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:879.238 - 0.004ms returns 0 +T42A8 000:879.244 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:879.248 - 0.004ms returns 0 +T42A8 000:879.254 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:879.259 - 0.004ms returns 0 +T42A8 000:879.265 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:879.270 - 0.005ms returns 0 +T42A8 000:879.276 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:879.280 - 0.004ms returns 0 +T42A8 000:879.286 JLINK_WriteReg(R15 (PC), 0x20003020) +T42A8 000:879.291 - 0.004ms returns 0 +T42A8 000:879.297 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:879.301 - 0.004ms returns 0 +T42A8 000:879.307 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:879.311 - 0.004ms returns 0 +T42A8 000:879.317 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:879.322 - 0.004ms returns 0 +T42A8 000:879.328 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:879.332 - 0.004ms returns 0 +T42A8 000:879.338 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:879.344 - 0.005ms returns 0x00000018 +T42A8 000:879.350 JLINK_Go() +T42A8 000:879.359 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:885.156 - 5.806ms +T42A8 000:885.170 JLINK_IsHalted() +T42A8 000:891.040 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:891.690 - 6.519ms returns TRUE +T42A8 000:891.705 JLINK_ReadReg(R15 (PC)) +T42A8 000:891.712 - 0.007ms returns 0x20003000 +T42A8 000:891.719 JLINK_ClrBPEx(BPHandle = 0x00000018) +T42A8 000:891.724 - 0.005ms returns 0x00 +T42A8 000:891.730 JLINK_ReadReg(R0) +T42A8 000:891.735 - 0.004ms returns 0x00000001 +T42A8 000:891.742 JLINK_HasError() +T42A8 000:891.811 JLINK_WriteReg(R0, 0x1800F000) +T42A8 000:891.821 - 0.010ms returns 0 +T42A8 000:891.828 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:891.833 - 0.005ms returns 0 +T42A8 000:891.839 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:891.845 - 0.005ms returns 0 +T42A8 000:891.852 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:891.858 - 0.005ms returns 0 +T42A8 000:891.864 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:891.869 - 0.004ms returns 0 +T42A8 000:891.899 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:891.907 - 0.006ms returns 0 +T42A8 000:891.918 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:891.929 - 0.010ms returns 0 +T42A8 000:891.936 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:891.941 - 0.005ms returns 0 +T42A8 000:891.960 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:891.964 - 0.004ms returns 0 +T42A8 000:891.970 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:891.975 - 0.004ms returns 0 +T42A8 000:891.981 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:891.985 - 0.004ms returns 0 +T42A8 000:891.991 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:891.996 - 0.004ms returns 0 +T42A8 000:892.001 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:892.024 - 0.022ms returns 0 +T42A8 000:892.083 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:892.091 - 0.008ms returns 0 +T42A8 000:892.097 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:892.102 - 0.004ms returns 0 +T42A8 000:892.107 JLINK_WriteReg(R15 (PC), 0x200032CA) +T42A8 000:892.112 - 0.004ms returns 0 +T42A8 000:892.118 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:892.123 - 0.004ms returns 0 +T42A8 000:892.128 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:892.133 - 0.004ms returns 0 +T42A8 000:892.139 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:892.144 - 0.004ms returns 0 +T42A8 000:892.149 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:892.154 - 0.004ms returns 0 +T42A8 000:892.161 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:892.169 - 0.008ms returns 0x00000019 +T42A8 000:892.175 JLINK_Go() +T42A8 000:892.193 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:898.427 - 6.250ms +T42A8 000:898.448 JLINK_IsHalted() +T42A8 000:899.007 - 0.558ms returns FALSE +T42A8 000:899.018 JLINK_HasError() +T42A8 000:903.007 JLINK_IsHalted() +T42A8 000:903.710 - 0.702ms returns FALSE +T42A8 000:903.720 JLINK_HasError() +T42A8 000:905.010 JLINK_IsHalted() +T42A8 000:905.705 - 0.695ms returns FALSE +T42A8 000:905.716 JLINK_HasError() +T42A8 000:906.889 JLINK_IsHalted() +T42A8 000:912.879 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:913.425 - 6.536ms returns TRUE +T42A8 000:913.436 JLINK_ReadReg(R15 (PC)) +T42A8 000:913.444 - 0.007ms returns 0x20003000 +T42A8 000:913.450 JLINK_ClrBPEx(BPHandle = 0x00000019) +T42A8 000:913.455 - 0.005ms returns 0x00 +T42A8 000:913.461 JLINK_ReadReg(R0) +T42A8 000:913.467 - 0.005ms returns 0x00000000 +T42A8 000:913.898 JLINK_HasError() +T42A8 000:913.908 JLINK_WriteReg(R0, 0x18010000) +T42A8 000:913.927 - 0.006ms returns 0 +T42A8 000:913.933 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:913.938 - 0.004ms returns 0 +T42A8 000:913.944 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:913.949 - 0.004ms returns 0 +T42A8 000:913.955 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:913.959 - 0.004ms returns 0 +T42A8 000:913.965 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:913.970 - 0.004ms returns 0 +T42A8 000:913.976 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:913.980 - 0.004ms returns 0 +T42A8 000:913.986 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:913.991 - 0.004ms returns 0 +T42A8 000:913.996 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:914.001 - 0.004ms returns 0 +T42A8 000:914.007 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:914.012 - 0.004ms returns 0 +T42A8 000:914.017 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:914.022 - 0.004ms returns 0 +T42A8 000:914.028 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:914.032 - 0.004ms returns 0 +T42A8 000:914.038 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:914.043 - 0.004ms returns 0 +T42A8 000:914.048 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:914.053 - 0.004ms returns 0 +T42A8 000:914.059 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:914.064 - 0.005ms returns 0 +T42A8 000:914.070 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:914.074 - 0.004ms returns 0 +T42A8 000:914.080 JLINK_WriteReg(R15 (PC), 0x20003020) +T42A8 000:914.085 - 0.004ms returns 0 +T42A8 000:914.090 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:914.095 - 0.004ms returns 0 +T42A8 000:914.101 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:914.105 - 0.004ms returns 0 +T42A8 000:914.111 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:914.116 - 0.004ms returns 0 +T42A8 000:914.122 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:914.126 - 0.004ms returns 0 +T42A8 000:914.133 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:914.138 - 0.005ms returns 0x0000001A +T42A8 000:914.144 JLINK_Go() +T42A8 000:914.153 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:919.975 - 5.830ms +T42A8 000:919.988 JLINK_IsHalted() +T42A8 000:926.145 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:926.987 - 6.995ms returns TRUE +T42A8 000:927.051 JLINK_ReadReg(R15 (PC)) +T42A8 000:927.083 - 0.031ms returns 0x20003000 +T42A8 000:927.306 JLINK_ClrBPEx(BPHandle = 0x0000001A) +T42A8 000:927.350 - 0.045ms returns 0x00 +T42A8 000:927.382 JLINK_ReadReg(R0) +T42A8 000:927.408 - 0.025ms returns 0x00000001 +T42A8 000:927.445 JLINK_HasError() +T42A8 000:927.480 JLINK_WriteReg(R0, 0x18010000) +T42A8 000:927.505 - 0.024ms returns 0 +T42A8 000:927.532 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:927.554 - 0.022ms returns 0 +T42A8 000:927.580 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:927.601 - 0.021ms returns 0 +T42A8 000:927.627 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:927.648 - 0.021ms returns 0 +T42A8 000:927.674 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:927.695 - 0.021ms returns 0 +T42A8 000:927.721 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:927.742 - 0.021ms returns 0 +T42A8 000:927.768 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:927.789 - 0.021ms returns 0 +T42A8 000:927.816 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:927.842 - 0.026ms returns 0 +T42A8 000:927.870 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:927.892 - 0.022ms returns 0 +T42A8 000:927.918 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:927.939 - 0.021ms returns 0 +T42A8 000:927.965 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:927.987 - 0.022ms returns 0 +T42A8 000:928.014 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:928.036 - 0.021ms returns 0 +T42A8 000:928.063 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:928.085 - 0.021ms returns 0 +T42A8 000:928.112 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:928.135 - 0.023ms returns 0 +T42A8 000:928.162 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:928.184 - 0.022ms returns 0 +T42A8 000:928.211 JLINK_WriteReg(R15 (PC), 0x200032CA) +T42A8 000:928.233 - 0.022ms returns 0 +T42A8 000:928.259 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:928.281 - 0.021ms returns 0 +T42A8 000:928.308 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:928.330 - 0.022ms returns 0 +T42A8 000:928.356 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:928.377 - 0.021ms returns 0 +T42A8 000:928.404 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:928.426 - 0.022ms returns 0 +T42A8 000:928.455 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:928.480 - 0.026ms returns 0x0000001B +T42A8 000:928.506 JLINK_Go() +T42A8 000:928.547 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:935.085 - 6.576ms +T42A8 000:935.150 JLINK_IsHalted() +T42A8 000:935.900 - 0.748ms returns FALSE +T42A8 000:935.955 JLINK_HasError() +T42A8 000:956.849 JLINK_IsHalted() +T42A8 000:962.907 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:963.446 - 6.597ms returns TRUE +T42A8 000:963.460 JLINK_ReadReg(R15 (PC)) +T42A8 000:963.467 - 0.007ms returns 0x20003000 +T42A8 000:963.473 JLINK_ClrBPEx(BPHandle = 0x0000001B) +T42A8 000:963.479 - 0.005ms returns 0x00 +T42A8 000:963.485 JLINK_ReadReg(R0) +T42A8 000:963.490 - 0.005ms returns 0x00000000 +T42A8 000:963.904 JLINK_HasError() +T42A8 000:963.914 JLINK_WriteReg(R0, 0x18011000) +T42A8 000:963.920 - 0.006ms returns 0 +T42A8 000:963.926 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:963.931 - 0.004ms returns 0 +T42A8 000:963.937 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:963.942 - 0.004ms returns 0 +T42A8 000:963.947 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:963.952 - 0.004ms returns 0 +T42A8 000:963.958 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:963.963 - 0.004ms returns 0 +T42A8 000:963.968 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:963.973 - 0.004ms returns 0 +T42A8 000:963.979 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:963.983 - 0.004ms returns 0 +T42A8 000:963.989 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:963.994 - 0.004ms returns 0 +T42A8 000:963.999 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:964.004 - 0.004ms returns 0 +T42A8 000:964.010 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:964.015 - 0.004ms returns 0 +T42A8 000:964.020 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:964.025 - 0.004ms returns 0 +T42A8 000:964.031 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:964.035 - 0.004ms returns 0 +T42A8 000:964.041 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:964.046 - 0.004ms returns 0 +T42A8 000:964.052 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:964.056 - 0.005ms returns 0 +T42A8 000:964.062 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:964.067 - 0.004ms returns 0 +T42A8 000:964.073 JLINK_WriteReg(R15 (PC), 0x20003020) +T42A8 000:964.077 - 0.004ms returns 0 +T42A8 000:964.083 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:964.093 - 0.009ms returns 0 +T42A8 000:964.099 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:964.103 - 0.004ms returns 0 +T42A8 000:964.109 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:964.114 - 0.004ms returns 0 +T42A8 000:964.120 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:964.125 - 0.005ms returns 0 +T42A8 000:964.131 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:964.136 - 0.005ms returns 0x0000001C +T42A8 000:964.142 JLINK_Go() +T42A8 000:964.152 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:970.252 - 6.109ms +T42A8 000:970.263 JLINK_IsHalted() +T42A8 000:976.228 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:976.854 - 6.590ms returns TRUE +T42A8 000:976.866 JLINK_ReadReg(R15 (PC)) +T42A8 000:976.873 - 0.006ms returns 0x20003000 +T42A8 000:976.879 JLINK_ClrBPEx(BPHandle = 0x0000001C) +T42A8 000:976.884 - 0.005ms returns 0x00 +T42A8 000:976.891 JLINK_ReadReg(R0) +T42A8 000:976.896 - 0.004ms returns 0x00000001 +T42A8 000:976.902 JLINK_HasError() +T42A8 000:976.908 JLINK_WriteReg(R0, 0x18011000) +T42A8 000:976.914 - 0.005ms returns 0 +T42A8 000:976.920 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:976.924 - 0.004ms returns 0 +T42A8 000:976.930 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:976.935 - 0.004ms returns 0 +T42A8 000:976.941 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:976.945 - 0.004ms returns 0 +T42A8 000:976.952 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:976.956 - 0.004ms returns 0 +T42A8 000:976.962 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:976.967 - 0.004ms returns 0 +T42A8 000:976.973 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:976.977 - 0.004ms returns 0 +T42A8 000:976.983 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:976.988 - 0.004ms returns 0 +T42A8 000:976.993 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:976.998 - 0.004ms returns 0 +T42A8 000:977.004 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:977.008 - 0.004ms returns 0 +T42A8 000:977.014 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:977.019 - 0.004ms returns 0 +T42A8 000:977.025 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:977.030 - 0.005ms returns 0 +T42A8 000:977.036 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:977.041 - 0.004ms returns 0 +T42A8 000:977.047 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:977.052 - 0.005ms returns 0 +T42A8 000:977.058 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:977.062 - 0.004ms returns 0 +T42A8 000:977.068 JLINK_WriteReg(R15 (PC), 0x200032CA) +T42A8 000:977.073 - 0.005ms returns 0 +T42A8 000:977.079 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:977.084 - 0.005ms returns 0 +T42A8 000:977.090 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:977.095 - 0.004ms returns 0 +T42A8 000:977.101 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:977.105 - 0.004ms returns 0 +T42A8 000:977.111 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:977.116 - 0.004ms returns 0 +T42A8 000:977.123 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:977.128 - 0.006ms returns 0x0000001D +T42A8 000:977.134 JLINK_Go() +T42A8 000:977.143 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 000:982.959 - 5.824ms +T42A8 000:982.972 JLINK_IsHalted() +T42A8 000:983.641 - 0.668ms returns FALSE +T42A8 000:983.659 JLINK_HasError() +T42A8 000:991.700 JLINK_IsHalted() +T42A8 000:997.873 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 000:998.661 - 6.960ms returns TRUE +T42A8 000:998.686 JLINK_ReadReg(R15 (PC)) +T42A8 000:998.694 - 0.008ms returns 0x20003000 +T42A8 000:998.700 JLINK_ClrBPEx(BPHandle = 0x0000001D) +T42A8 000:998.706 - 0.005ms returns 0x00 +T42A8 000:998.713 JLINK_ReadReg(R0) +T42A8 000:998.718 - 0.005ms returns 0x00000000 +T42A8 000:999.301 JLINK_HasError() +T42A8 000:999.325 JLINK_WriteReg(R0, 0x18012000) +T42A8 000:999.333 - 0.008ms returns 0 +T42A8 000:999.340 JLINK_WriteReg(R1, 0x00001000) +T42A8 000:999.345 - 0.005ms returns 0 +T42A8 000:999.351 JLINK_WriteReg(R2, 0x000000FF) +T42A8 000:999.356 - 0.004ms returns 0 +T42A8 000:999.362 JLINK_WriteReg(R3, 0x00000000) +T42A8 000:999.367 - 0.004ms returns 0 +T42A8 000:999.373 JLINK_WriteReg(R4, 0x00000000) +T42A8 000:999.377 - 0.004ms returns 0 +T42A8 000:999.383 JLINK_WriteReg(R5, 0x00000000) +T42A8 000:999.392 - 0.008ms returns 0 +T42A8 000:999.400 JLINK_WriteReg(R6, 0x00000000) +T42A8 000:999.405 - 0.004ms returns 0 +T42A8 000:999.411 JLINK_WriteReg(R7, 0x00000000) +T42A8 000:999.416 - 0.004ms returns 0 +T42A8 000:999.422 JLINK_WriteReg(R8, 0x00000000) +T42A8 000:999.427 - 0.004ms returns 0 +T42A8 000:999.432 JLINK_WriteReg(R9, 0x200039B4) +T42A8 000:999.437 - 0.004ms returns 0 +T42A8 000:999.443 JLINK_WriteReg(R10, 0x00000000) +T42A8 000:999.448 - 0.004ms returns 0 +T42A8 000:999.454 JLINK_WriteReg(R11, 0x00000000) +T42A8 000:999.459 - 0.004ms returns 0 +T42A8 000:999.464 JLINK_WriteReg(R12, 0x00000000) +T42A8 000:999.469 - 0.004ms returns 0 +T42A8 000:999.477 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 000:999.482 - 0.005ms returns 0 +T42A8 000:999.488 JLINK_WriteReg(R14, 0x20003001) +T42A8 000:999.493 - 0.004ms returns 0 +T42A8 000:999.499 JLINK_WriteReg(R15 (PC), 0x20003020) +T42A8 000:999.504 - 0.005ms returns 0 +T42A8 000:999.510 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 000:999.515 - 0.005ms returns 0 +T42A8 000:999.521 JLINK_WriteReg(MSP, 0x20004000) +T42A8 000:999.527 - 0.005ms returns 0 +T42A8 000:999.533 JLINK_WriteReg(PSP, 0x20004000) +T42A8 000:999.538 - 0.004ms returns 0 +T42A8 000:999.544 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 000:999.548 - 0.004ms returns 0 +T42A8 000:999.555 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 000:999.562 - 0.006ms returns 0x0000001E +T42A8 000:999.568 JLINK_Go() +T42A8 000:999.581 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:005.990 - 6.421ms +T42A8 001:006.017 JLINK_IsHalted() +T42A8 001:012.101 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:012.727 - 6.709ms returns TRUE +T42A8 001:012.742 JLINK_ReadReg(R15 (PC)) +T42A8 001:012.750 - 0.007ms returns 0x20003000 +T42A8 001:012.756 JLINK_ClrBPEx(BPHandle = 0x0000001E) +T42A8 001:012.762 - 0.005ms returns 0x00 +T42A8 001:012.768 JLINK_ReadReg(R0) +T42A8 001:012.774 - 0.005ms returns 0x00000001 +T42A8 001:012.841 JLINK_HasError() +T42A8 001:012.852 JLINK_WriteReg(R0, 0x18012000) +T42A8 001:012.859 - 0.006ms returns 0 +T42A8 001:012.865 JLINK_WriteReg(R1, 0x00001000) +T42A8 001:012.870 - 0.005ms returns 0 +T42A8 001:012.876 JLINK_WriteReg(R2, 0x000000FF) +T42A8 001:012.881 - 0.004ms returns 0 +T42A8 001:012.887 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:012.892 - 0.004ms returns 0 +T42A8 001:012.898 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:012.902 - 0.004ms returns 0 +T42A8 001:012.909 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:012.913 - 0.005ms returns 0 +T42A8 001:012.920 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:012.924 - 0.004ms returns 0 +T42A8 001:012.930 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:012.935 - 0.004ms returns 0 +T42A8 001:012.941 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:012.946 - 0.004ms returns 0 +T42A8 001:012.952 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:012.956 - 0.004ms returns 0 +T42A8 001:012.962 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:012.967 - 0.005ms returns 0 +T42A8 001:012.973 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:012.978 - 0.005ms returns 0 +T42A8 001:012.984 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:012.989 - 0.005ms returns 0 +T42A8 001:012.996 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:013.001 - 0.005ms returns 0 +T42A8 001:013.007 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:013.012 - 0.005ms returns 0 +T42A8 001:013.018 JLINK_WriteReg(R15 (PC), 0x200032CA) +T42A8 001:013.023 - 0.005ms returns 0 +T42A8 001:013.029 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:013.034 - 0.005ms returns 0 +T42A8 001:013.040 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:013.045 - 0.005ms returns 0 +T42A8 001:013.051 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:013.056 - 0.004ms returns 0 +T42A8 001:013.062 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:013.067 - 0.004ms returns 0 +T42A8 001:013.073 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:013.079 - 0.006ms returns 0x0000001F +T42A8 001:013.085 JLINK_Go() +T42A8 001:013.095 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:018.995 - 5.909ms +T42A8 001:019.008 JLINK_IsHalted() +T42A8 001:019.654 - 0.645ms returns FALSE +T42A8 001:019.668 JLINK_HasError() +T42A8 001:024.964 JLINK_IsHalted() +T42A8 001:025.617 - 0.652ms returns FALSE +T42A8 001:025.629 JLINK_HasError() +T42A8 001:026.840 JLINK_IsHalted() +T42A8 001:033.130 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:033.924 - 7.083ms returns TRUE +T42A8 001:033.949 JLINK_ReadReg(R15 (PC)) +T42A8 001:033.958 - 0.009ms returns 0x20003000 +T42A8 001:033.965 JLINK_ClrBPEx(BPHandle = 0x0000001F) +T42A8 001:033.971 - 0.005ms returns 0x00 +T42A8 001:033.977 JLINK_ReadReg(R0) +T42A8 001:033.983 - 0.005ms returns 0x00000000 +T42A8 001:034.449 JLINK_HasError() +T42A8 001:034.464 JLINK_WriteReg(R0, 0x18013000) +T42A8 001:034.472 - 0.007ms returns 0 +T42A8 001:034.479 JLINK_WriteReg(R1, 0x00001000) +T42A8 001:034.484 - 0.005ms returns 0 +T42A8 001:034.490 JLINK_WriteReg(R2, 0x000000FF) +T42A8 001:034.495 - 0.005ms returns 0 +T42A8 001:034.501 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:034.506 - 0.005ms returns 0 +T42A8 001:034.513 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:034.518 - 0.005ms returns 0 +T42A8 001:034.524 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:034.529 - 0.005ms returns 0 +T42A8 001:034.536 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:034.541 - 0.005ms returns 0 +T42A8 001:034.547 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:034.552 - 0.005ms returns 0 +T42A8 001:034.558 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:034.563 - 0.005ms returns 0 +T42A8 001:034.569 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:034.574 - 0.005ms returns 0 +T42A8 001:034.580 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:034.585 - 0.005ms returns 0 +T42A8 001:034.592 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:034.597 - 0.005ms returns 0 +T42A8 001:034.603 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:034.608 - 0.005ms returns 0 +T42A8 001:034.614 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:034.620 - 0.005ms returns 0 +T42A8 001:034.626 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:034.631 - 0.005ms returns 0 +T42A8 001:034.637 JLINK_WriteReg(R15 (PC), 0x20003020) +T42A8 001:034.642 - 0.005ms returns 0 +T42A8 001:034.648 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:034.654 - 0.005ms returns 0 +T42A8 001:034.660 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:034.665 - 0.005ms returns 0 +T42A8 001:034.671 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:034.676 - 0.005ms returns 0 +T42A8 001:034.682 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:034.687 - 0.005ms returns 0 +T42A8 001:034.694 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:034.700 - 0.006ms returns 0x00000020 +T42A8 001:034.706 JLINK_Go() +T42A8 001:034.719 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:040.909 - 6.201ms +T42A8 001:040.952 JLINK_IsHalted() +T42A8 001:047.047 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:047.715 - 6.762ms returns TRUE +T42A8 001:047.736 JLINK_ReadReg(R15 (PC)) +T42A8 001:047.748 - 0.011ms returns 0x20003000 +T42A8 001:047.762 JLINK_ClrBPEx(BPHandle = 0x00000020) +T42A8 001:047.775 - 0.012ms returns 0x00 +T42A8 001:047.792 JLINK_ReadReg(R0) +T42A8 001:047.800 - 0.008ms returns 0x00000001 +T42A8 001:047.808 JLINK_HasError() +T42A8 001:047.817 JLINK_WriteReg(R0, 0x18013000) +T42A8 001:047.824 - 0.007ms returns 0 +T42A8 001:047.833 JLINK_WriteReg(R1, 0x00001000) +T42A8 001:047.839 - 0.006ms returns 0 +T42A8 001:047.921 JLINK_WriteReg(R2, 0x000000FF) +T42A8 001:047.935 - 0.014ms returns 0 +T42A8 001:047.944 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:047.950 - 0.006ms returns 0 +T42A8 001:047.958 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:047.965 - 0.006ms returns 0 +T42A8 001:047.972 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:047.978 - 0.005ms returns 0 +T42A8 001:047.985 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:047.991 - 0.006ms returns 0 +T42A8 001:047.999 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:048.005 - 0.006ms returns 0 +T42A8 001:048.014 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:048.021 - 0.006ms returns 0 +T42A8 001:048.028 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:048.034 - 0.006ms returns 0 +T42A8 001:048.042 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:048.049 - 0.006ms returns 0 +T42A8 001:048.057 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:048.067 - 0.010ms returns 0 +T42A8 001:048.076 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:048.083 - 0.006ms returns 0 +T42A8 001:048.090 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:048.097 - 0.006ms returns 0 +T42A8 001:048.105 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:048.111 - 0.006ms returns 0 +T42A8 001:048.119 JLINK_WriteReg(R15 (PC), 0x200032CA) +T42A8 001:048.125 - 0.006ms returns 0 +T42A8 001:048.133 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:048.139 - 0.006ms returns 0 +T42A8 001:048.146 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:048.153 - 0.006ms returns 0 +T42A8 001:048.160 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:048.166 - 0.006ms returns 0 +T42A8 001:048.174 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:048.180 - 0.006ms returns 0 +T42A8 001:048.189 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:048.197 - 0.008ms returns 0x00000021 +T42A8 001:048.204 JLINK_Go() +T42A8 001:048.218 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:054.174 - 5.968ms +T42A8 001:054.192 JLINK_IsHalted() +T42A8 001:054.839 - 0.647ms returns FALSE +T42A8 001:054.856 JLINK_HasError() +T42A8 001:057.721 JLINK_IsHalted() +T42A8 001:058.252 - 0.530ms returns FALSE +T42A8 001:058.264 JLINK_HasError() +T42A8 001:059.851 JLINK_IsHalted() +T42A8 001:060.493 - 0.641ms returns FALSE +T42A8 001:060.504 JLINK_HasError() +T42A8 001:061.851 JLINK_IsHalted() +T42A8 001:067.812 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:068.555 - 6.703ms returns TRUE +T42A8 001:068.579 JLINK_ReadReg(R15 (PC)) +T42A8 001:068.588 - 0.008ms returns 0x20003000 +T42A8 001:068.594 JLINK_ClrBPEx(BPHandle = 0x00000021) +T42A8 001:068.600 - 0.005ms returns 0x00 +T42A8 001:068.606 JLINK_ReadReg(R0) +T42A8 001:068.611 - 0.004ms returns 0x00000000 +T42A8 001:069.140 JLINK_HasError() +T42A8 001:069.157 JLINK_WriteReg(R0, 0x18014000) +T42A8 001:069.164 - 0.007ms returns 0 +T42A8 001:069.171 JLINK_WriteReg(R1, 0x00001000) +T42A8 001:069.176 - 0.005ms returns 0 +T42A8 001:069.183 JLINK_WriteReg(R2, 0x000000FF) +T42A8 001:069.188 - 0.005ms returns 0 +T42A8 001:069.194 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:069.199 - 0.005ms returns 0 +T42A8 001:069.205 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:069.210 - 0.005ms returns 0 +T42A8 001:069.216 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:069.221 - 0.005ms returns 0 +T42A8 001:069.228 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:069.233 - 0.004ms returns 0 +T42A8 001:069.239 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:069.244 - 0.005ms returns 0 +T42A8 001:069.250 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:069.255 - 0.005ms returns 0 +T42A8 001:069.261 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:069.266 - 0.005ms returns 0 +T42A8 001:069.273 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:069.278 - 0.005ms returns 0 +T42A8 001:069.284 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:069.289 - 0.005ms returns 0 +T42A8 001:069.295 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:069.300 - 0.005ms returns 0 +T42A8 001:069.306 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:069.312 - 0.005ms returns 0 +T42A8 001:069.318 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:069.323 - 0.005ms returns 0 +T42A8 001:069.329 JLINK_WriteReg(R15 (PC), 0x20003020) +T42A8 001:069.335 - 0.005ms returns 0 +T42A8 001:069.341 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:069.346 - 0.005ms returns 0 +T42A8 001:069.352 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:069.358 - 0.005ms returns 0 +T42A8 001:069.364 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:069.369 - 0.005ms returns 0 +T42A8 001:069.375 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:069.380 - 0.005ms returns 0 +T42A8 001:069.387 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:069.393 - 0.006ms returns 0x00000022 +T42A8 001:069.399 JLINK_Go() +T42A8 001:069.412 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:075.744 - 6.342ms +T42A8 001:075.789 JLINK_IsHalted() +T42A8 001:081.910 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:082.665 - 6.875ms returns TRUE +T42A8 001:082.715 JLINK_ReadReg(R15 (PC)) +T42A8 001:082.732 - 0.018ms returns 0x20003000 +T42A8 001:082.744 JLINK_ClrBPEx(BPHandle = 0x00000022) +T42A8 001:082.758 - 0.014ms returns 0x00 +T42A8 001:082.768 JLINK_ReadReg(R0) +T42A8 001:082.774 - 0.006ms returns 0x00000001 +T42A8 001:082.783 JLINK_HasError() +T42A8 001:082.792 JLINK_WriteReg(R0, 0x18014000) +T42A8 001:082.799 - 0.007ms returns 0 +T42A8 001:082.807 JLINK_WriteReg(R1, 0x00001000) +T42A8 001:082.814 - 0.006ms returns 0 +T42A8 001:082.823 JLINK_WriteReg(R2, 0x000000FF) +T42A8 001:082.830 - 0.006ms returns 0 +T42A8 001:082.838 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:082.845 - 0.006ms returns 0 +T42A8 001:082.856 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:082.871 - 0.015ms returns 0 +T42A8 001:082.886 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:082.894 - 0.007ms returns 0 +T42A8 001:082.902 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:082.909 - 0.006ms returns 0 +T42A8 001:082.917 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:082.923 - 0.006ms returns 0 +T42A8 001:082.933 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:082.939 - 0.007ms returns 0 +T42A8 001:082.948 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:082.956 - 0.008ms returns 0 +T42A8 001:082.964 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:082.971 - 0.006ms returns 0 +T42A8 001:082.980 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:082.988 - 0.007ms returns 0 +T42A8 001:082.995 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:083.003 - 0.007ms returns 0 +T42A8 001:083.011 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:083.018 - 0.006ms returns 0 +T42A8 001:083.026 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:083.032 - 0.006ms returns 0 +T42A8 001:083.041 JLINK_WriteReg(R15 (PC), 0x200032CA) +T42A8 001:083.047 - 0.006ms returns 0 +T42A8 001:083.056 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:083.062 - 0.006ms returns 0 +T42A8 001:083.071 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:083.077 - 0.006ms returns 0 +T42A8 001:083.086 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:083.092 - 0.005ms returns 0 +T42A8 001:083.101 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:083.107 - 0.006ms returns 0 +T42A8 001:083.116 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:083.124 - 0.007ms returns 0x00000023 +T42A8 001:083.133 JLINK_Go() +T42A8 001:083.148 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:089.003 - 5.869ms +T42A8 001:089.019 JLINK_IsHalted() +T42A8 001:089.717 - 0.698ms returns FALSE +T42A8 001:089.730 JLINK_HasError() +T42A8 001:094.750 JLINK_IsHalted() +T42A8 001:095.523 - 0.772ms returns FALSE +T42A8 001:095.548 JLINK_HasError() +T42A8 001:096.915 JLINK_IsHalted() +T42A8 001:103.074 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:103.698 - 6.782ms returns TRUE +T42A8 001:103.720 JLINK_ReadReg(R15 (PC)) +T42A8 001:103.736 - 0.015ms returns 0x20003000 +T42A8 001:103.747 JLINK_ClrBPEx(BPHandle = 0x00000023) +T42A8 001:103.755 - 0.008ms returns 0x00 +T42A8 001:103.762 JLINK_ReadReg(R0) +T42A8 001:103.768 - 0.005ms returns 0x00000000 +T42A8 001:104.466 JLINK_HasError() +T42A8 001:104.487 JLINK_WriteReg(R0, 0x18015000) +T42A8 001:104.495 - 0.007ms returns 0 +T42A8 001:104.502 JLINK_WriteReg(R1, 0x00001000) +T42A8 001:104.507 - 0.005ms returns 0 +T42A8 001:104.513 JLINK_WriteReg(R2, 0x000000FF) +T42A8 001:104.518 - 0.005ms returns 0 +T42A8 001:104.524 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:104.529 - 0.004ms returns 0 +T42A8 001:104.535 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:104.540 - 0.004ms returns 0 +T42A8 001:104.546 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:104.551 - 0.005ms returns 0 +T42A8 001:104.557 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:104.562 - 0.004ms returns 0 +T42A8 001:104.568 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:104.572 - 0.004ms returns 0 +T42A8 001:104.579 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:104.584 - 0.004ms returns 0 +T42A8 001:104.590 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:104.594 - 0.004ms returns 0 +T42A8 001:104.600 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:104.605 - 0.005ms returns 0 +T42A8 001:104.611 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:104.620 - 0.008ms returns 0 +T42A8 001:104.626 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:104.631 - 0.005ms returns 0 +T42A8 001:104.637 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:104.646 - 0.009ms returns 0 +T42A8 001:104.655 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:104.660 - 0.005ms returns 0 +T42A8 001:104.667 JLINK_WriteReg(R15 (PC), 0x20003020) +T42A8 001:104.673 - 0.005ms returns 0 +T42A8 001:104.679 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:104.684 - 0.005ms returns 0 +T42A8 001:104.690 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:104.695 - 0.004ms returns 0 +T42A8 001:104.701 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:104.706 - 0.004ms returns 0 +T42A8 001:104.712 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:104.717 - 0.005ms returns 0 +T42A8 001:104.724 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:104.730 - 0.006ms returns 0x00000024 +T42A8 001:104.737 JLINK_Go() +T42A8 001:104.750 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:110.747 - 6.009ms +T42A8 001:110.760 JLINK_IsHalted() +T42A8 001:116.717 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:117.263 - 6.501ms returns TRUE +T42A8 001:117.275 JLINK_ReadReg(R15 (PC)) +T42A8 001:117.282 - 0.006ms returns 0x20003000 +T42A8 001:117.289 JLINK_ClrBPEx(BPHandle = 0x00000024) +T42A8 001:117.294 - 0.005ms returns 0x00 +T42A8 001:117.300 JLINK_ReadReg(R0) +T42A8 001:117.305 - 0.005ms returns 0x00000001 +T42A8 001:117.313 JLINK_HasError() +T42A8 001:117.320 JLINK_WriteReg(R0, 0x18015000) +T42A8 001:117.325 - 0.005ms returns 0 +T42A8 001:117.331 JLINK_WriteReg(R1, 0x00001000) +T42A8 001:117.336 - 0.005ms returns 0 +T42A8 001:117.342 JLINK_WriteReg(R2, 0x000000FF) +T42A8 001:117.347 - 0.004ms returns 0 +T42A8 001:117.355 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:117.360 - 0.005ms returns 0 +T42A8 001:117.366 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:117.371 - 0.005ms returns 0 +T42A8 001:117.377 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:117.382 - 0.005ms returns 0 +T42A8 001:117.388 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:117.393 - 0.004ms returns 0 +T42A8 001:117.400 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:117.405 - 0.005ms returns 0 +T42A8 001:117.411 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:117.416 - 0.005ms returns 0 +T42A8 001:117.422 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:117.427 - 0.004ms returns 0 +T42A8 001:117.433 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:117.438 - 0.005ms returns 0 +T42A8 001:117.445 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:117.450 - 0.005ms returns 0 +T42A8 001:117.457 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:117.462 - 0.005ms returns 0 +T42A8 001:117.469 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:117.475 - 0.005ms returns 0 +T42A8 001:117.482 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:117.487 - 0.005ms returns 0 +T42A8 001:117.494 JLINK_WriteReg(R15 (PC), 0x200032CA) +T42A8 001:117.499 - 0.005ms returns 0 +T42A8 001:117.507 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:117.512 - 0.005ms returns 0 +T42A8 001:117.519 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:117.524 - 0.005ms returns 0 +T42A8 001:117.531 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:117.536 - 0.005ms returns 0 +T42A8 001:117.543 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:117.548 - 0.005ms returns 0 +T42A8 001:117.622 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:117.633 - 0.010ms returns 0x00000025 +T42A8 001:117.639 JLINK_Go() +T42A8 001:117.648 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:123.751 - 6.109ms +T42A8 001:123.796 JLINK_IsHalted() +T42A8 001:124.432 - 0.635ms returns FALSE +T42A8 001:124.458 JLINK_HasError() +T42A8 001:125.805 JLINK_IsHalted() +T42A8 001:126.626 - 0.821ms returns FALSE +T42A8 001:126.651 JLINK_HasError() +T42A8 001:127.793 JLINK_IsHalted() +T42A8 001:128.602 - 0.809ms returns FALSE +T42A8 001:128.627 JLINK_HasError() +T42A8 001:130.803 JLINK_IsHalted() +T42A8 001:131.619 - 0.815ms returns FALSE +T42A8 001:131.646 JLINK_HasError() +T42A8 001:132.792 JLINK_IsHalted() +T42A8 001:139.135 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:139.738 - 6.945ms returns TRUE +T42A8 001:139.757 JLINK_ReadReg(R15 (PC)) +T42A8 001:139.768 - 0.010ms returns 0x20003000 +T42A8 001:139.777 JLINK_ClrBPEx(BPHandle = 0x00000025) +T42A8 001:139.785 - 0.008ms returns 0x00 +T42A8 001:139.797 JLINK_ReadReg(R0) +T42A8 001:139.807 - 0.009ms returns 0x00000000 +T42A8 001:140.184 JLINK_HasError() +T42A8 001:140.201 JLINK_WriteReg(R0, 0x00000001) +T42A8 001:140.210 - 0.009ms returns 0 +T42A8 001:140.219 JLINK_WriteReg(R1, 0x00001000) +T42A8 001:140.226 - 0.006ms returns 0 +T42A8 001:140.234 JLINK_WriteReg(R2, 0x000000FF) +T42A8 001:140.240 - 0.006ms returns 0 +T42A8 001:140.249 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:140.255 - 0.006ms returns 0 +T42A8 001:140.263 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:140.270 - 0.006ms returns 0 +T42A8 001:140.278 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:140.285 - 0.006ms returns 0 +T42A8 001:140.293 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:140.299 - 0.006ms returns 0 +T42A8 001:140.307 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:140.314 - 0.006ms returns 0 +T42A8 001:140.322 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:140.328 - 0.006ms returns 0 +T42A8 001:140.337 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:140.343 - 0.006ms returns 0 +T42A8 001:140.351 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:140.358 - 0.006ms returns 0 +T42A8 001:140.366 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:140.372 - 0.006ms returns 0 +T42A8 001:140.380 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:140.387 - 0.006ms returns 0 +T42A8 001:140.397 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:140.404 - 0.007ms returns 0 +T42A8 001:140.413 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:140.419 - 0.006ms returns 0 +T42A8 001:140.427 JLINK_WriteReg(R15 (PC), 0x20003218) +T42A8 001:140.434 - 0.007ms returns 0 +T42A8 001:140.443 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:140.449 - 0.006ms returns 0 +T42A8 001:140.457 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:140.464 - 0.006ms returns 0 +T42A8 001:140.472 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:140.478 - 0.006ms returns 0 +T42A8 001:140.487 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:140.493 - 0.006ms returns 0 +T42A8 001:140.502 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:140.510 - 0.008ms returns 0x00000026 +T42A8 001:140.518 JLINK_Go() +T42A8 001:140.539 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:146.474 - 5.956ms +T42A8 001:146.506 JLINK_IsHalted() +T42A8 001:152.445 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:153.070 - 6.563ms returns TRUE +T42A8 001:153.082 JLINK_ReadReg(R15 (PC)) +T42A8 001:153.088 - 0.006ms returns 0x20003000 +T42A8 001:153.095 JLINK_ClrBPEx(BPHandle = 0x00000026) +T42A8 001:153.100 - 0.005ms returns 0x00 +T42A8 001:153.106 JLINK_ReadReg(R0) +T42A8 001:153.111 - 0.004ms returns 0x00000000 +T42A8 001:216.356 JLINK_WriteMem(0x20003000, 0x9D4 Bytes, ...) +T42A8 001:216.367 Data: 00 BE 0A E0 0D 78 2D 06 68 40 08 24 40 00 00 D3 ... +T42A8 001:216.385 CPU_WriteMem(2516 bytes @ 0x20003000) +T42A8 001:248.177 - 31.820ms returns 0x9D4 +T42A8 001:248.305 JLINK_HasError() +T42A8 001:248.319 JLINK_WriteReg(R0, 0x18000000) +T42A8 001:248.328 - 0.008ms returns 0 +T42A8 001:248.335 JLINK_WriteReg(R1, 0x00F42400) +T42A8 001:248.340 - 0.005ms returns 0 +T42A8 001:248.346 JLINK_WriteReg(R2, 0x00000002) +T42A8 001:248.352 - 0.005ms returns 0 +T42A8 001:248.358 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:248.363 - 0.005ms returns 0 +T42A8 001:248.369 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:248.375 - 0.005ms returns 0 +T42A8 001:248.381 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:248.386 - 0.005ms returns 0 +T42A8 001:248.393 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:248.398 - 0.005ms returns 0 +T42A8 001:248.404 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:248.411 - 0.006ms returns 0 +T42A8 001:248.418 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:248.423 - 0.005ms returns 0 +T42A8 001:248.429 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:248.434 - 0.005ms returns 0 +T42A8 001:248.441 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:248.446 - 0.005ms returns 0 +T42A8 001:248.453 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:248.459 - 0.005ms returns 0 +T42A8 001:248.465 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:248.471 - 0.005ms returns 0 +T42A8 001:248.477 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:248.483 - 0.006ms returns 0 +T42A8 001:248.493 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:248.500 - 0.007ms returns 0 +T42A8 001:248.507 JLINK_WriteReg(R15 (PC), 0x200030E2) +T42A8 001:248.512 - 0.005ms returns 0 +T42A8 001:248.519 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:248.524 - 0.005ms returns 0 +T42A8 001:248.530 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:248.536 - 0.005ms returns 0 +T42A8 001:248.542 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:248.547 - 0.005ms returns 0 +T42A8 001:248.554 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:248.559 - 0.005ms returns 0 +T42A8 001:248.567 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:248.577 CPU_ReadMem(4 bytes @ 0x20003000) +T42A8 001:249.205 CPU_WriteMem(4 bytes @ 0x20003000) +T42A8 001:249.911 CPU_ReadMem(4 bytes @ 0x20003000) +T42A8 001:250.512 CPU_WriteMem(4 bytes @ 0x20003000) +T42A8 001:251.056 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:251.611 - 3.043ms returns 0x00000027 +T42A8 001:251.623 JLINK_Go() +T42A8 001:251.633 CPU_WriteMem(2 bytes @ 0x20003000) +T42A8 001:252.357 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:258.296 - 6.672ms +T42A8 001:258.321 JLINK_IsHalted() +T42A8 001:264.453 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:265.190 - 6.867ms returns TRUE +T42A8 001:265.219 JLINK_ReadReg(R15 (PC)) +T42A8 001:265.230 - 0.010ms returns 0x20003000 +T42A8 001:265.238 JLINK_ClrBPEx(BPHandle = 0x00000027) +T42A8 001:265.244 - 0.006ms returns 0x00 +T42A8 001:265.252 JLINK_ReadReg(R0) +T42A8 001:265.258 - 0.006ms returns 0x00000000 +T42A8 001:265.679 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:265.697 Data: 00 80 00 20 AD 40 00 18 D3 40 00 18 D5 40 00 18 ... +T42A8 001:265.722 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:269.663 - 3.983ms returns 0x100 +T42A8 001:269.689 JLINK_HasError() +T42A8 001:269.699 JLINK_WriteReg(R0, 0x18004000) +T42A8 001:269.709 - 0.010ms returns 0 +T42A8 001:269.717 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:269.724 - 0.006ms returns 0 +T42A8 001:269.731 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:269.737 - 0.006ms returns 0 +T42A8 001:269.745 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:269.752 - 0.007ms returns 0 +T42A8 001:269.759 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:269.766 - 0.006ms returns 0 +T42A8 001:269.773 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:269.779 - 0.006ms returns 0 +T42A8 001:269.786 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:269.792 - 0.006ms returns 0 +T42A8 001:269.800 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:269.806 - 0.006ms returns 0 +T42A8 001:269.814 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:269.820 - 0.006ms returns 0 +T42A8 001:269.827 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:269.833 - 0.006ms returns 0 +T42A8 001:269.841 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:269.847 - 0.006ms returns 0 +T42A8 001:269.855 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:269.861 - 0.006ms returns 0 +T42A8 001:269.869 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:269.875 - 0.006ms returns 0 +T42A8 001:269.883 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:269.890 - 0.007ms returns 0 +T42A8 001:269.897 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:269.904 - 0.006ms returns 0 +T42A8 001:269.912 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:269.918 - 0.006ms returns 0 +T42A8 001:269.926 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:269.932 - 0.006ms returns 0 +T42A8 001:269.939 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:269.946 - 0.006ms returns 0 +T42A8 001:269.953 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:269.959 - 0.006ms returns 0 +T42A8 001:269.967 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:269.973 - 0.006ms returns 0 +T42A8 001:269.981 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:269.989 - 0.007ms returns 0x00000028 +T42A8 001:269.997 JLINK_Go() +T42A8 001:270.010 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:276.198 - 6.201ms +T42A8 001:276.225 JLINK_IsHalted() +T42A8 001:276.873 - 0.647ms returns FALSE +T42A8 001:276.890 JLINK_HasError() +T42A8 001:285.427 JLINK_IsHalted() +T42A8 001:291.563 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:292.166 - 6.741ms returns TRUE +T42A8 001:292.182 JLINK_ReadReg(R15 (PC)) +T42A8 001:292.192 - 0.009ms returns 0x20003000 +T42A8 001:292.199 JLINK_ClrBPEx(BPHandle = 0x00000028) +T42A8 001:292.205 - 0.005ms returns 0x00 +T42A8 001:292.211 JLINK_ReadReg(R0) +T42A8 001:292.217 - 0.005ms returns 0x00000000 +T42A8 001:292.651 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:292.659 Data: F9 2E 01 18 99 40 00 18 FE B5 31 21 09 02 00 25 ... +T42A8 001:292.671 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:296.586 - 3.935ms returns 0x100 +T42A8 001:296.598 JLINK_HasError() +T42A8 001:296.605 JLINK_WriteReg(R0, 0x18004100) +T42A8 001:296.612 - 0.006ms returns 0 +T42A8 001:296.619 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:296.624 - 0.005ms returns 0 +T42A8 001:296.630 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:296.634 - 0.004ms returns 0 +T42A8 001:296.640 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:296.645 - 0.004ms returns 0 +T42A8 001:296.651 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:296.656 - 0.004ms returns 0 +T42A8 001:296.662 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:296.667 - 0.004ms returns 0 +T42A8 001:296.673 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:296.678 - 0.005ms returns 0 +T42A8 001:296.685 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:296.690 - 0.005ms returns 0 +T42A8 001:296.696 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:296.701 - 0.005ms returns 0 +T42A8 001:296.707 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:296.712 - 0.004ms returns 0 +T42A8 001:296.718 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:296.723 - 0.005ms returns 0 +T42A8 001:296.729 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:296.734 - 0.005ms returns 0 +T42A8 001:296.740 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:296.745 - 0.005ms returns 0 +T42A8 001:296.752 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:296.757 - 0.005ms returns 0 +T42A8 001:296.763 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:296.769 - 0.005ms returns 0 +T42A8 001:296.775 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:296.780 - 0.005ms returns 0 +T42A8 001:296.786 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:296.791 - 0.005ms returns 0 +T42A8 001:296.798 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:296.803 - 0.005ms returns 0 +T42A8 001:296.809 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:296.814 - 0.004ms returns 0 +T42A8 001:296.820 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:296.825 - 0.005ms returns 0 +T42A8 001:296.832 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:296.838 - 0.006ms returns 0x00000029 +T42A8 001:296.844 JLINK_Go() +T42A8 001:296.853 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:302.917 - 6.072ms +T42A8 001:302.930 JLINK_IsHalted() +T42A8 001:303.573 - 0.642ms returns FALSE +T42A8 001:303.585 JLINK_HasError() +T42A8 001:305.098 JLINK_IsHalted() +T42A8 001:310.888 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:311.366 - 6.266ms returns TRUE +T42A8 001:311.377 JLINK_ReadReg(R15 (PC)) +T42A8 001:311.383 - 0.006ms returns 0x20003000 +T42A8 001:311.390 JLINK_ClrBPEx(BPHandle = 0x00000029) +T42A8 001:311.395 - 0.005ms returns 0x00 +T42A8 001:311.401 JLINK_ReadReg(R0) +T42A8 001:311.406 - 0.004ms returns 0x00000000 +T42A8 001:311.764 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:311.772 Data: 40 30 C1 69 49 06 CA 0E 0E 2A 00 D1 14 22 4C 4D ... +T42A8 001:311.783 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:315.751 - 3.987ms returns 0x100 +T42A8 001:315.762 JLINK_HasError() +T42A8 001:315.769 JLINK_WriteReg(R0, 0x18004200) +T42A8 001:315.775 - 0.006ms returns 0 +T42A8 001:315.781 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:315.786 - 0.004ms returns 0 +T42A8 001:315.792 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:315.797 - 0.004ms returns 0 +T42A8 001:315.802 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:315.807 - 0.004ms returns 0 +T42A8 001:315.813 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:315.817 - 0.004ms returns 0 +T42A8 001:315.823 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:315.828 - 0.004ms returns 0 +T42A8 001:315.834 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:315.839 - 0.004ms returns 0 +T42A8 001:315.845 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:315.849 - 0.004ms returns 0 +T42A8 001:315.857 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:315.864 - 0.006ms returns 0 +T42A8 001:315.870 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:315.874 - 0.004ms returns 0 +T42A8 001:315.880 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:315.885 - 0.004ms returns 0 +T42A8 001:315.891 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:315.895 - 0.004ms returns 0 +T42A8 001:315.901 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:315.906 - 0.004ms returns 0 +T42A8 001:315.912 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:315.917 - 0.005ms returns 0 +T42A8 001:315.923 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:315.928 - 0.004ms returns 0 +T42A8 001:315.934 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:315.939 - 0.004ms returns 0 +T42A8 001:315.945 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:315.949 - 0.004ms returns 0 +T42A8 001:315.955 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:315.960 - 0.004ms returns 0 +T42A8 001:315.966 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:315.971 - 0.004ms returns 0 +T42A8 001:315.976 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:315.981 - 0.004ms returns 0 +T42A8 001:315.988 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:315.993 - 0.005ms returns 0x0000002A +T42A8 001:315.999 JLINK_Go() +T42A8 001:316.007 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:322.216 - 6.213ms +T42A8 001:322.298 JLINK_IsHalted() +T42A8 001:323.158 - 0.858ms returns FALSE +T42A8 001:323.227 JLINK_HasError() +T42A8 001:341.136 JLINK_IsHalted() +T42A8 001:347.285 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:348.113 - 6.975ms returns TRUE +T42A8 001:348.168 JLINK_ReadReg(R15 (PC)) +T42A8 001:348.193 - 0.024ms returns 0x20003000 +T42A8 001:348.215 JLINK_ClrBPEx(BPHandle = 0x0000002A) +T42A8 001:348.233 - 0.017ms returns 0x00 +T42A8 001:348.254 JLINK_ReadReg(R0) +T42A8 001:348.271 - 0.017ms returns 0x00000000 +T42A8 001:349.488 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:349.522 Data: 21 48 F0 61 61 6B 88 05 FC D5 0B 4F 64 21 28 46 ... +T42A8 001:349.561 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:353.663 - 4.174ms returns 0x100 +T42A8 001:353.708 JLINK_HasError() +T42A8 001:353.752 JLINK_WriteReg(R0, 0x18004300) +T42A8 001:353.788 - 0.037ms returns 0 +T42A8 001:353.808 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:353.824 - 0.016ms returns 0 +T42A8 001:353.843 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:353.858 - 0.015ms returns 0 +T42A8 001:353.877 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:353.892 - 0.015ms returns 0 +T42A8 001:353.911 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:353.926 - 0.015ms returns 0 +T42A8 001:353.946 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:353.962 - 0.016ms returns 0 +T42A8 001:353.982 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:353.999 - 0.016ms returns 0 +T42A8 001:354.031 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:354.056 - 0.025ms returns 0 +T42A8 001:354.103 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:354.141 - 0.039ms returns 0 +T42A8 001:354.182 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:354.200 - 0.018ms returns 0 +T42A8 001:354.221 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:354.236 - 0.015ms returns 0 +T42A8 001:354.257 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:354.272 - 0.015ms returns 0 +T42A8 001:354.291 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:354.307 - 0.016ms returns 0 +T42A8 001:354.330 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:354.350 - 0.021ms returns 0 +T42A8 001:354.370 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:354.385 - 0.015ms returns 0 +T42A8 001:354.407 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:354.422 - 0.015ms returns 0 +T42A8 001:354.443 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:354.458 - 0.015ms returns 0 +T42A8 001:354.480 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:354.494 - 0.015ms returns 0 +T42A8 001:354.516 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:354.531 - 0.015ms returns 0 +T42A8 001:354.553 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:354.570 - 0.016ms returns 0 +T42A8 001:354.594 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:354.613 - 0.019ms returns 0x0000002B +T42A8 001:354.634 JLINK_Go() +T42A8 001:354.665 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:360.900 - 6.264ms +T42A8 001:360.941 JLINK_IsHalted() +T42A8 001:361.645 - 0.703ms returns FALSE +T42A8 001:361.684 JLINK_HasError() +T42A8 001:368.154 JLINK_IsHalted() +T42A8 001:374.267 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:374.947 - 6.791ms returns TRUE +T42A8 001:374.983 JLINK_ReadReg(R15 (PC)) +T42A8 001:375.004 - 0.020ms returns 0x20003000 +T42A8 001:375.032 JLINK_ClrBPEx(BPHandle = 0x0000002B) +T42A8 001:375.071 - 0.038ms returns 0x00 +T42A8 001:375.094 JLINK_ReadReg(R0) +T42A8 001:375.110 - 0.016ms returns 0x00000000 +T42A8 001:376.221 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:376.247 Data: 32 1E 14 00 F8 B5 07 46 00 02 14 46 0E 46 00 25 ... +T42A8 001:376.280 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:380.197 - 3.975ms returns 0x100 +T42A8 001:380.233 JLINK_HasError() +T42A8 001:380.255 JLINK_WriteReg(R0, 0x18004400) +T42A8 001:380.275 - 0.020ms returns 0 +T42A8 001:380.294 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:380.310 - 0.015ms returns 0 +T42A8 001:380.328 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:380.343 - 0.014ms returns 0 +T42A8 001:380.361 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:380.378 - 0.017ms returns 0 +T42A8 001:380.398 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:380.414 - 0.016ms returns 0 +T42A8 001:380.433 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:380.448 - 0.015ms returns 0 +T42A8 001:380.467 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:380.482 - 0.014ms returns 0 +T42A8 001:380.500 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:380.515 - 0.014ms returns 0 +T42A8 001:380.533 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:380.548 - 0.014ms returns 0 +T42A8 001:380.566 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:380.580 - 0.014ms returns 0 +T42A8 001:380.599 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:380.614 - 0.015ms returns 0 +T42A8 001:380.632 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:380.647 - 0.015ms returns 0 +T42A8 001:380.666 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:380.682 - 0.015ms returns 0 +T42A8 001:380.701 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:380.717 - 0.016ms returns 0 +T42A8 001:380.735 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:380.751 - 0.015ms returns 0 +T42A8 001:380.770 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:380.785 - 0.015ms returns 0 +T42A8 001:380.804 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:380.818 - 0.015ms returns 0 +T42A8 001:380.837 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:380.852 - 0.015ms returns 0 +T42A8 001:380.871 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:380.885 - 0.014ms returns 0 +T42A8 001:380.904 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:380.919 - 0.015ms returns 0 +T42A8 001:380.939 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:380.956 - 0.017ms returns 0x0000002C +T42A8 001:380.974 JLINK_Go() +T42A8 001:381.000 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:387.111 - 6.135ms +T42A8 001:387.153 JLINK_IsHalted() +T42A8 001:387.929 - 0.774ms returns FALSE +T42A8 001:387.972 JLINK_HasError() +T42A8 001:394.025 JLINK_IsHalted() +T42A8 001:400.037 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:400.700 - 6.676ms returns TRUE +T42A8 001:400.712 JLINK_ReadReg(R15 (PC)) +T42A8 001:400.719 - 0.006ms returns 0x20003000 +T42A8 001:400.725 JLINK_ClrBPEx(BPHandle = 0x0000002C) +T42A8 001:400.730 - 0.005ms returns 0x00 +T42A8 001:400.737 JLINK_ReadReg(R0) +T42A8 001:400.742 - 0.005ms returns 0x00000000 +T42A8 001:401.190 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:401.198 Data: 97 FB B8 59 00 28 03 D1 E0 1D 00 21 0F F0 30 F9 ... +T42A8 001:401.235 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:405.087 - 3.896ms returns 0x100 +T42A8 001:405.112 JLINK_HasError() +T42A8 001:405.119 JLINK_WriteReg(R0, 0x18004500) +T42A8 001:405.125 - 0.006ms returns 0 +T42A8 001:405.131 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:405.136 - 0.005ms returns 0 +T42A8 001:405.141 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:405.146 - 0.004ms returns 0 +T42A8 001:405.152 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:405.157 - 0.004ms returns 0 +T42A8 001:405.162 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:405.170 - 0.007ms returns 0 +T42A8 001:405.178 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:405.182 - 0.004ms returns 0 +T42A8 001:405.188 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:405.193 - 0.004ms returns 0 +T42A8 001:405.199 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:405.203 - 0.004ms returns 0 +T42A8 001:405.209 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:405.214 - 0.004ms returns 0 +T42A8 001:405.219 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:405.224 - 0.004ms returns 0 +T42A8 001:405.230 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:405.234 - 0.004ms returns 0 +T42A8 001:405.240 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:405.245 - 0.004ms returns 0 +T42A8 001:405.251 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:405.255 - 0.004ms returns 0 +T42A8 001:405.261 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:405.266 - 0.005ms returns 0 +T42A8 001:405.272 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:405.276 - 0.004ms returns 0 +T42A8 001:405.282 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:405.287 - 0.004ms returns 0 +T42A8 001:405.293 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:405.298 - 0.004ms returns 0 +T42A8 001:405.303 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:405.308 - 0.004ms returns 0 +T42A8 001:405.314 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:405.318 - 0.004ms returns 0 +T42A8 001:405.324 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:405.329 - 0.004ms returns 0 +T42A8 001:405.335 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:405.340 - 0.005ms returns 0x0000002D +T42A8 001:405.346 JLINK_Go() +T42A8 001:405.355 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:411.240 - 5.891ms +T42A8 001:411.254 JLINK_IsHalted() +T42A8 001:411.866 - 0.611ms returns FALSE +T42A8 001:411.878 JLINK_HasError() +T42A8 001:420.009 JLINK_IsHalted() +T42A8 001:426.432 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:427.194 - 7.184ms returns TRUE +T42A8 001:427.248 JLINK_ReadReg(R15 (PC)) +T42A8 001:427.279 - 0.029ms returns 0x20003000 +T42A8 001:427.308 JLINK_ClrBPEx(BPHandle = 0x0000002D) +T42A8 001:427.332 - 0.024ms returns 0x00 +T42A8 001:427.360 JLINK_ReadReg(R0) +T42A8 001:427.383 - 0.022ms returns 0x00000000 +T42A8 001:429.319 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:429.360 Data: 32 46 84 48 04 99 0F F0 77 F8 06 46 28 46 02 F0 ... +T42A8 001:429.410 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:433.567 - 4.246ms returns 0x100 +T42A8 001:433.631 JLINK_HasError() +T42A8 001:433.665 JLINK_WriteReg(R0, 0x18004600) +T42A8 001:433.696 - 0.032ms returns 0 +T42A8 001:433.726 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:433.748 - 0.023ms returns 0 +T42A8 001:433.775 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:433.796 - 0.021ms returns 0 +T42A8 001:433.823 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:433.846 - 0.022ms returns 0 +T42A8 001:433.872 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:433.894 - 0.021ms returns 0 +T42A8 001:433.920 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:433.940 - 0.021ms returns 0 +T42A8 001:433.966 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:433.987 - 0.021ms returns 0 +T42A8 001:434.013 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:434.034 - 0.021ms returns 0 +T42A8 001:434.060 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:434.081 - 0.021ms returns 0 +T42A8 001:434.113 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:434.135 - 0.022ms returns 0 +T42A8 001:434.163 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:434.185 - 0.022ms returns 0 +T42A8 001:434.213 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:434.235 - 0.022ms returns 0 +T42A8 001:434.262 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:434.284 - 0.022ms returns 0 +T42A8 001:434.311 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:434.335 - 0.024ms returns 0 +T42A8 001:434.362 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:434.384 - 0.022ms returns 0 +T42A8 001:434.412 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:434.434 - 0.022ms returns 0 +T42A8 001:434.461 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:434.483 - 0.022ms returns 0 +T42A8 001:434.511 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:434.533 - 0.022ms returns 0 +T42A8 001:434.560 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:434.615 - 0.055ms returns 0 +T42A8 001:434.642 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:434.665 - 0.023ms returns 0 +T42A8 001:434.695 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:434.721 - 0.026ms returns 0x0000002E +T42A8 001:434.816 JLINK_Go() +T42A8 001:434.857 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:441.364 - 6.546ms +T42A8 001:441.433 JLINK_IsHalted() +T42A8 001:442.211 - 0.776ms returns FALSE +T42A8 001:442.267 JLINK_HasError() +T42A8 001:476.064 JLINK_IsHalted() +T42A8 001:482.220 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:483.020 - 6.954ms returns TRUE +T42A8 001:483.052 JLINK_ReadReg(R15 (PC)) +T42A8 001:483.064 - 0.012ms returns 0x20003000 +T42A8 001:483.074 JLINK_ClrBPEx(BPHandle = 0x0000002E) +T42A8 001:483.084 - 0.009ms returns 0x00 +T42A8 001:483.094 JLINK_ReadReg(R0) +T42A8 001:483.102 - 0.008ms returns 0x00000000 +T42A8 001:483.978 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:484.008 Data: 09 28 12 D1 28 46 02 F0 97 FB B9 59 02 9A 40 31 ... +T42A8 001:484.034 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:488.097 - 4.121ms returns 0x100 +T42A8 001:488.126 JLINK_HasError() +T42A8 001:488.139 JLINK_WriteReg(R0, 0x18004700) +T42A8 001:488.151 - 0.012ms returns 0 +T42A8 001:488.161 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:488.169 - 0.008ms returns 0 +T42A8 001:488.178 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:488.186 - 0.007ms returns 0 +T42A8 001:488.196 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:488.203 - 0.007ms returns 0 +T42A8 001:488.213 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:488.220 - 0.007ms returns 0 +T42A8 001:488.230 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:488.237 - 0.007ms returns 0 +T42A8 001:488.247 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:488.255 - 0.007ms returns 0 +T42A8 001:488.264 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:488.271 - 0.007ms returns 0 +T42A8 001:488.281 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:488.289 - 0.007ms returns 0 +T42A8 001:488.298 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:488.306 - 0.007ms returns 0 +T42A8 001:488.315 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:488.323 - 0.007ms returns 0 +T42A8 001:488.332 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:488.340 - 0.007ms returns 0 +T42A8 001:488.349 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:488.357 - 0.007ms returns 0 +T42A8 001:488.366 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:488.375 - 0.008ms returns 0 +T42A8 001:488.385 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:488.392 - 0.007ms returns 0 +T42A8 001:488.402 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:488.409 - 0.007ms returns 0 +T42A8 001:488.419 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:488.427 - 0.007ms returns 0 +T42A8 001:488.436 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:488.444 - 0.007ms returns 0 +T42A8 001:488.453 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:488.461 - 0.007ms returns 0 +T42A8 001:488.470 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:488.478 - 0.007ms returns 0 +T42A8 001:488.488 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:488.497 - 0.009ms returns 0x0000002F +T42A8 001:488.507 JLINK_Go() +T42A8 001:488.523 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:494.605 - 6.097ms +T42A8 001:494.634 JLINK_IsHalted() +T42A8 001:495.244 - 0.609ms returns FALSE +T42A8 001:495.257 JLINK_HasError() +T42A8 001:498.018 JLINK_IsHalted() +T42A8 001:504.052 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:504.597 - 6.578ms returns TRUE +T42A8 001:504.610 JLINK_ReadReg(R15 (PC)) +T42A8 001:504.618 - 0.007ms returns 0x20003000 +T42A8 001:504.624 JLINK_ClrBPEx(BPHandle = 0x0000002F) +T42A8 001:504.630 - 0.005ms returns 0x00 +T42A8 001:504.636 JLINK_ReadReg(R0) +T42A8 001:504.642 - 0.005ms returns 0x00000000 +T42A8 001:505.042 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:505.050 Data: 05 4A 39 46 E9 30 0E F0 F7 FF 16 E0 8C 90 00 20 ... +T42A8 001:505.062 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:509.014 - 3.971ms returns 0x100 +T42A8 001:509.026 JLINK_HasError() +T42A8 001:509.034 JLINK_WriteReg(R0, 0x18004800) +T42A8 001:509.041 - 0.007ms returns 0 +T42A8 001:509.052 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:509.057 - 0.005ms returns 0 +T42A8 001:509.063 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:509.068 - 0.005ms returns 0 +T42A8 001:509.075 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:509.080 - 0.005ms returns 0 +T42A8 001:509.086 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:509.090 - 0.004ms returns 0 +T42A8 001:509.096 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:509.101 - 0.004ms returns 0 +T42A8 001:509.107 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:509.111 - 0.004ms returns 0 +T42A8 001:509.117 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:509.122 - 0.004ms returns 0 +T42A8 001:509.128 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:509.133 - 0.004ms returns 0 +T42A8 001:509.139 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:509.143 - 0.004ms returns 0 +T42A8 001:509.149 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:509.154 - 0.005ms returns 0 +T42A8 001:509.160 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:509.165 - 0.005ms returns 0 +T42A8 001:509.172 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:509.176 - 0.005ms returns 0 +T42A8 001:509.183 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:509.188 - 0.005ms returns 0 +T42A8 001:509.194 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:509.199 - 0.005ms returns 0 +T42A8 001:509.206 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:509.211 - 0.005ms returns 0 +T42A8 001:509.217 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:509.222 - 0.005ms returns 0 +T42A8 001:509.228 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:509.233 - 0.005ms returns 0 +T42A8 001:509.239 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:509.244 - 0.004ms returns 0 +T42A8 001:509.250 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:509.254 - 0.004ms returns 0 +T42A8 001:509.261 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:509.267 - 0.006ms returns 0x00000030 +T42A8 001:509.273 JLINK_Go() +T42A8 001:509.283 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:515.483 - 6.209ms +T42A8 001:515.508 JLINK_IsHalted() +T42A8 001:516.040 - 0.531ms returns FALSE +T42A8 001:516.058 JLINK_HasError() +T42A8 001:520.981 JLINK_IsHalted() +T42A8 001:526.786 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:527.344 - 6.363ms returns TRUE +T42A8 001:527.356 JLINK_ReadReg(R15 (PC)) +T42A8 001:527.364 - 0.007ms returns 0x20003000 +T42A8 001:527.371 JLINK_ClrBPEx(BPHandle = 0x00000030) +T42A8 001:527.376 - 0.005ms returns 0x00 +T42A8 001:527.383 JLINK_ReadReg(R0) +T42A8 001:527.388 - 0.005ms returns 0x00000000 +T42A8 001:527.798 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:527.807 Data: 37 10 0C 37 A8 7C C0 06 C0 0E 60 70 40 36 31 70 ... +T42A8 001:527.818 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:531.729 - 3.928ms returns 0x100 +T42A8 001:531.779 JLINK_HasError() +T42A8 001:531.810 JLINK_WriteReg(R0, 0x18004900) +T42A8 001:531.839 - 0.028ms returns 0 +T42A8 001:531.880 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:531.904 - 0.024ms returns 0 +T42A8 001:531.932 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:531.953 - 0.021ms returns 0 +T42A8 001:531.980 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:532.028 - 0.047ms returns 0 +T42A8 001:532.084 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:532.111 - 0.027ms returns 0 +T42A8 001:532.138 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:532.159 - 0.021ms returns 0 +T42A8 001:532.185 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:532.206 - 0.021ms returns 0 +T42A8 001:532.232 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:532.253 - 0.021ms returns 0 +T42A8 001:532.280 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:532.301 - 0.021ms returns 0 +T42A8 001:532.327 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:532.348 - 0.021ms returns 0 +T42A8 001:532.374 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:532.395 - 0.021ms returns 0 +T42A8 001:532.422 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:532.443 - 0.021ms returns 0 +T42A8 001:532.470 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:532.491 - 0.021ms returns 0 +T42A8 001:532.517 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:532.540 - 0.023ms returns 0 +T42A8 001:532.566 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:532.587 - 0.021ms returns 0 +T42A8 001:532.625 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:532.646 - 0.022ms returns 0 +T42A8 001:532.673 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:532.694 - 0.021ms returns 0 +T42A8 001:532.720 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:532.741 - 0.021ms returns 0 +T42A8 001:532.767 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:532.788 - 0.021ms returns 0 +T42A8 001:532.815 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:532.836 - 0.021ms returns 0 +T42A8 001:532.864 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:532.889 - 0.026ms returns 0x00000031 +T42A8 001:532.917 JLINK_Go() +T42A8 001:532.954 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:539.281 - 6.362ms +T42A8 001:539.345 JLINK_IsHalted() +T42A8 001:540.163 - 0.815ms returns FALSE +T42A8 001:540.228 JLINK_HasError() +T42A8 001:560.034 JLINK_IsHalted() +T42A8 001:566.208 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:567.066 - 7.030ms returns TRUE +T42A8 001:567.104 JLINK_ReadReg(R15 (PC)) +T42A8 001:567.113 - 0.009ms returns 0x20003000 +T42A8 001:567.119 JLINK_ClrBPEx(BPHandle = 0x00000031) +T42A8 001:567.125 - 0.005ms returns 0x00 +T42A8 001:567.131 JLINK_ReadReg(R0) +T42A8 001:567.136 - 0.004ms returns 0x00000000 +T42A8 001:567.578 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:567.590 Data: FE BD F8 B5 88 4A 81 00 55 58 88 4F 2E 46 20 36 ... +T42A8 001:567.604 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:571.699 - 4.120ms returns 0x100 +T42A8 001:571.726 JLINK_HasError() +T42A8 001:571.734 JLINK_WriteReg(R0, 0x18004A00) +T42A8 001:571.743 - 0.008ms returns 0 +T42A8 001:571.749 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:571.754 - 0.005ms returns 0 +T42A8 001:571.829 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:571.840 - 0.010ms returns 0 +T42A8 001:571.847 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:571.854 - 0.007ms returns 0 +T42A8 001:571.862 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:571.867 - 0.005ms returns 0 +T42A8 001:571.874 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:571.878 - 0.005ms returns 0 +T42A8 001:571.884 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:571.893 - 0.008ms returns 0 +T42A8 001:571.923 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:571.942 - 0.019ms returns 0 +T42A8 001:571.949 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:571.955 - 0.005ms returns 0 +T42A8 001:571.962 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:571.984 - 0.021ms returns 0 +T42A8 001:571.991 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:571.997 - 0.006ms returns 0 +T42A8 001:572.017 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:572.022 - 0.005ms returns 0 +T42A8 001:572.028 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:572.033 - 0.005ms returns 0 +T42A8 001:572.040 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:572.046 - 0.006ms returns 0 +T42A8 001:572.053 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:572.059 - 0.005ms returns 0 +T42A8 001:572.066 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:572.073 - 0.007ms returns 0 +T42A8 001:572.080 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:572.086 - 0.006ms returns 0 +T42A8 001:572.093 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:572.099 - 0.005ms returns 0 +T42A8 001:572.106 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:572.111 - 0.005ms returns 0 +T42A8 001:572.118 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:572.125 - 0.006ms returns 0 +T42A8 001:572.133 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:572.143 - 0.009ms returns 0x00000032 +T42A8 001:572.151 JLINK_Go() +T42A8 001:572.165 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:578.431 - 6.279ms +T42A8 001:578.451 JLINK_IsHalted() +T42A8 001:579.032 - 0.580ms returns FALSE +T42A8 001:579.048 JLINK_HasError() +T42A8 001:583.860 JLINK_IsHalted() +T42A8 001:589.875 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:590.652 - 6.789ms returns TRUE +T42A8 001:590.720 JLINK_ReadReg(R15 (PC)) +T42A8 001:590.752 - 0.031ms returns 0x20003000 +T42A8 001:590.782 JLINK_ClrBPEx(BPHandle = 0x00000032) +T42A8 001:590.806 - 0.024ms returns 0x00 +T42A8 001:590.850 JLINK_ReadReg(R0) +T42A8 001:590.904 - 0.058ms returns 0x00000000 +T42A8 001:591.553 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:591.574 Data: 52 7C D2 07 00 D1 00 20 03 29 01 D0 04 29 06 D1 ... +T42A8 001:591.591 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:595.712 - 4.158ms returns 0x100 +T42A8 001:595.737 JLINK_HasError() +T42A8 001:595.745 JLINK_WriteReg(R0, 0x18004B00) +T42A8 001:595.754 - 0.008ms returns 0 +T42A8 001:595.760 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:595.765 - 0.005ms returns 0 +T42A8 001:595.771 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:595.776 - 0.004ms returns 0 +T42A8 001:595.782 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:595.786 - 0.004ms returns 0 +T42A8 001:595.792 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:595.799 - 0.006ms returns 0 +T42A8 001:595.805 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:595.810 - 0.004ms returns 0 +T42A8 001:595.816 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:595.821 - 0.005ms returns 0 +T42A8 001:595.826 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:595.831 - 0.004ms returns 0 +T42A8 001:595.837 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:595.842 - 0.004ms returns 0 +T42A8 001:595.848 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:595.853 - 0.005ms returns 0 +T42A8 001:595.859 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:595.864 - 0.004ms returns 0 +T42A8 001:595.870 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:595.874 - 0.004ms returns 0 +T42A8 001:595.880 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:595.885 - 0.004ms returns 0 +T42A8 001:595.891 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:595.896 - 0.005ms returns 0 +T42A8 001:595.902 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:595.906 - 0.004ms returns 0 +T42A8 001:595.912 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:595.917 - 0.004ms returns 0 +T42A8 001:595.923 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:595.928 - 0.005ms returns 0 +T42A8 001:595.934 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:595.939 - 0.004ms returns 0 +T42A8 001:595.945 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:595.950 - 0.004ms returns 0 +T42A8 001:595.955 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:595.960 - 0.005ms returns 0 +T42A8 001:595.967 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:595.973 - 0.006ms returns 0x00000033 +T42A8 001:595.979 JLINK_Go() +T42A8 001:595.991 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:602.026 - 6.046ms +T42A8 001:602.050 JLINK_IsHalted() +T42A8 001:602.713 - 0.662ms returns FALSE +T42A8 001:602.727 JLINK_HasError() +T42A8 001:605.913 JLINK_IsHalted() +T42A8 001:611.920 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:612.673 - 6.759ms returns TRUE +T42A8 001:612.698 JLINK_ReadReg(R15 (PC)) +T42A8 001:612.706 - 0.008ms returns 0x20003000 +T42A8 001:612.712 JLINK_ClrBPEx(BPHandle = 0x00000033) +T42A8 001:612.718 - 0.005ms returns 0x00 +T42A8 001:612.725 JLINK_ReadReg(R0) +T42A8 001:612.730 - 0.005ms returns 0x00000000 +T42A8 001:613.320 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:613.335 Data: 85 00 5B 59 22 69 1B 69 40 33 00 29 08 D0 15 7D ... +T42A8 001:613.352 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:617.309 - 3.989ms returns 0x100 +T42A8 001:617.333 JLINK_HasError() +T42A8 001:617.342 JLINK_WriteReg(R0, 0x18004C00) +T42A8 001:617.352 - 0.009ms returns 0 +T42A8 001:617.359 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:617.364 - 0.005ms returns 0 +T42A8 001:617.370 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:617.375 - 0.005ms returns 0 +T42A8 001:617.382 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:617.387 - 0.005ms returns 0 +T42A8 001:617.393 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:617.399 - 0.005ms returns 0 +T42A8 001:617.405 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:617.410 - 0.005ms returns 0 +T42A8 001:617.416 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:617.421 - 0.005ms returns 0 +T42A8 001:617.427 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:617.432 - 0.005ms returns 0 +T42A8 001:617.439 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:617.444 - 0.005ms returns 0 +T42A8 001:617.450 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:617.455 - 0.005ms returns 0 +T42A8 001:617.461 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:617.466 - 0.005ms returns 0 +T42A8 001:617.473 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:617.484 - 0.011ms returns 0 +T42A8 001:617.490 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:617.496 - 0.005ms returns 0 +T42A8 001:617.502 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:617.508 - 0.005ms returns 0 +T42A8 001:617.514 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:617.520 - 0.005ms returns 0 +T42A8 001:617.526 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:617.531 - 0.005ms returns 0 +T42A8 001:617.538 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:617.543 - 0.005ms returns 0 +T42A8 001:617.550 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:617.555 - 0.005ms returns 0 +T42A8 001:617.561 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:617.566 - 0.005ms returns 0 +T42A8 001:617.573 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:617.578 - 0.005ms returns 0 +T42A8 001:617.586 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:617.592 - 0.007ms returns 0x00000034 +T42A8 001:617.598 JLINK_Go() +T42A8 001:617.610 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:623.745 - 6.129ms +T42A8 001:623.769 JLINK_IsHalted() +T42A8 001:624.377 - 0.606ms returns FALSE +T42A8 001:624.397 JLINK_HasError() +T42A8 001:625.846 JLINK_IsHalted() +T42A8 001:631.842 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:632.372 - 6.525ms returns TRUE +T42A8 001:632.386 JLINK_ReadReg(R15 (PC)) +T42A8 001:632.393 - 0.007ms returns 0x20003000 +T42A8 001:632.400 JLINK_ClrBPEx(BPHandle = 0x00000034) +T42A8 001:632.405 - 0.005ms returns 0x00 +T42A8 001:632.411 JLINK_ReadReg(R0) +T42A8 001:632.416 - 0.004ms returns 0x00000000 +T42A8 001:632.854 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:632.862 Data: 02 F0 6F FB 07 46 CF 48 CE 49 20 30 00 79 1E 31 ... +T42A8 001:632.873 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:636.720 - 3.865ms returns 0x100 +T42A8 001:636.731 JLINK_HasError() +T42A8 001:636.738 JLINK_WriteReg(R0, 0x18004D00) +T42A8 001:636.757 - 0.019ms returns 0 +T42A8 001:636.779 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:636.784 - 0.005ms returns 0 +T42A8 001:636.790 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:636.795 - 0.005ms returns 0 +T42A8 001:636.801 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:636.818 - 0.017ms returns 0 +T42A8 001:636.824 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:636.844 - 0.019ms returns 0 +T42A8 001:636.850 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:636.855 - 0.004ms returns 0 +T42A8 001:636.861 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:636.865 - 0.004ms returns 0 +T42A8 001:636.884 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:636.889 - 0.004ms returns 0 +T42A8 001:636.910 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:636.915 - 0.005ms returns 0 +T42A8 001:636.921 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:636.926 - 0.004ms returns 0 +T42A8 001:636.932 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:636.950 - 0.018ms returns 0 +T42A8 001:636.955 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:636.975 - 0.019ms returns 0 +T42A8 001:636.981 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:636.986 - 0.004ms returns 0 +T42A8 001:636.992 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:636.997 - 0.005ms returns 0 +T42A8 001:637.016 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:637.036 - 0.019ms returns 0 +T42A8 001:637.042 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:637.047 - 0.004ms returns 0 +T42A8 001:637.053 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:637.058 - 0.004ms returns 0 +T42A8 001:637.064 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:637.081 - 0.017ms returns 0 +T42A8 001:637.087 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:637.092 - 0.004ms returns 0 +T42A8 001:637.098 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:637.102 - 0.004ms returns 0 +T42A8 001:637.109 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:637.114 - 0.005ms returns 0x00000035 +T42A8 001:637.120 JLINK_Go() +T42A8 001:637.129 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:642.888 - 5.766ms +T42A8 001:642.925 JLINK_IsHalted() +T42A8 001:643.441 - 0.516ms returns FALSE +T42A8 001:643.464 JLINK_HasError() +T42A8 001:649.746 JLINK_IsHalted() +T42A8 001:655.818 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:656.434 - 6.688ms returns TRUE +T42A8 001:656.449 JLINK_ReadReg(R15 (PC)) +T42A8 001:656.456 - 0.006ms returns 0x20003000 +T42A8 001:656.462 JLINK_ClrBPEx(BPHandle = 0x00000035) +T42A8 001:656.467 - 0.005ms returns 0x00 +T42A8 001:656.474 JLINK_ReadReg(R0) +T42A8 001:656.479 - 0.005ms returns 0x00000000 +T42A8 001:656.858 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:656.866 Data: D2 07 06 D0 49 7E C9 07 03 D0 C1 7B 01 22 11 43 ... +T42A8 001:656.877 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:660.805 - 3.947ms returns 0x100 +T42A8 001:660.835 JLINK_HasError() +T42A8 001:660.858 JLINK_WriteReg(R0, 0x18004E00) +T42A8 001:660.865 - 0.007ms returns 0 +T42A8 001:660.885 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:660.892 - 0.006ms returns 0 +T42A8 001:660.899 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:660.903 - 0.004ms returns 0 +T42A8 001:660.909 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:660.939 - 0.030ms returns 0 +T42A8 001:660.954 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:660.965 - 0.011ms returns 0 +T42A8 001:660.979 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:661.006 - 0.027ms returns 0 +T42A8 001:661.014 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:661.019 - 0.005ms returns 0 +T42A8 001:661.026 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:661.046 - 0.019ms returns 0 +T42A8 001:661.065 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:661.070 - 0.005ms returns 0 +T42A8 001:661.076 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:661.081 - 0.004ms returns 0 +T42A8 001:661.104 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:661.109 - 0.005ms returns 0 +T42A8 001:661.129 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:661.133 - 0.004ms returns 0 +T42A8 001:661.140 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:661.145 - 0.004ms returns 0 +T42A8 001:661.152 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:661.157 - 0.005ms returns 0 +T42A8 001:661.164 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:661.168 - 0.004ms returns 0 +T42A8 001:661.174 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:661.179 - 0.004ms returns 0 +T42A8 001:661.186 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:661.190 - 0.004ms returns 0 +T42A8 001:661.196 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:661.201 - 0.004ms returns 0 +T42A8 001:661.207 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:661.211 - 0.004ms returns 0 +T42A8 001:661.217 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:661.222 - 0.004ms returns 0 +T42A8 001:661.230 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:661.238 - 0.008ms returns 0x00000036 +T42A8 001:661.245 JLINK_Go() +T42A8 001:661.263 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:667.267 - 6.022ms +T42A8 001:667.280 JLINK_IsHalted() +T42A8 001:667.952 - 0.672ms returns FALSE +T42A8 001:667.964 JLINK_HasError() +T42A8 001:669.791 JLINK_IsHalted() +T42A8 001:675.766 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:676.352 - 6.560ms returns TRUE +T42A8 001:676.364 JLINK_ReadReg(R15 (PC)) +T42A8 001:676.371 - 0.006ms returns 0x20003000 +T42A8 001:676.378 JLINK_ClrBPEx(BPHandle = 0x00000036) +T42A8 001:676.384 - 0.005ms returns 0x00 +T42A8 001:676.390 JLINK_ReadReg(R0) +T42A8 001:676.396 - 0.005ms returns 0x00000000 +T42A8 001:676.934 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:676.943 Data: 01 21 00 98 01 F0 A5 FE FE BD 00 2C 06 D0 00 23 ... +T42A8 001:676.955 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:680.858 - 3.923ms returns 0x100 +T42A8 001:680.876 JLINK_HasError() +T42A8 001:680.885 JLINK_WriteReg(R0, 0x18004F00) +T42A8 001:680.892 - 0.007ms returns 0 +T42A8 001:680.899 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:680.905 - 0.005ms returns 0 +T42A8 001:680.912 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:680.917 - 0.005ms returns 0 +T42A8 001:680.924 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:680.929 - 0.005ms returns 0 +T42A8 001:680.936 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:680.942 - 0.005ms returns 0 +T42A8 001:680.948 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:680.954 - 0.005ms returns 0 +T42A8 001:680.960 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:680.966 - 0.005ms returns 0 +T42A8 001:680.973 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:680.980 - 0.007ms returns 0 +T42A8 001:680.989 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:680.994 - 0.005ms returns 0 +T42A8 001:681.001 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:681.007 - 0.005ms returns 0 +T42A8 001:681.014 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:681.019 - 0.005ms returns 0 +T42A8 001:681.026 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:681.031 - 0.005ms returns 0 +T42A8 001:681.038 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:681.043 - 0.005ms returns 0 +T42A8 001:681.050 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:681.056 - 0.005ms returns 0 +T42A8 001:681.062 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:681.068 - 0.005ms returns 0 +T42A8 001:681.075 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:681.080 - 0.005ms returns 0 +T42A8 001:681.087 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:681.093 - 0.005ms returns 0 +T42A8 001:681.099 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:681.105 - 0.005ms returns 0 +T42A8 001:681.112 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:681.117 - 0.005ms returns 0 +T42A8 001:681.124 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:681.129 - 0.005ms returns 0 +T42A8 001:681.136 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:681.142 - 0.006ms returns 0x00000037 +T42A8 001:681.149 JLINK_Go() +T42A8 001:681.159 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:687.148 - 5.997ms +T42A8 001:687.161 JLINK_IsHalted() +T42A8 001:687.800 - 0.638ms returns FALSE +T42A8 001:687.814 JLINK_HasError() +T42A8 001:690.868 JLINK_IsHalted() +T42A8 001:696.914 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:697.523 - 6.654ms returns TRUE +T42A8 001:697.542 JLINK_ReadReg(R15 (PC)) +T42A8 001:697.552 - 0.009ms returns 0x20003000 +T42A8 001:697.562 JLINK_ClrBPEx(BPHandle = 0x00000037) +T42A8 001:697.570 - 0.008ms returns 0x00 +T42A8 001:697.648 JLINK_ReadReg(R0) +T42A8 001:697.664 - 0.015ms returns 0x00000000 +T42A8 001:698.203 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:698.215 Data: 0B 98 11 4F 00 28 44 D0 01 21 28 46 01 F0 3C FF ... +T42A8 001:698.231 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:702.084 - 3.881ms returns 0x100 +T42A8 001:702.109 JLINK_HasError() +T42A8 001:702.126 JLINK_WriteReg(R0, 0x18005000) +T42A8 001:702.140 - 0.014ms returns 0 +T42A8 001:702.155 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:702.167 - 0.011ms returns 0 +T42A8 001:702.181 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:702.193 - 0.011ms returns 0 +T42A8 001:702.207 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:702.219 - 0.012ms returns 0 +T42A8 001:702.234 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:702.245 - 0.011ms returns 0 +T42A8 001:702.259 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:702.271 - 0.011ms returns 0 +T42A8 001:702.284 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:702.296 - 0.012ms returns 0 +T42A8 001:702.310 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:702.324 - 0.013ms returns 0 +T42A8 001:702.339 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:702.350 - 0.011ms returns 0 +T42A8 001:702.364 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:702.376 - 0.011ms returns 0 +T42A8 001:702.390 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:702.402 - 0.012ms returns 0 +T42A8 001:702.417 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:702.429 - 0.011ms returns 0 +T42A8 001:702.443 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:702.455 - 0.011ms returns 0 +T42A8 001:702.469 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:702.482 - 0.012ms returns 0 +T42A8 001:702.496 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:702.508 - 0.012ms returns 0 +T42A8 001:702.522 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:702.534 - 0.012ms returns 0 +T42A8 001:702.548 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:702.560 - 0.012ms returns 0 +T42A8 001:702.574 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:702.586 - 0.012ms returns 0 +T42A8 001:702.600 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:702.612 - 0.011ms returns 0 +T42A8 001:702.626 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:702.638 - 0.012ms returns 0 +T42A8 001:702.653 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:702.666 - 0.013ms returns 0x00000038 +T42A8 001:702.680 JLINK_Go() +T42A8 001:702.710 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:708.589 - 5.908ms +T42A8 001:708.619 JLINK_IsHalted() +T42A8 001:709.229 - 0.609ms returns FALSE +T42A8 001:709.250 JLINK_HasError() +T42A8 001:710.960 JLINK_IsHalted() +T42A8 001:717.095 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:717.860 - 6.899ms returns TRUE +T42A8 001:717.893 JLINK_ReadReg(R15 (PC)) +T42A8 001:717.907 - 0.013ms returns 0x20003000 +T42A8 001:717.918 JLINK_ClrBPEx(BPHandle = 0x00000038) +T42A8 001:717.928 - 0.009ms returns 0x00 +T42A8 001:717.939 JLINK_ReadReg(R0) +T42A8 001:717.948 - 0.008ms returns 0x00000000 +T42A8 001:718.638 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:718.656 Data: 30 D0 09 78 0A 29 2D D1 04 46 40 34 A1 79 8D 06 ... +T42A8 001:718.679 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:722.812 - 4.174ms returns 0x100 +T42A8 001:722.850 JLINK_HasError() +T42A8 001:722.865 JLINK_WriteReg(R0, 0x18005100) +T42A8 001:722.878 - 0.013ms returns 0 +T42A8 001:722.975 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:722.994 - 0.019ms returns 0 +T42A8 001:723.006 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:723.015 - 0.009ms returns 0 +T42A8 001:723.026 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:723.034 - 0.008ms returns 0 +T42A8 001:723.044 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:723.052 - 0.008ms returns 0 +T42A8 001:723.063 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:723.071 - 0.008ms returns 0 +T42A8 001:723.081 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:723.090 - 0.008ms returns 0 +T42A8 001:723.100 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:723.110 - 0.009ms returns 0 +T42A8 001:723.120 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:723.128 - 0.008ms returns 0 +T42A8 001:723.139 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:723.147 - 0.008ms returns 0 +T42A8 001:723.158 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:723.166 - 0.008ms returns 0 +T42A8 001:723.177 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:723.185 - 0.008ms returns 0 +T42A8 001:723.196 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:723.205 - 0.008ms returns 0 +T42A8 001:723.216 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:723.225 - 0.009ms returns 0 +T42A8 001:723.236 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:723.245 - 0.008ms returns 0 +T42A8 001:723.256 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:723.264 - 0.009ms returns 0 +T42A8 001:723.275 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:723.283 - 0.008ms returns 0 +T42A8 001:723.294 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:723.302 - 0.008ms returns 0 +T42A8 001:723.313 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:723.321 - 0.008ms returns 0 +T42A8 001:723.332 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:723.340 - 0.008ms returns 0 +T42A8 001:723.352 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:723.363 - 0.011ms returns 0x00000039 +T42A8 001:723.373 JLINK_Go() +T42A8 001:723.392 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:729.822 - 6.447ms +T42A8 001:729.853 JLINK_IsHalted() +T42A8 001:730.645 - 0.790ms returns FALSE +T42A8 001:730.678 JLINK_HasError() +T42A8 001:731.969 JLINK_IsHalted() +T42A8 001:738.148 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:738.913 - 6.943ms returns TRUE +T42A8 001:738.949 JLINK_ReadReg(R15 (PC)) +T42A8 001:738.964 - 0.014ms returns 0x20003000 +T42A8 001:738.977 JLINK_ClrBPEx(BPHandle = 0x00000039) +T42A8 001:738.988 - 0.010ms returns 0x00 +T42A8 001:739.000 JLINK_ReadReg(R0) +T42A8 001:739.011 - 0.010ms returns 0x00000000 +T42A8 001:739.816 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:739.839 Data: FF F7 BF FE AE E7 00 20 03 46 01 46 00 90 01 AA ... +T42A8 001:739.868 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:743.837 - 4.021ms returns 0x100 +T42A8 001:743.859 JLINK_HasError() +T42A8 001:743.868 JLINK_WriteReg(R0, 0x18005200) +T42A8 001:743.877 - 0.009ms returns 0 +T42A8 001:743.883 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:743.888 - 0.005ms returns 0 +T42A8 001:743.894 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:743.899 - 0.005ms returns 0 +T42A8 001:743.905 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:743.910 - 0.004ms returns 0 +T42A8 001:743.920 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:743.928 - 0.007ms returns 0 +T42A8 001:743.934 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:743.939 - 0.005ms returns 0 +T42A8 001:743.945 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:743.950 - 0.005ms returns 0 +T42A8 001:743.977 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:743.983 - 0.006ms returns 0 +T42A8 001:743.990 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:743.995 - 0.005ms returns 0 +T42A8 001:744.001 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:744.006 - 0.004ms returns 0 +T42A8 001:744.012 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:744.017 - 0.005ms returns 0 +T42A8 001:744.023 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:744.028 - 0.005ms returns 0 +T42A8 001:744.034 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:744.046 - 0.011ms returns 0 +T42A8 001:744.052 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:744.058 - 0.005ms returns 0 +T42A8 001:744.064 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:744.069 - 0.005ms returns 0 +T42A8 001:744.076 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:744.081 - 0.005ms returns 0 +T42A8 001:744.087 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:744.092 - 0.005ms returns 0 +T42A8 001:744.098 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:744.104 - 0.005ms returns 0 +T42A8 001:744.110 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:744.115 - 0.005ms returns 0 +T42A8 001:744.121 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:744.126 - 0.005ms returns 0 +T42A8 001:744.133 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:744.139 - 0.006ms returns 0x0000003A +T42A8 001:744.146 JLINK_Go() +T42A8 001:744.157 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:749.991 - 5.845ms +T42A8 001:750.006 JLINK_IsHalted() +T42A8 001:750.676 - 0.669ms returns FALSE +T42A8 001:750.689 JLINK_HasError() +T42A8 001:755.709 JLINK_IsHalted() +T42A8 001:761.766 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:762.454 - 6.743ms returns TRUE +T42A8 001:762.480 JLINK_ReadReg(R15 (PC)) +T42A8 001:762.489 - 0.009ms returns 0x20003000 +T42A8 001:762.496 JLINK_ClrBPEx(BPHandle = 0x0000003A) +T42A8 001:762.502 - 0.005ms returns 0x00 +T42A8 001:762.508 JLINK_ReadReg(R0) +T42A8 001:762.513 - 0.005ms returns 0x00000000 +T42A8 001:763.057 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:763.072 Data: 00 28 01 D0 01 28 49 D1 38 79 C0 1F 0A 28 47 D2 ... +T42A8 001:763.089 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:766.951 - 3.893ms returns 0x100 +T42A8 001:766.974 JLINK_HasError() +T42A8 001:766.983 JLINK_WriteReg(R0, 0x18005300) +T42A8 001:766.992 - 0.009ms returns 0 +T42A8 001:766.999 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:767.004 - 0.005ms returns 0 +T42A8 001:767.010 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:767.015 - 0.004ms returns 0 +T42A8 001:767.021 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:767.026 - 0.005ms returns 0 +T42A8 001:767.032 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:767.046 - 0.013ms returns 0 +T42A8 001:767.052 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:767.058 - 0.005ms returns 0 +T42A8 001:767.064 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:767.069 - 0.005ms returns 0 +T42A8 001:767.075 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:767.080 - 0.005ms returns 0 +T42A8 001:767.087 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:767.092 - 0.005ms returns 0 +T42A8 001:767.098 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:767.103 - 0.005ms returns 0 +T42A8 001:767.109 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:767.114 - 0.005ms returns 0 +T42A8 001:767.121 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:767.126 - 0.005ms returns 0 +T42A8 001:767.132 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:767.137 - 0.005ms returns 0 +T42A8 001:767.144 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:767.149 - 0.005ms returns 0 +T42A8 001:767.155 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:767.160 - 0.005ms returns 0 +T42A8 001:767.167 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:767.172 - 0.005ms returns 0 +T42A8 001:767.178 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:767.183 - 0.005ms returns 0 +T42A8 001:767.190 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:767.194 - 0.005ms returns 0 +T42A8 001:767.204 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:767.212 - 0.007ms returns 0 +T42A8 001:767.218 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:767.223 - 0.005ms returns 0 +T42A8 001:767.230 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:767.236 - 0.006ms returns 0x0000003B +T42A8 001:767.243 JLINK_Go() +T42A8 001:767.255 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:773.485 - 6.241ms +T42A8 001:773.507 JLINK_IsHalted() +T42A8 001:774.118 - 0.610ms returns FALSE +T42A8 001:774.141 JLINK_HasError() +T42A8 001:776.760 JLINK_IsHalted() +T42A8 001:782.758 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:783.402 - 6.642ms returns TRUE +T42A8 001:783.417 JLINK_ReadReg(R15 (PC)) +T42A8 001:783.425 - 0.008ms returns 0x20003000 +T42A8 001:783.433 JLINK_ClrBPEx(BPHandle = 0x0000003B) +T42A8 001:783.438 - 0.005ms returns 0x00 +T42A8 001:783.446 JLINK_ReadReg(R0) +T42A8 001:783.451 - 0.005ms returns 0x00000000 +T42A8 001:783.877 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:783.886 Data: 00 F0 06 FD 00 20 F8 BD 21 69 38 46 1E 31 00 F0 ... +T42A8 001:783.898 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:787.854 - 3.975ms returns 0x100 +T42A8 001:787.867 JLINK_HasError() +T42A8 001:787.875 JLINK_WriteReg(R0, 0x18005400) +T42A8 001:787.882 - 0.007ms returns 0 +T42A8 001:787.889 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:787.894 - 0.005ms returns 0 +T42A8 001:787.901 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:787.907 - 0.005ms returns 0 +T42A8 001:787.914 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:787.919 - 0.005ms returns 0 +T42A8 001:787.926 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:787.931 - 0.005ms returns 0 +T42A8 001:787.937 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:787.943 - 0.005ms returns 0 +T42A8 001:787.949 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:787.955 - 0.005ms returns 0 +T42A8 001:787.961 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:787.966 - 0.005ms returns 0 +T42A8 001:787.973 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:787.978 - 0.005ms returns 0 +T42A8 001:787.985 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:787.990 - 0.005ms returns 0 +T42A8 001:787.997 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:788.003 - 0.005ms returns 0 +T42A8 001:788.010 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:788.015 - 0.005ms returns 0 +T42A8 001:788.022 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:788.027 - 0.005ms returns 0 +T42A8 001:788.034 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:788.040 - 0.006ms returns 0 +T42A8 001:788.047 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:788.053 - 0.005ms returns 0 +T42A8 001:788.060 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:788.065 - 0.005ms returns 0 +T42A8 001:788.072 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:788.077 - 0.005ms returns 0 +T42A8 001:788.084 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:788.090 - 0.005ms returns 0 +T42A8 001:788.097 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:788.102 - 0.005ms returns 0 +T42A8 001:788.109 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:788.114 - 0.005ms returns 0 +T42A8 001:788.122 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:788.128 - 0.006ms returns 0x0000003C +T42A8 001:788.135 JLINK_Go() +T42A8 001:788.144 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:794.171 - 6.036ms +T42A8 001:794.186 JLINK_IsHalted() +T42A8 001:794.833 - 0.647ms returns FALSE +T42A8 001:794.869 JLINK_HasError() +T42A8 001:796.869 JLINK_IsHalted() +T42A8 001:802.903 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:803.508 - 6.638ms returns TRUE +T42A8 001:803.524 JLINK_ReadReg(R15 (PC)) +T42A8 001:803.534 - 0.009ms returns 0x20003000 +T42A8 001:803.544 JLINK_ClrBPEx(BPHandle = 0x0000003C) +T42A8 001:803.552 - 0.007ms returns 0x00 +T42A8 001:803.561 JLINK_ReadReg(R0) +T42A8 001:803.569 - 0.007ms returns 0x00000000 +T42A8 001:805.104 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:805.113 Data: 02 30 C9 1C B8 47 10 22 68 46 21 69 B8 47 28 46 ... +T42A8 001:805.123 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:809.006 - 3.902ms returns 0x100 +T42A8 001:809.019 JLINK_HasError() +T42A8 001:809.026 JLINK_WriteReg(R0, 0x18005500) +T42A8 001:809.035 - 0.009ms returns 0 +T42A8 001:809.044 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:809.049 - 0.005ms returns 0 +T42A8 001:809.056 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:809.061 - 0.005ms returns 0 +T42A8 001:809.068 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:809.073 - 0.004ms returns 0 +T42A8 001:809.080 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:809.084 - 0.004ms returns 0 +T42A8 001:809.091 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:809.096 - 0.005ms returns 0 +T42A8 001:809.103 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:809.108 - 0.004ms returns 0 +T42A8 001:809.115 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:809.120 - 0.005ms returns 0 +T42A8 001:809.127 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:809.132 - 0.005ms returns 0 +T42A8 001:809.139 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:809.144 - 0.004ms returns 0 +T42A8 001:809.151 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:809.156 - 0.004ms returns 0 +T42A8 001:809.163 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:809.168 - 0.004ms returns 0 +T42A8 001:809.175 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:809.180 - 0.004ms returns 0 +T42A8 001:809.187 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:809.192 - 0.005ms returns 0 +T42A8 001:809.250 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:809.258 - 0.008ms returns 0 +T42A8 001:809.265 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:809.270 - 0.005ms returns 0 +T42A8 001:809.276 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:809.281 - 0.005ms returns 0 +T42A8 001:809.287 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:809.292 - 0.004ms returns 0 +T42A8 001:809.298 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:809.303 - 0.004ms returns 0 +T42A8 001:809.309 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:809.314 - 0.004ms returns 0 +T42A8 001:809.320 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:809.326 - 0.006ms returns 0x0000003D +T42A8 001:809.332 JLINK_Go() +T42A8 001:809.341 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:815.342 - 6.009ms +T42A8 001:815.404 JLINK_IsHalted() +T42A8 001:816.222 - 0.817ms returns FALSE +T42A8 001:816.247 JLINK_HasError() +T42A8 001:817.962 JLINK_IsHalted() +T42A8 001:824.095 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:824.672 - 6.708ms returns TRUE +T42A8 001:824.694 JLINK_ReadReg(R15 (PC)) +T42A8 001:824.704 - 0.009ms returns 0x20003000 +T42A8 001:824.712 JLINK_ClrBPEx(BPHandle = 0x0000003D) +T42A8 001:824.720 - 0.008ms returns 0x00 +T42A8 001:824.727 JLINK_ReadReg(R0) +T42A8 001:824.733 - 0.005ms returns 0x00000000 +T42A8 001:825.247 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:825.257 Data: 0A 24 2D E0 30 46 01 F0 23 FC 00 28 28 D1 30 46 ... +T42A8 001:825.272 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:829.166 - 3.918ms returns 0x100 +T42A8 001:829.180 JLINK_HasError() +T42A8 001:829.189 JLINK_WriteReg(R0, 0x18005600) +T42A8 001:829.197 - 0.008ms returns 0 +T42A8 001:829.205 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:829.212 - 0.006ms returns 0 +T42A8 001:829.219 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:829.225 - 0.006ms returns 0 +T42A8 001:829.232 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:829.238 - 0.005ms returns 0 +T42A8 001:829.246 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:829.252 - 0.005ms returns 0 +T42A8 001:829.259 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:829.265 - 0.006ms returns 0 +T42A8 001:829.272 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:829.278 - 0.006ms returns 0 +T42A8 001:829.285 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:829.291 - 0.005ms returns 0 +T42A8 001:829.299 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:829.305 - 0.006ms returns 0 +T42A8 001:829.313 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:829.319 - 0.006ms returns 0 +T42A8 001:829.326 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:829.332 - 0.006ms returns 0 +T42A8 001:829.340 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:829.346 - 0.006ms returns 0 +T42A8 001:829.354 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:829.360 - 0.006ms returns 0 +T42A8 001:829.368 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:829.374 - 0.006ms returns 0 +T42A8 001:829.382 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:829.390 - 0.008ms returns 0 +T42A8 001:829.400 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:829.406 - 0.006ms returns 0 +T42A8 001:829.414 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:829.420 - 0.006ms returns 0 +T42A8 001:829.428 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:829.434 - 0.006ms returns 0 +T42A8 001:829.442 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:829.447 - 0.006ms returns 0 +T42A8 001:829.455 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:829.461 - 0.006ms returns 0 +T42A8 001:829.469 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:829.476 - 0.007ms returns 0x0000003E +T42A8 001:829.484 JLINK_Go() +T42A8 001:829.495 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:835.434 - 5.950ms +T42A8 001:835.447 JLINK_IsHalted() +T42A8 001:836.034 - 0.586ms returns FALSE +T42A8 001:836.046 JLINK_HasError() +T42A8 001:837.652 JLINK_IsHalted() +T42A8 001:843.732 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:844.304 - 6.652ms returns TRUE +T42A8 001:844.315 JLINK_ReadReg(R15 (PC)) +T42A8 001:844.321 - 0.006ms returns 0x20003000 +T42A8 001:844.327 JLINK_ClrBPEx(BPHandle = 0x0000003E) +T42A8 001:844.333 - 0.005ms returns 0x00 +T42A8 001:844.339 JLINK_ReadReg(R0) +T42A8 001:844.344 - 0.004ms returns 0x00000000 +T42A8 001:844.674 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:844.682 Data: 20 7D 48 71 60 7D 88 71 01 98 FF F7 95 FA 01 20 ... +T42A8 001:844.692 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:848.824 - 4.149ms returns 0x100 +T42A8 001:848.912 JLINK_HasError() +T42A8 001:848.921 JLINK_WriteReg(R0, 0x18005700) +T42A8 001:848.930 - 0.009ms returns 0 +T42A8 001:848.950 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:848.955 - 0.005ms returns 0 +T42A8 001:848.960 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:848.965 - 0.004ms returns 0 +T42A8 001:848.971 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:848.976 - 0.004ms returns 0 +T42A8 001:848.982 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:848.987 - 0.005ms returns 0 +T42A8 001:848.993 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:848.998 - 0.004ms returns 0 +T42A8 001:849.003 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:849.008 - 0.004ms returns 0 +T42A8 001:849.014 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:849.019 - 0.004ms returns 0 +T42A8 001:849.025 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:849.030 - 0.005ms returns 0 +T42A8 001:849.035 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:849.040 - 0.004ms returns 0 +T42A8 001:849.046 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:849.050 - 0.004ms returns 0 +T42A8 001:849.056 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:849.061 - 0.005ms returns 0 +T42A8 001:849.067 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:849.072 - 0.004ms returns 0 +T42A8 001:849.078 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:849.083 - 0.006ms returns 0 +T42A8 001:849.089 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:849.094 - 0.004ms returns 0 +T42A8 001:849.101 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:849.106 - 0.005ms returns 0 +T42A8 001:849.112 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:849.117 - 0.004ms returns 0 +T42A8 001:849.123 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:849.128 - 0.005ms returns 0 +T42A8 001:849.134 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:849.139 - 0.004ms returns 0 +T42A8 001:849.145 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:849.150 - 0.004ms returns 0 +T42A8 001:849.156 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:849.163 - 0.006ms returns 0x0000003F +T42A8 001:849.169 JLINK_Go() +T42A8 001:849.180 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:855.554 - 6.384ms +T42A8 001:855.583 JLINK_IsHalted() +T42A8 001:856.385 - 0.801ms returns FALSE +T42A8 001:856.410 JLINK_HasError() +T42A8 001:861.834 JLINK_IsHalted() +T42A8 001:868.043 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:868.630 - 6.795ms returns TRUE +T42A8 001:868.648 JLINK_ReadReg(R15 (PC)) +T42A8 001:868.656 - 0.008ms returns 0x20003000 +T42A8 001:868.663 JLINK_ClrBPEx(BPHandle = 0x0000003F) +T42A8 001:868.669 - 0.005ms returns 0x00 +T42A8 001:868.676 JLINK_ReadReg(R0) +T42A8 001:868.681 - 0.005ms returns 0x00000000 +T42A8 001:869.153 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:869.167 Data: 21 8A 01 70 09 0A 41 70 21 46 08 22 12 31 E8 1C ... +T42A8 001:869.182 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:873.051 - 3.897ms returns 0x100 +T42A8 001:873.064 JLINK_HasError() +T42A8 001:873.072 JLINK_WriteReg(R0, 0x18005800) +T42A8 001:873.080 - 0.007ms returns 0 +T42A8 001:873.086 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:873.092 - 0.005ms returns 0 +T42A8 001:873.099 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:873.104 - 0.005ms returns 0 +T42A8 001:873.110 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:873.116 - 0.005ms returns 0 +T42A8 001:873.122 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:873.128 - 0.005ms returns 0 +T42A8 001:873.134 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:873.139 - 0.005ms returns 0 +T42A8 001:873.147 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:873.153 - 0.005ms returns 0 +T42A8 001:873.160 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:873.165 - 0.005ms returns 0 +T42A8 001:873.172 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:873.177 - 0.005ms returns 0 +T42A8 001:873.184 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:873.190 - 0.005ms returns 0 +T42A8 001:873.196 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:873.202 - 0.005ms returns 0 +T42A8 001:873.209 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:873.214 - 0.005ms returns 0 +T42A8 001:873.221 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:873.226 - 0.005ms returns 0 +T42A8 001:873.233 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:873.239 - 0.006ms returns 0 +T42A8 001:873.246 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:873.252 - 0.005ms returns 0 +T42A8 001:873.258 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:873.264 - 0.005ms returns 0 +T42A8 001:873.271 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:873.276 - 0.005ms returns 0 +T42A8 001:873.283 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:873.289 - 0.005ms returns 0 +T42A8 001:873.296 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:873.301 - 0.005ms returns 0 +T42A8 001:873.308 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:873.313 - 0.005ms returns 0 +T42A8 001:873.320 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:873.327 - 0.006ms returns 0x00000040 +T42A8 001:873.333 JLINK_Go() +T42A8 001:873.344 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:879.381 - 6.047ms +T42A8 001:879.395 JLINK_IsHalted() +T42A8 001:880.031 - 0.635ms returns FALSE +T42A8 001:880.046 JLINK_HasError() +T42A8 001:881.638 JLINK_IsHalted() +T42A8 001:887.902 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:888.762 - 7.123ms returns TRUE +T42A8 001:888.788 JLINK_ReadReg(R15 (PC)) +T42A8 001:888.797 - 0.008ms returns 0x20003000 +T42A8 001:888.803 JLINK_ClrBPEx(BPHandle = 0x00000040) +T42A8 001:888.809 - 0.005ms returns 0x00 +T42A8 001:888.815 JLINK_ReadReg(R0) +T42A8 001:888.820 - 0.005ms returns 0x00000000 +T42A8 001:889.265 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:889.277 Data: 4A 06 06 D4 00 79 40 07 03 D4 03 25 1F E0 08 25 ... +T42A8 001:889.292 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:893.130 - 3.864ms returns 0x100 +T42A8 001:893.151 JLINK_HasError() +T42A8 001:893.160 JLINK_WriteReg(R0, 0x18005900) +T42A8 001:893.170 - 0.009ms returns 0 +T42A8 001:893.177 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:893.182 - 0.005ms returns 0 +T42A8 001:893.188 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:893.194 - 0.005ms returns 0 +T42A8 001:893.200 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:893.205 - 0.005ms returns 0 +T42A8 001:893.211 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:893.216 - 0.005ms returns 0 +T42A8 001:893.222 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:893.227 - 0.005ms returns 0 +T42A8 001:893.233 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:893.238 - 0.004ms returns 0 +T42A8 001:893.244 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:893.249 - 0.005ms returns 0 +T42A8 001:893.255 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:893.261 - 0.005ms returns 0 +T42A8 001:893.267 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:893.272 - 0.005ms returns 0 +T42A8 001:893.279 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:893.284 - 0.005ms returns 0 +T42A8 001:893.294 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:893.301 - 0.007ms returns 0 +T42A8 001:893.308 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:893.313 - 0.005ms returns 0 +T42A8 001:893.319 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:893.325 - 0.005ms returns 0 +T42A8 001:893.331 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:893.336 - 0.005ms returns 0 +T42A8 001:893.343 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:893.348 - 0.005ms returns 0 +T42A8 001:893.355 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:893.360 - 0.005ms returns 0 +T42A8 001:893.366 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:893.372 - 0.005ms returns 0 +T42A8 001:893.378 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:893.383 - 0.005ms returns 0 +T42A8 001:893.390 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:893.395 - 0.005ms returns 0 +T42A8 001:893.402 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:893.408 - 0.006ms returns 0x00000041 +T42A8 001:893.415 JLINK_Go() +T42A8 001:893.426 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:899.461 - 6.045ms +T42A8 001:899.477 JLINK_IsHalted() +T42A8 001:900.066 - 0.588ms returns FALSE +T42A8 001:900.078 JLINK_HasError() +T42A8 001:902.739 JLINK_IsHalted() +T42A8 001:909.034 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:909.634 - 6.895ms returns TRUE +T42A8 001:909.648 JLINK_ReadReg(R15 (PC)) +T42A8 001:909.656 - 0.008ms returns 0x20003000 +T42A8 001:909.664 JLINK_ClrBPEx(BPHandle = 0x00000041) +T42A8 001:909.670 - 0.006ms returns 0x00 +T42A8 001:909.677 JLINK_ReadReg(R0) +T42A8 001:909.682 - 0.005ms returns 0x00000000 +T42A8 001:910.180 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:910.190 Data: 00 25 00 2C 12 D0 21 46 40 31 8B 79 9B 06 0D D5 ... +T42A8 001:910.203 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:914.177 - 3.997ms returns 0x100 +T42A8 001:914.193 JLINK_HasError() +T42A8 001:914.202 JLINK_WriteReg(R0, 0x18005A00) +T42A8 001:914.210 - 0.008ms returns 0 +T42A8 001:914.218 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:914.224 - 0.006ms returns 0 +T42A8 001:914.231 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:914.237 - 0.005ms returns 0 +T42A8 001:914.244 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:914.250 - 0.006ms returns 0 +T42A8 001:914.257 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:914.263 - 0.005ms returns 0 +T42A8 001:914.270 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:914.276 - 0.005ms returns 0 +T42A8 001:914.283 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:914.288 - 0.005ms returns 0 +T42A8 001:914.296 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:914.302 - 0.006ms returns 0 +T42A8 001:914.310 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:914.316 - 0.006ms returns 0 +T42A8 001:914.323 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:914.329 - 0.005ms returns 0 +T42A8 001:914.336 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:914.342 - 0.006ms returns 0 +T42A8 001:914.349 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:914.355 - 0.006ms returns 0 +T42A8 001:914.363 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:914.369 - 0.006ms returns 0 +T42A8 001:914.376 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:914.382 - 0.006ms returns 0 +T42A8 001:914.390 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:914.396 - 0.006ms returns 0 +T42A8 001:914.404 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:914.410 - 0.006ms returns 0 +T42A8 001:914.417 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:914.423 - 0.006ms returns 0 +T42A8 001:914.430 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:914.438 - 0.006ms returns 0 +T42A8 001:914.446 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:914.452 - 0.006ms returns 0 +T42A8 001:914.459 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:914.465 - 0.006ms returns 0 +T42A8 001:914.474 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:914.481 - 0.007ms returns 0x00000042 +T42A8 001:914.572 JLINK_Go() +T42A8 001:914.591 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:920.523 - 5.950ms +T42A8 001:920.551 JLINK_IsHalted() +T42A8 001:921.155 - 0.603ms returns FALSE +T42A8 001:921.174 JLINK_HasError() +T42A8 001:922.486 JLINK_IsHalted() +T42A8 001:928.471 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:929.005 - 6.519ms returns TRUE +T42A8 001:929.016 JLINK_ReadReg(R15 (PC)) +T42A8 001:929.023 - 0.006ms returns 0x20003000 +T42A8 001:929.030 JLINK_ClrBPEx(BPHandle = 0x00000042) +T42A8 001:929.035 - 0.005ms returns 0x00 +T42A8 001:929.041 JLINK_ReadReg(R0) +T42A8 001:929.046 - 0.004ms returns 0x00000000 +T42A8 001:929.481 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:929.489 Data: BF 4B 20 69 06 22 5C 3B 29 46 10 30 98 47 00 21 ... +T42A8 001:929.500 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:933.416 - 3.935ms returns 0x100 +T42A8 001:933.427 JLINK_HasError() +T42A8 001:933.434 JLINK_WriteReg(R0, 0x18005B00) +T42A8 001:933.441 - 0.006ms returns 0 +T42A8 001:933.447 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:933.452 - 0.004ms returns 0 +T42A8 001:933.457 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:933.462 - 0.004ms returns 0 +T42A8 001:933.468 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:933.472 - 0.004ms returns 0 +T42A8 001:933.478 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:933.483 - 0.004ms returns 0 +T42A8 001:933.489 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:933.493 - 0.004ms returns 0 +T42A8 001:933.499 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:933.504 - 0.004ms returns 0 +T42A8 001:933.510 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:933.515 - 0.005ms returns 0 +T42A8 001:933.521 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:933.526 - 0.004ms returns 0 +T42A8 001:933.531 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:933.536 - 0.004ms returns 0 +T42A8 001:933.542 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:933.547 - 0.004ms returns 0 +T42A8 001:933.553 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:933.558 - 0.004ms returns 0 +T42A8 001:933.564 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:933.568 - 0.004ms returns 0 +T42A8 001:933.574 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:933.580 - 0.005ms returns 0 +T42A8 001:933.586 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:933.590 - 0.005ms returns 0 +T42A8 001:933.597 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:933.602 - 0.005ms returns 0 +T42A8 001:933.608 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:933.612 - 0.004ms returns 0 +T42A8 001:933.618 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:933.623 - 0.004ms returns 0 +T42A8 001:933.629 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:933.634 - 0.004ms returns 0 +T42A8 001:933.640 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:933.644 - 0.004ms returns 0 +T42A8 001:933.651 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:933.656 - 0.005ms returns 0x00000043 +T42A8 001:933.663 JLINK_Go() +T42A8 001:933.676 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:940.200 - 6.536ms +T42A8 001:940.226 JLINK_IsHalted() +T42A8 001:940.864 - 0.636ms returns FALSE +T42A8 001:940.895 JLINK_HasError() +T42A8 001:942.605 JLINK_IsHalted() +T42A8 001:948.796 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:949.437 - 6.831ms returns TRUE +T42A8 001:949.454 JLINK_ReadReg(R15 (PC)) +T42A8 001:949.464 - 0.009ms returns 0x20003000 +T42A8 001:949.473 JLINK_ClrBPEx(BPHandle = 0x00000043) +T42A8 001:949.479 - 0.006ms returns 0x00 +T42A8 001:949.487 JLINK_ReadReg(R0) +T42A8 001:949.494 - 0.006ms returns 0x00000000 +T42A8 001:950.055 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:950.070 Data: FF F7 1A F8 40 34 20 78 40 1E 19 28 0D D2 7D 4D ... +T42A8 001:950.089 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:954.095 - 4.039ms returns 0x100 +T42A8 001:954.118 JLINK_HasError() +T42A8 001:954.129 JLINK_WriteReg(R0, 0x18005C00) +T42A8 001:954.140 - 0.010ms returns 0 +T42A8 001:954.148 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:954.155 - 0.006ms returns 0 +T42A8 001:954.164 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:954.170 - 0.006ms returns 0 +T42A8 001:954.178 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:954.185 - 0.006ms returns 0 +T42A8 001:954.193 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:954.200 - 0.006ms returns 0 +T42A8 001:954.208 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:954.214 - 0.006ms returns 0 +T42A8 001:954.223 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:954.230 - 0.007ms returns 0 +T42A8 001:954.238 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:954.251 - 0.012ms returns 0 +T42A8 001:954.260 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:954.267 - 0.007ms returns 0 +T42A8 001:954.275 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:954.281 - 0.006ms returns 0 +T42A8 001:954.290 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:954.296 - 0.006ms returns 0 +T42A8 001:954.305 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:954.311 - 0.006ms returns 0 +T42A8 001:954.320 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:954.326 - 0.006ms returns 0 +T42A8 001:954.335 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:954.345 - 0.010ms returns 0 +T42A8 001:954.354 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:954.361 - 0.006ms returns 0 +T42A8 001:954.369 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:954.376 - 0.007ms returns 0 +T42A8 001:954.385 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:954.392 - 0.007ms returns 0 +T42A8 001:954.401 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:954.408 - 0.007ms returns 0 +T42A8 001:954.416 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:954.423 - 0.006ms returns 0 +T42A8 001:954.432 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:954.438 - 0.006ms returns 0 +T42A8 001:954.448 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:954.456 - 0.008ms returns 0x00000044 +T42A8 001:954.465 JLINK_Go() +T42A8 001:954.479 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:960.412 - 5.929ms +T42A8 001:960.430 JLINK_IsHalted() +T42A8 001:960.976 - 0.542ms returns FALSE +T42A8 001:961.022 JLINK_HasError() +T42A8 001:966.581 JLINK_IsHalted() +T42A8 001:972.959 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:973.644 - 7.062ms returns TRUE +T42A8 001:973.668 JLINK_ReadReg(R15 (PC)) +T42A8 001:973.677 - 0.008ms returns 0x20003000 +T42A8 001:973.683 JLINK_ClrBPEx(BPHandle = 0x00000044) +T42A8 001:973.689 - 0.005ms returns 0x00 +T42A8 001:973.695 JLINK_ReadReg(R0) +T42A8 001:973.701 - 0.005ms returns 0x00000000 +T42A8 001:974.248 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:974.268 Data: 0D F0 FA FC 04 46 0B 20 20 70 20 46 3C 4B 08 22 ... +T42A8 001:974.291 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:978.220 - 3.973ms returns 0x100 +T42A8 001:978.233 JLINK_HasError() +T42A8 001:978.241 JLINK_WriteReg(R0, 0x18005D00) +T42A8 001:978.248 - 0.007ms returns 0 +T42A8 001:978.255 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:978.260 - 0.005ms returns 0 +T42A8 001:978.267 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:978.271 - 0.004ms returns 0 +T42A8 001:978.277 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:978.282 - 0.004ms returns 0 +T42A8 001:978.288 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:978.292 - 0.004ms returns 0 +T42A8 001:978.300 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:978.305 - 0.005ms returns 0 +T42A8 001:978.311 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:978.316 - 0.004ms returns 0 +T42A8 001:978.321 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:978.326 - 0.004ms returns 0 +T42A8 001:978.332 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:978.337 - 0.005ms returns 0 +T42A8 001:978.344 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:978.348 - 0.005ms returns 0 +T42A8 001:978.354 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:978.359 - 0.004ms returns 0 +T42A8 001:978.365 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:978.370 - 0.004ms returns 0 +T42A8 001:978.376 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:978.381 - 0.004ms returns 0 +T42A8 001:978.387 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:978.393 - 0.005ms returns 0 +T42A8 001:978.399 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:978.404 - 0.005ms returns 0 +T42A8 001:978.410 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:978.415 - 0.005ms returns 0 +T42A8 001:978.421 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:978.426 - 0.005ms returns 0 +T42A8 001:978.432 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:978.437 - 0.005ms returns 0 +T42A8 001:978.443 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:978.448 - 0.004ms returns 0 +T42A8 001:978.454 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:978.459 - 0.005ms returns 0 +T42A8 001:978.466 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:978.472 - 0.006ms returns 0x00000045 +T42A8 001:978.533 JLINK_Go() +T42A8 001:978.546 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 001:984.459 - 5.925ms +T42A8 001:984.470 JLINK_IsHalted() +T42A8 001:985.101 - 0.631ms returns FALSE +T42A8 001:985.113 JLINK_HasError() +T42A8 001:986.396 JLINK_IsHalted() +T42A8 001:992.394 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 001:993.012 - 6.616ms returns TRUE +T42A8 001:993.025 JLINK_ReadReg(R15 (PC)) +T42A8 001:993.031 - 0.006ms returns 0x20003000 +T42A8 001:993.038 JLINK_ClrBPEx(BPHandle = 0x00000045) +T42A8 001:993.043 - 0.005ms returns 0x00 +T42A8 001:993.049 JLINK_ReadReg(R0) +T42A8 001:993.054 - 0.004ms returns 0x00000000 +T42A8 001:993.448 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 001:993.456 Data: 75 0F 00 00 17 07 00 00 84 90 00 20 30 75 00 00 ... +T42A8 001:993.466 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 001:997.361 - 3.913ms returns 0x100 +T42A8 001:997.372 JLINK_HasError() +T42A8 001:997.379 JLINK_WriteReg(R0, 0x18005E00) +T42A8 001:997.385 - 0.006ms returns 0 +T42A8 001:997.391 JLINK_WriteReg(R1, 0x00000100) +T42A8 001:997.396 - 0.004ms returns 0 +T42A8 001:997.402 JLINK_WriteReg(R2, 0x200039D4) +T42A8 001:997.407 - 0.004ms returns 0 +T42A8 001:997.412 JLINK_WriteReg(R3, 0x00000000) +T42A8 001:997.417 - 0.004ms returns 0 +T42A8 001:997.423 JLINK_WriteReg(R4, 0x00000000) +T42A8 001:997.427 - 0.004ms returns 0 +T42A8 001:997.433 JLINK_WriteReg(R5, 0x00000000) +T42A8 001:997.438 - 0.004ms returns 0 +T42A8 001:997.443 JLINK_WriteReg(R6, 0x00000000) +T42A8 001:997.448 - 0.004ms returns 0 +T42A8 001:997.454 JLINK_WriteReg(R7, 0x00000000) +T42A8 001:997.459 - 0.004ms returns 0 +T42A8 001:997.465 JLINK_WriteReg(R8, 0x00000000) +T42A8 001:997.469 - 0.004ms returns 0 +T42A8 001:997.475 JLINK_WriteReg(R9, 0x200039B4) +T42A8 001:997.480 - 0.004ms returns 0 +T42A8 001:997.486 JLINK_WriteReg(R10, 0x00000000) +T42A8 001:997.490 - 0.004ms returns 0 +T42A8 001:997.496 JLINK_WriteReg(R11, 0x00000000) +T42A8 001:997.501 - 0.004ms returns 0 +T42A8 001:997.507 JLINK_WriteReg(R12, 0x00000000) +T42A8 001:997.512 - 0.004ms returns 0 +T42A8 001:997.518 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 001:997.523 - 0.005ms returns 0 +T42A8 001:997.529 JLINK_WriteReg(R14, 0x20003001) +T42A8 001:997.534 - 0.004ms returns 0 +T42A8 001:997.540 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 001:997.545 - 0.005ms returns 0 +T42A8 001:997.551 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 001:997.555 - 0.004ms returns 0 +T42A8 001:997.561 JLINK_WriteReg(MSP, 0x20004000) +T42A8 001:997.566 - 0.004ms returns 0 +T42A8 001:997.572 JLINK_WriteReg(PSP, 0x20004000) +T42A8 001:997.577 - 0.004ms returns 0 +T42A8 001:997.582 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 001:997.587 - 0.004ms returns 0 +T42A8 001:997.594 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 001:997.599 - 0.005ms returns 0x00000046 +T42A8 001:997.605 JLINK_Go() +T42A8 001:997.613 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:003.466 - 5.860ms +T42A8 002:003.491 JLINK_IsHalted() +T42A8 002:004.302 - 0.809ms returns FALSE +T42A8 002:004.352 JLINK_HasError() +T42A8 002:006.437 JLINK_IsHalted() +T42A8 002:012.588 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:013.347 - 6.909ms returns TRUE +T42A8 002:013.375 JLINK_ReadReg(R15 (PC)) +T42A8 002:013.385 - 0.009ms returns 0x20003000 +T42A8 002:013.393 JLINK_ClrBPEx(BPHandle = 0x00000046) +T42A8 002:013.399 - 0.006ms returns 0x00 +T42A8 002:013.406 JLINK_ReadReg(R0) +T42A8 002:013.412 - 0.005ms returns 0x00000000 +T42A8 002:013.939 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:013.952 Data: 49 1C 88 42 03 D1 F0 04 C0 0F 80 1C E6 E7 C3 49 ... +T42A8 002:013.968 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:018.028 - 4.089ms returns 0x100 +T42A8 002:018.059 JLINK_HasError() +T42A8 002:018.069 JLINK_WriteReg(R0, 0x18005F00) +T42A8 002:018.079 - 0.010ms returns 0 +T42A8 002:018.087 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:018.094 - 0.006ms returns 0 +T42A8 002:018.103 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:018.109 - 0.006ms returns 0 +T42A8 002:018.118 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:018.128 - 0.010ms returns 0 +T42A8 002:018.139 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:018.146 - 0.006ms returns 0 +T42A8 002:018.156 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:018.162 - 0.006ms returns 0 +T42A8 002:018.171 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:018.178 - 0.007ms returns 0 +T42A8 002:018.186 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:018.192 - 0.006ms returns 0 +T42A8 002:018.200 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:018.206 - 0.006ms returns 0 +T42A8 002:018.213 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:018.220 - 0.006ms returns 0 +T42A8 002:018.228 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:018.234 - 0.006ms returns 0 +T42A8 002:018.242 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:018.248 - 0.005ms returns 0 +T42A8 002:018.256 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:018.262 - 0.006ms returns 0 +T42A8 002:018.270 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:018.276 - 0.006ms returns 0 +T42A8 002:018.284 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:018.290 - 0.006ms returns 0 +T42A8 002:018.299 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:018.305 - 0.006ms returns 0 +T42A8 002:018.314 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:018.320 - 0.006ms returns 0 +T42A8 002:018.327 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:018.333 - 0.006ms returns 0 +T42A8 002:018.342 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:018.348 - 0.006ms returns 0 +T42A8 002:018.355 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:018.361 - 0.006ms returns 0 +T42A8 002:018.370 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:018.377 - 0.007ms returns 0x00000047 +T42A8 002:018.386 JLINK_Go() +T42A8 002:018.399 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:024.526 - 6.139ms +T42A8 002:024.556 JLINK_IsHalted() +T42A8 002:025.253 - 0.695ms returns FALSE +T42A8 002:025.282 JLINK_HasError() +T42A8 002:031.248 JLINK_IsHalted() +T42A8 002:037.244 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:037.896 - 6.647ms returns TRUE +T42A8 002:037.914 JLINK_ReadReg(R15 (PC)) +T42A8 002:037.925 - 0.010ms returns 0x20003000 +T42A8 002:037.935 JLINK_ClrBPEx(BPHandle = 0x00000047) +T42A8 002:037.943 - 0.008ms returns 0x00 +T42A8 002:037.953 JLINK_ReadReg(R0) +T42A8 002:037.961 - 0.007ms returns 0x00000000 +T42A8 002:038.496 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:038.509 Data: 00 20 06 46 00 90 2E E0 40 20 07 B0 F0 BD 29 68 ... +T42A8 002:038.526 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:042.497 - 4.000ms returns 0x100 +T42A8 002:042.515 JLINK_HasError() +T42A8 002:042.526 JLINK_WriteReg(R0, 0x18006000) +T42A8 002:042.536 - 0.010ms returns 0 +T42A8 002:042.545 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:042.553 - 0.007ms returns 0 +T42A8 002:042.562 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:042.569 - 0.007ms returns 0 +T42A8 002:042.578 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:042.585 - 0.007ms returns 0 +T42A8 002:042.594 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:042.602 - 0.007ms returns 0 +T42A8 002:042.611 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:042.618 - 0.007ms returns 0 +T42A8 002:042.628 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:042.635 - 0.007ms returns 0 +T42A8 002:042.645 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:042.652 - 0.007ms returns 0 +T42A8 002:042.661 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:042.668 - 0.007ms returns 0 +T42A8 002:042.677 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:042.684 - 0.007ms returns 0 +T42A8 002:042.694 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:042.701 - 0.007ms returns 0 +T42A8 002:042.710 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:042.718 - 0.007ms returns 0 +T42A8 002:042.728 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:042.735 - 0.007ms returns 0 +T42A8 002:042.745 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:042.753 - 0.008ms returns 0 +T42A8 002:042.762 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:042.770 - 0.007ms returns 0 +T42A8 002:042.780 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:042.787 - 0.007ms returns 0 +T42A8 002:042.796 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:042.804 - 0.007ms returns 0 +T42A8 002:042.813 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:042.824 - 0.010ms returns 0 +T42A8 002:042.836 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:042.844 - 0.007ms returns 0 +T42A8 002:042.853 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:042.860 - 0.007ms returns 0 +T42A8 002:042.872 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:042.881 - 0.010ms returns 0x00000048 +T42A8 002:042.890 JLINK_Go() +T42A8 002:042.904 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:048.914 - 6.022ms +T42A8 002:048.933 JLINK_IsHalted() +T42A8 002:049.568 - 0.634ms returns FALSE +T42A8 002:049.587 JLINK_HasError() +T42A8 002:051.266 JLINK_IsHalted() +T42A8 002:057.228 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:057.864 - 6.597ms returns TRUE +T42A8 002:057.892 JLINK_ReadReg(R15 (PC)) +T42A8 002:057.907 - 0.015ms returns 0x20003000 +T42A8 002:057.923 JLINK_ClrBPEx(BPHandle = 0x00000048) +T42A8 002:057.936 - 0.013ms returns 0x00 +T42A8 002:057.950 JLINK_ReadReg(R0) +T42A8 002:057.962 - 0.011ms returns 0x00000000 +T42A8 002:058.797 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:058.816 Data: 05 D5 03 22 04 21 65 68 23 46 00 20 A8 47 20 46 ... +T42A8 002:058.842 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:063.032 - 4.233ms returns 0x100 +T42A8 002:063.080 JLINK_HasError() +T42A8 002:063.101 JLINK_WriteReg(R0, 0x18006100) +T42A8 002:063.123 - 0.021ms returns 0 +T42A8 002:063.145 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:063.160 - 0.015ms returns 0 +T42A8 002:063.178 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:063.192 - 0.014ms returns 0 +T42A8 002:063.209 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:063.223 - 0.013ms returns 0 +T42A8 002:063.239 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:063.253 - 0.013ms returns 0 +T42A8 002:063.270 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:063.285 - 0.014ms returns 0 +T42A8 002:063.302 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:063.316 - 0.013ms returns 0 +T42A8 002:063.332 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:063.346 - 0.013ms returns 0 +T42A8 002:063.363 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:063.376 - 0.013ms returns 0 +T42A8 002:063.393 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:063.407 - 0.013ms returns 0 +T42A8 002:063.424 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:063.438 - 0.014ms returns 0 +T42A8 002:063.455 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:063.469 - 0.014ms returns 0 +T42A8 002:063.487 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:063.501 - 0.014ms returns 0 +T42A8 002:063.519 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:063.534 - 0.015ms returns 0 +T42A8 002:063.552 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:063.566 - 0.014ms returns 0 +T42A8 002:063.584 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:063.598 - 0.014ms returns 0 +T42A8 002:063.615 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:063.629 - 0.014ms returns 0 +T42A8 002:063.647 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:063.661 - 0.014ms returns 0 +T42A8 002:063.678 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:063.692 - 0.013ms returns 0 +T42A8 002:063.709 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:063.723 - 0.014ms returns 0 +T42A8 002:063.742 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:063.758 - 0.017ms returns 0x00000049 +T42A8 002:063.776 JLINK_Go() +T42A8 002:063.803 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:070.390 - 6.611ms +T42A8 002:070.468 JLINK_IsHalted() +T42A8 002:071.293 - 0.821ms returns FALSE +T42A8 002:071.351 JLINK_HasError() +T42A8 002:090.272 JLINK_IsHalted() +T42A8 002:096.365 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:097.167 - 6.893ms returns TRUE +T42A8 002:097.207 JLINK_ReadReg(R15 (PC)) +T42A8 002:097.224 - 0.017ms returns 0x20003000 +T42A8 002:097.239 JLINK_ClrBPEx(BPHandle = 0x00000049) +T42A8 002:097.252 - 0.012ms returns 0x00 +T42A8 002:097.266 JLINK_ReadReg(R0) +T42A8 002:097.278 - 0.011ms returns 0x00000000 +T42A8 002:098.200 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:098.226 Data: 0E D0 41 18 01 2A 10 D0 18 46 03 4B 10 22 98 47 ... +T42A8 002:098.256 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:102.298 - 4.096ms returns 0x100 +T42A8 002:102.341 JLINK_HasError() +T42A8 002:102.364 JLINK_WriteReg(R0, 0x18006200) +T42A8 002:102.385 - 0.021ms returns 0 +T42A8 002:102.400 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:102.412 - 0.011ms returns 0 +T42A8 002:102.428 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:102.439 - 0.011ms returns 0 +T42A8 002:102.453 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:102.465 - 0.011ms returns 0 +T42A8 002:102.481 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:102.492 - 0.011ms returns 0 +T42A8 002:102.508 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:102.520 - 0.012ms returns 0 +T42A8 002:102.535 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:102.547 - 0.011ms returns 0 +T42A8 002:102.561 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:102.572 - 0.011ms returns 0 +T42A8 002:102.588 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:102.599 - 0.011ms returns 0 +T42A8 002:102.613 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:102.624 - 0.011ms returns 0 +T42A8 002:102.638 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:102.650 - 0.011ms returns 0 +T42A8 002:102.666 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:102.677 - 0.011ms returns 0 +T42A8 002:102.694 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:102.705 - 0.011ms returns 0 +T42A8 002:102.722 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:102.734 - 0.012ms returns 0 +T42A8 002:102.751 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:102.763 - 0.011ms returns 0 +T42A8 002:102.779 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:102.791 - 0.011ms returns 0 +T42A8 002:102.807 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:102.819 - 0.011ms returns 0 +T42A8 002:102.835 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:102.846 - 0.011ms returns 0 +T42A8 002:102.863 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:102.874 - 0.011ms returns 0 +T42A8 002:102.891 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:102.902 - 0.011ms returns 0 +T42A8 002:102.920 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:102.933 - 0.014ms returns 0x0000004A +T42A8 002:102.951 JLINK_Go() +T42A8 002:102.973 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:109.273 - 6.321ms +T42A8 002:109.317 JLINK_IsHalted() +T42A8 002:110.029 - 0.711ms returns FALSE +T42A8 002:110.061 JLINK_HasError() +T42A8 002:112.121 JLINK_IsHalted() +T42A8 002:118.236 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:118.931 - 6.809ms returns TRUE +T42A8 002:118.961 JLINK_ReadReg(R15 (PC)) +T42A8 002:118.981 - 0.019ms returns 0x20003000 +T42A8 002:118.997 JLINK_ClrBPEx(BPHandle = 0x0000004A) +T42A8 002:119.011 - 0.013ms returns 0x00 +T42A8 002:119.027 JLINK_ReadReg(R0) +T42A8 002:119.041 - 0.013ms returns 0x00000000 +T42A8 002:119.968 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:119.991 Data: 09 2C 09 D0 0C 2C 0A D0 0D 2C 0A D0 00 07 80 0F ... +T42A8 002:120.022 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:124.008 - 4.041ms returns 0x100 +T42A8 002:124.037 JLINK_HasError() +T42A8 002:124.054 JLINK_WriteReg(R0, 0x18006300) +T42A8 002:124.070 - 0.016ms returns 0 +T42A8 002:124.085 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:124.096 - 0.011ms returns 0 +T42A8 002:124.110 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:124.121 - 0.011ms returns 0 +T42A8 002:124.135 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:124.146 - 0.011ms returns 0 +T42A8 002:124.160 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:124.171 - 0.011ms returns 0 +T42A8 002:124.185 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:124.197 - 0.012ms returns 0 +T42A8 002:124.211 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:124.222 - 0.011ms returns 0 +T42A8 002:124.236 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:124.248 - 0.011ms returns 0 +T42A8 002:124.262 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:124.273 - 0.011ms returns 0 +T42A8 002:124.286 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:124.298 - 0.011ms returns 0 +T42A8 002:124.312 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:124.323 - 0.011ms returns 0 +T42A8 002:124.337 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:124.349 - 0.011ms returns 0 +T42A8 002:124.363 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:124.375 - 0.011ms returns 0 +T42A8 002:124.389 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:124.402 - 0.012ms returns 0 +T42A8 002:124.421 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:124.436 - 0.015ms returns 0 +T42A8 002:124.451 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:124.462 - 0.011ms returns 0 +T42A8 002:124.477 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:124.489 - 0.011ms returns 0 +T42A8 002:124.503 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:124.514 - 0.011ms returns 0 +T42A8 002:124.529 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:124.540 - 0.011ms returns 0 +T42A8 002:124.555 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:124.567 - 0.011ms returns 0 +T42A8 002:124.582 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:124.595 - 0.014ms returns 0x0000004B +T42A8 002:124.610 JLINK_Go() +T42A8 002:124.631 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:130.789 - 6.178ms +T42A8 002:130.816 JLINK_IsHalted() +T42A8 002:131.502 - 0.685ms returns FALSE +T42A8 002:131.528 JLINK_HasError() +T42A8 002:135.137 JLINK_IsHalted() +T42A8 002:141.292 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:141.961 - 6.823ms returns TRUE +T42A8 002:141.994 JLINK_ReadReg(R15 (PC)) +T42A8 002:142.012 - 0.017ms returns 0x20003000 +T42A8 002:142.031 JLINK_ClrBPEx(BPHandle = 0x0000004B) +T42A8 002:142.045 - 0.014ms returns 0x00 +T42A8 002:142.063 JLINK_ReadReg(R0) +T42A8 002:142.075 - 0.011ms returns 0x00000000 +T42A8 002:142.900 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:142.919 Data: 00 29 0A D0 B1 42 08 D2 70 1A C0 B2 06 28 04 D9 ... +T42A8 002:142.944 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:146.948 - 4.049ms returns 0x100 +T42A8 002:146.959 JLINK_HasError() +T42A8 002:146.967 JLINK_WriteReg(R0, 0x18006400) +T42A8 002:146.974 - 0.006ms returns 0 +T42A8 002:146.980 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:146.985 - 0.004ms returns 0 +T42A8 002:146.991 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:147.019 - 0.027ms returns 0 +T42A8 002:147.025 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:147.029 - 0.004ms returns 0 +T42A8 002:147.036 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:147.040 - 0.004ms returns 0 +T42A8 002:147.059 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:147.064 - 0.004ms returns 0 +T42A8 002:147.069 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:147.074 - 0.004ms returns 0 +T42A8 002:147.080 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:147.084 - 0.004ms returns 0 +T42A8 002:147.090 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:147.095 - 0.004ms returns 0 +T42A8 002:147.101 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:147.105 - 0.004ms returns 0 +T42A8 002:147.111 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:147.116 - 0.004ms returns 0 +T42A8 002:147.121 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:147.126 - 0.004ms returns 0 +T42A8 002:147.132 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:147.136 - 0.004ms returns 0 +T42A8 002:147.142 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:147.147 - 0.005ms returns 0 +T42A8 002:147.153 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:147.158 - 0.004ms returns 0 +T42A8 002:147.163 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:147.168 - 0.004ms returns 0 +T42A8 002:147.174 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:147.178 - 0.004ms returns 0 +T42A8 002:147.184 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:147.189 - 0.004ms returns 0 +T42A8 002:147.194 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:147.199 - 0.004ms returns 0 +T42A8 002:147.205 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:147.210 - 0.005ms returns 0 +T42A8 002:147.217 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:147.222 - 0.005ms returns 0x0000004C +T42A8 002:147.228 JLINK_Go() +T42A8 002:147.236 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:153.357 - 6.128ms +T42A8 002:153.378 JLINK_IsHalted() +T42A8 002:154.044 - 0.665ms returns FALSE +T42A8 002:154.057 JLINK_HasError() +T42A8 002:155.980 JLINK_IsHalted() +T42A8 002:162.113 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:162.883 - 6.903ms returns TRUE +T42A8 002:162.908 JLINK_ReadReg(R15 (PC)) +T42A8 002:162.916 - 0.009ms returns 0x20003000 +T42A8 002:162.932 JLINK_ClrBPEx(BPHandle = 0x0000004C) +T42A8 002:162.939 - 0.006ms returns 0x00 +T42A8 002:162.945 JLINK_ReadReg(R0) +T42A8 002:162.950 - 0.005ms returns 0x00000000 +T42A8 002:163.402 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:163.414 Data: 00 91 E1 05 04 D5 03 22 00 99 52 02 11 43 00 91 ... +T42A8 002:163.429 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:167.484 - 4.082ms returns 0x100 +T42A8 002:167.513 JLINK_HasError() +T42A8 002:167.522 JLINK_WriteReg(R0, 0x18006500) +T42A8 002:167.531 - 0.009ms returns 0 +T42A8 002:167.537 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:167.543 - 0.005ms returns 0 +T42A8 002:167.623 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:167.634 - 0.011ms returns 0 +T42A8 002:167.642 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:167.647 - 0.005ms returns 0 +T42A8 002:167.654 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:167.659 - 0.005ms returns 0 +T42A8 002:167.665 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:167.670 - 0.005ms returns 0 +T42A8 002:167.677 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:167.682 - 0.005ms returns 0 +T42A8 002:167.689 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:167.694 - 0.005ms returns 0 +T42A8 002:167.700 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:167.705 - 0.005ms returns 0 +T42A8 002:167.711 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:167.716 - 0.005ms returns 0 +T42A8 002:167.723 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:167.728 - 0.005ms returns 0 +T42A8 002:167.734 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:167.740 - 0.005ms returns 0 +T42A8 002:167.746 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:167.751 - 0.005ms returns 0 +T42A8 002:167.758 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:167.764 - 0.005ms returns 0 +T42A8 002:167.770 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:167.776 - 0.005ms returns 0 +T42A8 002:167.782 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:167.788 - 0.005ms returns 0 +T42A8 002:167.794 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:167.799 - 0.005ms returns 0 +T42A8 002:167.806 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:167.811 - 0.005ms returns 0 +T42A8 002:167.817 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:167.822 - 0.005ms returns 0 +T42A8 002:167.829 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:167.835 - 0.006ms returns 0 +T42A8 002:167.842 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:167.848 - 0.007ms returns 0x0000004D +T42A8 002:167.855 JLINK_Go() +T42A8 002:167.867 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:174.049 - 6.193ms +T42A8 002:174.073 JLINK_IsHalted() +T42A8 002:174.688 - 0.614ms returns FALSE +T42A8 002:174.705 JLINK_HasError() +T42A8 002:175.994 JLINK_IsHalted() +T42A8 002:182.063 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:182.791 - 6.796ms returns TRUE +T42A8 002:182.816 JLINK_ReadReg(R15 (PC)) +T42A8 002:182.824 - 0.008ms returns 0x20003000 +T42A8 002:182.831 JLINK_ClrBPEx(BPHandle = 0x0000004D) +T42A8 002:182.836 - 0.005ms returns 0x00 +T42A8 002:182.842 JLINK_ReadReg(R0) +T42A8 002:182.847 - 0.004ms returns 0x00000000 +T42A8 002:183.306 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:183.319 Data: 40 21 01 70 EC E7 44 4D 00 9A 02 23 AA 58 81 1D ... +T42A8 002:183.334 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:187.250 - 3.942ms returns 0x100 +T42A8 002:187.276 JLINK_HasError() +T42A8 002:187.285 JLINK_WriteReg(R0, 0x18006600) +T42A8 002:187.294 - 0.009ms returns 0 +T42A8 002:187.301 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:187.306 - 0.005ms returns 0 +T42A8 002:187.313 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:187.318 - 0.005ms returns 0 +T42A8 002:187.324 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:187.329 - 0.005ms returns 0 +T42A8 002:187.335 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:187.340 - 0.005ms returns 0 +T42A8 002:187.347 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:187.352 - 0.005ms returns 0 +T42A8 002:187.358 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:187.363 - 0.005ms returns 0 +T42A8 002:187.370 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:187.374 - 0.005ms returns 0 +T42A8 002:187.381 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:187.386 - 0.005ms returns 0 +T42A8 002:187.392 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:187.397 - 0.005ms returns 0 +T42A8 002:187.403 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:187.412 - 0.008ms returns 0 +T42A8 002:187.420 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:187.426 - 0.005ms returns 0 +T42A8 002:187.432 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:187.437 - 0.005ms returns 0 +T42A8 002:187.443 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:187.449 - 0.006ms returns 0 +T42A8 002:187.455 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:187.460 - 0.005ms returns 0 +T42A8 002:187.467 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:187.472 - 0.005ms returns 0 +T42A8 002:187.478 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:187.483 - 0.005ms returns 0 +T42A8 002:187.489 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:187.494 - 0.005ms returns 0 +T42A8 002:187.501 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:187.506 - 0.005ms returns 0 +T42A8 002:187.512 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:187.517 - 0.005ms returns 0 +T42A8 002:187.524 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:187.530 - 0.006ms returns 0x0000004E +T42A8 002:187.536 JLINK_Go() +T42A8 002:187.548 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:193.847 - 6.310ms +T42A8 002:193.873 JLINK_IsHalted() +T42A8 002:194.584 - 0.709ms returns FALSE +T42A8 002:194.600 JLINK_HasError() +T42A8 002:200.182 JLINK_IsHalted() +T42A8 002:206.318 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:207.063 - 6.881ms returns TRUE +T42A8 002:207.093 JLINK_ReadReg(R15 (PC)) +T42A8 002:207.104 - 0.010ms returns 0x20003000 +T42A8 002:207.112 JLINK_ClrBPEx(BPHandle = 0x0000004E) +T42A8 002:207.119 - 0.007ms returns 0x00 +T42A8 002:207.127 JLINK_ReadReg(R0) +T42A8 002:207.134 - 0.006ms returns 0x00000000 +T42A8 002:207.826 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:207.847 Data: FF F7 B6 FF 64 1C E4 B2 03 2C EC D3 F8 BD 00 00 ... +T42A8 002:207.868 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:211.935 - 4.108ms returns 0x100 +T42A8 002:211.962 JLINK_HasError() +T42A8 002:211.973 JLINK_WriteReg(R0, 0x18006700) +T42A8 002:212.002 - 0.024ms returns 0 +T42A8 002:212.013 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:212.019 - 0.007ms returns 0 +T42A8 002:212.029 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:212.035 - 0.006ms returns 0 +T42A8 002:212.042 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:212.048 - 0.005ms returns 0 +T42A8 002:212.057 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:212.063 - 0.006ms returns 0 +T42A8 002:212.071 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:212.077 - 0.006ms returns 0 +T42A8 002:212.084 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:212.090 - 0.006ms returns 0 +T42A8 002:212.099 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:212.105 - 0.006ms returns 0 +T42A8 002:212.113 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:212.119 - 0.006ms returns 0 +T42A8 002:212.126 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:212.132 - 0.005ms returns 0 +T42A8 002:212.139 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:212.146 - 0.006ms returns 0 +T42A8 002:212.153 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:212.159 - 0.006ms returns 0 +T42A8 002:212.167 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:212.173 - 0.006ms returns 0 +T42A8 002:212.181 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:212.188 - 0.007ms returns 0 +T42A8 002:212.196 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:212.202 - 0.006ms returns 0 +T42A8 002:212.210 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:212.216 - 0.006ms returns 0 +T42A8 002:212.223 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:212.230 - 0.006ms returns 0 +T42A8 002:212.237 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:212.243 - 0.006ms returns 0 +T42A8 002:212.251 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:212.257 - 0.006ms returns 0 +T42A8 002:212.264 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:212.270 - 0.006ms returns 0 +T42A8 002:212.279 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:212.286 - 0.007ms returns 0x0000004F +T42A8 002:212.294 JLINK_Go() +T42A8 002:212.307 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:218.636 - 6.338ms +T42A8 002:218.685 JLINK_IsHalted() +T42A8 002:219.364 - 0.678ms returns FALSE +T42A8 002:219.379 JLINK_HasError() +T42A8 002:220.999 JLINK_IsHalted() +T42A8 002:227.059 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:227.708 - 6.708ms returns TRUE +T42A8 002:227.723 JLINK_ReadReg(R15 (PC)) +T42A8 002:227.732 - 0.009ms returns 0x20003000 +T42A8 002:227.741 JLINK_ClrBPEx(BPHandle = 0x0000004F) +T42A8 002:227.749 - 0.007ms returns 0x00 +T42A8 002:227.757 JLINK_ReadReg(R0) +T42A8 002:227.765 - 0.007ms returns 0x00000000 +T42A8 002:228.381 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:228.392 Data: 93 42 04 D1 C0 88 88 42 01 D1 01 20 70 47 00 20 ... +T42A8 002:228.408 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:232.350 - 3.969ms returns 0x100 +T42A8 002:232.364 JLINK_HasError() +T42A8 002:232.373 JLINK_WriteReg(R0, 0x18006800) +T42A8 002:232.382 - 0.008ms returns 0 +T42A8 002:232.390 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:232.397 - 0.006ms returns 0 +T42A8 002:232.405 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:232.412 - 0.006ms returns 0 +T42A8 002:232.420 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:232.426 - 0.006ms returns 0 +T42A8 002:232.435 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:232.441 - 0.006ms returns 0 +T42A8 002:232.449 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:232.456 - 0.006ms returns 0 +T42A8 002:232.464 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:232.471 - 0.007ms returns 0 +T42A8 002:232.480 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:232.486 - 0.006ms returns 0 +T42A8 002:232.494 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:232.501 - 0.006ms returns 0 +T42A8 002:232.509 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:232.516 - 0.006ms returns 0 +T42A8 002:232.524 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:232.530 - 0.006ms returns 0 +T42A8 002:232.539 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:232.546 - 0.006ms returns 0 +T42A8 002:232.554 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:232.561 - 0.006ms returns 0 +T42A8 002:232.569 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:232.576 - 0.007ms returns 0 +T42A8 002:232.585 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:232.592 - 0.006ms returns 0 +T42A8 002:232.600 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:232.607 - 0.007ms returns 0 +T42A8 002:232.616 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:232.622 - 0.006ms returns 0 +T42A8 002:232.631 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:232.638 - 0.007ms returns 0 +T42A8 002:232.646 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:232.653 - 0.006ms returns 0 +T42A8 002:232.661 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:232.668 - 0.006ms returns 0 +T42A8 002:232.677 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:232.684 - 0.008ms returns 0x00000050 +T42A8 002:232.693 JLINK_Go() +T42A8 002:232.704 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:238.895 - 6.202ms +T42A8 002:238.911 JLINK_IsHalted() +T42A8 002:239.589 - 0.678ms returns FALSE +T42A8 002:239.604 JLINK_HasError() +T42A8 002:241.925 JLINK_IsHalted() +T42A8 002:247.834 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:248.464 - 6.539ms returns TRUE +T42A8 002:248.485 JLINK_ReadReg(R15 (PC)) +T42A8 002:248.496 - 0.010ms returns 0x20003000 +T42A8 002:248.507 JLINK_ClrBPEx(BPHandle = 0x00000050) +T42A8 002:248.516 - 0.009ms returns 0x00 +T42A8 002:248.600 JLINK_ReadReg(R0) +T42A8 002:248.616 - 0.015ms returns 0x00000000 +T42A8 002:249.214 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:249.228 Data: 29 FE A1 00 64 1C E4 B2 68 50 08 2C F7 D3 3B 46 ... +T42A8 002:249.246 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:253.179 - 3.965ms returns 0x100 +T42A8 002:253.197 JLINK_HasError() +T42A8 002:253.209 JLINK_WriteReg(R0, 0x18006900) +T42A8 002:253.219 - 0.010ms returns 0 +T42A8 002:253.230 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:253.238 - 0.008ms returns 0 +T42A8 002:253.249 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:253.257 - 0.008ms returns 0 +T42A8 002:253.267 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:253.275 - 0.008ms returns 0 +T42A8 002:253.286 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:253.294 - 0.008ms returns 0 +T42A8 002:253.304 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:253.313 - 0.008ms returns 0 +T42A8 002:253.324 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:253.332 - 0.008ms returns 0 +T42A8 002:253.345 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:253.356 - 0.010ms returns 0 +T42A8 002:253.366 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:253.375 - 0.008ms returns 0 +T42A8 002:253.385 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:253.393 - 0.008ms returns 0 +T42A8 002:253.404 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:253.412 - 0.008ms returns 0 +T42A8 002:253.450 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:253.458 - 0.009ms returns 0 +T42A8 002:253.469 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:253.478 - 0.008ms returns 0 +T42A8 002:253.488 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:253.498 - 0.009ms returns 0 +T42A8 002:253.508 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:253.517 - 0.008ms returns 0 +T42A8 002:253.528 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:253.536 - 0.008ms returns 0 +T42A8 002:253.547 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:253.556 - 0.008ms returns 0 +T42A8 002:253.566 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:253.575 - 0.008ms returns 0 +T42A8 002:253.585 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:253.594 - 0.008ms returns 0 +T42A8 002:253.604 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:253.612 - 0.008ms returns 0 +T42A8 002:253.624 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:253.635 - 0.011ms returns 0x00000051 +T42A8 002:253.645 JLINK_Go() +T42A8 002:253.660 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:259.578 - 5.931ms +T42A8 002:259.598 JLINK_IsHalted() +T42A8 002:260.242 - 0.643ms returns FALSE +T42A8 002:260.260 JLINK_HasError() +T42A8 002:263.863 JLINK_IsHalted() +T42A8 002:269.922 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:270.556 - 6.692ms returns TRUE +T42A8 002:270.574 JLINK_ReadReg(R15 (PC)) +T42A8 002:270.586 - 0.011ms returns 0x20003000 +T42A8 002:270.597 JLINK_ClrBPEx(BPHandle = 0x00000051) +T42A8 002:270.606 - 0.009ms returns 0x00 +T42A8 002:270.618 JLINK_ReadReg(R0) +T42A8 002:270.627 - 0.009ms returns 0x00000000 +T42A8 002:271.265 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:271.279 Data: 0B 9B 0A 9A FF F7 24 FF 04 46 32 46 18 30 10 23 ... +T42A8 002:271.298 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:275.233 - 3.968ms returns 0x100 +T42A8 002:275.255 JLINK_HasError() +T42A8 002:275.268 JLINK_WriteReg(R0, 0x18006A00) +T42A8 002:275.279 - 0.010ms returns 0 +T42A8 002:275.290 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:275.299 - 0.009ms returns 0 +T42A8 002:275.311 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:275.320 - 0.009ms returns 0 +T42A8 002:275.332 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:275.341 - 0.009ms returns 0 +T42A8 002:275.355 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:275.364 - 0.008ms returns 0 +T42A8 002:275.449 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:275.464 - 0.015ms returns 0 +T42A8 002:275.476 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:275.484 - 0.008ms returns 0 +T42A8 002:275.495 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:275.503 - 0.008ms returns 0 +T42A8 002:275.513 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:275.522 - 0.008ms returns 0 +T42A8 002:275.532 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:275.540 - 0.008ms returns 0 +T42A8 002:275.550 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:275.559 - 0.008ms returns 0 +T42A8 002:275.570 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:275.578 - 0.008ms returns 0 +T42A8 002:275.589 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:275.598 - 0.008ms returns 0 +T42A8 002:275.609 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:275.618 - 0.009ms returns 0 +T42A8 002:275.628 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:275.637 - 0.008ms returns 0 +T42A8 002:275.648 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:275.656 - 0.008ms returns 0 +T42A8 002:275.667 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:275.675 - 0.008ms returns 0 +T42A8 002:275.686 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:275.695 - 0.008ms returns 0 +T42A8 002:275.705 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:275.714 - 0.008ms returns 0 +T42A8 002:275.724 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:275.733 - 0.008ms returns 0 +T42A8 002:275.753 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:275.768 - 0.024ms returns 0x00000052 +T42A8 002:275.782 JLINK_Go() +T42A8 002:275.798 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:281.817 - 6.034ms +T42A8 002:281.834 JLINK_IsHalted() +T42A8 002:282.510 - 0.675ms returns FALSE +T42A8 002:282.527 JLINK_HasError() +T42A8 002:283.836 JLINK_IsHalted() +T42A8 002:289.873 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:290.522 - 6.685ms returns TRUE +T42A8 002:290.545 JLINK_ReadReg(R15 (PC)) +T42A8 002:290.557 - 0.013ms returns 0x20003000 +T42A8 002:290.569 JLINK_ClrBPEx(BPHandle = 0x00000052) +T42A8 002:290.579 - 0.010ms returns 0x00 +T42A8 002:290.591 JLINK_ReadReg(R0) +T42A8 002:290.601 - 0.009ms returns 0x00000000 +T42A8 002:292.213 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:292.234 Data: 06 2C 05 D0 07 2C 03 D0 08 78 19 46 FF F7 C1 FF ... +T42A8 002:292.258 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:296.208 - 3.996ms returns 0x100 +T42A8 002:296.230 JLINK_HasError() +T42A8 002:296.245 JLINK_WriteReg(R0, 0x18006B00) +T42A8 002:296.257 - 0.012ms returns 0 +T42A8 002:296.270 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:296.280 - 0.009ms returns 0 +T42A8 002:296.291 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:296.301 - 0.009ms returns 0 +T42A8 002:296.313 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:296.323 - 0.010ms returns 0 +T42A8 002:296.335 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:296.345 - 0.009ms returns 0 +T42A8 002:296.356 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:296.366 - 0.009ms returns 0 +T42A8 002:296.378 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:296.387 - 0.009ms returns 0 +T42A8 002:296.399 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:296.408 - 0.009ms returns 0 +T42A8 002:296.420 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:296.429 - 0.009ms returns 0 +T42A8 002:296.441 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:296.450 - 0.009ms returns 0 +T42A8 002:296.462 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:296.472 - 0.010ms returns 0 +T42A8 002:296.485 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:296.495 - 0.010ms returns 0 +T42A8 002:296.507 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:296.517 - 0.010ms returns 0 +T42A8 002:296.529 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:296.540 - 0.010ms returns 0 +T42A8 002:296.552 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:296.562 - 0.009ms returns 0 +T42A8 002:296.574 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:296.584 - 0.010ms returns 0 +T42A8 002:296.596 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:296.606 - 0.010ms returns 0 +T42A8 002:296.618 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:296.628 - 0.009ms returns 0 +T42A8 002:296.640 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:296.650 - 0.010ms returns 0 +T42A8 002:296.662 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:296.672 - 0.010ms returns 0 +T42A8 002:296.686 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:296.704 - 0.018ms returns 0x00000053 +T42A8 002:296.716 JLINK_Go() +T42A8 002:296.734 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:302.748 - 6.031ms +T42A8 002:302.771 JLINK_IsHalted() +T42A8 002:303.449 - 0.677ms returns FALSE +T42A8 002:303.471 JLINK_HasError() +T42A8 002:311.856 JLINK_IsHalted() +T42A8 002:318.062 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:318.851 - 6.994ms returns TRUE +T42A8 002:318.886 JLINK_ReadReg(R15 (PC)) +T42A8 002:318.902 - 0.015ms returns 0x20003000 +T42A8 002:318.915 JLINK_ClrBPEx(BPHandle = 0x00000053) +T42A8 002:318.926 - 0.011ms returns 0x00 +T42A8 002:318.939 JLINK_ReadReg(R0) +T42A8 002:318.950 - 0.010ms returns 0x00000000 +T42A8 002:319.797 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:319.819 Data: 70 B5 05 02 ED 1D 16 46 0C 46 28 46 0C F0 DB FD ... +T42A8 002:319.845 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:323.901 - 4.104ms returns 0x100 +T42A8 002:323.939 JLINK_HasError() +T42A8 002:323.955 JLINK_WriteReg(R0, 0x18006C00) +T42A8 002:323.972 - 0.016ms returns 0 +T42A8 002:323.985 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:323.997 - 0.011ms returns 0 +T42A8 002:324.015 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:324.027 - 0.011ms returns 0 +T42A8 002:324.042 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:324.071 - 0.029ms returns 0 +T42A8 002:324.093 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:324.105 - 0.011ms returns 0 +T42A8 002:324.119 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:324.128 - 0.009ms returns 0 +T42A8 002:324.140 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:324.150 - 0.009ms returns 0 +T42A8 002:324.162 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:324.171 - 0.009ms returns 0 +T42A8 002:324.183 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:324.192 - 0.009ms returns 0 +T42A8 002:324.204 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:324.213 - 0.009ms returns 0 +T42A8 002:324.225 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:324.235 - 0.009ms returns 0 +T42A8 002:324.247 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:324.256 - 0.009ms returns 0 +T42A8 002:324.268 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:324.277 - 0.009ms returns 0 +T42A8 002:324.289 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:324.300 - 0.010ms returns 0 +T42A8 002:324.311 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:324.321 - 0.009ms returns 0 +T42A8 002:324.333 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:324.342 - 0.009ms returns 0 +T42A8 002:324.354 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:324.364 - 0.009ms returns 0 +T42A8 002:324.376 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:324.385 - 0.009ms returns 0 +T42A8 002:324.397 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:324.406 - 0.009ms returns 0 +T42A8 002:324.418 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:324.428 - 0.009ms returns 0 +T42A8 002:324.441 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:324.452 - 0.012ms returns 0x00000054 +T42A8 002:324.464 JLINK_Go() +T42A8 002:324.485 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:330.822 - 6.356ms +T42A8 002:330.865 JLINK_IsHalted() +T42A8 002:331.669 - 0.802ms returns FALSE +T42A8 002:331.710 JLINK_HasError() +T42A8 002:333.617 JLINK_IsHalted() +T42A8 002:339.725 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:340.374 - 6.756ms returns TRUE +T42A8 002:340.396 JLINK_ReadReg(R15 (PC)) +T42A8 002:340.409 - 0.013ms returns 0x20003000 +T42A8 002:340.423 JLINK_ClrBPEx(BPHandle = 0x00000054) +T42A8 002:340.433 - 0.010ms returns 0x00 +T42A8 002:340.446 JLINK_ReadReg(R0) +T42A8 002:340.456 - 0.010ms returns 0x00000000 +T42A8 002:341.263 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:341.280 Data: E9 1D 80 1C 0C F0 CB FD F8 BD FF B5 81 B0 05 46 ... +T42A8 002:341.301 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:345.236 - 3.972ms returns 0x100 +T42A8 002:345.257 JLINK_HasError() +T42A8 002:345.270 JLINK_WriteReg(R0, 0x18006D00) +T42A8 002:345.282 - 0.012ms returns 0 +T42A8 002:345.295 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:345.305 - 0.010ms returns 0 +T42A8 002:345.318 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:345.328 - 0.010ms returns 0 +T42A8 002:345.340 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:345.350 - 0.009ms returns 0 +T42A8 002:345.362 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:345.372 - 0.009ms returns 0 +T42A8 002:345.383 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:345.393 - 0.009ms returns 0 +T42A8 002:345.405 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:345.414 - 0.009ms returns 0 +T42A8 002:345.426 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:345.435 - 0.009ms returns 0 +T42A8 002:345.447 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:345.457 - 0.009ms returns 0 +T42A8 002:345.468 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:345.478 - 0.009ms returns 0 +T42A8 002:345.490 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:345.500 - 0.010ms returns 0 +T42A8 002:345.512 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:345.522 - 0.009ms returns 0 +T42A8 002:345.534 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:345.544 - 0.010ms returns 0 +T42A8 002:345.557 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:345.576 - 0.019ms returns 0 +T42A8 002:345.589 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:345.599 - 0.010ms returns 0 +T42A8 002:345.611 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:345.621 - 0.010ms returns 0 +T42A8 002:345.633 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:345.643 - 0.010ms returns 0 +T42A8 002:345.656 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:345.672 - 0.017ms returns 0 +T42A8 002:345.685 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:345.695 - 0.010ms returns 0 +T42A8 002:345.707 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:345.717 - 0.009ms returns 0 +T42A8 002:345.730 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:345.741 - 0.011ms returns 0x00000055 +T42A8 002:345.753 JLINK_Go() +T42A8 002:345.771 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:351.907 - 6.153ms +T42A8 002:351.927 JLINK_IsHalted() +T42A8 002:352.585 - 0.657ms returns FALSE +T42A8 002:352.607 JLINK_HasError() +T42A8 002:355.614 JLINK_IsHalted() +T42A8 002:361.676 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:362.327 - 6.712ms returns TRUE +T42A8 002:362.352 JLINK_ReadReg(R15 (PC)) +T42A8 002:362.364 - 0.012ms returns 0x20003000 +T42A8 002:362.377 JLINK_ClrBPEx(BPHandle = 0x00000055) +T42A8 002:362.388 - 0.010ms returns 0x00 +T42A8 002:362.402 JLINK_ReadReg(R0) +T42A8 002:362.412 - 0.010ms returns 0x00000000 +T42A8 002:363.096 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:363.112 Data: 30 46 0C F0 92 FC 20 46 05 B0 F0 BD FF E7 FF 24 ... +T42A8 002:363.133 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:367.073 - 3.977ms returns 0x100 +T42A8 002:367.093 JLINK_HasError() +T42A8 002:367.107 JLINK_WriteReg(R0, 0x18006E00) +T42A8 002:367.119 - 0.012ms returns 0 +T42A8 002:367.132 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:367.142 - 0.010ms returns 0 +T42A8 002:367.154 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:367.164 - 0.010ms returns 0 +T42A8 002:367.176 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:367.185 - 0.009ms returns 0 +T42A8 002:367.197 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:367.206 - 0.009ms returns 0 +T42A8 002:367.218 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:367.228 - 0.009ms returns 0 +T42A8 002:367.239 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:367.249 - 0.009ms returns 0 +T42A8 002:367.261 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:367.270 - 0.009ms returns 0 +T42A8 002:367.282 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:367.291 - 0.009ms returns 0 +T42A8 002:367.304 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:367.313 - 0.010ms returns 0 +T42A8 002:367.326 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:367.336 - 0.010ms returns 0 +T42A8 002:367.348 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:367.358 - 0.010ms returns 0 +T42A8 002:367.370 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:367.380 - 0.009ms returns 0 +T42A8 002:367.392 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:367.402 - 0.010ms returns 0 +T42A8 002:367.415 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:367.424 - 0.010ms returns 0 +T42A8 002:367.437 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:367.447 - 0.010ms returns 0 +T42A8 002:367.459 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:367.469 - 0.010ms returns 0 +T42A8 002:367.483 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:367.493 - 0.010ms returns 0 +T42A8 002:367.513 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:367.523 - 0.011ms returns 0 +T42A8 002:367.536 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:367.546 - 0.010ms returns 0 +T42A8 002:367.559 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:367.570 - 0.011ms returns 0x00000056 +T42A8 002:367.582 JLINK_Go() +T42A8 002:367.598 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:373.608 - 6.025ms +T42A8 002:373.630 JLINK_IsHalted() +T42A8 002:374.248 - 0.617ms returns FALSE +T42A8 002:374.269 JLINK_HasError() +T42A8 002:375.560 JLINK_IsHalted() +T42A8 002:381.534 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:382.047 - 6.487ms returns TRUE +T42A8 002:382.060 JLINK_ReadReg(R15 (PC)) +T42A8 002:382.067 - 0.006ms returns 0x20003000 +T42A8 002:382.074 JLINK_ClrBPEx(BPHandle = 0x00000056) +T42A8 002:382.079 - 0.005ms returns 0x00 +T42A8 002:382.085 JLINK_ReadReg(R0) +T42A8 002:382.090 - 0.005ms returns 0x00000000 +T42A8 002:382.508 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:382.517 Data: 03 D0 40 31 88 79 80 07 80 0F 70 47 01 46 00 20 ... +T42A8 002:382.528 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:386.371 - 3.859ms returns 0x100 +T42A8 002:386.416 JLINK_HasError() +T42A8 002:386.425 JLINK_WriteReg(R0, 0x18006F00) +T42A8 002:386.431 - 0.006ms returns 0 +T42A8 002:386.437 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:386.442 - 0.004ms returns 0 +T42A8 002:386.448 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:386.456 - 0.008ms returns 0 +T42A8 002:386.462 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:386.467 - 0.004ms returns 0 +T42A8 002:386.473 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:386.477 - 0.004ms returns 0 +T42A8 002:386.483 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:386.488 - 0.004ms returns 0 +T42A8 002:386.494 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:386.498 - 0.004ms returns 0 +T42A8 002:386.504 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:386.509 - 0.004ms returns 0 +T42A8 002:386.514 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:386.519 - 0.004ms returns 0 +T42A8 002:386.525 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:386.529 - 0.004ms returns 0 +T42A8 002:386.535 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:386.540 - 0.004ms returns 0 +T42A8 002:386.545 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:386.550 - 0.004ms returns 0 +T42A8 002:386.556 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:386.560 - 0.004ms returns 0 +T42A8 002:386.566 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:386.571 - 0.005ms returns 0 +T42A8 002:386.577 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:386.582 - 0.004ms returns 0 +T42A8 002:386.588 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:386.592 - 0.004ms returns 0 +T42A8 002:386.598 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:386.603 - 0.004ms returns 0 +T42A8 002:386.608 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:386.613 - 0.004ms returns 0 +T42A8 002:386.619 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:386.624 - 0.004ms returns 0 +T42A8 002:386.629 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:386.634 - 0.004ms returns 0 +T42A8 002:386.640 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:386.645 - 0.005ms returns 0x00000057 +T42A8 002:386.651 JLINK_Go() +T42A8 002:386.660 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:392.583 - 5.931ms +T42A8 002:392.597 JLINK_IsHalted() +T42A8 002:393.275 - 0.678ms returns FALSE +T42A8 002:393.286 JLINK_HasError() +T42A8 002:394.574 JLINK_IsHalted() +T42A8 002:400.577 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:401.312 - 6.736ms returns TRUE +T42A8 002:401.336 JLINK_ReadReg(R15 (PC)) +T42A8 002:401.344 - 0.008ms returns 0x20003000 +T42A8 002:401.351 JLINK_ClrBPEx(BPHandle = 0x00000057) +T42A8 002:401.357 - 0.005ms returns 0x00 +T42A8 002:401.363 JLINK_ReadReg(R0) +T42A8 002:401.368 - 0.005ms returns 0x00000000 +T42A8 002:401.891 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:401.904 Data: 30 20 0C F0 B9 FA 30 22 70 4B 05 46 00 21 98 47 ... +T42A8 002:401.920 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:405.896 - 4.004ms returns 0x100 +T42A8 002:405.919 JLINK_HasError() +T42A8 002:405.927 JLINK_WriteReg(R0, 0x18007000) +T42A8 002:405.936 - 0.008ms returns 0 +T42A8 002:405.942 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:405.947 - 0.005ms returns 0 +T42A8 002:405.953 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:405.957 - 0.004ms returns 0 +T42A8 002:405.963 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:405.968 - 0.004ms returns 0 +T42A8 002:405.973 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:405.978 - 0.004ms returns 0 +T42A8 002:405.984 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:405.989 - 0.004ms returns 0 +T42A8 002:405.995 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:405.999 - 0.004ms returns 0 +T42A8 002:406.005 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:406.010 - 0.004ms returns 0 +T42A8 002:406.016 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:406.020 - 0.004ms returns 0 +T42A8 002:406.026 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:406.031 - 0.004ms returns 0 +T42A8 002:406.036 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:406.041 - 0.004ms returns 0 +T42A8 002:406.047 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:406.052 - 0.004ms returns 0 +T42A8 002:406.058 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:406.063 - 0.004ms returns 0 +T42A8 002:406.069 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:406.074 - 0.005ms returns 0 +T42A8 002:406.098 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:406.106 - 0.007ms returns 0 +T42A8 002:406.113 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:406.118 - 0.006ms returns 0 +T42A8 002:406.124 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:406.129 - 0.004ms returns 0 +T42A8 002:406.135 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:406.140 - 0.004ms returns 0 +T42A8 002:406.146 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:406.150 - 0.004ms returns 0 +T42A8 002:406.156 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:406.161 - 0.004ms returns 0 +T42A8 002:406.168 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:406.174 - 0.006ms returns 0x00000058 +T42A8 002:406.180 JLINK_Go() +T42A8 002:406.191 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:412.661 - 6.480ms +T42A8 002:412.684 JLINK_IsHalted() +T42A8 002:413.442 - 0.757ms returns FALSE +T42A8 002:413.467 JLINK_HasError() +T42A8 002:418.654 JLINK_IsHalted() +T42A8 002:424.891 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:425.578 - 6.923ms returns TRUE +T42A8 002:425.610 JLINK_ReadReg(R15 (PC)) +T42A8 002:425.618 - 0.008ms returns 0x20003000 +T42A8 002:425.625 JLINK_ClrBPEx(BPHandle = 0x00000058) +T42A8 002:425.630 - 0.005ms returns 0x00 +T42A8 002:425.637 JLINK_ReadReg(R0) +T42A8 002:425.642 - 0.005ms returns 0x00000000 +T42A8 002:426.109 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:426.122 Data: EF D3 30 46 00 F0 5C FD 2F 4F 07 E0 40 88 00 28 ... +T42A8 002:426.143 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:430.200 - 4.090ms returns 0x100 +T42A8 002:430.222 JLINK_HasError() +T42A8 002:430.231 JLINK_WriteReg(R0, 0x18007100) +T42A8 002:430.240 - 0.008ms returns 0 +T42A8 002:430.246 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:430.251 - 0.005ms returns 0 +T42A8 002:430.257 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:430.262 - 0.004ms returns 0 +T42A8 002:430.268 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:430.273 - 0.004ms returns 0 +T42A8 002:430.281 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:430.287 - 0.005ms returns 0 +T42A8 002:430.293 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:430.298 - 0.005ms returns 0 +T42A8 002:430.304 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:430.309 - 0.004ms returns 0 +T42A8 002:430.317 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:430.324 - 0.007ms returns 0 +T42A8 002:430.338 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:430.344 - 0.013ms returns 0 +T42A8 002:430.350 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:430.355 - 0.005ms returns 0 +T42A8 002:430.362 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:430.367 - 0.005ms returns 0 +T42A8 002:430.373 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:430.378 - 0.005ms returns 0 +T42A8 002:430.385 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:430.391 - 0.005ms returns 0 +T42A8 002:430.397 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:430.403 - 0.005ms returns 0 +T42A8 002:430.409 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:430.414 - 0.005ms returns 0 +T42A8 002:430.420 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:430.426 - 0.005ms returns 0 +T42A8 002:430.432 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:430.437 - 0.005ms returns 0 +T42A8 002:430.443 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:430.448 - 0.005ms returns 0 +T42A8 002:430.454 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:430.459 - 0.004ms returns 0 +T42A8 002:430.465 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:430.470 - 0.005ms returns 0 +T42A8 002:430.477 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:430.483 - 0.006ms returns 0x00000059 +T42A8 002:430.490 JLINK_Go() +T42A8 002:430.502 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:436.619 - 6.128ms +T42A8 002:436.635 JLINK_IsHalted() +T42A8 002:437.319 - 0.683ms returns FALSE +T42A8 002:437.331 JLINK_HasError() +T42A8 002:438.429 JLINK_IsHalted() +T42A8 002:444.436 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:445.109 - 6.679ms returns TRUE +T42A8 002:445.121 JLINK_ReadReg(R15 (PC)) +T42A8 002:445.129 - 0.007ms returns 0x20003000 +T42A8 002:445.136 JLINK_ClrBPEx(BPHandle = 0x00000059) +T42A8 002:445.142 - 0.006ms returns 0x00 +T42A8 002:445.149 JLINK_ReadReg(R0) +T42A8 002:445.159 - 0.010ms returns 0x00000000 +T42A8 002:445.646 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:445.655 Data: 41 74 98 4A A1 00 50 50 10 BD F8 B5 06 46 C8 B2 ... +T42A8 002:445.667 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:449.510 - 3.863ms returns 0x100 +T42A8 002:449.521 JLINK_HasError() +T42A8 002:449.529 JLINK_WriteReg(R0, 0x18007200) +T42A8 002:449.536 - 0.006ms returns 0 +T42A8 002:449.542 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:449.548 - 0.005ms returns 0 +T42A8 002:449.554 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:449.560 - 0.005ms returns 0 +T42A8 002:449.566 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:449.572 - 0.005ms returns 0 +T42A8 002:449.578 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:449.583 - 0.005ms returns 0 +T42A8 002:449.590 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:449.595 - 0.005ms returns 0 +T42A8 002:449.602 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:449.607 - 0.005ms returns 0 +T42A8 002:449.614 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:449.619 - 0.005ms returns 0 +T42A8 002:449.626 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:449.631 - 0.005ms returns 0 +T42A8 002:449.638 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:449.643 - 0.005ms returns 0 +T42A8 002:449.650 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:449.655 - 0.005ms returns 0 +T42A8 002:449.662 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:449.667 - 0.005ms returns 0 +T42A8 002:449.674 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:449.680 - 0.005ms returns 0 +T42A8 002:449.686 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:449.693 - 0.006ms returns 0 +T42A8 002:449.699 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:449.705 - 0.005ms returns 0 +T42A8 002:449.712 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:449.718 - 0.005ms returns 0 +T42A8 002:449.724 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:449.730 - 0.005ms returns 0 +T42A8 002:449.736 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:449.742 - 0.005ms returns 0 +T42A8 002:449.748 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:449.754 - 0.005ms returns 0 +T42A8 002:449.760 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:449.766 - 0.005ms returns 0 +T42A8 002:449.773 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:449.779 - 0.006ms returns 0x0000005A +T42A8 002:449.786 JLINK_Go() +T42A8 002:449.795 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:455.928 - 6.142ms +T42A8 002:455.944 JLINK_IsHalted() +T42A8 002:456.631 - 0.687ms returns FALSE +T42A8 002:456.646 JLINK_HasError() +T42A8 002:460.296 JLINK_IsHalted() +T42A8 002:466.336 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:466.899 - 6.604ms returns TRUE +T42A8 002:466.910 JLINK_ReadReg(R15 (PC)) +T42A8 002:466.917 - 0.006ms returns 0x20003000 +T42A8 002:466.923 JLINK_ClrBPEx(BPHandle = 0x0000005A) +T42A8 002:466.928 - 0.005ms returns 0x00 +T42A8 002:466.934 JLINK_ReadReg(R0) +T42A8 002:466.940 - 0.004ms returns 0x00000000 +T42A8 002:467.342 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:467.350 Data: 5F D0 34 68 00 2C 04 D0 06 98 00 28 01 D0 01 20 ... +T42A8 002:467.361 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:471.383 - 4.040ms returns 0x100 +T42A8 002:471.409 JLINK_HasError() +T42A8 002:471.418 JLINK_WriteReg(R0, 0x18007300) +T42A8 002:471.427 - 0.009ms returns 0 +T42A8 002:471.434 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:471.439 - 0.005ms returns 0 +T42A8 002:471.446 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:471.451 - 0.005ms returns 0 +T42A8 002:471.457 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:471.462 - 0.005ms returns 0 +T42A8 002:471.468 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:471.473 - 0.005ms returns 0 +T42A8 002:471.479 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:471.484 - 0.005ms returns 0 +T42A8 002:471.491 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:471.496 - 0.005ms returns 0 +T42A8 002:471.503 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:471.508 - 0.005ms returns 0 +T42A8 002:471.514 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:471.519 - 0.005ms returns 0 +T42A8 002:471.525 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:471.530 - 0.005ms returns 0 +T42A8 002:471.536 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:471.547 - 0.010ms returns 0 +T42A8 002:471.554 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:471.559 - 0.005ms returns 0 +T42A8 002:471.565 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:471.570 - 0.005ms returns 0 +T42A8 002:471.577 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:471.583 - 0.006ms returns 0 +T42A8 002:471.589 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:471.595 - 0.005ms returns 0 +T42A8 002:471.601 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:471.606 - 0.005ms returns 0 +T42A8 002:471.613 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:471.618 - 0.005ms returns 0 +T42A8 002:471.624 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:471.629 - 0.005ms returns 0 +T42A8 002:471.636 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:471.641 - 0.005ms returns 0 +T42A8 002:471.647 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:471.652 - 0.005ms returns 0 +T42A8 002:471.660 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:471.666 - 0.006ms returns 0x0000005B +T42A8 002:471.672 JLINK_Go() +T42A8 002:471.685 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:478.184 - 6.511ms +T42A8 002:478.222 JLINK_IsHalted() +T42A8 002:479.036 - 0.813ms returns FALSE +T42A8 002:479.062 JLINK_HasError() +T42A8 002:480.427 JLINK_IsHalted() +T42A8 002:486.499 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:487.249 - 6.820ms returns TRUE +T42A8 002:487.290 JLINK_ReadReg(R15 (PC)) +T42A8 002:487.310 - 0.020ms returns 0x20003000 +T42A8 002:487.324 JLINK_ClrBPEx(BPHandle = 0x0000005B) +T42A8 002:487.333 - 0.008ms returns 0x00 +T42A8 002:487.344 JLINK_ReadReg(R0) +T42A8 002:487.351 - 0.007ms returns 0x00000000 +T42A8 002:488.448 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:488.467 Data: 05 72 08 30 70 BD 70 B5 0D 46 11 46 09 31 8B B2 ... +T42A8 002:488.488 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:492.540 - 4.092ms returns 0x100 +T42A8 002:492.569 JLINK_HasError() +T42A8 002:492.581 JLINK_WriteReg(R0, 0x18007400) +T42A8 002:492.593 - 0.012ms returns 0 +T42A8 002:492.603 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:492.610 - 0.007ms returns 0 +T42A8 002:492.620 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:492.627 - 0.007ms returns 0 +T42A8 002:492.636 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:492.644 - 0.007ms returns 0 +T42A8 002:492.653 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:492.660 - 0.007ms returns 0 +T42A8 002:492.669 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:492.676 - 0.007ms returns 0 +T42A8 002:492.686 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:492.694 - 0.007ms returns 0 +T42A8 002:492.703 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:492.710 - 0.007ms returns 0 +T42A8 002:492.720 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:492.727 - 0.007ms returns 0 +T42A8 002:492.736 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:492.744 - 0.007ms returns 0 +T42A8 002:492.753 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:492.760 - 0.007ms returns 0 +T42A8 002:492.770 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:492.777 - 0.007ms returns 0 +T42A8 002:492.787 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:492.794 - 0.007ms returns 0 +T42A8 002:492.805 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:492.819 - 0.015ms returns 0 +T42A8 002:492.829 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:492.836 - 0.007ms returns 0 +T42A8 002:492.846 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:492.854 - 0.007ms returns 0 +T42A8 002:492.863 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:492.870 - 0.007ms returns 0 +T42A8 002:492.880 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:492.887 - 0.007ms returns 0 +T42A8 002:492.896 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:492.904 - 0.007ms returns 0 +T42A8 002:492.913 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:492.921 - 0.007ms returns 0 +T42A8 002:492.931 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:492.940 - 0.009ms returns 0x0000005C +T42A8 002:492.949 JLINK_Go() +T42A8 002:492.965 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:499.078 - 6.127ms +T42A8 002:499.095 JLINK_IsHalted() +T42A8 002:499.775 - 0.679ms returns FALSE +T42A8 002:499.792 JLINK_HasError() +T42A8 002:501.231 JLINK_IsHalted() +T42A8 002:507.322 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:507.934 - 6.702ms returns TRUE +T42A8 002:507.960 JLINK_ReadReg(R15 (PC)) +T42A8 002:507.975 - 0.014ms returns 0x20003000 +T42A8 002:507.990 JLINK_ClrBPEx(BPHandle = 0x0000005C) +T42A8 002:508.002 - 0.012ms returns 0x00 +T42A8 002:508.016 JLINK_ReadReg(R0) +T42A8 002:508.028 - 0.011ms returns 0x00000000 +T42A8 002:509.398 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:509.422 Data: 81 80 12 21 01 72 45 72 08 21 41 81 21 88 81 81 ... +T42A8 002:509.451 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:513.522 - 4.123ms returns 0x100 +T42A8 002:513.551 JLINK_HasError() +T42A8 002:513.568 JLINK_WriteReg(R0, 0x18007500) +T42A8 002:513.582 - 0.014ms returns 0 +T42A8 002:513.597 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:513.609 - 0.012ms returns 0 +T42A8 002:513.626 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:513.639 - 0.012ms returns 0 +T42A8 002:513.655 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:513.667 - 0.011ms returns 0 +T42A8 002:513.684 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:513.696 - 0.011ms returns 0 +T42A8 002:513.713 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:513.725 - 0.011ms returns 0 +T42A8 002:513.742 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:513.754 - 0.011ms returns 0 +T42A8 002:513.770 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:513.782 - 0.012ms returns 0 +T42A8 002:513.799 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:513.810 - 0.011ms returns 0 +T42A8 002:513.827 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:513.839 - 0.011ms returns 0 +T42A8 002:513.856 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:513.867 - 0.011ms returns 0 +T42A8 002:513.884 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:513.896 - 0.011ms returns 0 +T42A8 002:513.910 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:513.922 - 0.011ms returns 0 +T42A8 002:513.938 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:513.950 - 0.012ms returns 0 +T42A8 002:513.965 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:513.977 - 0.011ms returns 0 +T42A8 002:513.992 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:514.003 - 0.011ms returns 0 +T42A8 002:514.020 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:514.031 - 0.011ms returns 0 +T42A8 002:514.045 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:514.057 - 0.011ms returns 0 +T42A8 002:514.071 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:514.083 - 0.011ms returns 0 +T42A8 002:514.099 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:514.121 - 0.021ms returns 0 +T42A8 002:514.137 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:514.150 - 0.014ms returns 0x0000005D +T42A8 002:514.253 JLINK_Go() +T42A8 002:514.283 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:520.377 - 6.124ms +T42A8 002:520.402 JLINK_IsHalted() +T42A8 002:521.050 - 0.648ms returns FALSE +T42A8 002:521.074 JLINK_HasError() +T42A8 002:531.266 JLINK_IsHalted() +T42A8 002:537.480 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:538.264 - 6.996ms returns TRUE +T42A8 002:538.304 JLINK_ReadReg(R15 (PC)) +T42A8 002:538.322 - 0.017ms returns 0x20003000 +T42A8 002:538.336 JLINK_ClrBPEx(BPHandle = 0x0000005D) +T42A8 002:538.349 - 0.012ms returns 0x00 +T42A8 002:538.364 JLINK_ReadReg(R0) +T42A8 002:538.376 - 0.011ms returns 0x00000000 +T42A8 002:539.357 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:539.381 Data: 0B E0 00 23 61 78 1A 46 28 46 FF F7 37 FF 04 E0 ... +T42A8 002:539.446 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:543.442 - 4.084ms returns 0x100 +T42A8 002:543.487 JLINK_HasError() +T42A8 002:543.505 JLINK_WriteReg(R0, 0x18007600) +T42A8 002:543.523 - 0.017ms returns 0 +T42A8 002:543.540 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:543.552 - 0.012ms returns 0 +T42A8 002:543.569 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:543.580 - 0.011ms returns 0 +T42A8 002:543.595 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:543.606 - 0.011ms returns 0 +T42A8 002:543.624 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:543.635 - 0.011ms returns 0 +T42A8 002:543.649 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:543.660 - 0.011ms returns 0 +T42A8 002:543.675 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:543.766 - 0.090ms returns 0 +T42A8 002:543.786 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:543.797 - 0.011ms returns 0 +T42A8 002:543.811 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:543.823 - 0.011ms returns 0 +T42A8 002:543.839 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:543.850 - 0.011ms returns 0 +T42A8 002:543.867 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:543.878 - 0.011ms returns 0 +T42A8 002:543.896 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:543.907 - 0.011ms returns 0 +T42A8 002:543.923 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:543.934 - 0.011ms returns 0 +T42A8 002:543.949 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:543.961 - 0.012ms returns 0 +T42A8 002:543.978 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:543.989 - 0.011ms returns 0 +T42A8 002:544.006 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:544.017 - 0.011ms returns 0 +T42A8 002:544.050 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:544.063 - 0.012ms returns 0 +T42A8 002:544.080 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:544.092 - 0.012ms returns 0 +T42A8 002:544.109 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:544.121 - 0.012ms returns 0 +T42A8 002:544.138 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:544.149 - 0.011ms returns 0 +T42A8 002:544.165 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:544.179 - 0.014ms returns 0x0000005E +T42A8 002:544.196 JLINK_Go() +T42A8 002:544.220 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:550.762 - 6.564ms +T42A8 002:550.807 JLINK_IsHalted() +T42A8 002:551.606 - 0.797ms returns FALSE +T42A8 002:551.650 JLINK_HasError() +T42A8 002:553.208 JLINK_IsHalted() +T42A8 002:559.440 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:560.104 - 6.895ms returns TRUE +T42A8 002:560.130 JLINK_ReadReg(R15 (PC)) +T42A8 002:560.146 - 0.015ms returns 0x20003000 +T42A8 002:560.161 JLINK_ClrBPEx(BPHandle = 0x0000005E) +T42A8 002:560.174 - 0.012ms returns 0x00 +T42A8 002:560.189 JLINK_ReadReg(R0) +T42A8 002:560.201 - 0.012ms returns 0x00000000 +T42A8 002:561.114 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:561.133 Data: 10 2E 04 D1 28 46 FF F7 BF FF 06 46 0C 35 B4 42 ... +T42A8 002:561.159 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:565.110 - 3.996ms returns 0x100 +T42A8 002:565.134 JLINK_HasError() +T42A8 002:565.150 JLINK_WriteReg(R0, 0x18007700) +T42A8 002:565.165 - 0.014ms returns 0 +T42A8 002:565.180 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:565.192 - 0.012ms returns 0 +T42A8 002:565.206 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:565.218 - 0.011ms returns 0 +T42A8 002:565.232 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:565.243 - 0.011ms returns 0 +T42A8 002:565.257 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:565.269 - 0.012ms returns 0 +T42A8 002:565.284 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:565.295 - 0.011ms returns 0 +T42A8 002:565.310 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:565.322 - 0.011ms returns 0 +T42A8 002:565.336 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:565.347 - 0.011ms returns 0 +T42A8 002:565.361 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:565.373 - 0.011ms returns 0 +T42A8 002:565.387 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:565.399 - 0.011ms returns 0 +T42A8 002:565.413 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:565.425 - 0.011ms returns 0 +T42A8 002:565.439 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:565.450 - 0.011ms returns 0 +T42A8 002:565.465 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:565.476 - 0.011ms returns 0 +T42A8 002:565.491 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:565.504 - 0.012ms returns 0 +T42A8 002:565.518 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:565.530 - 0.011ms returns 0 +T42A8 002:565.544 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:565.556 - 0.011ms returns 0 +T42A8 002:565.570 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:565.582 - 0.012ms returns 0 +T42A8 002:565.596 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:565.608 - 0.011ms returns 0 +T42A8 002:565.622 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:565.634 - 0.011ms returns 0 +T42A8 002:565.648 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:565.659 - 0.011ms returns 0 +T42A8 002:565.675 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:565.694 - 0.019ms returns 0x0000005F +T42A8 002:565.708 JLINK_Go() +T42A8 002:565.728 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:571.836 - 6.126ms +T42A8 002:571.859 JLINK_IsHalted() +T42A8 002:572.553 - 0.692ms returns FALSE +T42A8 002:572.576 JLINK_HasError() +T42A8 002:580.108 JLINK_IsHalted() +T42A8 002:586.140 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:586.789 - 6.680ms returns TRUE +T42A8 002:586.800 JLINK_ReadReg(R15 (PC)) +T42A8 002:586.806 - 0.006ms returns 0x20003000 +T42A8 002:586.812 JLINK_ClrBPEx(BPHandle = 0x0000005F) +T42A8 002:586.818 - 0.005ms returns 0x00 +T42A8 002:586.824 JLINK_ReadReg(R0) +T42A8 002:586.829 - 0.005ms returns 0x00000000 +T42A8 002:587.191 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:587.199 Data: 10 18 60 4A 52 1E 91 42 17 D1 80 88 00 21 FE F7 ... +T42A8 002:587.210 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:591.041 - 3.849ms returns 0x100 +T42A8 002:591.056 JLINK_HasError() +T42A8 002:591.083 JLINK_WriteReg(R0, 0x18007800) +T42A8 002:591.090 - 0.006ms returns 0 +T42A8 002:591.096 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:591.101 - 0.005ms returns 0 +T42A8 002:591.107 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:591.112 - 0.004ms returns 0 +T42A8 002:591.118 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:591.139 - 0.021ms returns 0 +T42A8 002:591.145 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:591.166 - 0.022ms returns 0 +T42A8 002:591.172 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:591.177 - 0.004ms returns 0 +T42A8 002:591.199 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:591.204 - 0.020ms returns 0 +T42A8 002:591.210 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:591.214 - 0.004ms returns 0 +T42A8 002:591.220 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:591.225 - 0.004ms returns 0 +T42A8 002:591.230 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:591.235 - 0.004ms returns 0 +T42A8 002:591.241 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:591.245 - 0.004ms returns 0 +T42A8 002:591.251 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:591.256 - 0.004ms returns 0 +T42A8 002:591.261 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:591.266 - 0.004ms returns 0 +T42A8 002:591.272 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:591.277 - 0.005ms returns 0 +T42A8 002:591.282 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:591.287 - 0.004ms returns 0 +T42A8 002:591.293 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:591.298 - 0.004ms returns 0 +T42A8 002:591.303 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:591.308 - 0.004ms returns 0 +T42A8 002:591.314 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:591.318 - 0.004ms returns 0 +T42A8 002:591.324 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:591.329 - 0.004ms returns 0 +T42A8 002:591.334 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:591.340 - 0.005ms returns 0 +T42A8 002:591.346 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:591.351 - 0.005ms returns 0x00000060 +T42A8 002:591.357 JLINK_Go() +T42A8 002:591.366 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:597.514 - 6.156ms +T42A8 002:597.524 JLINK_IsHalted() +T42A8 002:598.193 - 0.668ms returns FALSE +T42A8 002:598.203 JLINK_HasError() +T42A8 002:599.322 JLINK_IsHalted() +T42A8 002:605.341 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:606.006 - 6.683ms returns TRUE +T42A8 002:606.019 JLINK_ReadReg(R15 (PC)) +T42A8 002:606.025 - 0.006ms returns 0x20003000 +T42A8 002:606.032 JLINK_ClrBPEx(BPHandle = 0x00000060) +T42A8 002:606.038 - 0.005ms returns 0x00 +T42A8 002:606.044 JLINK_ReadReg(R0) +T42A8 002:606.050 - 0.005ms returns 0x00000000 +T42A8 002:606.417 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:606.426 Data: 0D D9 29 21 09 02 88 42 09 D0 5E 80 E9 04 1E 48 ... +T42A8 002:606.437 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:610.398 - 3.980ms returns 0x100 +T42A8 002:610.411 JLINK_HasError() +T42A8 002:610.419 JLINK_WriteReg(R0, 0x18007900) +T42A8 002:610.427 - 0.007ms returns 0 +T42A8 002:610.434 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:610.440 - 0.005ms returns 0 +T42A8 002:610.447 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:610.452 - 0.005ms returns 0 +T42A8 002:610.463 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:610.469 - 0.005ms returns 0 +T42A8 002:610.476 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:610.481 - 0.005ms returns 0 +T42A8 002:610.488 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:610.494 - 0.005ms returns 0 +T42A8 002:610.501 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:610.506 - 0.005ms returns 0 +T42A8 002:610.513 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:610.519 - 0.005ms returns 0 +T42A8 002:610.526 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:610.532 - 0.005ms returns 0 +T42A8 002:610.538 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:610.544 - 0.005ms returns 0 +T42A8 002:610.551 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:610.556 - 0.005ms returns 0 +T42A8 002:610.563 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:610.569 - 0.005ms returns 0 +T42A8 002:610.576 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:610.581 - 0.005ms returns 0 +T42A8 002:610.588 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:610.594 - 0.006ms returns 0 +T42A8 002:610.601 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:610.607 - 0.005ms returns 0 +T42A8 002:610.614 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:610.620 - 0.005ms returns 0 +T42A8 002:610.627 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:610.632 - 0.005ms returns 0 +T42A8 002:610.639 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:610.645 - 0.005ms returns 0 +T42A8 002:610.652 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:610.658 - 0.005ms returns 0 +T42A8 002:610.664 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:610.670 - 0.005ms returns 0 +T42A8 002:610.678 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:610.684 - 0.006ms returns 0x00000061 +T42A8 002:610.691 JLINK_Go() +T42A8 002:610.701 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:616.519 - 5.827ms +T42A8 002:616.544 JLINK_IsHalted() +T42A8 002:617.173 - 0.628ms returns FALSE +T42A8 002:617.183 JLINK_HasError() +T42A8 002:622.350 JLINK_IsHalted() +T42A8 002:628.448 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:629.179 - 6.828ms returns TRUE +T42A8 002:629.215 JLINK_ReadReg(R15 (PC)) +T42A8 002:629.226 - 0.010ms returns 0x20003000 +T42A8 002:629.234 JLINK_ClrBPEx(BPHandle = 0x00000061) +T42A8 002:629.241 - 0.006ms returns 0x00 +T42A8 002:629.248 JLINK_ReadReg(R0) +T42A8 002:629.254 - 0.005ms returns 0x00000000 +T42A8 002:629.757 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:629.770 Data: 01 D0 03 24 12 E0 02 24 10 E0 02 21 38 46 FF F7 ... +T42A8 002:629.786 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:633.925 - 4.167ms returns 0x100 +T42A8 002:633.955 JLINK_HasError() +T42A8 002:634.040 JLINK_WriteReg(R0, 0x18007A00) +T42A8 002:634.053 - 0.013ms returns 0 +T42A8 002:634.061 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:634.067 - 0.006ms returns 0 +T42A8 002:634.076 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:634.082 - 0.006ms returns 0 +T42A8 002:634.089 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:634.095 - 0.006ms returns 0 +T42A8 002:634.102 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:634.108 - 0.006ms returns 0 +T42A8 002:634.117 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:634.124 - 0.007ms returns 0 +T42A8 002:634.131 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:634.138 - 0.006ms returns 0 +T42A8 002:634.146 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:634.152 - 0.006ms returns 0 +T42A8 002:634.159 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:634.165 - 0.005ms returns 0 +T42A8 002:634.171 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:634.177 - 0.005ms returns 0 +T42A8 002:634.184 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:634.189 - 0.005ms returns 0 +T42A8 002:634.196 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:634.201 - 0.005ms returns 0 +T42A8 002:634.208 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:634.214 - 0.005ms returns 0 +T42A8 002:634.221 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:634.227 - 0.006ms returns 0 +T42A8 002:634.234 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:634.239 - 0.005ms returns 0 +T42A8 002:634.246 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:634.251 - 0.005ms returns 0 +T42A8 002:634.258 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:634.264 - 0.005ms returns 0 +T42A8 002:634.275 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:634.281 - 0.006ms returns 0 +T42A8 002:634.288 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:634.294 - 0.005ms returns 0 +T42A8 002:634.300 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:634.306 - 0.005ms returns 0 +T42A8 002:634.313 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:634.321 - 0.007ms returns 0x00000062 +T42A8 002:634.328 JLINK_Go() +T42A8 002:634.341 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:640.659 - 6.330ms +T42A8 002:640.694 JLINK_IsHalted() +T42A8 002:641.260 - 0.565ms returns FALSE +T42A8 002:641.280 JLINK_HasError() +T42A8 002:643.182 JLINK_IsHalted() +T42A8 002:649.185 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:649.732 - 6.549ms returns TRUE +T42A8 002:649.748 JLINK_ReadReg(R15 (PC)) +T42A8 002:649.758 - 0.010ms returns 0x20003000 +T42A8 002:649.768 JLINK_ClrBPEx(BPHandle = 0x00000062) +T42A8 002:649.777 - 0.008ms returns 0x00 +T42A8 002:649.787 JLINK_ReadReg(R0) +T42A8 002:649.795 - 0.008ms returns 0x00000000 +T42A8 002:650.235 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:650.243 Data: 04 E0 30 88 20 80 00 2F 1A D0 04 E0 20 88 40 1C ... +T42A8 002:650.273 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:654.234 - 3.999ms returns 0x100 +T42A8 002:654.244 JLINK_HasError() +T42A8 002:654.250 JLINK_WriteReg(R0, 0x18007B00) +T42A8 002:654.256 - 0.005ms returns 0 +T42A8 002:654.262 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:654.267 - 0.004ms returns 0 +T42A8 002:654.273 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:654.278 - 0.004ms returns 0 +T42A8 002:654.284 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:654.288 - 0.004ms returns 0 +T42A8 002:654.295 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:654.300 - 0.004ms returns 0 +T42A8 002:654.305 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:654.310 - 0.004ms returns 0 +T42A8 002:654.316 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:654.320 - 0.004ms returns 0 +T42A8 002:654.326 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:654.331 - 0.004ms returns 0 +T42A8 002:654.337 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:654.342 - 0.004ms returns 0 +T42A8 002:654.348 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:654.352 - 0.004ms returns 0 +T42A8 002:654.358 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:654.363 - 0.004ms returns 0 +T42A8 002:654.368 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:654.373 - 0.004ms returns 0 +T42A8 002:654.379 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:654.384 - 0.004ms returns 0 +T42A8 002:654.389 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:654.395 - 0.005ms returns 0 +T42A8 002:654.400 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:654.405 - 0.004ms returns 0 +T42A8 002:654.411 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:654.417 - 0.006ms returns 0 +T42A8 002:654.424 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:654.428 - 0.005ms returns 0 +T42A8 002:654.434 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:654.439 - 0.004ms returns 0 +T42A8 002:654.445 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:654.449 - 0.004ms returns 0 +T42A8 002:654.455 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:654.460 - 0.004ms returns 0 +T42A8 002:654.466 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:654.471 - 0.005ms returns 0x00000063 +T42A8 002:654.477 JLINK_Go() +T42A8 002:654.486 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:660.626 - 6.148ms +T42A8 002:660.641 JLINK_IsHalted() +T42A8 002:661.247 - 0.605ms returns FALSE +T42A8 002:661.259 JLINK_HasError() +T42A8 002:663.035 JLINK_IsHalted() +T42A8 002:669.315 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:670.047 - 7.011ms returns TRUE +T42A8 002:670.072 JLINK_ReadReg(R15 (PC)) +T42A8 002:670.082 - 0.010ms returns 0x20003000 +T42A8 002:670.090 JLINK_ClrBPEx(BPHandle = 0x00000063) +T42A8 002:670.096 - 0.006ms returns 0x00 +T42A8 002:670.103 JLINK_ReadReg(R0) +T42A8 002:670.109 - 0.005ms returns 0x00000000 +T42A8 002:670.583 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:670.596 Data: 05 22 01 21 FF F7 FF FB 46 70 45 80 04 71 08 38 ... +T42A8 002:670.611 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:674.606 - 4.022ms returns 0x100 +T42A8 002:674.635 JLINK_HasError() +T42A8 002:674.644 JLINK_WriteReg(R0, 0x18007C00) +T42A8 002:674.653 - 0.008ms returns 0 +T42A8 002:674.660 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:674.665 - 0.005ms returns 0 +T42A8 002:674.672 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:674.677 - 0.005ms returns 0 +T42A8 002:674.683 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:674.688 - 0.005ms returns 0 +T42A8 002:674.695 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:674.700 - 0.005ms returns 0 +T42A8 002:674.706 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:674.712 - 0.005ms returns 0 +T42A8 002:674.718 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:674.723 - 0.005ms returns 0 +T42A8 002:674.730 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:674.735 - 0.005ms returns 0 +T42A8 002:674.742 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:674.748 - 0.006ms returns 0 +T42A8 002:674.756 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:674.761 - 0.005ms returns 0 +T42A8 002:674.767 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:674.772 - 0.005ms returns 0 +T42A8 002:674.779 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:674.784 - 0.005ms returns 0 +T42A8 002:674.790 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:674.795 - 0.005ms returns 0 +T42A8 002:674.801 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:674.807 - 0.005ms returns 0 +T42A8 002:674.813 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:674.818 - 0.005ms returns 0 +T42A8 002:674.824 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:674.829 - 0.005ms returns 0 +T42A8 002:674.836 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:674.841 - 0.005ms returns 0 +T42A8 002:674.847 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:674.852 - 0.005ms returns 0 +T42A8 002:674.858 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:674.863 - 0.005ms returns 0 +T42A8 002:674.869 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:674.874 - 0.005ms returns 0 +T42A8 002:674.903 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:674.910 - 0.007ms returns 0x00000064 +T42A8 002:674.917 JLINK_Go() +T42A8 002:674.929 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:681.126 - 6.208ms +T42A8 002:681.152 JLINK_IsHalted() +T42A8 002:681.832 - 0.679ms returns FALSE +T42A8 002:681.848 JLINK_HasError() +T42A8 002:684.091 JLINK_IsHalted() +T42A8 002:690.150 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:690.736 - 6.644ms returns TRUE +T42A8 002:690.757 JLINK_ReadReg(R15 (PC)) +T42A8 002:690.768 - 0.011ms returns 0x20003000 +T42A8 002:690.778 JLINK_ClrBPEx(BPHandle = 0x00000064) +T42A8 002:690.786 - 0.008ms returns 0x00 +T42A8 002:690.798 JLINK_ReadReg(R0) +T42A8 002:690.806 - 0.007ms returns 0x00000000 +T42A8 002:691.432 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:691.445 Data: 86 B2 A4 B2 B8 88 A0 42 04 D3 00 2C 02 D0 A8 1C ... +T42A8 002:691.463 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:695.444 - 4.011ms returns 0x100 +T42A8 002:695.464 JLINK_HasError() +T42A8 002:695.476 JLINK_WriteReg(R0, 0x18007D00) +T42A8 002:695.487 - 0.011ms returns 0 +T42A8 002:695.498 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:695.507 - 0.009ms returns 0 +T42A8 002:695.518 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:695.527 - 0.008ms returns 0 +T42A8 002:695.537 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:695.546 - 0.008ms returns 0 +T42A8 002:695.556 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:695.565 - 0.008ms returns 0 +T42A8 002:695.576 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:695.584 - 0.008ms returns 0 +T42A8 002:695.595 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:695.604 - 0.008ms returns 0 +T42A8 002:695.614 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:695.623 - 0.008ms returns 0 +T42A8 002:695.634 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:695.642 - 0.008ms returns 0 +T42A8 002:695.653 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:695.661 - 0.008ms returns 0 +T42A8 002:695.672 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:695.680 - 0.008ms returns 0 +T42A8 002:695.691 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:695.700 - 0.008ms returns 0 +T42A8 002:695.710 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:695.718 - 0.008ms returns 0 +T42A8 002:695.729 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:695.743 - 0.013ms returns 0 +T42A8 002:695.754 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:695.762 - 0.008ms returns 0 +T42A8 002:695.773 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:695.782 - 0.008ms returns 0 +T42A8 002:695.793 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:695.801 - 0.008ms returns 0 +T42A8 002:695.811 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:695.820 - 0.008ms returns 0 +T42A8 002:695.830 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:695.839 - 0.008ms returns 0 +T42A8 002:695.849 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:695.858 - 0.008ms returns 0 +T42A8 002:695.869 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:695.879 - 0.010ms returns 0x00000065 +T42A8 002:695.889 JLINK_Go() +T42A8 002:695.906 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:702.248 - 6.357ms +T42A8 002:702.284 JLINK_IsHalted() +T42A8 002:703.070 - 0.783ms returns FALSE +T42A8 002:703.122 JLINK_HasError() +T42A8 002:705.258 JLINK_IsHalted() +T42A8 002:711.538 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:712.282 - 7.022ms returns TRUE +T42A8 002:712.320 JLINK_ReadReg(R15 (PC)) +T42A8 002:712.341 - 0.019ms returns 0x20003000 +T42A8 002:712.360 JLINK_ClrBPEx(BPHandle = 0x00000065) +T42A8 002:712.376 - 0.015ms returns 0x00 +T42A8 002:712.393 JLINK_ReadReg(R0) +T42A8 002:712.408 - 0.014ms returns 0x00000000 +T42A8 002:713.511 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:713.537 Data: 01 25 4B E0 E0 88 05 21 C9 02 88 42 02 D0 49 1C ... +T42A8 002:713.570 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:717.686 - 4.173ms returns 0x100 +T42A8 002:717.782 JLINK_HasError() +T42A8 002:717.854 JLINK_WriteReg(R0, 0x18007E00) +T42A8 002:717.882 - 0.027ms returns 0 +T42A8 002:717.909 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:717.927 - 0.018ms returns 0 +T42A8 002:717.954 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:717.971 - 0.017ms returns 0 +T42A8 002:717.996 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:718.027 - 0.030ms returns 0 +T42A8 002:718.113 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:718.152 - 0.040ms returns 0 +T42A8 002:718.183 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:718.202 - 0.018ms returns 0 +T42A8 002:718.228 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:718.246 - 0.017ms returns 0 +T42A8 002:718.272 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:718.290 - 0.017ms returns 0 +T42A8 002:718.352 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:718.373 - 0.051ms returns 0 +T42A8 002:718.400 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:718.417 - 0.017ms returns 0 +T42A8 002:718.439 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:718.456 - 0.017ms returns 0 +T42A8 002:718.482 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:718.499 - 0.017ms returns 0 +T42A8 002:718.524 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:718.542 - 0.017ms returns 0 +T42A8 002:718.565 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:718.590 - 0.027ms returns 0 +T42A8 002:718.615 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:718.633 - 0.017ms returns 0 +T42A8 002:718.655 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:718.672 - 0.018ms returns 0 +T42A8 002:718.704 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:718.723 - 0.019ms returns 0 +T42A8 002:718.749 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:718.790 - 0.042ms returns 0 +T42A8 002:718.816 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:718.834 - 0.017ms returns 0 +T42A8 002:718.855 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:718.873 - 0.017ms returns 0 +T42A8 002:718.900 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:718.921 - 0.022ms returns 0x00000066 +T42A8 002:718.946 JLINK_Go() +T42A8 002:718.981 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:725.379 - 6.431ms +T42A8 002:725.433 JLINK_IsHalted() +T42A8 002:726.085 - 0.651ms returns FALSE +T42A8 002:726.131 JLINK_HasError() +T42A8 002:734.214 JLINK_IsHalted() +T42A8 002:740.552 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:741.162 - 6.947ms returns TRUE +T42A8 002:741.184 JLINK_ReadReg(R15 (PC)) +T42A8 002:741.193 - 0.009ms returns 0x20003000 +T42A8 002:741.201 JLINK_ClrBPEx(BPHandle = 0x00000066) +T42A8 002:741.207 - 0.005ms returns 0x00 +T42A8 002:741.218 JLINK_ReadReg(R0) +T42A8 002:741.223 - 0.005ms returns 0x00000000 +T42A8 002:741.661 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:741.669 Data: 2B 46 0B 98 FF F7 78 FE 00 20 0D B0 F0 BD 68 46 ... +T42A8 002:741.682 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:745.716 - 4.054ms returns 0x100 +T42A8 002:745.741 JLINK_HasError() +T42A8 002:745.750 JLINK_WriteReg(R0, 0x18007F00) +T42A8 002:745.759 - 0.008ms returns 0 +T42A8 002:745.765 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:745.770 - 0.005ms returns 0 +T42A8 002:745.777 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:745.782 - 0.005ms returns 0 +T42A8 002:745.788 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:745.793 - 0.005ms returns 0 +T42A8 002:745.799 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:745.804 - 0.005ms returns 0 +T42A8 002:745.811 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:745.816 - 0.005ms returns 0 +T42A8 002:745.822 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:745.828 - 0.005ms returns 0 +T42A8 002:745.834 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:745.839 - 0.005ms returns 0 +T42A8 002:745.845 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:745.850 - 0.005ms returns 0 +T42A8 002:745.856 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:745.861 - 0.005ms returns 0 +T42A8 002:745.868 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:745.872 - 0.005ms returns 0 +T42A8 002:745.879 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:745.884 - 0.005ms returns 0 +T42A8 002:745.890 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:745.895 - 0.005ms returns 0 +T42A8 002:745.901 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:745.907 - 0.005ms returns 0 +T42A8 002:745.914 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:745.920 - 0.006ms returns 0 +T42A8 002:745.927 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:745.932 - 0.005ms returns 0 +T42A8 002:745.939 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:745.944 - 0.005ms returns 0 +T42A8 002:745.950 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:745.955 - 0.004ms returns 0 +T42A8 002:745.961 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:745.966 - 0.005ms returns 0 +T42A8 002:745.973 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:745.978 - 0.005ms returns 0 +T42A8 002:745.986 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:745.993 - 0.007ms returns 0x00000067 +T42A8 002:745.999 JLINK_Go() +T42A8 002:746.011 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:752.037 - 6.037ms +T42A8 002:752.062 JLINK_IsHalted() +T42A8 002:752.755 - 0.689ms returns FALSE +T42A8 002:752.776 JLINK_HasError() +T42A8 002:753.914 JLINK_IsHalted() +T42A8 002:759.850 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:760.461 - 6.546ms returns TRUE +T42A8 002:760.473 JLINK_ReadReg(R15 (PC)) +T42A8 002:760.480 - 0.007ms returns 0x20003000 +T42A8 002:760.488 JLINK_ClrBPEx(BPHandle = 0x00000067) +T42A8 002:760.493 - 0.005ms returns 0x00 +T42A8 002:760.500 JLINK_ReadReg(R0) +T42A8 002:760.505 - 0.005ms returns 0x00000000 +T42A8 002:760.944 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:760.952 Data: 41 1C 89 B2 11 82 AA 88 8A 42 04 D3 82 42 02 D0 ... +T42A8 002:760.964 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:764.950 - 4.007ms returns 0x100 +T42A8 002:764.962 JLINK_HasError() +T42A8 002:764.969 JLINK_WriteReg(R0, 0x18008000) +T42A8 002:764.976 - 0.006ms returns 0 +T42A8 002:764.982 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:764.988 - 0.005ms returns 0 +T42A8 002:764.994 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:764.999 - 0.005ms returns 0 +T42A8 002:765.005 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:765.011 - 0.006ms returns 0 +T42A8 002:765.018 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:765.023 - 0.005ms returns 0 +T42A8 002:765.029 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:765.034 - 0.005ms returns 0 +T42A8 002:765.040 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:765.046 - 0.005ms returns 0 +T42A8 002:765.052 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:765.057 - 0.005ms returns 0 +T42A8 002:765.064 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:765.069 - 0.005ms returns 0 +T42A8 002:765.075 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:765.080 - 0.005ms returns 0 +T42A8 002:765.088 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:765.096 - 0.006ms returns 0 +T42A8 002:765.102 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:765.107 - 0.005ms returns 0 +T42A8 002:765.113 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:765.118 - 0.005ms returns 0 +T42A8 002:765.124 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:765.130 - 0.005ms returns 0 +T42A8 002:765.136 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:765.160 - 0.024ms returns 0 +T42A8 002:765.167 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:765.173 - 0.005ms returns 0 +T42A8 002:765.179 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:765.184 - 0.005ms returns 0 +T42A8 002:765.191 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:765.196 - 0.005ms returns 0 +T42A8 002:765.202 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:765.207 - 0.005ms returns 0 +T42A8 002:765.213 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:765.218 - 0.005ms returns 0 +T42A8 002:765.225 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:765.231 - 0.006ms returns 0x00000068 +T42A8 002:765.237 JLINK_Go() +T42A8 002:765.257 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:771.368 - 6.131ms +T42A8 002:771.380 JLINK_IsHalted() +T42A8 002:772.000 - 0.619ms returns FALSE +T42A8 002:772.012 JLINK_HasError() +T42A8 002:775.961 JLINK_IsHalted() +T42A8 002:781.993 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:782.866 - 6.901ms returns TRUE +T42A8 002:782.941 JLINK_ReadReg(R15 (PC)) +T42A8 002:782.974 - 0.032ms returns 0x20003000 +T42A8 002:783.153 JLINK_ClrBPEx(BPHandle = 0x00000068) +T42A8 002:783.198 - 0.045ms returns 0x00 +T42A8 002:783.229 JLINK_ReadReg(R0) +T42A8 002:783.255 - 0.024ms returns 0x00000000 +T42A8 002:784.930 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:784.968 Data: 0A 90 08 98 A9 88 80 8F 6A 46 11 83 0A 99 09 AB ... +T42A8 002:785.019 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:789.121 - 4.190ms returns 0x100 +T42A8 002:789.187 JLINK_HasError() +T42A8 002:789.220 JLINK_WriteReg(R0, 0x18008100) +T42A8 002:789.252 - 0.032ms returns 0 +T42A8 002:789.280 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:789.303 - 0.023ms returns 0 +T42A8 002:789.329 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:789.352 - 0.022ms returns 0 +T42A8 002:789.378 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:789.400 - 0.022ms returns 0 +T42A8 002:789.427 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:789.450 - 0.022ms returns 0 +T42A8 002:789.476 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:789.498 - 0.022ms returns 0 +T42A8 002:789.526 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:789.548 - 0.022ms returns 0 +T42A8 002:789.575 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:789.597 - 0.022ms returns 0 +T42A8 002:789.625 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:789.646 - 0.022ms returns 0 +T42A8 002:789.673 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:789.695 - 0.022ms returns 0 +T42A8 002:789.722 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:789.744 - 0.021ms returns 0 +T42A8 002:789.771 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:789.793 - 0.022ms returns 0 +T42A8 002:789.827 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:789.857 - 0.029ms returns 0 +T42A8 002:789.891 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:789.915 - 0.025ms returns 0 +T42A8 002:789.942 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:789.964 - 0.022ms returns 0 +T42A8 002:789.991 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:790.012 - 0.022ms returns 0 +T42A8 002:790.039 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:790.060 - 0.021ms returns 0 +T42A8 002:790.086 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:790.107 - 0.021ms returns 0 +T42A8 002:790.134 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:790.155 - 0.021ms returns 0 +T42A8 002:790.181 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:790.202 - 0.021ms returns 0 +T42A8 002:790.231 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:790.255 - 0.025ms returns 0x00000069 +T42A8 002:790.281 JLINK_Go() +T42A8 002:790.322 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:796.784 - 6.499ms +T42A8 002:796.875 JLINK_IsHalted() +T42A8 002:797.625 - 0.748ms returns FALSE +T42A8 002:797.674 JLINK_HasError() +T42A8 002:799.836 JLINK_IsHalted() +T42A8 002:806.090 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:806.812 - 6.974ms returns TRUE +T42A8 002:806.866 JLINK_ReadReg(R15 (PC)) +T42A8 002:806.896 - 0.029ms returns 0x20003000 +T42A8 002:806.924 JLINK_ClrBPEx(BPHandle = 0x00000069) +T42A8 002:806.947 - 0.023ms returns 0x00 +T42A8 002:806.974 JLINK_ReadReg(R0) +T42A8 002:806.996 - 0.021ms returns 0x00000000 +T42A8 002:808.431 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:808.440 Data: B2 B2 A8 18 E1 88 81 70 09 0A C1 70 92 1C 96 B2 ... +T42A8 002:808.453 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:812.407 - 3.976ms returns 0x100 +T42A8 002:812.420 JLINK_HasError() +T42A8 002:812.428 JLINK_WriteReg(R0, 0x18008200) +T42A8 002:812.434 - 0.006ms returns 0 +T42A8 002:812.440 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:812.446 - 0.005ms returns 0 +T42A8 002:812.452 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:812.457 - 0.005ms returns 0 +T42A8 002:812.464 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:812.469 - 0.005ms returns 0 +T42A8 002:812.476 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:812.481 - 0.005ms returns 0 +T42A8 002:812.488 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:812.493 - 0.005ms returns 0 +T42A8 002:812.558 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:812.569 - 0.010ms returns 0 +T42A8 002:812.576 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:812.581 - 0.005ms returns 0 +T42A8 002:812.587 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:812.592 - 0.005ms returns 0 +T42A8 002:812.598 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:812.603 - 0.005ms returns 0 +T42A8 002:812.609 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:812.615 - 0.005ms returns 0 +T42A8 002:812.621 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:812.626 - 0.005ms returns 0 +T42A8 002:812.632 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:812.637 - 0.005ms returns 0 +T42A8 002:812.643 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:812.649 - 0.005ms returns 0 +T42A8 002:812.655 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:812.660 - 0.005ms returns 0 +T42A8 002:812.666 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:812.671 - 0.005ms returns 0 +T42A8 002:812.677 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:812.682 - 0.005ms returns 0 +T42A8 002:812.688 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:812.693 - 0.005ms returns 0 +T42A8 002:812.699 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:812.704 - 0.005ms returns 0 +T42A8 002:812.710 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:812.716 - 0.006ms returns 0 +T42A8 002:812.723 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:812.729 - 0.006ms returns 0x0000006A +T42A8 002:812.735 JLINK_Go() +T42A8 002:812.753 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:818.815 - 6.079ms +T42A8 002:818.827 JLINK_IsHalted() +T42A8 002:819.508 - 0.680ms returns FALSE +T42A8 002:819.518 JLINK_HasError() +T42A8 002:820.867 JLINK_IsHalted() +T42A8 002:826.860 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:827.493 - 6.625ms returns TRUE +T42A8 002:827.503 JLINK_ReadReg(R15 (PC)) +T42A8 002:827.509 - 0.006ms returns 0x20003000 +T42A8 002:827.516 JLINK_ClrBPEx(BPHandle = 0x0000006A) +T42A8 002:827.521 - 0.005ms returns 0x00 +T42A8 002:827.527 JLINK_ReadReg(R0) +T42A8 002:827.532 - 0.005ms returns 0x00000000 +T42A8 002:827.899 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:827.907 Data: 01 AB 6A 46 30 46 FF F7 A1 FB 04 00 0A D0 06 2C ... +T42A8 002:827.918 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:831.839 - 3.940ms returns 0x100 +T42A8 002:831.850 JLINK_HasError() +T42A8 002:831.856 JLINK_WriteReg(R0, 0x18008300) +T42A8 002:831.863 - 0.006ms returns 0 +T42A8 002:831.869 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:831.874 - 0.005ms returns 0 +T42A8 002:831.880 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:831.885 - 0.005ms returns 0 +T42A8 002:831.891 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:831.896 - 0.004ms returns 0 +T42A8 002:831.902 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:831.907 - 0.004ms returns 0 +T42A8 002:831.914 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:831.919 - 0.005ms returns 0 +T42A8 002:831.925 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:831.942 - 0.017ms returns 0 +T42A8 002:831.949 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:831.954 - 0.005ms returns 0 +T42A8 002:831.960 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:831.965 - 0.005ms returns 0 +T42A8 002:831.971 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:831.976 - 0.004ms returns 0 +T42A8 002:831.982 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:831.986 - 0.005ms returns 0 +T42A8 002:831.993 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:831.998 - 0.005ms returns 0 +T42A8 002:832.004 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:832.008 - 0.004ms returns 0 +T42A8 002:832.014 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:832.020 - 0.005ms returns 0 +T42A8 002:832.026 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:832.031 - 0.004ms returns 0 +T42A8 002:832.037 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:832.042 - 0.005ms returns 0 +T42A8 002:832.048 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:832.053 - 0.005ms returns 0 +T42A8 002:832.059 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:832.064 - 0.005ms returns 0 +T42A8 002:832.070 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:832.075 - 0.004ms returns 0 +T42A8 002:832.081 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:832.086 - 0.005ms returns 0 +T42A8 002:832.093 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:832.098 - 0.005ms returns 0x0000006B +T42A8 002:832.104 JLINK_Go() +T42A8 002:832.112 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:837.897 - 5.792ms +T42A8 002:837.910 JLINK_IsHalted() +T42A8 002:838.523 - 0.612ms returns FALSE +T42A8 002:838.534 JLINK_HasError() +T42A8 002:843.677 JLINK_IsHalted() +T42A8 002:849.956 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:850.718 - 7.040ms returns TRUE +T42A8 002:850.742 JLINK_ReadReg(R15 (PC)) +T42A8 002:850.750 - 0.008ms returns 0x20003000 +T42A8 002:850.757 JLINK_ClrBPEx(BPHandle = 0x0000006B) +T42A8 002:850.762 - 0.005ms returns 0x00 +T42A8 002:850.769 JLINK_ReadReg(R0) +T42A8 002:850.774 - 0.005ms returns 0x00000000 +T42A8 002:851.220 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:851.231 Data: 01 21 08 30 0B F0 B8 F8 01 90 87 80 01 98 A9 4B ... +T42A8 002:851.246 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:855.290 - 4.070ms returns 0x100 +T42A8 002:855.316 JLINK_HasError() +T42A8 002:855.325 JLINK_WriteReg(R0, 0x18008400) +T42A8 002:855.334 - 0.009ms returns 0 +T42A8 002:855.340 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:855.346 - 0.005ms returns 0 +T42A8 002:855.352 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:855.358 - 0.005ms returns 0 +T42A8 002:855.364 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:855.369 - 0.005ms returns 0 +T42A8 002:855.376 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:855.381 - 0.005ms returns 0 +T42A8 002:855.388 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:855.393 - 0.005ms returns 0 +T42A8 002:855.399 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:855.404 - 0.005ms returns 0 +T42A8 002:855.411 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:855.416 - 0.005ms returns 0 +T42A8 002:855.422 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:855.428 - 0.005ms returns 0 +T42A8 002:855.434 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:855.439 - 0.005ms returns 0 +T42A8 002:855.446 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:855.451 - 0.005ms returns 0 +T42A8 002:855.457 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:855.462 - 0.005ms returns 0 +T42A8 002:855.469 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:855.474 - 0.005ms returns 0 +T42A8 002:855.480 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:855.486 - 0.005ms returns 0 +T42A8 002:855.492 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:855.498 - 0.005ms returns 0 +T42A8 002:855.504 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:855.510 - 0.005ms returns 0 +T42A8 002:855.516 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:855.521 - 0.005ms returns 0 +T42A8 002:855.528 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:855.533 - 0.005ms returns 0 +T42A8 002:855.539 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:855.544 - 0.005ms returns 0 +T42A8 002:855.551 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:855.556 - 0.005ms returns 0 +T42A8 002:855.563 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:855.575 - 0.012ms returns 0x0000006C +T42A8 002:855.581 JLINK_Go() +T42A8 002:855.593 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:861.842 - 6.259ms +T42A8 002:861.866 JLINK_IsHalted() +T42A8 002:862.656 - 0.788ms returns FALSE +T42A8 002:862.686 JLINK_HasError() +T42A8 002:863.809 JLINK_IsHalted() +T42A8 002:870.058 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:870.716 - 6.906ms returns TRUE +T42A8 002:870.743 JLINK_ReadReg(R15 (PC)) +T42A8 002:870.754 - 0.011ms returns 0x20003000 +T42A8 002:870.763 JLINK_ClrBPEx(BPHandle = 0x0000006C) +T42A8 002:870.771 - 0.007ms returns 0x00 +T42A8 002:870.857 JLINK_ReadReg(R0) +T42A8 002:870.873 - 0.015ms returns 0x00000000 +T42A8 002:871.477 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:871.492 Data: 24 1D 38 46 FF F7 42 FA 84 46 69 46 03 98 08 80 ... +T42A8 002:871.510 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:875.513 - 4.035ms returns 0x100 +T42A8 002:875.538 JLINK_HasError() +T42A8 002:875.550 JLINK_WriteReg(R0, 0x18008500) +T42A8 002:875.562 - 0.012ms returns 0 +T42A8 002:875.572 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:875.580 - 0.008ms returns 0 +T42A8 002:875.590 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:875.597 - 0.007ms returns 0 +T42A8 002:875.606 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:875.614 - 0.007ms returns 0 +T42A8 002:875.625 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:875.633 - 0.007ms returns 0 +T42A8 002:875.642 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:875.650 - 0.007ms returns 0 +T42A8 002:875.659 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:875.676 - 0.016ms returns 0 +T42A8 002:875.686 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:875.694 - 0.007ms returns 0 +T42A8 002:875.703 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:875.711 - 0.007ms returns 0 +T42A8 002:875.720 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:875.728 - 0.007ms returns 0 +T42A8 002:875.737 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:875.745 - 0.007ms returns 0 +T42A8 002:875.754 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:875.762 - 0.007ms returns 0 +T42A8 002:875.771 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:875.778 - 0.007ms returns 0 +T42A8 002:875.788 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:875.796 - 0.008ms returns 0 +T42A8 002:875.806 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:875.813 - 0.007ms returns 0 +T42A8 002:875.823 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:875.830 - 0.007ms returns 0 +T42A8 002:875.840 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:875.847 - 0.007ms returns 0 +T42A8 002:875.857 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:875.864 - 0.007ms returns 0 +T42A8 002:875.874 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:875.881 - 0.007ms returns 0 +T42A8 002:875.890 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:875.898 - 0.007ms returns 0 +T42A8 002:875.908 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:875.917 - 0.009ms returns 0x0000006D +T42A8 002:875.926 JLINK_Go() +T42A8 002:875.942 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:881.892 - 5.964ms +T42A8 002:881.912 JLINK_IsHalted() +T42A8 002:882.552 - 0.640ms returns FALSE +T42A8 002:882.570 JLINK_HasError() +T42A8 002:883.737 JLINK_IsHalted() +T42A8 002:889.669 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:890.297 - 6.559ms returns TRUE +T42A8 002:890.321 JLINK_ReadReg(R15 (PC)) +T42A8 002:890.336 - 0.014ms returns 0x20003000 +T42A8 002:890.352 JLINK_ClrBPEx(BPHandle = 0x0000006D) +T42A8 002:890.365 - 0.012ms returns 0x00 +T42A8 002:890.379 JLINK_ReadReg(R0) +T42A8 002:890.391 - 0.011ms returns 0x00000000 +T42A8 002:891.298 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:891.318 Data: A8 1D 02 9A 98 47 A0 88 A8 80 28 46 08 38 0B F0 ... +T42A8 002:891.343 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:895.437 - 4.139ms returns 0x100 +T42A8 002:895.467 JLINK_HasError() +T42A8 002:895.486 JLINK_WriteReg(R0, 0x18008600) +T42A8 002:895.504 - 0.017ms returns 0 +T42A8 002:895.522 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:895.536 - 0.014ms returns 0 +T42A8 002:895.554 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:895.573 - 0.019ms returns 0 +T42A8 002:895.595 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:895.609 - 0.014ms returns 0 +T42A8 002:895.637 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:895.652 - 0.015ms returns 0 +T42A8 002:895.670 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:895.684 - 0.014ms returns 0 +T42A8 002:895.702 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:895.716 - 0.014ms returns 0 +T42A8 002:895.733 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:895.747 - 0.014ms returns 0 +T42A8 002:895.764 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:895.779 - 0.014ms returns 0 +T42A8 002:895.796 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:895.810 - 0.014ms returns 0 +T42A8 002:895.828 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:895.842 - 0.014ms returns 0 +T42A8 002:895.859 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:895.873 - 0.014ms returns 0 +T42A8 002:895.890 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:895.904 - 0.014ms returns 0 +T42A8 002:895.922 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:895.937 - 0.015ms returns 0 +T42A8 002:895.955 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:895.969 - 0.014ms returns 0 +T42A8 002:895.987 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:896.001 - 0.014ms returns 0 +T42A8 002:896.019 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:896.033 - 0.014ms returns 0 +T42A8 002:896.050 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:896.064 - 0.014ms returns 0 +T42A8 002:896.082 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:896.096 - 0.014ms returns 0 +T42A8 002:896.113 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:896.127 - 0.014ms returns 0 +T42A8 002:896.146 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:896.161 - 0.016ms returns 0x0000006E +T42A8 002:896.178 JLINK_Go() +T42A8 002:896.203 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:902.451 - 6.271ms +T42A8 002:902.484 JLINK_IsHalted() +T42A8 002:903.184 - 0.698ms returns FALSE +T42A8 002:903.216 JLINK_HasError() +T42A8 002:906.669 JLINK_IsHalted() +T42A8 002:912.702 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:913.394 - 6.725ms returns TRUE +T42A8 002:913.424 JLINK_ReadReg(R15 (PC)) +T42A8 002:913.442 - 0.017ms returns 0x20003000 +T42A8 002:913.460 JLINK_ClrBPEx(BPHandle = 0x0000006E) +T42A8 002:913.475 - 0.014ms returns 0x00 +T42A8 002:913.492 JLINK_ReadReg(R0) +T42A8 002:913.508 - 0.014ms returns 0x00000000 +T42A8 002:914.532 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:914.556 Data: A0 88 06 90 25 46 14 35 04 98 FF F7 3F F9 07 46 ... +T42A8 002:914.600 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:918.594 - 4.061ms returns 0x100 +T42A8 002:918.624 JLINK_HasError() +T42A8 002:918.644 JLINK_WriteReg(R0, 0x18008700) +T42A8 002:918.662 - 0.018ms returns 0 +T42A8 002:918.680 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:918.694 - 0.015ms returns 0 +T42A8 002:918.712 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:918.726 - 0.014ms returns 0 +T42A8 002:918.743 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:918.757 - 0.014ms returns 0 +T42A8 002:918.775 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:918.789 - 0.014ms returns 0 +T42A8 002:918.807 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:918.821 - 0.014ms returns 0 +T42A8 002:918.838 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:918.852 - 0.014ms returns 0 +T42A8 002:918.869 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:918.883 - 0.014ms returns 0 +T42A8 002:918.901 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:918.915 - 0.014ms returns 0 +T42A8 002:918.932 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:918.947 - 0.014ms returns 0 +T42A8 002:918.964 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:918.978 - 0.014ms returns 0 +T42A8 002:918.995 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:919.009 - 0.014ms returns 0 +T42A8 002:919.027 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:919.041 - 0.014ms returns 0 +T42A8 002:919.059 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:919.074 - 0.015ms returns 0 +T42A8 002:919.091 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:919.105 - 0.014ms returns 0 +T42A8 002:919.123 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:919.137 - 0.014ms returns 0 +T42A8 002:919.155 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:919.174 - 0.019ms returns 0 +T42A8 002:919.195 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:919.209 - 0.014ms returns 0 +T42A8 002:919.226 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:919.240 - 0.014ms returns 0 +T42A8 002:919.258 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:919.274 - 0.016ms returns 0 +T42A8 002:919.293 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:919.309 - 0.016ms returns 0x0000006F +T42A8 002:919.327 JLINK_Go() +T42A8 002:919.352 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:925.684 - 6.355ms +T42A8 002:925.728 JLINK_IsHalted() +T42A8 002:926.458 - 0.729ms returns FALSE +T42A8 002:926.487 JLINK_HasError() +T42A8 002:928.577 JLINK_IsHalted() +T42A8 002:934.760 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:935.546 - 6.968ms returns TRUE +T42A8 002:935.597 JLINK_ReadReg(R15 (PC)) +T42A8 002:935.607 - 0.010ms returns 0x20003000 +T42A8 002:935.615 JLINK_ClrBPEx(BPHandle = 0x0000006F) +T42A8 002:935.634 - 0.019ms returns 0x00 +T42A8 002:935.641 JLINK_ReadReg(R0) +T42A8 002:935.646 - 0.004ms returns 0x00000000 +T42A8 002:936.088 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:936.101 Data: 0A 7A 04 02 FF 25 80 00 6C 4B 1E 2A 02 D0 D7 07 ... +T42A8 002:936.116 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:940.081 - 3.992ms returns 0x100 +T42A8 002:940.106 JLINK_HasError() +T42A8 002:940.114 JLINK_WriteReg(R0, 0x18008800) +T42A8 002:940.122 - 0.008ms returns 0 +T42A8 002:940.129 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:940.134 - 0.005ms returns 0 +T42A8 002:940.140 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:940.145 - 0.005ms returns 0 +T42A8 002:940.152 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:940.157 - 0.005ms returns 0 +T42A8 002:940.163 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:940.168 - 0.004ms returns 0 +T42A8 002:940.174 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:940.179 - 0.005ms returns 0 +T42A8 002:940.185 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:940.190 - 0.004ms returns 0 +T42A8 002:940.196 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:940.201 - 0.004ms returns 0 +T42A8 002:940.207 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:940.212 - 0.005ms returns 0 +T42A8 002:940.218 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:940.223 - 0.004ms returns 0 +T42A8 002:940.229 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:940.234 - 0.004ms returns 0 +T42A8 002:940.240 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:940.245 - 0.004ms returns 0 +T42A8 002:940.251 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:940.256 - 0.005ms returns 0 +T42A8 002:940.262 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:940.268 - 0.005ms returns 0 +T42A8 002:940.274 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:940.278 - 0.005ms returns 0 +T42A8 002:940.285 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:940.290 - 0.005ms returns 0 +T42A8 002:940.296 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:940.301 - 0.005ms returns 0 +T42A8 002:940.307 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:940.312 - 0.004ms returns 0 +T42A8 002:940.318 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:940.323 - 0.005ms returns 0 +T42A8 002:940.329 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:940.334 - 0.005ms returns 0 +T42A8 002:940.341 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:940.347 - 0.006ms returns 0x00000070 +T42A8 002:940.353 JLINK_Go() +T42A8 002:940.364 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:946.608 - 6.254ms +T42A8 002:946.635 JLINK_IsHalted() +T42A8 002:947.428 - 0.791ms returns FALSE +T42A8 002:947.453 JLINK_HasError() +T42A8 002:952.693 JLINK_IsHalted() +T42A8 002:958.899 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:959.527 - 6.833ms returns TRUE +T42A8 002:959.540 JLINK_ReadReg(R15 (PC)) +T42A8 002:959.548 - 0.007ms returns 0x20003000 +T42A8 002:959.554 JLINK_ClrBPEx(BPHandle = 0x00000070) +T42A8 002:959.560 - 0.005ms returns 0x00 +T42A8 002:959.567 JLINK_ReadReg(R0) +T42A8 002:959.572 - 0.005ms returns 0x00000000 +T42A8 002:959.996 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:960.004 Data: 7F 02 BD 42 02 D9 11 20 00 90 F8 BD AF B2 4C 81 ... +T42A8 002:960.016 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:964.031 - 4.035ms returns 0x100 +T42A8 002:964.045 JLINK_HasError() +T42A8 002:964.053 JLINK_WriteReg(R0, 0x18008900) +T42A8 002:964.059 - 0.006ms returns 0 +T42A8 002:964.066 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:964.071 - 0.005ms returns 0 +T42A8 002:964.078 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:964.083 - 0.005ms returns 0 +T42A8 002:964.089 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:964.094 - 0.005ms returns 0 +T42A8 002:964.101 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:964.107 - 0.005ms returns 0 +T42A8 002:964.113 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:964.118 - 0.005ms returns 0 +T42A8 002:964.124 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:964.129 - 0.005ms returns 0 +T42A8 002:964.136 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:964.141 - 0.005ms returns 0 +T42A8 002:964.148 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:964.153 - 0.005ms returns 0 +T42A8 002:964.159 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:964.164 - 0.005ms returns 0 +T42A8 002:964.171 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:964.176 - 0.005ms returns 0 +T42A8 002:964.182 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:964.187 - 0.005ms returns 0 +T42A8 002:964.195 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:964.200 - 0.005ms returns 0 +T42A8 002:964.207 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:964.213 - 0.005ms returns 0 +T42A8 002:964.220 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:964.225 - 0.005ms returns 0 +T42A8 002:964.232 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:964.238 - 0.005ms returns 0 +T42A8 002:964.244 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:964.249 - 0.005ms returns 0 +T42A8 002:964.255 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:964.260 - 0.005ms returns 0 +T42A8 002:964.267 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:964.272 - 0.005ms returns 0 +T42A8 002:964.279 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:964.284 - 0.005ms returns 0 +T42A8 002:964.292 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:964.298 - 0.006ms returns 0x00000071 +T42A8 002:964.305 JLINK_Go() +T42A8 002:964.314 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:970.396 - 6.091ms +T42A8 002:970.408 JLINK_IsHalted() +T42A8 002:971.059 - 0.650ms returns FALSE +T42A8 002:971.070 JLINK_HasError() +T42A8 002:973.535 JLINK_IsHalted() +T42A8 002:979.552 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 002:980.342 - 6.806ms returns TRUE +T42A8 002:980.366 JLINK_ReadReg(R15 (PC)) +T42A8 002:980.374 - 0.008ms returns 0x20003000 +T42A8 002:980.381 JLINK_ClrBPEx(BPHandle = 0x00000071) +T42A8 002:980.396 - 0.015ms returns 0x00 +T42A8 002:980.403 JLINK_ReadReg(R0) +T42A8 002:980.409 - 0.005ms returns 0x00000000 +T42A8 002:980.906 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 002:980.920 Data: 04 2C E9 D3 03 E0 04 2C 01 D2 01 20 FE BD 00 20 ... +T42A8 002:980.935 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 002:984.959 - 4.052ms returns 0x100 +T42A8 002:984.984 JLINK_HasError() +T42A8 002:984.993 JLINK_WriteReg(R0, 0x18008A00) +T42A8 002:985.002 - 0.009ms returns 0 +T42A8 002:985.011 JLINK_WriteReg(R1, 0x00000100) +T42A8 002:985.016 - 0.005ms returns 0 +T42A8 002:985.023 JLINK_WriteReg(R2, 0x200039D4) +T42A8 002:985.029 - 0.005ms returns 0 +T42A8 002:985.035 JLINK_WriteReg(R3, 0x00000000) +T42A8 002:985.041 - 0.005ms returns 0 +T42A8 002:985.048 JLINK_WriteReg(R4, 0x00000000) +T42A8 002:985.053 - 0.005ms returns 0 +T42A8 002:985.060 JLINK_WriteReg(R5, 0x00000000) +T42A8 002:985.065 - 0.005ms returns 0 +T42A8 002:985.072 JLINK_WriteReg(R6, 0x00000000) +T42A8 002:985.077 - 0.005ms returns 0 +T42A8 002:985.084 JLINK_WriteReg(R7, 0x00000000) +T42A8 002:985.089 - 0.005ms returns 0 +T42A8 002:985.096 JLINK_WriteReg(R8, 0x00000000) +T42A8 002:985.101 - 0.005ms returns 0 +T42A8 002:985.108 JLINK_WriteReg(R9, 0x200039B4) +T42A8 002:985.113 - 0.005ms returns 0 +T42A8 002:985.120 JLINK_WriteReg(R10, 0x00000000) +T42A8 002:985.125 - 0.005ms returns 0 +T42A8 002:985.132 JLINK_WriteReg(R11, 0x00000000) +T42A8 002:985.137 - 0.005ms returns 0 +T42A8 002:985.144 JLINK_WriteReg(R12, 0x00000000) +T42A8 002:985.149 - 0.005ms returns 0 +T42A8 002:985.156 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 002:985.167 - 0.011ms returns 0 +T42A8 002:985.174 JLINK_WriteReg(R14, 0x20003001) +T42A8 002:985.179 - 0.005ms returns 0 +T42A8 002:985.186 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 002:985.191 - 0.005ms returns 0 +T42A8 002:985.197 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 002:985.203 - 0.005ms returns 0 +T42A8 002:985.210 JLINK_WriteReg(MSP, 0x20004000) +T42A8 002:985.215 - 0.005ms returns 0 +T42A8 002:985.221 JLINK_WriteReg(PSP, 0x20004000) +T42A8 002:985.227 - 0.005ms returns 0 +T42A8 002:985.233 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 002:985.239 - 0.005ms returns 0 +T42A8 002:985.246 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 002:985.253 - 0.007ms returns 0x00000072 +T42A8 002:985.259 JLINK_Go() +T42A8 002:985.271 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 002:991.533 - 6.272ms +T42A8 002:991.557 JLINK_IsHalted() +T42A8 002:992.225 - 0.667ms returns FALSE +T42A8 002:992.237 JLINK_HasError() +T42A8 002:994.459 JLINK_IsHalted() +T42A8 003:000.467 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:001.085 - 6.625ms returns TRUE +T42A8 003:001.100 JLINK_ReadReg(R15 (PC)) +T42A8 003:001.109 - 0.008ms returns 0x20003000 +T42A8 003:001.117 JLINK_ClrBPEx(BPHandle = 0x00000072) +T42A8 003:001.124 - 0.007ms returns 0x00 +T42A8 003:001.133 JLINK_ReadReg(R0) +T42A8 003:001.140 - 0.006ms returns 0x00000000 +T42A8 003:001.645 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:001.655 Data: C0 B2 5C 4A 69 46 05 F0 77 FA 08 BD 00 29 01 D1 ... +T42A8 003:001.670 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:005.504 - 3.859ms returns 0x100 +T42A8 003:005.519 JLINK_HasError() +T42A8 003:005.528 JLINK_WriteReg(R0, 0x18008B00) +T42A8 003:005.537 - 0.008ms returns 0 +T42A8 003:005.546 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:005.554 - 0.007ms returns 0 +T42A8 003:005.562 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:005.569 - 0.007ms returns 0 +T42A8 003:005.578 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:005.585 - 0.007ms returns 0 +T42A8 003:005.594 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:005.601 - 0.007ms returns 0 +T42A8 003:005.609 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:005.616 - 0.007ms returns 0 +T42A8 003:005.625 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:005.632 - 0.007ms returns 0 +T42A8 003:005.641 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:005.648 - 0.007ms returns 0 +T42A8 003:005.656 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:005.663 - 0.007ms returns 0 +T42A8 003:005.672 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:005.679 - 0.007ms returns 0 +T42A8 003:005.688 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:005.695 - 0.007ms returns 0 +T42A8 003:005.703 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:005.711 - 0.007ms returns 0 +T42A8 003:005.719 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:005.726 - 0.007ms returns 0 +T42A8 003:005.735 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:005.743 - 0.007ms returns 0 +T42A8 003:005.751 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:005.758 - 0.007ms returns 0 +T42A8 003:005.767 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:005.774 - 0.007ms returns 0 +T42A8 003:005.783 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:005.790 - 0.007ms returns 0 +T42A8 003:005.799 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:005.806 - 0.007ms returns 0 +T42A8 003:005.815 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:005.822 - 0.007ms returns 0 +T42A8 003:005.830 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:005.838 - 0.007ms returns 0 +T42A8 003:005.847 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:005.855 - 0.008ms returns 0x00000073 +T42A8 003:005.863 JLINK_Go() +T42A8 003:005.876 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:011.916 - 6.052ms +T42A8 003:011.936 JLINK_IsHalted() +T42A8 003:012.578 - 0.641ms returns FALSE +T42A8 003:012.594 JLINK_HasError() +T42A8 003:014.382 JLINK_IsHalted() +T42A8 003:020.392 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:021.045 - 6.661ms returns TRUE +T42A8 003:021.066 JLINK_ReadReg(R15 (PC)) +T42A8 003:021.079 - 0.012ms returns 0x20003000 +T42A8 003:021.093 JLINK_ClrBPEx(BPHandle = 0x00000073) +T42A8 003:021.109 - 0.016ms returns 0x00 +T42A8 003:021.125 JLINK_ReadReg(R0) +T42A8 003:021.136 - 0.010ms returns 0x00000000 +T42A8 003:022.582 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:022.600 Data: 89 07 04 D0 61 78 C9 07 03 D0 3A 25 17 E0 0C 25 ... +T42A8 003:022.622 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:026.472 - 3.890ms returns 0x100 +T42A8 003:026.484 JLINK_HasError() +T42A8 003:026.490 JLINK_WriteReg(R0, 0x18008C00) +T42A8 003:026.515 - 0.024ms returns 0 +T42A8 003:027.065 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:027.077 - 0.011ms returns 0 +T42A8 003:027.084 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:027.089 - 0.005ms returns 0 +T42A8 003:027.095 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:027.100 - 0.004ms returns 0 +T42A8 003:027.106 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:027.111 - 0.004ms returns 0 +T42A8 003:027.117 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:027.122 - 0.005ms returns 0 +T42A8 003:027.128 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:027.133 - 0.004ms returns 0 +T42A8 003:027.139 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:027.144 - 0.004ms returns 0 +T42A8 003:027.150 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:027.154 - 0.005ms returns 0 +T42A8 003:027.160 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:027.165 - 0.005ms returns 0 +T42A8 003:027.171 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:027.176 - 0.005ms returns 0 +T42A8 003:027.182 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:027.187 - 0.004ms returns 0 +T42A8 003:027.193 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:027.198 - 0.004ms returns 0 +T42A8 003:027.204 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:027.209 - 0.005ms returns 0 +T42A8 003:027.215 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:027.220 - 0.004ms returns 0 +T42A8 003:027.226 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:027.231 - 0.004ms returns 0 +T42A8 003:027.237 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:027.242 - 0.005ms returns 0 +T42A8 003:027.247 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:027.252 - 0.004ms returns 0 +T42A8 003:027.259 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:027.266 - 0.006ms returns 0 +T42A8 003:027.271 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:027.276 - 0.004ms returns 0 +T42A8 003:027.283 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:027.312 - 0.029ms returns 0x00000074 +T42A8 003:027.318 JLINK_Go() +T42A8 003:027.329 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:033.441 - 6.121ms +T42A8 003:033.494 JLINK_IsHalted() +T42A8 003:034.313 - 0.818ms returns FALSE +T42A8 003:034.341 JLINK_HasError() +T42A8 003:035.484 JLINK_IsHalted() +T42A8 003:041.649 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:042.415 - 6.931ms returns TRUE +T42A8 003:042.439 JLINK_ReadReg(R15 (PC)) +T42A8 003:042.448 - 0.009ms returns 0x20003000 +T42A8 003:042.456 JLINK_ClrBPEx(BPHandle = 0x00000074) +T42A8 003:042.462 - 0.006ms returns 0x00 +T42A8 003:042.469 JLINK_ReadReg(R0) +T42A8 003:042.475 - 0.005ms returns 0x00000000 +T42A8 003:043.002 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:043.014 Data: 04 F0 B6 FF 00 21 20 46 FF F7 B6 FF 28 46 70 BD ... +T42A8 003:043.030 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:047.052 - 4.049ms returns 0x100 +T42A8 003:047.079 JLINK_HasError() +T42A8 003:047.089 JLINK_WriteReg(R0, 0x18008D00) +T42A8 003:047.100 - 0.011ms returns 0 +T42A8 003:047.108 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:047.114 - 0.006ms returns 0 +T42A8 003:047.122 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:047.128 - 0.006ms returns 0 +T42A8 003:047.136 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:047.142 - 0.006ms returns 0 +T42A8 003:047.150 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:047.156 - 0.006ms returns 0 +T42A8 003:047.164 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:047.170 - 0.006ms returns 0 +T42A8 003:047.178 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:047.184 - 0.006ms returns 0 +T42A8 003:047.191 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:047.198 - 0.006ms returns 0 +T42A8 003:047.205 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:047.222 - 0.017ms returns 0 +T42A8 003:047.230 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:047.240 - 0.009ms returns 0 +T42A8 003:047.250 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:047.256 - 0.006ms returns 0 +T42A8 003:047.264 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:047.270 - 0.006ms returns 0 +T42A8 003:047.278 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:047.285 - 0.006ms returns 0 +T42A8 003:047.293 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:047.299 - 0.007ms returns 0 +T42A8 003:047.307 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:047.313 - 0.006ms returns 0 +T42A8 003:047.321 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:047.327 - 0.006ms returns 0 +T42A8 003:047.335 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:047.341 - 0.006ms returns 0 +T42A8 003:047.349 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:047.355 - 0.006ms returns 0 +T42A8 003:047.363 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:047.369 - 0.006ms returns 0 +T42A8 003:047.376 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:047.383 - 0.006ms returns 0 +T42A8 003:047.391 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:047.398 - 0.008ms returns 0x00000075 +T42A8 003:047.406 JLINK_Go() +T42A8 003:047.420 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:053.867 - 6.460ms +T42A8 003:053.898 JLINK_IsHalted() +T42A8 003:054.537 - 0.637ms returns FALSE +T42A8 003:054.560 JLINK_HasError() +T42A8 003:061.417 JLINK_IsHalted() +T42A8 003:067.489 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:068.230 - 6.812ms returns TRUE +T42A8 003:068.263 JLINK_ReadReg(R15 (PC)) +T42A8 003:068.272 - 0.009ms returns 0x20003000 +T42A8 003:068.279 JLINK_ClrBPEx(BPHandle = 0x00000075) +T42A8 003:068.286 - 0.006ms returns 0x00 +T42A8 003:068.293 JLINK_ReadReg(R0) +T42A8 003:068.299 - 0.005ms returns 0x00000000 +T42A8 003:068.817 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:068.831 Data: 00 F0 10 F8 10 BD 10 B5 F7 49 82 00 89 58 49 68 ... +T42A8 003:068.847 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:072.887 - 4.069ms returns 0x100 +T42A8 003:072.913 JLINK_HasError() +T42A8 003:072.922 JLINK_WriteReg(R0, 0x18008E00) +T42A8 003:072.932 - 0.009ms returns 0 +T42A8 003:072.939 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:072.945 - 0.006ms returns 0 +T42A8 003:072.952 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:072.957 - 0.005ms returns 0 +T42A8 003:072.964 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:072.970 - 0.005ms returns 0 +T42A8 003:072.976 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:072.982 - 0.005ms returns 0 +T42A8 003:072.989 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:072.994 - 0.005ms returns 0 +T42A8 003:073.001 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:073.006 - 0.005ms returns 0 +T42A8 003:073.013 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:073.019 - 0.005ms returns 0 +T42A8 003:073.025 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:073.031 - 0.005ms returns 0 +T42A8 003:073.038 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:073.043 - 0.005ms returns 0 +T42A8 003:073.050 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:073.055 - 0.005ms returns 0 +T42A8 003:073.062 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:073.067 - 0.005ms returns 0 +T42A8 003:073.074 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:073.080 - 0.005ms returns 0 +T42A8 003:073.086 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:073.092 - 0.006ms returns 0 +T42A8 003:073.099 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:073.105 - 0.005ms returns 0 +T42A8 003:073.112 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:073.117 - 0.005ms returns 0 +T42A8 003:073.124 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:073.129 - 0.005ms returns 0 +T42A8 003:073.136 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:073.153 - 0.016ms returns 0 +T42A8 003:073.160 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:073.165 - 0.005ms returns 0 +T42A8 003:073.172 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:073.178 - 0.005ms returns 0 +T42A8 003:073.185 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:073.192 - 0.007ms returns 0x00000076 +T42A8 003:073.200 JLINK_Go() +T42A8 003:073.213 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:079.487 - 6.286ms +T42A8 003:079.512 JLINK_IsHalted() +T42A8 003:080.187 - 0.674ms returns FALSE +T42A8 003:080.206 JLINK_HasError() +T42A8 003:082.129 JLINK_IsHalted() +T42A8 003:088.112 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:088.834 - 6.704ms returns TRUE +T42A8 003:088.858 JLINK_ReadReg(R15 (PC)) +T42A8 003:088.867 - 0.009ms returns 0x20003000 +T42A8 003:088.873 JLINK_ClrBPEx(BPHandle = 0x00000076) +T42A8 003:088.879 - 0.005ms returns 0x00 +T42A8 003:088.886 JLINK_ReadReg(R0) +T42A8 003:088.891 - 0.005ms returns 0x00000000 +T42A8 003:089.384 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:089.397 Data: 01 21 30 46 04 F0 CA FE 05 B0 F0 BD 6A 46 10 70 ... +T42A8 003:089.413 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:093.389 - 4.005ms returns 0x100 +T42A8 003:093.413 JLINK_HasError() +T42A8 003:093.423 JLINK_WriteReg(R0, 0x18008F00) +T42A8 003:093.432 - 0.009ms returns 0 +T42A8 003:093.439 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:093.445 - 0.005ms returns 0 +T42A8 003:093.453 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:093.459 - 0.005ms returns 0 +T42A8 003:093.466 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:093.471 - 0.005ms returns 0 +T42A8 003:093.478 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:093.483 - 0.005ms returns 0 +T42A8 003:093.490 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:093.496 - 0.005ms returns 0 +T42A8 003:093.503 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:093.508 - 0.005ms returns 0 +T42A8 003:093.515 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:093.520 - 0.005ms returns 0 +T42A8 003:093.527 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:093.533 - 0.005ms returns 0 +T42A8 003:093.539 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:093.545 - 0.005ms returns 0 +T42A8 003:093.552 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:093.560 - 0.008ms returns 0 +T42A8 003:093.568 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:093.574 - 0.006ms returns 0 +T42A8 003:093.581 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:093.586 - 0.005ms returns 0 +T42A8 003:093.593 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:093.600 - 0.006ms returns 0 +T42A8 003:093.606 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:093.612 - 0.005ms returns 0 +T42A8 003:093.619 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:093.624 - 0.005ms returns 0 +T42A8 003:093.632 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:093.637 - 0.005ms returns 0 +T42A8 003:093.644 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:093.649 - 0.005ms returns 0 +T42A8 003:093.656 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:093.662 - 0.005ms returns 0 +T42A8 003:093.668 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:093.674 - 0.005ms returns 0 +T42A8 003:093.681 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:093.688 - 0.007ms returns 0x00000077 +T42A8 003:093.695 JLINK_Go() +T42A8 003:093.707 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:100.061 - 6.365ms +T42A8 003:100.103 JLINK_IsHalted() +T42A8 003:100.865 - 0.761ms returns FALSE +T42A8 003:100.893 JLINK_HasError() +T42A8 003:102.291 JLINK_IsHalted() +T42A8 003:108.495 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:109.264 - 6.971ms returns TRUE +T42A8 003:109.302 JLINK_ReadReg(R15 (PC)) +T42A8 003:109.314 - 0.012ms returns 0x20003000 +T42A8 003:109.324 JLINK_ClrBPEx(BPHandle = 0x00000077) +T42A8 003:109.332 - 0.008ms returns 0x00 +T42A8 003:109.429 JLINK_ReadReg(R0) +T42A8 003:109.446 - 0.017ms returns 0x00000000 +T42A8 003:110.063 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:110.079 Data: 03 D0 20 34 A0 7D 00 28 03 D0 39 46 30 46 FC F7 ... +T42A8 003:110.102 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:113.980 - 3.916ms returns 0x100 +T42A8 003:114.008 JLINK_HasError() +T42A8 003:114.020 JLINK_WriteReg(R0, 0x18009000) +T42A8 003:114.045 - 0.024ms returns 0 +T42A8 003:114.055 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:114.063 - 0.007ms returns 0 +T42A8 003:114.073 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:114.081 - 0.007ms returns 0 +T42A8 003:114.090 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:114.099 - 0.008ms returns 0 +T42A8 003:114.108 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:114.116 - 0.007ms returns 0 +T42A8 003:114.125 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:114.133 - 0.007ms returns 0 +T42A8 003:114.146 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:114.156 - 0.010ms returns 0 +T42A8 003:114.165 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:114.172 - 0.007ms returns 0 +T42A8 003:114.181 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:114.188 - 0.007ms returns 0 +T42A8 003:114.197 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:114.205 - 0.007ms returns 0 +T42A8 003:114.214 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:114.221 - 0.007ms returns 0 +T42A8 003:114.230 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:114.237 - 0.007ms returns 0 +T42A8 003:114.246 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:114.254 - 0.007ms returns 0 +T42A8 003:114.263 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:114.271 - 0.008ms returns 0 +T42A8 003:114.280 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:114.288 - 0.007ms returns 0 +T42A8 003:114.297 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:114.304 - 0.007ms returns 0 +T42A8 003:114.314 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:114.321 - 0.007ms returns 0 +T42A8 003:114.330 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:114.337 - 0.007ms returns 0 +T42A8 003:114.346 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:114.354 - 0.007ms returns 0 +T42A8 003:114.363 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:114.370 - 0.007ms returns 0 +T42A8 003:114.384 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:114.403 - 0.021ms returns 0x00000078 +T42A8 003:114.412 JLINK_Go() +T42A8 003:114.428 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:120.440 - 6.026ms +T42A8 003:120.458 JLINK_IsHalted() +T42A8 003:121.125 - 0.666ms returns FALSE +T42A8 003:121.141 JLINK_HasError() +T42A8 003:127.204 JLINK_IsHalted() +T42A8 003:133.326 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:134.075 - 6.870ms returns TRUE +T42A8 003:134.114 JLINK_ReadReg(R15 (PC)) +T42A8 003:134.128 - 0.014ms returns 0x20003000 +T42A8 003:134.140 JLINK_ClrBPEx(BPHandle = 0x00000078) +T42A8 003:134.151 - 0.010ms returns 0x00 +T42A8 003:134.163 JLINK_ReadReg(R0) +T42A8 003:134.172 - 0.009ms returns 0x00000000 +T42A8 003:134.920 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:134.942 Data: 04 F0 8F FD 01 22 11 46 30 46 04 F0 F1 FE 00 22 ... +T42A8 003:134.966 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:139.039 - 4.118ms returns 0x100 +T42A8 003:139.080 JLINK_HasError() +T42A8 003:139.178 JLINK_WriteReg(R0, 0x18009100) +T42A8 003:139.198 - 0.020ms returns 0 +T42A8 003:139.210 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:139.219 - 0.009ms returns 0 +T42A8 003:139.229 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:139.237 - 0.008ms returns 0 +T42A8 003:139.248 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:139.256 - 0.008ms returns 0 +T42A8 003:139.266 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:139.274 - 0.008ms returns 0 +T42A8 003:139.285 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:139.293 - 0.008ms returns 0 +T42A8 003:139.303 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:139.311 - 0.008ms returns 0 +T42A8 003:139.321 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:139.330 - 0.008ms returns 0 +T42A8 003:139.343 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:139.351 - 0.011ms returns 0 +T42A8 003:139.361 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:139.369 - 0.008ms returns 0 +T42A8 003:139.379 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:139.388 - 0.008ms returns 0 +T42A8 003:139.398 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:139.406 - 0.008ms returns 0 +T42A8 003:139.416 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:139.425 - 0.008ms returns 0 +T42A8 003:139.435 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:139.444 - 0.009ms returns 0 +T42A8 003:139.454 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:139.462 - 0.008ms returns 0 +T42A8 003:139.473 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:139.481 - 0.008ms returns 0 +T42A8 003:139.491 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:139.500 - 0.008ms returns 0 +T42A8 003:139.510 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:139.518 - 0.008ms returns 0 +T42A8 003:139.528 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:139.536 - 0.008ms returns 0 +T42A8 003:139.548 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:139.556 - 0.008ms returns 0 +T42A8 003:139.575 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:139.586 - 0.011ms returns 0x00000079 +T42A8 003:139.597 JLINK_Go() +T42A8 003:139.615 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:145.825 - 6.227ms +T42A8 003:145.857 JLINK_IsHalted() +T42A8 003:146.643 - 0.784ms returns FALSE +T42A8 003:146.675 JLINK_HasError() +T42A8 003:147.972 JLINK_IsHalted() +T42A8 003:154.030 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:154.675 - 6.702ms returns TRUE +T42A8 003:154.692 JLINK_ReadReg(R15 (PC)) +T42A8 003:154.704 - 0.011ms returns 0x20003000 +T42A8 003:154.715 JLINK_ClrBPEx(BPHandle = 0x00000079) +T42A8 003:154.724 - 0.009ms returns 0x00 +T42A8 003:154.734 JLINK_ReadReg(R0) +T42A8 003:154.743 - 0.008ms returns 0x00000000 +T42A8 003:155.400 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:155.414 Data: 21 46 22 46 30 46 0C 31 1C 32 02 F0 33 FF 01 21 ... +T42A8 003:155.432 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:159.370 - 3.970ms returns 0x100 +T42A8 003:159.396 JLINK_HasError() +T42A8 003:159.409 JLINK_WriteReg(R0, 0x18009200) +T42A8 003:159.422 - 0.013ms returns 0 +T42A8 003:159.433 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:159.441 - 0.008ms returns 0 +T42A8 003:159.451 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:159.460 - 0.008ms returns 0 +T42A8 003:159.470 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:159.478 - 0.008ms returns 0 +T42A8 003:159.488 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:159.496 - 0.008ms returns 0 +T42A8 003:159.506 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:159.515 - 0.008ms returns 0 +T42A8 003:159.525 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:159.533 - 0.008ms returns 0 +T42A8 003:159.543 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:159.552 - 0.008ms returns 0 +T42A8 003:159.562 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:159.570 - 0.008ms returns 0 +T42A8 003:159.580 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:159.588 - 0.008ms returns 0 +T42A8 003:159.598 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:159.606 - 0.008ms returns 0 +T42A8 003:159.616 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:159.625 - 0.008ms returns 0 +T42A8 003:159.635 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:159.643 - 0.008ms returns 0 +T42A8 003:159.653 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:159.662 - 0.009ms returns 0 +T42A8 003:159.672 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:159.680 - 0.008ms returns 0 +T42A8 003:159.691 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:159.699 - 0.008ms returns 0 +T42A8 003:159.709 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:159.718 - 0.008ms returns 0 +T42A8 003:159.728 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:159.736 - 0.008ms returns 0 +T42A8 003:159.746 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:159.754 - 0.008ms returns 0 +T42A8 003:159.764 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:159.772 - 0.008ms returns 0 +T42A8 003:159.783 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:159.793 - 0.009ms returns 0x0000007A +T42A8 003:159.803 JLINK_Go() +T42A8 003:159.818 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:165.946 - 6.141ms +T42A8 003:165.978 JLINK_IsHalted() +T42A8 003:166.661 - 0.682ms returns FALSE +T42A8 003:166.682 JLINK_HasError() +T42A8 003:173.943 JLINK_IsHalted() +T42A8 003:179.935 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:180.570 - 6.626ms returns TRUE +T42A8 003:180.592 JLINK_ReadReg(R15 (PC)) +T42A8 003:180.604 - 0.012ms returns 0x20003000 +T42A8 003:180.615 JLINK_ClrBPEx(BPHandle = 0x0000007A) +T42A8 003:180.624 - 0.009ms returns 0x00 +T42A8 003:180.634 JLINK_ReadReg(R0) +T42A8 003:180.643 - 0.008ms returns 0x00000000 +T42A8 003:181.327 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:181.340 Data: 20 46 39 46 1C 30 B0 47 08 22 39 1D 20 46 24 30 ... +T42A8 003:181.359 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:185.264 - 3.937ms returns 0x100 +T42A8 003:185.282 JLINK_HasError() +T42A8 003:185.294 JLINK_WriteReg(R0, 0x18009300) +T42A8 003:185.305 - 0.011ms returns 0 +T42A8 003:185.316 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:185.324 - 0.008ms returns 0 +T42A8 003:185.334 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:185.348 - 0.013ms returns 0 +T42A8 003:185.358 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:185.366 - 0.008ms returns 0 +T42A8 003:185.376 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:185.384 - 0.007ms returns 0 +T42A8 003:185.394 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:185.403 - 0.008ms returns 0 +T42A8 003:185.413 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:185.421 - 0.008ms returns 0 +T42A8 003:185.431 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:185.439 - 0.008ms returns 0 +T42A8 003:185.450 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:185.458 - 0.008ms returns 0 +T42A8 003:185.468 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:185.476 - 0.008ms returns 0 +T42A8 003:185.486 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:185.494 - 0.008ms returns 0 +T42A8 003:185.504 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:185.512 - 0.008ms returns 0 +T42A8 003:185.522 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:185.531 - 0.008ms returns 0 +T42A8 003:185.541 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:185.550 - 0.008ms returns 0 +T42A8 003:185.560 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:185.568 - 0.008ms returns 0 +T42A8 003:185.578 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:185.586 - 0.008ms returns 0 +T42A8 003:185.597 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:185.605 - 0.008ms returns 0 +T42A8 003:185.615 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:185.623 - 0.008ms returns 0 +T42A8 003:185.634 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:185.642 - 0.008ms returns 0 +T42A8 003:185.652 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:185.660 - 0.008ms returns 0 +T42A8 003:185.671 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:185.680 - 0.009ms returns 0x0000007B +T42A8 003:185.690 JLINK_Go() +T42A8 003:185.704 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:192.006 - 6.314ms +T42A8 003:192.051 JLINK_IsHalted() +T42A8 003:192.851 - 0.799ms returns FALSE +T42A8 003:192.889 JLINK_HasError() +T42A8 003:194.904 JLINK_IsHalted() +T42A8 003:200.994 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:201.681 - 6.776ms returns TRUE +T42A8 003:201.701 JLINK_ReadReg(R15 (PC)) +T42A8 003:201.713 - 0.011ms returns 0x20003000 +T42A8 003:201.724 JLINK_ClrBPEx(BPHandle = 0x0000007B) +T42A8 003:201.733 - 0.008ms returns 0x00 +T42A8 003:201.744 JLINK_ReadReg(R0) +T42A8 003:201.752 - 0.008ms returns 0x00000000 +T42A8 003:202.482 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:202.501 Data: 20 46 70 BD 01 22 FF 20 38 23 11 46 07 30 0A F0 ... +T42A8 003:202.523 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:206.461 - 3.979ms returns 0x100 +T42A8 003:206.481 JLINK_HasError() +T42A8 003:206.493 JLINK_WriteReg(R0, 0x18009400) +T42A8 003:206.504 - 0.011ms returns 0 +T42A8 003:206.515 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:206.524 - 0.009ms returns 0 +T42A8 003:206.534 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:206.542 - 0.008ms returns 0 +T42A8 003:206.552 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:206.560 - 0.008ms returns 0 +T42A8 003:206.572 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:206.580 - 0.008ms returns 0 +T42A8 003:206.590 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:206.599 - 0.008ms returns 0 +T42A8 003:206.609 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:206.617 - 0.008ms returns 0 +T42A8 003:206.628 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:206.636 - 0.008ms returns 0 +T42A8 003:206.646 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:206.654 - 0.008ms returns 0 +T42A8 003:206.664 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:206.672 - 0.008ms returns 0 +T42A8 003:206.682 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:206.691 - 0.008ms returns 0 +T42A8 003:206.701 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:206.709 - 0.008ms returns 0 +T42A8 003:206.720 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:206.728 - 0.008ms returns 0 +T42A8 003:206.738 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:206.747 - 0.009ms returns 0 +T42A8 003:206.757 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:206.765 - 0.008ms returns 0 +T42A8 003:206.776 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:206.792 - 0.016ms returns 0 +T42A8 003:206.802 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:206.817 - 0.014ms returns 0 +T42A8 003:206.828 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:206.842 - 0.011ms returns 0 +T42A8 003:206.863 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:206.874 - 0.010ms returns 0 +T42A8 003:206.884 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:206.892 - 0.008ms returns 0 +T42A8 003:206.903 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:206.913 - 0.010ms returns 0x0000007C +T42A8 003:206.923 JLINK_Go() +T42A8 003:206.939 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:212.866 - 5.942ms +T42A8 003:212.886 JLINK_IsHalted() +T42A8 003:213.464 - 0.578ms returns FALSE +T42A8 003:213.476 JLINK_HasError() +T42A8 003:215.878 JLINK_IsHalted() +T42A8 003:222.058 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:222.805 - 6.926ms returns TRUE +T42A8 003:222.834 JLINK_ReadReg(R15 (PC)) +T42A8 003:222.844 - 0.009ms returns 0x20003000 +T42A8 003:222.852 JLINK_ClrBPEx(BPHandle = 0x0000007C) +T42A8 003:222.858 - 0.005ms returns 0x00 +T42A8 003:222.866 JLINK_ReadReg(R0) +T42A8 003:222.872 - 0.005ms returns 0x00000000 +T42A8 003:223.337 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:223.350 Data: 0B 31 20 46 52 4B 24 30 98 47 08 22 69 1C 50 4B ... +T42A8 003:223.366 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:227.390 - 4.053ms returns 0x100 +T42A8 003:227.415 JLINK_HasError() +T42A8 003:227.424 JLINK_WriteReg(R0, 0x18009500) +T42A8 003:227.433 - 0.009ms returns 0 +T42A8 003:227.439 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:227.445 - 0.005ms returns 0 +T42A8 003:227.451 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:227.456 - 0.005ms returns 0 +T42A8 003:227.463 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:227.468 - 0.005ms returns 0 +T42A8 003:227.474 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:227.479 - 0.005ms returns 0 +T42A8 003:227.485 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:227.491 - 0.005ms returns 0 +T42A8 003:227.497 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:227.502 - 0.005ms returns 0 +T42A8 003:227.508 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:227.513 - 0.005ms returns 0 +T42A8 003:227.520 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:227.525 - 0.005ms returns 0 +T42A8 003:227.531 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:227.536 - 0.005ms returns 0 +T42A8 003:227.542 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:227.547 - 0.005ms returns 0 +T42A8 003:227.554 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:227.559 - 0.005ms returns 0 +T42A8 003:227.565 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:227.570 - 0.005ms returns 0 +T42A8 003:227.576 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:227.582 - 0.005ms returns 0 +T42A8 003:227.588 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:227.593 - 0.005ms returns 0 +T42A8 003:227.600 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:227.605 - 0.005ms returns 0 +T42A8 003:227.611 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:227.616 - 0.005ms returns 0 +T42A8 003:227.623 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:227.628 - 0.005ms returns 0 +T42A8 003:227.634 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:227.639 - 0.005ms returns 0 +T42A8 003:227.645 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:227.650 - 0.005ms returns 0 +T42A8 003:227.658 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:227.664 - 0.007ms returns 0x0000007D +T42A8 003:227.670 JLINK_Go() +T42A8 003:227.682 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:233.893 - 6.221ms +T42A8 003:233.919 JLINK_IsHalted() +T42A8 003:234.590 - 0.670ms returns FALSE +T42A8 003:234.603 JLINK_HasError() +T42A8 003:235.830 JLINK_IsHalted() +T42A8 003:241.757 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:242.305 - 6.474ms returns TRUE +T42A8 003:242.318 JLINK_ReadReg(R15 (PC)) +T42A8 003:242.325 - 0.007ms returns 0x20003000 +T42A8 003:242.332 JLINK_ClrBPEx(BPHandle = 0x0000007D) +T42A8 003:242.338 - 0.005ms returns 0x00 +T42A8 003:242.344 JLINK_ReadReg(R0) +T42A8 003:242.350 - 0.005ms returns 0x00000000 +T42A8 003:242.768 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:242.776 Data: 11 FC F8 E7 00 22 08 21 FF F7 2C FD F3 E7 FF B5 ... +T42A8 003:242.788 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:246.731 - 3.962ms returns 0x100 +T42A8 003:246.741 JLINK_HasError() +T42A8 003:246.748 JLINK_WriteReg(R0, 0x18009600) +T42A8 003:246.755 - 0.006ms returns 0 +T42A8 003:246.761 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:246.766 - 0.005ms returns 0 +T42A8 003:246.772 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:246.778 - 0.005ms returns 0 +T42A8 003:246.784 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:246.789 - 0.005ms returns 0 +T42A8 003:246.795 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:246.800 - 0.005ms returns 0 +T42A8 003:246.806 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:246.811 - 0.005ms returns 0 +T42A8 003:246.818 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:246.823 - 0.005ms returns 0 +T42A8 003:246.829 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:246.834 - 0.005ms returns 0 +T42A8 003:246.840 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:246.845 - 0.005ms returns 0 +T42A8 003:246.852 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:246.857 - 0.005ms returns 0 +T42A8 003:246.863 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:246.868 - 0.005ms returns 0 +T42A8 003:246.874 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:246.880 - 0.006ms returns 0 +T42A8 003:246.889 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:246.894 - 0.005ms returns 0 +T42A8 003:246.900 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:246.906 - 0.005ms returns 0 +T42A8 003:246.912 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:246.917 - 0.005ms returns 0 +T42A8 003:246.923 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:246.928 - 0.005ms returns 0 +T42A8 003:246.934 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:246.939 - 0.005ms returns 0 +T42A8 003:246.946 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:246.951 - 0.005ms returns 0 +T42A8 003:246.957 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:246.962 - 0.005ms returns 0 +T42A8 003:246.968 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:246.974 - 0.006ms returns 0 +T42A8 003:246.981 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:246.987 - 0.005ms returns 0x0000007E +T42A8 003:246.993 JLINK_Go() +T42A8 003:247.002 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:253.094 - 6.101ms +T42A8 003:253.107 JLINK_IsHalted() +T42A8 003:253.769 - 0.661ms returns FALSE +T42A8 003:253.780 JLINK_HasError() +T42A8 003:255.818 JLINK_IsHalted() +T42A8 003:261.797 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:262.437 - 6.618ms returns TRUE +T42A8 003:262.449 JLINK_ReadReg(R15 (PC)) +T42A8 003:262.457 - 0.007ms returns 0x20003000 +T42A8 003:262.464 JLINK_ClrBPEx(BPHandle = 0x0000007E) +T42A8 003:262.471 - 0.006ms returns 0x00 +T42A8 003:262.478 JLINK_ReadReg(R0) +T42A8 003:262.485 - 0.006ms returns 0x00000000 +T42A8 003:262.908 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:262.918 Data: 30 46 04 F0 F5 FA 78 59 01 22 C1 8F 52 02 91 43 ... +T42A8 003:262.930 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:266.818 - 3.909ms returns 0x100 +T42A8 003:266.831 JLINK_HasError() +T42A8 003:266.840 JLINK_WriteReg(R0, 0x18009700) +T42A8 003:266.848 - 0.008ms returns 0 +T42A8 003:266.856 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:266.863 - 0.006ms returns 0 +T42A8 003:266.871 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:266.878 - 0.006ms returns 0 +T42A8 003:266.886 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:266.892 - 0.006ms returns 0 +T42A8 003:266.900 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:266.907 - 0.006ms returns 0 +T42A8 003:266.915 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:266.921 - 0.006ms returns 0 +T42A8 003:266.929 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:266.936 - 0.006ms returns 0 +T42A8 003:266.944 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:266.951 - 0.006ms returns 0 +T42A8 003:266.959 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:266.965 - 0.006ms returns 0 +T42A8 003:266.973 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:266.980 - 0.006ms returns 0 +T42A8 003:266.988 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:266.994 - 0.006ms returns 0 +T42A8 003:267.002 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:267.009 - 0.006ms returns 0 +T42A8 003:267.017 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:267.023 - 0.006ms returns 0 +T42A8 003:267.035 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:267.042 - 0.007ms returns 0 +T42A8 003:267.050 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:267.057 - 0.006ms returns 0 +T42A8 003:267.065 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:267.072 - 0.006ms returns 0 +T42A8 003:267.080 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:267.087 - 0.007ms returns 0 +T42A8 003:267.095 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:267.101 - 0.006ms returns 0 +T42A8 003:267.132 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:267.138 - 0.006ms returns 0 +T42A8 003:267.147 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:267.153 - 0.006ms returns 0 +T42A8 003:267.162 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:267.169 - 0.007ms returns 0x0000007F +T42A8 003:267.177 JLINK_Go() +T42A8 003:267.188 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:273.026 - 5.848ms +T42A8 003:273.037 JLINK_IsHalted() +T42A8 003:273.546 - 0.508ms returns FALSE +T42A8 003:273.569 JLINK_HasError() +T42A8 003:279.825 JLINK_IsHalted() +T42A8 003:285.968 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:286.724 - 6.897ms returns TRUE +T42A8 003:286.768 JLINK_ReadReg(R15 (PC)) +T42A8 003:286.777 - 0.008ms returns 0x20003000 +T42A8 003:286.783 JLINK_ClrBPEx(BPHandle = 0x0000007F) +T42A8 003:286.788 - 0.005ms returns 0x00 +T42A8 003:286.794 JLINK_ReadReg(R0) +T42A8 003:286.800 - 0.004ms returns 0x00000000 +T42A8 003:287.238 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:287.250 Data: 4D FA F8 BD 00 22 11 46 30 46 04 F0 47 FA D3 E7 ... +T42A8 003:287.265 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:291.226 - 3.987ms returns 0x100 +T42A8 003:291.251 JLINK_HasError() +T42A8 003:291.259 JLINK_WriteReg(R0, 0x18009800) +T42A8 003:291.268 - 0.009ms returns 0 +T42A8 003:291.274 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:291.280 - 0.005ms returns 0 +T42A8 003:291.286 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:291.291 - 0.005ms returns 0 +T42A8 003:291.297 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:291.302 - 0.005ms returns 0 +T42A8 003:291.308 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:291.313 - 0.005ms returns 0 +T42A8 003:291.319 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:291.324 - 0.005ms returns 0 +T42A8 003:291.330 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:291.335 - 0.005ms returns 0 +T42A8 003:291.341 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:291.346 - 0.005ms returns 0 +T42A8 003:291.352 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:291.357 - 0.005ms returns 0 +T42A8 003:291.363 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:291.368 - 0.005ms returns 0 +T42A8 003:291.374 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:291.382 - 0.007ms returns 0 +T42A8 003:291.388 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:291.393 - 0.005ms returns 0 +T42A8 003:291.399 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:291.403 - 0.004ms returns 0 +T42A8 003:291.410 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:291.415 - 0.005ms returns 0 +T42A8 003:291.421 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:291.426 - 0.004ms returns 0 +T42A8 003:291.432 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:291.436 - 0.005ms returns 0 +T42A8 003:291.442 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:291.447 - 0.004ms returns 0 +T42A8 003:291.453 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:291.458 - 0.004ms returns 0 +T42A8 003:291.464 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:291.468 - 0.004ms returns 0 +T42A8 003:291.474 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:291.479 - 0.004ms returns 0 +T42A8 003:291.485 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:291.491 - 0.006ms returns 0x00000080 +T42A8 003:291.497 JLINK_Go() +T42A8 003:291.508 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:297.775 - 6.276ms +T42A8 003:297.804 JLINK_IsHalted() +T42A8 003:298.612 - 0.806ms returns FALSE +T42A8 003:298.649 JLINK_HasError() +T42A8 003:299.773 JLINK_IsHalted() +T42A8 003:305.940 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:306.626 - 6.852ms returns TRUE +T42A8 003:306.643 JLINK_ReadReg(R15 (PC)) +T42A8 003:306.652 - 0.007ms returns 0x20003000 +T42A8 003:306.658 JLINK_ClrBPEx(BPHandle = 0x00000080) +T42A8 003:306.668 - 0.010ms returns 0x00 +T42A8 003:306.676 JLINK_ReadReg(R0) +T42A8 003:306.681 - 0.005ms returns 0x00000000 +T42A8 003:307.189 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:307.208 Data: 4E 78 1A 46 20 32 16 72 8E 78 56 72 CE 78 96 72 ... +T42A8 003:307.230 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:311.184 - 3.995ms returns 0x100 +T42A8 003:311.198 JLINK_HasError() +T42A8 003:311.206 JLINK_WriteReg(R0, 0x18009900) +T42A8 003:311.213 - 0.007ms returns 0 +T42A8 003:311.220 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:311.225 - 0.005ms returns 0 +T42A8 003:311.231 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:311.236 - 0.005ms returns 0 +T42A8 003:311.243 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:311.248 - 0.005ms returns 0 +T42A8 003:311.255 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:311.260 - 0.005ms returns 0 +T42A8 003:311.266 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:311.272 - 0.005ms returns 0 +T42A8 003:311.278 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:311.283 - 0.005ms returns 0 +T42A8 003:311.289 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:311.294 - 0.005ms returns 0 +T42A8 003:311.301 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:311.306 - 0.005ms returns 0 +T42A8 003:311.312 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:311.317 - 0.005ms returns 0 +T42A8 003:311.323 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:311.328 - 0.005ms returns 0 +T42A8 003:311.334 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:311.340 - 0.005ms returns 0 +T42A8 003:311.346 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:311.351 - 0.005ms returns 0 +T42A8 003:311.357 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:311.363 - 0.005ms returns 0 +T42A8 003:311.369 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:311.374 - 0.005ms returns 0 +T42A8 003:311.381 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:311.386 - 0.005ms returns 0 +T42A8 003:311.392 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:311.397 - 0.005ms returns 0 +T42A8 003:311.403 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:311.408 - 0.005ms returns 0 +T42A8 003:311.415 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:311.420 - 0.005ms returns 0 +T42A8 003:311.426 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:311.431 - 0.005ms returns 0 +T42A8 003:311.438 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:311.444 - 0.006ms returns 0x00000081 +T42A8 003:311.450 JLINK_Go() +T42A8 003:311.461 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:317.620 - 6.169ms +T42A8 003:317.631 JLINK_IsHalted() +T42A8 003:318.340 - 0.708ms returns FALSE +T42A8 003:318.350 JLINK_HasError() +T42A8 003:320.590 JLINK_IsHalted() +T42A8 003:326.583 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:327.221 - 6.631ms returns TRUE +T42A8 003:327.234 JLINK_ReadReg(R15 (PC)) +T42A8 003:327.242 - 0.007ms returns 0x20003000 +T42A8 003:327.250 JLINK_ClrBPEx(BPHandle = 0x00000081) +T42A8 003:327.257 - 0.006ms returns 0x00 +T42A8 003:327.264 JLINK_ReadReg(R0) +T42A8 003:327.270 - 0.006ms returns 0x00000000 +T42A8 003:327.735 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:327.745 Data: 15 58 00 27 2C 68 83 B0 61 78 00 29 02 D0 01 29 ... +T42A8 003:327.758 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:331.619 - 3.884ms returns 0x100 +T42A8 003:331.633 JLINK_HasError() +T42A8 003:331.642 JLINK_WriteReg(R0, 0x18009A00) +T42A8 003:331.650 - 0.008ms returns 0 +T42A8 003:331.658 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:331.665 - 0.006ms returns 0 +T42A8 003:331.673 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:331.680 - 0.006ms returns 0 +T42A8 003:331.688 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:331.695 - 0.006ms returns 0 +T42A8 003:331.703 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:331.710 - 0.006ms returns 0 +T42A8 003:331.718 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:331.724 - 0.006ms returns 0 +T42A8 003:331.732 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:331.739 - 0.006ms returns 0 +T42A8 003:331.747 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:331.754 - 0.006ms returns 0 +T42A8 003:331.762 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:331.768 - 0.006ms returns 0 +T42A8 003:331.776 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:331.788 - 0.011ms returns 0 +T42A8 003:331.796 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:331.803 - 0.006ms returns 0 +T42A8 003:331.811 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:331.818 - 0.006ms returns 0 +T42A8 003:331.826 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:331.832 - 0.006ms returns 0 +T42A8 003:331.841 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:331.848 - 0.007ms returns 0 +T42A8 003:331.856 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:331.863 - 0.007ms returns 0 +T42A8 003:331.872 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:331.879 - 0.006ms returns 0 +T42A8 003:331.887 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:331.894 - 0.006ms returns 0 +T42A8 003:331.902 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:331.908 - 0.006ms returns 0 +T42A8 003:331.916 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:331.923 - 0.006ms returns 0 +T42A8 003:331.931 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:331.938 - 0.006ms returns 0 +T42A8 003:331.946 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:331.954 - 0.007ms returns 0x00000082 +T42A8 003:331.962 JLINK_Go() +T42A8 003:331.973 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:338.132 - 6.169ms +T42A8 003:338.149 JLINK_IsHalted() +T42A8 003:338.824 - 0.674ms returns FALSE +T42A8 003:338.841 JLINK_HasError() +T42A8 003:340.473 JLINK_IsHalted() +T42A8 003:346.418 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:347.025 - 6.551ms returns TRUE +T42A8 003:347.044 JLINK_ReadReg(R15 (PC)) +T42A8 003:347.056 - 0.011ms returns 0x20003000 +T42A8 003:347.069 JLINK_ClrBPEx(BPHandle = 0x00000082) +T42A8 003:347.078 - 0.009ms returns 0x00 +T42A8 003:347.090 JLINK_ReadReg(R0) +T42A8 003:347.100 - 0.009ms returns 0x00000000 +T42A8 003:347.758 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:347.774 Data: 08 40 68 70 00 21 30 46 04 F0 F2 F8 BC E7 01 27 ... +T42A8 003:347.793 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:351.724 - 3.966ms returns 0x100 +T42A8 003:351.746 JLINK_HasError() +T42A8 003:351.762 JLINK_WriteReg(R0, 0x18009B00) +T42A8 003:351.775 - 0.013ms returns 0 +T42A8 003:351.789 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:351.801 - 0.011ms returns 0 +T42A8 003:351.814 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:351.825 - 0.011ms returns 0 +T42A8 003:351.839 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:351.850 - 0.011ms returns 0 +T42A8 003:351.863 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:351.874 - 0.011ms returns 0 +T42A8 003:351.888 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:351.899 - 0.011ms returns 0 +T42A8 003:351.912 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:351.924 - 0.011ms returns 0 +T42A8 003:351.937 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:351.948 - 0.011ms returns 0 +T42A8 003:351.961 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:351.972 - 0.011ms returns 0 +T42A8 003:351.986 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:351.996 - 0.011ms returns 0 +T42A8 003:352.010 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:352.021 - 0.010ms returns 0 +T42A8 003:352.034 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:352.045 - 0.011ms returns 0 +T42A8 003:352.058 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:352.069 - 0.010ms returns 0 +T42A8 003:352.083 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:352.095 - 0.011ms returns 0 +T42A8 003:352.108 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:352.119 - 0.011ms returns 0 +T42A8 003:352.133 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:352.144 - 0.011ms returns 0 +T42A8 003:352.158 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:352.169 - 0.011ms returns 0 +T42A8 003:352.183 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:352.194 - 0.011ms returns 0 +T42A8 003:352.207 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:352.218 - 0.011ms returns 0 +T42A8 003:352.232 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:352.243 - 0.011ms returns 0 +T42A8 003:352.257 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:352.270 - 0.012ms returns 0x00000083 +T42A8 003:352.285 JLINK_Go() +T42A8 003:352.303 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:358.301 - 6.015ms +T42A8 003:358.328 JLINK_IsHalted() +T42A8 003:359.015 - 0.685ms returns FALSE +T42A8 003:359.045 JLINK_HasError() +T42A8 003:360.439 JLINK_IsHalted() +T42A8 003:366.568 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:367.278 - 6.837ms returns TRUE +T42A8 003:367.317 JLINK_ReadReg(R15 (PC)) +T42A8 003:367.338 - 0.021ms returns 0x20003000 +T42A8 003:367.374 JLINK_ClrBPEx(BPHandle = 0x00000083) +T42A8 003:367.393 - 0.018ms returns 0x00 +T42A8 003:367.417 JLINK_ReadReg(R0) +T42A8 003:367.434 - 0.017ms returns 0x00000000 +T42A8 003:368.604 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:368.632 Data: 11 E0 11 78 F6 E7 51 78 14 29 10 D1 19 21 04 28 ... +T42A8 003:368.666 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:372.768 - 4.164ms returns 0x100 +T42A8 003:372.803 JLINK_HasError() +T42A8 003:372.826 JLINK_WriteReg(R0, 0x18009C00) +T42A8 003:372.846 - 0.020ms returns 0 +T42A8 003:372.867 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:372.884 - 0.017ms returns 0 +T42A8 003:372.905 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:372.922 - 0.016ms returns 0 +T42A8 003:372.942 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:372.958 - 0.016ms returns 0 +T42A8 003:372.978 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:372.995 - 0.016ms returns 0 +T42A8 003:373.015 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:373.031 - 0.016ms returns 0 +T42A8 003:373.052 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:373.068 - 0.016ms returns 0 +T42A8 003:373.088 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:373.105 - 0.016ms returns 0 +T42A8 003:373.125 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:373.143 - 0.017ms returns 0 +T42A8 003:373.163 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:373.180 - 0.016ms returns 0 +T42A8 003:373.200 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:373.216 - 0.016ms returns 0 +T42A8 003:373.237 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:373.253 - 0.016ms returns 0 +T42A8 003:373.273 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:373.290 - 0.016ms returns 0 +T42A8 003:373.310 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:373.328 - 0.018ms returns 0 +T42A8 003:373.388 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:373.425 - 0.037ms returns 0 +T42A8 003:373.456 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:373.474 - 0.019ms returns 0 +T42A8 003:373.495 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:373.511 - 0.016ms returns 0 +T42A8 003:373.531 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:373.547 - 0.016ms returns 0 +T42A8 003:373.567 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:373.582 - 0.015ms returns 0 +T42A8 003:373.602 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:373.618 - 0.016ms returns 0 +T42A8 003:373.640 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:373.658 - 0.019ms returns 0x00000084 +T42A8 003:373.678 JLINK_Go() +T42A8 003:373.706 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:379.930 - 6.251ms +T42A8 003:379.965 JLINK_IsHalted() +T42A8 003:380.706 - 0.739ms returns FALSE +T42A8 003:380.740 JLINK_HasError() +T42A8 003:382.388 JLINK_IsHalted() +T42A8 003:388.514 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:389.066 - 6.678ms returns TRUE +T42A8 003:389.077 JLINK_ReadReg(R15 (PC)) +T42A8 003:389.084 - 0.007ms returns 0x20003000 +T42A8 003:389.090 JLINK_ClrBPEx(BPHandle = 0x00000084) +T42A8 003:389.096 - 0.005ms returns 0x00 +T42A8 003:389.102 JLINK_ReadReg(R0) +T42A8 003:389.107 - 0.004ms returns 0x00000000 +T42A8 003:389.547 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:389.555 Data: 00 D2 30 46 88 80 50 78 17 78 CE 88 00 02 38 43 ... +T42A8 003:389.566 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:393.452 - 3.904ms returns 0x100 +T42A8 003:393.482 JLINK_HasError() +T42A8 003:393.490 JLINK_WriteReg(R0, 0x18009D00) +T42A8 003:393.496 - 0.006ms returns 0 +T42A8 003:393.502 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:393.507 - 0.004ms returns 0 +T42A8 003:393.570 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:393.578 - 0.008ms returns 0 +T42A8 003:393.584 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:393.589 - 0.005ms returns 0 +T42A8 003:393.595 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:393.600 - 0.004ms returns 0 +T42A8 003:393.606 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:393.614 - 0.007ms returns 0 +T42A8 003:393.622 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:393.627 - 0.004ms returns 0 +T42A8 003:393.632 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:393.638 - 0.004ms returns 0 +T42A8 003:393.644 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:393.648 - 0.004ms returns 0 +T42A8 003:393.654 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:393.659 - 0.005ms returns 0 +T42A8 003:393.665 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:393.670 - 0.004ms returns 0 +T42A8 003:393.676 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:393.681 - 0.004ms returns 0 +T42A8 003:393.687 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:393.692 - 0.004ms returns 0 +T42A8 003:393.698 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:393.703 - 0.005ms returns 0 +T42A8 003:393.709 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:393.714 - 0.004ms returns 0 +T42A8 003:393.720 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:393.724 - 0.005ms returns 0 +T42A8 003:393.730 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:393.735 - 0.004ms returns 0 +T42A8 003:393.741 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:393.746 - 0.004ms returns 0 +T42A8 003:393.752 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:393.757 - 0.004ms returns 0 +T42A8 003:393.763 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:393.768 - 0.004ms returns 0 +T42A8 003:393.774 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:393.780 - 0.006ms returns 0x00000085 +T42A8 003:393.786 JLINK_Go() +T42A8 003:393.795 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:399.635 - 5.848ms +T42A8 003:399.645 JLINK_IsHalted() +T42A8 003:400.320 - 0.673ms returns FALSE +T42A8 003:400.329 JLINK_HasError() +T42A8 003:405.502 JLINK_IsHalted() +T42A8 003:411.610 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:412.392 - 6.889ms returns TRUE +T42A8 003:412.420 JLINK_ReadReg(R15 (PC)) +T42A8 003:412.428 - 0.008ms returns 0x20003000 +T42A8 003:412.435 JLINK_ClrBPEx(BPHandle = 0x00000085) +T42A8 003:412.440 - 0.005ms returns 0x00 +T42A8 003:412.447 JLINK_ReadReg(R0) +T42A8 003:412.452 - 0.005ms returns 0x00000000 +T42A8 003:412.936 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:412.948 Data: 90 42 00 00 D0 78 00 28 F4 D0 00 20 03 46 02 46 ... +T42A8 003:412.963 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:417.046 - 4.110ms returns 0x100 +T42A8 003:417.070 JLINK_HasError() +T42A8 003:417.080 JLINK_WriteReg(R0, 0x18009E00) +T42A8 003:417.088 - 0.008ms returns 0 +T42A8 003:417.094 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:417.100 - 0.005ms returns 0 +T42A8 003:417.106 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:417.111 - 0.005ms returns 0 +T42A8 003:417.117 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:417.122 - 0.005ms returns 0 +T42A8 003:417.130 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:417.135 - 0.005ms returns 0 +T42A8 003:417.141 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:417.146 - 0.005ms returns 0 +T42A8 003:417.152 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:417.157 - 0.005ms returns 0 +T42A8 003:417.163 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:417.168 - 0.005ms returns 0 +T42A8 003:417.174 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:417.180 - 0.005ms returns 0 +T42A8 003:417.186 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:417.191 - 0.004ms returns 0 +T42A8 003:417.196 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:417.202 - 0.005ms returns 0 +T42A8 003:417.208 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:417.213 - 0.005ms returns 0 +T42A8 003:417.228 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:417.234 - 0.005ms returns 0 +T42A8 003:417.240 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:417.246 - 0.005ms returns 0 +T42A8 003:417.252 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:417.257 - 0.005ms returns 0 +T42A8 003:417.263 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:417.268 - 0.005ms returns 0 +T42A8 003:417.274 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:417.279 - 0.004ms returns 0 +T42A8 003:417.285 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:417.290 - 0.004ms returns 0 +T42A8 003:417.296 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:417.301 - 0.004ms returns 0 +T42A8 003:417.307 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:417.315 - 0.007ms returns 0 +T42A8 003:417.324 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:417.329 - 0.006ms returns 0x00000086 +T42A8 003:417.336 JLINK_Go() +T42A8 003:417.347 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:423.579 - 6.242ms +T42A8 003:423.604 JLINK_IsHalted() +T42A8 003:424.319 - 0.714ms returns FALSE +T42A8 003:424.341 JLINK_HasError() +T42A8 003:426.264 JLINK_IsHalted() +T42A8 003:432.188 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:432.917 - 6.654ms returns TRUE +T42A8 003:432.942 JLINK_ReadReg(R15 (PC)) +T42A8 003:432.951 - 0.008ms returns 0x20003000 +T42A8 003:432.957 JLINK_ClrBPEx(BPHandle = 0x00000086) +T42A8 003:432.963 - 0.005ms returns 0x00 +T42A8 003:432.970 JLINK_ReadReg(R0) +T42A8 003:432.975 - 0.005ms returns 0x00000000 +T42A8 003:433.450 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:433.464 Data: 08 18 A1 88 49 00 07 F0 77 FB 08 A8 0A 91 02 F0 ... +T42A8 003:433.478 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:437.445 - 3.994ms returns 0x100 +T42A8 003:437.478 JLINK_HasError() +T42A8 003:437.487 JLINK_WriteReg(R0, 0x18009F00) +T42A8 003:437.496 - 0.008ms returns 0 +T42A8 003:437.502 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:437.508 - 0.005ms returns 0 +T42A8 003:437.514 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:437.519 - 0.005ms returns 0 +T42A8 003:437.524 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:437.530 - 0.005ms returns 0 +T42A8 003:437.536 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:437.540 - 0.005ms returns 0 +T42A8 003:437.547 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:437.552 - 0.004ms returns 0 +T42A8 003:437.558 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:437.562 - 0.004ms returns 0 +T42A8 003:437.568 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:437.573 - 0.005ms returns 0 +T42A8 003:437.580 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:437.584 - 0.005ms returns 0 +T42A8 003:437.591 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:437.596 - 0.004ms returns 0 +T42A8 003:437.602 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:437.606 - 0.005ms returns 0 +T42A8 003:437.612 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:437.618 - 0.005ms returns 0 +T42A8 003:437.624 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:437.628 - 0.004ms returns 0 +T42A8 003:437.635 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:437.642 - 0.008ms returns 0 +T42A8 003:437.648 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:437.653 - 0.005ms returns 0 +T42A8 003:437.663 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:437.668 - 0.007ms returns 0 +T42A8 003:437.674 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:437.679 - 0.005ms returns 0 +T42A8 003:437.685 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:437.690 - 0.005ms returns 0 +T42A8 003:437.696 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:437.701 - 0.004ms returns 0 +T42A8 003:437.707 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:437.712 - 0.004ms returns 0 +T42A8 003:437.719 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:437.725 - 0.006ms returns 0x00000087 +T42A8 003:437.731 JLINK_Go() +T42A8 003:437.743 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:444.172 - 6.440ms +T42A8 003:444.197 JLINK_IsHalted() +T42A8 003:444.976 - 0.778ms returns FALSE +T42A8 003:445.001 JLINK_HasError() +T42A8 003:447.200 JLINK_IsHalted() +T42A8 003:453.409 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:454.178 - 6.976ms returns TRUE +T42A8 003:454.207 JLINK_ReadReg(R15 (PC)) +T42A8 003:454.217 - 0.009ms returns 0x20003000 +T42A8 003:454.225 JLINK_ClrBPEx(BPHandle = 0x00000087) +T42A8 003:454.232 - 0.006ms returns 0x00 +T42A8 003:454.240 JLINK_ReadReg(R0) +T42A8 003:454.246 - 0.005ms returns 0x00000000 +T42A8 003:454.742 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:454.756 Data: 02 22 02 29 00 D8 11 46 03 91 02 F0 78 F8 00 90 ... +T42A8 003:454.772 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:458.820 - 4.077ms returns 0x100 +T42A8 003:458.846 JLINK_HasError() +T42A8 003:458.855 JLINK_WriteReg(R0, 0x1800A000) +T42A8 003:458.865 - 0.009ms returns 0 +T42A8 003:458.872 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:458.878 - 0.005ms returns 0 +T42A8 003:458.888 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:458.895 - 0.007ms returns 0 +T42A8 003:458.902 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:458.907 - 0.005ms returns 0 +T42A8 003:458.914 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:458.920 - 0.005ms returns 0 +T42A8 003:458.926 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:458.932 - 0.005ms returns 0 +T42A8 003:458.938 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:458.944 - 0.005ms returns 0 +T42A8 003:458.951 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:458.956 - 0.005ms returns 0 +T42A8 003:458.963 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:458.969 - 0.005ms returns 0 +T42A8 003:458.976 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:458.981 - 0.005ms returns 0 +T42A8 003:458.988 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:458.993 - 0.005ms returns 0 +T42A8 003:459.000 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:459.005 - 0.005ms returns 0 +T42A8 003:459.012 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:459.017 - 0.005ms returns 0 +T42A8 003:459.024 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:459.030 - 0.006ms returns 0 +T42A8 003:459.038 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:459.043 - 0.005ms returns 0 +T42A8 003:459.050 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:459.056 - 0.005ms returns 0 +T42A8 003:459.062 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:459.068 - 0.005ms returns 0 +T42A8 003:459.075 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:459.080 - 0.005ms returns 0 +T42A8 003:459.087 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:459.092 - 0.005ms returns 0 +T42A8 003:459.099 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:459.123 - 0.023ms returns 0 +T42A8 003:459.140 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:459.149 - 0.009ms returns 0x00000088 +T42A8 003:459.156 JLINK_Go() +T42A8 003:459.177 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:465.324 - 6.165ms +T42A8 003:465.354 JLINK_IsHalted() +T42A8 003:466.031 - 0.676ms returns FALSE +T42A8 003:466.046 JLINK_HasError() +T42A8 003:468.360 JLINK_IsHalted() +T42A8 003:474.496 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:475.037 - 6.677ms returns TRUE +T42A8 003:475.054 JLINK_ReadReg(R15 (PC)) +T42A8 003:475.074 - 0.020ms returns 0x20003000 +T42A8 003:475.084 JLINK_ClrBPEx(BPHandle = 0x00000088) +T42A8 003:475.091 - 0.007ms returns 0x00 +T42A8 003:475.100 JLINK_ReadReg(R0) +T42A8 003:475.107 - 0.006ms returns 0x00000000 +T42A8 003:475.675 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:475.685 Data: 20 30 03 90 00 7A 00 28 38 46 26 D0 01 F0 40 FF ... +T42A8 003:475.700 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:479.652 - 3.977ms returns 0x100 +T42A8 003:479.681 JLINK_HasError() +T42A8 003:479.692 JLINK_WriteReg(R0, 0x1800A100) +T42A8 003:479.703 - 0.010ms returns 0 +T42A8 003:479.712 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:479.719 - 0.007ms returns 0 +T42A8 003:479.728 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:479.735 - 0.006ms returns 0 +T42A8 003:479.745 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:479.752 - 0.006ms returns 0 +T42A8 003:479.760 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:479.767 - 0.006ms returns 0 +T42A8 003:479.777 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:479.783 - 0.006ms returns 0 +T42A8 003:479.793 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:479.800 - 0.007ms returns 0 +T42A8 003:479.810 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:479.816 - 0.006ms returns 0 +T42A8 003:479.826 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:479.832 - 0.006ms returns 0 +T42A8 003:479.910 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:479.924 - 0.014ms returns 0 +T42A8 003:479.934 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:479.941 - 0.007ms returns 0 +T42A8 003:479.949 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:479.956 - 0.006ms returns 0 +T42A8 003:479.964 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:479.971 - 0.006ms returns 0 +T42A8 003:479.980 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:479.987 - 0.007ms returns 0 +T42A8 003:479.995 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:480.002 - 0.006ms returns 0 +T42A8 003:480.010 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:480.016 - 0.007ms returns 0 +T42A8 003:480.028 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:480.037 - 0.008ms returns 0 +T42A8 003:480.045 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:480.064 - 0.018ms returns 0 +T42A8 003:480.072 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:480.079 - 0.006ms returns 0 +T42A8 003:480.087 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:480.094 - 0.006ms returns 0 +T42A8 003:480.103 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:480.113 - 0.011ms returns 0x00000089 +T42A8 003:480.122 JLINK_Go() +T42A8 003:480.137 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:486.340 - 6.217ms +T42A8 003:486.366 JLINK_IsHalted() +T42A8 003:487.009 - 0.642ms returns FALSE +T42A8 003:487.024 JLINK_HasError() +T42A8 003:488.129 JLINK_IsHalted() +T42A8 003:494.074 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:494.652 - 6.522ms returns TRUE +T42A8 003:494.664 JLINK_ReadReg(R15 (PC)) +T42A8 003:494.672 - 0.007ms returns 0x20003000 +T42A8 003:494.678 JLINK_ClrBPEx(BPHandle = 0x00000089) +T42A8 003:494.684 - 0.005ms returns 0x00 +T42A8 003:494.690 JLINK_ReadReg(R0) +T42A8 003:494.696 - 0.005ms returns 0x00000000 +T42A8 003:495.115 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:495.124 Data: 90 92 00 20 FF FF 00 00 E2 04 00 00 19 0F 00 00 ... +T42A8 003:495.136 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:499.084 - 3.969ms returns 0x100 +T42A8 003:499.096 JLINK_HasError() +T42A8 003:499.103 JLINK_WriteReg(R0, 0x1800A200) +T42A8 003:499.110 - 0.006ms returns 0 +T42A8 003:499.116 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:499.122 - 0.005ms returns 0 +T42A8 003:499.128 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:499.133 - 0.005ms returns 0 +T42A8 003:499.140 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:499.144 - 0.005ms returns 0 +T42A8 003:499.151 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:499.156 - 0.005ms returns 0 +T42A8 003:499.162 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:499.167 - 0.005ms returns 0 +T42A8 003:499.173 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:499.178 - 0.005ms returns 0 +T42A8 003:499.184 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:499.190 - 0.005ms returns 0 +T42A8 003:499.196 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:499.201 - 0.005ms returns 0 +T42A8 003:499.207 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:499.212 - 0.005ms returns 0 +T42A8 003:499.218 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:499.224 - 0.005ms returns 0 +T42A8 003:499.230 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:499.235 - 0.005ms returns 0 +T42A8 003:499.241 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:499.246 - 0.005ms returns 0 +T42A8 003:499.252 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:499.258 - 0.005ms returns 0 +T42A8 003:499.264 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:499.269 - 0.005ms returns 0 +T42A8 003:499.276 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:499.280 - 0.005ms returns 0 +T42A8 003:499.287 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:499.292 - 0.005ms returns 0 +T42A8 003:499.298 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:499.303 - 0.005ms returns 0 +T42A8 003:499.309 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:499.314 - 0.005ms returns 0 +T42A8 003:499.320 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:499.326 - 0.005ms returns 0 +T42A8 003:499.333 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:499.342 - 0.008ms returns 0x0000008A +T42A8 003:499.348 JLINK_Go() +T42A8 003:499.359 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:505.220 - 5.870ms +T42A8 003:505.239 JLINK_IsHalted() +T42A8 003:505.915 - 0.676ms returns FALSE +T42A8 003:505.926 JLINK_HasError() +T42A8 003:511.216 JLINK_IsHalted() +T42A8 003:517.311 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:518.044 - 6.826ms returns TRUE +T42A8 003:518.072 JLINK_ReadReg(R15 (PC)) +T42A8 003:518.081 - 0.009ms returns 0x20003000 +T42A8 003:518.088 JLINK_ClrBPEx(BPHandle = 0x0000008A) +T42A8 003:518.094 - 0.005ms returns 0x00 +T42A8 003:518.100 JLINK_ReadReg(R0) +T42A8 003:518.106 - 0.005ms returns 0x00000000 +T42A8 003:518.568 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:518.579 Data: E8 87 20 37 38 7A 00 28 10 D0 20 89 22 8C 61 89 ... +T42A8 003:518.661 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:522.725 - 4.156ms returns 0x100 +T42A8 003:522.749 JLINK_HasError() +T42A8 003:522.758 JLINK_WriteReg(R0, 0x1800A300) +T42A8 003:522.766 - 0.008ms returns 0 +T42A8 003:522.773 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:522.778 - 0.005ms returns 0 +T42A8 003:522.784 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:522.790 - 0.005ms returns 0 +T42A8 003:522.797 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:522.822 - 0.024ms returns 0 +T42A8 003:522.829 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:522.835 - 0.005ms returns 0 +T42A8 003:522.841 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:522.847 - 0.005ms returns 0 +T42A8 003:522.853 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:522.858 - 0.005ms returns 0 +T42A8 003:522.864 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:522.869 - 0.005ms returns 0 +T42A8 003:522.876 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:522.881 - 0.005ms returns 0 +T42A8 003:522.887 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:522.892 - 0.005ms returns 0 +T42A8 003:522.898 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:522.904 - 0.005ms returns 0 +T42A8 003:522.910 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:522.915 - 0.005ms returns 0 +T42A8 003:522.921 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:522.926 - 0.005ms returns 0 +T42A8 003:522.932 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:522.947 - 0.014ms returns 0 +T42A8 003:522.953 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:522.958 - 0.005ms returns 0 +T42A8 003:522.965 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:522.970 - 0.005ms returns 0 +T42A8 003:522.976 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:522.981 - 0.005ms returns 0 +T42A8 003:522.987 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:522.992 - 0.005ms returns 0 +T42A8 003:522.999 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:523.004 - 0.005ms returns 0 +T42A8 003:523.012 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:523.018 - 0.005ms returns 0 +T42A8 003:523.025 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:523.032 - 0.006ms returns 0x0000008B +T42A8 003:523.038 JLINK_Go() +T42A8 003:523.051 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:529.116 - 6.076ms +T42A8 003:529.135 JLINK_IsHalted() +T42A8 003:529.652 - 0.515ms returns FALSE +T42A8 003:529.666 JLINK_HasError() +T42A8 003:530.940 JLINK_IsHalted() +T42A8 003:536.928 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:537.474 - 6.534ms returns TRUE +T42A8 003:537.490 JLINK_ReadReg(R15 (PC)) +T42A8 003:537.499 - 0.008ms returns 0x20003000 +T42A8 003:537.507 JLINK_ClrBPEx(BPHandle = 0x0000008B) +T42A8 003:537.512 - 0.005ms returns 0x00 +T42A8 003:537.520 JLINK_ReadReg(R0) +T42A8 003:537.526 - 0.005ms returns 0x00000000 +T42A8 003:537.993 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:538.002 Data: 10 29 09 D1 92 78 03 E0 52 78 01 E0 12 78 0B 23 ... +T42A8 003:538.015 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:541.947 - 3.953ms returns 0x100 +T42A8 003:541.960 JLINK_HasError() +T42A8 003:541.968 JLINK_WriteReg(R0, 0x1800A400) +T42A8 003:541.975 - 0.007ms returns 0 +T42A8 003:541.981 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:541.987 - 0.005ms returns 0 +T42A8 003:541.993 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:541.998 - 0.005ms returns 0 +T42A8 003:542.004 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:542.010 - 0.005ms returns 0 +T42A8 003:542.016 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:542.021 - 0.005ms returns 0 +T42A8 003:542.027 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:542.032 - 0.005ms returns 0 +T42A8 003:542.038 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:542.044 - 0.005ms returns 0 +T42A8 003:542.050 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:542.055 - 0.005ms returns 0 +T42A8 003:542.062 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:542.067 - 0.005ms returns 0 +T42A8 003:542.073 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:542.078 - 0.005ms returns 0 +T42A8 003:542.084 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:542.089 - 0.005ms returns 0 +T42A8 003:542.096 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:542.100 - 0.005ms returns 0 +T42A8 003:542.107 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:542.114 - 0.007ms returns 0 +T42A8 003:542.122 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:542.128 - 0.005ms returns 0 +T42A8 003:542.134 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:542.140 - 0.005ms returns 0 +T42A8 003:542.146 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:542.151 - 0.005ms returns 0 +T42A8 003:542.157 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:542.162 - 0.005ms returns 0 +T42A8 003:542.168 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:542.174 - 0.005ms returns 0 +T42A8 003:542.180 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:542.185 - 0.005ms returns 0 +T42A8 003:542.191 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:542.196 - 0.005ms returns 0 +T42A8 003:542.203 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:542.209 - 0.006ms returns 0x0000008C +T42A8 003:542.215 JLINK_Go() +T42A8 003:542.225 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:548.187 - 5.971ms +T42A8 003:548.199 JLINK_IsHalted() +T42A8 003:548.934 - 0.734ms returns FALSE +T42A8 003:548.945 JLINK_HasError() +T42A8 003:551.004 JLINK_IsHalted() +T42A8 003:556.958 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:557.468 - 6.463ms returns TRUE +T42A8 003:557.481 JLINK_ReadReg(R15 (PC)) +T42A8 003:557.488 - 0.007ms returns 0x20003000 +T42A8 003:557.495 JLINK_ClrBPEx(BPHandle = 0x0000008C) +T42A8 003:557.501 - 0.005ms returns 0x00 +T42A8 003:557.508 JLINK_ReadReg(R0) +T42A8 003:557.513 - 0.005ms returns 0x00000000 +T42A8 003:557.937 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:557.945 Data: 02 98 4A 49 80 00 08 58 01 90 40 68 00 27 00 28 ... +T42A8 003:557.958 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:561.820 - 3.883ms returns 0x100 +T42A8 003:561.852 JLINK_HasError() +T42A8 003:561.861 JLINK_WriteReg(R0, 0x1800A500) +T42A8 003:561.869 - 0.009ms returns 0 +T42A8 003:561.876 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:561.881 - 0.005ms returns 0 +T42A8 003:561.887 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:561.892 - 0.005ms returns 0 +T42A8 003:561.899 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:561.904 - 0.005ms returns 0 +T42A8 003:561.910 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:561.915 - 0.005ms returns 0 +T42A8 003:561.922 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:561.927 - 0.005ms returns 0 +T42A8 003:561.933 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:561.938 - 0.005ms returns 0 +T42A8 003:561.944 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:561.950 - 0.005ms returns 0 +T42A8 003:561.956 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:561.961 - 0.005ms returns 0 +T42A8 003:561.967 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:561.972 - 0.005ms returns 0 +T42A8 003:561.979 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:561.984 - 0.005ms returns 0 +T42A8 003:561.990 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:561.995 - 0.005ms returns 0 +T42A8 003:562.001 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:562.006 - 0.005ms returns 0 +T42A8 003:562.013 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:562.018 - 0.005ms returns 0 +T42A8 003:562.024 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:562.030 - 0.005ms returns 0 +T42A8 003:562.036 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:562.041 - 0.005ms returns 0 +T42A8 003:562.048 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:562.053 - 0.005ms returns 0 +T42A8 003:562.059 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:562.064 - 0.005ms returns 0 +T42A8 003:562.070 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:562.076 - 0.005ms returns 0 +T42A8 003:562.082 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:562.087 - 0.005ms returns 0 +T42A8 003:562.094 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:562.100 - 0.006ms returns 0x0000008D +T42A8 003:562.106 JLINK_Go() +T42A8 003:562.116 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:568.001 - 5.894ms +T42A8 003:568.013 JLINK_IsHalted() +T42A8 003:568.689 - 0.675ms returns FALSE +T42A8 003:568.700 JLINK_HasError() +T42A8 003:569.977 JLINK_IsHalted() +T42A8 003:575.964 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:576.528 - 6.550ms returns TRUE +T42A8 003:576.559 JLINK_ReadReg(R15 (PC)) +T42A8 003:576.570 - 0.011ms returns 0x20003000 +T42A8 003:576.596 JLINK_ClrBPEx(BPHandle = 0x0000008D) +T42A8 003:576.606 - 0.009ms returns 0x00 +T42A8 003:576.616 JLINK_ReadReg(R0) +T42A8 003:576.636 - 0.020ms returns 0x00000000 +T42A8 003:577.442 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:577.463 Data: 00 22 07 21 02 98 FF F7 52 FE 38 46 DC E5 F7 B5 ... +T42A8 003:577.488 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:581.388 - 3.946ms returns 0x100 +T42A8 003:581.412 JLINK_HasError() +T42A8 003:581.420 JLINK_WriteReg(R0, 0x1800A600) +T42A8 003:581.432 - 0.011ms returns 0 +T42A8 003:581.439 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:581.444 - 0.005ms returns 0 +T42A8 003:581.451 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:581.456 - 0.005ms returns 0 +T42A8 003:581.463 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:581.468 - 0.005ms returns 0 +T42A8 003:581.475 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:581.480 - 0.005ms returns 0 +T42A8 003:581.486 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:581.492 - 0.005ms returns 0 +T42A8 003:581.498 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:581.503 - 0.005ms returns 0 +T42A8 003:581.509 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:581.514 - 0.005ms returns 0 +T42A8 003:581.521 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:581.526 - 0.005ms returns 0 +T42A8 003:581.532 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:581.538 - 0.005ms returns 0 +T42A8 003:581.544 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:581.549 - 0.005ms returns 0 +T42A8 003:581.555 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:581.560 - 0.005ms returns 0 +T42A8 003:581.566 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:581.572 - 0.005ms returns 0 +T42A8 003:581.578 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:581.584 - 0.005ms returns 0 +T42A8 003:581.590 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:581.594 - 0.005ms returns 0 +T42A8 003:581.601 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:581.606 - 0.005ms returns 0 +T42A8 003:581.612 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:581.617 - 0.005ms returns 0 +T42A8 003:581.624 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:581.628 - 0.005ms returns 0 +T42A8 003:581.635 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:581.640 - 0.005ms returns 0 +T42A8 003:581.646 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:581.652 - 0.005ms returns 0 +T42A8 003:581.658 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:581.664 - 0.006ms returns 0x0000008E +T42A8 003:581.671 JLINK_Go() +T42A8 003:581.683 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:587.604 - 5.932ms +T42A8 003:587.628 JLINK_IsHalted() +T42A8 003:588.281 - 0.653ms returns FALSE +T42A8 003:588.292 JLINK_HasError() +T42A8 003:589.884 JLINK_IsHalted() +T42A8 003:595.981 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:596.618 - 6.733ms returns TRUE +T42A8 003:596.630 JLINK_ReadReg(R15 (PC)) +T42A8 003:596.637 - 0.007ms returns 0x20003000 +T42A8 003:596.643 JLINK_ClrBPEx(BPHandle = 0x0000008E) +T42A8 003:596.648 - 0.005ms returns 0x00 +T42A8 003:596.655 JLINK_ReadReg(R0) +T42A8 003:596.660 - 0.005ms returns 0x00000000 +T42A8 003:597.083 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:597.091 Data: 89 07 0A D0 04 2D 0A D2 28 21 09 5C 02 22 11 40 ... +T42A8 003:597.102 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:601.041 - 3.958ms returns 0x100 +T42A8 003:601.052 JLINK_HasError() +T42A8 003:601.060 JLINK_WriteReg(R0, 0x1800A700) +T42A8 003:601.066 - 0.006ms returns 0 +T42A8 003:601.072 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:601.077 - 0.005ms returns 0 +T42A8 003:601.083 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:601.088 - 0.005ms returns 0 +T42A8 003:601.094 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:601.099 - 0.004ms returns 0 +T42A8 003:601.104 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:601.110 - 0.004ms returns 0 +T42A8 003:601.115 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:601.120 - 0.004ms returns 0 +T42A8 003:601.126 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:601.131 - 0.004ms returns 0 +T42A8 003:601.137 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:601.142 - 0.004ms returns 0 +T42A8 003:601.148 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:601.152 - 0.005ms returns 0 +T42A8 003:601.164 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:601.169 - 0.005ms returns 0 +T42A8 003:601.176 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:601.180 - 0.004ms returns 0 +T42A8 003:601.186 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:601.191 - 0.004ms returns 0 +T42A8 003:601.197 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:601.202 - 0.004ms returns 0 +T42A8 003:601.208 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:601.213 - 0.005ms returns 0 +T42A8 003:601.219 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:601.224 - 0.004ms returns 0 +T42A8 003:601.230 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:601.235 - 0.005ms returns 0 +T42A8 003:601.241 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:601.246 - 0.005ms returns 0 +T42A8 003:601.252 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:601.256 - 0.004ms returns 0 +T42A8 003:601.263 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:601.268 - 0.004ms returns 0 +T42A8 003:601.273 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:601.278 - 0.004ms returns 0 +T42A8 003:601.285 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:601.290 - 0.005ms returns 0x0000008F +T42A8 003:601.296 JLINK_Go() +T42A8 003:601.305 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:607.352 - 6.055ms +T42A8 003:607.362 JLINK_IsHalted() +T42A8 003:607.981 - 0.619ms returns FALSE +T42A8 003:607.991 JLINK_HasError() +T42A8 003:612.942 JLINK_IsHalted() +T42A8 003:619.094 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:619.723 - 6.780ms returns TRUE +T42A8 003:619.756 JLINK_ReadReg(R15 (PC)) +T42A8 003:619.770 - 0.014ms returns 0x20003000 +T42A8 003:619.777 JLINK_ClrBPEx(BPHandle = 0x0000008F) +T42A8 003:619.782 - 0.005ms returns 0x00 +T42A8 003:619.789 JLINK_ReadReg(R0) +T42A8 003:619.794 - 0.005ms returns 0x00000000 +T42A8 003:620.264 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:620.272 Data: 00 2A 05 D0 3B 22 08 21 18 46 FF F7 50 FD 00 20 ... +T42A8 003:620.284 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:624.104 - 3.839ms returns 0x100 +T42A8 003:624.116 JLINK_HasError() +T42A8 003:624.124 JLINK_WriteReg(R0, 0x1800A800) +T42A8 003:624.130 - 0.006ms returns 0 +T42A8 003:624.136 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:624.141 - 0.005ms returns 0 +T42A8 003:624.148 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:624.153 - 0.005ms returns 0 +T42A8 003:624.159 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:624.164 - 0.005ms returns 0 +T42A8 003:624.171 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:624.176 - 0.005ms returns 0 +T42A8 003:624.183 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:624.204 - 0.021ms returns 0 +T42A8 003:624.307 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:624.332 - 0.025ms returns 0 +T42A8 003:624.340 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:624.361 - 0.021ms returns 0 +T42A8 003:624.368 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:624.372 - 0.005ms returns 0 +T42A8 003:624.396 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:624.401 - 0.005ms returns 0 +T42A8 003:624.408 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:624.429 - 0.021ms returns 0 +T42A8 003:624.435 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:624.440 - 0.004ms returns 0 +T42A8 003:624.446 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:624.450 - 0.004ms returns 0 +T42A8 003:624.456 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:624.462 - 0.005ms returns 0 +T42A8 003:624.468 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:624.473 - 0.005ms returns 0 +T42A8 003:624.480 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:624.484 - 0.004ms returns 0 +T42A8 003:624.490 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:624.495 - 0.004ms returns 0 +T42A8 003:624.501 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:624.506 - 0.004ms returns 0 +T42A8 003:624.512 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:624.516 - 0.004ms returns 0 +T42A8 003:624.522 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:624.527 - 0.004ms returns 0 +T42A8 003:624.534 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:624.540 - 0.006ms returns 0x00000090 +T42A8 003:624.546 JLINK_Go() +T42A8 003:624.555 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:630.388 - 5.841ms +T42A8 003:630.405 JLINK_IsHalted() +T42A8 003:630.923 - 0.517ms returns FALSE +T42A8 003:630.934 JLINK_HasError() +T42A8 003:632.732 JLINK_IsHalted() +T42A8 003:638.750 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:639.394 - 6.662ms returns TRUE +T42A8 003:639.404 JLINK_ReadReg(R15 (PC)) +T42A8 003:639.411 - 0.007ms returns 0x20003000 +T42A8 003:639.418 JLINK_ClrBPEx(BPHandle = 0x00000090) +T42A8 003:639.423 - 0.005ms returns 0x00 +T42A8 003:639.430 JLINK_ReadReg(R0) +T42A8 003:639.435 - 0.005ms returns 0x00000000 +T42A8 003:639.894 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:639.903 Data: DB 07 01 D1 C9 1E D2 1E 03 23 03 70 00 23 43 70 ... +T42A8 003:639.915 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:643.823 - 3.928ms returns 0x100 +T42A8 003:643.853 JLINK_HasError() +T42A8 003:643.873 JLINK_WriteReg(R0, 0x1800A900) +T42A8 003:643.879 - 0.006ms returns 0 +T42A8 003:643.885 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:643.890 - 0.004ms returns 0 +T42A8 003:643.896 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:643.900 - 0.004ms returns 0 +T42A8 003:643.906 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:643.911 - 0.004ms returns 0 +T42A8 003:643.916 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:643.921 - 0.004ms returns 0 +T42A8 003:643.927 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:643.932 - 0.004ms returns 0 +T42A8 003:643.960 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:643.965 - 0.004ms returns 0 +T42A8 003:643.971 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:643.976 - 0.004ms returns 0 +T42A8 003:643.995 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:644.000 - 0.005ms returns 0 +T42A8 003:644.006 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:644.010 - 0.004ms returns 0 +T42A8 003:644.016 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:644.021 - 0.004ms returns 0 +T42A8 003:644.026 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:644.031 - 0.004ms returns 0 +T42A8 003:644.037 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:644.042 - 0.004ms returns 0 +T42A8 003:644.047 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:644.052 - 0.005ms returns 0 +T42A8 003:644.058 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:644.063 - 0.004ms returns 0 +T42A8 003:644.069 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:644.073 - 0.004ms returns 0 +T42A8 003:644.079 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:644.084 - 0.004ms returns 0 +T42A8 003:644.090 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:644.094 - 0.004ms returns 0 +T42A8 003:644.100 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:644.104 - 0.004ms returns 0 +T42A8 003:644.110 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:644.115 - 0.004ms returns 0 +T42A8 003:644.121 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:644.127 - 0.006ms returns 0x00000091 +T42A8 003:644.133 JLINK_Go() +T42A8 003:644.142 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:650.267 - 6.133ms +T42A8 003:650.278 JLINK_IsHalted() +T42A8 003:650.950 - 0.671ms returns FALSE +T42A8 003:650.960 JLINK_HasError() +T42A8 003:656.704 JLINK_IsHalted() +T42A8 003:662.565 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:663.089 - 6.385ms returns TRUE +T42A8 003:663.101 JLINK_ReadReg(R15 (PC)) +T42A8 003:663.108 - 0.007ms returns 0x20003000 +T42A8 003:663.114 JLINK_ClrBPEx(BPHandle = 0x00000091) +T42A8 003:663.120 - 0.005ms returns 0x00 +T42A8 003:663.126 JLINK_ReadReg(R0) +T42A8 003:663.131 - 0.004ms returns 0x00000000 +T42A8 003:663.506 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:663.516 Data: 4D F9 E8 8F C0 07 01 D0 02 20 B7 E0 A0 79 01 21 ... +T42A8 003:663.527 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:667.522 - 4.016ms returns 0x100 +T42A8 003:667.533 JLINK_HasError() +T42A8 003:667.540 JLINK_WriteReg(R0, 0x1800AA00) +T42A8 003:667.546 - 0.006ms returns 0 +T42A8 003:667.556 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:667.562 - 0.005ms returns 0 +T42A8 003:667.568 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:667.573 - 0.004ms returns 0 +T42A8 003:667.579 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:667.584 - 0.004ms returns 0 +T42A8 003:667.590 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:667.594 - 0.004ms returns 0 +T42A8 003:667.600 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:667.609 - 0.009ms returns 0 +T42A8 003:667.616 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:667.620 - 0.004ms returns 0 +T42A8 003:667.626 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:667.631 - 0.004ms returns 0 +T42A8 003:667.638 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:667.643 - 0.006ms returns 0 +T42A8 003:667.649 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:667.654 - 0.004ms returns 0 +T42A8 003:667.660 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:667.665 - 0.005ms returns 0 +T42A8 003:667.671 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:667.676 - 0.004ms returns 0 +T42A8 003:667.682 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:667.687 - 0.005ms returns 0 +T42A8 003:667.693 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:667.698 - 0.005ms returns 0 +T42A8 003:667.704 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:667.709 - 0.004ms returns 0 +T42A8 003:667.715 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:667.720 - 0.005ms returns 0 +T42A8 003:667.726 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:667.731 - 0.005ms returns 0 +T42A8 003:667.737 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:667.742 - 0.004ms returns 0 +T42A8 003:667.748 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:667.752 - 0.004ms returns 0 +T42A8 003:667.758 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:667.763 - 0.004ms returns 0 +T42A8 003:667.770 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:667.775 - 0.005ms returns 0x00000092 +T42A8 003:667.781 JLINK_Go() +T42A8 003:667.790 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:674.181 - 6.399ms +T42A8 003:674.208 JLINK_IsHalted() +T42A8 003:674.842 - 0.633ms returns FALSE +T42A8 003:674.853 JLINK_HasError() +T42A8 003:676.768 JLINK_IsHalted() +T42A8 003:682.730 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:683.400 - 6.632ms returns TRUE +T42A8 003:683.414 JLINK_ReadReg(R15 (PC)) +T42A8 003:683.421 - 0.007ms returns 0x20003000 +T42A8 003:683.428 JLINK_ClrBPEx(BPHandle = 0x00000092) +T42A8 003:683.433 - 0.005ms returns 0x00 +T42A8 003:683.440 JLINK_ReadReg(R0) +T42A8 003:683.446 - 0.005ms returns 0x00000000 +T42A8 003:683.940 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:683.953 Data: 18 22 02 98 1A 70 59 70 62 46 9A 70 72 46 DA 70 ... +T42A8 003:683.968 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:687.913 - 3.973ms returns 0x100 +T42A8 003:687.934 JLINK_HasError() +T42A8 003:687.943 JLINK_WriteReg(R0, 0x1800AB00) +T42A8 003:687.952 - 0.008ms returns 0 +T42A8 003:687.958 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:687.963 - 0.005ms returns 0 +T42A8 003:687.969 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:687.974 - 0.004ms returns 0 +T42A8 003:687.980 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:687.984 - 0.004ms returns 0 +T42A8 003:687.990 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:687.995 - 0.004ms returns 0 +T42A8 003:688.001 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:688.006 - 0.004ms returns 0 +T42A8 003:688.012 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:688.017 - 0.004ms returns 0 +T42A8 003:688.022 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:688.028 - 0.004ms returns 0 +T42A8 003:688.033 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:688.038 - 0.005ms returns 0 +T42A8 003:688.044 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:688.049 - 0.004ms returns 0 +T42A8 003:688.055 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:688.060 - 0.004ms returns 0 +T42A8 003:688.066 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:688.070 - 0.004ms returns 0 +T42A8 003:688.076 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:688.081 - 0.004ms returns 0 +T42A8 003:688.087 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:688.093 - 0.005ms returns 0 +T42A8 003:688.099 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:688.104 - 0.004ms returns 0 +T42A8 003:688.110 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:688.114 - 0.005ms returns 0 +T42A8 003:688.120 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:688.125 - 0.005ms returns 0 +T42A8 003:688.131 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:688.136 - 0.004ms returns 0 +T42A8 003:688.142 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:688.147 - 0.004ms returns 0 +T42A8 003:688.153 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:688.163 - 0.009ms returns 0 +T42A8 003:688.169 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:688.176 - 0.006ms returns 0x00000093 +T42A8 003:688.182 JLINK_Go() +T42A8 003:688.193 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:694.336 - 6.147ms +T42A8 003:694.372 JLINK_IsHalted() +T42A8 003:695.043 - 0.670ms returns FALSE +T42A8 003:695.054 JLINK_HasError() +T42A8 003:696.582 JLINK_IsHalted() +T42A8 003:702.581 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:703.221 - 6.637ms returns TRUE +T42A8 003:703.236 JLINK_ReadReg(R15 (PC)) +T42A8 003:703.244 - 0.008ms returns 0x20003000 +T42A8 003:703.252 JLINK_ClrBPEx(BPHandle = 0x00000093) +T42A8 003:703.259 - 0.006ms returns 0x00 +T42A8 003:703.267 JLINK_ReadReg(R0) +T42A8 003:703.274 - 0.006ms returns 0x00000000 +T42A8 003:703.797 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:703.807 Data: 19 2A 08 D0 1A 2A 06 D0 11 E0 12 78 F6 E7 51 78 ... +T42A8 003:703.821 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:707.654 - 3.856ms returns 0x100 +T42A8 003:707.668 JLINK_HasError() +T42A8 003:707.678 JLINK_WriteReg(R0, 0x1800AC00) +T42A8 003:707.687 - 0.008ms returns 0 +T42A8 003:707.696 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:707.703 - 0.007ms returns 0 +T42A8 003:707.711 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:707.718 - 0.007ms returns 0 +T42A8 003:707.726 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:707.733 - 0.006ms returns 0 +T42A8 003:707.742 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:707.749 - 0.006ms returns 0 +T42A8 003:707.757 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:707.764 - 0.007ms returns 0 +T42A8 003:707.772 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:707.779 - 0.006ms returns 0 +T42A8 003:707.788 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:707.794 - 0.007ms returns 0 +T42A8 003:707.804 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:707.811 - 0.007ms returns 0 +T42A8 003:707.819 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:707.826 - 0.007ms returns 0 +T42A8 003:707.837 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:707.844 - 0.007ms returns 0 +T42A8 003:707.852 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:707.858 - 0.006ms returns 0 +T42A8 003:707.867 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:707.873 - 0.006ms returns 0 +T42A8 003:707.881 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:707.888 - 0.007ms returns 0 +T42A8 003:707.896 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:707.903 - 0.006ms returns 0 +T42A8 003:707.911 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:707.918 - 0.006ms returns 0 +T42A8 003:707.926 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:707.932 - 0.006ms returns 0 +T42A8 003:707.941 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:707.947 - 0.006ms returns 0 +T42A8 003:707.956 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:707.962 - 0.006ms returns 0 +T42A8 003:707.970 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:707.977 - 0.006ms returns 0 +T42A8 003:707.986 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:707.993 - 0.008ms returns 0x00000094 +T42A8 003:708.001 JLINK_Go() +T42A8 003:708.014 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:713.964 - 5.961ms +T42A8 003:713.980 JLINK_IsHalted() +T42A8 003:714.584 - 0.604ms returns FALSE +T42A8 003:714.598 JLINK_HasError() +T42A8 003:720.622 JLINK_IsHalted() +T42A8 003:726.750 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:727.517 - 6.892ms returns TRUE +T42A8 003:727.562 JLINK_ReadReg(R15 (PC)) +T42A8 003:727.576 - 0.012ms returns 0x20003000 +T42A8 003:727.586 JLINK_ClrBPEx(BPHandle = 0x00000094) +T42A8 003:727.594 - 0.008ms returns 0x00 +T42A8 003:727.603 JLINK_ReadReg(R0) +T42A8 003:727.611 - 0.007ms returns 0x00000000 +T42A8 003:728.265 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:728.284 Data: 7B F9 01 22 11 46 30 46 02 F0 C8 FF F8 BD 00 22 ... +T42A8 003:728.304 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:732.347 - 4.081ms returns 0x100 +T42A8 003:732.392 JLINK_HasError() +T42A8 003:732.404 JLINK_WriteReg(R0, 0x1800AD00) +T42A8 003:732.416 - 0.012ms returns 0 +T42A8 003:732.424 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:732.437 - 0.012ms returns 0 +T42A8 003:732.451 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:732.459 - 0.007ms returns 0 +T42A8 003:732.470 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:732.477 - 0.007ms returns 0 +T42A8 003:732.486 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:732.493 - 0.007ms returns 0 +T42A8 003:732.501 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:732.508 - 0.006ms returns 0 +T42A8 003:732.516 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:732.523 - 0.006ms returns 0 +T42A8 003:732.532 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:732.540 - 0.007ms returns 0 +T42A8 003:732.548 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:732.555 - 0.007ms returns 0 +T42A8 003:732.563 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:732.570 - 0.006ms returns 0 +T42A8 003:732.580 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:732.588 - 0.007ms returns 0 +T42A8 003:732.597 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:732.604 - 0.007ms returns 0 +T42A8 003:732.614 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:732.622 - 0.007ms returns 0 +T42A8 003:732.634 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:732.657 - 0.025ms returns 0 +T42A8 003:732.667 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:732.674 - 0.007ms returns 0 +T42A8 003:732.683 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:732.691 - 0.007ms returns 0 +T42A8 003:732.700 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:732.707 - 0.007ms returns 0 +T42A8 003:732.716 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:732.724 - 0.007ms returns 0 +T42A8 003:732.732 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:732.739 - 0.006ms returns 0 +T42A8 003:732.748 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:732.756 - 0.006ms returns 0 +T42A8 003:732.765 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:732.773 - 0.009ms returns 0x00000095 +T42A8 003:732.782 JLINK_Go() +T42A8 003:732.799 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:738.660 - 5.876ms +T42A8 003:738.689 JLINK_IsHalted() +T42A8 003:739.445 - 0.754ms returns FALSE +T42A8 003:739.481 JLINK_HasError() +T42A8 003:741.371 JLINK_IsHalted() +T42A8 003:747.451 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:748.065 - 6.693ms returns TRUE +T42A8 003:748.101 JLINK_ReadReg(R15 (PC)) +T42A8 003:748.115 - 0.014ms returns 0x20003000 +T42A8 003:748.126 JLINK_ClrBPEx(BPHandle = 0x00000095) +T42A8 003:748.135 - 0.008ms returns 0x00 +T42A8 003:748.145 JLINK_ReadReg(R0) +T42A8 003:748.156 - 0.009ms returns 0x00000000 +T42A8 003:749.142 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:749.159 Data: 01 21 30 46 02 F0 34 FF 00 22 05 21 30 46 FF F7 ... +T42A8 003:749.179 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:753.172 - 4.030ms returns 0x100 +T42A8 003:753.194 JLINK_HasError() +T42A8 003:753.205 JLINK_WriteReg(R0, 0x1800AE00) +T42A8 003:753.216 - 0.011ms returns 0 +T42A8 003:753.225 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:753.232 - 0.007ms returns 0 +T42A8 003:753.240 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:753.248 - 0.007ms returns 0 +T42A8 003:753.256 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:753.263 - 0.007ms returns 0 +T42A8 003:753.271 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:753.278 - 0.006ms returns 0 +T42A8 003:753.286 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:753.293 - 0.007ms returns 0 +T42A8 003:753.302 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:753.308 - 0.006ms returns 0 +T42A8 003:753.317 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:753.344 - 0.027ms returns 0 +T42A8 003:753.356 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:753.365 - 0.009ms returns 0 +T42A8 003:753.376 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:753.385 - 0.009ms returns 0 +T42A8 003:753.396 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:753.406 - 0.009ms returns 0 +T42A8 003:753.417 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:753.426 - 0.009ms returns 0 +T42A8 003:753.438 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:753.448 - 0.009ms returns 0 +T42A8 003:753.462 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:753.476 - 0.015ms returns 0 +T42A8 003:753.488 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:753.498 - 0.009ms returns 0 +T42A8 003:753.509 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:753.521 - 0.012ms returns 0 +T42A8 003:753.533 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:753.543 - 0.009ms returns 0 +T42A8 003:753.554 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:753.563 - 0.009ms returns 0 +T42A8 003:753.574 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:753.583 - 0.009ms returns 0 +T42A8 003:753.594 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:753.604 - 0.009ms returns 0 +T42A8 003:753.616 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:753.654 - 0.038ms returns 0x00000096 +T42A8 003:753.666 JLINK_Go() +T42A8 003:753.687 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:759.492 - 5.825ms +T42A8 003:759.513 JLINK_IsHalted() +T42A8 003:760.055 - 0.541ms returns FALSE +T42A8 003:760.066 JLINK_HasError() +T42A8 003:763.396 JLINK_IsHalted() +T42A8 003:769.583 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:770.217 - 6.819ms returns TRUE +T42A8 003:770.241 JLINK_ReadReg(R15 (PC)) +T42A8 003:770.250 - 0.008ms returns 0x20003000 +T42A8 003:770.256 JLINK_ClrBPEx(BPHandle = 0x00000096) +T42A8 003:770.262 - 0.005ms returns 0x00 +T42A8 003:770.269 JLINK_ReadReg(R0) +T42A8 003:770.283 - 0.013ms returns 0x00000000 +T42A8 003:770.745 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:770.758 Data: 10 43 98 80 22 46 06 21 28 46 FF F7 95 FE E1 E7 ... +T42A8 003:770.772 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:774.736 - 3.990ms returns 0x100 +T42A8 003:774.759 JLINK_HasError() +T42A8 003:774.768 JLINK_WriteReg(R0, 0x1800AF00) +T42A8 003:774.777 - 0.009ms returns 0 +T42A8 003:774.783 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:774.788 - 0.005ms returns 0 +T42A8 003:774.795 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:774.800 - 0.005ms returns 0 +T42A8 003:774.806 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:774.812 - 0.005ms returns 0 +T42A8 003:774.818 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:774.823 - 0.005ms returns 0 +T42A8 003:774.829 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:774.834 - 0.005ms returns 0 +T42A8 003:774.840 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:774.846 - 0.005ms returns 0 +T42A8 003:774.852 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:774.857 - 0.005ms returns 0 +T42A8 003:774.863 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:774.868 - 0.005ms returns 0 +T42A8 003:774.875 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:774.880 - 0.005ms returns 0 +T42A8 003:774.886 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:774.891 - 0.005ms returns 0 +T42A8 003:774.897 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:774.902 - 0.005ms returns 0 +T42A8 003:774.908 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:774.913 - 0.005ms returns 0 +T42A8 003:774.920 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:774.925 - 0.005ms returns 0 +T42A8 003:774.932 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:774.937 - 0.005ms returns 0 +T42A8 003:774.943 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:774.948 - 0.005ms returns 0 +T42A8 003:774.955 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:774.960 - 0.005ms returns 0 +T42A8 003:774.966 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:774.971 - 0.005ms returns 0 +T42A8 003:774.978 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:774.983 - 0.005ms returns 0 +T42A8 003:774.989 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:774.994 - 0.005ms returns 0 +T42A8 003:775.002 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:775.008 - 0.006ms returns 0x00000097 +T42A8 003:775.014 JLINK_Go() +T42A8 003:775.026 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:781.127 - 6.112ms +T42A8 003:781.139 JLINK_IsHalted() +T42A8 003:781.810 - 0.671ms returns FALSE +T42A8 003:781.822 JLINK_HasError() +T42A8 003:783.364 JLINK_IsHalted() +T42A8 003:789.375 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:790.003 - 6.638ms returns TRUE +T42A8 003:790.013 JLINK_ReadReg(R15 (PC)) +T42A8 003:790.020 - 0.006ms returns 0x20003000 +T42A8 003:790.026 JLINK_ClrBPEx(BPHandle = 0x00000097) +T42A8 003:790.032 - 0.005ms returns 0x00 +T42A8 003:790.038 JLINK_ReadReg(R0) +T42A8 003:790.044 - 0.005ms returns 0x00000000 +T42A8 003:790.507 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:790.516 Data: 00 28 FA D0 E3 7D A2 7D 40 34 A1 78 38 46 02 F0 ... +T42A8 003:790.532 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:794.406 - 3.899ms returns 0x100 +T42A8 003:794.418 JLINK_HasError() +T42A8 003:794.426 JLINK_WriteReg(R0, 0x1800B000) +T42A8 003:794.432 - 0.007ms returns 0 +T42A8 003:794.438 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:794.444 - 0.005ms returns 0 +T42A8 003:794.450 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:794.455 - 0.005ms returns 0 +T42A8 003:794.461 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:794.466 - 0.005ms returns 0 +T42A8 003:794.472 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:794.478 - 0.005ms returns 0 +T42A8 003:794.484 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:794.489 - 0.005ms returns 0 +T42A8 003:794.496 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:794.500 - 0.005ms returns 0 +T42A8 003:794.506 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:794.512 - 0.005ms returns 0 +T42A8 003:794.518 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:794.523 - 0.005ms returns 0 +T42A8 003:794.529 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:794.534 - 0.005ms returns 0 +T42A8 003:794.540 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:794.545 - 0.005ms returns 0 +T42A8 003:794.552 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:794.556 - 0.005ms returns 0 +T42A8 003:794.563 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:794.568 - 0.005ms returns 0 +T42A8 003:794.574 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:794.580 - 0.005ms returns 0 +T42A8 003:794.586 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:794.591 - 0.005ms returns 0 +T42A8 003:794.597 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:794.602 - 0.005ms returns 0 +T42A8 003:794.608 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:794.614 - 0.005ms returns 0 +T42A8 003:794.620 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:794.625 - 0.005ms returns 0 +T42A8 003:794.631 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:794.636 - 0.005ms returns 0 +T42A8 003:794.642 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:794.647 - 0.005ms returns 0 +T42A8 003:794.654 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:794.660 - 0.006ms returns 0x00000098 +T42A8 003:794.666 JLINK_Go() +T42A8 003:794.675 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:800.691 - 6.024ms +T42A8 003:800.704 JLINK_IsHalted() +T42A8 003:801.348 - 0.643ms returns FALSE +T42A8 003:801.367 JLINK_HasError() +T42A8 003:803.300 JLINK_IsHalted() +T42A8 003:809.297 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:809.942 - 6.640ms returns TRUE +T42A8 003:809.954 JLINK_ReadReg(R15 (PC)) +T42A8 003:809.962 - 0.007ms returns 0x20003000 +T42A8 003:809.970 JLINK_ClrBPEx(BPHandle = 0x00000098) +T42A8 003:809.976 - 0.006ms returns 0x00 +T42A8 003:809.983 JLINK_ReadReg(R0) +T42A8 003:809.990 - 0.006ms returns 0x00000000 +T42A8 003:810.460 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:810.470 Data: FA 48 21 6E 02 89 70 8E 0F 46 10 18 41 43 F8 48 ... +T42A8 003:810.483 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:814.351 - 3.890ms returns 0x100 +T42A8 003:814.364 JLINK_HasError() +T42A8 003:814.372 JLINK_WriteReg(R0, 0x1800B100) +T42A8 003:814.380 - 0.007ms returns 0 +T42A8 003:814.387 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:814.393 - 0.006ms returns 0 +T42A8 003:814.401 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:814.407 - 0.006ms returns 0 +T42A8 003:814.414 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:814.420 - 0.006ms returns 0 +T42A8 003:814.428 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:814.433 - 0.006ms returns 0 +T42A8 003:814.442 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:814.448 - 0.006ms returns 0 +T42A8 003:814.456 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:814.461 - 0.006ms returns 0 +T42A8 003:814.469 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:814.475 - 0.006ms returns 0 +T42A8 003:814.482 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:814.488 - 0.006ms returns 0 +T42A8 003:814.496 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:814.501 - 0.006ms returns 0 +T42A8 003:814.509 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:814.515 - 0.006ms returns 0 +T42A8 003:814.522 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:814.528 - 0.006ms returns 0 +T42A8 003:814.536 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:814.546 - 0.010ms returns 0 +T42A8 003:814.553 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:814.560 - 0.006ms returns 0 +T42A8 003:814.567 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:814.573 - 0.006ms returns 0 +T42A8 003:814.580 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:814.586 - 0.006ms returns 0 +T42A8 003:814.594 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:814.600 - 0.006ms returns 0 +T42A8 003:814.607 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:814.613 - 0.005ms returns 0 +T42A8 003:814.620 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:814.626 - 0.006ms returns 0 +T42A8 003:814.634 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:814.640 - 0.006ms returns 0 +T42A8 003:814.648 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:814.654 - 0.007ms returns 0x00000099 +T42A8 003:814.662 JLINK_Go() +T42A8 003:814.672 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:820.714 - 6.052ms +T42A8 003:820.730 JLINK_IsHalted() +T42A8 003:821.316 - 0.586ms returns FALSE +T42A8 003:821.331 JLINK_HasError() +T42A8 003:827.258 JLINK_IsHalted() +T42A8 003:833.412 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:834.173 - 6.914ms returns TRUE +T42A8 003:834.210 JLINK_ReadReg(R15 (PC)) +T42A8 003:834.220 - 0.010ms returns 0x20003000 +T42A8 003:834.229 JLINK_ClrBPEx(BPHandle = 0x00000099) +T42A8 003:834.238 - 0.008ms returns 0x00 +T42A8 003:834.367 JLINK_ReadReg(R0) +T42A8 003:834.381 - 0.013ms returns 0x00000000 +T42A8 003:835.277 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:835.294 Data: 84 42 00 D3 04 46 00 98 70 21 48 43 BA 49 41 18 ... +T42A8 003:835.312 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:839.275 - 3.997ms returns 0x100 +T42A8 003:839.292 JLINK_HasError() +T42A8 003:839.301 JLINK_WriteReg(R0, 0x1800B200) +T42A8 003:839.308 - 0.007ms returns 0 +T42A8 003:839.316 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:839.322 - 0.006ms returns 0 +T42A8 003:839.329 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:839.334 - 0.005ms returns 0 +T42A8 003:839.341 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:839.347 - 0.005ms returns 0 +T42A8 003:839.354 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:839.360 - 0.005ms returns 0 +T42A8 003:839.366 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:839.372 - 0.005ms returns 0 +T42A8 003:839.379 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:839.385 - 0.005ms returns 0 +T42A8 003:839.392 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:839.397 - 0.005ms returns 0 +T42A8 003:839.404 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:839.410 - 0.005ms returns 0 +T42A8 003:839.417 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:839.422 - 0.005ms returns 0 +T42A8 003:839.429 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:839.435 - 0.005ms returns 0 +T42A8 003:839.442 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:839.448 - 0.005ms returns 0 +T42A8 003:839.454 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:839.460 - 0.005ms returns 0 +T42A8 003:839.467 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:839.473 - 0.006ms returns 0 +T42A8 003:839.480 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:839.486 - 0.005ms returns 0 +T42A8 003:839.493 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:839.498 - 0.005ms returns 0 +T42A8 003:839.506 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:839.511 - 0.005ms returns 0 +T42A8 003:839.518 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:839.524 - 0.005ms returns 0 +T42A8 003:839.531 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:839.536 - 0.005ms returns 0 +T42A8 003:839.543 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:839.549 - 0.005ms returns 0 +T42A8 003:839.556 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:839.563 - 0.006ms returns 0x0000009A +T42A8 003:839.570 JLINK_Go() +T42A8 003:839.580 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:845.611 - 6.040ms +T42A8 003:845.627 JLINK_IsHalted() +T42A8 003:846.246 - 0.618ms returns FALSE +T42A8 003:846.259 JLINK_HasError() +T42A8 003:848.106 JLINK_IsHalted() +T42A8 003:854.142 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:854.784 - 6.679ms returns TRUE +T42A8 003:854.814 JLINK_ReadReg(R15 (PC)) +T42A8 003:854.825 - 0.010ms returns 0x20003000 +T42A8 003:854.842 JLINK_ClrBPEx(BPHandle = 0x0000009A) +T42A8 003:854.851 - 0.009ms returns 0x00 +T42A8 003:854.862 JLINK_ReadReg(R0) +T42A8 003:854.870 - 0.008ms returns 0x00000000 +T42A8 003:855.629 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:855.644 Data: 08 F0 24 FA 28 46 FF F7 48 FF 22 6E 80 34 A1 7B ... +T42A8 003:855.662 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:859.598 - 3.969ms returns 0x100 +T42A8 003:859.617 JLINK_HasError() +T42A8 003:859.629 JLINK_WriteReg(R0, 0x1800B300) +T42A8 003:859.640 - 0.011ms returns 0 +T42A8 003:859.651 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:859.660 - 0.008ms returns 0 +T42A8 003:859.670 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:859.679 - 0.008ms returns 0 +T42A8 003:859.690 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:859.698 - 0.008ms returns 0 +T42A8 003:859.709 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:859.718 - 0.008ms returns 0 +T42A8 003:859.728 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:859.737 - 0.008ms returns 0 +T42A8 003:859.748 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:859.756 - 0.008ms returns 0 +T42A8 003:859.767 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:859.776 - 0.008ms returns 0 +T42A8 003:859.786 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:859.795 - 0.008ms returns 0 +T42A8 003:859.821 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:859.831 - 0.009ms returns 0 +T42A8 003:859.843 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:859.852 - 0.009ms returns 0 +T42A8 003:859.864 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:859.873 - 0.009ms returns 0 +T42A8 003:859.885 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:859.895 - 0.009ms returns 0 +T42A8 003:859.907 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:859.917 - 0.010ms returns 0 +T42A8 003:859.929 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:859.938 - 0.009ms returns 0 +T42A8 003:859.950 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:859.960 - 0.009ms returns 0 +T42A8 003:859.972 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:859.981 - 0.009ms returns 0 +T42A8 003:859.993 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:860.003 - 0.009ms returns 0 +T42A8 003:860.014 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:860.024 - 0.009ms returns 0 +T42A8 003:860.046 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:860.056 - 0.010ms returns 0 +T42A8 003:860.070 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:860.080 - 0.011ms returns 0x0000009B +T42A8 003:860.186 JLINK_Go() +T42A8 003:860.212 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:866.188 - 6.000ms +T42A8 003:866.221 JLINK_IsHalted() +T42A8 003:866.836 - 0.613ms returns FALSE +T42A8 003:866.866 JLINK_HasError() +T42A8 003:870.117 JLINK_IsHalted() +T42A8 003:876.140 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:876.824 - 6.713ms returns TRUE +T42A8 003:876.848 JLINK_ReadReg(R15 (PC)) +T42A8 003:876.862 - 0.013ms returns 0x20003000 +T42A8 003:876.876 JLINK_ClrBPEx(BPHandle = 0x0000009B) +T42A8 003:876.886 - 0.010ms returns 0x00 +T42A8 003:876.899 JLINK_ReadReg(R0) +T42A8 003:876.910 - 0.010ms returns 0x00000000 +T42A8 003:877.685 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:877.701 Data: 81 42 37 D2 02 98 80 7F 00 28 20 D1 20 8F 80 19 ... +T42A8 003:877.724 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:881.606 - 3.920ms returns 0x100 +T42A8 003:881.631 JLINK_HasError() +T42A8 003:881.646 JLINK_WriteReg(R0, 0x1800B400) +T42A8 003:881.659 - 0.013ms returns 0 +T42A8 003:881.672 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:881.682 - 0.010ms returns 0 +T42A8 003:881.695 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:881.705 - 0.010ms returns 0 +T42A8 003:881.717 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:881.727 - 0.010ms returns 0 +T42A8 003:881.739 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:881.749 - 0.009ms returns 0 +T42A8 003:881.761 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:881.771 - 0.010ms returns 0 +T42A8 003:881.784 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:881.793 - 0.009ms returns 0 +T42A8 003:881.805 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:881.815 - 0.009ms returns 0 +T42A8 003:881.828 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:881.841 - 0.013ms returns 0 +T42A8 003:881.856 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:881.866 - 0.010ms returns 0 +T42A8 003:881.878 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:881.888 - 0.010ms returns 0 +T42A8 003:881.900 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:881.910 - 0.010ms returns 0 +T42A8 003:881.922 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:881.932 - 0.010ms returns 0 +T42A8 003:881.944 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:881.955 - 0.010ms returns 0 +T42A8 003:881.967 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:881.977 - 0.010ms returns 0 +T42A8 003:881.989 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:881.999 - 0.010ms returns 0 +T42A8 003:882.020 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:882.039 - 0.019ms returns 0 +T42A8 003:882.064 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:882.076 - 0.012ms returns 0 +T42A8 003:882.088 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:882.098 - 0.009ms returns 0 +T42A8 003:882.110 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:882.119 - 0.009ms returns 0 +T42A8 003:882.132 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:882.144 - 0.012ms returns 0x0000009C +T42A8 003:882.155 JLINK_Go() +T42A8 003:882.173 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:888.219 - 6.063ms +T42A8 003:888.244 JLINK_IsHalted() +T42A8 003:888.891 - 0.645ms returns FALSE +T42A8 003:888.913 JLINK_HasError() +T42A8 003:890.040 JLINK_IsHalted() +T42A8 003:896.004 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:896.654 - 6.613ms returns TRUE +T42A8 003:896.674 JLINK_ReadReg(R15 (PC)) +T42A8 003:896.687 - 0.012ms returns 0x20003000 +T42A8 003:896.700 JLINK_ClrBPEx(BPHandle = 0x0000009C) +T42A8 003:896.711 - 0.010ms returns 0x00 +T42A8 003:896.724 JLINK_ReadReg(R0) +T42A8 003:896.734 - 0.010ms returns 0x00000000 +T42A8 003:897.476 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:897.493 Data: FF 7F 00 00 A0 8F FD 49 48 43 C7 19 05 E0 FB 49 ... +T42A8 003:897.514 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:901.518 - 4.042ms returns 0x100 +T42A8 003:901.539 JLINK_HasError() +T42A8 003:901.553 JLINK_WriteReg(R0, 0x1800B500) +T42A8 003:901.566 - 0.013ms returns 0 +T42A8 003:901.578 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:901.589 - 0.010ms returns 0 +T42A8 003:901.601 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:901.611 - 0.010ms returns 0 +T42A8 003:901.624 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:901.633 - 0.010ms returns 0 +T42A8 003:901.646 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:901.656 - 0.010ms returns 0 +T42A8 003:901.668 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:901.678 - 0.010ms returns 0 +T42A8 003:901.690 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:901.700 - 0.009ms returns 0 +T42A8 003:901.712 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:901.722 - 0.010ms returns 0 +T42A8 003:901.734 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:901.744 - 0.010ms returns 0 +T42A8 003:901.756 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:901.766 - 0.010ms returns 0 +T42A8 003:901.779 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:901.788 - 0.009ms returns 0 +T42A8 003:901.801 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:901.810 - 0.009ms returns 0 +T42A8 003:901.822 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:901.832 - 0.010ms returns 0 +T42A8 003:901.844 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:901.855 - 0.010ms returns 0 +T42A8 003:901.867 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:901.877 - 0.010ms returns 0 +T42A8 003:901.890 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:901.900 - 0.010ms returns 0 +T42A8 003:901.912 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:901.933 - 0.020ms returns 0 +T42A8 003:901.946 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:901.956 - 0.010ms returns 0 +T42A8 003:901.968 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:901.978 - 0.009ms returns 0 +T42A8 003:901.990 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:902.000 - 0.010ms returns 0 +T42A8 003:902.013 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:902.024 - 0.011ms returns 0x0000009D +T42A8 003:902.036 JLINK_Go() +T42A8 003:902.053 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:908.020 - 5.983ms +T42A8 003:908.048 JLINK_IsHalted() +T42A8 003:908.725 - 0.677ms returns FALSE +T42A8 003:908.745 JLINK_HasError() +T42A8 003:909.996 JLINK_IsHalted() +T42A8 003:916.022 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:916.667 - 6.670ms returns TRUE +T42A8 003:916.690 JLINK_ReadReg(R15 (PC)) +T42A8 003:916.703 - 0.012ms returns 0x20003000 +T42A8 003:916.716 JLINK_ClrBPEx(BPHandle = 0x0000009D) +T42A8 003:916.726 - 0.010ms returns 0x00 +T42A8 003:916.741 JLINK_ReadReg(R0) +T42A8 003:916.751 - 0.010ms returns 0x00000000 +T42A8 003:917.455 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:917.471 Data: 01 99 89 1A 09 01 09 09 01 91 01 46 40 1E 80 B2 ... +T42A8 003:917.492 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:921.457 - 4.001ms returns 0x100 +T42A8 003:921.484 JLINK_HasError() +T42A8 003:921.498 JLINK_WriteReg(R0, 0x1800B600) +T42A8 003:921.511 - 0.013ms returns 0 +T42A8 003:921.524 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:921.534 - 0.010ms returns 0 +T42A8 003:921.546 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:921.557 - 0.010ms returns 0 +T42A8 003:921.569 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:921.579 - 0.010ms returns 0 +T42A8 003:921.591 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:921.601 - 0.010ms returns 0 +T42A8 003:921.614 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:921.624 - 0.010ms returns 0 +T42A8 003:921.636 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:921.646 - 0.009ms returns 0 +T42A8 003:921.659 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:921.668 - 0.010ms returns 0 +T42A8 003:921.681 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:921.691 - 0.010ms returns 0 +T42A8 003:921.703 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:921.713 - 0.010ms returns 0 +T42A8 003:921.725 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:921.735 - 0.010ms returns 0 +T42A8 003:921.748 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:921.757 - 0.010ms returns 0 +T42A8 003:921.770 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:921.780 - 0.010ms returns 0 +T42A8 003:921.792 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:921.803 - 0.011ms returns 0 +T42A8 003:921.815 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:921.825 - 0.010ms returns 0 +T42A8 003:921.838 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:921.848 - 0.010ms returns 0 +T42A8 003:921.860 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:921.882 - 0.021ms returns 0 +T42A8 003:921.894 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:921.904 - 0.009ms returns 0 +T42A8 003:921.916 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:921.926 - 0.009ms returns 0 +T42A8 003:921.938 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:921.948 - 0.010ms returns 0 +T42A8 003:921.962 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:921.973 - 0.012ms returns 0x0000009E +T42A8 003:921.985 JLINK_Go() +T42A8 003:922.004 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:927.979 - 5.993ms +T42A8 003:927.995 JLINK_IsHalted() +T42A8 003:928.516 - 0.520ms returns FALSE +T42A8 003:928.540 JLINK_HasError() +T42A8 003:933.092 JLINK_IsHalted() +T42A8 003:939.289 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:940.091 - 6.999ms returns TRUE +T42A8 003:940.114 JLINK_ReadReg(R15 (PC)) +T42A8 003:940.123 - 0.008ms returns 0x20003000 +T42A8 003:940.129 JLINK_ClrBPEx(BPHandle = 0x0000009E) +T42A8 003:940.135 - 0.005ms returns 0x00 +T42A8 003:940.141 JLINK_ReadReg(R0) +T42A8 003:940.146 - 0.005ms returns 0x00000000 +T42A8 003:940.758 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:940.774 Data: 08 D1 30 68 00 28 05 D0 06 46 E8 62 C0 88 80 05 ... +T42A8 003:940.793 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:945.082 - 4.325ms returns 0x100 +T42A8 003:945.109 JLINK_HasError() +T42A8 003:945.127 JLINK_WriteReg(R0, 0x1800B700) +T42A8 003:945.158 - 0.033ms returns 0 +T42A8 003:945.233 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:945.244 - 0.011ms returns 0 +T42A8 003:945.251 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:945.257 - 0.005ms returns 0 +T42A8 003:945.263 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:945.268 - 0.005ms returns 0 +T42A8 003:945.275 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:945.280 - 0.005ms returns 0 +T42A8 003:945.290 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:945.297 - 0.007ms returns 0 +T42A8 003:945.304 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:945.309 - 0.005ms returns 0 +T42A8 003:945.315 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:945.320 - 0.005ms returns 0 +T42A8 003:945.327 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:945.332 - 0.005ms returns 0 +T42A8 003:945.338 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:945.343 - 0.005ms returns 0 +T42A8 003:945.349 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:945.354 - 0.005ms returns 0 +T42A8 003:945.360 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:945.366 - 0.005ms returns 0 +T42A8 003:945.372 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:945.377 - 0.005ms returns 0 +T42A8 003:945.384 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:945.389 - 0.005ms returns 0 +T42A8 003:945.396 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:945.400 - 0.005ms returns 0 +T42A8 003:945.407 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:945.412 - 0.005ms returns 0 +T42A8 003:945.418 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:945.424 - 0.005ms returns 0 +T42A8 003:945.430 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:945.435 - 0.005ms returns 0 +T42A8 003:945.441 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:945.446 - 0.005ms returns 0 +T42A8 003:945.452 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:945.457 - 0.005ms returns 0 +T42A8 003:945.464 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:945.471 - 0.007ms returns 0x0000009F +T42A8 003:945.477 JLINK_Go() +T42A8 003:945.489 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:951.854 - 6.375ms +T42A8 003:951.883 JLINK_IsHalted() +T42A8 003:952.679 - 0.795ms returns FALSE +T42A8 003:952.704 JLINK_HasError() +T42A8 003:953.914 JLINK_IsHalted() +T42A8 003:959.943 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:960.524 - 6.608ms returns TRUE +T42A8 003:960.536 JLINK_ReadReg(R15 (PC)) +T42A8 003:960.543 - 0.007ms returns 0x20003000 +T42A8 003:960.550 JLINK_ClrBPEx(BPHandle = 0x0000009F) +T42A8 003:960.556 - 0.005ms returns 0x00 +T42A8 003:960.562 JLINK_ReadReg(R0) +T42A8 003:960.568 - 0.005ms returns 0x00000000 +T42A8 003:961.013 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:961.022 Data: 05 F0 FA FE F9 72 38 7B 40 1C 38 73 04 98 40 1C ... +T42A8 003:961.033 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:965.002 - 3.985ms returns 0x100 +T42A8 003:965.052 JLINK_HasError() +T42A8 003:965.083 JLINK_WriteReg(R0, 0x1800B800) +T42A8 003:965.112 - 0.029ms returns 0 +T42A8 003:965.141 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:965.164 - 0.023ms returns 0 +T42A8 003:965.192 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:965.214 - 0.022ms returns 0 +T42A8 003:965.242 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:965.264 - 0.022ms returns 0 +T42A8 003:965.292 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:965.314 - 0.022ms returns 0 +T42A8 003:965.341 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:965.364 - 0.022ms returns 0 +T42A8 003:965.391 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:965.413 - 0.022ms returns 0 +T42A8 003:965.440 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:965.462 - 0.022ms returns 0 +T42A8 003:965.490 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:965.512 - 0.022ms returns 0 +T42A8 003:965.540 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:965.562 - 0.022ms returns 0 +T42A8 003:965.588 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:965.611 - 0.022ms returns 0 +T42A8 003:965.638 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:965.660 - 0.022ms returns 0 +T42A8 003:965.688 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:965.714 - 0.025ms returns 0 +T42A8 003:965.742 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:965.794 - 0.051ms returns 0 +T42A8 003:965.821 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:965.843 - 0.021ms returns 0 +T42A8 003:965.870 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:965.892 - 0.022ms returns 0 +T42A8 003:965.920 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:965.941 - 0.021ms returns 0 +T42A8 003:965.968 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:965.990 - 0.022ms returns 0 +T42A8 003:966.017 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:966.039 - 0.022ms returns 0 +T42A8 003:966.080 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:966.102 - 0.023ms returns 0 +T42A8 003:966.131 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:966.156 - 0.026ms returns 0x000000A0 +T42A8 003:966.183 JLINK_Go() +T42A8 003:966.222 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 003:972.812 - 6.626ms +T42A8 003:972.888 JLINK_IsHalted() +T42A8 003:973.881 - 0.989ms returns FALSE +T42A8 003:973.981 JLINK_HasError() +T42A8 003:978.943 JLINK_IsHalted() +T42A8 003:985.510 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 003:986.405 - 7.462ms returns TRUE +T42A8 003:986.471 JLINK_ReadReg(R15 (PC)) +T42A8 003:986.503 - 0.031ms returns 0x20003000 +T42A8 003:986.532 JLINK_ClrBPEx(BPHandle = 0x000000A0) +T42A8 003:986.557 - 0.024ms returns 0x00 +T42A8 003:986.584 JLINK_ReadReg(R0) +T42A8 003:986.608 - 0.022ms returns 0x00000000 +T42A8 003:988.663 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 003:988.710 Data: FF 7F 00 00 60 91 00 20 80 83 00 20 50 91 00 20 ... +T42A8 003:988.776 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 003:992.912 - 4.247ms returns 0x100 +T42A8 003:993.000 JLINK_HasError() +T42A8 003:993.036 JLINK_WriteReg(R0, 0x1800B900) +T42A8 003:993.068 - 0.032ms returns 0 +T42A8 003:993.096 JLINK_WriteReg(R1, 0x00000100) +T42A8 003:993.117 - 0.022ms returns 0 +T42A8 003:993.144 JLINK_WriteReg(R2, 0x200039D4) +T42A8 003:993.165 - 0.021ms returns 0 +T42A8 003:993.191 JLINK_WriteReg(R3, 0x00000000) +T42A8 003:993.212 - 0.021ms returns 0 +T42A8 003:993.238 JLINK_WriteReg(R4, 0x00000000) +T42A8 003:993.260 - 0.021ms returns 0 +T42A8 003:993.286 JLINK_WriteReg(R5, 0x00000000) +T42A8 003:993.308 - 0.021ms returns 0 +T42A8 003:993.334 JLINK_WriteReg(R6, 0x00000000) +T42A8 003:993.355 - 0.021ms returns 0 +T42A8 003:993.381 JLINK_WriteReg(R7, 0x00000000) +T42A8 003:993.402 - 0.020ms returns 0 +T42A8 003:993.428 JLINK_WriteReg(R8, 0x00000000) +T42A8 003:993.450 - 0.021ms returns 0 +T42A8 003:993.476 JLINK_WriteReg(R9, 0x200039B4) +T42A8 003:993.497 - 0.021ms returns 0 +T42A8 003:993.523 JLINK_WriteReg(R10, 0x00000000) +T42A8 003:993.544 - 0.021ms returns 0 +T42A8 003:993.570 JLINK_WriteReg(R11, 0x00000000) +T42A8 003:993.592 - 0.021ms returns 0 +T42A8 003:993.618 JLINK_WriteReg(R12, 0x00000000) +T42A8 003:993.639 - 0.021ms returns 0 +T42A8 003:993.666 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 003:993.688 - 0.023ms returns 0 +T42A8 003:993.714 JLINK_WriteReg(R14, 0x20003001) +T42A8 003:993.742 - 0.028ms returns 0 +T42A8 003:993.805 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 003:993.828 - 0.023ms returns 0 +T42A8 003:993.856 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 003:993.877 - 0.021ms returns 0 +T42A8 003:993.904 JLINK_WriteReg(MSP, 0x20004000) +T42A8 003:993.925 - 0.021ms returns 0 +T42A8 003:993.952 JLINK_WriteReg(PSP, 0x20004000) +T42A8 003:993.973 - 0.021ms returns 0 +T42A8 003:993.999 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 003:994.020 - 0.021ms returns 0 +T42A8 003:994.049 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 003:994.074 - 0.026ms returns 0x000000A1 +T42A8 003:994.100 JLINK_Go() +T42A8 003:994.141 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:000.845 - 6.741ms +T42A8 004:000.962 JLINK_IsHalted() +T42A8 004:001.868 - 0.903ms returns FALSE +T42A8 004:001.942 JLINK_HasError() +T42A8 004:006.696 JLINK_IsHalted() +T42A8 004:013.010 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:013.794 - 7.095ms returns TRUE +T42A8 004:013.851 JLINK_ReadReg(R15 (PC)) +T42A8 004:013.882 - 0.030ms returns 0x20003000 +T42A8 004:013.911 JLINK_ClrBPEx(BPHandle = 0x000000A1) +T42A8 004:013.935 - 0.024ms returns 0x00 +T42A8 004:013.964 JLINK_ReadReg(R0) +T42A8 004:013.987 - 0.022ms returns 0x00000000 +T42A8 004:015.664 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:015.700 Data: 8A 42 F2 D8 00 22 31 46 00 98 FF F7 9E FC F8 BD ... +T42A8 004:015.749 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:019.868 - 4.203ms returns 0x100 +T42A8 004:019.952 JLINK_HasError() +T42A8 004:019.986 JLINK_WriteReg(R0, 0x1800BA00) +T42A8 004:020.018 - 0.032ms returns 0 +T42A8 004:020.046 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:020.275 - 0.228ms returns 0 +T42A8 004:020.304 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:020.326 - 0.022ms returns 0 +T42A8 004:020.352 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:020.374 - 0.021ms returns 0 +T42A8 004:020.400 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:020.421 - 0.021ms returns 0 +T42A8 004:020.448 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:020.469 - 0.021ms returns 0 +T42A8 004:020.495 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:020.516 - 0.021ms returns 0 +T42A8 004:020.593 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:020.629 - 0.035ms returns 0 +T42A8 004:020.663 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:020.686 - 0.023ms returns 0 +T42A8 004:020.712 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:020.734 - 0.022ms returns 0 +T42A8 004:020.761 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:020.782 - 0.021ms returns 0 +T42A8 004:020.809 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:020.830 - 0.021ms returns 0 +T42A8 004:020.857 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:020.878 - 0.021ms returns 0 +T42A8 004:020.906 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:020.936 - 0.031ms returns 0 +T42A8 004:020.962 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:020.984 - 0.021ms returns 0 +T42A8 004:021.011 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:021.032 - 0.022ms returns 0 +T42A8 004:021.058 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:021.080 - 0.021ms returns 0 +T42A8 004:021.106 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:021.127 - 0.021ms returns 0 +T42A8 004:021.153 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:021.174 - 0.021ms returns 0 +T42A8 004:021.200 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:021.222 - 0.021ms returns 0 +T42A8 004:021.251 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:021.276 - 0.026ms returns 0x000000A2 +T42A8 004:021.302 JLINK_Go() +T42A8 004:021.343 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:027.683 - 6.378ms +T42A8 004:027.754 JLINK_IsHalted() +T42A8 004:028.429 - 0.673ms returns FALSE +T42A8 004:028.481 JLINK_HasError() +T42A8 004:030.648 JLINK_IsHalted() +T42A8 004:036.980 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:037.710 - 7.059ms returns TRUE +T42A8 004:037.762 JLINK_ReadReg(R15 (PC)) +T42A8 004:037.791 - 0.028ms returns 0x20003000 +T42A8 004:037.824 JLINK_ClrBPEx(BPHandle = 0x000000A2) +T42A8 004:037.849 - 0.025ms returns 0x00 +T42A8 004:037.878 JLINK_ReadReg(R0) +T42A8 004:037.902 - 0.023ms returns 0x00000000 +T42A8 004:039.708 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:039.745 Data: 04 98 00 29 7E D0 03 21 70 22 50 43 82 4A 03 46 ... +T42A8 004:039.795 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:043.887 - 4.178ms returns 0x100 +T42A8 004:043.953 JLINK_HasError() +T42A8 004:043.986 JLINK_WriteReg(R0, 0x1800BB00) +T42A8 004:044.018 - 0.032ms returns 0 +T42A8 004:044.046 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:044.070 - 0.023ms returns 0 +T42A8 004:044.097 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:044.120 - 0.022ms returns 0 +T42A8 004:044.147 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:044.169 - 0.022ms returns 0 +T42A8 004:044.196 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:044.219 - 0.022ms returns 0 +T42A8 004:044.246 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:044.268 - 0.022ms returns 0 +T42A8 004:044.295 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:044.317 - 0.022ms returns 0 +T42A8 004:044.344 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:044.366 - 0.021ms returns 0 +T42A8 004:044.393 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:044.415 - 0.022ms returns 0 +T42A8 004:044.442 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:044.464 - 0.022ms returns 0 +T42A8 004:044.491 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:044.513 - 0.022ms returns 0 +T42A8 004:044.540 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:044.562 - 0.022ms returns 0 +T42A8 004:044.595 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:044.618 - 0.022ms returns 0 +T42A8 004:044.646 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:044.672 - 0.026ms returns 0 +T42A8 004:044.700 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:044.722 - 0.022ms returns 0 +T42A8 004:044.749 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:044.779 - 0.031ms returns 0 +T42A8 004:044.812 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:044.834 - 0.022ms returns 0 +T42A8 004:044.860 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:044.882 - 0.021ms returns 0 +T42A8 004:044.908 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:044.929 - 0.021ms returns 0 +T42A8 004:044.955 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:044.977 - 0.021ms returns 0 +T42A8 004:045.006 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:045.030 - 0.025ms returns 0x000000A3 +T42A8 004:045.056 JLINK_Go() +T42A8 004:045.097 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:051.797 - 6.737ms +T42A8 004:051.871 JLINK_IsHalted() +T42A8 004:052.615 - 0.742ms returns FALSE +T42A8 004:052.673 JLINK_HasError() +T42A8 004:067.522 JLINK_IsHalted() +T42A8 004:073.940 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:074.688 - 7.165ms returns TRUE +T42A8 004:074.723 JLINK_ReadReg(R15 (PC)) +T42A8 004:074.737 - 0.014ms returns 0x20003000 +T42A8 004:074.750 JLINK_ClrBPEx(BPHandle = 0x000000A3) +T42A8 004:074.760 - 0.010ms returns 0x00 +T42A8 004:074.772 JLINK_ReadReg(R0) +T42A8 004:074.782 - 0.009ms returns 0x00000000 +T42A8 004:075.492 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:075.510 Data: 04 98 00 E0 31 E0 08 18 01 06 0A 0D 77 21 C9 00 ... +T42A8 004:075.536 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:079.473 - 3.980ms returns 0x100 +T42A8 004:079.504 JLINK_HasError() +T42A8 004:079.516 JLINK_WriteReg(R0, 0x1800BC00) +T42A8 004:079.532 - 0.015ms returns 0 +T42A8 004:079.544 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:079.553 - 0.008ms returns 0 +T42A8 004:079.562 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:079.570 - 0.007ms returns 0 +T42A8 004:079.580 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:079.588 - 0.007ms returns 0 +T42A8 004:079.598 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:079.606 - 0.007ms returns 0 +T42A8 004:079.615 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:079.623 - 0.008ms returns 0 +T42A8 004:079.633 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:079.642 - 0.008ms returns 0 +T42A8 004:079.652 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:079.659 - 0.007ms returns 0 +T42A8 004:079.668 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:079.676 - 0.007ms returns 0 +T42A8 004:079.686 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:079.693 - 0.007ms returns 0 +T42A8 004:079.703 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:079.710 - 0.007ms returns 0 +T42A8 004:079.720 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:079.728 - 0.007ms returns 0 +T42A8 004:079.737 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:079.744 - 0.007ms returns 0 +T42A8 004:079.754 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:079.762 - 0.008ms returns 0 +T42A8 004:079.772 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:079.780 - 0.008ms returns 0 +T42A8 004:079.790 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:079.798 - 0.008ms returns 0 +T42A8 004:079.808 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:079.815 - 0.007ms returns 0 +T42A8 004:079.824 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:079.832 - 0.007ms returns 0 +T42A8 004:079.842 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:079.850 - 0.008ms returns 0 +T42A8 004:079.859 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:079.867 - 0.007ms returns 0 +T42A8 004:079.878 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:079.887 - 0.009ms returns 0x000000A4 +T42A8 004:079.896 JLINK_Go() +T42A8 004:079.912 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:085.816 - 5.919ms +T42A8 004:085.830 JLINK_IsHalted() +T42A8 004:086.464 - 0.633ms returns FALSE +T42A8 004:086.475 JLINK_HasError() +T42A8 004:088.469 JLINK_IsHalted() +T42A8 004:094.503 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:095.044 - 6.575ms returns TRUE +T42A8 004:095.055 JLINK_ReadReg(R15 (PC)) +T42A8 004:095.061 - 0.006ms returns 0x20003000 +T42A8 004:095.068 JLINK_ClrBPEx(BPHandle = 0x000000A4) +T42A8 004:095.074 - 0.005ms returns 0x00 +T42A8 004:095.080 JLINK_ReadReg(R0) +T42A8 004:095.085 - 0.005ms returns 0x00000000 +T42A8 004:095.505 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:095.514 Data: 72 B6 83 00 06 48 C0 58 00 28 26 D0 03 46 80 30 ... +T42A8 004:095.529 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:099.482 - 3.976ms returns 0x100 +T42A8 004:099.492 JLINK_HasError() +T42A8 004:099.500 JLINK_WriteReg(R0, 0x1800BD00) +T42A8 004:099.506 - 0.006ms returns 0 +T42A8 004:099.513 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:099.518 - 0.005ms returns 0 +T42A8 004:099.524 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:099.529 - 0.005ms returns 0 +T42A8 004:099.536 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:099.540 - 0.005ms returns 0 +T42A8 004:099.547 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:099.552 - 0.005ms returns 0 +T42A8 004:099.558 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:099.563 - 0.005ms returns 0 +T42A8 004:099.569 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:099.574 - 0.005ms returns 0 +T42A8 004:099.580 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:099.585 - 0.005ms returns 0 +T42A8 004:099.591 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:099.596 - 0.005ms returns 0 +T42A8 004:099.602 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:099.608 - 0.005ms returns 0 +T42A8 004:099.614 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:099.620 - 0.005ms returns 0 +T42A8 004:099.626 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:099.631 - 0.005ms returns 0 +T42A8 004:099.637 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:099.642 - 0.005ms returns 0 +T42A8 004:099.648 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:099.654 - 0.005ms returns 0 +T42A8 004:099.660 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:099.665 - 0.005ms returns 0 +T42A8 004:099.671 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:099.676 - 0.005ms returns 0 +T42A8 004:099.682 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:099.687 - 0.005ms returns 0 +T42A8 004:099.693 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:099.698 - 0.005ms returns 0 +T42A8 004:099.704 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:099.709 - 0.005ms returns 0 +T42A8 004:099.716 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:099.720 - 0.005ms returns 0 +T42A8 004:099.727 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:099.733 - 0.005ms returns 0x000000A5 +T42A8 004:099.739 JLINK_Go() +T42A8 004:099.748 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:105.592 - 5.852ms +T42A8 004:105.603 JLINK_IsHalted() +T42A8 004:106.291 - 0.688ms returns FALSE +T42A8 004:106.302 JLINK_HasError() +T42A8 004:107.386 JLINK_IsHalted() +T42A8 004:113.314 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:113.932 - 6.545ms returns TRUE +T42A8 004:113.944 JLINK_ReadReg(R15 (PC)) +T42A8 004:113.952 - 0.006ms returns 0x20003000 +T42A8 004:113.958 JLINK_ClrBPEx(BPHandle = 0x000000A5) +T42A8 004:113.963 - 0.005ms returns 0x00 +T42A8 004:113.969 JLINK_ReadReg(R0) +T42A8 004:113.974 - 0.005ms returns 0x00000000 +T42A8 004:114.563 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:114.572 Data: 91 04 89 0F 01 D1 01 21 C1 70 18 46 70 BD 70 B5 ... +T42A8 004:114.583 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:118.553 - 3.990ms returns 0x100 +T42A8 004:118.564 JLINK_HasError() +T42A8 004:118.571 JLINK_WriteReg(R0, 0x1800BE00) +T42A8 004:118.577 - 0.006ms returns 0 +T42A8 004:118.584 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:118.588 - 0.004ms returns 0 +T42A8 004:118.594 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:118.599 - 0.005ms returns 0 +T42A8 004:118.605 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:118.609 - 0.004ms returns 0 +T42A8 004:118.615 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:118.620 - 0.004ms returns 0 +T42A8 004:118.626 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:118.630 - 0.004ms returns 0 +T42A8 004:118.636 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:118.640 - 0.004ms returns 0 +T42A8 004:118.646 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:118.651 - 0.004ms returns 0 +T42A8 004:118.657 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:118.661 - 0.004ms returns 0 +T42A8 004:118.667 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:118.672 - 0.004ms returns 0 +T42A8 004:118.678 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:118.682 - 0.004ms returns 0 +T42A8 004:118.688 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:118.692 - 0.004ms returns 0 +T42A8 004:118.701 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:118.706 - 0.005ms returns 0 +T42A8 004:118.712 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:118.717 - 0.005ms returns 0 +T42A8 004:118.723 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:118.728 - 0.004ms returns 0 +T42A8 004:118.734 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:118.738 - 0.004ms returns 0 +T42A8 004:118.744 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:118.749 - 0.004ms returns 0 +T42A8 004:118.754 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:118.759 - 0.004ms returns 0 +T42A8 004:118.765 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:118.770 - 0.004ms returns 0 +T42A8 004:118.775 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:118.780 - 0.004ms returns 0 +T42A8 004:118.786 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:118.792 - 0.005ms returns 0x000000A6 +T42A8 004:118.797 JLINK_Go() +T42A8 004:118.806 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:124.844 - 6.045ms +T42A8 004:124.867 JLINK_IsHalted() +T42A8 004:125.504 - 0.636ms returns FALSE +T42A8 004:125.514 JLINK_HasError() +T42A8 004:127.487 JLINK_IsHalted() +T42A8 004:133.494 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:134.124 - 6.636ms returns TRUE +T42A8 004:134.135 JLINK_ReadReg(R15 (PC)) +T42A8 004:134.142 - 0.007ms returns 0x20003000 +T42A8 004:134.150 JLINK_ClrBPEx(BPHandle = 0x000000A6) +T42A8 004:134.156 - 0.006ms returns 0x00 +T42A8 004:134.163 JLINK_ReadReg(R0) +T42A8 004:134.169 - 0.005ms returns 0x00000000 +T42A8 004:134.622 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:134.632 Data: 2A 6E FF F7 1C F9 00 20 86 F3 10 88 F8 BD F8 B5 ... +T42A8 004:134.644 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:138.483 - 3.860ms returns 0x100 +T42A8 004:138.497 JLINK_HasError() +T42A8 004:138.506 JLINK_WriteReg(R0, 0x1800BF00) +T42A8 004:138.513 - 0.007ms returns 0 +T42A8 004:138.521 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:138.528 - 0.006ms returns 0 +T42A8 004:138.537 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:138.543 - 0.006ms returns 0 +T42A8 004:138.552 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:138.558 - 0.006ms returns 0 +T42A8 004:138.619 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:138.630 - 0.011ms returns 0 +T42A8 004:138.638 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:138.644 - 0.006ms returns 0 +T42A8 004:138.652 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:138.658 - 0.006ms returns 0 +T42A8 004:138.666 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:138.672 - 0.006ms returns 0 +T42A8 004:138.680 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:138.686 - 0.006ms returns 0 +T42A8 004:138.694 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:138.700 - 0.006ms returns 0 +T42A8 004:138.708 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:138.714 - 0.006ms returns 0 +T42A8 004:138.721 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:138.728 - 0.006ms returns 0 +T42A8 004:138.735 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:138.742 - 0.006ms returns 0 +T42A8 004:138.749 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:138.756 - 0.006ms returns 0 +T42A8 004:138.764 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:138.770 - 0.006ms returns 0 +T42A8 004:138.777 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:138.784 - 0.006ms returns 0 +T42A8 004:138.791 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:138.797 - 0.006ms returns 0 +T42A8 004:138.805 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:138.811 - 0.006ms returns 0 +T42A8 004:138.819 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:138.825 - 0.006ms returns 0 +T42A8 004:138.832 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:138.839 - 0.006ms returns 0 +T42A8 004:138.847 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:138.854 - 0.007ms returns 0x000000A7 +T42A8 004:138.862 JLINK_Go() +T42A8 004:138.872 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:144.929 - 6.066ms +T42A8 004:144.945 JLINK_IsHalted() +T42A8 004:145.509 - 0.563ms returns FALSE +T42A8 004:145.524 JLINK_HasError() +T42A8 004:147.332 JLINK_IsHalted() +T42A8 004:153.366 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:154.154 - 6.821ms returns TRUE +T42A8 004:154.178 JLINK_ReadReg(R15 (PC)) +T42A8 004:154.192 - 0.013ms returns 0x20003000 +T42A8 004:154.200 JLINK_ClrBPEx(BPHandle = 0x000000A7) +T42A8 004:154.205 - 0.005ms returns 0x00 +T42A8 004:154.212 JLINK_ReadReg(R0) +T42A8 004:154.217 - 0.005ms returns 0x00000000 +T42A8 004:154.732 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:154.748 Data: FB FA 60 1A A0 42 00 D1 00 20 4A 49 48 43 40 1C ... +T42A8 004:154.764 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:158.822 - 4.089ms returns 0x100 +T42A8 004:158.847 JLINK_HasError() +T42A8 004:158.856 JLINK_WriteReg(R0, 0x1800C000) +T42A8 004:158.864 - 0.008ms returns 0 +T42A8 004:158.872 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:158.877 - 0.005ms returns 0 +T42A8 004:158.884 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:158.889 - 0.005ms returns 0 +T42A8 004:158.895 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:158.900 - 0.005ms returns 0 +T42A8 004:158.907 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:158.912 - 0.005ms returns 0 +T42A8 004:158.919 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:158.924 - 0.005ms returns 0 +T42A8 004:158.930 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:158.936 - 0.005ms returns 0 +T42A8 004:158.942 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:158.948 - 0.005ms returns 0 +T42A8 004:158.954 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:158.959 - 0.005ms returns 0 +T42A8 004:158.966 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:158.971 - 0.005ms returns 0 +T42A8 004:158.977 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:158.982 - 0.005ms returns 0 +T42A8 004:158.989 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:158.994 - 0.005ms returns 0 +T42A8 004:159.000 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:159.006 - 0.005ms returns 0 +T42A8 004:159.012 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:159.018 - 0.006ms returns 0 +T42A8 004:159.025 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:159.030 - 0.005ms returns 0 +T42A8 004:159.037 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:159.042 - 0.005ms returns 0 +T42A8 004:159.048 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:159.054 - 0.005ms returns 0 +T42A8 004:159.060 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:159.065 - 0.005ms returns 0 +T42A8 004:159.072 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:159.077 - 0.005ms returns 0 +T42A8 004:159.083 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:159.088 - 0.005ms returns 0 +T42A8 004:159.096 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:159.102 - 0.007ms returns 0x000000A8 +T42A8 004:159.108 JLINK_Go() +T42A8 004:159.120 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:165.473 - 6.363ms +T42A8 004:165.503 JLINK_IsHalted() +T42A8 004:166.170 - 0.666ms returns FALSE +T42A8 004:166.187 JLINK_HasError() +T42A8 004:172.419 JLINK_IsHalted() +T42A8 004:178.582 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:179.305 - 6.885ms returns TRUE +T42A8 004:179.334 JLINK_ReadReg(R15 (PC)) +T42A8 004:179.344 - 0.010ms returns 0x20003000 +T42A8 004:179.352 JLINK_ClrBPEx(BPHandle = 0x000000A8) +T42A8 004:179.359 - 0.006ms returns 0x00 +T42A8 004:179.367 JLINK_ReadReg(R0) +T42A8 004:179.374 - 0.006ms returns 0x00000000 +T42A8 004:179.911 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:179.924 Data: 01 46 00 20 EF F3 10 84 72 B6 8A 00 06 49 89 58 ... +T42A8 004:179.942 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:184.022 - 4.110ms returns 0x100 +T42A8 004:184.048 JLINK_HasError() +T42A8 004:184.059 JLINK_WriteReg(R0, 0x1800C100) +T42A8 004:184.069 - 0.010ms returns 0 +T42A8 004:184.077 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:184.084 - 0.006ms returns 0 +T42A8 004:184.092 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:184.098 - 0.006ms returns 0 +T42A8 004:184.106 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:184.112 - 0.006ms returns 0 +T42A8 004:184.120 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:184.126 - 0.006ms returns 0 +T42A8 004:184.133 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:184.140 - 0.006ms returns 0 +T42A8 004:184.147 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:184.153 - 0.006ms returns 0 +T42A8 004:184.161 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:184.178 - 0.016ms returns 0 +T42A8 004:184.186 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:184.198 - 0.012ms returns 0 +T42A8 004:184.206 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:184.212 - 0.006ms returns 0 +T42A8 004:184.220 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:184.227 - 0.006ms returns 0 +T42A8 004:184.236 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:184.242 - 0.006ms returns 0 +T42A8 004:184.258 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:184.268 - 0.009ms returns 0 +T42A8 004:184.276 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:184.283 - 0.007ms returns 0 +T42A8 004:184.290 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:184.296 - 0.006ms returns 0 +T42A8 004:184.304 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:184.311 - 0.006ms returns 0 +T42A8 004:184.318 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:184.324 - 0.006ms returns 0 +T42A8 004:184.332 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:184.338 - 0.006ms returns 0 +T42A8 004:184.346 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:184.352 - 0.006ms returns 0 +T42A8 004:184.360 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:184.366 - 0.006ms returns 0 +T42A8 004:184.375 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:184.382 - 0.008ms returns 0x000000A9 +T42A8 004:184.390 JLINK_Go() +T42A8 004:184.404 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:190.822 - 6.431ms +T42A8 004:190.848 JLINK_IsHalted() +T42A8 004:191.540 - 0.692ms returns FALSE +T42A8 004:191.553 JLINK_HasError() +T42A8 004:196.236 JLINK_IsHalted() +T42A8 004:202.294 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:202.929 - 6.692ms returns TRUE +T42A8 004:202.942 JLINK_ReadReg(R15 (PC)) +T42A8 004:202.950 - 0.008ms returns 0x20003000 +T42A8 004:202.959 JLINK_ClrBPEx(BPHandle = 0x000000A9) +T42A8 004:202.966 - 0.006ms returns 0x00 +T42A8 004:202.974 JLINK_ReadReg(R0) +T42A8 004:202.981 - 0.006ms returns 0x00000000 +T42A8 004:203.427 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:203.438 Data: DD 49 00 69 30 18 40 1B C0 1B 00 28 04 DD 40 1E ... +T42A8 004:203.452 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:207.394 - 3.966ms returns 0x100 +T42A8 004:207.407 JLINK_HasError() +T42A8 004:207.416 JLINK_WriteReg(R0, 0x1800C200) +T42A8 004:207.425 - 0.008ms returns 0 +T42A8 004:207.433 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:207.439 - 0.006ms returns 0 +T42A8 004:207.446 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:207.453 - 0.006ms returns 0 +T42A8 004:207.461 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:207.467 - 0.006ms returns 0 +T42A8 004:207.475 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:207.481 - 0.006ms returns 0 +T42A8 004:207.489 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:207.495 - 0.006ms returns 0 +T42A8 004:207.502 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:207.509 - 0.006ms returns 0 +T42A8 004:207.516 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:207.522 - 0.006ms returns 0 +T42A8 004:207.530 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:207.536 - 0.006ms returns 0 +T42A8 004:207.544 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:207.550 - 0.006ms returns 0 +T42A8 004:207.558 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:207.565 - 0.007ms returns 0 +T42A8 004:207.573 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:207.579 - 0.006ms returns 0 +T42A8 004:207.587 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:207.593 - 0.006ms returns 0 +T42A8 004:207.601 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:207.608 - 0.006ms returns 0 +T42A8 004:207.616 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:207.622 - 0.006ms returns 0 +T42A8 004:207.630 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:207.636 - 0.006ms returns 0 +T42A8 004:207.644 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:207.650 - 0.006ms returns 0 +T42A8 004:207.657 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:207.664 - 0.006ms returns 0 +T42A8 004:207.671 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:207.677 - 0.006ms returns 0 +T42A8 004:207.685 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:207.691 - 0.006ms returns 0 +T42A8 004:207.700 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:207.707 - 0.007ms returns 0x000000AA +T42A8 004:207.715 JLINK_Go() +T42A8 004:207.727 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:213.714 - 5.999ms +T42A8 004:213.730 JLINK_IsHalted() +T42A8 004:214.284 - 0.553ms returns FALSE +T42A8 004:214.297 JLINK_HasError() +T42A8 004:216.122 JLINK_IsHalted() +T42A8 004:222.317 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:223.108 - 6.986ms returns TRUE +T42A8 004:223.163 JLINK_ReadReg(R15 (PC)) +T42A8 004:223.173 - 0.011ms returns 0x20003000 +T42A8 004:223.181 JLINK_ClrBPEx(BPHandle = 0x000000AA) +T42A8 004:223.200 - 0.005ms returns 0x00 +T42A8 004:223.207 JLINK_ReadReg(R0) +T42A8 004:223.212 - 0.005ms returns 0x00000000 +T42A8 004:223.753 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:223.788 Data: 8A 43 0A 43 82 61 01 68 01 22 D2 06 91 43 11 43 ... +T42A8 004:223.826 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:227.931 - 4.177ms returns 0x100 +T42A8 004:227.955 JLINK_HasError() +T42A8 004:227.964 JLINK_WriteReg(R0, 0x1800C300) +T42A8 004:227.973 - 0.009ms returns 0 +T42A8 004:227.979 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:227.985 - 0.005ms returns 0 +T42A8 004:227.991 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:227.996 - 0.005ms returns 0 +T42A8 004:228.002 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:228.007 - 0.005ms returns 0 +T42A8 004:228.013 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:228.018 - 0.005ms returns 0 +T42A8 004:228.024 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:228.029 - 0.005ms returns 0 +T42A8 004:228.036 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:228.041 - 0.005ms returns 0 +T42A8 004:228.047 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:228.063 - 0.016ms returns 0 +T42A8 004:228.069 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:228.074 - 0.004ms returns 0 +T42A8 004:228.080 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:228.085 - 0.005ms returns 0 +T42A8 004:228.091 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:228.096 - 0.005ms returns 0 +T42A8 004:228.103 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:228.107 - 0.005ms returns 0 +T42A8 004:228.114 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:228.119 - 0.005ms returns 0 +T42A8 004:228.126 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:228.132 - 0.006ms returns 0 +T42A8 004:228.139 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:228.144 - 0.005ms returns 0 +T42A8 004:228.150 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:228.155 - 0.005ms returns 0 +T42A8 004:228.161 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:228.166 - 0.004ms returns 0 +T42A8 004:228.172 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:228.176 - 0.004ms returns 0 +T42A8 004:228.182 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:228.187 - 0.004ms returns 0 +T42A8 004:228.193 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:228.198 - 0.005ms returns 0 +T42A8 004:228.205 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:228.211 - 0.006ms returns 0x000000AB +T42A8 004:228.217 JLINK_Go() +T42A8 004:228.229 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:234.659 - 6.441ms +T42A8 004:234.681 JLINK_IsHalted() +T42A8 004:235.347 - 0.664ms returns FALSE +T42A8 004:235.360 JLINK_HasError() +T42A8 004:237.153 JLINK_IsHalted() +T42A8 004:243.176 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:243.746 - 6.592ms returns TRUE +T42A8 004:243.757 JLINK_ReadReg(R15 (PC)) +T42A8 004:243.765 - 0.007ms returns 0x20003000 +T42A8 004:243.771 JLINK_ClrBPEx(BPHandle = 0x000000AB) +T42A8 004:243.777 - 0.005ms returns 0x00 +T42A8 004:243.783 JLINK_ReadReg(R0) +T42A8 004:243.788 - 0.005ms returns 0x00000000 +T42A8 004:244.191 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:244.199 Data: 03 D2 40 1C 00 01 00 09 68 60 A8 8A 80 0B 02 28 ... +T42A8 004:244.211 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:248.165 - 3.973ms returns 0x100 +T42A8 004:248.176 JLINK_HasError() +T42A8 004:248.184 JLINK_WriteReg(R0, 0x1800C400) +T42A8 004:248.190 - 0.006ms returns 0 +T42A8 004:248.197 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:248.202 - 0.005ms returns 0 +T42A8 004:248.208 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:248.213 - 0.005ms returns 0 +T42A8 004:248.219 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:248.224 - 0.005ms returns 0 +T42A8 004:248.230 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:248.237 - 0.007ms returns 0 +T42A8 004:248.245 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:248.250 - 0.005ms returns 0 +T42A8 004:248.257 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:248.261 - 0.005ms returns 0 +T42A8 004:248.268 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:248.273 - 0.004ms returns 0 +T42A8 004:248.279 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:248.284 - 0.005ms returns 0 +T42A8 004:248.290 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:248.295 - 0.005ms returns 0 +T42A8 004:248.301 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:248.306 - 0.005ms returns 0 +T42A8 004:248.312 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:248.317 - 0.004ms returns 0 +T42A8 004:248.323 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:248.328 - 0.005ms returns 0 +T42A8 004:248.334 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:248.340 - 0.005ms returns 0 +T42A8 004:248.346 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:248.351 - 0.005ms returns 0 +T42A8 004:248.357 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:248.362 - 0.005ms returns 0 +T42A8 004:248.368 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:248.373 - 0.005ms returns 0 +T42A8 004:248.379 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:248.384 - 0.005ms returns 0 +T42A8 004:248.390 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:248.395 - 0.004ms returns 0 +T42A8 004:248.401 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:248.406 - 0.004ms returns 0 +T42A8 004:248.413 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:248.423 - 0.009ms returns 0x000000AC +T42A8 004:248.429 JLINK_Go() +T42A8 004:248.442 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:254.894 - 6.463ms +T42A8 004:254.923 JLINK_IsHalted() +T42A8 004:255.711 - 0.787ms returns FALSE +T42A8 004:255.740 JLINK_HasError() +T42A8 004:257.177 JLINK_IsHalted() +T42A8 004:263.232 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:263.922 - 6.745ms returns TRUE +T42A8 004:263.937 JLINK_ReadReg(R15 (PC)) +T42A8 004:263.945 - 0.008ms returns 0x20003000 +T42A8 004:263.969 JLINK_ClrBPEx(BPHandle = 0x000000AC) +T42A8 004:263.975 - 0.006ms returns 0x00 +T42A8 004:263.982 JLINK_ReadReg(R0) +T42A8 004:263.988 - 0.005ms returns 0x00000000 +T42A8 004:264.489 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:264.501 Data: 00 09 40 42 83 42 98 DC 1C 48 0C 38 80 68 A0 42 ... +T42A8 004:264.516 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:268.434 - 3.945ms returns 0x100 +T42A8 004:268.458 JLINK_HasError() +T42A8 004:268.467 JLINK_WriteReg(R0, 0x1800C500) +T42A8 004:268.477 - 0.009ms returns 0 +T42A8 004:268.483 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:268.489 - 0.005ms returns 0 +T42A8 004:268.497 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:268.502 - 0.005ms returns 0 +T42A8 004:268.508 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:268.514 - 0.005ms returns 0 +T42A8 004:268.521 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:268.528 - 0.006ms returns 0 +T42A8 004:268.535 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:268.541 - 0.006ms returns 0 +T42A8 004:268.548 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:268.553 - 0.005ms returns 0 +T42A8 004:268.560 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:268.565 - 0.005ms returns 0 +T42A8 004:268.572 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:268.577 - 0.005ms returns 0 +T42A8 004:268.583 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:268.589 - 0.005ms returns 0 +T42A8 004:268.595 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:268.601 - 0.005ms returns 0 +T42A8 004:268.607 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:268.613 - 0.005ms returns 0 +T42A8 004:268.620 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:268.626 - 0.006ms returns 0 +T42A8 004:268.633 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:268.640 - 0.007ms returns 0 +T42A8 004:268.646 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:268.651 - 0.005ms returns 0 +T42A8 004:268.658 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:268.664 - 0.006ms returns 0 +T42A8 004:268.671 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:268.676 - 0.005ms returns 0 +T42A8 004:268.683 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:268.688 - 0.005ms returns 0 +T42A8 004:268.695 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:268.705 - 0.010ms returns 0 +T42A8 004:268.715 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:268.721 - 0.005ms returns 0 +T42A8 004:268.728 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:268.735 - 0.007ms returns 0x000000AD +T42A8 004:268.742 JLINK_Go() +T42A8 004:268.755 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:274.635 - 5.890ms +T42A8 004:274.669 JLINK_IsHalted() +T42A8 004:275.253 - 0.584ms returns FALSE +T42A8 004:275.267 JLINK_HasError() +T42A8 004:280.949 JLINK_IsHalted() +T42A8 004:286.891 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:287.451 - 6.501ms returns TRUE +T42A8 004:287.466 JLINK_ReadReg(R15 (PC)) +T42A8 004:287.475 - 0.008ms returns 0x20003000 +T42A8 004:287.481 JLINK_ClrBPEx(BPHandle = 0x000000AD) +T42A8 004:287.487 - 0.005ms returns 0x00 +T42A8 004:287.493 JLINK_ReadReg(R0) +T42A8 004:287.498 - 0.005ms returns 0x00000000 +T42A8 004:287.993 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:288.001 Data: 80 3A 81 18 77 68 0F 64 11 19 80 31 0B 70 61 46 ... +T42A8 004:288.013 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:291.857 - 3.864ms returns 0x100 +T42A8 004:291.873 JLINK_HasError() +T42A8 004:291.887 JLINK_WriteReg(R0, 0x1800C600) +T42A8 004:291.894 - 0.008ms returns 0 +T42A8 004:291.901 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:291.906 - 0.005ms returns 0 +T42A8 004:291.935 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:291.940 - 0.005ms returns 0 +T42A8 004:291.946 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:291.951 - 0.004ms returns 0 +T42A8 004:291.957 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:291.974 - 0.017ms returns 0 +T42A8 004:291.980 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:291.985 - 0.004ms returns 0 +T42A8 004:291.990 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:291.995 - 0.004ms returns 0 +T42A8 004:292.001 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:292.005 - 0.004ms returns 0 +T42A8 004:292.011 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:292.016 - 0.004ms returns 0 +T42A8 004:292.021 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:292.026 - 0.004ms returns 0 +T42A8 004:292.032 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:292.037 - 0.004ms returns 0 +T42A8 004:292.042 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:292.047 - 0.004ms returns 0 +T42A8 004:292.053 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:292.057 - 0.004ms returns 0 +T42A8 004:292.063 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:292.068 - 0.005ms returns 0 +T42A8 004:292.074 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:292.078 - 0.004ms returns 0 +T42A8 004:292.084 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:292.089 - 0.005ms returns 0 +T42A8 004:292.095 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:292.099 - 0.004ms returns 0 +T42A8 004:292.105 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:292.110 - 0.004ms returns 0 +T42A8 004:292.116 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:292.120 - 0.004ms returns 0 +T42A8 004:292.126 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:292.131 - 0.004ms returns 0 +T42A8 004:292.137 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:292.143 - 0.006ms returns 0x000000AE +T42A8 004:292.149 JLINK_Go() +T42A8 004:292.159 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:297.950 - 5.800ms +T42A8 004:297.966 JLINK_IsHalted() +T42A8 004:298.525 - 0.558ms returns FALSE +T42A8 004:298.536 JLINK_HasError() +T42A8 004:299.899 JLINK_IsHalted() +T42A8 004:305.764 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:306.289 - 6.389ms returns TRUE +T42A8 004:306.303 JLINK_ReadReg(R15 (PC)) +T42A8 004:306.310 - 0.007ms returns 0x20003000 +T42A8 004:306.317 JLINK_ClrBPEx(BPHandle = 0x000000AE) +T42A8 004:306.323 - 0.005ms returns 0x00 +T42A8 004:306.329 JLINK_ReadReg(R0) +T42A8 004:306.348 - 0.018ms returns 0x00000000 +T42A8 004:307.086 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:307.110 Data: 02 D0 06 E0 78 68 FA E7 10 99 00 29 01 D0 11 98 ... +T42A8 004:307.127 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:311.002 - 3.915ms returns 0x100 +T42A8 004:311.019 JLINK_HasError() +T42A8 004:311.027 JLINK_WriteReg(R0, 0x1800C700) +T42A8 004:311.035 - 0.008ms returns 0 +T42A8 004:311.045 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:311.051 - 0.006ms returns 0 +T42A8 004:311.058 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:311.063 - 0.005ms returns 0 +T42A8 004:311.069 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:311.074 - 0.004ms returns 0 +T42A8 004:311.080 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:311.085 - 0.004ms returns 0 +T42A8 004:311.091 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:311.095 - 0.004ms returns 0 +T42A8 004:311.101 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:311.106 - 0.004ms returns 0 +T42A8 004:311.112 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:311.117 - 0.004ms returns 0 +T42A8 004:311.123 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:311.128 - 0.004ms returns 0 +T42A8 004:311.134 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:311.139 - 0.004ms returns 0 +T42A8 004:311.145 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:311.151 - 0.004ms returns 0 +T42A8 004:311.157 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:311.161 - 0.004ms returns 0 +T42A8 004:311.167 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:311.172 - 0.004ms returns 0 +T42A8 004:311.178 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:311.184 - 0.005ms returns 0 +T42A8 004:311.190 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:311.195 - 0.004ms returns 0 +T42A8 004:311.201 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:311.205 - 0.005ms returns 0 +T42A8 004:311.211 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:311.217 - 0.005ms returns 0 +T42A8 004:311.222 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:311.227 - 0.004ms returns 0 +T42A8 004:311.233 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:311.238 - 0.004ms returns 0 +T42A8 004:311.244 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:311.249 - 0.004ms returns 0 +T42A8 004:311.255 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:311.261 - 0.006ms returns 0x000000AF +T42A8 004:311.267 JLINK_Go() +T42A8 004:311.277 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:317.113 - 5.845ms +T42A8 004:317.129 JLINK_IsHalted() +T42A8 004:317.724 - 0.594ms returns FALSE +T42A8 004:317.737 JLINK_HasError() +T42A8 004:319.844 JLINK_IsHalted() +T42A8 004:325.678 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:326.220 - 6.375ms returns TRUE +T42A8 004:326.233 JLINK_ReadReg(R15 (PC)) +T42A8 004:326.240 - 0.007ms returns 0x20003000 +T42A8 004:326.246 JLINK_ClrBPEx(BPHandle = 0x000000AF) +T42A8 004:326.252 - 0.005ms returns 0x00 +T42A8 004:326.258 JLINK_ReadReg(R0) +T42A8 004:326.263 - 0.005ms returns 0x00000000 +T42A8 004:326.678 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:326.686 Data: 04 99 04 F0 F9 FE CF 19 07 91 7F 1E 04 99 01 98 ... +T42A8 004:326.698 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:330.549 - 3.869ms returns 0x100 +T42A8 004:330.566 JLINK_HasError() +T42A8 004:330.574 JLINK_WriteReg(R0, 0x1800C800) +T42A8 004:330.583 - 0.009ms returns 0 +T42A8 004:330.589 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:330.595 - 0.005ms returns 0 +T42A8 004:330.601 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:330.606 - 0.005ms returns 0 +T42A8 004:330.612 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:330.617 - 0.004ms returns 0 +T42A8 004:330.623 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:330.627 - 0.004ms returns 0 +T42A8 004:330.633 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:330.638 - 0.004ms returns 0 +T42A8 004:330.645 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:330.649 - 0.004ms returns 0 +T42A8 004:330.655 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:330.660 - 0.004ms returns 0 +T42A8 004:330.666 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:330.671 - 0.004ms returns 0 +T42A8 004:330.677 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:330.682 - 0.004ms returns 0 +T42A8 004:330.688 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:330.693 - 0.004ms returns 0 +T42A8 004:330.699 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:330.703 - 0.004ms returns 0 +T42A8 004:330.709 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:330.714 - 0.004ms returns 0 +T42A8 004:330.720 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:330.725 - 0.005ms returns 0 +T42A8 004:330.732 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:330.737 - 0.004ms returns 0 +T42A8 004:330.746 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:330.753 - 0.006ms returns 0 +T42A8 004:330.759 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:330.763 - 0.005ms returns 0 +T42A8 004:330.769 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:330.779 - 0.010ms returns 0 +T42A8 004:330.785 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:330.791 - 0.004ms returns 0 +T42A8 004:330.797 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:330.822 - 0.025ms returns 0 +T42A8 004:330.829 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:330.848 - 0.019ms returns 0x000000B0 +T42A8 004:330.854 JLINK_Go() +T42A8 004:330.866 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:336.732 - 5.877ms +T42A8 004:336.750 JLINK_IsHalted() +T42A8 004:337.328 - 0.577ms returns FALSE +T42A8 004:337.339 JLINK_HasError() +T42A8 004:338.799 JLINK_IsHalted() +T42A8 004:344.649 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:345.217 - 6.417ms returns TRUE +T42A8 004:345.231 JLINK_ReadReg(R15 (PC)) +T42A8 004:345.238 - 0.007ms returns 0x20003000 +T42A8 004:345.245 JLINK_ClrBPEx(BPHandle = 0x000000B0) +T42A8 004:345.250 - 0.005ms returns 0x00 +T42A8 004:345.256 JLINK_ReadReg(R0) +T42A8 004:345.261 - 0.005ms returns 0x00000000 +T42A8 004:345.686 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:345.695 Data: 39 46 30 46 04 F0 78 FE 00 29 13 D1 39 46 02 98 ... +T42A8 004:345.707 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:349.527 - 3.840ms returns 0x100 +T42A8 004:349.540 JLINK_HasError() +T42A8 004:349.547 JLINK_WriteReg(R0, 0x1800C900) +T42A8 004:349.553 - 0.006ms returns 0 +T42A8 004:349.560 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:349.565 - 0.005ms returns 0 +T42A8 004:349.571 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:349.576 - 0.004ms returns 0 +T42A8 004:349.582 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:349.587 - 0.004ms returns 0 +T42A8 004:349.593 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:349.597 - 0.004ms returns 0 +T42A8 004:349.603 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:349.609 - 0.004ms returns 0 +T42A8 004:349.614 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:349.619 - 0.004ms returns 0 +T42A8 004:349.625 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:349.630 - 0.004ms returns 0 +T42A8 004:349.636 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:349.641 - 0.004ms returns 0 +T42A8 004:349.647 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:349.651 - 0.004ms returns 0 +T42A8 004:349.657 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:349.662 - 0.004ms returns 0 +T42A8 004:349.668 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:349.673 - 0.004ms returns 0 +T42A8 004:349.679 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:349.684 - 0.004ms returns 0 +T42A8 004:349.690 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:349.695 - 0.005ms returns 0 +T42A8 004:349.701 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:349.706 - 0.004ms returns 0 +T42A8 004:349.712 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:349.717 - 0.004ms returns 0 +T42A8 004:349.728 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:349.733 - 0.005ms returns 0 +T42A8 004:349.739 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:349.744 - 0.004ms returns 0 +T42A8 004:349.750 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:349.778 - 0.027ms returns 0 +T42A8 004:349.784 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:349.789 - 0.004ms returns 0 +T42A8 004:349.796 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:349.801 - 0.006ms returns 0x000000B1 +T42A8 004:349.821 JLINK_Go() +T42A8 004:349.830 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:356.001 - 6.179ms +T42A8 004:356.042 JLINK_IsHalted() +T42A8 004:356.803 - 0.760ms returns FALSE +T42A8 004:356.830 JLINK_HasError() +T42A8 004:358.967 JLINK_IsHalted() +T42A8 004:365.095 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:365.890 - 6.923ms returns TRUE +T42A8 004:365.914 JLINK_ReadReg(R15 (PC)) +T42A8 004:365.923 - 0.008ms returns 0x20003000 +T42A8 004:365.929 JLINK_ClrBPEx(BPHandle = 0x000000B1) +T42A8 004:365.935 - 0.005ms returns 0x00 +T42A8 004:365.941 JLINK_ReadReg(R0) +T42A8 004:365.948 - 0.006ms returns 0x00000000 +T42A8 004:366.403 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:366.418 Data: 04 F0 FA FD 70 43 05 46 1D E0 A6 7C 00 2E 1A D0 ... +T42A8 004:366.435 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:370.480 - 4.076ms returns 0x100 +T42A8 004:370.497 JLINK_HasError() +T42A8 004:370.505 JLINK_WriteReg(R0, 0x1800CA00) +T42A8 004:370.513 - 0.007ms returns 0 +T42A8 004:370.519 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:370.525 - 0.005ms returns 0 +T42A8 004:370.557 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:370.565 - 0.008ms returns 0 +T42A8 004:370.572 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:370.577 - 0.005ms returns 0 +T42A8 004:370.583 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:370.588 - 0.005ms returns 0 +T42A8 004:370.594 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:370.599 - 0.005ms returns 0 +T42A8 004:370.606 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:370.611 - 0.005ms returns 0 +T42A8 004:370.617 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:370.622 - 0.005ms returns 0 +T42A8 004:370.628 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:370.633 - 0.005ms returns 0 +T42A8 004:370.639 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:370.644 - 0.005ms returns 0 +T42A8 004:370.650 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:370.655 - 0.005ms returns 0 +T42A8 004:370.661 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:370.671 - 0.009ms returns 0 +T42A8 004:370.678 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:370.684 - 0.005ms returns 0 +T42A8 004:370.690 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:370.695 - 0.005ms returns 0 +T42A8 004:370.701 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:370.706 - 0.004ms returns 0 +T42A8 004:370.712 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:370.717 - 0.005ms returns 0 +T42A8 004:370.723 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:370.728 - 0.004ms returns 0 +T42A8 004:370.733 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:370.738 - 0.004ms returns 0 +T42A8 004:370.744 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:370.749 - 0.004ms returns 0 +T42A8 004:370.755 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:370.760 - 0.004ms returns 0 +T42A8 004:370.766 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:370.772 - 0.006ms returns 0x000000B2 +T42A8 004:370.778 JLINK_Go() +T42A8 004:370.789 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:376.789 - 6.010ms +T42A8 004:376.801 JLINK_IsHalted() +T42A8 004:377.467 - 0.665ms returns FALSE +T42A8 004:377.477 JLINK_HasError() +T42A8 004:382.657 JLINK_IsHalted() +T42A8 004:388.588 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:389.173 - 6.515ms returns TRUE +T42A8 004:389.235 JLINK_ReadReg(R15 (PC)) +T42A8 004:389.243 - 0.008ms returns 0x20003000 +T42A8 004:389.250 JLINK_ClrBPEx(BPHandle = 0x000000B2) +T42A8 004:389.256 - 0.005ms returns 0x00 +T42A8 004:389.263 JLINK_ReadReg(R0) +T42A8 004:389.268 - 0.005ms returns 0x00000000 +T42A8 004:389.783 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:389.796 Data: 09 1A 09 01 01 23 09 09 DB 06 99 42 00 D3 10 60 ... +T42A8 004:389.813 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:393.917 - 4.133ms returns 0x100 +T42A8 004:393.941 JLINK_HasError() +T42A8 004:393.950 JLINK_WriteReg(R0, 0x1800CB00) +T42A8 004:393.959 - 0.008ms returns 0 +T42A8 004:393.965 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:393.970 - 0.005ms returns 0 +T42A8 004:393.977 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:393.982 - 0.005ms returns 0 +T42A8 004:393.988 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:393.993 - 0.005ms returns 0 +T42A8 004:393.999 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:394.005 - 0.005ms returns 0 +T42A8 004:394.010 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:394.015 - 0.005ms returns 0 +T42A8 004:394.021 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:394.027 - 0.005ms returns 0 +T42A8 004:394.033 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:394.038 - 0.004ms returns 0 +T42A8 004:394.044 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:394.049 - 0.005ms returns 0 +T42A8 004:394.055 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:394.060 - 0.004ms returns 0 +T42A8 004:394.066 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:394.071 - 0.005ms returns 0 +T42A8 004:394.077 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:394.085 - 0.008ms returns 0 +T42A8 004:394.094 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:394.099 - 0.005ms returns 0 +T42A8 004:394.105 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:394.111 - 0.005ms returns 0 +T42A8 004:394.117 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:394.122 - 0.005ms returns 0 +T42A8 004:394.128 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:394.133 - 0.005ms returns 0 +T42A8 004:394.139 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:394.144 - 0.005ms returns 0 +T42A8 004:394.150 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:394.155 - 0.005ms returns 0 +T42A8 004:394.161 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:394.166 - 0.004ms returns 0 +T42A8 004:394.173 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:394.178 - 0.005ms returns 0 +T42A8 004:394.185 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:394.191 - 0.006ms returns 0x000000B3 +T42A8 004:394.197 JLINK_Go() +T42A8 004:394.208 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:400.407 - 6.209ms +T42A8 004:400.433 JLINK_IsHalted() +T42A8 004:401.136 - 0.703ms returns FALSE +T42A8 004:401.153 JLINK_HasError() +T42A8 004:402.709 JLINK_IsHalted() +T42A8 004:408.773 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:409.426 - 6.716ms returns TRUE +T42A8 004:409.437 JLINK_ReadReg(R15 (PC)) +T42A8 004:409.445 - 0.007ms returns 0x20003000 +T42A8 004:409.451 JLINK_ClrBPEx(BPHandle = 0x000000B3) +T42A8 004:409.457 - 0.005ms returns 0x00 +T42A8 004:409.463 JLINK_ReadReg(R0) +T42A8 004:409.469 - 0.005ms returns 0x00000000 +T42A8 004:409.899 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:409.907 Data: 0A 46 01 21 00 90 FF F7 C5 FF 02 90 01 28 7A D1 ... +T42A8 004:409.918 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:413.734 - 3.835ms returns 0x100 +T42A8 004:413.745 JLINK_HasError() +T42A8 004:413.752 JLINK_WriteReg(R0, 0x1800CC00) +T42A8 004:413.758 - 0.006ms returns 0 +T42A8 004:413.764 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:413.769 - 0.005ms returns 0 +T42A8 004:413.775 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:413.781 - 0.005ms returns 0 +T42A8 004:413.787 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:413.792 - 0.004ms returns 0 +T42A8 004:413.798 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:413.803 - 0.005ms returns 0 +T42A8 004:413.809 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:413.814 - 0.005ms returns 0 +T42A8 004:413.820 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:413.825 - 0.005ms returns 0 +T42A8 004:413.831 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:413.836 - 0.005ms returns 0 +T42A8 004:413.842 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:413.847 - 0.005ms returns 0 +T42A8 004:413.853 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:413.858 - 0.005ms returns 0 +T42A8 004:413.864 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:413.870 - 0.005ms returns 0 +T42A8 004:413.876 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:413.881 - 0.005ms returns 0 +T42A8 004:413.887 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:413.892 - 0.004ms returns 0 +T42A8 004:413.898 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:413.904 - 0.005ms returns 0 +T42A8 004:413.910 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:413.915 - 0.005ms returns 0 +T42A8 004:413.921 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:413.926 - 0.005ms returns 0 +T42A8 004:413.933 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:413.937 - 0.005ms returns 0 +T42A8 004:413.943 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:413.949 - 0.005ms returns 0 +T42A8 004:413.955 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:413.959 - 0.005ms returns 0 +T42A8 004:413.965 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:413.971 - 0.005ms returns 0 +T42A8 004:413.977 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:413.983 - 0.005ms returns 0x000000B4 +T42A8 004:413.989 JLINK_Go() +T42A8 004:413.998 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:420.206 - 6.217ms +T42A8 004:420.216 JLINK_IsHalted() +T42A8 004:420.943 - 0.726ms returns FALSE +T42A8 004:420.953 JLINK_HasError() +T42A8 004:423.663 JLINK_IsHalted() +T42A8 004:429.731 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:430.257 - 6.593ms returns TRUE +T42A8 004:430.272 JLINK_ReadReg(R15 (PC)) +T42A8 004:430.281 - 0.008ms returns 0x20003000 +T42A8 004:430.287 JLINK_ClrBPEx(BPHandle = 0x000000B4) +T42A8 004:430.293 - 0.005ms returns 0x00 +T42A8 004:430.299 JLINK_ReadReg(R0) +T42A8 004:430.304 - 0.005ms returns 0x00000000 +T42A8 004:430.726 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:430.734 Data: E0 88 88 80 32 E0 C1 E0 A1 88 E0 88 81 42 01 D9 ... +T42A8 004:430.745 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:434.725 - 3.999ms returns 0x100 +T42A8 004:434.736 JLINK_HasError() +T42A8 004:434.755 JLINK_WriteReg(R0, 0x1800CD00) +T42A8 004:434.761 - 0.006ms returns 0 +T42A8 004:434.768 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:434.773 - 0.004ms returns 0 +T42A8 004:434.778 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:434.783 - 0.004ms returns 0 +T42A8 004:434.789 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:434.793 - 0.004ms returns 0 +T42A8 004:434.799 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:434.804 - 0.004ms returns 0 +T42A8 004:434.809 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:434.814 - 0.004ms returns 0 +T42A8 004:434.820 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:434.825 - 0.004ms returns 0 +T42A8 004:434.830 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:434.835 - 0.004ms returns 0 +T42A8 004:434.841 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:434.845 - 0.004ms returns 0 +T42A8 004:434.851 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:434.856 - 0.004ms returns 0 +T42A8 004:434.861 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:434.866 - 0.004ms returns 0 +T42A8 004:434.872 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:434.876 - 0.004ms returns 0 +T42A8 004:434.882 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:434.887 - 0.004ms returns 0 +T42A8 004:434.893 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:434.897 - 0.005ms returns 0 +T42A8 004:434.903 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:434.908 - 0.004ms returns 0 +T42A8 004:434.914 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:434.919 - 0.004ms returns 0 +T42A8 004:434.925 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:434.929 - 0.004ms returns 0 +T42A8 004:434.935 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:434.939 - 0.004ms returns 0 +T42A8 004:434.945 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:434.950 - 0.004ms returns 0 +T42A8 004:434.956 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:434.960 - 0.004ms returns 0 +T42A8 004:434.967 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:434.972 - 0.005ms returns 0x000000B5 +T42A8 004:434.978 JLINK_Go() +T42A8 004:434.986 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:441.195 - 6.216ms +T42A8 004:441.208 JLINK_IsHalted() +T42A8 004:441.946 - 0.738ms returns FALSE +T42A8 004:441.957 JLINK_HasError() +T42A8 004:443.641 JLINK_IsHalted() +T42A8 004:449.668 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:450.317 - 6.675ms returns TRUE +T42A8 004:450.328 JLINK_ReadReg(R15 (PC)) +T42A8 004:450.335 - 0.006ms returns 0x20003000 +T42A8 004:450.341 JLINK_ClrBPEx(BPHandle = 0x000000B5) +T42A8 004:450.347 - 0.005ms returns 0x00 +T42A8 004:450.353 JLINK_ReadReg(R0) +T42A8 004:450.359 - 0.005ms returns 0x00000000 +T42A8 004:450.750 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:450.758 Data: 40 1F 86 42 00 D2 30 46 87 B2 B8 1D 82 B2 16 21 ... +T42A8 004:450.769 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:454.665 - 3.915ms returns 0x100 +T42A8 004:454.675 JLINK_HasError() +T42A8 004:454.683 JLINK_WriteReg(R0, 0x1800CE00) +T42A8 004:454.689 - 0.006ms returns 0 +T42A8 004:454.695 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:454.701 - 0.005ms returns 0 +T42A8 004:454.707 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:454.713 - 0.005ms returns 0 +T42A8 004:454.719 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:454.724 - 0.005ms returns 0 +T42A8 004:454.731 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:454.736 - 0.005ms returns 0 +T42A8 004:454.742 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:454.747 - 0.005ms returns 0 +T42A8 004:454.754 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:454.759 - 0.005ms returns 0 +T42A8 004:454.765 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:454.771 - 0.005ms returns 0 +T42A8 004:454.782 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:454.787 - 0.005ms returns 0 +T42A8 004:454.793 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:454.812 - 0.018ms returns 0 +T42A8 004:454.819 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:454.824 - 0.005ms returns 0 +T42A8 004:454.831 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:454.837 - 0.005ms returns 0 +T42A8 004:454.843 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:454.849 - 0.005ms returns 0 +T42A8 004:454.855 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:454.861 - 0.006ms returns 0 +T42A8 004:454.868 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:454.873 - 0.005ms returns 0 +T42A8 004:454.880 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:454.886 - 0.005ms returns 0 +T42A8 004:454.893 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:454.898 - 0.005ms returns 0 +T42A8 004:454.905 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:454.910 - 0.005ms returns 0 +T42A8 004:454.917 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:454.922 - 0.005ms returns 0 +T42A8 004:454.929 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:454.934 - 0.005ms returns 0 +T42A8 004:454.942 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:454.948 - 0.006ms returns 0x000000B6 +T42A8 004:454.955 JLINK_Go() +T42A8 004:454.964 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:461.153 - 6.197ms +T42A8 004:461.165 JLINK_IsHalted() +T42A8 004:461.705 - 0.539ms returns FALSE +T42A8 004:461.717 JLINK_HasError() +T42A8 004:464.457 JLINK_IsHalted() +T42A8 004:470.677 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:471.448 - 6.991ms returns TRUE +T42A8 004:471.478 JLINK_ReadReg(R15 (PC)) +T42A8 004:471.488 - 0.010ms returns 0x20003000 +T42A8 004:471.496 JLINK_ClrBPEx(BPHandle = 0x000000B6) +T42A8 004:471.504 - 0.008ms returns 0x00 +T42A8 004:471.511 JLINK_ReadReg(R0) +T42A8 004:471.517 - 0.006ms returns 0x00000000 +T42A8 004:472.049 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:472.063 Data: F8 B5 15 46 0C 46 00 27 10 46 06 F0 5C FC 10 28 ... +T42A8 004:472.080 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:476.219 - 4.168ms returns 0x100 +T42A8 004:476.244 JLINK_HasError() +T42A8 004:476.254 JLINK_WriteReg(R0, 0x1800CF00) +T42A8 004:476.263 - 0.009ms returns 0 +T42A8 004:476.271 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:476.277 - 0.006ms returns 0 +T42A8 004:476.284 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:476.290 - 0.005ms returns 0 +T42A8 004:476.297 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:476.302 - 0.005ms returns 0 +T42A8 004:476.309 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:476.315 - 0.005ms returns 0 +T42A8 004:476.322 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:476.328 - 0.005ms returns 0 +T42A8 004:476.335 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:476.341 - 0.005ms returns 0 +T42A8 004:476.347 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:476.353 - 0.005ms returns 0 +T42A8 004:476.360 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:476.366 - 0.005ms returns 0 +T42A8 004:476.373 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:476.379 - 0.005ms returns 0 +T42A8 004:476.394 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:476.400 - 0.006ms returns 0 +T42A8 004:476.407 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:476.413 - 0.005ms returns 0 +T42A8 004:476.420 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:476.425 - 0.005ms returns 0 +T42A8 004:476.433 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:476.439 - 0.006ms returns 0 +T42A8 004:476.447 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:476.452 - 0.005ms returns 0 +T42A8 004:476.459 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:476.465 - 0.005ms returns 0 +T42A8 004:476.472 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:476.478 - 0.005ms returns 0 +T42A8 004:476.485 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:476.491 - 0.005ms returns 0 +T42A8 004:476.497 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:476.503 - 0.005ms returns 0 +T42A8 004:476.510 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:476.516 - 0.005ms returns 0 +T42A8 004:476.523 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:476.531 - 0.007ms returns 0x000000B7 +T42A8 004:476.538 JLINK_Go() +T42A8 004:476.555 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:482.689 - 6.149ms +T42A8 004:482.714 JLINK_IsHalted() +T42A8 004:483.474 - 0.758ms returns FALSE +T42A8 004:483.507 JLINK_HasError() +T42A8 004:488.603 JLINK_IsHalted() +T42A8 004:494.813 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:495.470 - 6.867ms returns TRUE +T42A8 004:495.483 JLINK_ReadReg(R15 (PC)) +T42A8 004:495.492 - 0.008ms returns 0x20003000 +T42A8 004:495.499 JLINK_ClrBPEx(BPHandle = 0x000000B7) +T42A8 004:495.506 - 0.006ms returns 0x00 +T42A8 004:495.513 JLINK_ReadReg(R0) +T42A8 004:495.519 - 0.005ms returns 0x00000000 +T42A8 004:495.991 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:496.001 Data: 17 46 10 46 06 F0 DF FB 3D 0A 10 28 21 D0 2F 4E ... +T42A8 004:496.013 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:499.809 - 3.818ms returns 0x100 +T42A8 004:499.822 JLINK_HasError() +T42A8 004:499.829 JLINK_WriteReg(R0, 0x1800D000) +T42A8 004:499.837 - 0.007ms returns 0 +T42A8 004:499.844 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:499.850 - 0.005ms returns 0 +T42A8 004:499.857 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:499.863 - 0.005ms returns 0 +T42A8 004:499.869 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:499.875 - 0.005ms returns 0 +T42A8 004:499.883 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:499.888 - 0.005ms returns 0 +T42A8 004:499.895 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:499.901 - 0.005ms returns 0 +T42A8 004:499.908 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:499.913 - 0.005ms returns 0 +T42A8 004:499.921 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:499.926 - 0.005ms returns 0 +T42A8 004:499.933 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:499.939 - 0.005ms returns 0 +T42A8 004:499.946 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:499.951 - 0.005ms returns 0 +T42A8 004:499.958 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:499.964 - 0.005ms returns 0 +T42A8 004:499.971 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:499.977 - 0.005ms returns 0 +T42A8 004:499.984 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:499.989 - 0.005ms returns 0 +T42A8 004:499.997 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:500.002 - 0.006ms returns 0 +T42A8 004:500.009 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:500.015 - 0.005ms returns 0 +T42A8 004:500.022 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:500.028 - 0.005ms returns 0 +T42A8 004:500.035 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:500.041 - 0.006ms returns 0 +T42A8 004:500.048 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:500.053 - 0.005ms returns 0 +T42A8 004:500.061 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:500.066 - 0.005ms returns 0 +T42A8 004:500.073 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:500.079 - 0.005ms returns 0 +T42A8 004:500.086 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:500.093 - 0.006ms returns 0x000000B8 +T42A8 004:500.100 JLINK_Go() +T42A8 004:500.110 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:506.009 - 5.908ms +T42A8 004:506.022 JLINK_IsHalted() +T42A8 004:506.594 - 0.571ms returns FALSE +T42A8 004:506.607 JLINK_HasError() +T42A8 004:508.317 JLINK_IsHalted() +T42A8 004:514.327 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:514.935 - 6.618ms returns TRUE +T42A8 004:514.951 JLINK_ReadReg(R15 (PC)) +T42A8 004:514.960 - 0.008ms returns 0x20003000 +T42A8 004:514.967 JLINK_ClrBPEx(BPHandle = 0x000000B8) +T42A8 004:514.974 - 0.006ms returns 0x00 +T42A8 004:515.038 JLINK_ReadReg(R0) +T42A8 004:515.049 - 0.011ms returns 0x00000000 +T42A8 004:515.541 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:515.550 Data: 49 1C C9 B2 04 29 EC D3 30 BD 10 B5 F9 F7 4D FD ... +T42A8 004:515.563 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:519.442 - 3.901ms returns 0x100 +T42A8 004:519.454 JLINK_HasError() +T42A8 004:519.462 JLINK_WriteReg(R0, 0x1800D100) +T42A8 004:519.469 - 0.007ms returns 0 +T42A8 004:519.477 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:519.482 - 0.005ms returns 0 +T42A8 004:519.489 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:519.495 - 0.005ms returns 0 +T42A8 004:519.502 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:519.508 - 0.005ms returns 0 +T42A8 004:519.515 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:519.585 - 0.069ms returns 0 +T42A8 004:519.593 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:519.599 - 0.005ms returns 0 +T42A8 004:519.606 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:519.611 - 0.005ms returns 0 +T42A8 004:519.618 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:519.624 - 0.005ms returns 0 +T42A8 004:519.631 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:519.636 - 0.005ms returns 0 +T42A8 004:519.644 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:519.649 - 0.005ms returns 0 +T42A8 004:519.656 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:519.677 - 0.021ms returns 0 +T42A8 004:519.685 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:519.690 - 0.005ms returns 0 +T42A8 004:519.697 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:519.702 - 0.005ms returns 0 +T42A8 004:519.709 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:519.715 - 0.006ms returns 0 +T42A8 004:519.722 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:519.727 - 0.005ms returns 0 +T42A8 004:519.734 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:519.740 - 0.005ms returns 0 +T42A8 004:519.746 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:519.752 - 0.005ms returns 0 +T42A8 004:519.759 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:519.764 - 0.005ms returns 0 +T42A8 004:519.771 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:519.777 - 0.005ms returns 0 +T42A8 004:519.783 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:519.789 - 0.005ms returns 0 +T42A8 004:519.796 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:519.802 - 0.006ms returns 0x000000B9 +T42A8 004:519.809 JLINK_Go() +T42A8 004:519.819 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:525.951 - 6.141ms +T42A8 004:525.963 JLINK_IsHalted() +T42A8 004:526.502 - 0.539ms returns FALSE +T42A8 004:526.513 JLINK_HasError() +T42A8 004:528.290 JLINK_IsHalted() +T42A8 004:534.313 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:534.818 - 6.527ms returns TRUE +T42A8 004:534.830 JLINK_ReadReg(R15 (PC)) +T42A8 004:534.838 - 0.007ms returns 0x20003000 +T42A8 004:534.844 JLINK_ClrBPEx(BPHandle = 0x000000B9) +T42A8 004:534.850 - 0.005ms returns 0x00 +T42A8 004:534.856 JLINK_ReadReg(R0) +T42A8 004:534.861 - 0.005ms returns 0x00000000 +T42A8 004:535.308 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:535.329 Data: 60 7B 00 28 05 D0 30 46 03 F0 27 FC 01 20 E0 73 ... +T42A8 004:535.340 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:539.227 - 3.918ms returns 0x100 +T42A8 004:539.237 JLINK_HasError() +T42A8 004:539.262 JLINK_WriteReg(R0, 0x1800D200) +T42A8 004:539.281 - 0.019ms returns 0 +T42A8 004:539.287 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:539.292 - 0.004ms returns 0 +T42A8 004:539.297 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:539.302 - 0.004ms returns 0 +T42A8 004:539.308 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:539.313 - 0.004ms returns 0 +T42A8 004:539.318 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:539.323 - 0.004ms returns 0 +T42A8 004:539.329 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:539.333 - 0.004ms returns 0 +T42A8 004:539.339 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:539.344 - 0.004ms returns 0 +T42A8 004:539.349 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:539.354 - 0.004ms returns 0 +T42A8 004:539.360 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:539.365 - 0.004ms returns 0 +T42A8 004:539.370 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:539.375 - 0.004ms returns 0 +T42A8 004:539.381 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:539.385 - 0.004ms returns 0 +T42A8 004:539.391 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:539.395 - 0.004ms returns 0 +T42A8 004:539.401 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:539.406 - 0.004ms returns 0 +T42A8 004:539.412 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:539.417 - 0.005ms returns 0 +T42A8 004:539.422 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:539.427 - 0.004ms returns 0 +T42A8 004:539.433 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:539.438 - 0.004ms returns 0 +T42A8 004:539.443 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:539.448 - 0.004ms returns 0 +T42A8 004:539.454 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:539.459 - 0.004ms returns 0 +T42A8 004:539.464 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:539.513 - 0.049ms returns 0 +T42A8 004:539.519 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:539.524 - 0.004ms returns 0 +T42A8 004:539.531 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:539.536 - 0.005ms returns 0x000000BA +T42A8 004:539.542 JLINK_Go() +T42A8 004:539.551 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:545.355 - 5.812ms +T42A8 004:545.383 JLINK_IsHalted() +T42A8 004:546.007 - 0.624ms returns FALSE +T42A8 004:546.018 JLINK_HasError() +T42A8 004:547.349 JLINK_IsHalted() +T42A8 004:553.511 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:554.320 - 6.970ms returns TRUE +T42A8 004:554.341 JLINK_ReadReg(R15 (PC)) +T42A8 004:554.349 - 0.008ms returns 0x20003000 +T42A8 004:554.357 JLINK_ClrBPEx(BPHandle = 0x000000BA) +T42A8 004:554.362 - 0.005ms returns 0x00 +T42A8 004:554.368 JLINK_ReadReg(R0) +T42A8 004:554.373 - 0.004ms returns 0x00000000 +T42A8 004:554.970 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:554.980 Data: 53 FA 05 04 25 31 3A 4A 57 00 68 78 29 46 04 28 ... +T42A8 004:554.993 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:559.058 - 4.087ms returns 0x100 +T42A8 004:559.082 JLINK_HasError() +T42A8 004:559.090 JLINK_WriteReg(R0, 0x1800D300) +T42A8 004:559.099 - 0.008ms returns 0 +T42A8 004:559.105 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:559.110 - 0.005ms returns 0 +T42A8 004:559.116 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:559.121 - 0.005ms returns 0 +T42A8 004:559.127 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:559.132 - 0.004ms returns 0 +T42A8 004:559.138 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:559.143 - 0.004ms returns 0 +T42A8 004:559.149 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:559.154 - 0.004ms returns 0 +T42A8 004:559.160 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:559.176 - 0.016ms returns 0 +T42A8 004:559.183 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:559.188 - 0.004ms returns 0 +T42A8 004:559.194 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:559.199 - 0.004ms returns 0 +T42A8 004:559.205 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:559.209 - 0.004ms returns 0 +T42A8 004:559.215 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:559.220 - 0.004ms returns 0 +T42A8 004:559.226 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:559.231 - 0.004ms returns 0 +T42A8 004:559.239 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:559.244 - 0.004ms returns 0 +T42A8 004:559.250 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:559.263 - 0.013ms returns 0 +T42A8 004:559.269 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:559.273 - 0.005ms returns 0 +T42A8 004:559.279 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:559.284 - 0.004ms returns 0 +T42A8 004:559.290 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:559.295 - 0.004ms returns 0 +T42A8 004:559.300 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:559.305 - 0.004ms returns 0 +T42A8 004:559.311 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:559.315 - 0.004ms returns 0 +T42A8 004:559.321 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:559.326 - 0.004ms returns 0 +T42A8 004:559.332 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:559.338 - 0.006ms returns 0x000000BB +T42A8 004:559.344 JLINK_Go() +T42A8 004:559.355 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:565.364 - 6.018ms +T42A8 004:565.385 JLINK_IsHalted() +T42A8 004:566.036 - 0.650ms returns FALSE +T42A8 004:566.048 JLINK_HasError() +T42A8 004:567.181 JLINK_IsHalted() +T42A8 004:573.305 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:573.892 - 6.710ms returns TRUE +T42A8 004:573.917 JLINK_ReadReg(R15 (PC)) +T42A8 004:573.927 - 0.011ms returns 0x20003000 +T42A8 004:573.935 JLINK_ClrBPEx(BPHandle = 0x000000BB) +T42A8 004:573.942 - 0.006ms returns 0x00 +T42A8 004:573.997 JLINK_ReadReg(R0) +T42A8 004:574.012 - 0.015ms returns 0x00000000 +T42A8 004:574.549 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:574.567 Data: 69 78 04 9A 02 F0 F2 FB 04 46 E5 E7 69 78 04 9A ... +T42A8 004:574.587 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:578.545 - 3.997ms returns 0x100 +T42A8 004:578.558 JLINK_HasError() +T42A8 004:578.567 JLINK_WriteReg(R0, 0x1800D400) +T42A8 004:578.578 - 0.011ms returns 0 +T42A8 004:578.585 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:578.591 - 0.006ms returns 0 +T42A8 004:578.598 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:578.604 - 0.005ms returns 0 +T42A8 004:578.611 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:578.617 - 0.005ms returns 0 +T42A8 004:578.624 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:578.629 - 0.005ms returns 0 +T42A8 004:578.637 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:578.642 - 0.005ms returns 0 +T42A8 004:578.649 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:578.655 - 0.005ms returns 0 +T42A8 004:578.662 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:578.668 - 0.005ms returns 0 +T42A8 004:578.675 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:578.680 - 0.005ms returns 0 +T42A8 004:578.687 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:578.693 - 0.005ms returns 0 +T42A8 004:578.700 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:578.705 - 0.005ms returns 0 +T42A8 004:578.713 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:578.718 - 0.005ms returns 0 +T42A8 004:578.725 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:578.731 - 0.005ms returns 0 +T42A8 004:578.738 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:578.744 - 0.006ms returns 0 +T42A8 004:578.751 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:578.757 - 0.005ms returns 0 +T42A8 004:578.764 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:578.769 - 0.006ms returns 0 +T42A8 004:578.777 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:578.782 - 0.005ms returns 0 +T42A8 004:578.789 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:578.795 - 0.005ms returns 0 +T42A8 004:578.802 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:578.807 - 0.005ms returns 0 +T42A8 004:578.814 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:578.820 - 0.005ms returns 0 +T42A8 004:578.827 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:578.834 - 0.007ms returns 0x000000BC +T42A8 004:578.841 JLINK_Go() +T42A8 004:578.852 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:584.816 - 5.974ms +T42A8 004:584.826 JLINK_IsHalted() +T42A8 004:585.361 - 0.534ms returns FALSE +T42A8 004:585.370 JLINK_HasError() +T42A8 004:590.333 JLINK_IsHalted() +T42A8 004:596.410 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:597.170 - 6.836ms returns TRUE +T42A8 004:597.201 JLINK_ReadReg(R15 (PC)) +T42A8 004:597.210 - 0.008ms returns 0x20003000 +T42A8 004:597.217 JLINK_ClrBPEx(BPHandle = 0x000000BC) +T42A8 004:597.223 - 0.005ms returns 0x00 +T42A8 004:597.229 JLINK_ReadReg(R0) +T42A8 004:597.234 - 0.005ms returns 0x00000000 +T42A8 004:597.708 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:597.720 Data: 05 80 86 70 06 F0 11 F9 BA 48 C0 59 82 89 FF 2A ... +T42A8 004:597.735 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:601.791 - 4.083ms returns 0x100 +T42A8 004:601.819 JLINK_HasError() +T42A8 004:601.828 JLINK_WriteReg(R0, 0x1800D500) +T42A8 004:601.837 - 0.008ms returns 0 +T42A8 004:601.843 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:601.849 - 0.005ms returns 0 +T42A8 004:601.855 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:601.860 - 0.005ms returns 0 +T42A8 004:601.867 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:601.873 - 0.005ms returns 0 +T42A8 004:601.879 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:601.884 - 0.005ms returns 0 +T42A8 004:601.891 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:601.896 - 0.005ms returns 0 +T42A8 004:601.902 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:601.907 - 0.005ms returns 0 +T42A8 004:601.915 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:601.920 - 0.005ms returns 0 +T42A8 004:601.927 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:601.933 - 0.005ms returns 0 +T42A8 004:601.940 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:601.945 - 0.005ms returns 0 +T42A8 004:601.989 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:601.997 - 0.008ms returns 0 +T42A8 004:602.004 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:602.009 - 0.005ms returns 0 +T42A8 004:602.016 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:602.021 - 0.005ms returns 0 +T42A8 004:602.027 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:602.033 - 0.005ms returns 0 +T42A8 004:602.039 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:602.060 - 0.020ms returns 0 +T42A8 004:602.067 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:602.073 - 0.005ms returns 0 +T42A8 004:602.079 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:602.084 - 0.005ms returns 0 +T42A8 004:602.090 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:602.096 - 0.005ms returns 0 +T42A8 004:602.102 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:602.108 - 0.005ms returns 0 +T42A8 004:602.115 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:602.120 - 0.005ms returns 0 +T42A8 004:602.128 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:602.136 - 0.008ms returns 0x000000BD +T42A8 004:602.143 JLINK_Go() +T42A8 004:602.158 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:608.187 - 6.042ms +T42A8 004:608.208 JLINK_IsHalted() +T42A8 004:609.044 - 0.835ms returns FALSE +T42A8 004:609.069 JLINK_HasError() +T42A8 004:610.274 JLINK_IsHalted() +T42A8 004:616.469 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:617.130 - 6.856ms returns TRUE +T42A8 004:617.145 JLINK_ReadReg(R15 (PC)) +T42A8 004:617.153 - 0.008ms returns 0x20003000 +T42A8 004:617.160 JLINK_ClrBPEx(BPHandle = 0x000000BD) +T42A8 004:617.165 - 0.005ms returns 0x00 +T42A8 004:617.172 JLINK_ReadReg(R0) +T42A8 004:617.177 - 0.005ms returns 0x00000000 +T42A8 004:617.638 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:617.651 Data: C0 00 06 F0 79 F8 05 46 02 98 7C 4B 01 78 79 48 ... +T42A8 004:617.665 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:621.634 - 3.996ms returns 0x100 +T42A8 004:621.656 JLINK_HasError() +T42A8 004:621.664 JLINK_WriteReg(R0, 0x1800D600) +T42A8 004:621.673 - 0.008ms returns 0 +T42A8 004:621.679 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:621.685 - 0.005ms returns 0 +T42A8 004:621.691 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:621.697 - 0.005ms returns 0 +T42A8 004:621.703 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:621.708 - 0.005ms returns 0 +T42A8 004:621.715 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:621.721 - 0.005ms returns 0 +T42A8 004:621.727 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:621.732 - 0.005ms returns 0 +T42A8 004:621.738 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:621.743 - 0.005ms returns 0 +T42A8 004:621.750 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:621.756 - 0.005ms returns 0 +T42A8 004:621.763 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:621.768 - 0.005ms returns 0 +T42A8 004:621.774 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:621.779 - 0.005ms returns 0 +T42A8 004:621.786 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:621.791 - 0.005ms returns 0 +T42A8 004:621.797 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:621.802 - 0.005ms returns 0 +T42A8 004:621.809 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:621.813 - 0.005ms returns 0 +T42A8 004:621.820 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:621.825 - 0.005ms returns 0 +T42A8 004:621.832 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:621.837 - 0.005ms returns 0 +T42A8 004:621.843 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:621.849 - 0.005ms returns 0 +T42A8 004:621.855 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:621.860 - 0.005ms returns 0 +T42A8 004:621.867 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:621.872 - 0.005ms returns 0 +T42A8 004:621.878 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:621.883 - 0.005ms returns 0 +T42A8 004:621.889 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:621.895 - 0.005ms returns 0 +T42A8 004:621.901 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:621.907 - 0.006ms returns 0x000000BE +T42A8 004:621.914 JLINK_Go() +T42A8 004:621.925 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:628.100 - 6.185ms +T42A8 004:628.123 JLINK_IsHalted() +T42A8 004:628.828 - 0.705ms returns FALSE +T42A8 004:628.841 JLINK_HasError() +T42A8 004:631.091 JLINK_IsHalted() +T42A8 004:637.125 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:637.756 - 6.665ms returns TRUE +T42A8 004:637.769 JLINK_ReadReg(R15 (PC)) +T42A8 004:637.777 - 0.007ms returns 0x20003000 +T42A8 004:637.785 JLINK_ClrBPEx(BPHandle = 0x000000BE) +T42A8 004:637.791 - 0.006ms returns 0x00 +T42A8 004:637.799 JLINK_ReadReg(R0) +T42A8 004:637.805 - 0.006ms returns 0x00000000 +T42A8 004:638.274 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:638.288 Data: 00 2F E6 D1 00 24 E4 E7 FF B5 81 B0 15 46 0E 46 ... +T42A8 004:638.302 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:642.126 - 3.851ms returns 0x100 +T42A8 004:642.147 JLINK_HasError() +T42A8 004:642.160 JLINK_WriteReg(R0, 0x1800D700) +T42A8 004:642.171 - 0.011ms returns 0 +T42A8 004:642.186 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:642.194 - 0.008ms returns 0 +T42A8 004:642.202 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:642.209 - 0.006ms returns 0 +T42A8 004:642.217 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:642.223 - 0.006ms returns 0 +T42A8 004:642.231 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:642.237 - 0.006ms returns 0 +T42A8 004:642.245 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:642.252 - 0.006ms returns 0 +T42A8 004:642.260 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:642.266 - 0.006ms returns 0 +T42A8 004:642.274 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:642.281 - 0.006ms returns 0 +T42A8 004:642.289 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:642.295 - 0.006ms returns 0 +T42A8 004:642.303 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:642.309 - 0.006ms returns 0 +T42A8 004:642.317 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:642.323 - 0.006ms returns 0 +T42A8 004:642.331 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:642.337 - 0.006ms returns 0 +T42A8 004:642.345 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:642.352 - 0.006ms returns 0 +T42A8 004:642.360 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:642.367 - 0.007ms returns 0 +T42A8 004:642.375 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:642.381 - 0.006ms returns 0 +T42A8 004:642.389 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:642.396 - 0.006ms returns 0 +T42A8 004:642.404 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:642.410 - 0.006ms returns 0 +T42A8 004:642.418 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:642.425 - 0.006ms returns 0 +T42A8 004:642.432 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:642.439 - 0.006ms returns 0 +T42A8 004:642.447 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:642.453 - 0.006ms returns 0 +T42A8 004:642.461 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:642.469 - 0.007ms returns 0x000000BF +T42A8 004:642.477 JLINK_Go() +T42A8 004:642.489 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:648.601 - 6.123ms +T42A8 004:648.616 JLINK_IsHalted() +T42A8 004:649.181 - 0.565ms returns FALSE +T42A8 004:649.191 JLINK_HasError() +T42A8 004:651.072 JLINK_IsHalted() +T42A8 004:657.264 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:657.847 - 6.773ms returns TRUE +T42A8 004:657.870 JLINK_ReadReg(R15 (PC)) +T42A8 004:657.878 - 0.008ms returns 0x20003000 +T42A8 004:657.885 JLINK_ClrBPEx(BPHandle = 0x000000BF) +T42A8 004:657.890 - 0.005ms returns 0x00 +T42A8 004:657.897 JLINK_ReadReg(R0) +T42A8 004:657.913 - 0.016ms returns 0x00000000 +T42A8 004:658.401 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:658.410 Data: 70 B5 01 24 09 4D 84 40 28 88 00 29 0B D0 20 42 ... +T42A8 004:658.429 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:662.315 - 3.914ms returns 0x100 +T42A8 004:662.339 JLINK_HasError() +T42A8 004:662.348 JLINK_WriteReg(R0, 0x1800D800) +T42A8 004:662.357 - 0.009ms returns 0 +T42A8 004:662.364 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:662.369 - 0.005ms returns 0 +T42A8 004:662.376 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:662.381 - 0.005ms returns 0 +T42A8 004:662.388 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:662.393 - 0.005ms returns 0 +T42A8 004:662.399 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:662.405 - 0.005ms returns 0 +T42A8 004:662.411 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:662.416 - 0.005ms returns 0 +T42A8 004:662.423 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:662.428 - 0.005ms returns 0 +T42A8 004:662.435 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:662.440 - 0.005ms returns 0 +T42A8 004:662.446 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:662.451 - 0.005ms returns 0 +T42A8 004:662.458 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:662.463 - 0.005ms returns 0 +T42A8 004:662.469 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:662.475 - 0.005ms returns 0 +T42A8 004:662.481 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:662.491 - 0.009ms returns 0 +T42A8 004:662.497 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:662.502 - 0.005ms returns 0 +T42A8 004:662.509 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:662.515 - 0.006ms returns 0 +T42A8 004:662.521 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:662.527 - 0.005ms returns 0 +T42A8 004:662.536 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:662.541 - 0.007ms returns 0 +T42A8 004:662.549 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:662.554 - 0.006ms returns 0 +T42A8 004:662.561 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:662.566 - 0.005ms returns 0 +T42A8 004:662.573 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:662.577 - 0.005ms returns 0 +T42A8 004:662.584 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:662.589 - 0.005ms returns 0 +T42A8 004:662.596 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:662.603 - 0.006ms returns 0x000000C0 +T42A8 004:662.610 JLINK_Go() +T42A8 004:662.623 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:669.106 - 6.494ms +T42A8 004:669.137 JLINK_IsHalted() +T42A8 004:669.929 - 0.791ms returns FALSE +T42A8 004:669.957 JLINK_HasError() +T42A8 004:671.090 JLINK_IsHalted() +T42A8 004:677.247 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:678.041 - 6.949ms returns TRUE +T42A8 004:678.067 JLINK_ReadReg(R15 (PC)) +T42A8 004:678.078 - 0.010ms returns 0x20003000 +T42A8 004:678.087 JLINK_ClrBPEx(BPHandle = 0x000000C0) +T42A8 004:678.095 - 0.007ms returns 0x00 +T42A8 004:678.103 JLINK_ReadReg(R0) +T42A8 004:678.110 - 0.006ms returns 0x00000000 +T42A8 004:678.708 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:678.722 Data: 08 80 58 7C 19 46 40 1F C7 B2 22 88 00 98 17 31 ... +T42A8 004:678.741 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:682.685 - 3.976ms returns 0x100 +T42A8 004:682.707 JLINK_HasError() +T42A8 004:682.718 JLINK_WriteReg(R0, 0x1800D900) +T42A8 004:682.729 - 0.011ms returns 0 +T42A8 004:682.740 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:682.748 - 0.008ms returns 0 +T42A8 004:682.757 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:682.765 - 0.007ms returns 0 +T42A8 004:682.774 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:682.782 - 0.007ms returns 0 +T42A8 004:682.791 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:682.799 - 0.007ms returns 0 +T42A8 004:682.809 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:682.816 - 0.007ms returns 0 +T42A8 004:682.826 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:682.842 - 0.016ms returns 0 +T42A8 004:682.851 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:682.859 - 0.007ms returns 0 +T42A8 004:682.869 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:682.877 - 0.007ms returns 0 +T42A8 004:682.886 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:682.893 - 0.007ms returns 0 +T42A8 004:682.903 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:682.911 - 0.007ms returns 0 +T42A8 004:682.920 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:682.927 - 0.007ms returns 0 +T42A8 004:682.937 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:682.945 - 0.007ms returns 0 +T42A8 004:682.954 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:682.962 - 0.008ms returns 0 +T42A8 004:682.971 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:682.979 - 0.007ms returns 0 +T42A8 004:682.989 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:682.997 - 0.008ms returns 0 +T42A8 004:683.006 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:683.013 - 0.007ms returns 0 +T42A8 004:683.023 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:683.031 - 0.007ms returns 0 +T42A8 004:683.040 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:683.047 - 0.007ms returns 0 +T42A8 004:683.057 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:683.064 - 0.007ms returns 0 +T42A8 004:683.074 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:683.083 - 0.009ms returns 0x000000C1 +T42A8 004:683.093 JLINK_Go() +T42A8 004:683.107 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:689.060 - 5.966ms +T42A8 004:689.080 JLINK_IsHalted() +T42A8 004:689.722 - 0.641ms returns FALSE +T42A8 004:689.741 JLINK_HasError() +T42A8 004:690.860 JLINK_IsHalted() +T42A8 004:696.814 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:697.538 - 6.677ms returns TRUE +T42A8 004:697.563 JLINK_ReadReg(R15 (PC)) +T42A8 004:697.571 - 0.008ms returns 0x20003000 +T42A8 004:697.578 JLINK_ClrBPEx(BPHandle = 0x000000C1) +T42A8 004:697.584 - 0.006ms returns 0x00 +T42A8 004:697.590 JLINK_ReadReg(R0) +T42A8 004:697.595 - 0.005ms returns 0x00000000 +T42A8 004:698.078 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:698.091 Data: 90 42 02 D2 31 88 00 29 D6 D1 C0 B2 D1 B2 88 42 ... +T42A8 004:698.107 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:702.066 - 3.987ms returns 0x100 +T42A8 004:702.099 JLINK_HasError() +T42A8 004:702.108 JLINK_WriteReg(R0, 0x1800DA00) +T42A8 004:702.117 - 0.008ms returns 0 +T42A8 004:702.123 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:702.128 - 0.005ms returns 0 +T42A8 004:702.134 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:702.139 - 0.004ms returns 0 +T42A8 004:702.145 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:702.150 - 0.005ms returns 0 +T42A8 004:702.156 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:702.161 - 0.005ms returns 0 +T42A8 004:702.167 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:702.172 - 0.005ms returns 0 +T42A8 004:702.178 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:702.183 - 0.005ms returns 0 +T42A8 004:702.189 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:702.194 - 0.004ms returns 0 +T42A8 004:702.201 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:702.205 - 0.005ms returns 0 +T42A8 004:702.211 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:702.216 - 0.004ms returns 0 +T42A8 004:702.222 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:702.227 - 0.005ms returns 0 +T42A8 004:702.233 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:702.238 - 0.004ms returns 0 +T42A8 004:702.244 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:702.249 - 0.005ms returns 0 +T42A8 004:702.255 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:702.261 - 0.005ms returns 0 +T42A8 004:702.267 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:702.272 - 0.005ms returns 0 +T42A8 004:702.278 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:702.283 - 0.005ms returns 0 +T42A8 004:702.289 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:702.294 - 0.005ms returns 0 +T42A8 004:702.300 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:702.305 - 0.004ms returns 0 +T42A8 004:702.311 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:702.316 - 0.004ms returns 0 +T42A8 004:702.322 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:702.327 - 0.005ms returns 0 +T42A8 004:702.333 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:702.340 - 0.006ms returns 0x000000C2 +T42A8 004:702.346 JLINK_Go() +T42A8 004:702.357 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:708.495 - 6.148ms +T42A8 004:708.517 JLINK_IsHalted() +T42A8 004:709.179 - 0.661ms returns FALSE +T42A8 004:709.190 JLINK_HasError() +T42A8 004:714.967 JLINK_IsHalted() +T42A8 004:721.237 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:721.910 - 6.942ms returns TRUE +T42A8 004:721.929 JLINK_ReadReg(R15 (PC)) +T42A8 004:721.938 - 0.009ms returns 0x20003000 +T42A8 004:721.945 JLINK_ClrBPEx(BPHandle = 0x000000C2) +T42A8 004:721.951 - 0.006ms returns 0x00 +T42A8 004:721.959 JLINK_ReadReg(R0) +T42A8 004:721.965 - 0.005ms returns 0x00000000 +T42A8 004:722.467 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:722.485 Data: 64 1E 64 B2 00 2C F4 DA 00 22 11 46 30 46 FF F7 ... +T42A8 004:722.525 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:726.550 - 4.082ms returns 0x100 +T42A8 004:726.570 JLINK_HasError() +T42A8 004:726.579 JLINK_WriteReg(R0, 0x1800DB00) +T42A8 004:726.587 - 0.008ms returns 0 +T42A8 004:726.594 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:726.600 - 0.005ms returns 0 +T42A8 004:726.607 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:726.613 - 0.005ms returns 0 +T42A8 004:726.619 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:726.625 - 0.005ms returns 0 +T42A8 004:726.633 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:726.639 - 0.005ms returns 0 +T42A8 004:726.645 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:726.651 - 0.005ms returns 0 +T42A8 004:726.658 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:726.663 - 0.005ms returns 0 +T42A8 004:726.670 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:726.681 - 0.010ms returns 0 +T42A8 004:726.687 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:726.693 - 0.005ms returns 0 +T42A8 004:726.700 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:726.706 - 0.006ms returns 0 +T42A8 004:726.713 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:726.729 - 0.017ms returns 0 +T42A8 004:726.737 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:726.742 - 0.005ms returns 0 +T42A8 004:726.749 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:726.754 - 0.005ms returns 0 +T42A8 004:726.761 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:726.767 - 0.006ms returns 0 +T42A8 004:726.774 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:726.779 - 0.005ms returns 0 +T42A8 004:726.786 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:726.792 - 0.005ms returns 0 +T42A8 004:726.799 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:726.804 - 0.005ms returns 0 +T42A8 004:726.811 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:726.817 - 0.005ms returns 0 +T42A8 004:726.823 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:726.829 - 0.005ms returns 0 +T42A8 004:726.835 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:726.841 - 0.005ms returns 0 +T42A8 004:726.848 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:726.855 - 0.007ms returns 0x000000C3 +T42A8 004:726.862 JLINK_Go() +T42A8 004:726.874 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:732.877 - 6.014ms +T42A8 004:732.888 JLINK_IsHalted() +T42A8 004:733.544 - 0.656ms returns FALSE +T42A8 004:733.555 JLINK_HasError() +T42A8 004:735.809 JLINK_IsHalted() +T42A8 004:741.848 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:742.498 - 6.688ms returns TRUE +T42A8 004:742.509 JLINK_ReadReg(R15 (PC)) +T42A8 004:742.517 - 0.007ms returns 0x20003000 +T42A8 004:742.524 JLINK_ClrBPEx(BPHandle = 0x000000C3) +T42A8 004:742.530 - 0.005ms returns 0x00 +T42A8 004:742.537 JLINK_ReadReg(R0) +T42A8 004:742.543 - 0.006ms returns 0x00000000 +T42A8 004:742.987 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:742.996 Data: 40 38 36 18 30 46 14 30 A9 1C B8 47 68 78 B0 76 ... +T42A8 004:743.009 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:746.822 - 3.834ms returns 0x100 +T42A8 004:746.841 JLINK_HasError() +T42A8 004:746.852 JLINK_WriteReg(R0, 0x1800DC00) +T42A8 004:746.859 - 0.007ms returns 0 +T42A8 004:746.866 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:746.872 - 0.005ms returns 0 +T42A8 004:746.879 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:746.884 - 0.005ms returns 0 +T42A8 004:746.890 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:746.896 - 0.005ms returns 0 +T42A8 004:746.902 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:746.907 - 0.005ms returns 0 +T42A8 004:746.914 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:746.919 - 0.005ms returns 0 +T42A8 004:746.926 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:746.931 - 0.005ms returns 0 +T42A8 004:746.938 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:746.943 - 0.005ms returns 0 +T42A8 004:746.950 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:746.955 - 0.005ms returns 0 +T42A8 004:746.962 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:746.970 - 0.008ms returns 0 +T42A8 004:746.981 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:746.986 - 0.005ms returns 0 +T42A8 004:746.993 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:746.998 - 0.005ms returns 0 +T42A8 004:747.005 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:747.010 - 0.005ms returns 0 +T42A8 004:747.017 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:747.022 - 0.006ms returns 0 +T42A8 004:747.029 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:747.034 - 0.005ms returns 0 +T42A8 004:747.041 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:747.046 - 0.005ms returns 0 +T42A8 004:747.053 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:747.058 - 0.005ms returns 0 +T42A8 004:747.065 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:747.070 - 0.005ms returns 0 +T42A8 004:747.077 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:747.081 - 0.005ms returns 0 +T42A8 004:747.088 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:747.093 - 0.005ms returns 0 +T42A8 004:747.101 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:747.107 - 0.006ms returns 0x000000C4 +T42A8 004:747.117 JLINK_Go() +T42A8 004:747.128 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:753.058 - 5.940ms +T42A8 004:753.078 JLINK_IsHalted() +T42A8 004:753.633 - 0.554ms returns FALSE +T42A8 004:753.658 JLINK_HasError() +T42A8 004:757.685 JLINK_IsHalted() +T42A8 004:763.555 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:764.130 - 6.444ms returns TRUE +T42A8 004:764.142 JLINK_ReadReg(R15 (PC)) +T42A8 004:764.149 - 0.007ms returns 0x20003000 +T42A8 004:764.156 JLINK_ClrBPEx(BPHandle = 0x000000C4) +T42A8 004:764.161 - 0.005ms returns 0x00 +T42A8 004:764.167 JLINK_ReadReg(R0) +T42A8 004:764.173 - 0.005ms returns 0x00000000 +T42A8 004:764.625 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:764.633 Data: 06 46 62 49 A8 00 0C 58 00 22 39 46 28 46 FF F7 ... +T42A8 004:764.645 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:768.747 - 4.121ms returns 0x100 +T42A8 004:768.774 JLINK_HasError() +T42A8 004:768.783 JLINK_WriteReg(R0, 0x1800DD00) +T42A8 004:768.791 - 0.008ms returns 0 +T42A8 004:768.798 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:768.803 - 0.005ms returns 0 +T42A8 004:768.809 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:768.813 - 0.004ms returns 0 +T42A8 004:768.832 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:768.837 - 0.005ms returns 0 +T42A8 004:768.843 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:768.848 - 0.004ms returns 0 +T42A8 004:768.854 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:768.859 - 0.004ms returns 0 +T42A8 004:768.865 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:768.870 - 0.004ms returns 0 +T42A8 004:768.876 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:768.881 - 0.005ms returns 0 +T42A8 004:768.887 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:768.893 - 0.005ms returns 0 +T42A8 004:768.899 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:768.903 - 0.004ms returns 0 +T42A8 004:768.909 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:768.915 - 0.005ms returns 0 +T42A8 004:768.921 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:768.925 - 0.004ms returns 0 +T42A8 004:768.931 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:768.936 - 0.004ms returns 0 +T42A8 004:768.943 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:768.948 - 0.005ms returns 0 +T42A8 004:768.954 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:768.959 - 0.005ms returns 0 +T42A8 004:768.965 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:768.970 - 0.005ms returns 0 +T42A8 004:768.977 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:768.981 - 0.005ms returns 0 +T42A8 004:768.988 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:768.993 - 0.004ms returns 0 +T42A8 004:768.999 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:769.003 - 0.004ms returns 0 +T42A8 004:769.009 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:769.014 - 0.004ms returns 0 +T42A8 004:769.021 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:769.027 - 0.006ms returns 0x000000C5 +T42A8 004:769.033 JLINK_Go() +T42A8 004:769.045 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:775.212 - 6.178ms +T42A8 004:775.233 JLINK_IsHalted() +T42A8 004:775.950 - 0.716ms returns FALSE +T42A8 004:775.961 JLINK_HasError() +T42A8 004:778.752 JLINK_IsHalted() +T42A8 004:784.758 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:785.403 - 6.650ms returns TRUE +T42A8 004:785.415 JLINK_ReadReg(R15 (PC)) +T42A8 004:785.422 - 0.007ms returns 0x20003000 +T42A8 004:785.429 JLINK_ClrBPEx(BPHandle = 0x000000C5) +T42A8 004:785.434 - 0.005ms returns 0x00 +T42A8 004:785.441 JLINK_ReadReg(R0) +T42A8 004:785.446 - 0.005ms returns 0x00000000 +T42A8 004:785.871 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:785.880 Data: FC D2 00 E0 09 78 2B 00 03 F0 CE FC 08 05 06 0A ... +T42A8 004:785.891 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:789.721 - 3.848ms returns 0x100 +T42A8 004:789.734 JLINK_HasError() +T42A8 004:789.741 JLINK_WriteReg(R0, 0x1800DE00) +T42A8 004:789.748 - 0.006ms returns 0 +T42A8 004:789.754 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:789.759 - 0.005ms returns 0 +T42A8 004:789.765 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:789.770 - 0.005ms returns 0 +T42A8 004:789.777 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:789.781 - 0.004ms returns 0 +T42A8 004:789.791 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:789.797 - 0.006ms returns 0 +T42A8 004:789.804 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:789.809 - 0.005ms returns 0 +T42A8 004:789.815 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:789.819 - 0.004ms returns 0 +T42A8 004:789.825 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:789.833 - 0.007ms returns 0 +T42A8 004:789.843 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:789.849 - 0.006ms returns 0 +T42A8 004:789.855 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:789.860 - 0.004ms returns 0 +T42A8 004:789.866 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:789.871 - 0.004ms returns 0 +T42A8 004:789.877 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:789.882 - 0.004ms returns 0 +T42A8 004:789.888 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:789.893 - 0.005ms returns 0 +T42A8 004:789.899 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:789.905 - 0.005ms returns 0 +T42A8 004:789.911 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:789.915 - 0.005ms returns 0 +T42A8 004:789.922 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:789.927 - 0.005ms returns 0 +T42A8 004:789.933 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:789.938 - 0.004ms returns 0 +T42A8 004:789.944 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:789.949 - 0.004ms returns 0 +T42A8 004:789.955 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:789.959 - 0.004ms returns 0 +T42A8 004:789.965 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:789.970 - 0.004ms returns 0 +T42A8 004:789.978 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:789.983 - 0.006ms returns 0x000000C6 +T42A8 004:789.989 JLINK_Go() +T42A8 004:789.999 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:796.027 - 6.037ms +T42A8 004:796.038 JLINK_IsHalted() +T42A8 004:796.714 - 0.675ms returns FALSE +T42A8 004:796.724 JLINK_HasError() +T42A8 004:798.678 JLINK_IsHalted() +T42A8 004:804.707 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:805.268 - 6.589ms returns TRUE +T42A8 004:805.281 JLINK_ReadReg(R15 (PC)) +T42A8 004:805.288 - 0.007ms returns 0x20003000 +T42A8 004:805.295 JLINK_ClrBPEx(BPHandle = 0x000000C6) +T42A8 004:805.301 - 0.006ms returns 0x00 +T42A8 004:805.308 JLINK_ReadReg(R0) +T42A8 004:805.314 - 0.005ms returns 0x00000000 +T42A8 004:806.358 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:806.367 Data: 00 2B 0C D0 9C 78 00 2C 0A D0 01 2C 0C D0 02 2C ... +T42A8 004:806.378 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:810.257 - 3.899ms returns 0x100 +T42A8 004:810.268 JLINK_HasError() +T42A8 004:810.275 JLINK_WriteReg(R0, 0x1800DF00) +T42A8 004:810.282 - 0.006ms returns 0 +T42A8 004:810.288 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:810.293 - 0.005ms returns 0 +T42A8 004:810.299 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:810.305 - 0.004ms returns 0 +T42A8 004:810.310 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:810.315 - 0.004ms returns 0 +T42A8 004:810.321 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:810.326 - 0.004ms returns 0 +T42A8 004:810.332 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:810.337 - 0.004ms returns 0 +T42A8 004:810.343 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:810.349 - 0.006ms returns 0 +T42A8 004:810.355 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:810.360 - 0.005ms returns 0 +T42A8 004:810.366 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:810.371 - 0.004ms returns 0 +T42A8 004:810.377 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:810.382 - 0.004ms returns 0 +T42A8 004:810.388 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:810.393 - 0.004ms returns 0 +T42A8 004:810.399 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:810.404 - 0.004ms returns 0 +T42A8 004:810.409 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:810.414 - 0.004ms returns 0 +T42A8 004:810.421 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:810.426 - 0.005ms returns 0 +T42A8 004:810.432 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:810.437 - 0.004ms returns 0 +T42A8 004:810.443 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:810.448 - 0.005ms returns 0 +T42A8 004:810.453 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:810.459 - 0.005ms returns 0 +T42A8 004:810.465 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:810.469 - 0.004ms returns 0 +T42A8 004:810.480 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:810.485 - 0.005ms returns 0 +T42A8 004:810.497 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:810.502 - 0.005ms returns 0 +T42A8 004:810.509 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:810.514 - 0.006ms returns 0x000000C7 +T42A8 004:810.520 JLINK_Go() +T42A8 004:810.548 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:816.778 - 6.256ms +T42A8 004:816.823 JLINK_IsHalted() +T42A8 004:817.597 - 0.773ms returns FALSE +T42A8 004:817.627 JLINK_HasError() +T42A8 004:822.680 JLINK_IsHalted() +T42A8 004:829.113 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:829.909 - 7.228ms returns TRUE +T42A8 004:829.933 JLINK_ReadReg(R15 (PC)) +T42A8 004:829.942 - 0.008ms returns 0x20003000 +T42A8 004:829.949 JLINK_ClrBPEx(BPHandle = 0x000000C7) +T42A8 004:829.955 - 0.006ms returns 0x00 +T42A8 004:829.962 JLINK_ReadReg(R0) +T42A8 004:829.967 - 0.005ms returns 0x00000000 +T42A8 004:830.481 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:830.495 Data: 80 00 0E 58 00 2F 1E D0 00 2E 1C D0 38 78 19 28 ... +T42A8 004:830.514 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:834.445 - 3.963ms returns 0x100 +T42A8 004:834.468 JLINK_HasError() +T42A8 004:834.477 JLINK_WriteReg(R0, 0x1800E000) +T42A8 004:834.485 - 0.008ms returns 0 +T42A8 004:834.491 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:834.497 - 0.005ms returns 0 +T42A8 004:834.503 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:834.508 - 0.005ms returns 0 +T42A8 004:834.514 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:834.519 - 0.005ms returns 0 +T42A8 004:834.525 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:834.531 - 0.005ms returns 0 +T42A8 004:834.537 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:834.542 - 0.005ms returns 0 +T42A8 004:834.549 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:834.554 - 0.005ms returns 0 +T42A8 004:834.560 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:834.565 - 0.005ms returns 0 +T42A8 004:834.572 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:834.577 - 0.005ms returns 0 +T42A8 004:834.583 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:834.588 - 0.005ms returns 0 +T42A8 004:834.594 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:834.599 - 0.005ms returns 0 +T42A8 004:834.605 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:834.611 - 0.005ms returns 0 +T42A8 004:834.617 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:834.622 - 0.005ms returns 0 +T42A8 004:834.628 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:834.634 - 0.005ms returns 0 +T42A8 004:834.640 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:834.645 - 0.005ms returns 0 +T42A8 004:834.651 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:834.657 - 0.005ms returns 0 +T42A8 004:834.663 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:834.668 - 0.005ms returns 0 +T42A8 004:834.674 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:834.679 - 0.005ms returns 0 +T42A8 004:834.685 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:834.690 - 0.005ms returns 0 +T42A8 004:834.697 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:834.701 - 0.005ms returns 0 +T42A8 004:834.708 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:834.715 - 0.006ms returns 0x000000C8 +T42A8 004:834.721 JLINK_Go() +T42A8 004:834.733 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:840.538 - 5.816ms +T42A8 004:840.549 JLINK_IsHalted() +T42A8 004:841.109 - 0.559ms returns FALSE +T42A8 004:841.119 JLINK_HasError() +T42A8 004:842.449 JLINK_IsHalted() +T42A8 004:848.656 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:849.451 - 7.001ms returns TRUE +T42A8 004:849.479 JLINK_ReadReg(R15 (PC)) +T42A8 004:849.489 - 0.009ms returns 0x20003000 +T42A8 004:849.495 JLINK_ClrBPEx(BPHandle = 0x000000C8) +T42A8 004:849.501 - 0.005ms returns 0x00 +T42A8 004:849.507 JLINK_ReadReg(R0) +T42A8 004:849.512 - 0.004ms returns 0x00000000 +T42A8 004:849.987 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:850.036 Data: 80 07 09 79 80 0F 19 29 26 D2 1E 4B 4A 00 66 88 ... +T42A8 004:850.052 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:854.125 - 4.137ms returns 0x100 +T42A8 004:854.186 JLINK_HasError() +T42A8 004:854.195 JLINK_WriteReg(R0, 0x1800E100) +T42A8 004:854.209 - 0.014ms returns 0 +T42A8 004:854.217 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:854.222 - 0.006ms returns 0 +T42A8 004:854.229 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:854.234 - 0.005ms returns 0 +T42A8 004:854.241 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:854.246 - 0.005ms returns 0 +T42A8 004:854.252 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:854.257 - 0.005ms returns 0 +T42A8 004:854.264 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:854.269 - 0.005ms returns 0 +T42A8 004:854.276 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:854.281 - 0.005ms returns 0 +T42A8 004:854.288 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:854.293 - 0.005ms returns 0 +T42A8 004:854.299 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:854.305 - 0.005ms returns 0 +T42A8 004:854.311 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:854.316 - 0.005ms returns 0 +T42A8 004:854.323 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:854.328 - 0.005ms returns 0 +T42A8 004:854.334 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:854.340 - 0.005ms returns 0 +T42A8 004:854.346 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:854.351 - 0.005ms returns 0 +T42A8 004:854.358 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:854.364 - 0.005ms returns 0 +T42A8 004:854.370 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:854.404 - 0.034ms returns 0 +T42A8 004:854.415 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:854.422 - 0.008ms returns 0 +T42A8 004:854.433 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:854.444 - 0.010ms returns 0 +T42A8 004:854.456 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:854.467 - 0.010ms returns 0 +T42A8 004:854.478 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:854.487 - 0.009ms returns 0 +T42A8 004:854.497 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:854.505 - 0.008ms returns 0 +T42A8 004:854.515 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:854.527 - 0.011ms returns 0x000000C9 +T42A8 004:854.537 JLINK_Go() +T42A8 004:854.556 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:861.094 - 6.556ms +T42A8 004:861.121 JLINK_IsHalted() +T42A8 004:861.877 - 0.755ms returns FALSE +T42A8 004:861.903 JLINK_HasError() +T42A8 004:864.583 JLINK_IsHalted() +T42A8 004:870.560 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:871.226 - 6.642ms returns TRUE +T42A8 004:871.242 JLINK_ReadReg(R15 (PC)) +T42A8 004:871.252 - 0.009ms returns 0x20003000 +T42A8 004:871.260 JLINK_ClrBPEx(BPHandle = 0x000000C9) +T42A8 004:871.267 - 0.006ms returns 0x00 +T42A8 004:871.275 JLINK_ReadReg(R0) +T42A8 004:871.281 - 0.006ms returns 0x00000000 +T42A8 004:871.837 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:871.852 Data: 00 2A 04 D0 10 46 05 F0 6F F8 83 78 04 88 B1 00 ... +T42A8 004:871.870 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:875.738 - 3.901ms returns 0x100 +T42A8 004:875.762 JLINK_HasError() +T42A8 004:875.772 JLINK_WriteReg(R0, 0x1800E200) +T42A8 004:875.781 - 0.009ms returns 0 +T42A8 004:875.789 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:875.795 - 0.006ms returns 0 +T42A8 004:875.804 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:875.811 - 0.006ms returns 0 +T42A8 004:875.820 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:875.826 - 0.006ms returns 0 +T42A8 004:875.835 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:875.842 - 0.006ms returns 0 +T42A8 004:875.851 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:875.857 - 0.006ms returns 0 +T42A8 004:875.868 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:875.874 - 0.006ms returns 0 +T42A8 004:875.883 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:875.891 - 0.008ms returns 0 +T42A8 004:875.899 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:875.906 - 0.006ms returns 0 +T42A8 004:875.913 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:875.920 - 0.006ms returns 0 +T42A8 004:875.927 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:875.933 - 0.006ms returns 0 +T42A8 004:875.942 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:875.949 - 0.006ms returns 0 +T42A8 004:875.957 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:875.964 - 0.006ms returns 0 +T42A8 004:875.972 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:875.979 - 0.007ms returns 0 +T42A8 004:875.988 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:875.998 - 0.010ms returns 0 +T42A8 004:876.008 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:876.014 - 0.006ms returns 0 +T42A8 004:876.021 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:876.028 - 0.006ms returns 0 +T42A8 004:876.037 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:876.043 - 0.006ms returns 0 +T42A8 004:876.051 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:876.057 - 0.006ms returns 0 +T42A8 004:876.065 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:876.071 - 0.006ms returns 0 +T42A8 004:876.081 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:876.088 - 0.007ms returns 0x000000CA +T42A8 004:876.096 JLINK_Go() +T42A8 004:876.109 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:882.162 - 6.066ms +T42A8 004:882.177 JLINK_IsHalted() +T42A8 004:882.745 - 0.566ms returns FALSE +T42A8 004:882.761 JLINK_HasError() +T42A8 004:884.310 JLINK_IsHalted() +T42A8 004:890.316 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:890.915 - 6.604ms returns TRUE +T42A8 004:890.931 JLINK_ReadReg(R15 (PC)) +T42A8 004:890.941 - 0.009ms returns 0x20003000 +T42A8 004:890.951 JLINK_ClrBPEx(BPHandle = 0x000000CA) +T42A8 004:890.959 - 0.008ms returns 0x00 +T42A8 004:890.969 JLINK_ReadReg(R0) +T42A8 004:890.977 - 0.007ms returns 0x00000000 +T42A8 004:891.571 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:891.584 Data: 0A D0 E8 7F 00 28 07 D1 60 6A 40 1C 04 D0 E8 7E ... +T42A8 004:891.601 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:895.652 - 4.080ms returns 0x100 +T42A8 004:895.668 JLINK_HasError() +T42A8 004:895.679 JLINK_WriteReg(R0, 0x1800E300) +T42A8 004:895.689 - 0.009ms returns 0 +T42A8 004:895.699 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:895.707 - 0.008ms returns 0 +T42A8 004:895.716 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:895.724 - 0.007ms returns 0 +T42A8 004:895.733 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:895.742 - 0.008ms returns 0 +T42A8 004:895.751 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:895.759 - 0.007ms returns 0 +T42A8 004:895.769 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:895.776 - 0.007ms returns 0 +T42A8 004:895.786 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:895.793 - 0.007ms returns 0 +T42A8 004:895.803 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:895.811 - 0.007ms returns 0 +T42A8 004:895.820 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:895.828 - 0.007ms returns 0 +T42A8 004:895.837 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:895.845 - 0.007ms returns 0 +T42A8 004:895.854 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:895.861 - 0.007ms returns 0 +T42A8 004:895.871 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:895.879 - 0.007ms returns 0 +T42A8 004:895.888 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:895.896 - 0.007ms returns 0 +T42A8 004:895.905 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:895.913 - 0.008ms returns 0 +T42A8 004:895.923 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:895.930 - 0.007ms returns 0 +T42A8 004:895.940 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:895.947 - 0.007ms returns 0 +T42A8 004:895.957 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:895.965 - 0.007ms returns 0 +T42A8 004:895.974 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:895.982 - 0.007ms returns 0 +T42A8 004:895.991 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:895.999 - 0.007ms returns 0 +T42A8 004:896.008 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:896.015 - 0.007ms returns 0 +T42A8 004:896.025 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:896.034 - 0.009ms returns 0x000000CB +T42A8 004:896.043 JLINK_Go() +T42A8 004:896.057 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:902.029 - 5.985ms +T42A8 004:902.044 JLINK_IsHalted() +T42A8 004:902.699 - 0.654ms returns FALSE +T42A8 004:902.714 JLINK_HasError() +T42A8 004:904.336 JLINK_IsHalted() +T42A8 004:910.326 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:910.971 - 6.634ms returns TRUE +T42A8 004:910.994 JLINK_ReadReg(R15 (PC)) +T42A8 004:911.007 - 0.012ms returns 0x20003000 +T42A8 004:911.020 JLINK_ClrBPEx(BPHandle = 0x000000CB) +T42A8 004:911.031 - 0.010ms returns 0x00 +T42A8 004:911.045 JLINK_ReadReg(R0) +T42A8 004:911.056 - 0.010ms returns 0x00000000 +T42A8 004:911.774 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:911.793 Data: 04 D0 1D 28 0A D1 01 E0 6C 48 05 E0 01 26 FB E7 ... +T42A8 004:911.814 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:915.709 - 3.934ms returns 0x100 +T42A8 004:915.733 JLINK_HasError() +T42A8 004:915.747 JLINK_WriteReg(R0, 0x1800E400) +T42A8 004:915.761 - 0.013ms returns 0 +T42A8 004:915.773 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:915.784 - 0.010ms returns 0 +T42A8 004:915.796 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:915.806 - 0.010ms returns 0 +T42A8 004:915.819 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:915.829 - 0.010ms returns 0 +T42A8 004:915.845 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:915.855 - 0.010ms returns 0 +T42A8 004:915.868 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:915.878 - 0.010ms returns 0 +T42A8 004:915.891 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:915.901 - 0.010ms returns 0 +T42A8 004:915.913 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:915.923 - 0.010ms returns 0 +T42A8 004:915.936 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:915.945 - 0.010ms returns 0 +T42A8 004:915.958 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:915.967 - 0.009ms returns 0 +T42A8 004:915.979 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:915.989 - 0.010ms returns 0 +T42A8 004:916.001 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:916.011 - 0.009ms returns 0 +T42A8 004:916.023 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:916.033 - 0.009ms returns 0 +T42A8 004:916.045 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:916.056 - 0.010ms returns 0 +T42A8 004:916.068 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:916.078 - 0.010ms returns 0 +T42A8 004:916.090 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:916.100 - 0.010ms returns 0 +T42A8 004:916.113 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:916.122 - 0.010ms returns 0 +T42A8 004:916.135 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:916.144 - 0.009ms returns 0 +T42A8 004:916.157 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:916.166 - 0.009ms returns 0 +T42A8 004:916.178 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:916.188 - 0.009ms returns 0 +T42A8 004:916.201 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:916.212 - 0.011ms returns 0x000000CC +T42A8 004:916.224 JLINK_Go() +T42A8 004:916.245 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:922.278 - 6.053ms +T42A8 004:922.308 JLINK_IsHalted() +T42A8 004:922.953 - 0.644ms returns FALSE +T42A8 004:922.977 JLINK_HasError() +T42A8 004:932.373 JLINK_IsHalted() +T42A8 004:938.584 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:939.267 - 6.893ms returns TRUE +T42A8 004:939.300 JLINK_ReadReg(R15 (PC)) +T42A8 004:939.316 - 0.016ms returns 0x20003000 +T42A8 004:939.331 JLINK_ClrBPEx(BPHandle = 0x000000CC) +T42A8 004:939.342 - 0.011ms returns 0x00 +T42A8 004:939.358 JLINK_ReadReg(R0) +T42A8 004:939.369 - 0.010ms returns 0x00000000 +T42A8 004:940.309 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:940.334 Data: 06 98 70 23 58 43 40 39 46 18 01 90 00 2A 0C DA ... +T42A8 004:940.367 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:944.373 - 4.064ms returns 0x100 +T42A8 004:944.419 JLINK_HasError() +T42A8 004:944.436 JLINK_WriteReg(R0, 0x1800E500) +T42A8 004:944.451 - 0.015ms returns 0 +T42A8 004:944.463 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:944.473 - 0.010ms returns 0 +T42A8 004:944.485 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:944.495 - 0.009ms returns 0 +T42A8 004:944.507 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:944.517 - 0.009ms returns 0 +T42A8 004:944.528 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:944.538 - 0.009ms returns 0 +T42A8 004:944.550 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:944.559 - 0.009ms returns 0 +T42A8 004:944.571 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:944.581 - 0.009ms returns 0 +T42A8 004:944.592 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:944.602 - 0.009ms returns 0 +T42A8 004:944.614 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:944.623 - 0.009ms returns 0 +T42A8 004:944.635 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:944.645 - 0.009ms returns 0 +T42A8 004:944.657 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:944.666 - 0.009ms returns 0 +T42A8 004:944.686 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:944.696 - 0.010ms returns 0 +T42A8 004:944.708 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:944.717 - 0.009ms returns 0 +T42A8 004:944.729 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:944.739 - 0.010ms returns 0 +T42A8 004:944.751 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:944.761 - 0.009ms returns 0 +T42A8 004:944.773 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:944.783 - 0.010ms returns 0 +T42A8 004:944.795 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:944.804 - 0.009ms returns 0 +T42A8 004:944.816 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:944.825 - 0.009ms returns 0 +T42A8 004:944.837 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:944.847 - 0.009ms returns 0 +T42A8 004:944.859 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:944.868 - 0.009ms returns 0 +T42A8 004:944.881 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:944.893 - 0.012ms returns 0x000000CD +T42A8 004:944.905 JLINK_Go() +T42A8 004:944.925 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:951.342 - 6.434ms +T42A8 004:951.389 JLINK_IsHalted() +T42A8 004:952.061 - 0.669ms returns FALSE +T42A8 004:952.097 JLINK_HasError() +T42A8 004:954.197 JLINK_IsHalted() +T42A8 004:960.258 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:960.993 - 6.794ms returns TRUE +T42A8 004:961.041 JLINK_ReadReg(R15 (PC)) +T42A8 004:961.071 - 0.028ms returns 0x20003000 +T42A8 004:961.116 JLINK_ClrBPEx(BPHandle = 0x000000CD) +T42A8 004:961.141 - 0.025ms returns 0x00 +T42A8 004:961.169 JLINK_ReadReg(R0) +T42A8 004:961.193 - 0.022ms returns 0x00000000 +T42A8 004:963.123 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:963.162 Data: 03 98 C9 07 C9 0F 00 02 20 22 10 43 08 43 70 82 ... +T42A8 004:963.210 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:967.307 - 4.182ms returns 0x100 +T42A8 004:967.382 JLINK_HasError() +T42A8 004:967.602 JLINK_WriteReg(R0, 0x1800E600) +T42A8 004:967.649 - 0.048ms returns 0 +T42A8 004:967.681 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:967.705 - 0.023ms returns 0 +T42A8 004:967.732 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:967.755 - 0.022ms returns 0 +T42A8 004:967.782 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:967.805 - 0.022ms returns 0 +T42A8 004:967.832 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:967.854 - 0.022ms returns 0 +T42A8 004:967.881 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:967.903 - 0.022ms returns 0 +T42A8 004:967.930 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:967.953 - 0.022ms returns 0 +T42A8 004:967.980 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:968.002 - 0.022ms returns 0 +T42A8 004:968.029 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:968.051 - 0.022ms returns 0 +T42A8 004:968.104 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:968.128 - 0.024ms returns 0 +T42A8 004:968.156 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:968.179 - 0.022ms returns 0 +T42A8 004:968.206 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:968.228 - 0.022ms returns 0 +T42A8 004:968.255 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:968.277 - 0.022ms returns 0 +T42A8 004:968.305 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:968.334 - 0.030ms returns 0 +T42A8 004:968.361 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:968.386 - 0.025ms returns 0 +T42A8 004:968.414 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:968.437 - 0.023ms returns 0 +T42A8 004:968.465 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:968.487 - 0.022ms returns 0 +T42A8 004:968.514 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:968.536 - 0.022ms returns 0 +T42A8 004:968.563 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:968.585 - 0.021ms returns 0 +T42A8 004:968.612 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:968.634 - 0.022ms returns 0 +T42A8 004:968.664 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:968.690 - 0.027ms returns 0x000000CE +T42A8 004:968.718 JLINK_Go() +T42A8 004:968.760 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 004:975.293 - 6.572ms +T42A8 004:975.374 JLINK_IsHalted() +T42A8 004:976.240 - 0.863ms returns FALSE +T42A8 004:976.305 JLINK_HasError() +T42A8 004:983.166 JLINK_IsHalted() +T42A8 004:989.613 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 004:990.399 - 7.231ms returns TRUE +T42A8 004:990.457 JLINK_ReadReg(R15 (PC)) +T42A8 004:990.489 - 0.031ms returns 0x20003000 +T42A8 004:990.519 JLINK_ClrBPEx(BPHandle = 0x000000CE) +T42A8 004:990.544 - 0.024ms returns 0x00 +T42A8 004:990.573 JLINK_ReadReg(R0) +T42A8 004:990.595 - 0.022ms returns 0x00000000 +T42A8 004:992.313 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 004:992.350 Data: 28 D0 01 46 20 31 0A 7E 00 2A 02 D0 01 2A 21 D1 ... +T42A8 004:992.399 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 004:996.475 - 4.161ms returns 0x100 +T42A8 004:996.547 JLINK_HasError() +T42A8 004:996.581 JLINK_WriteReg(R0, 0x1800E700) +T42A8 004:996.613 - 0.032ms returns 0 +T42A8 004:996.645 JLINK_WriteReg(R1, 0x00000100) +T42A8 004:996.669 - 0.023ms returns 0 +T42A8 004:996.849 JLINK_WriteReg(R2, 0x200039D4) +T42A8 004:996.895 - 0.046ms returns 0 +T42A8 004:996.926 JLINK_WriteReg(R3, 0x00000000) +T42A8 004:996.950 - 0.023ms returns 0 +T42A8 004:996.977 JLINK_WriteReg(R4, 0x00000000) +T42A8 004:997.031 - 0.053ms returns 0 +T42A8 004:997.060 JLINK_WriteReg(R5, 0x00000000) +T42A8 004:997.083 - 0.023ms returns 0 +T42A8 004:997.111 JLINK_WriteReg(R6, 0x00000000) +T42A8 004:997.133 - 0.022ms returns 0 +T42A8 004:997.159 JLINK_WriteReg(R7, 0x00000000) +T42A8 004:997.181 - 0.021ms returns 0 +T42A8 004:997.208 JLINK_WriteReg(R8, 0x00000000) +T42A8 004:997.229 - 0.021ms returns 0 +T42A8 004:997.255 JLINK_WriteReg(R9, 0x200039B4) +T42A8 004:997.276 - 0.021ms returns 0 +T42A8 004:997.302 JLINK_WriteReg(R10, 0x00000000) +T42A8 004:997.323 - 0.021ms returns 0 +T42A8 004:997.349 JLINK_WriteReg(R11, 0x00000000) +T42A8 004:997.371 - 0.021ms returns 0 +T42A8 004:997.397 JLINK_WriteReg(R12, 0x00000000) +T42A8 004:997.418 - 0.021ms returns 0 +T42A8 004:997.445 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 004:997.467 - 0.023ms returns 0 +T42A8 004:997.494 JLINK_WriteReg(R14, 0x20003001) +T42A8 004:997.515 - 0.021ms returns 0 +T42A8 004:997.542 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 004:997.563 - 0.022ms returns 0 +T42A8 004:997.590 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 004:997.611 - 0.021ms returns 0 +T42A8 004:997.637 JLINK_WriteReg(MSP, 0x20004000) +T42A8 004:997.659 - 0.021ms returns 0 +T42A8 004:997.685 JLINK_WriteReg(PSP, 0x20004000) +T42A8 004:997.705 - 0.021ms returns 0 +T42A8 004:997.732 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 004:997.753 - 0.021ms returns 0 +T42A8 004:997.781 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 004:997.808 - 0.027ms returns 0x000000CF +T42A8 004:997.834 JLINK_Go() +T42A8 004:997.876 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:004.314 - 6.477ms +T42A8 005:004.381 JLINK_IsHalted() +T42A8 005:005.154 - 0.770ms returns FALSE +T42A8 005:005.211 JLINK_HasError() +T42A8 005:007.073 JLINK_IsHalted() +T42A8 005:013.525 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:014.300 - 7.226ms returns TRUE +T42A8 005:014.355 JLINK_ReadReg(R15 (PC)) +T42A8 005:014.385 - 0.030ms returns 0x20003000 +T42A8 005:014.414 JLINK_ClrBPEx(BPHandle = 0x000000CF) +T42A8 005:014.438 - 0.024ms returns 0x00 +T42A8 005:014.465 JLINK_ReadReg(R0) +T42A8 005:014.489 - 0.022ms returns 0x00000000 +T42A8 005:016.437 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:016.476 Data: 03 D2 FF F7 77 FF 05 B0 F0 BD 04 98 00 28 03 D1 ... +T42A8 005:016.525 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:020.768 - 4.330ms returns 0x100 +T42A8 005:020.867 JLINK_HasError() +T42A8 005:020.900 JLINK_WriteReg(R0, 0x1800E800) +T42A8 005:020.971 - 0.071ms returns 0 +T42A8 005:021.002 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:021.027 - 0.024ms returns 0 +T42A8 005:021.055 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:021.079 - 0.023ms returns 0 +T42A8 005:021.107 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:021.129 - 0.022ms returns 0 +T42A8 005:021.157 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:021.180 - 0.022ms returns 0 +T42A8 005:021.207 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:021.229 - 0.021ms returns 0 +T42A8 005:021.256 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:021.277 - 0.021ms returns 0 +T42A8 005:021.304 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:021.341 - 0.036ms returns 0 +T42A8 005:021.368 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:021.389 - 0.021ms returns 0 +T42A8 005:021.415 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:021.437 - 0.021ms returns 0 +T42A8 005:021.463 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:021.484 - 0.021ms returns 0 +T42A8 005:021.510 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:021.531 - 0.021ms returns 0 +T42A8 005:021.558 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:021.580 - 0.021ms returns 0 +T42A8 005:021.607 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:021.633 - 0.027ms returns 0 +T42A8 005:021.662 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:021.743 - 0.081ms returns 0 +T42A8 005:021.773 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:021.795 - 0.022ms returns 0 +T42A8 005:021.821 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:021.843 - 0.021ms returns 0 +T42A8 005:021.869 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:021.890 - 0.021ms returns 0 +T42A8 005:021.917 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:021.963 - 0.046ms returns 0 +T42A8 005:021.990 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:022.012 - 0.021ms returns 0 +T42A8 005:022.204 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:022.255 - 0.052ms returns 0x000000D0 +T42A8 005:022.286 JLINK_Go() +T42A8 005:022.331 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:028.616 - 6.328ms +T42A8 005:028.665 JLINK_IsHalted() +T42A8 005:029.485 - 0.818ms returns FALSE +T42A8 005:029.535 JLINK_HasError() +T42A8 005:039.098 JLINK_IsHalted() +T42A8 005:045.265 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:045.999 - 6.900ms returns TRUE +T42A8 005:046.032 JLINK_ReadReg(R15 (PC)) +T42A8 005:046.043 - 0.011ms returns 0x20003000 +T42A8 005:046.053 JLINK_ClrBPEx(BPHandle = 0x000000D0) +T42A8 005:046.060 - 0.007ms returns 0x00 +T42A8 005:046.069 JLINK_ReadReg(R0) +T42A8 005:046.075 - 0.006ms returns 0x00000000 +T42A8 005:046.666 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:046.700 Data: 8A 42 03 D3 A1 7D 49 1C A1 75 60 62 20 46 FD F7 ... +T42A8 005:046.721 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:050.873 - 4.214ms returns 0x100 +T42A8 005:050.905 JLINK_HasError() +T42A8 005:050.917 JLINK_WriteReg(R0, 0x1800E900) +T42A8 005:050.928 - 0.011ms returns 0 +T42A8 005:050.937 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:050.944 - 0.007ms returns 0 +T42A8 005:050.954 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:050.961 - 0.007ms returns 0 +T42A8 005:050.969 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:050.977 - 0.007ms returns 0 +T42A8 005:050.985 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:050.992 - 0.006ms returns 0 +T42A8 005:051.002 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:051.009 - 0.007ms returns 0 +T42A8 005:051.019 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:051.026 - 0.006ms returns 0 +T42A8 005:051.037 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:051.044 - 0.007ms returns 0 +T42A8 005:051.054 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:051.061 - 0.007ms returns 0 +T42A8 005:051.071 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:051.077 - 0.006ms returns 0 +T42A8 005:051.087 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:051.094 - 0.007ms returns 0 +T42A8 005:051.104 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:051.111 - 0.006ms returns 0 +T42A8 005:051.120 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:051.127 - 0.006ms returns 0 +T42A8 005:051.137 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:051.144 - 0.007ms returns 0 +T42A8 005:051.154 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:051.161 - 0.007ms returns 0 +T42A8 005:051.171 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:051.178 - 0.007ms returns 0 +T42A8 005:051.188 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:051.194 - 0.007ms returns 0 +T42A8 005:051.204 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:051.211 - 0.006ms returns 0 +T42A8 005:051.220 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:051.227 - 0.006ms returns 0 +T42A8 005:051.236 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:051.243 - 0.006ms returns 0 +T42A8 005:051.253 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:051.262 - 0.008ms returns 0x000000D1 +T42A8 005:051.278 JLINK_Go() +T42A8 005:051.293 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:057.548 - 6.269ms +T42A8 005:057.578 JLINK_IsHalted() +T42A8 005:058.443 - 0.863ms returns FALSE +T42A8 005:058.475 JLINK_HasError() +T42A8 005:060.058 JLINK_IsHalted() +T42A8 005:066.365 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:066.965 - 6.906ms returns TRUE +T42A8 005:066.985 JLINK_ReadReg(R15 (PC)) +T42A8 005:066.995 - 0.010ms returns 0x20003000 +T42A8 005:067.005 JLINK_ClrBPEx(BPHandle = 0x000000D1) +T42A8 005:067.012 - 0.007ms returns 0x00 +T42A8 005:067.021 JLINK_ReadReg(R0) +T42A8 005:067.028 - 0.006ms returns 0x00000000 +T42A8 005:067.595 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:067.609 Data: 06 9A 02 75 01 29 0B D0 00 20 03 90 20 7A 01 21 ... +T42A8 005:067.627 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:071.582 - 3.988ms returns 0x100 +T42A8 005:071.597 JLINK_HasError() +T42A8 005:071.607 JLINK_WriteReg(R0, 0x1800EA00) +T42A8 005:071.621 - 0.011ms returns 0 +T42A8 005:071.633 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:071.642 - 0.009ms returns 0 +T42A8 005:071.651 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:071.658 - 0.007ms returns 0 +T42A8 005:071.666 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:071.673 - 0.006ms returns 0 +T42A8 005:071.682 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:071.689 - 0.006ms returns 0 +T42A8 005:071.697 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:071.704 - 0.006ms returns 0 +T42A8 005:071.713 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:071.720 - 0.007ms returns 0 +T42A8 005:071.728 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:071.735 - 0.006ms returns 0 +T42A8 005:071.743 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:071.750 - 0.007ms returns 0 +T42A8 005:071.759 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:071.765 - 0.006ms returns 0 +T42A8 005:071.774 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:071.781 - 0.006ms returns 0 +T42A8 005:071.789 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:071.805 - 0.015ms returns 0 +T42A8 005:071.813 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:071.820 - 0.006ms returns 0 +T42A8 005:071.828 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:071.835 - 0.007ms returns 0 +T42A8 005:071.843 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:071.850 - 0.006ms returns 0 +T42A8 005:071.858 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:071.865 - 0.006ms returns 0 +T42A8 005:071.873 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:071.880 - 0.006ms returns 0 +T42A8 005:071.888 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:071.895 - 0.006ms returns 0 +T42A8 005:071.903 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:071.909 - 0.006ms returns 0 +T42A8 005:071.917 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:071.924 - 0.006ms returns 0 +T42A8 005:071.933 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:071.941 - 0.008ms returns 0x000000D2 +T42A8 005:071.949 JLINK_Go() +T42A8 005:071.961 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:078.187 - 6.237ms +T42A8 005:078.201 JLINK_IsHalted() +T42A8 005:078.930 - 0.728ms returns FALSE +T42A8 005:078.944 JLINK_HasError() +T42A8 005:081.863 JLINK_IsHalted() +T42A8 005:087.932 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:088.569 - 6.705ms returns TRUE +T42A8 005:088.585 JLINK_ReadReg(R15 (PC)) +T42A8 005:088.594 - 0.008ms returns 0x20003000 +T42A8 005:088.603 JLINK_ClrBPEx(BPHandle = 0x000000D2) +T42A8 005:088.610 - 0.007ms returns 0x00 +T42A8 005:088.619 JLINK_ReadReg(R0) +T42A8 005:088.626 - 0.006ms returns 0x00000000 +T42A8 005:089.118 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:089.129 Data: C0 92 00 20 FE FF FF 0F E2 04 00 00 01 60 00 00 ... +T42A8 005:089.144 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:093.031 - 3.913ms returns 0x100 +T42A8 005:093.047 JLINK_HasError() +T42A8 005:093.057 JLINK_WriteReg(R0, 0x1800EB00) +T42A8 005:093.065 - 0.008ms returns 0 +T42A8 005:093.074 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:093.081 - 0.007ms returns 0 +T42A8 005:093.089 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:093.097 - 0.007ms returns 0 +T42A8 005:093.105 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:093.115 - 0.010ms returns 0 +T42A8 005:093.126 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:093.133 - 0.006ms returns 0 +T42A8 005:093.141 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:093.148 - 0.006ms returns 0 +T42A8 005:093.157 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:093.163 - 0.006ms returns 0 +T42A8 005:093.172 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:093.179 - 0.006ms returns 0 +T42A8 005:093.187 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:093.194 - 0.006ms returns 0 +T42A8 005:093.202 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:093.209 - 0.006ms returns 0 +T42A8 005:093.217 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:093.225 - 0.006ms returns 0 +T42A8 005:093.233 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:093.239 - 0.006ms returns 0 +T42A8 005:093.248 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:093.256 - 0.008ms returns 0 +T42A8 005:093.265 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:093.272 - 0.007ms returns 0 +T42A8 005:093.281 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:093.288 - 0.007ms returns 0 +T42A8 005:093.297 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:093.304 - 0.007ms returns 0 +T42A8 005:093.312 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:093.319 - 0.007ms returns 0 +T42A8 005:093.327 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:093.334 - 0.006ms returns 0 +T42A8 005:093.343 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:093.349 - 0.006ms returns 0 +T42A8 005:093.358 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:093.365 - 0.006ms returns 0 +T42A8 005:093.373 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:093.381 - 0.008ms returns 0x000000D3 +T42A8 005:093.389 JLINK_Go() +T42A8 005:093.401 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:099.466 - 6.076ms +T42A8 005:099.490 JLINK_IsHalted() +T42A8 005:100.267 - 0.775ms returns FALSE +T42A8 005:100.292 JLINK_HasError() +T42A8 005:101.967 JLINK_IsHalted() +T42A8 005:108.200 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:108.859 - 6.892ms returns TRUE +T42A8 005:108.871 JLINK_ReadReg(R15 (PC)) +T42A8 005:108.879 - 0.007ms returns 0x20003000 +T42A8 005:108.886 JLINK_ClrBPEx(BPHandle = 0x000000D3) +T42A8 005:108.892 - 0.005ms returns 0x00 +T42A8 005:108.899 JLINK_ReadReg(R0) +T42A8 005:108.904 - 0.005ms returns 0x00000000 +T42A8 005:109.367 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:109.375 Data: 42 87 00 21 81 87 41 8F 03 22 C9 B2 92 02 11 43 ... +T42A8 005:109.387 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:113.230 - 3.863ms returns 0x100 +T42A8 005:113.242 JLINK_HasError() +T42A8 005:113.250 JLINK_WriteReg(R0, 0x1800EC00) +T42A8 005:113.257 - 0.007ms returns 0 +T42A8 005:113.265 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:113.270 - 0.005ms returns 0 +T42A8 005:113.277 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:113.283 - 0.005ms returns 0 +T42A8 005:113.290 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:113.296 - 0.005ms returns 0 +T42A8 005:113.303 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:113.309 - 0.005ms returns 0 +T42A8 005:113.316 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:113.321 - 0.005ms returns 0 +T42A8 005:113.329 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:113.335 - 0.006ms returns 0 +T42A8 005:113.342 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:113.348 - 0.005ms returns 0 +T42A8 005:113.355 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:113.361 - 0.005ms returns 0 +T42A8 005:113.368 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:113.373 - 0.005ms returns 0 +T42A8 005:113.380 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:113.386 - 0.005ms returns 0 +T42A8 005:113.393 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:113.399 - 0.005ms returns 0 +T42A8 005:113.405 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:113.411 - 0.005ms returns 0 +T42A8 005:113.418 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:113.424 - 0.006ms returns 0 +T42A8 005:113.431 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:113.437 - 0.005ms returns 0 +T42A8 005:113.444 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:113.450 - 0.005ms returns 0 +T42A8 005:113.457 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:113.462 - 0.005ms returns 0 +T42A8 005:113.469 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:113.478 - 0.008ms returns 0 +T42A8 005:113.486 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:113.492 - 0.005ms returns 0 +T42A8 005:113.499 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:113.505 - 0.005ms returns 0 +T42A8 005:113.512 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:113.519 - 0.006ms returns 0x000000D4 +T42A8 005:113.525 JLINK_Go() +T42A8 005:113.536 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:119.582 - 6.056ms +T42A8 005:119.597 JLINK_IsHalted() +T42A8 005:120.313 - 0.716ms returns FALSE +T42A8 005:120.328 JLINK_HasError() +T42A8 005:121.753 JLINK_IsHalted() +T42A8 005:127.789 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:128.427 - 6.674ms returns TRUE +T42A8 005:128.443 JLINK_ReadReg(R15 (PC)) +T42A8 005:128.453 - 0.009ms returns 0x20003000 +T42A8 005:128.462 JLINK_ClrBPEx(BPHandle = 0x000000D4) +T42A8 005:128.470 - 0.008ms returns 0x00 +T42A8 005:128.480 JLINK_ReadReg(R0) +T42A8 005:128.488 - 0.007ms returns 0x00000000 +T42A8 005:129.018 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:129.031 Data: FD F7 3E FC FD F7 C2 FE 20 68 00 68 04 F0 8E FC ... +T42A8 005:129.047 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:132.874 - 3.856ms returns 0x100 +T42A8 005:132.885 JLINK_HasError() +T42A8 005:132.892 JLINK_WriteReg(R0, 0x1800ED00) +T42A8 005:132.898 - 0.006ms returns 0 +T42A8 005:132.904 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:132.909 - 0.005ms returns 0 +T42A8 005:132.915 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:132.920 - 0.004ms returns 0 +T42A8 005:132.926 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:132.931 - 0.004ms returns 0 +T42A8 005:132.937 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:132.942 - 0.004ms returns 0 +T42A8 005:132.948 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:132.953 - 0.005ms returns 0 +T42A8 005:132.959 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:132.963 - 0.004ms returns 0 +T42A8 005:132.969 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:132.974 - 0.004ms returns 0 +T42A8 005:132.980 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:132.985 - 0.005ms returns 0 +T42A8 005:132.991 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:132.996 - 0.004ms returns 0 +T42A8 005:133.002 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:133.007 - 0.004ms returns 0 +T42A8 005:133.013 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:133.017 - 0.004ms returns 0 +T42A8 005:133.023 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:133.028 - 0.004ms returns 0 +T42A8 005:133.034 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:133.039 - 0.005ms returns 0 +T42A8 005:133.045 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:133.050 - 0.004ms returns 0 +T42A8 005:133.057 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:133.061 - 0.005ms returns 0 +T42A8 005:133.067 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:133.072 - 0.005ms returns 0 +T42A8 005:133.078 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:133.083 - 0.004ms returns 0 +T42A8 005:133.089 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:133.093 - 0.004ms returns 0 +T42A8 005:133.100 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:133.104 - 0.004ms returns 0 +T42A8 005:133.111 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:133.116 - 0.005ms returns 0x000000D5 +T42A8 005:133.122 JLINK_Go() +T42A8 005:133.131 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:138.901 - 5.778ms +T42A8 005:138.911 JLINK_IsHalted() +T42A8 005:139.546 - 0.635ms returns FALSE +T42A8 005:139.556 JLINK_HasError() +T42A8 005:144.853 JLINK_IsHalted() +T42A8 005:150.959 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:151.697 - 6.843ms returns TRUE +T42A8 005:151.728 JLINK_ReadReg(R15 (PC)) +T42A8 005:151.737 - 0.009ms returns 0x20003000 +T42A8 005:151.743 JLINK_ClrBPEx(BPHandle = 0x000000D5) +T42A8 005:151.749 - 0.005ms returns 0x00 +T42A8 005:151.755 JLINK_ReadReg(R0) +T42A8 005:151.762 - 0.006ms returns 0x00000000 +T42A8 005:152.219 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:152.232 Data: 40 39 79 18 CA 85 00 26 C6 84 20 46 FD F7 BF FA ... +T42A8 005:152.247 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:156.095 - 3.875ms returns 0x100 +T42A8 005:156.118 JLINK_HasError() +T42A8 005:156.129 JLINK_WriteReg(R0, 0x1800EE00) +T42A8 005:156.140 - 0.010ms returns 0 +T42A8 005:156.146 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:156.151 - 0.005ms returns 0 +T42A8 005:156.157 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:156.162 - 0.005ms returns 0 +T42A8 005:156.168 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:156.173 - 0.004ms returns 0 +T42A8 005:156.179 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:156.184 - 0.004ms returns 0 +T42A8 005:156.190 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:156.195 - 0.005ms returns 0 +T42A8 005:156.201 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:156.206 - 0.004ms returns 0 +T42A8 005:156.212 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:156.217 - 0.004ms returns 0 +T42A8 005:156.223 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:156.228 - 0.004ms returns 0 +T42A8 005:156.233 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:156.239 - 0.004ms returns 0 +T42A8 005:156.245 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:156.249 - 0.004ms returns 0 +T42A8 005:156.255 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:156.260 - 0.004ms returns 0 +T42A8 005:156.266 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:156.271 - 0.004ms returns 0 +T42A8 005:156.277 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:156.282 - 0.005ms returns 0 +T42A8 005:156.288 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:156.293 - 0.004ms returns 0 +T42A8 005:156.299 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:156.304 - 0.005ms returns 0 +T42A8 005:156.310 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:156.315 - 0.004ms returns 0 +T42A8 005:156.321 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:156.325 - 0.004ms returns 0 +T42A8 005:156.332 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:156.336 - 0.004ms returns 0 +T42A8 005:156.342 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:156.347 - 0.004ms returns 0 +T42A8 005:156.354 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:156.360 - 0.006ms returns 0x000000D6 +T42A8 005:156.366 JLINK_Go() +T42A8 005:156.377 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:162.731 - 6.364ms +T42A8 005:162.753 JLINK_IsHalted() +T42A8 005:163.426 - 0.672ms returns FALSE +T42A8 005:163.438 JLINK_HasError() +T42A8 005:164.668 JLINK_IsHalted() +T42A8 005:170.713 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:171.403 - 6.734ms returns TRUE +T42A8 005:171.417 JLINK_ReadReg(R15 (PC)) +T42A8 005:171.425 - 0.008ms returns 0x20003000 +T42A8 005:171.432 JLINK_ClrBPEx(BPHandle = 0x000000D6) +T42A8 005:171.438 - 0.005ms returns 0x00 +T42A8 005:171.445 JLINK_ReadReg(R0) +T42A8 005:171.451 - 0.005ms returns 0x00000000 +T42A8 005:171.989 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:172.002 Data: A1 76 A9 78 E1 76 26 46 29 78 20 36 F1 75 00 21 ... +T42A8 005:172.019 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:175.915 - 3.926ms returns 0x100 +T42A8 005:175.939 JLINK_HasError() +T42A8 005:175.947 JLINK_WriteReg(R0, 0x1800EF00) +T42A8 005:175.957 - 0.009ms returns 0 +T42A8 005:175.964 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:175.969 - 0.005ms returns 0 +T42A8 005:175.976 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:175.982 - 0.005ms returns 0 +T42A8 005:175.989 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:175.994 - 0.005ms returns 0 +T42A8 005:176.001 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:176.006 - 0.005ms returns 0 +T42A8 005:176.013 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:176.018 - 0.005ms returns 0 +T42A8 005:176.025 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:176.030 - 0.005ms returns 0 +T42A8 005:176.037 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:176.042 - 0.005ms returns 0 +T42A8 005:176.049 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:176.054 - 0.005ms returns 0 +T42A8 005:176.061 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:176.066 - 0.005ms returns 0 +T42A8 005:176.073 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:176.078 - 0.005ms returns 0 +T42A8 005:176.085 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:176.090 - 0.005ms returns 0 +T42A8 005:176.097 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:176.102 - 0.005ms returns 0 +T42A8 005:176.109 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:176.115 - 0.006ms returns 0 +T42A8 005:176.124 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:176.131 - 0.007ms returns 0 +T42A8 005:176.138 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:176.143 - 0.005ms returns 0 +T42A8 005:176.150 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:176.155 - 0.005ms returns 0 +T42A8 005:176.162 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:176.168 - 0.005ms returns 0 +T42A8 005:176.174 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:176.179 - 0.005ms returns 0 +T42A8 005:176.186 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:176.191 - 0.005ms returns 0 +T42A8 005:176.199 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:176.205 - 0.007ms returns 0x000000D7 +T42A8 005:176.212 JLINK_Go() +T42A8 005:176.224 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:182.320 - 6.107ms +T42A8 005:182.334 JLINK_IsHalted() +T42A8 005:183.031 - 0.696ms returns FALSE +T42A8 005:183.043 JLINK_HasError() +T42A8 005:185.612 JLINK_IsHalted() +T42A8 005:191.627 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:192.328 - 6.715ms returns TRUE +T42A8 005:192.338 JLINK_ReadReg(R15 (PC)) +T42A8 005:192.345 - 0.006ms returns 0x20003000 +T42A8 005:192.351 JLINK_ClrBPEx(BPHandle = 0x000000D7) +T42A8 005:192.357 - 0.005ms returns 0x00 +T42A8 005:192.363 JLINK_ReadReg(R0) +T42A8 005:192.369 - 0.005ms returns 0x00000000 +T42A8 005:192.809 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:192.817 Data: 00 21 81 60 A8 89 34 4A 50 43 32 4A 92 88 90 42 ... +T42A8 005:192.828 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:196.775 - 3.966ms returns 0x100 +T42A8 005:196.785 JLINK_HasError() +T42A8 005:196.792 JLINK_WriteReg(R0, 0x1800F000) +T42A8 005:196.798 - 0.006ms returns 0 +T42A8 005:196.805 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:196.810 - 0.005ms returns 0 +T42A8 005:196.816 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:196.821 - 0.005ms returns 0 +T42A8 005:196.827 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:196.833 - 0.005ms returns 0 +T42A8 005:196.839 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:196.844 - 0.005ms returns 0 +T42A8 005:196.850 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:196.855 - 0.005ms returns 0 +T42A8 005:196.861 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:196.865 - 0.005ms returns 0 +T42A8 005:196.872 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:196.877 - 0.005ms returns 0 +T42A8 005:196.883 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:196.889 - 0.006ms returns 0 +T42A8 005:196.895 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:196.900 - 0.005ms returns 0 +T42A8 005:196.906 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:196.911 - 0.005ms returns 0 +T42A8 005:196.917 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:196.922 - 0.005ms returns 0 +T42A8 005:196.929 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:196.933 - 0.005ms returns 0 +T42A8 005:196.940 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:196.945 - 0.005ms returns 0 +T42A8 005:196.951 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:196.956 - 0.005ms returns 0 +T42A8 005:196.962 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:196.967 - 0.005ms returns 0 +T42A8 005:196.973 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:196.979 - 0.005ms returns 0 +T42A8 005:196.985 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:196.989 - 0.004ms returns 0 +T42A8 005:196.996 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:197.001 - 0.005ms returns 0 +T42A8 005:197.007 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:197.012 - 0.004ms returns 0 +T42A8 005:197.018 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:197.024 - 0.005ms returns 0x000000D8 +T42A8 005:197.030 JLINK_Go() +T42A8 005:197.039 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:203.131 - 6.100ms +T42A8 005:203.141 JLINK_IsHalted() +T42A8 005:203.813 - 0.670ms returns FALSE +T42A8 005:203.823 JLINK_HasError() +T42A8 005:205.541 JLINK_IsHalted() +T42A8 005:211.521 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:212.171 - 6.629ms returns TRUE +T42A8 005:212.186 JLINK_ReadReg(R15 (PC)) +T42A8 005:212.195 - 0.008ms returns 0x20003000 +T42A8 005:212.203 JLINK_ClrBPEx(BPHandle = 0x000000D8) +T42A8 005:212.210 - 0.006ms returns 0x00 +T42A8 005:212.218 JLINK_ReadReg(R0) +T42A8 005:212.228 - 0.009ms returns 0x00000000 +T42A8 005:212.717 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:212.727 Data: 0E 21 00 23 39 82 50 4A 91 88 F9 83 D1 88 39 84 ... +T42A8 005:212.741 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:216.594 - 3.877ms returns 0x100 +T42A8 005:216.608 JLINK_HasError() +T42A8 005:216.618 JLINK_WriteReg(R0, 0x1800F100) +T42A8 005:216.627 - 0.008ms returns 0 +T42A8 005:216.636 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:216.643 - 0.007ms returns 0 +T42A8 005:216.652 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:216.659 - 0.007ms returns 0 +T42A8 005:216.668 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:216.675 - 0.007ms returns 0 +T42A8 005:216.684 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:216.691 - 0.007ms returns 0 +T42A8 005:216.699 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:216.707 - 0.007ms returns 0 +T42A8 005:216.715 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:216.723 - 0.007ms returns 0 +T42A8 005:216.731 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:216.738 - 0.007ms returns 0 +T42A8 005:216.747 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:216.754 - 0.007ms returns 0 +T42A8 005:216.763 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:216.770 - 0.007ms returns 0 +T42A8 005:216.778 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:216.785 - 0.007ms returns 0 +T42A8 005:216.794 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:216.801 - 0.007ms returns 0 +T42A8 005:216.810 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:216.817 - 0.007ms returns 0 +T42A8 005:216.826 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:216.833 - 0.007ms returns 0 +T42A8 005:216.842 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:216.849 - 0.007ms returns 0 +T42A8 005:216.858 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:216.865 - 0.007ms returns 0 +T42A8 005:216.874 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:216.881 - 0.007ms returns 0 +T42A8 005:216.890 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:216.897 - 0.007ms returns 0 +T42A8 005:216.905 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:216.913 - 0.006ms returns 0 +T42A8 005:216.921 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:216.928 - 0.007ms returns 0 +T42A8 005:216.937 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:216.945 - 0.008ms returns 0x000000D9 +T42A8 005:216.954 JLINK_Go() +T42A8 005:216.965 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:222.963 - 6.009ms +T42A8 005:222.979 JLINK_IsHalted() +T42A8 005:223.632 - 0.652ms returns FALSE +T42A8 005:223.648 JLINK_HasError() +T42A8 005:225.428 JLINK_IsHalted() +T42A8 005:231.687 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:232.476 - 7.047ms returns TRUE +T42A8 005:232.526 JLINK_ReadReg(R15 (PC)) +T42A8 005:232.536 - 0.009ms returns 0x20003000 +T42A8 005:232.543 JLINK_ClrBPEx(BPHandle = 0x000000D9) +T42A8 005:232.549 - 0.005ms returns 0x00 +T42A8 005:232.555 JLINK_ReadReg(R0) +T42A8 005:232.561 - 0.005ms returns 0x00000000 +T42A8 005:233.009 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:233.022 Data: 01 87 65 60 20 68 00 28 0B D0 0E 99 41 60 04 46 ... +T42A8 005:233.037 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:237.077 - 4.066ms returns 0x100 +T42A8 005:237.104 JLINK_HasError() +T42A8 005:237.113 JLINK_WriteReg(R0, 0x1800F200) +T42A8 005:237.122 - 0.009ms returns 0 +T42A8 005:237.129 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:237.134 - 0.005ms returns 0 +T42A8 005:237.141 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:237.146 - 0.005ms returns 0 +T42A8 005:237.154 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:237.159 - 0.005ms returns 0 +T42A8 005:237.167 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:237.173 - 0.005ms returns 0 +T42A8 005:237.180 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:237.185 - 0.005ms returns 0 +T42A8 005:237.193 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:237.198 - 0.005ms returns 0 +T42A8 005:237.205 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:237.211 - 0.005ms returns 0 +T42A8 005:237.218 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:237.223 - 0.005ms returns 0 +T42A8 005:237.231 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:237.236 - 0.005ms returns 0 +T42A8 005:237.244 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:237.253 - 0.009ms returns 0 +T42A8 005:237.263 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:237.269 - 0.005ms returns 0 +T42A8 005:237.275 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:237.281 - 0.005ms returns 0 +T42A8 005:237.287 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:237.293 - 0.006ms returns 0 +T42A8 005:237.301 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:237.306 - 0.005ms returns 0 +T42A8 005:237.313 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:237.319 - 0.005ms returns 0 +T42A8 005:237.326 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:237.331 - 0.005ms returns 0 +T42A8 005:237.339 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:237.344 - 0.005ms returns 0 +T42A8 005:237.362 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:237.367 - 0.005ms returns 0 +T42A8 005:237.374 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:237.379 - 0.005ms returns 0 +T42A8 005:237.386 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:237.393 - 0.007ms returns 0x000000DA +T42A8 005:237.400 JLINK_Go() +T42A8 005:237.413 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:243.495 - 6.095ms +T42A8 005:243.527 JLINK_IsHalted() +T42A8 005:244.171 - 0.643ms returns FALSE +T42A8 005:244.182 JLINK_HasError() +T42A8 005:249.564 JLINK_IsHalted() +T42A8 005:255.826 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:256.591 - 7.025ms returns TRUE +T42A8 005:256.617 JLINK_ReadReg(R15 (PC)) +T42A8 005:256.626 - 0.008ms returns 0x20003000 +T42A8 005:256.633 JLINK_ClrBPEx(BPHandle = 0x000000DA) +T42A8 005:256.639 - 0.006ms returns 0x00 +T42A8 005:256.646 JLINK_ReadReg(R0) +T42A8 005:256.652 - 0.005ms returns 0x00000000 +T42A8 005:257.225 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:257.243 Data: 89 1A 09 01 09 09 81 42 03 D3 25 46 24 68 00 2C ... +T42A8 005:257.263 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:261.342 - 4.117ms returns 0x100 +T42A8 005:261.369 JLINK_HasError() +T42A8 005:261.379 JLINK_WriteReg(R0, 0x1800F300) +T42A8 005:261.389 - 0.010ms returns 0 +T42A8 005:261.397 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:261.402 - 0.005ms returns 0 +T42A8 005:261.408 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:261.413 - 0.005ms returns 0 +T42A8 005:261.421 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:261.426 - 0.005ms returns 0 +T42A8 005:261.433 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:261.438 - 0.005ms returns 0 +T42A8 005:261.444 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:261.449 - 0.005ms returns 0 +T42A8 005:261.455 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:261.461 - 0.005ms returns 0 +T42A8 005:261.467 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:261.473 - 0.005ms returns 0 +T42A8 005:261.479 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:261.484 - 0.005ms returns 0 +T42A8 005:261.490 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:261.495 - 0.005ms returns 0 +T42A8 005:261.501 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:261.506 - 0.005ms returns 0 +T42A8 005:261.513 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:261.518 - 0.005ms returns 0 +T42A8 005:261.524 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:261.529 - 0.005ms returns 0 +T42A8 005:261.535 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:261.541 - 0.005ms returns 0 +T42A8 005:261.548 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:261.553 - 0.005ms returns 0 +T42A8 005:261.559 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:261.565 - 0.005ms returns 0 +T42A8 005:261.571 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:261.576 - 0.005ms returns 0 +T42A8 005:261.582 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:261.587 - 0.005ms returns 0 +T42A8 005:261.593 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:261.598 - 0.005ms returns 0 +T42A8 005:261.605 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:261.610 - 0.005ms returns 0 +T42A8 005:261.617 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:261.623 - 0.006ms returns 0x000000DB +T42A8 005:261.630 JLINK_Go() +T42A8 005:261.673 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:268.181 - 6.550ms +T42A8 005:268.205 JLINK_IsHalted() +T42A8 005:269.033 - 0.826ms returns FALSE +T42A8 005:269.057 JLINK_HasError() +T42A8 005:272.391 JLINK_IsHalted() +T42A8 005:278.461 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:279.164 - 6.767ms returns TRUE +T42A8 005:279.181 JLINK_ReadReg(R15 (PC)) +T42A8 005:279.189 - 0.008ms returns 0x20003000 +T42A8 005:279.196 JLINK_ClrBPEx(BPHandle = 0x000000DB) +T42A8 005:279.201 - 0.005ms returns 0x00 +T42A8 005:279.208 JLINK_ReadReg(R0) +T42A8 005:279.213 - 0.005ms returns 0x00000000 +T42A8 005:279.693 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:279.707 Data: 69 46 88 81 30 88 3A 49 40 18 04 90 37 79 01 2F ... +T42A8 005:279.722 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:283.600 - 3.906ms returns 0x100 +T42A8 005:283.622 JLINK_HasError() +T42A8 005:283.631 JLINK_WriteReg(R0, 0x1800F400) +T42A8 005:283.661 - 0.030ms returns 0 +T42A8 005:283.669 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:283.674 - 0.005ms returns 0 +T42A8 005:283.681 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:283.685 - 0.005ms returns 0 +T42A8 005:283.692 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:283.697 - 0.004ms returns 0 +T42A8 005:283.703 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:283.708 - 0.004ms returns 0 +T42A8 005:283.714 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:283.719 - 0.005ms returns 0 +T42A8 005:283.725 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:283.730 - 0.004ms returns 0 +T42A8 005:283.736 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:283.741 - 0.004ms returns 0 +T42A8 005:283.747 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:283.752 - 0.005ms returns 0 +T42A8 005:283.758 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:283.763 - 0.005ms returns 0 +T42A8 005:283.769 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:283.774 - 0.005ms returns 0 +T42A8 005:283.780 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:283.785 - 0.004ms returns 0 +T42A8 005:283.791 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:283.796 - 0.004ms returns 0 +T42A8 005:283.802 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:283.808 - 0.005ms returns 0 +T42A8 005:283.814 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:283.819 - 0.004ms returns 0 +T42A8 005:283.825 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:283.830 - 0.005ms returns 0 +T42A8 005:283.836 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:283.841 - 0.005ms returns 0 +T42A8 005:283.847 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:283.852 - 0.004ms returns 0 +T42A8 005:283.858 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:283.863 - 0.005ms returns 0 +T42A8 005:283.869 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:283.874 - 0.005ms returns 0 +T42A8 005:283.881 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:283.887 - 0.006ms returns 0x000000DC +T42A8 005:283.893 JLINK_Go() +T42A8 005:283.904 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:290.076 - 6.182ms +T42A8 005:290.097 JLINK_IsHalted() +T42A8 005:290.663 - 0.565ms returns FALSE +T42A8 005:290.689 JLINK_HasError() +T42A8 005:296.313 JLINK_IsHalted() +T42A8 005:302.319 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:302.971 - 6.657ms returns TRUE +T42A8 005:302.981 JLINK_ReadReg(R15 (PC)) +T42A8 005:302.989 - 0.007ms returns 0x20003000 +T42A8 005:302.995 JLINK_ClrBPEx(BPHandle = 0x000000DC) +T42A8 005:303.001 - 0.005ms returns 0x00 +T42A8 005:303.007 JLINK_ReadReg(R0) +T42A8 005:303.013 - 0.005ms returns 0x00000000 +T42A8 005:303.404 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:303.413 Data: 1D 46 0C 46 01 28 07 D0 03 28 0B D0 40 22 19 46 ... +T42A8 005:303.424 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:307.245 - 3.840ms returns 0x100 +T42A8 005:307.256 JLINK_HasError() +T42A8 005:307.264 JLINK_WriteReg(R0, 0x1800F500) +T42A8 005:307.270 - 0.006ms returns 0 +T42A8 005:307.277 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:307.282 - 0.005ms returns 0 +T42A8 005:307.288 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:307.293 - 0.005ms returns 0 +T42A8 005:307.300 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:307.305 - 0.005ms returns 0 +T42A8 005:307.311 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:307.316 - 0.005ms returns 0 +T42A8 005:307.323 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:307.328 - 0.005ms returns 0 +T42A8 005:307.334 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:307.339 - 0.005ms returns 0 +T42A8 005:307.350 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:307.356 - 0.005ms returns 0 +T42A8 005:307.362 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:307.367 - 0.005ms returns 0 +T42A8 005:307.373 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:307.379 - 0.005ms returns 0 +T42A8 005:307.385 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:307.390 - 0.005ms returns 0 +T42A8 005:307.397 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:307.403 - 0.006ms returns 0 +T42A8 005:307.409 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:307.414 - 0.005ms returns 0 +T42A8 005:307.421 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:307.426 - 0.005ms returns 0 +T42A8 005:307.433 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:307.437 - 0.004ms returns 0 +T42A8 005:307.444 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:307.449 - 0.005ms returns 0 +T42A8 005:307.456 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:307.461 - 0.005ms returns 0 +T42A8 005:307.467 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:307.472 - 0.005ms returns 0 +T42A8 005:307.478 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:307.483 - 0.004ms returns 0 +T42A8 005:307.489 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:307.494 - 0.005ms returns 0 +T42A8 005:307.501 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:307.507 - 0.007ms returns 0x000000DD +T42A8 005:307.513 JLINK_Go() +T42A8 005:307.523 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:313.621 - 6.107ms +T42A8 005:313.632 JLINK_IsHalted() +T42A8 005:314.215 - 0.583ms returns FALSE +T42A8 005:314.225 JLINK_HasError() +T42A8 005:316.293 JLINK_IsHalted() +T42A8 005:322.310 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:322.940 - 6.647ms returns TRUE +T42A8 005:322.953 JLINK_ReadReg(R15 (PC)) +T42A8 005:322.959 - 0.006ms returns 0x20003000 +T42A8 005:322.966 JLINK_ClrBPEx(BPHandle = 0x000000DD) +T42A8 005:322.972 - 0.005ms returns 0x00 +T42A8 005:322.979 JLINK_ReadReg(R0) +T42A8 005:322.984 - 0.005ms returns 0x00000000 +T42A8 005:323.363 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:323.371 Data: 1B D0 61 48 00 68 00 28 17 D0 01 78 19 29 14 D1 ... +T42A8 005:323.382 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:327.251 - 3.888ms returns 0x100 +T42A8 005:327.264 JLINK_HasError() +T42A8 005:327.272 JLINK_WriteReg(R0, 0x1800F600) +T42A8 005:327.279 - 0.007ms returns 0 +T42A8 005:327.286 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:327.292 - 0.005ms returns 0 +T42A8 005:327.299 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:327.305 - 0.005ms returns 0 +T42A8 005:327.312 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:327.317 - 0.005ms returns 0 +T42A8 005:327.325 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:327.330 - 0.005ms returns 0 +T42A8 005:327.337 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:327.343 - 0.005ms returns 0 +T42A8 005:327.350 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:327.355 - 0.005ms returns 0 +T42A8 005:327.362 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:327.368 - 0.005ms returns 0 +T42A8 005:327.375 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:327.381 - 0.005ms returns 0 +T42A8 005:327.388 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:327.393 - 0.005ms returns 0 +T42A8 005:327.400 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:327.406 - 0.005ms returns 0 +T42A8 005:327.413 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:327.418 - 0.005ms returns 0 +T42A8 005:327.425 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:327.431 - 0.005ms returns 0 +T42A8 005:327.438 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:327.444 - 0.006ms returns 0 +T42A8 005:327.451 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:327.457 - 0.006ms returns 0 +T42A8 005:327.465 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:327.470 - 0.006ms returns 0 +T42A8 005:327.477 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:327.483 - 0.006ms returns 0 +T42A8 005:327.490 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:327.496 - 0.005ms returns 0 +T42A8 005:327.503 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:327.508 - 0.005ms returns 0 +T42A8 005:327.515 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:327.521 - 0.005ms returns 0 +T42A8 005:327.528 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:327.537 - 0.008ms returns 0x000000DE +T42A8 005:327.546 JLINK_Go() +T42A8 005:327.557 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:333.639 - 6.093ms +T42A8 005:333.651 JLINK_IsHalted() +T42A8 005:334.254 - 0.602ms returns FALSE +T42A8 005:334.266 JLINK_HasError() +T42A8 005:336.135 JLINK_IsHalted() +T42A8 005:342.178 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:342.735 - 6.601ms returns TRUE +T42A8 005:342.746 JLINK_ReadReg(R15 (PC)) +T42A8 005:342.752 - 0.006ms returns 0x20003000 +T42A8 005:342.759 JLINK_ClrBPEx(BPHandle = 0x000000DE) +T42A8 005:342.764 - 0.005ms returns 0x00 +T42A8 005:342.770 JLINK_ReadReg(R0) +T42A8 005:342.775 - 0.004ms returns 0x00000000 +T42A8 005:343.180 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:343.188 Data: 01 89 00 25 08 23 06 22 22 48 03 F0 F5 FF 1F 4B ... +T42A8 005:343.198 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:347.195 - 4.015ms returns 0x100 +T42A8 005:347.205 JLINK_HasError() +T42A8 005:347.212 JLINK_WriteReg(R0, 0x1800F700) +T42A8 005:347.218 - 0.006ms returns 0 +T42A8 005:347.224 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:347.229 - 0.004ms returns 0 +T42A8 005:347.235 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:347.239 - 0.004ms returns 0 +T42A8 005:347.245 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:347.250 - 0.004ms returns 0 +T42A8 005:347.256 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:347.260 - 0.004ms returns 0 +T42A8 005:347.266 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:347.271 - 0.004ms returns 0 +T42A8 005:347.277 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:347.281 - 0.004ms returns 0 +T42A8 005:347.287 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:347.292 - 0.004ms returns 0 +T42A8 005:347.297 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:347.302 - 0.004ms returns 0 +T42A8 005:347.308 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:347.312 - 0.004ms returns 0 +T42A8 005:347.318 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:347.323 - 0.004ms returns 0 +T42A8 005:347.329 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:347.333 - 0.004ms returns 0 +T42A8 005:347.339 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:347.343 - 0.004ms returns 0 +T42A8 005:347.349 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:347.354 - 0.005ms returns 0 +T42A8 005:347.360 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:347.365 - 0.004ms returns 0 +T42A8 005:347.371 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:347.375 - 0.004ms returns 0 +T42A8 005:347.381 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:347.386 - 0.004ms returns 0 +T42A8 005:347.391 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:347.396 - 0.004ms returns 0 +T42A8 005:347.402 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:347.406 - 0.004ms returns 0 +T42A8 005:347.412 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:347.417 - 0.004ms returns 0 +T42A8 005:347.423 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:347.429 - 0.005ms returns 0x000000DF +T42A8 005:347.434 JLINK_Go() +T42A8 005:347.442 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:353.249 - 5.813ms +T42A8 005:353.277 JLINK_IsHalted() +T42A8 005:353.941 - 0.663ms returns FALSE +T42A8 005:353.951 JLINK_HasError() +T42A8 005:359.242 JLINK_IsHalted() +T42A8 005:365.517 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:366.188 - 6.945ms returns TRUE +T42A8 005:366.202 JLINK_ReadReg(R15 (PC)) +T42A8 005:366.210 - 0.007ms returns 0x20003000 +T42A8 005:366.216 JLINK_ClrBPEx(BPHandle = 0x000000DF) +T42A8 005:366.221 - 0.005ms returns 0x00 +T42A8 005:366.228 JLINK_ReadReg(R0) +T42A8 005:366.233 - 0.005ms returns 0x00000000 +T42A8 005:366.687 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:366.699 Data: 08 21 08 43 20 74 00 25 09 E0 A9 28 01 D0 AA 28 ... +T42A8 005:366.713 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:370.673 - 3.985ms returns 0x100 +T42A8 005:370.695 JLINK_HasError() +T42A8 005:370.703 JLINK_WriteReg(R0, 0x1800F800) +T42A8 005:370.711 - 0.008ms returns 0 +T42A8 005:370.717 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:370.722 - 0.005ms returns 0 +T42A8 005:370.728 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:370.733 - 0.005ms returns 0 +T42A8 005:370.739 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:370.763 - 0.023ms returns 0 +T42A8 005:370.776 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:370.781 - 0.005ms returns 0 +T42A8 005:370.786 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:370.791 - 0.004ms returns 0 +T42A8 005:370.797 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:370.802 - 0.005ms returns 0 +T42A8 005:370.809 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:370.814 - 0.005ms returns 0 +T42A8 005:370.820 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:370.825 - 0.005ms returns 0 +T42A8 005:370.831 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:370.836 - 0.005ms returns 0 +T42A8 005:370.842 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:370.847 - 0.004ms returns 0 +T42A8 005:370.853 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:370.858 - 0.004ms returns 0 +T42A8 005:370.864 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:370.869 - 0.004ms returns 0 +T42A8 005:370.875 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:370.880 - 0.005ms returns 0 +T42A8 005:370.886 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:370.891 - 0.004ms returns 0 +T42A8 005:370.897 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:370.902 - 0.005ms returns 0 +T42A8 005:370.908 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:370.913 - 0.004ms returns 0 +T42A8 005:370.918 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:370.923 - 0.004ms returns 0 +T42A8 005:370.929 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:370.934 - 0.004ms returns 0 +T42A8 005:370.940 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:370.945 - 0.004ms returns 0 +T42A8 005:370.951 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:370.958 - 0.006ms returns 0x000000E0 +T42A8 005:370.964 JLINK_Go() +T42A8 005:370.975 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:377.131 - 6.166ms +T42A8 005:377.147 JLINK_IsHalted() +T42A8 005:377.827 - 0.679ms returns FALSE +T42A8 005:377.837 JLINK_HasError() +T42A8 005:379.103 JLINK_IsHalted() +T42A8 005:385.051 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:385.609 - 6.505ms returns TRUE +T42A8 005:385.621 JLINK_ReadReg(R15 (PC)) +T42A8 005:385.629 - 0.007ms returns 0x20003000 +T42A8 005:385.635 JLINK_ClrBPEx(BPHandle = 0x000000E0) +T42A8 005:385.641 - 0.005ms returns 0x00 +T42A8 005:385.647 JLINK_ReadReg(R0) +T42A8 005:385.652 - 0.005ms returns 0x00000000 +T42A8 005:386.046 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:386.054 Data: D5 F8 05 46 01 28 0E D1 60 78 92 49 80 00 20 39 ... +T42A8 005:386.065 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:389.902 - 3.856ms returns 0x100 +T42A8 005:389.913 JLINK_HasError() +T42A8 005:389.920 JLINK_WriteReg(R0, 0x1800F900) +T42A8 005:389.926 - 0.006ms returns 0 +T42A8 005:389.932 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:389.937 - 0.004ms returns 0 +T42A8 005:389.948 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:389.953 - 0.005ms returns 0 +T42A8 005:389.981 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:389.986 - 0.004ms returns 0 +T42A8 005:389.992 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:389.997 - 0.005ms returns 0 +T42A8 005:390.003 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:390.008 - 0.004ms returns 0 +T42A8 005:390.027 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:390.031 - 0.004ms returns 0 +T42A8 005:390.037 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:390.042 - 0.004ms returns 0 +T42A8 005:390.048 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:390.052 - 0.004ms returns 0 +T42A8 005:390.073 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:390.078 - 0.004ms returns 0 +T42A8 005:390.084 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:390.089 - 0.004ms returns 0 +T42A8 005:390.095 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:390.113 - 0.004ms returns 0 +T42A8 005:390.118 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:390.139 - 0.020ms returns 0 +T42A8 005:390.145 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:390.150 - 0.005ms returns 0 +T42A8 005:390.156 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:390.211 - 0.055ms returns 0 +T42A8 005:390.218 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:390.232 - 0.014ms returns 0 +T42A8 005:390.238 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:390.243 - 0.005ms returns 0 +T42A8 005:390.249 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:390.261 - 0.012ms returns 0 +T42A8 005:390.268 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:390.273 - 0.005ms returns 0 +T42A8 005:390.279 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:390.284 - 0.005ms returns 0 +T42A8 005:390.293 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:390.301 - 0.008ms returns 0x000000E1 +T42A8 005:390.311 JLINK_Go() +T42A8 005:390.329 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:396.080 - 5.769ms +T42A8 005:396.099 JLINK_IsHalted() +T42A8 005:396.733 - 0.634ms returns FALSE +T42A8 005:396.744 JLINK_HasError() +T42A8 005:398.957 JLINK_IsHalted() +T42A8 005:405.100 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:406.025 - 7.066ms returns TRUE +T42A8 005:406.094 JLINK_ReadReg(R15 (PC)) +T42A8 005:406.126 - 0.031ms returns 0x20003000 +T42A8 005:406.155 JLINK_ClrBPEx(BPHandle = 0x000000E1) +T42A8 005:406.180 - 0.024ms returns 0x00 +T42A8 005:406.208 JLINK_ReadReg(R0) +T42A8 005:406.231 - 0.022ms returns 0x00000000 +T42A8 005:407.921 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:407.962 Data: 03 F0 93 FE FE BD 70 B5 52 4B 80 00 20 3B C0 18 ... +T42A8 005:408.013 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:412.126 - 4.203ms returns 0x100 +T42A8 005:412.240 JLINK_HasError() +T42A8 005:412.313 JLINK_WriteReg(R0, 0x1800FA00) +T42A8 005:412.348 - 0.035ms returns 0 +T42A8 005:412.539 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:412.589 - 0.051ms returns 0 +T42A8 005:412.621 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:412.647 - 0.025ms returns 0 +T42A8 005:412.677 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:412.701 - 0.024ms returns 0 +T42A8 005:412.755 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:412.778 - 0.023ms returns 0 +T42A8 005:412.806 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:412.828 - 0.022ms returns 0 +T42A8 005:412.855 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:412.877 - 0.022ms returns 0 +T42A8 005:412.905 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:412.935 - 0.029ms returns 0 +T42A8 005:412.963 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:412.987 - 0.023ms returns 0 +T42A8 005:413.015 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:413.036 - 0.021ms returns 0 +T42A8 005:413.063 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:413.085 - 0.021ms returns 0 +T42A8 005:413.111 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:413.133 - 0.021ms returns 0 +T42A8 005:413.159 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:413.180 - 0.021ms returns 0 +T42A8 005:413.207 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:413.229 - 0.023ms returns 0 +T42A8 005:413.256 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:413.277 - 0.021ms returns 0 +T42A8 005:413.306 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:413.327 - 0.023ms returns 0 +T42A8 005:413.354 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:413.375 - 0.021ms returns 0 +T42A8 005:413.402 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:413.427 - 0.025ms returns 0 +T42A8 005:413.454 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:413.477 - 0.022ms returns 0 +T42A8 005:413.503 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:413.525 - 0.022ms returns 0 +T42A8 005:413.555 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:413.581 - 0.027ms returns 0x000000E2 +T42A8 005:413.607 JLINK_Go() +T42A8 005:413.650 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:420.196 - 6.586ms +T42A8 005:420.261 JLINK_IsHalted() +T42A8 005:421.088 - 0.825ms returns FALSE +T42A8 005:421.156 JLINK_HasError() +T42A8 005:423.097 JLINK_IsHalted() +T42A8 005:429.404 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:430.183 - 7.086ms returns TRUE +T42A8 005:430.235 JLINK_ReadReg(R15 (PC)) +T42A8 005:430.265 - 0.029ms returns 0x20003000 +T42A8 005:430.295 JLINK_ClrBPEx(BPHandle = 0x000000E2) +T42A8 005:430.319 - 0.023ms returns 0x00 +T42A8 005:430.347 JLINK_ReadReg(R0) +T42A8 005:430.370 - 0.022ms returns 0x00000000 +T42A8 005:432.011 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:432.047 Data: DC B2 03 E0 01 20 00 E0 00 20 FB 24 0B 7B 6D 46 ... +T42A8 005:432.095 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:436.138 - 4.126ms returns 0x100 +T42A8 005:436.213 JLINK_HasError() +T42A8 005:436.251 JLINK_WriteReg(R0, 0x1800FB00) +T42A8 005:436.282 - 0.031ms returns 0 +T42A8 005:436.309 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:436.332 - 0.022ms returns 0 +T42A8 005:436.358 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:436.380 - 0.022ms returns 0 +T42A8 005:436.407 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:436.428 - 0.021ms returns 0 +T42A8 005:436.454 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:436.475 - 0.021ms returns 0 +T42A8 005:436.501 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:436.523 - 0.021ms returns 0 +T42A8 005:436.549 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:436.570 - 0.021ms returns 0 +T42A8 005:436.597 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:436.617 - 0.021ms returns 0 +T42A8 005:436.644 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:436.665 - 0.021ms returns 0 +T42A8 005:436.691 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:436.712 - 0.021ms returns 0 +T42A8 005:436.739 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:436.761 - 0.022ms returns 0 +T42A8 005:436.787 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:436.808 - 0.021ms returns 0 +T42A8 005:436.848 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:436.873 - 0.026ms returns 0 +T42A8 005:436.901 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:436.923 - 0.023ms returns 0 +T42A8 005:436.950 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:436.972 - 0.021ms returns 0 +T42A8 005:436.999 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:437.020 - 0.022ms returns 0 +T42A8 005:437.047 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:437.068 - 0.021ms returns 0 +T42A8 005:437.094 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:437.115 - 0.021ms returns 0 +T42A8 005:437.142 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:437.163 - 0.021ms returns 0 +T42A8 005:437.189 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:437.211 - 0.021ms returns 0 +T42A8 005:437.239 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:437.264 - 0.025ms returns 0x000000E3 +T42A8 005:437.290 JLINK_Go() +T42A8 005:437.330 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:444.053 - 6.760ms +T42A8 005:444.145 JLINK_IsHalted() +T42A8 005:444.933 - 0.785ms returns FALSE +T42A8 005:444.998 JLINK_HasError() +T42A8 005:446.902 JLINK_IsHalted() +T42A8 005:453.182 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:453.908 - 7.004ms returns TRUE +T42A8 005:453.978 JLINK_ReadReg(R15 (PC)) +T42A8 005:454.009 - 0.030ms returns 0x20003000 +T42A8 005:454.038 JLINK_ClrBPEx(BPHandle = 0x000000E3) +T42A8 005:454.061 - 0.023ms returns 0x00 +T42A8 005:454.089 JLINK_ReadReg(R0) +T42A8 005:454.110 - 0.021ms returns 0x00000000 +T42A8 005:455.957 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:455.995 Data: 18 E0 08 46 FD F7 68 FA 00 28 15 D0 1C 21 20 46 ... +T42A8 005:456.043 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:460.051 - 4.093ms returns 0x100 +T42A8 005:460.104 JLINK_HasError() +T42A8 005:460.136 JLINK_WriteReg(R0, 0x1800FC00) +T42A8 005:460.165 - 0.029ms returns 0 +T42A8 005:460.194 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:460.218 - 0.024ms returns 0 +T42A8 005:460.246 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:460.269 - 0.023ms returns 0 +T42A8 005:460.297 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:460.319 - 0.022ms returns 0 +T42A8 005:460.347 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:460.370 - 0.022ms returns 0 +T42A8 005:460.398 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:460.420 - 0.022ms returns 0 +T42A8 005:460.448 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:460.471 - 0.022ms returns 0 +T42A8 005:460.498 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:460.520 - 0.022ms returns 0 +T42A8 005:460.548 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:460.571 - 0.023ms returns 0 +T42A8 005:460.599 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:460.621 - 0.022ms returns 0 +T42A8 005:460.649 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:460.672 - 0.022ms returns 0 +T42A8 005:460.699 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:460.721 - 0.022ms returns 0 +T42A8 005:460.749 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:460.791 - 0.042ms returns 0 +T42A8 005:460.819 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:460.852 - 0.033ms returns 0 +T42A8 005:460.885 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:460.907 - 0.022ms returns 0 +T42A8 005:460.935 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:460.957 - 0.022ms returns 0 +T42A8 005:460.985 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:461.008 - 0.023ms returns 0 +T42A8 005:461.035 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:461.057 - 0.022ms returns 0 +T42A8 005:461.084 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:461.106 - 0.021ms returns 0 +T42A8 005:461.133 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:461.155 - 0.022ms returns 0 +T42A8 005:461.184 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:461.209 - 0.026ms returns 0x000000E4 +T42A8 005:461.237 JLINK_Go() +T42A8 005:461.276 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:467.473 - 6.234ms +T42A8 005:467.521 JLINK_IsHalted() +T42A8 005:468.309 - 0.785ms returns FALSE +T42A8 005:468.354 JLINK_HasError() +T42A8 005:489.704 JLINK_IsHalted() +T42A8 005:495.824 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:496.477 - 6.772ms returns TRUE +T42A8 005:496.499 JLINK_ReadReg(R15 (PC)) +T42A8 005:496.510 - 0.011ms returns 0x20003000 +T42A8 005:496.521 JLINK_ClrBPEx(BPHandle = 0x000000E4) +T42A8 005:496.530 - 0.008ms returns 0x00 +T42A8 005:496.540 JLINK_ReadReg(R0) +T42A8 005:496.548 - 0.008ms returns 0x00000000 +T42A8 005:497.263 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:497.281 Data: 00 E0 02 20 60 70 68 7D C0 07 03 D0 60 78 10 21 ... +T42A8 005:497.302 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:501.323 - 4.059ms returns 0x100 +T42A8 005:501.356 JLINK_HasError() +T42A8 005:501.369 JLINK_WriteReg(R0, 0x1800FD00) +T42A8 005:501.382 - 0.012ms returns 0 +T42A8 005:501.392 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:501.401 - 0.008ms returns 0 +T42A8 005:501.411 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:501.419 - 0.008ms returns 0 +T42A8 005:501.429 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:501.437 - 0.008ms returns 0 +T42A8 005:501.447 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:501.455 - 0.008ms returns 0 +T42A8 005:501.464 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:501.472 - 0.007ms returns 0 +T42A8 005:501.482 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:501.490 - 0.008ms returns 0 +T42A8 005:501.500 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:501.507 - 0.007ms returns 0 +T42A8 005:501.517 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:501.525 - 0.008ms returns 0 +T42A8 005:501.535 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:501.543 - 0.007ms returns 0 +T42A8 005:501.553 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:501.561 - 0.008ms returns 0 +T42A8 005:501.571 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:501.579 - 0.008ms returns 0 +T42A8 005:501.589 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:501.596 - 0.008ms returns 0 +T42A8 005:501.607 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:501.615 - 0.009ms returns 0 +T42A8 005:501.625 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:501.633 - 0.008ms returns 0 +T42A8 005:501.656 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:501.665 - 0.009ms returns 0 +T42A8 005:501.675 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:501.683 - 0.008ms returns 0 +T42A8 005:501.693 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:501.701 - 0.008ms returns 0 +T42A8 005:501.712 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:501.721 - 0.008ms returns 0 +T42A8 005:501.730 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:501.738 - 0.007ms returns 0 +T42A8 005:501.749 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:501.759 - 0.010ms returns 0x000000E5 +T42A8 005:501.769 JLINK_Go() +T42A8 005:501.785 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:507.906 - 6.136ms +T42A8 005:507.931 JLINK_IsHalted() +T42A8 005:508.551 - 0.619ms returns FALSE +T42A8 005:508.567 JLINK_HasError() +T42A8 005:510.661 JLINK_IsHalted() +T42A8 005:516.801 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:517.447 - 6.786ms returns TRUE +T42A8 005:517.457 JLINK_ReadReg(R15 (PC)) +T42A8 005:517.464 - 0.006ms returns 0x20003000 +T42A8 005:517.470 JLINK_ClrBPEx(BPHandle = 0x000000E5) +T42A8 005:517.475 - 0.005ms returns 0x00 +T42A8 005:517.485 JLINK_ReadReg(R0) +T42A8 005:517.491 - 0.006ms returns 0x00000000 +T42A8 005:517.905 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:517.913 Data: 08 D0 A1 70 A8 88 E0 80 E8 88 20 81 68 78 40 07 ... +T42A8 005:517.925 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:521.789 - 3.884ms returns 0x100 +T42A8 005:521.814 JLINK_HasError() +T42A8 005:521.821 JLINK_WriteReg(R0, 0x1800FE00) +T42A8 005:521.827 - 0.006ms returns 0 +T42A8 005:521.834 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:521.839 - 0.005ms returns 0 +T42A8 005:521.845 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:521.849 - 0.004ms returns 0 +T42A8 005:521.855 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:521.860 - 0.004ms returns 0 +T42A8 005:521.866 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:521.870 - 0.004ms returns 0 +T42A8 005:521.876 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:521.881 - 0.004ms returns 0 +T42A8 005:521.887 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:521.892 - 0.004ms returns 0 +T42A8 005:521.898 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:521.902 - 0.004ms returns 0 +T42A8 005:521.909 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:521.913 - 0.005ms returns 0 +T42A8 005:521.919 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:521.924 - 0.004ms returns 0 +T42A8 005:521.929 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:521.934 - 0.004ms returns 0 +T42A8 005:521.941 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:521.945 - 0.004ms returns 0 +T42A8 005:521.951 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:521.956 - 0.004ms returns 0 +T42A8 005:521.962 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:521.967 - 0.005ms returns 0 +T42A8 005:521.973 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:521.977 - 0.004ms returns 0 +T42A8 005:521.984 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:521.989 - 0.004ms returns 0 +T42A8 005:521.996 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:522.001 - 0.004ms returns 0 +T42A8 005:522.008 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:522.013 - 0.004ms returns 0 +T42A8 005:522.018 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:522.023 - 0.004ms returns 0 +T42A8 005:522.029 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:522.034 - 0.004ms returns 0 +T42A8 005:522.041 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:522.046 - 0.005ms returns 0x000000E6 +T42A8 005:522.052 JLINK_Go() +T42A8 005:522.060 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:528.198 - 6.146ms +T42A8 005:528.211 JLINK_IsHalted() +T42A8 005:528.808 - 0.597ms returns FALSE +T42A8 005:528.819 JLINK_HasError() +T42A8 005:530.711 JLINK_IsHalted() +T42A8 005:536.753 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:537.401 - 6.690ms returns TRUE +T42A8 005:537.411 JLINK_ReadReg(R15 (PC)) +T42A8 005:537.417 - 0.006ms returns 0x20003000 +T42A8 005:537.424 JLINK_ClrBPEx(BPHandle = 0x000000E6) +T42A8 005:537.429 - 0.005ms returns 0x00 +T42A8 005:537.435 JLINK_ReadReg(R0) +T42A8 005:537.440 - 0.005ms returns 0x00000000 +T42A8 005:537.798 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:537.806 Data: 40 24 FB E7 4B 24 F9 E7 70 B5 51 4E 00 25 B1 79 ... +T42A8 005:537.816 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:541.721 - 3.923ms returns 0x100 +T42A8 005:541.733 JLINK_HasError() +T42A8 005:541.741 JLINK_WriteReg(R0, 0x1800FF00) +T42A8 005:541.747 - 0.006ms returns 0 +T42A8 005:541.766 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:541.771 - 0.005ms returns 0 +T42A8 005:541.777 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:541.782 - 0.004ms returns 0 +T42A8 005:541.788 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:541.792 - 0.004ms returns 0 +T42A8 005:541.798 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:541.803 - 0.004ms returns 0 +T42A8 005:541.809 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:541.813 - 0.004ms returns 0 +T42A8 005:541.819 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:541.823 - 0.004ms returns 0 +T42A8 005:541.829 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:541.834 - 0.004ms returns 0 +T42A8 005:541.840 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:541.844 - 0.004ms returns 0 +T42A8 005:541.850 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:541.855 - 0.004ms returns 0 +T42A8 005:541.861 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:541.923 - 0.062ms returns 0 +T42A8 005:541.929 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:541.934 - 0.004ms returns 0 +T42A8 005:541.940 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:541.945 - 0.004ms returns 0 +T42A8 005:541.951 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:541.955 - 0.005ms returns 0 +T42A8 005:541.961 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:541.967 - 0.005ms returns 0 +T42A8 005:541.973 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:541.978 - 0.004ms returns 0 +T42A8 005:541.984 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:541.988 - 0.004ms returns 0 +T42A8 005:541.994 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:541.999 - 0.004ms returns 0 +T42A8 005:542.020 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:542.025 - 0.004ms returns 0 +T42A8 005:542.031 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:542.035 - 0.004ms returns 0 +T42A8 005:542.042 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:542.047 - 0.005ms returns 0x000000E7 +T42A8 005:542.053 JLINK_Go() +T42A8 005:542.062 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:548.183 - 6.129ms +T42A8 005:548.192 JLINK_IsHalted() +T42A8 005:548.947 - 0.755ms returns FALSE +T42A8 005:548.957 JLINK_HasError() +T42A8 005:550.567 JLINK_IsHalted() +T42A8 005:556.490 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:556.993 - 6.424ms returns TRUE +T42A8 005:557.009 JLINK_ReadReg(R15 (PC)) +T42A8 005:557.017 - 0.007ms returns 0x20003000 +T42A8 005:557.024 JLINK_ClrBPEx(BPHandle = 0x000000E7) +T42A8 005:557.030 - 0.005ms returns 0x00 +T42A8 005:557.037 JLINK_ReadReg(R0) +T42A8 005:557.042 - 0.005ms returns 0x00000000 +T42A8 005:557.493 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:557.506 Data: C0 0F 60 72 68 78 C0 07 0F D0 A8 88 60 81 E8 88 ... +T42A8 005:557.519 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:561.546 - 4.052ms returns 0x100 +T42A8 005:561.573 JLINK_HasError() +T42A8 005:561.584 JLINK_WriteReg(R0, 0x18010000) +T42A8 005:561.599 - 0.011ms returns 0 +T42A8 005:561.611 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:561.621 - 0.010ms returns 0 +T42A8 005:561.629 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:561.635 - 0.006ms returns 0 +T42A8 005:561.642 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:561.648 - 0.005ms returns 0 +T42A8 005:561.655 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:561.661 - 0.005ms returns 0 +T42A8 005:561.667 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:561.673 - 0.005ms returns 0 +T42A8 005:561.680 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:561.686 - 0.005ms returns 0 +T42A8 005:561.693 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:561.699 - 0.005ms returns 0 +T42A8 005:561.705 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:561.711 - 0.005ms returns 0 +T42A8 005:561.718 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:561.724 - 0.006ms returns 0 +T42A8 005:561.731 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:561.737 - 0.005ms returns 0 +T42A8 005:561.744 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:561.749 - 0.005ms returns 0 +T42A8 005:561.756 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:561.762 - 0.005ms returns 0 +T42A8 005:561.769 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:561.775 - 0.006ms returns 0 +T42A8 005:561.782 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:561.788 - 0.005ms returns 0 +T42A8 005:561.795 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:561.801 - 0.005ms returns 0 +T42A8 005:561.807 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:561.813 - 0.005ms returns 0 +T42A8 005:561.820 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:561.826 - 0.005ms returns 0 +T42A8 005:561.833 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:561.838 - 0.005ms returns 0 +T42A8 005:561.845 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:561.851 - 0.005ms returns 0 +T42A8 005:561.859 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:561.865 - 0.007ms returns 0x000000E8 +T42A8 005:561.872 JLINK_Go() +T42A8 005:561.885 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:568.332 - 6.459ms +T42A8 005:568.357 JLINK_IsHalted() +T42A8 005:569.043 - 0.685ms returns FALSE +T42A8 005:569.058 JLINK_HasError() +T42A8 005:570.523 JLINK_IsHalted() +T42A8 005:576.467 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:577.078 - 6.554ms returns TRUE +T42A8 005:577.094 JLINK_ReadReg(R15 (PC)) +T42A8 005:577.105 - 0.010ms returns 0x20003000 +T42A8 005:577.115 JLINK_ClrBPEx(BPHandle = 0x000000E8) +T42A8 005:577.123 - 0.008ms returns 0x00 +T42A8 005:577.133 JLINK_ReadReg(R0) +T42A8 005:577.141 - 0.007ms returns 0x00000000 +T42A8 005:577.809 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:577.821 Data: 08 1A 80 1C 68 80 30 46 24 68 0C 38 03 F0 8E FA ... +T42A8 005:577.839 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:581.690 - 3.882ms returns 0x100 +T42A8 005:581.709 JLINK_HasError() +T42A8 005:581.720 JLINK_WriteReg(R0, 0x18010100) +T42A8 005:581.729 - 0.010ms returns 0 +T42A8 005:581.739 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:581.747 - 0.008ms returns 0 +T42A8 005:581.758 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:581.766 - 0.007ms returns 0 +T42A8 005:581.777 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:581.785 - 0.007ms returns 0 +T42A8 005:581.795 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:581.803 - 0.007ms returns 0 +T42A8 005:581.814 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:581.822 - 0.007ms returns 0 +T42A8 005:581.833 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:581.841 - 0.007ms returns 0 +T42A8 005:581.852 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:581.859 - 0.007ms returns 0 +T42A8 005:581.870 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:581.878 - 0.007ms returns 0 +T42A8 005:581.889 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:581.897 - 0.007ms returns 0 +T42A8 005:581.907 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:581.915 - 0.007ms returns 0 +T42A8 005:581.926 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:581.933 - 0.007ms returns 0 +T42A8 005:581.945 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:581.952 - 0.007ms returns 0 +T42A8 005:581.963 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:581.971 - 0.008ms returns 0 +T42A8 005:581.982 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:581.990 - 0.007ms returns 0 +T42A8 005:582.001 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:582.009 - 0.008ms returns 0 +T42A8 005:582.019 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:582.027 - 0.007ms returns 0 +T42A8 005:582.038 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:582.046 - 0.007ms returns 0 +T42A8 005:582.057 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:582.064 - 0.007ms returns 0 +T42A8 005:582.075 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:582.083 - 0.007ms returns 0 +T42A8 005:582.095 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:582.103 - 0.009ms returns 0x000000E9 +T42A8 005:582.114 JLINK_Go() +T42A8 005:582.127 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:588.149 - 6.035ms +T42A8 005:588.167 JLINK_IsHalted() +T42A8 005:588.817 - 0.649ms returns FALSE +T42A8 005:588.834 JLINK_HasError() +T42A8 005:595.542 JLINK_IsHalted() +T42A8 005:601.665 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:602.429 - 6.885ms returns TRUE +T42A8 005:602.459 JLINK_ReadReg(R15 (PC)) +T42A8 005:602.471 - 0.012ms returns 0x20003000 +T42A8 005:602.481 JLINK_ClrBPEx(BPHandle = 0x000000E9) +T42A8 005:602.491 - 0.008ms returns 0x00 +T42A8 005:602.501 JLINK_ReadReg(R0) +T42A8 005:602.509 - 0.008ms returns 0x00000000 +T42A8 005:603.139 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:603.157 Data: 99 48 52 1D 80 1E 03 F0 77 FA 04 46 04 98 97 4B ... +T42A8 005:603.177 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:607.148 - 4.007ms returns 0x100 +T42A8 005:607.192 JLINK_HasError() +T42A8 005:607.209 JLINK_WriteReg(R0, 0x18010200) +T42A8 005:607.226 - 0.017ms returns 0 +T42A8 005:607.238 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:607.249 - 0.010ms returns 0 +T42A8 005:607.261 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:607.271 - 0.010ms returns 0 +T42A8 005:607.287 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:607.300 - 0.013ms returns 0 +T42A8 005:607.310 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:607.317 - 0.007ms returns 0 +T42A8 005:607.327 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:607.339 - 0.012ms returns 0 +T42A8 005:607.348 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:607.359 - 0.011ms returns 0 +T42A8 005:607.372 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:607.379 - 0.007ms returns 0 +T42A8 005:607.389 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:607.401 - 0.012ms returns 0 +T42A8 005:607.418 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:607.429 - 0.011ms returns 0 +T42A8 005:607.444 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:607.463 - 0.018ms returns 0 +T42A8 005:607.474 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:607.481 - 0.007ms returns 0 +T42A8 005:607.491 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:607.498 - 0.007ms returns 0 +T42A8 005:607.507 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:607.515 - 0.008ms returns 0 +T42A8 005:607.525 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:607.532 - 0.007ms returns 0 +T42A8 005:607.541 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:607.549 - 0.007ms returns 0 +T42A8 005:607.558 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:607.565 - 0.007ms returns 0 +T42A8 005:607.575 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:607.582 - 0.007ms returns 0 +T42A8 005:607.591 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:607.598 - 0.007ms returns 0 +T42A8 005:607.607 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:607.615 - 0.007ms returns 0 +T42A8 005:607.625 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:607.634 - 0.009ms returns 0x000000EA +T42A8 005:607.643 JLINK_Go() +T42A8 005:607.659 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:613.580 - 5.936ms +T42A8 005:613.604 JLINK_IsHalted() +T42A8 005:614.289 - 0.684ms returns FALSE +T42A8 005:614.306 JLINK_HasError() +T42A8 005:616.439 JLINK_IsHalted() +T42A8 005:622.369 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:622.906 - 6.466ms returns TRUE +T42A8 005:622.923 JLINK_ReadReg(R15 (PC)) +T42A8 005:622.935 - 0.010ms returns 0x20003000 +T42A8 005:622.945 JLINK_ClrBPEx(BPHandle = 0x000000EA) +T42A8 005:622.953 - 0.008ms returns 0x00 +T42A8 005:622.963 JLINK_ReadReg(R0) +T42A8 005:622.971 - 0.007ms returns 0x00000000 +T42A8 005:623.603 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:623.617 Data: B8 42 05 D8 00 22 01 21 03 98 F6 F7 C2 FE 0C E0 ... +T42A8 005:623.637 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:627.497 - 3.893ms returns 0x100 +T42A8 005:627.521 JLINK_HasError() +T42A8 005:627.533 JLINK_WriteReg(R0, 0x18010300) +T42A8 005:627.544 - 0.010ms returns 0 +T42A8 005:627.554 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:627.562 - 0.007ms returns 0 +T42A8 005:627.571 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:627.578 - 0.007ms returns 0 +T42A8 005:627.587 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:627.595 - 0.007ms returns 0 +T42A8 005:627.604 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:627.611 - 0.007ms returns 0 +T42A8 005:627.621 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:627.628 - 0.007ms returns 0 +T42A8 005:627.637 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:627.644 - 0.007ms returns 0 +T42A8 005:627.653 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:627.661 - 0.007ms returns 0 +T42A8 005:627.670 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:627.677 - 0.007ms returns 0 +T42A8 005:627.686 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:627.693 - 0.007ms returns 0 +T42A8 005:627.703 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:627.710 - 0.007ms returns 0 +T42A8 005:627.719 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:627.726 - 0.007ms returns 0 +T42A8 005:627.735 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:627.743 - 0.007ms returns 0 +T42A8 005:627.752 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:627.760 - 0.008ms returns 0 +T42A8 005:627.769 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:627.777 - 0.008ms returns 0 +T42A8 005:627.787 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:627.794 - 0.007ms returns 0 +T42A8 005:627.803 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:627.811 - 0.007ms returns 0 +T42A8 005:627.820 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:627.827 - 0.007ms returns 0 +T42A8 005:627.837 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:627.844 - 0.007ms returns 0 +T42A8 005:627.853 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:627.860 - 0.007ms returns 0 +T42A8 005:627.870 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:627.883 - 0.012ms returns 0x000000EB +T42A8 005:627.894 JLINK_Go() +T42A8 005:627.909 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:633.915 - 6.019ms +T42A8 005:633.931 JLINK_IsHalted() +T42A8 005:634.565 - 0.633ms returns FALSE +T42A8 005:634.580 JLINK_HasError() +T42A8 005:637.423 JLINK_IsHalted() +T42A8 005:643.466 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:644.045 - 6.621ms returns TRUE +T42A8 005:644.059 JLINK_ReadReg(R15 (PC)) +T42A8 005:644.065 - 0.006ms returns 0x20003000 +T42A8 005:644.072 JLINK_ClrBPEx(BPHandle = 0x000000EB) +T42A8 005:644.077 - 0.005ms returns 0x00 +T42A8 005:644.083 JLINK_ReadReg(R0) +T42A8 005:644.088 - 0.004ms returns 0x00000000 +T42A8 005:644.922 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:644.937 Data: 89 1C 02 9A 98 47 02 98 28 18 85 B2 30 46 03 F0 ... +T42A8 005:644.961 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:648.947 - 4.025ms returns 0x100 +T42A8 005:648.958 JLINK_HasError() +T42A8 005:648.965 JLINK_WriteReg(R0, 0x18010400) +T42A8 005:648.971 - 0.006ms returns 0 +T42A8 005:648.978 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:648.983 - 0.005ms returns 0 +T42A8 005:648.989 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:648.994 - 0.005ms returns 0 +T42A8 005:649.000 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:649.005 - 0.004ms returns 0 +T42A8 005:649.011 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:649.015 - 0.004ms returns 0 +T42A8 005:649.021 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:649.026 - 0.004ms returns 0 +T42A8 005:649.032 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:649.037 - 0.004ms returns 0 +T42A8 005:649.044 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:649.049 - 0.005ms returns 0 +T42A8 005:649.055 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:649.060 - 0.005ms returns 0 +T42A8 005:649.066 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:649.071 - 0.004ms returns 0 +T42A8 005:649.077 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:649.082 - 0.005ms returns 0 +T42A8 005:649.088 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:649.093 - 0.004ms returns 0 +T42A8 005:649.099 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:649.103 - 0.004ms returns 0 +T42A8 005:649.110 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:649.115 - 0.005ms returns 0 +T42A8 005:649.121 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:649.126 - 0.005ms returns 0 +T42A8 005:649.132 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:649.137 - 0.005ms returns 0 +T42A8 005:649.143 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:649.148 - 0.004ms returns 0 +T42A8 005:649.154 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:649.159 - 0.004ms returns 0 +T42A8 005:649.165 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:649.169 - 0.004ms returns 0 +T42A8 005:649.175 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:649.180 - 0.004ms returns 0 +T42A8 005:649.187 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:649.192 - 0.005ms returns 0x000000EC +T42A8 005:649.198 JLINK_Go() +T42A8 005:649.207 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:655.301 - 6.102ms +T42A8 005:655.311 JLINK_IsHalted() +T42A8 005:655.973 - 0.661ms returns FALSE +T42A8 005:655.983 JLINK_HasError() +T42A8 005:657.244 JLINK_IsHalted() +T42A8 005:663.319 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:663.968 - 6.723ms returns TRUE +T42A8 005:663.980 JLINK_ReadReg(R15 (PC)) +T42A8 005:663.987 - 0.007ms returns 0x20003000 +T42A8 005:663.994 JLINK_ClrBPEx(BPHandle = 0x000000EC) +T42A8 005:664.001 - 0.006ms returns 0x00 +T42A8 005:664.008 JLINK_ReadReg(R0) +T42A8 005:664.013 - 0.005ms returns 0x00000000 +T42A8 005:664.459 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:664.468 Data: 01 46 70 88 48 80 09 98 FF F7 B7 FD 00 20 0B B0 ... +T42A8 005:664.480 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:668.372 - 3.912ms returns 0x100 +T42A8 005:668.384 JLINK_HasError() +T42A8 005:668.393 JLINK_WriteReg(R0, 0x18010500) +T42A8 005:668.400 - 0.007ms returns 0 +T42A8 005:668.408 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:668.415 - 0.006ms returns 0 +T42A8 005:668.422 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:668.429 - 0.006ms returns 0 +T42A8 005:668.439 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:668.448 - 0.008ms returns 0 +T42A8 005:668.455 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:668.461 - 0.006ms returns 0 +T42A8 005:668.469 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:668.476 - 0.006ms returns 0 +T42A8 005:668.483 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:668.489 - 0.006ms returns 0 +T42A8 005:668.497 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:668.503 - 0.006ms returns 0 +T42A8 005:668.511 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:668.517 - 0.006ms returns 0 +T42A8 005:668.525 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:668.531 - 0.006ms returns 0 +T42A8 005:668.539 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:668.545 - 0.006ms returns 0 +T42A8 005:668.553 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:668.559 - 0.006ms returns 0 +T42A8 005:668.566 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:668.573 - 0.006ms returns 0 +T42A8 005:668.580 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:668.587 - 0.006ms returns 0 +T42A8 005:668.594 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:668.601 - 0.006ms returns 0 +T42A8 005:668.608 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:668.615 - 0.006ms returns 0 +T42A8 005:668.622 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:668.629 - 0.006ms returns 0 +T42A8 005:668.636 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:668.642 - 0.006ms returns 0 +T42A8 005:668.650 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:668.656 - 0.006ms returns 0 +T42A8 005:668.663 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:668.669 - 0.006ms returns 0 +T42A8 005:668.678 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:668.685 - 0.007ms returns 0x000000ED +T42A8 005:668.693 JLINK_Go() +T42A8 005:668.703 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:674.783 - 6.089ms +T42A8 005:674.800 JLINK_IsHalted() +T42A8 005:675.440 - 0.639ms returns FALSE +T42A8 005:675.457 JLINK_HasError() +T42A8 005:677.180 JLINK_IsHalted() +T42A8 005:683.183 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:683.950 - 6.768ms returns TRUE +T42A8 005:683.974 JLINK_ReadReg(R15 (PC)) +T42A8 005:683.982 - 0.008ms returns 0x20003000 +T42A8 005:683.989 JLINK_ClrBPEx(BPHandle = 0x000000ED) +T42A8 005:683.995 - 0.005ms returns 0x00 +T42A8 005:684.001 JLINK_ReadReg(R0) +T42A8 005:684.006 - 0.005ms returns 0x00000000 +T42A8 005:684.511 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:684.523 Data: 00 9B 08 58 9B 1D 40 68 0C 38 01 89 05 98 02 02 ... +T42A8 005:684.539 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:688.507 - 3.995ms returns 0x100 +T42A8 005:688.530 JLINK_HasError() +T42A8 005:688.538 JLINK_WriteReg(R0, 0x18010600) +T42A8 005:688.546 - 0.008ms returns 0 +T42A8 005:688.552 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:688.557 - 0.004ms returns 0 +T42A8 005:688.563 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:688.567 - 0.004ms returns 0 +T42A8 005:688.573 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:688.578 - 0.004ms returns 0 +T42A8 005:688.584 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:688.589 - 0.004ms returns 0 +T42A8 005:688.594 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:688.599 - 0.004ms returns 0 +T42A8 005:688.605 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:688.609 - 0.004ms returns 0 +T42A8 005:688.615 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:688.620 - 0.004ms returns 0 +T42A8 005:688.626 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:688.630 - 0.004ms returns 0 +T42A8 005:688.636 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:688.641 - 0.004ms returns 0 +T42A8 005:688.646 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:688.651 - 0.004ms returns 0 +T42A8 005:688.657 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:688.661 - 0.004ms returns 0 +T42A8 005:688.667 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:688.672 - 0.004ms returns 0 +T42A8 005:688.678 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:688.683 - 0.005ms returns 0 +T42A8 005:688.689 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:688.694 - 0.004ms returns 0 +T42A8 005:688.700 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:688.704 - 0.004ms returns 0 +T42A8 005:688.710 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:688.715 - 0.004ms returns 0 +T42A8 005:688.725 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:688.730 - 0.004ms returns 0 +T42A8 005:688.736 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:688.741 - 0.004ms returns 0 +T42A8 005:688.746 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:688.751 - 0.004ms returns 0 +T42A8 005:688.758 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:688.764 - 0.006ms returns 0x000000EE +T42A8 005:688.769 JLINK_Go() +T42A8 005:688.781 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:694.953 - 6.181ms +T42A8 005:694.975 JLINK_IsHalted() +T42A8 005:695.643 - 0.668ms returns FALSE +T42A8 005:695.655 JLINK_HasError() +T42A8 005:701.219 JLINK_IsHalted() +T42A8 005:707.386 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:708.005 - 6.785ms returns TRUE +T42A8 005:708.028 JLINK_ReadReg(R15 (PC)) +T42A8 005:708.038 - 0.009ms returns 0x20003000 +T42A8 005:708.047 JLINK_ClrBPEx(BPHandle = 0x000000EE) +T42A8 005:708.053 - 0.006ms returns 0x00 +T42A8 005:708.061 JLINK_ReadReg(R0) +T42A8 005:708.067 - 0.005ms returns 0x00000000 +T42A8 005:709.053 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:709.063 Data: 14 F8 20 88 E9 88 81 42 01 D8 00 22 25 E0 40 1C ... +T42A8 005:709.076 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:713.017 - 3.965ms returns 0x100 +T42A8 005:713.029 JLINK_HasError() +T42A8 005:713.036 JLINK_WriteReg(R0, 0x18010700) +T42A8 005:713.042 - 0.006ms returns 0 +T42A8 005:713.048 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:713.053 - 0.005ms returns 0 +T42A8 005:713.059 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:713.064 - 0.004ms returns 0 +T42A8 005:713.070 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:713.080 - 0.005ms returns 0 +T42A8 005:713.086 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:713.091 - 0.005ms returns 0 +T42A8 005:713.097 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:713.102 - 0.004ms returns 0 +T42A8 005:713.108 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:713.113 - 0.005ms returns 0 +T42A8 005:713.140 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:713.145 - 0.005ms returns 0 +T42A8 005:713.151 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:713.156 - 0.004ms returns 0 +T42A8 005:713.175 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:713.179 - 0.004ms returns 0 +T42A8 005:713.185 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:713.190 - 0.004ms returns 0 +T42A8 005:713.196 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:713.200 - 0.004ms returns 0 +T42A8 005:713.206 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:713.211 - 0.004ms returns 0 +T42A8 005:713.217 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:713.221 - 0.005ms returns 0 +T42A8 005:713.227 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:713.232 - 0.004ms returns 0 +T42A8 005:713.237 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:713.242 - 0.004ms returns 0 +T42A8 005:713.248 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:713.253 - 0.005ms returns 0 +T42A8 005:713.259 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:713.263 - 0.004ms returns 0 +T42A8 005:713.269 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:713.274 - 0.004ms returns 0 +T42A8 005:713.280 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:713.284 - 0.004ms returns 0 +T42A8 005:713.291 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:713.297 - 0.006ms returns 0x000000EF +T42A8 005:713.302 JLINK_Go() +T42A8 005:713.311 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:719.828 - 6.524ms +T42A8 005:719.865 JLINK_IsHalted() +T42A8 005:720.676 - 0.810ms returns FALSE +T42A8 005:720.701 JLINK_HasError() +T42A8 005:722.292 JLINK_IsHalted() +T42A8 005:728.440 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:729.168 - 6.874ms returns TRUE +T42A8 005:729.197 JLINK_ReadReg(R15 (PC)) +T42A8 005:729.207 - 0.009ms returns 0x20003000 +T42A8 005:729.214 JLINK_ClrBPEx(BPHandle = 0x000000EF) +T42A8 005:729.220 - 0.005ms returns 0x00 +T42A8 005:729.227 JLINK_ReadReg(R0) +T42A8 005:729.232 - 0.005ms returns 0x00000000 +T42A8 005:729.696 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:729.709 Data: 40 1B 81 42 00 D2 08 46 82 B2 A2 80 00 20 60 80 ... +T42A8 005:729.724 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:733.837 - 4.140ms returns 0x100 +T42A8 005:733.867 JLINK_HasError() +T42A8 005:733.876 JLINK_WriteReg(R0, 0x18010800) +T42A8 005:733.885 - 0.009ms returns 0 +T42A8 005:733.891 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:733.897 - 0.005ms returns 0 +T42A8 005:733.903 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:733.909 - 0.005ms returns 0 +T42A8 005:733.915 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:733.920 - 0.005ms returns 0 +T42A8 005:733.926 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:733.931 - 0.005ms returns 0 +T42A8 005:733.937 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:733.943 - 0.005ms returns 0 +T42A8 005:733.949 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:733.954 - 0.005ms returns 0 +T42A8 005:733.960 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:733.965 - 0.005ms returns 0 +T42A8 005:733.971 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:733.977 - 0.005ms returns 0 +T42A8 005:733.983 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:733.988 - 0.005ms returns 0 +T42A8 005:733.994 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:733.999 - 0.005ms returns 0 +T42A8 005:734.005 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:734.010 - 0.005ms returns 0 +T42A8 005:734.017 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:734.031 - 0.014ms returns 0 +T42A8 005:734.037 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:734.043 - 0.005ms returns 0 +T42A8 005:734.049 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:734.055 - 0.005ms returns 0 +T42A8 005:734.063 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:734.069 - 0.007ms returns 0 +T42A8 005:734.075 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:734.081 - 0.006ms returns 0 +T42A8 005:734.087 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:734.093 - 0.005ms returns 0 +T42A8 005:734.099 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:734.105 - 0.005ms returns 0 +T42A8 005:734.111 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:734.116 - 0.005ms returns 0 +T42A8 005:734.123 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:734.129 - 0.006ms returns 0x000000F0 +T42A8 005:734.135 JLINK_Go() +T42A8 005:734.147 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:740.210 - 6.073ms +T42A8 005:740.245 JLINK_IsHalted() +T42A8 005:740.840 - 0.594ms returns FALSE +T42A8 005:740.857 JLINK_HasError() +T42A8 005:743.110 JLINK_IsHalted() +T42A8 005:749.125 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:749.761 - 6.649ms returns TRUE +T42A8 005:749.773 JLINK_ReadReg(R15 (PC)) +T42A8 005:749.781 - 0.008ms returns 0x20003000 +T42A8 005:749.789 JLINK_ClrBPEx(BPHandle = 0x000000F0) +T42A8 005:749.796 - 0.006ms returns 0x00 +T42A8 005:749.803 JLINK_ReadReg(R0) +T42A8 005:749.809 - 0.006ms returns 0x00000000 +T42A8 005:750.337 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:750.347 Data: 0C 2A 03 D0 0F 2A 0B D0 41 22 04 E0 4A 89 09 89 ... +T42A8 005:750.363 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:754.188 - 3.851ms returns 0x100 +T42A8 005:754.202 JLINK_HasError() +T42A8 005:754.211 JLINK_WriteReg(R0, 0x18010900) +T42A8 005:754.219 - 0.008ms returns 0 +T42A8 005:754.228 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:754.235 - 0.007ms returns 0 +T42A8 005:754.243 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:754.250 - 0.007ms returns 0 +T42A8 005:754.259 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:754.265 - 0.006ms returns 0 +T42A8 005:754.273 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:754.280 - 0.006ms returns 0 +T42A8 005:754.288 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:754.295 - 0.006ms returns 0 +T42A8 005:754.303 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:754.309 - 0.006ms returns 0 +T42A8 005:754.317 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:754.324 - 0.006ms returns 0 +T42A8 005:754.332 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:754.340 - 0.008ms returns 0 +T42A8 005:754.348 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:754.355 - 0.006ms returns 0 +T42A8 005:754.363 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:754.370 - 0.006ms returns 0 +T42A8 005:754.378 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:754.385 - 0.006ms returns 0 +T42A8 005:754.393 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:754.400 - 0.006ms returns 0 +T42A8 005:754.408 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:754.419 - 0.011ms returns 0 +T42A8 005:754.429 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:754.436 - 0.006ms returns 0 +T42A8 005:754.444 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:754.451 - 0.006ms returns 0 +T42A8 005:754.459 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:754.466 - 0.006ms returns 0 +T42A8 005:754.474 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:754.481 - 0.006ms returns 0 +T42A8 005:754.489 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:754.495 - 0.006ms returns 0 +T42A8 005:754.503 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:754.510 - 0.006ms returns 0 +T42A8 005:754.519 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:754.526 - 0.007ms returns 0x000000F1 +T42A8 005:754.534 JLINK_Go() +T42A8 005:754.546 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:760.334 - 5.799ms +T42A8 005:760.350 JLINK_IsHalted() +T42A8 005:760.958 - 0.607ms returns FALSE +T42A8 005:760.973 JLINK_HasError() +T42A8 005:764.081 JLINK_IsHalted() +T42A8 005:770.115 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:770.758 - 6.677ms returns TRUE +T42A8 005:770.768 JLINK_ReadReg(R15 (PC)) +T42A8 005:770.775 - 0.006ms returns 0x20003000 +T42A8 005:770.782 JLINK_ClrBPEx(BPHandle = 0x000000F1) +T42A8 005:770.788 - 0.005ms returns 0x00 +T42A8 005:770.794 JLINK_ReadReg(R0) +T42A8 005:770.800 - 0.005ms returns 0x00000000 +T42A8 005:771.809 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:771.817 Data: F8 BD 00 00 B4 90 00 20 A3 0F 00 00 8C 90 00 20 ... +T42A8 005:771.842 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:775.753 - 3.944ms returns 0x100 +T42A8 005:775.773 JLINK_HasError() +T42A8 005:775.781 JLINK_WriteReg(R0, 0x18010A00) +T42A8 005:775.789 - 0.008ms returns 0 +T42A8 005:775.795 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:775.801 - 0.005ms returns 0 +T42A8 005:775.806 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:775.811 - 0.005ms returns 0 +T42A8 005:775.817 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:775.822 - 0.004ms returns 0 +T42A8 005:775.828 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:775.833 - 0.004ms returns 0 +T42A8 005:775.839 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:775.844 - 0.004ms returns 0 +T42A8 005:775.850 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:775.855 - 0.004ms returns 0 +T42A8 005:775.861 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:775.865 - 0.004ms returns 0 +T42A8 005:775.872 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:775.877 - 0.004ms returns 0 +T42A8 005:775.882 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:775.887 - 0.004ms returns 0 +T42A8 005:775.893 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:775.898 - 0.005ms returns 0 +T42A8 005:775.904 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:775.915 - 0.010ms returns 0 +T42A8 005:775.921 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:775.926 - 0.004ms returns 0 +T42A8 005:775.932 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:775.937 - 0.005ms returns 0 +T42A8 005:775.943 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:775.948 - 0.004ms returns 0 +T42A8 005:775.977 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:775.981 - 0.004ms returns 0 +T42A8 005:776.001 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:776.005 - 0.004ms returns 0 +T42A8 005:776.011 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:776.016 - 0.004ms returns 0 +T42A8 005:776.021 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:776.026 - 0.004ms returns 0 +T42A8 005:776.032 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:776.037 - 0.004ms returns 0 +T42A8 005:776.043 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:776.048 - 0.005ms returns 0x000000F2 +T42A8 005:776.054 JLINK_Go() +T42A8 005:776.063 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:781.987 - 5.932ms +T42A8 005:781.999 JLINK_IsHalted() +T42A8 005:782.586 - 0.586ms returns FALSE +T42A8 005:782.597 JLINK_HasError() +T42A8 005:784.042 JLINK_IsHalted() +T42A8 005:790.064 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:790.792 - 6.748ms returns TRUE +T42A8 005:790.850 JLINK_ReadReg(R15 (PC)) +T42A8 005:790.923 - 0.070ms returns 0x20003000 +T42A8 005:790.988 JLINK_ClrBPEx(BPHandle = 0x000000F2) +T42A8 005:791.027 - 0.044ms returns 0x00 +T42A8 005:791.076 JLINK_ReadReg(R0) +T42A8 005:791.101 - 0.024ms returns 0x00000000 +T42A8 005:792.725 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:792.761 Data: 20 D2 1C 20 DB 49 60 43 46 18 35 69 00 27 06 22 ... +T42A8 005:792.808 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:796.972 - 4.246ms returns 0x100 +T42A8 005:797.041 JLINK_HasError() +T42A8 005:797.075 JLINK_WriteReg(R0, 0x18010B00) +T42A8 005:797.107 - 0.032ms returns 0 +T42A8 005:797.135 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:797.159 - 0.024ms returns 0 +T42A8 005:797.187 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:797.209 - 0.022ms returns 0 +T42A8 005:797.237 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:797.328 - 0.091ms returns 0 +T42A8 005:797.359 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:797.380 - 0.022ms returns 0 +T42A8 005:797.407 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:797.428 - 0.021ms returns 0 +T42A8 005:797.454 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:797.476 - 0.021ms returns 0 +T42A8 005:797.502 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:797.523 - 0.021ms returns 0 +T42A8 005:797.550 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:797.571 - 0.021ms returns 0 +T42A8 005:797.597 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:797.618 - 0.021ms returns 0 +T42A8 005:797.645 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:797.666 - 0.021ms returns 0 +T42A8 005:797.692 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:797.713 - 0.021ms returns 0 +T42A8 005:797.739 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:797.761 - 0.021ms returns 0 +T42A8 005:797.787 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:797.810 - 0.023ms returns 0 +T42A8 005:797.837 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:797.875 - 0.038ms returns 0 +T42A8 005:797.903 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:797.925 - 0.022ms returns 0 +T42A8 005:797.951 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:797.972 - 0.021ms returns 0 +T42A8 005:797.999 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:798.020 - 0.021ms returns 0 +T42A8 005:798.047 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:798.068 - 0.021ms returns 0 +T42A8 005:798.094 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:798.115 - 0.021ms returns 0 +T42A8 005:798.144 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:798.169 - 0.026ms returns 0x000000F3 +T42A8 005:798.195 JLINK_Go() +T42A8 005:798.263 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:804.818 - 6.620ms +T42A8 005:804.947 JLINK_IsHalted() +T42A8 005:805.887 - 0.937ms returns FALSE +T42A8 005:805.953 JLINK_HasError() +T42A8 005:820.055 JLINK_IsHalted() +T42A8 005:826.147 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:826.889 - 6.833ms returns TRUE +T42A8 005:826.920 JLINK_ReadReg(R15 (PC)) +T42A8 005:826.929 - 0.008ms returns 0x20003000 +T42A8 005:826.935 JLINK_ClrBPEx(BPHandle = 0x000000F3) +T42A8 005:826.941 - 0.005ms returns 0x00 +T42A8 005:826.947 JLINK_ReadReg(R0) +T42A8 005:826.953 - 0.005ms returns 0x00000000 +T42A8 005:827.412 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:827.425 Data: 06 46 40 88 E9 78 40 18 40 28 05 D9 60 78 02 F0 ... +T42A8 005:827.440 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:831.399 - 3.986ms returns 0x100 +T42A8 005:831.423 JLINK_HasError() +T42A8 005:831.432 JLINK_WriteReg(R0, 0x18010C00) +T42A8 005:831.441 - 0.008ms returns 0 +T42A8 005:831.447 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:831.453 - 0.005ms returns 0 +T42A8 005:831.459 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:831.465 - 0.005ms returns 0 +T42A8 005:831.471 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:831.476 - 0.005ms returns 0 +T42A8 005:831.482 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:831.487 - 0.005ms returns 0 +T42A8 005:831.494 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:831.499 - 0.005ms returns 0 +T42A8 005:831.505 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:831.510 - 0.005ms returns 0 +T42A8 005:831.517 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:831.521 - 0.005ms returns 0 +T42A8 005:831.528 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:831.533 - 0.005ms returns 0 +T42A8 005:831.539 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:831.544 - 0.005ms returns 0 +T42A8 005:831.555 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:831.561 - 0.005ms returns 0 +T42A8 005:831.567 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:831.572 - 0.005ms returns 0 +T42A8 005:831.578 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:831.583 - 0.005ms returns 0 +T42A8 005:831.590 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:831.596 - 0.005ms returns 0 +T42A8 005:831.602 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:831.607 - 0.005ms returns 0 +T42A8 005:831.613 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:831.619 - 0.005ms returns 0 +T42A8 005:831.625 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:831.630 - 0.005ms returns 0 +T42A8 005:831.636 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:831.641 - 0.005ms returns 0 +T42A8 005:831.647 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:831.653 - 0.005ms returns 0 +T42A8 005:831.659 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:831.664 - 0.005ms returns 0 +T42A8 005:831.671 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:831.677 - 0.006ms returns 0x000000F4 +T42A8 005:831.685 JLINK_Go() +T42A8 005:831.696 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:837.932 - 6.247ms +T42A8 005:837.953 JLINK_IsHalted() +T42A8 005:838.641 - 0.686ms returns FALSE +T42A8 005:838.651 JLINK_HasError() +T42A8 005:842.850 JLINK_IsHalted() +T42A8 005:848.898 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:849.530 - 6.679ms returns TRUE +T42A8 005:849.541 JLINK_ReadReg(R15 (PC)) +T42A8 005:849.549 - 0.007ms returns 0x20003000 +T42A8 005:849.555 JLINK_ClrBPEx(BPHandle = 0x000000F4) +T42A8 005:849.561 - 0.005ms returns 0x00 +T42A8 005:849.568 JLINK_ReadReg(R0) +T42A8 005:849.574 - 0.005ms returns 0x00000000 +T42A8 005:849.971 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:849.980 Data: 02 28 0A D0 2A 79 69 88 38 46 26 69 FD F7 26 FB ... +T42A8 005:849.992 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:853.894 - 3.922ms returns 0x100 +T42A8 005:853.905 JLINK_HasError() +T42A8 005:853.912 JLINK_WriteReg(R0, 0x18010D00) +T42A8 005:853.919 - 0.006ms returns 0 +T42A8 005:853.925 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:853.930 - 0.005ms returns 0 +T42A8 005:853.937 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:853.942 - 0.005ms returns 0 +T42A8 005:853.948 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:853.953 - 0.005ms returns 0 +T42A8 005:853.959 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:853.965 - 0.005ms returns 0 +T42A8 005:853.971 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:853.976 - 0.005ms returns 0 +T42A8 005:853.982 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:853.987 - 0.005ms returns 0 +T42A8 005:853.993 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:853.999 - 0.005ms returns 0 +T42A8 005:854.005 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:854.010 - 0.005ms returns 0 +T42A8 005:854.017 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:854.021 - 0.005ms returns 0 +T42A8 005:854.028 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:854.033 - 0.005ms returns 0 +T42A8 005:854.039 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:854.044 - 0.005ms returns 0 +T42A8 005:854.051 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:854.056 - 0.005ms returns 0 +T42A8 005:854.062 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:854.067 - 0.005ms returns 0 +T42A8 005:854.073 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:854.079 - 0.005ms returns 0 +T42A8 005:854.085 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:854.090 - 0.005ms returns 0 +T42A8 005:854.097 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:854.101 - 0.005ms returns 0 +T42A8 005:854.108 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:854.113 - 0.005ms returns 0 +T42A8 005:854.119 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:854.124 - 0.005ms returns 0 +T42A8 005:854.130 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:854.135 - 0.005ms returns 0 +T42A8 005:854.142 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:854.148 - 0.006ms returns 0x000000F5 +T42A8 005:854.154 JLINK_Go() +T42A8 005:854.163 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:860.281 - 6.127ms +T42A8 005:860.294 JLINK_IsHalted() +T42A8 005:860.883 - 0.588ms returns FALSE +T42A8 005:860.893 JLINK_HasError() +T42A8 005:862.847 JLINK_IsHalted() +T42A8 005:868.897 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:869.587 - 6.738ms returns TRUE +T42A8 005:869.604 JLINK_ReadReg(R15 (PC)) +T42A8 005:869.612 - 0.008ms returns 0x20003000 +T42A8 005:869.619 JLINK_ClrBPEx(BPHandle = 0x000000F5) +T42A8 005:869.624 - 0.005ms returns 0x00 +T42A8 005:869.630 JLINK_ReadReg(R0) +T42A8 005:869.635 - 0.005ms returns 0x00000000 +T42A8 005:870.246 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:870.263 Data: 89 18 88 73 60 78 3C 28 09 D1 E0 78 00 28 01 D0 ... +T42A8 005:870.280 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:874.134 - 3.887ms returns 0x100 +T42A8 005:874.158 JLINK_HasError() +T42A8 005:874.167 JLINK_WriteReg(R0, 0x18010E00) +T42A8 005:874.176 - 0.008ms returns 0 +T42A8 005:874.182 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:874.188 - 0.005ms returns 0 +T42A8 005:874.195 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:874.200 - 0.005ms returns 0 +T42A8 005:874.206 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:874.212 - 0.005ms returns 0 +T42A8 005:874.218 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:874.223 - 0.005ms returns 0 +T42A8 005:874.229 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:874.235 - 0.005ms returns 0 +T42A8 005:874.241 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:874.248 - 0.006ms returns 0 +T42A8 005:874.254 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:874.259 - 0.005ms returns 0 +T42A8 005:874.266 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:874.271 - 0.005ms returns 0 +T42A8 005:874.277 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:874.283 - 0.005ms returns 0 +T42A8 005:874.289 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:874.295 - 0.005ms returns 0 +T42A8 005:874.303 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:874.308 - 0.005ms returns 0 +T42A8 005:874.315 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:874.321 - 0.007ms returns 0 +T42A8 005:874.329 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:874.334 - 0.006ms returns 0 +T42A8 005:874.341 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:874.346 - 0.005ms returns 0 +T42A8 005:874.352 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:874.357 - 0.005ms returns 0 +T42A8 005:874.363 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:874.369 - 0.005ms returns 0 +T42A8 005:874.375 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:874.380 - 0.005ms returns 0 +T42A8 005:874.386 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:874.391 - 0.005ms returns 0 +T42A8 005:874.397 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:874.402 - 0.005ms returns 0 +T42A8 005:874.409 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:874.415 - 0.006ms returns 0x000000F6 +T42A8 005:874.422 JLINK_Go() +T42A8 005:874.433 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:880.303 - 5.880ms +T42A8 005:880.316 JLINK_IsHalted() +T42A8 005:880.865 - 0.548ms returns FALSE +T42A8 005:880.877 JLINK_HasError() +T42A8 005:882.669 JLINK_IsHalted() +T42A8 005:888.760 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:889.396 - 6.727ms returns TRUE +T42A8 005:889.408 JLINK_ReadReg(R15 (PC)) +T42A8 005:889.414 - 0.006ms returns 0x20003000 +T42A8 005:889.421 JLINK_ClrBPEx(BPHandle = 0x000000F6) +T42A8 005:889.427 - 0.005ms returns 0x00 +T42A8 005:889.434 JLINK_ReadReg(R0) +T42A8 005:889.440 - 0.005ms returns 0x00000000 +T42A8 005:889.889 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:889.899 Data: DC 4A 00 20 1C 21 41 43 89 18 89 7B 06 29 01 D3 ... +T42A8 005:889.912 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:893.851 - 3.961ms returns 0x100 +T42A8 005:893.864 JLINK_HasError() +T42A8 005:893.872 JLINK_WriteReg(R0, 0x18010F00) +T42A8 005:893.880 - 0.007ms returns 0 +T42A8 005:893.887 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:893.893 - 0.006ms returns 0 +T42A8 005:893.901 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:893.907 - 0.006ms returns 0 +T42A8 005:893.914 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:893.920 - 0.006ms returns 0 +T42A8 005:893.927 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:893.933 - 0.005ms returns 0 +T42A8 005:893.940 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:893.946 - 0.005ms returns 0 +T42A8 005:893.953 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:893.965 - 0.011ms returns 0 +T42A8 005:893.972 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:893.978 - 0.005ms returns 0 +T42A8 005:893.985 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:893.991 - 0.006ms returns 0 +T42A8 005:893.998 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:894.004 - 0.005ms returns 0 +T42A8 005:894.011 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:894.017 - 0.005ms returns 0 +T42A8 005:894.024 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:894.030 - 0.005ms returns 0 +T42A8 005:894.037 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:894.043 - 0.005ms returns 0 +T42A8 005:894.050 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:894.057 - 0.006ms returns 0 +T42A8 005:894.064 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:894.070 - 0.005ms returns 0 +T42A8 005:894.077 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:894.083 - 0.006ms returns 0 +T42A8 005:894.091 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:894.097 - 0.006ms returns 0 +T42A8 005:894.104 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:894.109 - 0.005ms returns 0 +T42A8 005:894.117 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:894.122 - 0.005ms returns 0 +T42A8 005:894.129 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:894.135 - 0.006ms returns 0 +T42A8 005:894.143 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:894.149 - 0.006ms returns 0x000000F7 +T42A8 005:894.157 JLINK_Go() +T42A8 005:894.167 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:899.956 - 5.799ms +T42A8 005:899.968 JLINK_IsHalted() +T42A8 005:900.628 - 0.659ms returns FALSE +T42A8 005:900.639 JLINK_HasError() +T42A8 005:905.723 JLINK_IsHalted() +T42A8 005:911.851 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:912.609 - 6.884ms returns TRUE +T42A8 005:912.674 JLINK_ReadReg(R15 (PC)) +T42A8 005:912.683 - 0.022ms returns 0x20003000 +T42A8 005:912.690 JLINK_ClrBPEx(BPHandle = 0x000000F7) +T42A8 005:912.696 - 0.005ms returns 0x00 +T42A8 005:912.702 JLINK_ReadReg(R0) +T42A8 005:912.707 - 0.004ms returns 0x00000000 +T42A8 005:913.149 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:913.162 Data: 40 18 07 69 9C 4D 00 21 05 A8 A8 47 06 22 00 21 ... +T42A8 005:913.177 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:917.228 - 4.078ms returns 0x100 +T42A8 005:917.253 JLINK_HasError() +T42A8 005:917.261 JLINK_WriteReg(R0, 0x18011000) +T42A8 005:917.270 - 0.008ms returns 0 +T42A8 005:917.277 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:917.282 - 0.005ms returns 0 +T42A8 005:917.289 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:917.293 - 0.005ms returns 0 +T42A8 005:917.300 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:917.305 - 0.005ms returns 0 +T42A8 005:917.311 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:917.316 - 0.005ms returns 0 +T42A8 005:917.322 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:917.327 - 0.004ms returns 0 +T42A8 005:917.333 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:917.338 - 0.005ms returns 0 +T42A8 005:917.344 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:917.349 - 0.005ms returns 0 +T42A8 005:917.355 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:917.360 - 0.005ms returns 0 +T42A8 005:917.366 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:917.372 - 0.005ms returns 0 +T42A8 005:917.379 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:917.384 - 0.005ms returns 0 +T42A8 005:917.391 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:917.395 - 0.005ms returns 0 +T42A8 005:917.402 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:917.407 - 0.004ms returns 0 +T42A8 005:917.413 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:917.418 - 0.005ms returns 0 +T42A8 005:917.424 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:917.429 - 0.004ms returns 0 +T42A8 005:917.435 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:917.441 - 0.005ms returns 0 +T42A8 005:917.447 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:917.452 - 0.005ms returns 0 +T42A8 005:917.458 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:917.463 - 0.004ms returns 0 +T42A8 005:917.469 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:917.473 - 0.004ms returns 0 +T42A8 005:917.480 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:917.485 - 0.005ms returns 0 +T42A8 005:917.495 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:917.503 - 0.008ms returns 0x000000F8 +T42A8 005:917.509 JLINK_Go() +T42A8 005:917.521 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:923.705 - 6.194ms +T42A8 005:923.738 JLINK_IsHalted() +T42A8 005:924.306 - 0.567ms returns FALSE +T42A8 005:924.321 JLINK_HasError() +T42A8 005:925.576 JLINK_IsHalted() +T42A8 005:931.478 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:932.095 - 6.518ms returns TRUE +T42A8 005:932.121 JLINK_ReadReg(R15 (PC)) +T42A8 005:932.131 - 0.009ms returns 0x20003000 +T42A8 005:932.137 JLINK_ClrBPEx(BPHandle = 0x000000F8) +T42A8 005:932.144 - 0.006ms returns 0x00 +T42A8 005:932.151 JLINK_ReadReg(R0) +T42A8 005:932.156 - 0.005ms returns 0x00000000 +T42A8 005:932.727 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:932.736 Data: 1C FA 00 28 2B D0 F1 7A 0C 98 81 42 27 D1 B1 7A ... +T42A8 005:932.751 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:936.629 - 3.901ms returns 0x100 +T42A8 005:936.652 JLINK_HasError() +T42A8 005:936.662 JLINK_WriteReg(R0, 0x18011100) +T42A8 005:936.669 - 0.007ms returns 0 +T42A8 005:936.676 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:936.681 - 0.005ms returns 0 +T42A8 005:936.687 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:936.692 - 0.005ms returns 0 +T42A8 005:936.698 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:936.703 - 0.005ms returns 0 +T42A8 005:936.709 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:936.714 - 0.005ms returns 0 +T42A8 005:936.720 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:936.725 - 0.004ms returns 0 +T42A8 005:936.731 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:936.736 - 0.004ms returns 0 +T42A8 005:936.742 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:936.747 - 0.005ms returns 0 +T42A8 005:936.753 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:936.758 - 0.005ms returns 0 +T42A8 005:936.764 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:936.769 - 0.004ms returns 0 +T42A8 005:936.775 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:936.780 - 0.005ms returns 0 +T42A8 005:936.786 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:936.791 - 0.005ms returns 0 +T42A8 005:936.797 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:936.802 - 0.004ms returns 0 +T42A8 005:936.808 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:936.813 - 0.005ms returns 0 +T42A8 005:936.820 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:936.825 - 0.005ms returns 0 +T42A8 005:936.831 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:936.836 - 0.005ms returns 0 +T42A8 005:936.842 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:936.847 - 0.005ms returns 0 +T42A8 005:936.853 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:936.858 - 0.004ms returns 0 +T42A8 005:936.864 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:936.869 - 0.004ms returns 0 +T42A8 005:936.875 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:936.880 - 0.005ms returns 0 +T42A8 005:936.887 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:936.893 - 0.006ms returns 0x000000F9 +T42A8 005:936.899 JLINK_Go() +T42A8 005:936.909 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:942.995 - 6.096ms +T42A8 005:943.009 JLINK_IsHalted() +T42A8 005:943.565 - 0.556ms returns FALSE +T42A8 005:943.576 JLINK_HasError() +T42A8 005:945.501 JLINK_IsHalted() +T42A8 005:951.616 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:952.321 - 6.821ms returns TRUE +T42A8 005:952.331 JLINK_ReadReg(R15 (PC)) +T42A8 005:952.338 - 0.006ms returns 0x20003000 +T42A8 005:952.345 JLINK_ClrBPEx(BPHandle = 0x000000F9) +T42A8 005:952.350 - 0.005ms returns 0x00 +T42A8 005:952.357 JLINK_ReadReg(R0) +T42A8 005:952.361 - 0.005ms returns 0x00000000 +T42A8 005:952.754 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:952.762 Data: 20 46 FE F7 3F FD 60 7F 00 28 02 D0 20 8C 01 F0 ... +T42A8 005:952.774 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:956.588 - 3.834ms returns 0x100 +T42A8 005:956.606 JLINK_HasError() +T42A8 005:956.615 JLINK_WriteReg(R0, 0x18011200) +T42A8 005:956.621 - 0.006ms returns 0 +T42A8 005:956.629 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:956.634 - 0.005ms returns 0 +T42A8 005:956.641 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:956.649 - 0.008ms returns 0 +T42A8 005:956.657 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:956.663 - 0.005ms returns 0 +T42A8 005:956.669 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:956.675 - 0.005ms returns 0 +T42A8 005:956.681 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:956.686 - 0.005ms returns 0 +T42A8 005:956.693 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:956.699 - 0.005ms returns 0 +T42A8 005:956.706 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:956.711 - 0.005ms returns 0 +T42A8 005:956.719 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:956.724 - 0.005ms returns 0 +T42A8 005:956.731 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:956.737 - 0.005ms returns 0 +T42A8 005:956.744 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:956.752 - 0.007ms returns 0 +T42A8 005:956.759 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:956.766 - 0.006ms returns 0 +T42A8 005:956.773 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:956.779 - 0.005ms returns 0 +T42A8 005:956.786 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:956.792 - 0.006ms returns 0 +T42A8 005:956.798 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:956.803 - 0.005ms returns 0 +T42A8 005:956.809 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:956.815 - 0.005ms returns 0 +T42A8 005:956.821 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:956.827 - 0.005ms returns 0 +T42A8 005:956.834 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:956.839 - 0.005ms returns 0 +T42A8 005:956.847 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:956.859 - 0.011ms returns 0 +T42A8 005:956.869 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:956.879 - 0.010ms returns 0 +T42A8 005:956.891 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:956.897 - 0.007ms returns 0x000000FA +T42A8 005:956.905 JLINK_Go() +T42A8 005:956.914 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:962.862 - 5.956ms +T42A8 005:962.877 JLINK_IsHalted() +T42A8 005:963.539 - 0.661ms returns FALSE +T42A8 005:963.552 JLINK_HasError() +T42A8 005:965.509 JLINK_IsHalted() +T42A8 005:971.529 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:972.155 - 6.644ms returns TRUE +T42A8 005:972.169 JLINK_ReadReg(R15 (PC)) +T42A8 005:972.179 - 0.009ms returns 0x20003000 +T42A8 005:972.188 JLINK_ClrBPEx(BPHandle = 0x000000FA) +T42A8 005:972.195 - 0.007ms returns 0x00 +T42A8 005:972.205 JLINK_ReadReg(R0) +T42A8 005:972.212 - 0.007ms returns 0x00000000 +T42A8 005:972.745 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:972.757 Data: 93 42 00 D8 13 46 9C 46 63 01 01 A8 18 18 47 60 ... +T42A8 005:972.772 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:976.778 - 4.033ms returns 0x100 +T42A8 005:976.795 JLINK_HasError() +T42A8 005:976.806 JLINK_WriteReg(R0, 0x18011300) +T42A8 005:976.817 - 0.010ms returns 0 +T42A8 005:976.827 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:976.835 - 0.008ms returns 0 +T42A8 005:976.845 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:976.853 - 0.008ms returns 0 +T42A8 005:976.863 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:976.871 - 0.008ms returns 0 +T42A8 005:976.881 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:976.889 - 0.008ms returns 0 +T42A8 005:976.899 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:976.906 - 0.008ms returns 0 +T42A8 005:976.916 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:976.925 - 0.008ms returns 0 +T42A8 005:976.934 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:976.942 - 0.008ms returns 0 +T42A8 005:976.952 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:976.960 - 0.008ms returns 0 +T42A8 005:976.970 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:976.978 - 0.008ms returns 0 +T42A8 005:976.988 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:976.996 - 0.008ms returns 0 +T42A8 005:977.006 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:977.013 - 0.008ms returns 0 +T42A8 005:977.023 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:977.031 - 0.008ms returns 0 +T42A8 005:977.041 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:977.050 - 0.008ms returns 0 +T42A8 005:977.059 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:977.067 - 0.008ms returns 0 +T42A8 005:977.077 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:977.085 - 0.008ms returns 0 +T42A8 005:977.095 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:977.107 - 0.012ms returns 0 +T42A8 005:977.119 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:977.127 - 0.007ms returns 0 +T42A8 005:977.138 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:977.146 - 0.008ms returns 0 +T42A8 005:977.156 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:977.164 - 0.007ms returns 0 +T42A8 005:977.175 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:977.184 - 0.009ms returns 0x000000FB +T42A8 005:977.193 JLINK_Go() +T42A8 005:977.207 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 005:983.334 - 6.140ms +T42A8 005:983.362 JLINK_IsHalted() +T42A8 005:984.049 - 0.686ms returns FALSE +T42A8 005:984.067 JLINK_HasError() +T42A8 005:985.439 JLINK_IsHalted() +T42A8 005:991.436 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 005:992.044 - 6.603ms returns TRUE +T42A8 005:992.077 JLINK_ReadReg(R15 (PC)) +T42A8 005:992.094 - 0.016ms returns 0x20003000 +T42A8 005:992.111 JLINK_ClrBPEx(BPHandle = 0x000000FB) +T42A8 005:992.124 - 0.013ms returns 0x00 +T42A8 005:992.143 JLINK_ReadReg(R0) +T42A8 005:992.156 - 0.012ms returns 0x00000000 +T42A8 005:993.048 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 005:993.069 Data: 20 46 02 29 00 D8 19 46 01 81 12 8B 8A 42 00 D9 ... +T42A8 005:993.096 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 005:997.135 - 4.087ms returns 0x100 +T42A8 005:997.167 JLINK_HasError() +T42A8 005:997.189 JLINK_WriteReg(R0, 0x18011400) +T42A8 005:997.207 - 0.019ms returns 0 +T42A8 005:997.226 JLINK_WriteReg(R1, 0x00000100) +T42A8 005:997.242 - 0.015ms returns 0 +T42A8 005:997.261 JLINK_WriteReg(R2, 0x200039D4) +T42A8 005:997.276 - 0.015ms returns 0 +T42A8 005:997.295 JLINK_WriteReg(R3, 0x00000000) +T42A8 005:997.310 - 0.015ms returns 0 +T42A8 005:997.344 JLINK_WriteReg(R4, 0x00000000) +T42A8 005:997.360 - 0.015ms returns 0 +T42A8 005:997.379 JLINK_WriteReg(R5, 0x00000000) +T42A8 005:997.394 - 0.015ms returns 0 +T42A8 005:997.413 JLINK_WriteReg(R6, 0x00000000) +T42A8 005:997.428 - 0.015ms returns 0 +T42A8 005:997.447 JLINK_WriteReg(R7, 0x00000000) +T42A8 005:997.462 - 0.015ms returns 0 +T42A8 005:997.481 JLINK_WriteReg(R8, 0x00000000) +T42A8 005:997.496 - 0.015ms returns 0 +T42A8 005:997.515 JLINK_WriteReg(R9, 0x200039B4) +T42A8 005:997.530 - 0.015ms returns 0 +T42A8 005:997.549 JLINK_WriteReg(R10, 0x00000000) +T42A8 005:997.564 - 0.015ms returns 0 +T42A8 005:997.583 JLINK_WriteReg(R11, 0x00000000) +T42A8 005:997.598 - 0.015ms returns 0 +T42A8 005:997.617 JLINK_WriteReg(R12, 0x00000000) +T42A8 005:997.632 - 0.015ms returns 0 +T42A8 005:997.651 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 005:997.667 - 0.016ms returns 0 +T42A8 005:997.685 JLINK_WriteReg(R14, 0x20003001) +T42A8 005:997.701 - 0.015ms returns 0 +T42A8 005:997.719 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 005:997.735 - 0.015ms returns 0 +T42A8 005:997.753 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 005:997.769 - 0.015ms returns 0 +T42A8 005:997.788 JLINK_WriteReg(MSP, 0x20004000) +T42A8 005:997.803 - 0.015ms returns 0 +T42A8 005:997.822 JLINK_WriteReg(PSP, 0x20004000) +T42A8 005:997.837 - 0.015ms returns 0 +T42A8 005:997.856 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 005:997.871 - 0.015ms returns 0 +T42A8 005:997.891 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 005:997.908 - 0.017ms returns 0x000000FC +T42A8 005:997.926 JLINK_Go() +T42A8 005:997.951 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:004.247 - 6.319ms +T42A8 006:004.287 JLINK_IsHalted() +T42A8 006:005.050 - 0.761ms returns FALSE +T42A8 006:005.094 JLINK_HasError() +T42A8 006:006.393 JLINK_IsHalted() +T42A8 006:012.510 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:013.314 - 6.919ms returns TRUE +T42A8 006:013.365 JLINK_ReadReg(R15 (PC)) +T42A8 006:013.394 - 0.028ms returns 0x20003000 +T42A8 006:013.423 JLINK_ClrBPEx(BPHandle = 0x000000FC) +T42A8 006:013.446 - 0.023ms returns 0x00 +T42A8 006:013.473 JLINK_ReadReg(R0) +T42A8 006:013.495 - 0.021ms returns 0x00000000 +T42A8 006:015.021 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:015.057 Data: 68 78 88 42 09 D1 03 28 0F D0 04 28 0C D1 20 46 ... +T42A8 006:015.103 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:019.315 - 4.293ms returns 0x100 +T42A8 006:019.390 JLINK_HasError() +T42A8 006:019.584 JLINK_WriteReg(R0, 0x18011500) +T42A8 006:019.632 - 0.048ms returns 0 +T42A8 006:019.663 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:019.687 - 0.023ms returns 0 +T42A8 006:019.714 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:019.737 - 0.023ms returns 0 +T42A8 006:019.765 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:019.787 - 0.022ms returns 0 +T42A8 006:019.814 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:019.836 - 0.021ms returns 0 +T42A8 006:019.863 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:019.885 - 0.022ms returns 0 +T42A8 006:019.913 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:019.934 - 0.021ms returns 0 +T42A8 006:019.961 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:019.983 - 0.022ms returns 0 +T42A8 006:020.011 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:020.033 - 0.022ms returns 0 +T42A8 006:020.060 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:020.082 - 0.022ms returns 0 +T42A8 006:020.109 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:020.132 - 0.022ms returns 0 +T42A8 006:020.159 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:020.181 - 0.022ms returns 0 +T42A8 006:020.208 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:020.229 - 0.022ms returns 0 +T42A8 006:020.288 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:020.318 - 0.030ms returns 0 +T42A8 006:020.346 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:020.371 - 0.025ms returns 0 +T42A8 006:020.409 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:020.462 - 0.053ms returns 0 +T42A8 006:020.503 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:020.527 - 0.024ms returns 0 +T42A8 006:020.554 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:020.575 - 0.021ms returns 0 +T42A8 006:020.602 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:020.623 - 0.021ms returns 0 +T42A8 006:020.649 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:020.671 - 0.021ms returns 0 +T42A8 006:020.700 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:020.726 - 0.028ms returns 0x000000FD +T42A8 006:020.753 JLINK_Go() +T42A8 006:020.795 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:027.461 - 6.706ms +T42A8 006:027.529 JLINK_IsHalted() +T42A8 006:028.442 - 0.910ms returns FALSE +T42A8 006:028.506 JLINK_HasError() +T42A8 006:042.441 JLINK_IsHalted() +T42A8 006:048.728 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:049.409 - 6.966ms returns TRUE +T42A8 006:049.447 JLINK_ReadReg(R15 (PC)) +T42A8 006:049.462 - 0.014ms returns 0x20003000 +T42A8 006:049.474 JLINK_ClrBPEx(BPHandle = 0x000000FD) +T42A8 006:049.484 - 0.010ms returns 0x00 +T42A8 006:049.499 JLINK_ReadReg(R0) +T42A8 006:049.509 - 0.009ms returns 0x00000000 +T42A8 006:050.299 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:050.318 Data: 20 22 01 24 09 E0 0D 46 D5 40 9D 42 05 D3 1D 46 ... +T42A8 006:050.341 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:054.305 - 4.006ms returns 0x100 +T42A8 006:054.328 JLINK_HasError() +T42A8 006:054.336 JLINK_WriteReg(R0, 0x18011600) +T42A8 006:054.344 - 0.008ms returns 0 +T42A8 006:054.350 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:054.357 - 0.006ms returns 0 +T42A8 006:054.363 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:054.369 - 0.005ms returns 0 +T42A8 006:054.375 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:054.380 - 0.005ms returns 0 +T42A8 006:054.386 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:054.391 - 0.005ms returns 0 +T42A8 006:054.398 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:054.403 - 0.005ms returns 0 +T42A8 006:054.409 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:054.414 - 0.005ms returns 0 +T42A8 006:054.421 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:054.425 - 0.005ms returns 0 +T42A8 006:054.432 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:054.437 - 0.005ms returns 0 +T42A8 006:054.443 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:054.448 - 0.005ms returns 0 +T42A8 006:054.454 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:054.459 - 0.005ms returns 0 +T42A8 006:054.465 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:054.471 - 0.005ms returns 0 +T42A8 006:054.477 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:054.482 - 0.005ms returns 0 +T42A8 006:054.527 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:054.536 - 0.008ms returns 0 +T42A8 006:054.542 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:054.547 - 0.005ms returns 0 +T42A8 006:054.553 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:054.559 - 0.005ms returns 0 +T42A8 006:054.565 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:054.570 - 0.005ms returns 0 +T42A8 006:054.577 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:054.581 - 0.005ms returns 0 +T42A8 006:054.588 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:054.593 - 0.005ms returns 0 +T42A8 006:054.599 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:054.605 - 0.005ms returns 0 +T42A8 006:054.612 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:054.637 - 0.025ms returns 0x000000FE +T42A8 006:054.644 JLINK_Go() +T42A8 006:054.656 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:060.565 - 5.921ms +T42A8 006:060.576 JLINK_IsHalted() +T42A8 006:061.230 - 0.653ms returns FALSE +T42A8 006:061.240 JLINK_HasError() +T42A8 006:063.148 JLINK_IsHalted() +T42A8 006:069.299 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:070.085 - 6.936ms returns TRUE +T42A8 006:070.110 JLINK_ReadReg(R15 (PC)) +T42A8 006:070.119 - 0.008ms returns 0x20003000 +T42A8 006:070.135 JLINK_ClrBPEx(BPHandle = 0x000000FE) +T42A8 006:070.142 - 0.006ms returns 0x00 +T42A8 006:070.148 JLINK_ReadReg(R0) +T42A8 006:070.153 - 0.005ms returns 0x00000000 +T42A8 006:070.629 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:070.642 Data: 0B 46 D3 40 D0 40 20 24 A2 1A 91 40 08 43 19 46 ... +T42A8 006:070.658 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:074.743 - 4.113ms returns 0x100 +T42A8 006:074.768 JLINK_HasError() +T42A8 006:074.777 JLINK_WriteReg(R0, 0x18011700) +T42A8 006:074.786 - 0.009ms returns 0 +T42A8 006:074.793 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:074.798 - 0.005ms returns 0 +T42A8 006:074.805 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:074.810 - 0.005ms returns 0 +T42A8 006:074.816 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:074.821 - 0.005ms returns 0 +T42A8 006:074.828 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:074.833 - 0.005ms returns 0 +T42A8 006:074.839 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:074.844 - 0.005ms returns 0 +T42A8 006:074.850 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:074.855 - 0.005ms returns 0 +T42A8 006:074.862 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:074.867 - 0.005ms returns 0 +T42A8 006:074.873 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:074.879 - 0.005ms returns 0 +T42A8 006:074.885 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:074.890 - 0.005ms returns 0 +T42A8 006:074.896 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:074.901 - 0.005ms returns 0 +T42A8 006:074.908 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:074.913 - 0.005ms returns 0 +T42A8 006:074.919 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:074.925 - 0.005ms returns 0 +T42A8 006:074.931 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:074.937 - 0.005ms returns 0 +T42A8 006:074.943 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:074.948 - 0.005ms returns 0 +T42A8 006:074.955 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:074.960 - 0.005ms returns 0 +T42A8 006:074.966 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:074.971 - 0.005ms returns 0 +T42A8 006:074.977 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:074.983 - 0.005ms returns 0 +T42A8 006:074.989 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:074.994 - 0.005ms returns 0 +T42A8 006:075.001 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:075.006 - 0.005ms returns 0 +T42A8 006:075.013 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:075.020 - 0.007ms returns 0x000000FF +T42A8 006:075.027 JLINK_Go() +T42A8 006:075.040 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:081.389 - 6.361ms +T42A8 006:081.416 JLINK_IsHalted() +T42A8 006:082.165 - 0.748ms returns FALSE +T42A8 006:082.198 JLINK_HasError() +T42A8 006:083.324 JLINK_IsHalted() +T42A8 006:089.279 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:089.946 - 6.621ms returns TRUE +T42A8 006:089.960 JLINK_ReadReg(R15 (PC)) +T42A8 006:089.968 - 0.008ms returns 0x20003000 +T42A8 006:089.975 JLINK_ClrBPEx(BPHandle = 0x000000FF) +T42A8 006:090.040 - 0.064ms returns 0x00 +T42A8 006:090.051 JLINK_ReadReg(R0) +T42A8 006:090.056 - 0.005ms returns 0x00000000 +T42A8 006:090.699 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:090.719 Data: 30 46 15 B0 F0 BD 00 24 00 94 01 21 F3 4A 02 94 ... +T42A8 006:090.737 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:094.676 - 3.977ms returns 0x100 +T42A8 006:094.687 JLINK_HasError() +T42A8 006:094.695 JLINK_WriteReg(R0, 0x18011800) +T42A8 006:094.702 - 0.007ms returns 0 +T42A8 006:094.709 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:094.714 - 0.005ms returns 0 +T42A8 006:094.721 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:094.726 - 0.005ms returns 0 +T42A8 006:094.732 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:094.737 - 0.005ms returns 0 +T42A8 006:094.744 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:094.749 - 0.005ms returns 0 +T42A8 006:094.755 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:094.760 - 0.005ms returns 0 +T42A8 006:094.766 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:094.771 - 0.005ms returns 0 +T42A8 006:094.778 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:094.783 - 0.005ms returns 0 +T42A8 006:094.789 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:094.794 - 0.005ms returns 0 +T42A8 006:094.801 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:094.805 - 0.005ms returns 0 +T42A8 006:094.812 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:094.817 - 0.005ms returns 0 +T42A8 006:094.823 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:094.828 - 0.005ms returns 0 +T42A8 006:094.835 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:094.840 - 0.005ms returns 0 +T42A8 006:094.846 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:094.851 - 0.005ms returns 0 +T42A8 006:094.858 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:094.863 - 0.005ms returns 0 +T42A8 006:094.872 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:094.877 - 0.006ms returns 0 +T42A8 006:094.885 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:094.889 - 0.006ms returns 0 +T42A8 006:094.896 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:094.901 - 0.005ms returns 0 +T42A8 006:094.910 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:094.915 - 0.005ms returns 0 +T42A8 006:094.921 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:094.927 - 0.005ms returns 0 +T42A8 006:094.933 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:094.940 - 0.006ms returns 0x00000100 +T42A8 006:094.946 JLINK_Go() +T42A8 006:094.956 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:101.048 - 6.101ms +T42A8 006:101.058 JLINK_IsHalted() +T42A8 006:101.719 - 0.660ms returns FALSE +T42A8 006:101.729 JLINK_HasError() +T42A8 006:103.151 JLINK_IsHalted() +T42A8 006:109.143 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:109.769 - 6.618ms returns TRUE +T42A8 006:109.783 JLINK_ReadReg(R15 (PC)) +T42A8 006:109.790 - 0.007ms returns 0x20003000 +T42A8 006:109.797 JLINK_ClrBPEx(BPHandle = 0x00000100) +T42A8 006:109.803 - 0.005ms returns 0x00 +T42A8 006:109.892 JLINK_ReadReg(R0) +T42A8 006:109.903 - 0.010ms returns 0x00000000 +T42A8 006:110.349 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:110.358 Data: 6F 28 70 D0 70 28 04 D1 A7 E0 75 28 6C D0 78 28 ... +T42A8 006:110.371 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:114.351 - 4.002ms returns 0x100 +T42A8 006:114.375 JLINK_HasError() +T42A8 006:114.396 JLINK_WriteReg(R0, 0x18011900) +T42A8 006:114.402 - 0.021ms returns 0 +T42A8 006:114.409 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:114.427 - 0.018ms returns 0 +T42A8 006:114.445 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:114.450 - 0.005ms returns 0 +T42A8 006:114.469 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:114.474 - 0.004ms returns 0 +T42A8 006:114.495 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:114.513 - 0.017ms returns 0 +T42A8 006:114.519 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:114.537 - 0.018ms returns 0 +T42A8 006:114.543 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:114.561 - 0.018ms returns 0 +T42A8 006:114.581 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:114.586 - 0.005ms returns 0 +T42A8 006:114.592 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:114.597 - 0.004ms returns 0 +T42A8 006:114.603 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:114.611 - 0.007ms returns 0 +T42A8 006:114.618 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:114.623 - 0.004ms returns 0 +T42A8 006:114.629 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:114.634 - 0.004ms returns 0 +T42A8 006:114.640 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:114.645 - 0.004ms returns 0 +T42A8 006:114.651 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:114.655 - 0.005ms returns 0 +T42A8 006:114.661 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:114.666 - 0.004ms returns 0 +T42A8 006:114.672 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:114.677 - 0.004ms returns 0 +T42A8 006:114.683 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:114.688 - 0.004ms returns 0 +T42A8 006:114.694 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:114.698 - 0.004ms returns 0 +T42A8 006:114.704 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:114.709 - 0.004ms returns 0 +T42A8 006:114.715 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:114.720 - 0.004ms returns 0 +T42A8 006:114.726 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:114.731 - 0.005ms returns 0x00000101 +T42A8 006:114.737 JLINK_Go() +T42A8 006:114.746 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:120.373 - 5.634ms +T42A8 006:120.383 JLINK_IsHalted() +T42A8 006:121.009 - 0.626ms returns FALSE +T42A8 006:121.045 JLINK_HasError() +T42A8 006:126.218 JLINK_IsHalted() +T42A8 006:132.334 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:133.080 - 6.860ms returns TRUE +T42A8 006:133.108 JLINK_ReadReg(R15 (PC)) +T42A8 006:133.117 - 0.008ms returns 0x20003000 +T42A8 006:133.124 JLINK_ClrBPEx(BPHandle = 0x00000101) +T42A8 006:133.129 - 0.005ms returns 0x00 +T42A8 006:133.137 JLINK_ReadReg(R0) +T42A8 006:133.143 - 0.005ms returns 0x00000000 +T42A8 006:133.611 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:133.623 Data: 94 46 03 29 05 D0 07 E0 FF 1D FF 08 FF 00 03 CF ... +T42A8 006:133.639 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:137.676 - 4.064ms returns 0x100 +T42A8 006:137.705 JLINK_HasError() +T42A8 006:137.714 JLINK_WriteReg(R0, 0x18011A00) +T42A8 006:137.724 - 0.010ms returns 0 +T42A8 006:137.732 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:137.738 - 0.006ms returns 0 +T42A8 006:137.746 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:137.752 - 0.005ms returns 0 +T42A8 006:137.760 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:137.766 - 0.006ms returns 0 +T42A8 006:137.774 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:137.780 - 0.005ms returns 0 +T42A8 006:137.789 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:137.794 - 0.005ms returns 0 +T42A8 006:137.842 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:137.852 - 0.009ms returns 0 +T42A8 006:137.859 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:137.865 - 0.005ms returns 0 +T42A8 006:137.872 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:137.878 - 0.005ms returns 0 +T42A8 006:137.885 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:137.891 - 0.005ms returns 0 +T42A8 006:137.898 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:137.903 - 0.005ms returns 0 +T42A8 006:137.911 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:137.917 - 0.006ms returns 0 +T42A8 006:137.923 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:137.929 - 0.005ms returns 0 +T42A8 006:137.936 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:137.953 - 0.017ms returns 0 +T42A8 006:137.961 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:137.967 - 0.005ms returns 0 +T42A8 006:137.974 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:137.980 - 0.006ms returns 0 +T42A8 006:137.987 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:137.993 - 0.005ms returns 0 +T42A8 006:138.000 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:138.006 - 0.005ms returns 0 +T42A8 006:138.013 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:138.019 - 0.005ms returns 0 +T42A8 006:138.026 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:138.032 - 0.006ms returns 0 +T42A8 006:138.040 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:138.047 - 0.007ms returns 0x00000102 +T42A8 006:138.055 JLINK_Go() +T42A8 006:138.069 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:144.283 - 6.227ms +T42A8 006:144.306 JLINK_IsHalted() +T42A8 006:144.987 - 0.679ms returns FALSE +T42A8 006:145.006 JLINK_HasError() +T42A8 006:146.963 JLINK_IsHalted() +T42A8 006:153.202 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:154.060 - 7.097ms returns TRUE +T42A8 006:154.086 JLINK_ReadReg(R15 (PC)) +T42A8 006:154.095 - 0.009ms returns 0x20003000 +T42A8 006:154.102 JLINK_ClrBPEx(BPHandle = 0x00000102) +T42A8 006:154.108 - 0.005ms returns 0x00 +T42A8 006:154.114 JLINK_ReadReg(R0) +T42A8 006:154.120 - 0.005ms returns 0x00000000 +T42A8 006:154.570 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:154.582 Data: 04 D0 37 A1 03 91 0F A9 0F 91 0D E0 39 A1 F9 E7 ... +T42A8 006:154.597 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:158.616 - 4.045ms returns 0x100 +T42A8 006:158.639 JLINK_HasError() +T42A8 006:158.648 JLINK_WriteReg(R0, 0x18011B00) +T42A8 006:158.657 - 0.009ms returns 0 +T42A8 006:158.665 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:158.670 - 0.005ms returns 0 +T42A8 006:158.677 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:158.683 - 0.006ms returns 0 +T42A8 006:158.690 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:158.695 - 0.005ms returns 0 +T42A8 006:158.702 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:158.707 - 0.005ms returns 0 +T42A8 006:158.714 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:158.719 - 0.005ms returns 0 +T42A8 006:158.726 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:158.732 - 0.005ms returns 0 +T42A8 006:158.738 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:158.744 - 0.005ms returns 0 +T42A8 006:158.750 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:158.756 - 0.005ms returns 0 +T42A8 006:158.762 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:158.768 - 0.005ms returns 0 +T42A8 006:158.774 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:158.779 - 0.005ms returns 0 +T42A8 006:158.786 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:158.791 - 0.005ms returns 0 +T42A8 006:158.798 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:158.803 - 0.005ms returns 0 +T42A8 006:158.810 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:158.816 - 0.006ms returns 0 +T42A8 006:158.823 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:158.828 - 0.005ms returns 0 +T42A8 006:158.835 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:158.840 - 0.005ms returns 0 +T42A8 006:158.847 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:158.852 - 0.005ms returns 0 +T42A8 006:158.859 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:158.864 - 0.005ms returns 0 +T42A8 006:158.871 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:158.876 - 0.005ms returns 0 +T42A8 006:158.882 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:158.893 - 0.010ms returns 0 +T42A8 006:158.901 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:158.907 - 0.007ms returns 0x00000103 +T42A8 006:158.914 JLINK_Go() +T42A8 006:158.927 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:164.981 - 6.066ms +T42A8 006:164.997 JLINK_IsHalted() +T42A8 006:165.687 - 0.689ms returns FALSE +T42A8 006:165.703 JLINK_HasError() +T42A8 006:167.969 JLINK_IsHalted() +T42A8 006:173.929 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:174.506 - 6.536ms returns TRUE +T42A8 006:174.521 JLINK_ReadReg(R15 (PC)) +T42A8 006:174.530 - 0.009ms returns 0x20003000 +T42A8 006:174.539 JLINK_ClrBPEx(BPHandle = 0x00000103) +T42A8 006:174.547 - 0.007ms returns 0x00 +T42A8 006:174.557 JLINK_ReadReg(R0) +T42A8 006:174.564 - 0.007ms returns 0x00000000 +T42A8 006:176.036 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:176.045 Data: 43 44 45 46 00 00 00 00 F8 B5 04 46 00 25 1E 46 ... +T42A8 006:176.056 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:180.005 - 3.968ms returns 0x100 +T42A8 006:180.017 JLINK_HasError() +T42A8 006:180.024 JLINK_WriteReg(R0, 0x18011C00) +T42A8 006:180.031 - 0.006ms returns 0 +T42A8 006:180.037 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:180.043 - 0.005ms returns 0 +T42A8 006:180.049 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:180.055 - 0.005ms returns 0 +T42A8 006:180.061 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:180.066 - 0.005ms returns 0 +T42A8 006:180.073 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:180.078 - 0.005ms returns 0 +T42A8 006:180.084 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:180.089 - 0.005ms returns 0 +T42A8 006:180.101 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:180.106 - 0.005ms returns 0 +T42A8 006:180.113 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:180.118 - 0.005ms returns 0 +T42A8 006:180.124 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:180.129 - 0.005ms returns 0 +T42A8 006:180.136 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:180.141 - 0.005ms returns 0 +T42A8 006:180.147 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:180.153 - 0.005ms returns 0 +T42A8 006:180.159 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:180.164 - 0.005ms returns 0 +T42A8 006:180.171 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:180.176 - 0.005ms returns 0 +T42A8 006:180.182 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:180.188 - 0.005ms returns 0 +T42A8 006:180.194 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:180.199 - 0.005ms returns 0 +T42A8 006:180.206 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:180.211 - 0.005ms returns 0 +T42A8 006:180.218 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:180.223 - 0.005ms returns 0 +T42A8 006:180.229 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:180.234 - 0.005ms returns 0 +T42A8 006:180.241 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:180.246 - 0.005ms returns 0 +T42A8 006:180.252 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:180.257 - 0.005ms returns 0 +T42A8 006:180.265 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:180.271 - 0.006ms returns 0x00000104 +T42A8 006:180.277 JLINK_Go() +T42A8 006:180.286 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:186.387 - 6.110ms +T42A8 006:186.400 JLINK_IsHalted() +T42A8 006:186.982 - 0.581ms returns FALSE +T42A8 006:186.994 JLINK_HasError() +T42A8 006:188.967 JLINK_IsHalted() +T42A8 006:194.964 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:195.597 - 6.630ms returns TRUE +T42A8 006:195.613 JLINK_ReadReg(R15 (PC)) +T42A8 006:195.622 - 0.008ms returns 0x20003000 +T42A8 006:195.631 JLINK_ClrBPEx(BPHandle = 0x00000104) +T42A8 006:195.639 - 0.007ms returns 0x00 +T42A8 006:195.647 JLINK_ReadReg(R0) +T42A8 006:195.655 - 0.007ms returns 0x00000000 +T42A8 006:196.154 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:196.165 Data: 03 29 FA D0 00 F0 BC FE 7C 70 F8 BD 03 29 0B D0 ... +T42A8 006:196.179 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:200.046 - 3.892ms returns 0x100 +T42A8 006:200.061 JLINK_HasError() +T42A8 006:200.072 JLINK_WriteReg(R0, 0x18011D00) +T42A8 006:200.081 - 0.009ms returns 0 +T42A8 006:200.091 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:200.100 - 0.008ms returns 0 +T42A8 006:200.109 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:200.117 - 0.007ms returns 0 +T42A8 006:200.126 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:200.134 - 0.007ms returns 0 +T42A8 006:200.143 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:200.151 - 0.007ms returns 0 +T42A8 006:200.161 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:200.168 - 0.007ms returns 0 +T42A8 006:200.177 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:200.185 - 0.007ms returns 0 +T42A8 006:200.195 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:200.202 - 0.007ms returns 0 +T42A8 006:200.211 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:200.219 - 0.007ms returns 0 +T42A8 006:200.229 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:200.236 - 0.007ms returns 0 +T42A8 006:200.245 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:200.253 - 0.007ms returns 0 +T42A8 006:200.262 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:200.270 - 0.007ms returns 0 +T42A8 006:200.279 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:200.287 - 0.007ms returns 0 +T42A8 006:200.297 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:200.305 - 0.008ms returns 0 +T42A8 006:200.314 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:200.321 - 0.007ms returns 0 +T42A8 006:200.331 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:200.339 - 0.007ms returns 0 +T42A8 006:200.348 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:200.356 - 0.007ms returns 0 +T42A8 006:200.365 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:200.373 - 0.007ms returns 0 +T42A8 006:200.382 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:200.390 - 0.007ms returns 0 +T42A8 006:200.399 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:200.408 - 0.009ms returns 0 +T42A8 006:200.423 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:200.432 - 0.009ms returns 0x00000105 +T42A8 006:200.441 JLINK_Go() +T42A8 006:200.454 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:206.593 - 6.151ms +T42A8 006:206.610 JLINK_IsHalted() +T42A8 006:207.242 - 0.631ms returns FALSE +T42A8 006:207.261 JLINK_HasError() +T42A8 006:208.889 JLINK_IsHalted() +T42A8 006:214.916 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:215.563 - 6.673ms returns TRUE +T42A8 006:215.587 JLINK_ReadReg(R15 (PC)) +T42A8 006:215.601 - 0.014ms returns 0x20003000 +T42A8 006:215.617 JLINK_ClrBPEx(BPHandle = 0x00000105) +T42A8 006:215.629 - 0.012ms returns 0x00 +T42A8 006:215.644 JLINK_ReadReg(R0) +T42A8 006:215.656 - 0.011ms returns 0x00000000 +T42A8 006:216.473 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:216.493 Data: 10 BD 02 22 05 4B 00 21 03 48 98 47 04 49 00 22 ... +T42A8 006:216.517 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:220.524 - 4.051ms returns 0x100 +T42A8 006:220.553 JLINK_HasError() +T42A8 006:220.573 JLINK_WriteReg(R0, 0x18011E00) +T42A8 006:220.591 - 0.017ms returns 0 +T42A8 006:220.609 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:220.623 - 0.014ms returns 0 +T42A8 006:220.641 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:220.655 - 0.014ms returns 0 +T42A8 006:220.673 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:220.687 - 0.014ms returns 0 +T42A8 006:220.704 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:220.731 - 0.027ms returns 0 +T42A8 006:220.750 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:220.765 - 0.015ms returns 0 +T42A8 006:220.783 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:220.797 - 0.014ms returns 0 +T42A8 006:220.819 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:220.833 - 0.014ms returns 0 +T42A8 006:220.853 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:220.867 - 0.014ms returns 0 +T42A8 006:220.888 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:220.902 - 0.014ms returns 0 +T42A8 006:220.923 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:220.937 - 0.014ms returns 0 +T42A8 006:220.957 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:220.971 - 0.014ms returns 0 +T42A8 006:220.992 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:221.007 - 0.014ms returns 0 +T42A8 006:221.028 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:221.043 - 0.015ms returns 0 +T42A8 006:221.063 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:221.077 - 0.014ms returns 0 +T42A8 006:221.097 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:221.112 - 0.014ms returns 0 +T42A8 006:221.133 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:221.147 - 0.014ms returns 0 +T42A8 006:221.167 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:221.181 - 0.014ms returns 0 +T42A8 006:221.201 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:221.215 - 0.014ms returns 0 +T42A8 006:221.235 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:221.249 - 0.014ms returns 0 +T42A8 006:221.271 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:221.288 - 0.016ms returns 0x00000106 +T42A8 006:221.308 JLINK_Go() +T42A8 006:221.332 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:227.435 - 6.126ms +T42A8 006:227.449 JLINK_IsHalted() +T42A8 006:227.972 - 0.523ms returns FALSE +T42A8 006:227.984 JLINK_HasError() +T42A8 006:232.960 JLINK_IsHalted() +T42A8 006:239.077 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:239.610 - 6.670ms returns TRUE +T42A8 006:239.623 JLINK_ReadReg(R15 (PC)) +T42A8 006:239.631 - 0.007ms returns 0x20003000 +T42A8 006:239.637 JLINK_ClrBPEx(BPHandle = 0x00000106) +T42A8 006:239.643 - 0.005ms returns 0x00 +T42A8 006:239.649 JLINK_ReadReg(R0) +T42A8 006:239.654 - 0.005ms returns 0x00000000 +T42A8 006:240.291 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:240.300 Data: 00 25 60 19 81 7C 3E A0 FF F7 3E FC 6D 1C 06 2D ... +T42A8 006:240.312 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:244.231 - 3.940ms returns 0x100 +T42A8 006:244.243 JLINK_HasError() +T42A8 006:244.250 JLINK_WriteReg(R0, 0x18011F00) +T42A8 006:244.256 - 0.006ms returns 0 +T42A8 006:244.262 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:244.267 - 0.005ms returns 0 +T42A8 006:244.273 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:244.283 - 0.009ms returns 0 +T42A8 006:244.289 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:244.293 - 0.004ms returns 0 +T42A8 006:244.299 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:244.305 - 0.004ms returns 0 +T42A8 006:244.310 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:244.315 - 0.004ms returns 0 +T42A8 006:244.321 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:244.326 - 0.004ms returns 0 +T42A8 006:244.332 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:244.337 - 0.004ms returns 0 +T42A8 006:244.343 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:244.347 - 0.004ms returns 0 +T42A8 006:244.353 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:244.358 - 0.004ms returns 0 +T42A8 006:244.364 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:244.369 - 0.004ms returns 0 +T42A8 006:244.375 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:244.380 - 0.004ms returns 0 +T42A8 006:244.386 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:244.391 - 0.004ms returns 0 +T42A8 006:244.397 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:244.402 - 0.005ms returns 0 +T42A8 006:244.408 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:244.413 - 0.005ms returns 0 +T42A8 006:244.419 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:244.423 - 0.005ms returns 0 +T42A8 006:244.429 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:244.434 - 0.005ms returns 0 +T42A8 006:244.440 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:244.445 - 0.004ms returns 0 +T42A8 006:244.451 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:244.456 - 0.004ms returns 0 +T42A8 006:244.461 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:244.466 - 0.004ms returns 0 +T42A8 006:244.473 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:244.479 - 0.005ms returns 0x00000107 +T42A8 006:244.485 JLINK_Go() +T42A8 006:244.494 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:250.604 - 6.119ms +T42A8 006:250.615 JLINK_IsHalted() +T42A8 006:251.344 - 0.728ms returns FALSE +T42A8 006:251.353 JLINK_HasError() +T42A8 006:252.761 JLINK_IsHalted() +T42A8 006:258.814 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:259.455 - 6.694ms returns TRUE +T42A8 006:259.467 JLINK_ReadReg(R15 (PC)) +T42A8 006:259.474 - 0.006ms returns 0x20003000 +T42A8 006:259.480 JLINK_ClrBPEx(BPHandle = 0x00000107) +T42A8 006:259.485 - 0.005ms returns 0x00 +T42A8 006:259.491 JLINK_ReadReg(R0) +T42A8 006:259.496 - 0.004ms returns 0x00000000 +T42A8 006:259.977 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:259.986 Data: 25 30 32 58 20 00 00 00 3C 25 73 2C 25 64 3E 42 ... +T42A8 006:259.997 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:263.822 - 3.844ms returns 0x100 +T42A8 006:263.836 JLINK_HasError() +T42A8 006:263.844 JLINK_WriteReg(R0, 0x18012000) +T42A8 006:263.851 - 0.007ms returns 0 +T42A8 006:263.858 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:263.864 - 0.005ms returns 0 +T42A8 006:263.874 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:263.881 - 0.007ms returns 0 +T42A8 006:263.890 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:263.896 - 0.005ms returns 0 +T42A8 006:263.902 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:263.907 - 0.005ms returns 0 +T42A8 006:263.913 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:263.920 - 0.006ms returns 0 +T42A8 006:263.926 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:263.931 - 0.005ms returns 0 +T42A8 006:263.937 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:263.943 - 0.005ms returns 0 +T42A8 006:263.949 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:263.954 - 0.005ms returns 0 +T42A8 006:263.960 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:263.965 - 0.005ms returns 0 +T42A8 006:263.971 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:263.977 - 0.005ms returns 0 +T42A8 006:263.984 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:263.989 - 0.005ms returns 0 +T42A8 006:263.995 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:264.000 - 0.005ms returns 0 +T42A8 006:264.008 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:264.015 - 0.009ms returns 0 +T42A8 006:264.022 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:264.027 - 0.005ms returns 0 +T42A8 006:264.033 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:264.039 - 0.005ms returns 0 +T42A8 006:264.046 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:264.055 - 0.010ms returns 0 +T42A8 006:264.062 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:264.067 - 0.005ms returns 0 +T42A8 006:264.073 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:264.078 - 0.005ms returns 0 +T42A8 006:264.085 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:264.089 - 0.005ms returns 0 +T42A8 006:264.097 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:264.102 - 0.006ms returns 0x00000108 +T42A8 006:264.109 JLINK_Go() +T42A8 006:264.119 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:269.899 - 5.789ms +T42A8 006:269.911 JLINK_IsHalted() +T42A8 006:270.429 - 0.517ms returns FALSE +T42A8 006:270.440 JLINK_HasError() +T42A8 006:273.629 JLINK_IsHalted() +T42A8 006:279.486 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:280.133 - 6.503ms returns TRUE +T42A8 006:280.143 JLINK_ReadReg(R15 (PC)) +T42A8 006:280.149 - 0.006ms returns 0x20003000 +T42A8 006:280.156 JLINK_ClrBPEx(BPHandle = 0x00000108) +T42A8 006:280.161 - 0.005ms returns 0x00 +T42A8 006:280.168 JLINK_ReadReg(R0) +T42A8 006:280.173 - 0.005ms returns 0x00000000 +T42A8 006:280.576 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:280.586 Data: 4C 49 FF F7 79 FA 4C 48 10 22 0C 18 00 21 68 46 ... +T42A8 006:280.625 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:284.610 - 4.034ms returns 0x100 +T42A8 006:284.622 JLINK_HasError() +T42A8 006:284.642 JLINK_WriteReg(R0, 0x18012100) +T42A8 006:284.649 - 0.006ms returns 0 +T42A8 006:284.655 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:284.659 - 0.005ms returns 0 +T42A8 006:284.665 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:284.670 - 0.004ms returns 0 +T42A8 006:284.676 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:284.680 - 0.004ms returns 0 +T42A8 006:284.687 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:284.692 - 0.004ms returns 0 +T42A8 006:284.697 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:284.702 - 0.004ms returns 0 +T42A8 006:284.708 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:284.713 - 0.004ms returns 0 +T42A8 006:284.718 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:284.723 - 0.004ms returns 0 +T42A8 006:284.729 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:284.734 - 0.004ms returns 0 +T42A8 006:284.741 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:284.746 - 0.004ms returns 0 +T42A8 006:284.752 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:284.757 - 0.004ms returns 0 +T42A8 006:284.764 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:284.769 - 0.004ms returns 0 +T42A8 006:284.775 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:284.780 - 0.004ms returns 0 +T42A8 006:284.785 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:284.791 - 0.005ms returns 0 +T42A8 006:284.797 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:284.802 - 0.004ms returns 0 +T42A8 006:284.807 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:284.812 - 0.004ms returns 0 +T42A8 006:284.818 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:284.823 - 0.005ms returns 0 +T42A8 006:284.831 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:284.836 - 0.004ms returns 0 +T42A8 006:284.843 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:284.848 - 0.004ms returns 0 +T42A8 006:284.904 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:284.913 - 0.008ms returns 0 +T42A8 006:284.920 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:284.926 - 0.006ms returns 0x00000109 +T42A8 006:284.932 JLINK_Go() +T42A8 006:284.941 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:290.989 - 6.057ms +T42A8 006:291.001 JLINK_IsHalted() +T42A8 006:291.650 - 0.649ms returns FALSE +T42A8 006:291.661 JLINK_HasError() +T42A8 006:293.669 JLINK_IsHalted() +T42A8 006:299.687 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:300.319 - 6.649ms returns TRUE +T42A8 006:300.332 JLINK_ReadReg(R15 (PC)) +T42A8 006:300.340 - 0.007ms returns 0x20003000 +T42A8 006:300.347 JLINK_ClrBPEx(BPHandle = 0x00000109) +T42A8 006:300.354 - 0.006ms returns 0x00 +T42A8 006:300.362 JLINK_ReadReg(R0) +T42A8 006:300.368 - 0.006ms returns 0x00000000 +T42A8 006:300.816 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:300.825 Data: 0A 00 00 00 3C 25 73 2C 25 64 3E 54 4B 5F 4B 45 ... +T42A8 006:300.838 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:304.673 - 3.858ms returns 0x100 +T42A8 006:304.686 JLINK_HasError() +T42A8 006:304.695 JLINK_WriteReg(R0, 0x18012200) +T42A8 006:304.703 - 0.007ms returns 0 +T42A8 006:304.711 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:304.717 - 0.006ms returns 0 +T42A8 006:304.725 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:304.731 - 0.006ms returns 0 +T42A8 006:304.738 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:304.745 - 0.006ms returns 0 +T42A8 006:304.753 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:304.759 - 0.006ms returns 0 +T42A8 006:304.766 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:304.773 - 0.006ms returns 0 +T42A8 006:304.780 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:304.786 - 0.006ms returns 0 +T42A8 006:304.846 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:304.854 - 0.007ms returns 0 +T42A8 006:304.862 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:304.869 - 0.006ms returns 0 +T42A8 006:304.877 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:304.883 - 0.006ms returns 0 +T42A8 006:304.891 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:304.898 - 0.006ms returns 0 +T42A8 006:304.906 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:304.913 - 0.006ms returns 0 +T42A8 006:304.921 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:304.927 - 0.006ms returns 0 +T42A8 006:304.936 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:304.943 - 0.007ms returns 0 +T42A8 006:304.951 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:304.957 - 0.006ms returns 0 +T42A8 006:304.966 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:304.974 - 0.008ms returns 0 +T42A8 006:304.982 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:304.989 - 0.006ms returns 0 +T42A8 006:304.997 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:305.004 - 0.006ms returns 0 +T42A8 006:305.012 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:305.019 - 0.006ms returns 0 +T42A8 006:305.027 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:305.033 - 0.006ms returns 0 +T42A8 006:305.042 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:305.050 - 0.007ms returns 0x0000010A +T42A8 006:305.058 JLINK_Go() +T42A8 006:305.069 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:311.101 - 6.043ms +T42A8 006:311.113 JLINK_IsHalted() +T42A8 006:311.667 - 0.554ms returns FALSE +T42A8 006:311.678 JLINK_HasError() +T42A8 006:313.625 JLINK_IsHalted() +T42A8 006:319.584 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:320.291 - 6.665ms returns TRUE +T42A8 006:320.317 JLINK_ReadReg(R15 (PC)) +T42A8 006:320.326 - 0.009ms returns 0x20003000 +T42A8 006:320.333 JLINK_ClrBPEx(BPHandle = 0x0000010A) +T42A8 006:320.339 - 0.005ms returns 0x00 +T42A8 006:320.345 JLINK_ReadReg(R0) +T42A8 006:320.351 - 0.005ms returns 0x00000000 +T42A8 006:320.874 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:320.887 Data: FF F7 42 FA 64 1C 08 2C F7 DB 24 A0 FF F7 3C FA ... +T42A8 006:320.903 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:324.902 - 4.028ms returns 0x100 +T42A8 006:324.925 JLINK_HasError() +T42A8 006:324.935 JLINK_WriteReg(R0, 0x18012300) +T42A8 006:324.944 - 0.009ms returns 0 +T42A8 006:324.951 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:324.957 - 0.005ms returns 0 +T42A8 006:324.964 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:324.969 - 0.005ms returns 0 +T42A8 006:324.976 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:324.981 - 0.005ms returns 0 +T42A8 006:324.988 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:324.993 - 0.005ms returns 0 +T42A8 006:325.000 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:325.006 - 0.005ms returns 0 +T42A8 006:325.013 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:325.018 - 0.005ms returns 0 +T42A8 006:325.025 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:325.030 - 0.005ms returns 0 +T42A8 006:325.037 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:325.042 - 0.005ms returns 0 +T42A8 006:325.049 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:325.055 - 0.005ms returns 0 +T42A8 006:325.061 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:325.067 - 0.005ms returns 0 +T42A8 006:325.073 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:325.079 - 0.005ms returns 0 +T42A8 006:325.086 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:325.091 - 0.005ms returns 0 +T42A8 006:325.103 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:325.109 - 0.006ms returns 0 +T42A8 006:325.116 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:325.121 - 0.005ms returns 0 +T42A8 006:325.128 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:325.133 - 0.005ms returns 0 +T42A8 006:325.141 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:325.146 - 0.005ms returns 0 +T42A8 006:325.153 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:325.158 - 0.005ms returns 0 +T42A8 006:325.165 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:325.170 - 0.005ms returns 0 +T42A8 006:325.177 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:325.183 - 0.005ms returns 0 +T42A8 006:325.190 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:325.197 - 0.007ms returns 0x0000010B +T42A8 006:325.204 JLINK_Go() +T42A8 006:325.216 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:331.419 - 6.214ms +T42A8 006:331.459 JLINK_IsHalted() +T42A8 006:332.258 - 0.797ms returns FALSE +T42A8 006:332.285 JLINK_HasError() +T42A8 006:333.445 JLINK_IsHalted() +T42A8 006:339.493 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:340.304 - 6.858ms returns TRUE +T42A8 006:340.336 JLINK_ReadReg(R15 (PC)) +T42A8 006:340.346 - 0.010ms returns 0x20003000 +T42A8 006:340.353 JLINK_ClrBPEx(BPHandle = 0x0000010B) +T42A8 006:340.360 - 0.006ms returns 0x00 +T42A8 006:340.367 JLINK_ReadReg(R0) +T42A8 006:340.373 - 0.005ms returns 0x00000000 +T42A8 006:340.991 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:341.015 Data: 23 E0 0C 2D 41 D0 0E 2D 0C D1 54 E0 06 2D 6B D0 ... +T42A8 006:341.032 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:344.965 - 3.974ms returns 0x100 +T42A8 006:344.989 JLINK_HasError() +T42A8 006:344.999 JLINK_WriteReg(R0, 0x18012400) +T42A8 006:345.009 - 0.010ms returns 0 +T42A8 006:345.017 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:345.024 - 0.006ms returns 0 +T42A8 006:345.030 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:345.036 - 0.005ms returns 0 +T42A8 006:345.042 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:345.047 - 0.005ms returns 0 +T42A8 006:345.053 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:345.058 - 0.005ms returns 0 +T42A8 006:345.065 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:345.070 - 0.005ms returns 0 +T42A8 006:345.076 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:345.081 - 0.005ms returns 0 +T42A8 006:345.087 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:345.093 - 0.005ms returns 0 +T42A8 006:345.099 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:345.104 - 0.005ms returns 0 +T42A8 006:345.111 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:345.116 - 0.005ms returns 0 +T42A8 006:345.123 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:345.128 - 0.005ms returns 0 +T42A8 006:345.134 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:345.139 - 0.004ms returns 0 +T42A8 006:345.145 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:345.149 - 0.004ms returns 0 +T42A8 006:345.156 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:345.161 - 0.005ms returns 0 +T42A8 006:345.167 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:345.172 - 0.005ms returns 0 +T42A8 006:345.179 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:345.183 - 0.005ms returns 0 +T42A8 006:345.189 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:345.195 - 0.005ms returns 0 +T42A8 006:345.201 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:345.205 - 0.004ms returns 0 +T42A8 006:345.211 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:345.217 - 0.004ms returns 0 +T42A8 006:345.223 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:345.227 - 0.005ms returns 0 +T42A8 006:345.234 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:345.241 - 0.006ms returns 0x0000010C +T42A8 006:345.247 JLINK_Go() +T42A8 006:345.258 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:351.394 - 6.147ms +T42A8 006:351.413 JLINK_IsHalted() +T42A8 006:352.102 - 0.688ms returns FALSE +T42A8 006:352.115 JLINK_HasError() +T42A8 006:357.374 JLINK_IsHalted() +T42A8 006:363.618 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:364.397 - 7.022ms returns TRUE +T42A8 006:364.425 JLINK_ReadReg(R15 (PC)) +T42A8 006:364.435 - 0.010ms returns 0x20003000 +T42A8 006:364.442 JLINK_ClrBPEx(BPHandle = 0x0000010C) +T42A8 006:364.454 - 0.011ms returns 0x00 +T42A8 006:364.461 JLINK_ReadReg(R0) +T42A8 006:364.467 - 0.005ms returns 0x00000000 +T42A8 006:364.965 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:364.978 Data: C0 E7 00 E0 07 E0 0B 78 FF 22 2C 32 17 A1 66 A0 ... +T42A8 006:364.994 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:368.833 - 3.867ms returns 0x100 +T42A8 006:368.857 JLINK_HasError() +T42A8 006:368.937 JLINK_WriteReg(R0, 0x18012500) +T42A8 006:368.948 - 0.011ms returns 0 +T42A8 006:368.956 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:368.961 - 0.005ms returns 0 +T42A8 006:368.968 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:368.977 - 0.009ms returns 0 +T42A8 006:368.984 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:368.989 - 0.005ms returns 0 +T42A8 006:368.997 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:369.009 - 0.012ms returns 0 +T42A8 006:369.017 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:369.023 - 0.005ms returns 0 +T42A8 006:369.029 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:369.034 - 0.005ms returns 0 +T42A8 006:369.041 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:369.046 - 0.005ms returns 0 +T42A8 006:369.053 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:369.057 - 0.005ms returns 0 +T42A8 006:369.064 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:369.069 - 0.005ms returns 0 +T42A8 006:369.075 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:369.081 - 0.005ms returns 0 +T42A8 006:369.087 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:369.092 - 0.005ms returns 0 +T42A8 006:369.099 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:369.104 - 0.005ms returns 0 +T42A8 006:369.110 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:369.116 - 0.006ms returns 0 +T42A8 006:369.122 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:369.127 - 0.005ms returns 0 +T42A8 006:369.134 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:369.139 - 0.005ms returns 0 +T42A8 006:369.145 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:369.151 - 0.005ms returns 0 +T42A8 006:369.157 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:369.162 - 0.005ms returns 0 +T42A8 006:369.169 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:369.174 - 0.005ms returns 0 +T42A8 006:369.180 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:369.185 - 0.005ms returns 0 +T42A8 006:369.193 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:369.199 - 0.007ms returns 0x0000010D +T42A8 006:369.206 JLINK_Go() +T42A8 006:369.219 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:375.133 - 5.927ms +T42A8 006:375.149 JLINK_IsHalted() +T42A8 006:375.791 - 0.641ms returns FALSE +T42A8 006:375.802 JLINK_HasError() +T42A8 006:378.417 JLINK_IsHalted() +T42A8 006:384.338 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:384.834 - 6.416ms returns TRUE +T42A8 006:384.859 JLINK_ReadReg(R15 (PC)) +T42A8 006:384.867 - 0.007ms returns 0x20003000 +T42A8 006:384.873 JLINK_ClrBPEx(BPHandle = 0x0000010D) +T42A8 006:384.878 - 0.005ms returns 0x00 +T42A8 006:384.885 JLINK_ReadReg(R0) +T42A8 006:384.889 - 0.004ms returns 0x00000000 +T42A8 006:385.268 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:385.276 Data: 73 6F 6E 3A 30 78 25 58 29 0D 0A 00 3C 25 73 2C ... +T42A8 006:385.289 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:389.152 - 3.884ms returns 0x100 +T42A8 006:389.163 JLINK_HasError() +T42A8 006:389.169 JLINK_WriteReg(R0, 0x18012600) +T42A8 006:389.176 - 0.006ms returns 0 +T42A8 006:389.182 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:389.187 - 0.005ms returns 0 +T42A8 006:389.193 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:389.198 - 0.005ms returns 0 +T42A8 006:389.204 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:389.209 - 0.004ms returns 0 +T42A8 006:389.215 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:389.220 - 0.004ms returns 0 +T42A8 006:389.226 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:389.231 - 0.004ms returns 0 +T42A8 006:389.237 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:389.242 - 0.005ms returns 0 +T42A8 006:389.248 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:389.253 - 0.004ms returns 0 +T42A8 006:389.259 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:389.263 - 0.005ms returns 0 +T42A8 006:389.273 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:389.283 - 0.009ms returns 0 +T42A8 006:389.289 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:389.294 - 0.004ms returns 0 +T42A8 006:389.300 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:389.305 - 0.004ms returns 0 +T42A8 006:389.334 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:389.339 - 0.005ms returns 0 +T42A8 006:389.345 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:389.350 - 0.005ms returns 0 +T42A8 006:389.370 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:389.389 - 0.019ms returns 0 +T42A8 006:389.395 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:389.413 - 0.017ms returns 0 +T42A8 006:389.419 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:389.423 - 0.004ms returns 0 +T42A8 006:389.429 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:389.434 - 0.004ms returns 0 +T42A8 006:389.439 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:389.444 - 0.004ms returns 0 +T42A8 006:389.450 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:389.455 - 0.004ms returns 0 +T42A8 006:389.461 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:389.466 - 0.005ms returns 0x0000010E +T42A8 006:389.472 JLINK_Go() +T42A8 006:389.481 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:395.410 - 5.937ms +T42A8 006:395.438 JLINK_IsHalted() +T42A8 006:396.054 - 0.616ms returns FALSE +T42A8 006:396.065 JLINK_HasError() +T42A8 006:400.281 JLINK_IsHalted() +T42A8 006:406.329 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:407.039 - 6.757ms returns TRUE +T42A8 006:407.112 JLINK_ReadReg(R15 (PC)) +T42A8 006:407.141 - 0.029ms returns 0x20003000 +T42A8 006:407.170 JLINK_ClrBPEx(BPHandle = 0x0000010E) +T42A8 006:407.193 - 0.023ms returns 0x00 +T42A8 006:407.220 JLINK_ReadReg(R0) +T42A8 006:407.248 - 0.027ms returns 0x00000000 +T42A8 006:409.193 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:409.231 Data: 64 29 0D 0A 00 00 00 00 03 22 10 B5 52 02 80 1A ... +T42A8 006:409.288 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:413.462 - 4.267ms returns 0x100 +T42A8 006:413.526 JLINK_HasError() +T42A8 006:413.559 JLINK_WriteReg(R0, 0x18012700) +T42A8 006:413.590 - 0.031ms returns 0 +T42A8 006:413.618 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:413.640 - 0.022ms returns 0 +T42A8 006:413.666 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:413.687 - 0.021ms returns 0 +T42A8 006:413.713 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:413.735 - 0.021ms returns 0 +T42A8 006:413.761 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:413.782 - 0.021ms returns 0 +T42A8 006:413.808 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:413.829 - 0.021ms returns 0 +T42A8 006:413.856 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:413.877 - 0.020ms returns 0 +T42A8 006:413.903 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:413.923 - 0.020ms returns 0 +T42A8 006:413.950 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:413.971 - 0.021ms returns 0 +T42A8 006:413.997 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:414.018 - 0.021ms returns 0 +T42A8 006:414.044 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:414.065 - 0.021ms returns 0 +T42A8 006:414.092 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:414.113 - 0.021ms returns 0 +T42A8 006:414.139 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:414.160 - 0.021ms returns 0 +T42A8 006:414.190 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:414.239 - 0.049ms returns 0 +T42A8 006:414.267 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:414.289 - 0.022ms returns 0 +T42A8 006:414.316 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:414.338 - 0.023ms returns 0 +T42A8 006:414.365 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:414.387 - 0.021ms returns 0 +T42A8 006:414.413 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:414.434 - 0.021ms returns 0 +T42A8 006:414.460 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:414.481 - 0.021ms returns 0 +T42A8 006:414.507 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:414.529 - 0.021ms returns 0 +T42A8 006:414.557 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:414.582 - 0.025ms returns 0x0000010F +T42A8 006:414.608 JLINK_Go() +T42A8 006:414.648 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:421.093 - 6.482ms +T42A8 006:421.158 JLINK_IsHalted() +T42A8 006:422.103 - 0.942ms returns FALSE +T42A8 006:422.212 JLINK_HasError() +T42A8 006:424.336 JLINK_IsHalted() +T42A8 006:430.726 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:431.532 - 7.195ms returns TRUE +T42A8 006:431.589 JLINK_ReadReg(R15 (PC)) +T42A8 006:431.620 - 0.030ms returns 0x20003000 +T42A8 006:431.649 JLINK_ClrBPEx(BPHandle = 0x0000010F) +T42A8 006:431.673 - 0.023ms returns 0x00 +T42A8 006:431.701 JLINK_ReadReg(R0) +T42A8 006:431.724 - 0.022ms returns 0x00000000 +T42A8 006:433.375 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:433.411 Data: F3 F7 56 FF 00 F0 92 F8 00 F0 44 FB 10 BD 00 00 ... +T42A8 006:433.460 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:437.498 - 4.122ms returns 0x100 +T42A8 006:437.564 JLINK_HasError() +T42A8 006:437.597 JLINK_WriteReg(R0, 0x18012800) +T42A8 006:437.629 - 0.031ms returns 0 +T42A8 006:437.657 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:437.680 - 0.023ms returns 0 +T42A8 006:437.707 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:437.729 - 0.022ms returns 0 +T42A8 006:437.757 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:437.779 - 0.022ms returns 0 +T42A8 006:437.806 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:437.829 - 0.022ms returns 0 +T42A8 006:437.856 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:437.877 - 0.022ms returns 0 +T42A8 006:437.905 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:437.926 - 0.021ms returns 0 +T42A8 006:437.953 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:437.975 - 0.021ms returns 0 +T42A8 006:438.002 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:438.023 - 0.022ms returns 0 +T42A8 006:438.051 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:438.072 - 0.022ms returns 0 +T42A8 006:438.099 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:438.121 - 0.021ms returns 0 +T42A8 006:438.179 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:438.203 - 0.024ms returns 0 +T42A8 006:438.230 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:438.252 - 0.022ms returns 0 +T42A8 006:438.280 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:438.304 - 0.024ms returns 0 +T42A8 006:438.331 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:438.353 - 0.022ms returns 0 +T42A8 006:438.381 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:438.404 - 0.022ms returns 0 +T42A8 006:438.431 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:438.453 - 0.021ms returns 0 +T42A8 006:438.479 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:438.500 - 0.021ms returns 0 +T42A8 006:438.526 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:438.548 - 0.021ms returns 0 +T42A8 006:438.574 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:438.595 - 0.021ms returns 0 +T42A8 006:438.624 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:438.649 - 0.026ms returns 0x00000110 +T42A8 006:438.675 JLINK_Go() +T42A8 006:438.715 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:445.134 - 6.457ms +T42A8 006:445.176 JLINK_IsHalted() +T42A8 006:445.913 - 0.735ms returns FALSE +T42A8 006:445.957 JLINK_HasError() +T42A8 006:456.311 JLINK_IsHalted() +T42A8 006:462.407 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:463.145 - 6.834ms returns TRUE +T42A8 006:463.223 JLINK_ReadReg(R15 (PC)) +T42A8 006:463.237 - 0.014ms returns 0x20003000 +T42A8 006:463.255 JLINK_ClrBPEx(BPHandle = 0x00000110) +T42A8 006:463.270 - 0.015ms returns 0x00 +T42A8 006:463.286 JLINK_ReadReg(R0) +T42A8 006:463.300 - 0.013ms returns 0x00000000 +T42A8 006:463.963 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:463.986 Data: 01 A9 00 F0 39 F8 00 28 08 D0 00 90 68 46 83 88 ... +T42A8 006:464.028 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:468.122 - 4.159ms returns 0x100 +T42A8 006:468.193 JLINK_HasError() +T42A8 006:468.205 JLINK_WriteReg(R0, 0x18012900) +T42A8 006:468.217 - 0.011ms returns 0 +T42A8 006:468.226 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:468.233 - 0.007ms returns 0 +T42A8 006:468.242 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:468.249 - 0.007ms returns 0 +T42A8 006:468.257 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:468.264 - 0.006ms returns 0 +T42A8 006:468.273 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:468.280 - 0.007ms returns 0 +T42A8 006:468.288 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:468.299 - 0.010ms returns 0 +T42A8 006:468.310 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:468.317 - 0.007ms returns 0 +T42A8 006:468.325 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:468.332 - 0.006ms returns 0 +T42A8 006:468.341 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:468.347 - 0.007ms returns 0 +T42A8 006:468.356 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:468.363 - 0.006ms returns 0 +T42A8 006:468.371 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:468.378 - 0.007ms returns 0 +T42A8 006:468.386 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:468.393 - 0.006ms returns 0 +T42A8 006:468.401 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:468.409 - 0.007ms returns 0 +T42A8 006:468.417 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:468.424 - 0.007ms returns 0 +T42A8 006:468.433 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:468.439 - 0.006ms returns 0 +T42A8 006:468.448 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:468.455 - 0.007ms returns 0 +T42A8 006:468.464 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:468.471 - 0.006ms returns 0 +T42A8 006:468.479 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:468.486 - 0.006ms returns 0 +T42A8 006:468.494 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:468.501 - 0.006ms returns 0 +T42A8 006:468.509 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:468.516 - 0.007ms returns 0 +T42A8 006:468.525 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:468.533 - 0.008ms returns 0x00000111 +T42A8 006:468.542 JLINK_Go() +T42A8 006:468.557 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:474.752 - 6.209ms +T42A8 006:474.784 JLINK_IsHalted() +T42A8 006:475.559 - 0.773ms returns FALSE +T42A8 006:475.591 JLINK_HasError() +T42A8 006:478.245 JLINK_IsHalted() +T42A8 006:484.311 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:485.086 - 6.839ms returns TRUE +T42A8 006:485.117 JLINK_ReadReg(R15 (PC)) +T42A8 006:485.128 - 0.010ms returns 0x20003000 +T42A8 006:485.137 JLINK_ClrBPEx(BPHandle = 0x00000111) +T42A8 006:485.146 - 0.009ms returns 0x00 +T42A8 006:485.155 JLINK_ReadReg(R0) +T42A8 006:485.163 - 0.007ms returns 0x00000000 +T42A8 006:485.749 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:485.765 Data: 06 D0 00 20 10 BD 19 46 14 20 FF F7 C9 FE 10 BD ... +T42A8 006:485.785 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:489.849 - 4.099ms returns 0x100 +T42A8 006:489.878 JLINK_HasError() +T42A8 006:489.890 JLINK_WriteReg(R0, 0x18012A00) +T42A8 006:489.901 - 0.011ms returns 0 +T42A8 006:489.910 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:489.917 - 0.007ms returns 0 +T42A8 006:489.926 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:489.933 - 0.007ms returns 0 +T42A8 006:489.941 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:489.948 - 0.006ms returns 0 +T42A8 006:489.957 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:489.963 - 0.006ms returns 0 +T42A8 006:489.972 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:489.979 - 0.006ms returns 0 +T42A8 006:489.987 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:489.994 - 0.006ms returns 0 +T42A8 006:490.013 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:490.020 - 0.007ms returns 0 +T42A8 006:490.029 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:490.037 - 0.008ms returns 0 +T42A8 006:490.045 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:490.052 - 0.006ms returns 0 +T42A8 006:490.060 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:490.067 - 0.007ms returns 0 +T42A8 006:490.076 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:490.083 - 0.006ms returns 0 +T42A8 006:490.091 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:490.098 - 0.007ms returns 0 +T42A8 006:490.107 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:490.114 - 0.007ms returns 0 +T42A8 006:490.123 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:490.131 - 0.007ms returns 0 +T42A8 006:490.141 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:490.149 - 0.009ms returns 0 +T42A8 006:490.158 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:490.168 - 0.009ms returns 0 +T42A8 006:490.179 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:490.188 - 0.008ms returns 0 +T42A8 006:490.200 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:490.209 - 0.009ms returns 0 +T42A8 006:490.220 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:490.237 - 0.017ms returns 0 +T42A8 006:490.250 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:490.259 - 0.009ms returns 0x00000112 +T42A8 006:490.267 JLINK_Go() +T42A8 006:490.283 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:496.234 - 5.966ms +T42A8 006:496.251 JLINK_IsHalted() +T42A8 006:496.895 - 0.643ms returns FALSE +T42A8 006:496.909 JLINK_HasError() +T42A8 006:499.073 JLINK_IsHalted() +T42A8 006:505.070 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:505.703 - 6.629ms returns TRUE +T42A8 006:505.719 JLINK_ReadReg(R15 (PC)) +T42A8 006:505.729 - 0.008ms returns 0x20003000 +T42A8 006:505.737 JLINK_ClrBPEx(BPHandle = 0x00000112) +T42A8 006:505.745 - 0.007ms returns 0x00 +T42A8 006:505.820 JLINK_ReadReg(R0) +T42A8 006:505.833 - 0.012ms returns 0x00000000 +T42A8 006:506.436 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:506.448 Data: 70 B5 0E 46 05 46 2A 23 03 22 06 21 15 48 00 F0 ... +T42A8 006:506.463 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:510.421 - 3.985ms returns 0x100 +T42A8 006:510.436 JLINK_HasError() +T42A8 006:510.446 JLINK_WriteReg(R0, 0x18012B00) +T42A8 006:510.455 - 0.009ms returns 0 +T42A8 006:510.463 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:510.470 - 0.007ms returns 0 +T42A8 006:510.479 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:510.486 - 0.007ms returns 0 +T42A8 006:510.494 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:510.501 - 0.006ms returns 0 +T42A8 006:510.510 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:510.517 - 0.006ms returns 0 +T42A8 006:510.525 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:510.532 - 0.006ms returns 0 +T42A8 006:510.540 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:510.547 - 0.006ms returns 0 +T42A8 006:510.555 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:510.562 - 0.006ms returns 0 +T42A8 006:510.571 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:510.577 - 0.006ms returns 0 +T42A8 006:510.586 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:510.593 - 0.006ms returns 0 +T42A8 006:510.601 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:510.608 - 0.006ms returns 0 +T42A8 006:510.616 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:510.623 - 0.006ms returns 0 +T42A8 006:510.631 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:510.638 - 0.006ms returns 0 +T42A8 006:510.647 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:510.654 - 0.007ms returns 0 +T42A8 006:510.663 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:510.669 - 0.006ms returns 0 +T42A8 006:510.678 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:510.685 - 0.007ms returns 0 +T42A8 006:510.694 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:510.701 - 0.007ms returns 0 +T42A8 006:510.709 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:510.716 - 0.006ms returns 0 +T42A8 006:510.724 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:510.731 - 0.006ms returns 0 +T42A8 006:510.739 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:510.746 - 0.007ms returns 0 +T42A8 006:510.755 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:510.763 - 0.008ms returns 0x00000113 +T42A8 006:510.771 JLINK_Go() +T42A8 006:510.784 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:516.893 - 6.121ms +T42A8 006:516.907 JLINK_IsHalted() +T42A8 006:517.599 - 0.692ms returns FALSE +T42A8 006:517.612 JLINK_HasError() +T42A8 006:519.017 JLINK_IsHalted() +T42A8 006:525.054 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:525.690 - 6.671ms returns TRUE +T42A8 006:525.704 JLINK_ReadReg(R15 (PC)) +T42A8 006:525.713 - 0.008ms returns 0x20003000 +T42A8 006:525.721 JLINK_ClrBPEx(BPHandle = 0x00000113) +T42A8 006:525.729 - 0.007ms returns 0x00 +T42A8 006:525.737 JLINK_ReadReg(R0) +T42A8 006:525.745 - 0.006ms returns 0x00000000 +T42A8 006:526.153 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:526.161 Data: 11 05 00 00 F8 B5 0F 46 11 46 1E 46 08 31 8B B2 ... +T42A8 006:526.171 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:530.077 - 3.923ms returns 0x100 +T42A8 006:530.089 JLINK_HasError() +T42A8 006:530.097 JLINK_WriteReg(R0, 0x18012C00) +T42A8 006:530.103 - 0.006ms returns 0 +T42A8 006:530.110 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:530.115 - 0.005ms returns 0 +T42A8 006:530.124 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:530.131 - 0.007ms returns 0 +T42A8 006:530.139 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:530.144 - 0.005ms returns 0 +T42A8 006:530.150 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:530.155 - 0.005ms returns 0 +T42A8 006:530.162 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:530.167 - 0.005ms returns 0 +T42A8 006:530.228 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:530.237 - 0.009ms returns 0 +T42A8 006:530.244 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:530.249 - 0.005ms returns 0 +T42A8 006:530.256 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:530.261 - 0.005ms returns 0 +T42A8 006:530.267 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:530.273 - 0.005ms returns 0 +T42A8 006:530.279 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:530.285 - 0.006ms returns 0 +T42A8 006:530.292 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:530.297 - 0.005ms returns 0 +T42A8 006:530.304 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:530.309 - 0.005ms returns 0 +T42A8 006:530.315 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:530.321 - 0.006ms returns 0 +T42A8 006:530.328 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:530.333 - 0.005ms returns 0 +T42A8 006:530.339 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:530.345 - 0.005ms returns 0 +T42A8 006:530.351 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:530.357 - 0.005ms returns 0 +T42A8 006:530.363 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:530.368 - 0.005ms returns 0 +T42A8 006:530.374 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:530.379 - 0.005ms returns 0 +T42A8 006:530.386 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:530.391 - 0.005ms returns 0 +T42A8 006:530.398 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:530.404 - 0.006ms returns 0x00000114 +T42A8 006:530.411 JLINK_Go() +T42A8 006:530.420 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:536.487 - 6.076ms +T42A8 006:536.498 JLINK_IsHalted() +T42A8 006:537.053 - 0.555ms returns FALSE +T42A8 006:537.065 JLINK_HasError() +T42A8 006:538.995 JLINK_IsHalted() +T42A8 006:545.012 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:545.645 - 6.649ms returns TRUE +T42A8 006:545.661 JLINK_ReadReg(R15 (PC)) +T42A8 006:545.669 - 0.008ms returns 0x20003000 +T42A8 006:545.678 JLINK_ClrBPEx(BPHandle = 0x00000114) +T42A8 006:545.685 - 0.007ms returns 0x00 +T42A8 006:545.693 JLINK_ReadReg(R0) +T42A8 006:545.701 - 0.006ms returns 0x00000000 +T42A8 006:546.175 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:546.186 Data: FA E7 00 00 D1 08 00 00 40 10 03 40 53 74 61 72 ... +T42A8 006:546.200 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:550.044 - 3.868ms returns 0x100 +T42A8 006:550.063 JLINK_HasError() +T42A8 006:550.074 JLINK_WriteReg(R0, 0x18012D00) +T42A8 006:550.084 - 0.010ms returns 0 +T42A8 006:550.094 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:550.102 - 0.008ms returns 0 +T42A8 006:550.112 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:550.119 - 0.007ms returns 0 +T42A8 006:550.129 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:550.137 - 0.007ms returns 0 +T42A8 006:550.146 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:550.153 - 0.007ms returns 0 +T42A8 006:550.163 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:550.171 - 0.007ms returns 0 +T42A8 006:550.180 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:550.188 - 0.007ms returns 0 +T42A8 006:550.197 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:550.205 - 0.007ms returns 0 +T42A8 006:550.214 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:550.222 - 0.007ms returns 0 +T42A8 006:550.231 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:550.239 - 0.007ms returns 0 +T42A8 006:550.249 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:550.256 - 0.007ms returns 0 +T42A8 006:550.265 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:550.273 - 0.007ms returns 0 +T42A8 006:550.283 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:550.290 - 0.007ms returns 0 +T42A8 006:550.300 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:550.308 - 0.008ms returns 0 +T42A8 006:550.317 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:550.325 - 0.007ms returns 0 +T42A8 006:550.334 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:550.342 - 0.007ms returns 0 +T42A8 006:550.382 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:550.390 - 0.008ms returns 0 +T42A8 006:550.399 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:550.406 - 0.007ms returns 0 +T42A8 006:550.416 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:550.423 - 0.007ms returns 0 +T42A8 006:550.432 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:550.439 - 0.007ms returns 0 +T42A8 006:550.449 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:550.457 - 0.008ms returns 0x00000115 +T42A8 006:550.467 JLINK_Go() +T42A8 006:550.480 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:556.306 - 5.839ms +T42A8 006:556.333 JLINK_IsHalted() +T42A8 006:556.886 - 0.552ms returns FALSE +T42A8 006:556.899 JLINK_HasError() +T42A8 006:562.048 JLINK_IsHalted() +T42A8 006:568.202 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:569.111 - 7.063ms returns TRUE +T42A8 006:569.134 JLINK_ReadReg(R15 (PC)) +T42A8 006:569.143 - 0.008ms returns 0x20003000 +T42A8 006:569.149 JLINK_ClrBPEx(BPHandle = 0x00000115) +T42A8 006:569.155 - 0.005ms returns 0x00 +T42A8 006:569.161 JLINK_ReadReg(R0) +T42A8 006:569.167 - 0.005ms returns 0x00000000 +T42A8 006:569.610 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:569.622 Data: C7 40 B8 07 80 0F 69 46 88 80 01 A8 02 23 00 21 ... +T42A8 006:569.637 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:573.607 - 3.996ms returns 0x100 +T42A8 006:573.643 JLINK_HasError() +T42A8 006:573.653 JLINK_WriteReg(R0, 0x18012E00) +T42A8 006:573.683 - 0.029ms returns 0 +T42A8 006:573.692 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:573.699 - 0.007ms returns 0 +T42A8 006:573.706 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:573.726 - 0.020ms returns 0 +T42A8 006:573.734 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:573.740 - 0.006ms returns 0 +T42A8 006:573.745 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:573.751 - 0.005ms returns 0 +T42A8 006:573.756 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:573.761 - 0.004ms returns 0 +T42A8 006:573.767 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:573.771 - 0.004ms returns 0 +T42A8 006:573.792 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:573.797 - 0.004ms returns 0 +T42A8 006:573.803 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:573.830 - 0.027ms returns 0 +T42A8 006:573.837 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:573.841 - 0.005ms returns 0 +T42A8 006:573.848 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:573.853 - 0.005ms returns 0 +T42A8 006:573.859 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:573.864 - 0.005ms returns 0 +T42A8 006:573.870 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:573.888 - 0.017ms returns 0 +T42A8 006:573.894 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:573.899 - 0.005ms returns 0 +T42A8 006:573.905 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:573.910 - 0.004ms returns 0 +T42A8 006:573.917 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:573.921 - 0.005ms returns 0 +T42A8 006:573.927 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:573.932 - 0.004ms returns 0 +T42A8 006:573.937 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:573.942 - 0.004ms returns 0 +T42A8 006:573.948 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:573.953 - 0.004ms returns 0 +T42A8 006:573.958 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:573.963 - 0.004ms returns 0 +T42A8 006:573.970 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:573.976 - 0.006ms returns 0x00000116 +T42A8 006:573.982 JLINK_Go() +T42A8 006:573.994 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:579.979 - 5.996ms +T42A8 006:579.993 JLINK_IsHalted() +T42A8 006:580.647 - 0.653ms returns FALSE +T42A8 006:580.660 JLINK_HasError() +T42A8 006:581.899 JLINK_IsHalted() +T42A8 006:587.964 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:588.605 - 6.705ms returns TRUE +T42A8 006:588.617 JLINK_ReadReg(R15 (PC)) +T42A8 006:588.625 - 0.007ms returns 0x20003000 +T42A8 006:588.631 JLINK_ClrBPEx(BPHandle = 0x00000116) +T42A8 006:588.637 - 0.006ms returns 0x00 +T42A8 006:588.644 JLINK_ReadReg(R0) +T42A8 006:588.649 - 0.005ms returns 0x00000000 +T42A8 006:589.084 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:589.093 Data: 81 B2 35 48 08 18 A0 60 35 4D 34 48 E8 63 35 49 ... +T42A8 006:589.108 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:592.951 - 3.866ms returns 0x100 +T42A8 006:592.966 JLINK_HasError() +T42A8 006:592.974 JLINK_WriteReg(R0, 0x18012F00) +T42A8 006:592.981 - 0.007ms returns 0 +T42A8 006:592.988 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:592.993 - 0.005ms returns 0 +T42A8 006:592.999 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:593.004 - 0.005ms returns 0 +T42A8 006:593.010 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:593.015 - 0.005ms returns 0 +T42A8 006:593.021 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:593.026 - 0.005ms returns 0 +T42A8 006:593.033 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:593.038 - 0.005ms returns 0 +T42A8 006:593.044 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:593.049 - 0.005ms returns 0 +T42A8 006:593.055 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:593.060 - 0.005ms returns 0 +T42A8 006:593.066 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:593.071 - 0.005ms returns 0 +T42A8 006:593.077 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:593.082 - 0.005ms returns 0 +T42A8 006:593.089 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:593.093 - 0.005ms returns 0 +T42A8 006:593.099 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:593.105 - 0.005ms returns 0 +T42A8 006:593.111 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:593.116 - 0.005ms returns 0 +T42A8 006:593.122 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:593.127 - 0.005ms returns 0 +T42A8 006:593.133 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:593.138 - 0.005ms returns 0 +T42A8 006:593.144 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:593.149 - 0.005ms returns 0 +T42A8 006:593.155 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:593.160 - 0.005ms returns 0 +T42A8 006:593.167 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:593.171 - 0.005ms returns 0 +T42A8 006:593.177 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:593.183 - 0.004ms returns 0 +T42A8 006:593.189 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:593.193 - 0.005ms returns 0 +T42A8 006:593.200 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:593.206 - 0.006ms returns 0x00000117 +T42A8 006:593.212 JLINK_Go() +T42A8 006:593.222 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:599.313 - 6.101ms +T42A8 006:599.325 JLINK_IsHalted() +T42A8 006:599.901 - 0.576ms returns FALSE +T42A8 006:599.913 JLINK_HasError() +T42A8 006:601.814 JLINK_IsHalted() +T42A8 006:607.725 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:608.331 - 6.516ms returns TRUE +T42A8 006:608.344 JLINK_ReadReg(R15 (PC)) +T42A8 006:608.352 - 0.008ms returns 0x20003000 +T42A8 006:608.361 JLINK_ClrBPEx(BPHandle = 0x00000117) +T42A8 006:608.368 - 0.007ms returns 0x00 +T42A8 006:608.376 JLINK_ReadReg(R0) +T42A8 006:608.383 - 0.006ms returns 0x00000000 +T42A8 006:608.861 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:608.872 Data: 00 F0 6A F8 03 22 8B 21 00 20 00 F0 37 F8 11 23 ... +T42A8 006:608.887 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:612.820 - 3.958ms returns 0x100 +T42A8 006:612.835 JLINK_HasError() +T42A8 006:612.845 JLINK_WriteReg(R0, 0x18013000) +T42A8 006:612.853 - 0.008ms returns 0 +T42A8 006:612.863 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:612.870 - 0.007ms returns 0 +T42A8 006:612.879 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:612.886 - 0.007ms returns 0 +T42A8 006:612.894 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:612.901 - 0.007ms returns 0 +T42A8 006:612.910 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:612.917 - 0.007ms returns 0 +T42A8 006:612.926 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:612.933 - 0.007ms returns 0 +T42A8 006:612.942 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:612.949 - 0.007ms returns 0 +T42A8 006:612.957 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:612.965 - 0.007ms returns 0 +T42A8 006:612.974 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:612.981 - 0.007ms returns 0 +T42A8 006:612.989 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:612.996 - 0.007ms returns 0 +T42A8 006:613.005 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:613.012 - 0.007ms returns 0 +T42A8 006:613.021 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:613.028 - 0.007ms returns 0 +T42A8 006:613.037 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:613.047 - 0.010ms returns 0 +T42A8 006:613.056 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:613.064 - 0.007ms returns 0 +T42A8 006:613.073 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:613.079 - 0.007ms returns 0 +T42A8 006:613.088 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:613.095 - 0.007ms returns 0 +T42A8 006:613.104 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:613.111 - 0.007ms returns 0 +T42A8 006:613.120 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:613.127 - 0.007ms returns 0 +T42A8 006:613.136 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:613.143 - 0.007ms returns 0 +T42A8 006:613.153 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:613.161 - 0.008ms returns 0 +T42A8 006:613.171 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:613.179 - 0.008ms returns 0x00000118 +T42A8 006:613.187 JLINK_Go() +T42A8 006:613.199 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:619.200 - 6.012ms +T42A8 006:619.219 JLINK_IsHalted() +T42A8 006:619.830 - 0.610ms returns FALSE +T42A8 006:619.848 JLINK_HasError() +T42A8 006:621.736 JLINK_IsHalted() +T42A8 006:627.744 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:628.395 - 6.658ms returns TRUE +T42A8 006:628.416 JLINK_ReadReg(R15 (PC)) +T42A8 006:628.429 - 0.012ms returns 0x20003000 +T42A8 006:628.443 JLINK_ClrBPEx(BPHandle = 0x00000118) +T42A8 006:628.454 - 0.011ms returns 0x00 +T42A8 006:628.467 JLINK_ReadReg(R0) +T42A8 006:628.478 - 0.010ms returns 0x00000000 +T42A8 006:629.202 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:629.219 Data: C3 00 80 3C 1B 19 59 60 E1 05 CC 6A 01 23 C0 1C ... +T42A8 006:629.241 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:633.179 - 3.977ms returns 0x100 +T42A8 006:633.205 JLINK_HasError() +T42A8 006:633.222 JLINK_WriteReg(R0, 0x18013100) +T42A8 006:633.237 - 0.015ms returns 0 +T42A8 006:633.253 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:633.266 - 0.013ms returns 0 +T42A8 006:633.281 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:633.293 - 0.012ms returns 0 +T42A8 006:633.309 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:633.321 - 0.012ms returns 0 +T42A8 006:633.337 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:633.349 - 0.012ms returns 0 +T42A8 006:633.364 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:633.377 - 0.012ms returns 0 +T42A8 006:633.392 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:633.404 - 0.012ms returns 0 +T42A8 006:633.419 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:633.432 - 0.012ms returns 0 +T42A8 006:633.447 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:633.460 - 0.012ms returns 0 +T42A8 006:633.475 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:633.487 - 0.012ms returns 0 +T42A8 006:633.503 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:633.517 - 0.014ms returns 0 +T42A8 006:633.533 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:633.545 - 0.012ms returns 0 +T42A8 006:633.561 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:633.574 - 0.012ms returns 0 +T42A8 006:633.589 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:633.603 - 0.013ms returns 0 +T42A8 006:633.643 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:633.657 - 0.014ms returns 0 +T42A8 006:633.673 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:633.685 - 0.013ms returns 0 +T42A8 006:633.701 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:633.713 - 0.012ms returns 0 +T42A8 006:633.729 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:633.741 - 0.012ms returns 0 +T42A8 006:633.756 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:633.769 - 0.012ms returns 0 +T42A8 006:633.784 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:633.796 - 0.012ms returns 0 +T42A8 006:633.813 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:633.827 - 0.014ms returns 0x00000119 +T42A8 006:633.842 JLINK_Go() +T42A8 006:633.862 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:640.170 - 6.326ms +T42A8 006:640.210 JLINK_IsHalted() +T42A8 006:640.948 - 0.736ms returns FALSE +T42A8 006:640.989 JLINK_HasError() +T42A8 006:642.669 JLINK_IsHalted() +T42A8 006:648.820 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:649.550 - 6.879ms returns TRUE +T42A8 006:649.615 JLINK_ReadReg(R15 (PC)) +T42A8 006:649.669 - 0.053ms returns 0x20003000 +T42A8 006:649.713 JLINK_ClrBPEx(BPHandle = 0x00000119) +T42A8 006:649.735 - 0.022ms returns 0x00 +T42A8 006:649.761 JLINK_ReadReg(R0) +T42A8 006:649.781 - 0.020ms returns 0x00000000 +T42A8 006:651.200 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:651.233 Data: 80 F3 10 88 10 BD 70 B5 41 4C 00 20 61 88 00 29 ... +T42A8 006:651.291 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:655.338 - 4.138ms returns 0x100 +T42A8 006:655.379 JLINK_HasError() +T42A8 006:655.406 JLINK_WriteReg(R0, 0x18013200) +T42A8 006:655.430 - 0.024ms returns 0 +T42A8 006:655.455 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:655.476 - 0.020ms returns 0 +T42A8 006:655.501 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:655.520 - 0.019ms returns 0 +T42A8 006:655.545 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:655.581 - 0.036ms returns 0 +T42A8 006:655.607 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:655.627 - 0.020ms returns 0 +T42A8 006:655.651 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:655.671 - 0.019ms returns 0 +T42A8 006:655.695 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:655.715 - 0.019ms returns 0 +T42A8 006:655.739 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:655.759 - 0.019ms returns 0 +T42A8 006:655.783 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:655.803 - 0.020ms returns 0 +T42A8 006:655.828 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:655.847 - 0.019ms returns 0 +T42A8 006:655.871 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:655.891 - 0.019ms returns 0 +T42A8 006:655.916 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:655.935 - 0.020ms returns 0 +T42A8 006:655.960 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:655.980 - 0.019ms returns 0 +T42A8 006:656.005 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:656.025 - 0.021ms returns 0 +T42A8 006:656.050 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:656.070 - 0.020ms returns 0 +T42A8 006:656.094 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:656.114 - 0.020ms returns 0 +T42A8 006:656.139 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:656.159 - 0.020ms returns 0 +T42A8 006:656.183 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:656.202 - 0.019ms returns 0 +T42A8 006:656.227 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:656.246 - 0.019ms returns 0 +T42A8 006:656.271 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:656.291 - 0.020ms returns 0 +T42A8 006:656.317 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:656.339 - 0.023ms returns 0x0000011A +T42A8 006:656.363 JLINK_Go() +T42A8 006:656.396 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:662.706 - 6.342ms +T42A8 006:662.749 JLINK_IsHalted() +T42A8 006:663.489 - 0.739ms returns FALSE +T42A8 006:663.529 JLINK_HasError() +T42A8 006:665.568 JLINK_IsHalted() +T42A8 006:671.729 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:672.451 - 6.881ms returns TRUE +T42A8 006:672.493 JLINK_ReadReg(R15 (PC)) +T42A8 006:672.541 - 0.046ms returns 0x20003000 +T42A8 006:672.568 JLINK_ClrBPEx(BPHandle = 0x0000011A) +T42A8 006:672.590 - 0.022ms returns 0x00 +T42A8 006:672.615 JLINK_ReadReg(R0) +T42A8 006:672.636 - 0.020ms returns 0x00000000 +T42A8 006:674.113 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:674.147 Data: 40 1E 03 4A D1 88 01 23 83 40 19 43 D1 80 70 47 ... +T42A8 006:674.221 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:678.314 - 4.201ms returns 0x100 +T42A8 006:678.361 JLINK_HasError() +T42A8 006:678.389 JLINK_WriteReg(R0, 0x18013300) +T42A8 006:678.414 - 0.024ms returns 0 +T42A8 006:678.444 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:678.465 - 0.021ms returns 0 +T42A8 006:678.493 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:678.534 - 0.041ms returns 0 +T42A8 006:678.563 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:678.584 - 0.020ms returns 0 +T42A8 006:678.613 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:678.633 - 0.020ms returns 0 +T42A8 006:678.661 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:678.681 - 0.020ms returns 0 +T42A8 006:678.710 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:678.730 - 0.020ms returns 0 +T42A8 006:678.758 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:678.778 - 0.020ms returns 0 +T42A8 006:678.807 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:678.827 - 0.020ms returns 0 +T42A8 006:678.863 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:678.883 - 0.019ms returns 0 +T42A8 006:678.907 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:678.927 - 0.020ms returns 0 +T42A8 006:678.956 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:678.976 - 0.019ms returns 0 +T42A8 006:679.005 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:679.025 - 0.020ms returns 0 +T42A8 006:679.054 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:679.075 - 0.021ms returns 0 +T42A8 006:679.104 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:679.124 - 0.020ms returns 0 +T42A8 006:679.153 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:679.173 - 0.020ms returns 0 +T42A8 006:679.202 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:679.222 - 0.020ms returns 0 +T42A8 006:679.251 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:679.271 - 0.020ms returns 0 +T42A8 006:679.299 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:679.319 - 0.020ms returns 0 +T42A8 006:679.343 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:679.363 - 0.019ms returns 0 +T42A8 006:679.393 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:679.416 - 0.023ms returns 0x0000011B +T42A8 006:679.444 JLINK_Go() +T42A8 006:679.477 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:685.803 - 6.357ms +T42A8 006:685.848 JLINK_IsHalted() +T42A8 006:686.598 - 0.748ms returns FALSE +T42A8 006:686.643 JLINK_HasError() +T42A8 006:700.643 JLINK_IsHalted() +T42A8 006:706.855 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:707.415 - 6.771ms returns TRUE +T42A8 006:707.458 JLINK_ReadReg(R15 (PC)) +T42A8 006:707.473 - 0.014ms returns 0x20003000 +T42A8 006:707.485 JLINK_ClrBPEx(BPHandle = 0x0000011B) +T42A8 006:707.495 - 0.009ms returns 0x00 +T42A8 006:707.506 JLINK_ReadReg(R0) +T42A8 006:707.515 - 0.009ms returns 0x00000000 +T42A8 006:708.327 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:708.343 Data: 30 60 20 68 00 28 02 D0 00 20 20 60 05 E0 75 60 ... +T42A8 006:708.365 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:712.536 - 4.208ms returns 0x100 +T42A8 006:712.577 JLINK_HasError() +T42A8 006:712.681 JLINK_WriteReg(R0, 0x18013400) +T42A8 006:712.703 - 0.021ms returns 0 +T42A8 006:712.716 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:712.725 - 0.010ms returns 0 +T42A8 006:712.737 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:712.747 - 0.009ms returns 0 +T42A8 006:712.758 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:712.767 - 0.009ms returns 0 +T42A8 006:712.778 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:712.787 - 0.009ms returns 0 +T42A8 006:712.798 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:712.807 - 0.009ms returns 0 +T42A8 006:712.818 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:712.827 - 0.009ms returns 0 +T42A8 006:712.838 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:712.848 - 0.009ms returns 0 +T42A8 006:712.859 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:712.868 - 0.009ms returns 0 +T42A8 006:712.879 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:712.889 - 0.009ms returns 0 +T42A8 006:712.900 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:712.909 - 0.009ms returns 0 +T42A8 006:712.920 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:712.929 - 0.009ms returns 0 +T42A8 006:712.940 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:712.949 - 0.009ms returns 0 +T42A8 006:712.960 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:712.969 - 0.010ms returns 0 +T42A8 006:712.981 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:712.990 - 0.009ms returns 0 +T42A8 006:713.001 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:713.010 - 0.009ms returns 0 +T42A8 006:713.021 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:713.030 - 0.009ms returns 0 +T42A8 006:713.041 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:713.051 - 0.009ms returns 0 +T42A8 006:713.062 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:713.071 - 0.009ms returns 0 +T42A8 006:713.081 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:713.091 - 0.009ms returns 0 +T42A8 006:713.103 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:713.114 - 0.012ms returns 0x0000011C +T42A8 006:713.129 JLINK_Go() +T42A8 006:713.166 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:719.464 - 6.336ms +T42A8 006:719.506 JLINK_IsHalted() +T42A8 006:720.291 - 0.783ms returns FALSE +T42A8 006:720.325 JLINK_HasError() +T42A8 006:723.561 JLINK_IsHalted() +T42A8 006:729.663 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:730.431 - 6.869ms returns TRUE +T42A8 006:730.466 JLINK_ReadReg(R15 (PC)) +T42A8 006:730.481 - 0.014ms returns 0x20003000 +T42A8 006:730.493 JLINK_ClrBPEx(BPHandle = 0x0000011C) +T42A8 006:730.503 - 0.010ms returns 0x00 +T42A8 006:730.514 JLINK_ReadReg(R0) +T42A8 006:730.524 - 0.009ms returns 0x00000000 +T42A8 006:731.284 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:731.304 Data: 02 0A 01 D0 10 46 08 39 02 09 01 D0 10 46 09 1F ... +T42A8 006:731.327 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:735.410 - 4.125ms returns 0x100 +T42A8 006:735.445 JLINK_HasError() +T42A8 006:735.461 JLINK_WriteReg(R0, 0x18013500) +T42A8 006:735.475 - 0.015ms returns 0 +T42A8 006:735.487 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:735.497 - 0.009ms returns 0 +T42A8 006:735.508 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:735.517 - 0.009ms returns 0 +T42A8 006:735.529 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:735.537 - 0.009ms returns 0 +T42A8 006:735.549 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:735.557 - 0.009ms returns 0 +T42A8 006:735.569 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:735.577 - 0.009ms returns 0 +T42A8 006:735.589 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:735.597 - 0.009ms returns 0 +T42A8 006:735.609 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:735.617 - 0.008ms returns 0 +T42A8 006:735.629 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:735.638 - 0.009ms returns 0 +T42A8 006:735.649 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:735.658 - 0.009ms returns 0 +T42A8 006:735.669 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:735.678 - 0.008ms returns 0 +T42A8 006:735.689 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:735.698 - 0.009ms returns 0 +T42A8 006:735.709 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:735.718 - 0.009ms returns 0 +T42A8 006:735.729 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:735.739 - 0.009ms returns 0 +T42A8 006:735.750 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:735.759 - 0.009ms returns 0 +T42A8 006:735.771 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:735.780 - 0.009ms returns 0 +T42A8 006:735.791 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:735.800 - 0.009ms returns 0 +T42A8 006:735.811 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:735.820 - 0.009ms returns 0 +T42A8 006:735.831 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:735.840 - 0.008ms returns 0 +T42A8 006:735.851 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:735.860 - 0.009ms returns 0 +T42A8 006:735.872 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:735.882 - 0.011ms returns 0x0000011D +T42A8 006:735.893 JLINK_Go() +T42A8 006:735.912 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:742.022 - 6.127ms +T42A8 006:742.056 JLINK_IsHalted() +T42A8 006:742.737 - 0.680ms returns FALSE +T42A8 006:742.757 JLINK_HasError() +T42A8 006:744.457 JLINK_IsHalted() +T42A8 006:750.474 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:751.126 - 6.668ms returns TRUE +T42A8 006:751.145 JLINK_ReadReg(R15 (PC)) +T42A8 006:751.157 - 0.012ms returns 0x20003000 +T42A8 006:751.169 JLINK_ClrBPEx(BPHandle = 0x0000011D) +T42A8 006:751.178 - 0.009ms returns 0x00 +T42A8 006:751.190 JLINK_ReadReg(R0) +T42A8 006:751.200 - 0.009ms returns 0x00000000 +T42A8 006:751.899 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:751.913 Data: 00 28 0A D0 A1 68 81 60 07 E0 37 48 F8 F7 96 FD ... +T42A8 006:751.933 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:755.893 - 3.993ms returns 0x100 +T42A8 006:755.914 JLINK_HasError() +T42A8 006:755.928 JLINK_WriteReg(R0, 0x18013600) +T42A8 006:755.940 - 0.012ms returns 0 +T42A8 006:755.952 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:755.961 - 0.009ms returns 0 +T42A8 006:755.972 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:755.981 - 0.009ms returns 0 +T42A8 006:755.993 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:756.001 - 0.009ms returns 0 +T42A8 006:756.013 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:756.021 - 0.009ms returns 0 +T42A8 006:756.033 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:756.046 - 0.013ms returns 0 +T42A8 006:756.057 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:756.066 - 0.009ms returns 0 +T42A8 006:756.077 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:756.088 - 0.010ms returns 0 +T42A8 006:756.100 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:756.109 - 0.009ms returns 0 +T42A8 006:756.120 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:756.129 - 0.009ms returns 0 +T42A8 006:756.140 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:756.149 - 0.009ms returns 0 +T42A8 006:756.161 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:756.169 - 0.009ms returns 0 +T42A8 006:756.181 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:756.189 - 0.009ms returns 0 +T42A8 006:756.201 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:756.211 - 0.009ms returns 0 +T42A8 006:756.222 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:756.231 - 0.009ms returns 0 +T42A8 006:756.242 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:756.251 - 0.009ms returns 0 +T42A8 006:756.262 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:756.272 - 0.009ms returns 0 +T42A8 006:756.282 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:756.295 - 0.012ms returns 0 +T42A8 006:756.320 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:756.332 - 0.012ms returns 0 +T42A8 006:756.343 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:756.352 - 0.009ms returns 0 +T42A8 006:756.364 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:756.374 - 0.010ms returns 0x0000011E +T42A8 006:756.385 JLINK_Go() +T42A8 006:756.401 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:762.301 - 5.908ms +T42A8 006:762.345 JLINK_IsHalted() +T42A8 006:762.967 - 0.621ms returns FALSE +T42A8 006:762.987 JLINK_HasError() +T42A8 006:764.300 JLINK_IsHalted() +T42A8 006:770.207 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:770.857 - 6.556ms returns TRUE +T42A8 006:770.881 JLINK_ReadReg(R15 (PC)) +T42A8 006:770.893 - 0.011ms returns 0x20003000 +T42A8 006:770.903 JLINK_ClrBPEx(BPHandle = 0x0000011E) +T42A8 006:770.911 - 0.008ms returns 0x00 +T42A8 006:770.922 JLINK_ReadReg(R0) +T42A8 006:770.930 - 0.007ms returns 0x00000000 +T42A8 006:771.569 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:771.581 Data: 1D 46 16 46 01 21 0C 30 FF F7 36 FF 00 21 C9 43 ... +T42A8 006:771.599 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:775.565 - 3.996ms returns 0x100 +T42A8 006:775.585 JLINK_HasError() +T42A8 006:775.594 JLINK_WriteReg(R0, 0x18013700) +T42A8 006:775.602 - 0.008ms returns 0 +T42A8 006:775.609 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:775.614 - 0.005ms returns 0 +T42A8 006:775.621 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:775.625 - 0.005ms returns 0 +T42A8 006:775.632 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:775.637 - 0.005ms returns 0 +T42A8 006:775.645 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:775.650 - 0.005ms returns 0 +T42A8 006:775.656 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:775.661 - 0.005ms returns 0 +T42A8 006:775.668 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:775.673 - 0.005ms returns 0 +T42A8 006:775.679 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:775.685 - 0.005ms returns 0 +T42A8 006:775.690 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:775.696 - 0.005ms returns 0 +T42A8 006:775.702 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:775.707 - 0.005ms returns 0 +T42A8 006:775.713 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:775.718 - 0.005ms returns 0 +T42A8 006:775.725 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:775.729 - 0.005ms returns 0 +T42A8 006:775.736 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:775.741 - 0.005ms returns 0 +T42A8 006:775.747 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:775.753 - 0.005ms returns 0 +T42A8 006:775.759 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:775.765 - 0.005ms returns 0 +T42A8 006:775.771 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:775.776 - 0.005ms returns 0 +T42A8 006:775.782 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:775.787 - 0.005ms returns 0 +T42A8 006:775.793 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:775.798 - 0.005ms returns 0 +T42A8 006:775.805 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:775.809 - 0.004ms returns 0 +T42A8 006:775.821 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:775.825 - 0.005ms returns 0 +T42A8 006:775.833 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:775.839 - 0.006ms returns 0x0000011F +T42A8 006:775.845 JLINK_Go() +T42A8 006:775.857 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:781.940 - 6.093ms +T42A8 006:781.964 JLINK_IsHalted() +T42A8 006:782.720 - 0.755ms returns FALSE +T42A8 006:782.744 JLINK_HasError() +T42A8 006:789.435 JLINK_IsHalted() +T42A8 006:795.542 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:796.309 - 6.871ms returns TRUE +T42A8 006:796.341 JLINK_ReadReg(R15 (PC)) +T42A8 006:796.350 - 0.009ms returns 0x20003000 +T42A8 006:796.357 JLINK_ClrBPEx(BPHandle = 0x0000011F) +T42A8 006:796.363 - 0.005ms returns 0x00 +T42A8 006:796.369 JLINK_ReadReg(R0) +T42A8 006:796.375 - 0.005ms returns 0x00000000 +T42A8 006:796.877 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:796.890 Data: 15 46 0E 46 82 42 01 D9 05 46 02 E0 00 2D 00 D1 ... +T42A8 006:796.905 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:800.938 - 4.060ms returns 0x100 +T42A8 006:800.964 JLINK_HasError() +T42A8 006:800.972 JLINK_WriteReg(R0, 0x18013800) +T42A8 006:800.981 - 0.008ms returns 0 +T42A8 006:800.987 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:800.993 - 0.005ms returns 0 +T42A8 006:800.999 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:801.005 - 0.005ms returns 0 +T42A8 006:801.011 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:801.016 - 0.005ms returns 0 +T42A8 006:801.022 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:801.027 - 0.005ms returns 0 +T42A8 006:801.033 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:801.038 - 0.005ms returns 0 +T42A8 006:801.045 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:801.050 - 0.005ms returns 0 +T42A8 006:801.057 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:801.061 - 0.005ms returns 0 +T42A8 006:801.068 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:801.073 - 0.005ms returns 0 +T42A8 006:801.079 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:801.085 - 0.005ms returns 0 +T42A8 006:801.090 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:801.096 - 0.005ms returns 0 +T42A8 006:801.101 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:801.107 - 0.005ms returns 0 +T42A8 006:801.113 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:801.118 - 0.005ms returns 0 +T42A8 006:801.125 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:801.130 - 0.006ms returns 0 +T42A8 006:801.137 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:801.141 - 0.005ms returns 0 +T42A8 006:801.148 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:801.153 - 0.005ms returns 0 +T42A8 006:801.159 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:801.165 - 0.005ms returns 0 +T42A8 006:801.179 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:801.185 - 0.005ms returns 0 +T42A8 006:801.191 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:801.196 - 0.005ms returns 0 +T42A8 006:801.202 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:801.207 - 0.005ms returns 0 +T42A8 006:801.214 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:801.221 - 0.006ms returns 0x00000120 +T42A8 006:801.228 JLINK_Go() +T42A8 006:801.240 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:807.269 - 6.040ms +T42A8 006:809.721 JLINK_IsHalted() +T42A8 006:815.729 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:816.472 - 6.748ms returns TRUE +T42A8 006:816.522 JLINK_ReadReg(R15 (PC)) +T42A8 006:816.552 - 0.028ms returns 0x20003000 +T42A8 006:816.581 JLINK_ClrBPEx(BPHandle = 0x00000120) +T42A8 006:816.605 - 0.024ms returns 0x00 +T42A8 006:816.633 JLINK_ReadReg(R0) +T42A8 006:816.657 - 0.022ms returns 0x00000000 +T42A8 006:818.275 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:818.312 Data: 70 BD 00 00 FF FF 7F 02 FB 67 00 18 08 90 00 20 ... +T42A8 006:818.358 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:822.433 - 4.157ms returns 0x100 +T42A8 006:822.505 JLINK_HasError() +T42A8 006:822.539 JLINK_WriteReg(R0, 0x18013900) +T42A8 006:822.571 - 0.031ms returns 0 +T42A8 006:822.603 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:822.625 - 0.022ms returns 0 +T42A8 006:822.657 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:822.678 - 0.021ms returns 0 +T42A8 006:822.721 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:822.744 - 0.022ms returns 0 +T42A8 006:822.778 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:822.801 - 0.022ms returns 0 +T42A8 006:822.832 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:822.854 - 0.022ms returns 0 +T42A8 006:822.886 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:822.907 - 0.022ms returns 0 +T42A8 006:822.938 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:822.960 - 0.021ms returns 0 +T42A8 006:822.992 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:823.013 - 0.021ms returns 0 +T42A8 006:823.043 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:823.064 - 0.021ms returns 0 +T42A8 006:823.091 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:823.112 - 0.021ms returns 0 +T42A8 006:823.143 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:823.173 - 0.030ms returns 0 +T42A8 006:823.266 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:823.289 - 0.023ms returns 0 +T42A8 006:823.320 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:823.351 - 0.032ms returns 0 +T42A8 006:823.381 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:823.403 - 0.021ms returns 0 +T42A8 006:823.430 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:823.452 - 0.022ms returns 0 +T42A8 006:823.482 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:823.504 - 0.021ms returns 0 +T42A8 006:823.529 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:823.551 - 0.021ms returns 0 +T42A8 006:823.585 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:823.634 - 0.048ms returns 0 +T42A8 006:823.693 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:823.717 - 0.041ms returns 0 +T42A8 006:823.943 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:823.990 - 0.048ms returns 0x00000121 +T42A8 006:824.021 JLINK_Go() +T42A8 006:824.064 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:830.495 - 6.471ms +T42A8 006:830.558 JLINK_IsHalted() +T42A8 006:831.278 - 0.717ms returns FALSE +T42A8 006:831.331 JLINK_HasError() +T42A8 006:836.332 JLINK_IsHalted() +T42A8 006:842.862 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:843.749 - 7.415ms returns TRUE +T42A8 006:843.815 JLINK_ReadReg(R15 (PC)) +T42A8 006:843.846 - 0.031ms returns 0x20003000 +T42A8 006:843.876 JLINK_ClrBPEx(BPHandle = 0x00000121) +T42A8 006:843.900 - 0.024ms returns 0x00 +T42A8 006:843.928 JLINK_ReadReg(R0) +T42A8 006:843.952 - 0.023ms returns 0x00000000 +T42A8 006:845.693 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:845.733 Data: 10 88 30 BD F0 B5 00 20 84 46 01 20 49 4E C0 07 ... +T42A8 006:845.784 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:850.075 - 4.381ms returns 0x100 +T42A8 006:850.152 JLINK_HasError() +T42A8 006:850.345 JLINK_WriteReg(R0, 0x18013A00) +T42A8 006:850.393 - 0.049ms returns 0 +T42A8 006:850.425 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:850.449 - 0.023ms returns 0 +T42A8 006:850.476 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:850.499 - 0.022ms returns 0 +T42A8 006:850.526 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:850.549 - 0.022ms returns 0 +T42A8 006:850.576 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:850.598 - 0.022ms returns 0 +T42A8 006:850.625 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:850.648 - 0.022ms returns 0 +T42A8 006:850.675 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:850.697 - 0.022ms returns 0 +T42A8 006:850.725 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:850.747 - 0.022ms returns 0 +T42A8 006:850.774 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:850.796 - 0.022ms returns 0 +T42A8 006:850.823 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:850.845 - 0.022ms returns 0 +T42A8 006:850.873 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:850.895 - 0.022ms returns 0 +T42A8 006:850.922 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:850.944 - 0.022ms returns 0 +T42A8 006:850.971 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:850.993 - 0.022ms returns 0 +T42A8 006:851.021 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:851.100 - 0.078ms returns 0 +T42A8 006:851.149 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:851.188 - 0.038ms returns 0 +T42A8 006:851.229 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:851.265 - 0.035ms returns 0 +T42A8 006:851.305 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:851.341 - 0.035ms returns 0 +T42A8 006:851.399 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:851.435 - 0.036ms returns 0 +T42A8 006:851.474 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:851.509 - 0.034ms returns 0 +T42A8 006:851.549 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:851.583 - 0.034ms returns 0 +T42A8 006:851.627 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:851.665 - 0.040ms returns 0x00000122 +T42A8 006:851.705 JLINK_Go() +T42A8 006:851.773 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:858.326 - 6.619ms +T42A8 006:858.392 JLINK_IsHalted() +T42A8 006:859.143 - 0.749ms returns FALSE +T42A8 006:859.196 JLINK_HasError() +T42A8 006:861.252 JLINK_IsHalted() +T42A8 006:867.478 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:868.287 - 7.033ms returns TRUE +T42A8 006:868.341 JLINK_ReadReg(R15 (PC)) +T42A8 006:868.373 - 0.031ms returns 0x20003000 +T42A8 006:868.402 JLINK_ClrBPEx(BPHandle = 0x00000122) +T42A8 006:868.426 - 0.024ms returns 0x00 +T42A8 006:868.454 JLINK_ReadReg(R0) +T42A8 006:868.477 - 0.022ms returns 0x00000000 +T42A8 006:870.262 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:870.302 Data: 40 38 41 63 01 99 81 63 02 99 C1 63 09 4A 03 99 ... +T42A8 006:870.353 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:874.493 - 4.230ms returns 0x100 +T42A8 006:874.558 JLINK_HasError() +T42A8 006:874.592 JLINK_WriteReg(R0, 0x18013B00) +T42A8 006:874.623 - 0.031ms returns 0 +T42A8 006:874.669 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:874.692 - 0.022ms returns 0 +T42A8 006:874.718 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:874.740 - 0.021ms returns 0 +T42A8 006:874.766 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:874.787 - 0.021ms returns 0 +T42A8 006:874.813 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:874.834 - 0.021ms returns 0 +T42A8 006:874.870 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:874.893 - 0.022ms returns 0 +T42A8 006:874.920 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:874.941 - 0.021ms returns 0 +T42A8 006:874.993 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:875.022 - 0.054ms returns 0 +T42A8 006:875.049 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:875.100 - 0.050ms returns 0 +T42A8 006:875.126 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:875.147 - 0.021ms returns 0 +T42A8 006:875.174 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:875.195 - 0.021ms returns 0 +T42A8 006:875.221 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:875.242 - 0.021ms returns 0 +T42A8 006:875.269 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:875.290 - 0.021ms returns 0 +T42A8 006:875.317 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:875.340 - 0.023ms returns 0 +T42A8 006:875.366 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:875.387 - 0.021ms returns 0 +T42A8 006:875.414 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:875.435 - 0.021ms returns 0 +T42A8 006:875.462 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:875.483 - 0.021ms returns 0 +T42A8 006:875.509 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:875.530 - 0.021ms returns 0 +T42A8 006:875.557 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:875.577 - 0.021ms returns 0 +T42A8 006:875.604 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:875.625 - 0.021ms returns 0 +T42A8 006:875.653 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:875.678 - 0.025ms returns 0x00000123 +T42A8 006:875.707 JLINK_Go() +T42A8 006:875.747 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:882.195 - 6.485ms +T42A8 006:882.288 JLINK_IsHalted() +T42A8 006:883.186 - 0.895ms returns FALSE +T42A8 006:883.287 JLINK_HasError() +T42A8 006:900.109 JLINK_IsHalted() +T42A8 006:906.303 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:906.970 - 6.861ms returns TRUE +T42A8 006:907.004 JLINK_ReadReg(R15 (PC)) +T42A8 006:907.019 - 0.015ms returns 0x20003000 +T42A8 006:907.033 JLINK_ClrBPEx(BPHandle = 0x00000123) +T42A8 006:907.044 - 0.010ms returns 0x00 +T42A8 006:907.056 JLINK_ReadReg(R0) +T42A8 006:907.065 - 0.009ms returns 0x00000000 +T42A8 006:907.821 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:907.841 Data: 00 2C 26 D0 20 46 40 38 80 8F 1A 49 88 42 20 D1 ... +T42A8 006:907.865 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:911.943 - 4.122ms returns 0x100 +T42A8 006:911.990 JLINK_HasError() +T42A8 006:912.090 JLINK_WriteReg(R0, 0x18013C00) +T42A8 006:912.113 - 0.023ms returns 0 +T42A8 006:912.126 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:912.137 - 0.010ms returns 0 +T42A8 006:912.149 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:912.158 - 0.009ms returns 0 +T42A8 006:912.169 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:912.179 - 0.009ms returns 0 +T42A8 006:912.191 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:912.201 - 0.009ms returns 0 +T42A8 006:912.213 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:912.222 - 0.009ms returns 0 +T42A8 006:912.234 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:912.243 - 0.009ms returns 0 +T42A8 006:912.255 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:912.265 - 0.009ms returns 0 +T42A8 006:912.278 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:912.287 - 0.011ms returns 0 +T42A8 006:912.299 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:912.309 - 0.009ms returns 0 +T42A8 006:912.320 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:912.329 - 0.009ms returns 0 +T42A8 006:912.341 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:912.351 - 0.009ms returns 0 +T42A8 006:912.362 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:912.372 - 0.009ms returns 0 +T42A8 006:912.384 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:912.394 - 0.010ms returns 0 +T42A8 006:912.406 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:912.415 - 0.009ms returns 0 +T42A8 006:912.427 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:912.437 - 0.009ms returns 0 +T42A8 006:912.449 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:912.458 - 0.009ms returns 0 +T42A8 006:912.469 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:912.479 - 0.009ms returns 0 +T42A8 006:912.491 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:912.500 - 0.009ms returns 0 +T42A8 006:912.512 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:912.521 - 0.009ms returns 0 +T42A8 006:912.533 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:912.545 - 0.012ms returns 0x00000124 +T42A8 006:912.557 JLINK_Go() +T42A8 006:912.577 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:919.098 - 6.540ms +T42A8 006:919.132 JLINK_IsHalted() +T42A8 006:919.916 - 0.782ms returns FALSE +T42A8 006:919.951 JLINK_HasError() +T42A8 006:922.045 JLINK_IsHalted() +T42A8 006:928.262 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:928.940 - 6.895ms returns TRUE +T42A8 006:928.952 JLINK_ReadReg(R15 (PC)) +T42A8 006:928.960 - 0.007ms returns 0x20003000 +T42A8 006:928.966 JLINK_ClrBPEx(BPHandle = 0x00000124) +T42A8 006:928.972 - 0.005ms returns 0x00 +T42A8 006:928.978 JLINK_ReadReg(R0) +T42A8 006:928.984 - 0.005ms returns 0x00000000 +T42A8 006:929.403 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:929.411 Data: 10 4E 35 88 00 2D 1B D0 00 24 01 27 0C E0 38 46 ... +T42A8 006:929.423 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:933.397 - 3.994ms returns 0x100 +T42A8 006:933.408 JLINK_HasError() +T42A8 006:933.415 JLINK_WriteReg(R0, 0x18013D00) +T42A8 006:933.421 - 0.006ms returns 0 +T42A8 006:933.428 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:933.433 - 0.005ms returns 0 +T42A8 006:933.440 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:933.445 - 0.005ms returns 0 +T42A8 006:933.451 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:933.456 - 0.005ms returns 0 +T42A8 006:933.462 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:933.467 - 0.005ms returns 0 +T42A8 006:933.473 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:933.479 - 0.005ms returns 0 +T42A8 006:933.485 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:933.490 - 0.005ms returns 0 +T42A8 006:933.497 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:933.501 - 0.005ms returns 0 +T42A8 006:933.508 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:933.513 - 0.005ms returns 0 +T42A8 006:933.519 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:933.524 - 0.005ms returns 0 +T42A8 006:933.530 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:933.536 - 0.005ms returns 0 +T42A8 006:933.541 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:933.547 - 0.005ms returns 0 +T42A8 006:933.553 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:933.558 - 0.005ms returns 0 +T42A8 006:933.565 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:933.573 - 0.007ms returns 0 +T42A8 006:933.581 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:933.586 - 0.005ms returns 0 +T42A8 006:933.593 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:933.597 - 0.005ms returns 0 +T42A8 006:933.604 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:933.609 - 0.005ms returns 0 +T42A8 006:933.615 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:933.621 - 0.005ms returns 0 +T42A8 006:933.626 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:933.632 - 0.005ms returns 0 +T42A8 006:933.638 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:933.643 - 0.005ms returns 0 +T42A8 006:933.649 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:933.656 - 0.006ms returns 0x00000125 +T42A8 006:933.662 JLINK_Go() +T42A8 006:933.672 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:939.668 - 6.005ms +T42A8 006:939.681 JLINK_IsHalted() +T42A8 006:940.273 - 0.591ms returns FALSE +T42A8 006:940.290 JLINK_HasError() +T42A8 006:944.885 JLINK_IsHalted() +T42A8 006:951.373 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:952.125 - 7.238ms returns TRUE +T42A8 006:952.178 JLINK_ReadReg(R15 (PC)) +T42A8 006:952.209 - 0.030ms returns 0x20003000 +T42A8 006:952.238 JLINK_ClrBPEx(BPHandle = 0x00000125) +T42A8 006:952.262 - 0.024ms returns 0x00 +T42A8 006:952.291 JLINK_ReadReg(R0) +T42A8 006:952.314 - 0.022ms returns 0x00000000 +T42A8 006:953.977 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:954.013 Data: 04 21 40 1E 20 73 A0 7A 40 1C FD F7 F5 FB A1 72 ... +T42A8 006:954.061 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:958.041 - 4.063ms returns 0x100 +T42A8 006:958.106 JLINK_HasError() +T42A8 006:958.161 JLINK_WriteReg(R0, 0x18013E00) +T42A8 006:958.192 - 0.031ms returns 0 +T42A8 006:958.219 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:958.242 - 0.022ms returns 0 +T42A8 006:958.269 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:958.291 - 0.021ms returns 0 +T42A8 006:958.340 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:958.367 - 0.026ms returns 0 +T42A8 006:958.394 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:958.416 - 0.022ms returns 0 +T42A8 006:958.443 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:958.465 - 0.021ms returns 0 +T42A8 006:958.491 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:958.512 - 0.021ms returns 0 +T42A8 006:958.537 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:958.559 - 0.021ms returns 0 +T42A8 006:958.585 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:958.606 - 0.021ms returns 0 +T42A8 006:958.633 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:958.654 - 0.021ms returns 0 +T42A8 006:958.681 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:958.701 - 0.021ms returns 0 +T42A8 006:958.728 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:958.749 - 0.021ms returns 0 +T42A8 006:958.775 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:958.801 - 0.026ms returns 0 +T42A8 006:958.852 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:958.889 - 0.039ms returns 0 +T42A8 006:958.936 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:958.989 - 0.054ms returns 0 +T42A8 006:959.021 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:959.043 - 0.023ms returns 0 +T42A8 006:959.069 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:959.091 - 0.021ms returns 0 +T42A8 006:959.117 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:959.138 - 0.021ms returns 0 +T42A8 006:959.165 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:959.185 - 0.021ms returns 0 +T42A8 006:959.211 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:959.233 - 0.021ms returns 0 +T42A8 006:959.261 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:959.286 - 0.026ms returns 0x00000126 +T42A8 006:959.313 JLINK_Go() +T42A8 006:959.353 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:965.973 - 6.656ms +T42A8 006:966.064 JLINK_IsHalted() +T42A8 006:966.967 - 0.900ms returns FALSE +T42A8 006:967.039 JLINK_HasError() +T42A8 006:971.921 JLINK_IsHalted() +T42A8 006:978.292 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 006:979.119 - 7.195ms returns TRUE +T42A8 006:979.185 JLINK_ReadReg(R15 (PC)) +T42A8 006:979.216 - 0.030ms returns 0x20003000 +T42A8 006:979.244 JLINK_ClrBPEx(BPHandle = 0x00000126) +T42A8 006:979.267 - 0.022ms returns 0x00 +T42A8 006:979.307 JLINK_ReadReg(R0) +T42A8 006:979.329 - 0.022ms returns 0x00000000 +T42A8 006:981.189 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 006:981.231 Data: C0 07 11 D0 00 98 80 8B 27 21 80 05 80 0D 09 01 ... +T42A8 006:981.282 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 006:985.445 - 4.256ms returns 0x100 +T42A8 006:985.512 JLINK_HasError() +T42A8 006:985.545 JLINK_WriteReg(R0, 0x18013F00) +T42A8 006:985.605 - 0.060ms returns 0 +T42A8 006:985.633 JLINK_WriteReg(R1, 0x00000100) +T42A8 006:985.657 - 0.023ms returns 0 +T42A8 006:985.708 JLINK_WriteReg(R2, 0x200039D4) +T42A8 006:985.732 - 0.024ms returns 0 +T42A8 006:985.760 JLINK_WriteReg(R3, 0x00000000) +T42A8 006:985.782 - 0.022ms returns 0 +T42A8 006:985.810 JLINK_WriteReg(R4, 0x00000000) +T42A8 006:985.833 - 0.022ms returns 0 +T42A8 006:985.859 JLINK_WriteReg(R5, 0x00000000) +T42A8 006:985.881 - 0.022ms returns 0 +T42A8 006:985.909 JLINK_WriteReg(R6, 0x00000000) +T42A8 006:985.930 - 0.021ms returns 0 +T42A8 006:985.957 JLINK_WriteReg(R7, 0x00000000) +T42A8 006:985.979 - 0.022ms returns 0 +T42A8 006:986.006 JLINK_WriteReg(R8, 0x00000000) +T42A8 006:986.028 - 0.022ms returns 0 +T42A8 006:986.055 JLINK_WriteReg(R9, 0x200039B4) +T42A8 006:986.077 - 0.021ms returns 0 +T42A8 006:986.105 JLINK_WriteReg(R10, 0x00000000) +T42A8 006:986.126 - 0.022ms returns 0 +T42A8 006:986.153 JLINK_WriteReg(R11, 0x00000000) +T42A8 006:986.175 - 0.022ms returns 0 +T42A8 006:986.202 JLINK_WriteReg(R12, 0x00000000) +T42A8 006:986.225 - 0.022ms returns 0 +T42A8 006:986.252 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 006:986.275 - 0.023ms returns 0 +T42A8 006:986.302 JLINK_WriteReg(R14, 0x20003001) +T42A8 006:986.325 - 0.022ms returns 0 +T42A8 006:986.352 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 006:986.373 - 0.022ms returns 0 +T42A8 006:986.403 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 006:986.425 - 0.025ms returns 0 +T42A8 006:986.453 JLINK_WriteReg(MSP, 0x20004000) +T42A8 006:986.473 - 0.021ms returns 0 +T42A8 006:986.501 JLINK_WriteReg(PSP, 0x20004000) +T42A8 006:986.521 - 0.021ms returns 0 +T42A8 006:986.548 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 006:986.569 - 0.021ms returns 0 +T42A8 006:986.597 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 006:986.622 - 0.025ms returns 0x00000127 +T42A8 006:986.649 JLINK_Go() +T42A8 006:986.712 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 006:993.188 - 6.537ms +T42A8 006:993.256 JLINK_IsHalted() +T42A8 006:994.009 - 0.751ms returns FALSE +T42A8 006:994.064 JLINK_HasError() +T42A8 007:005.857 JLINK_IsHalted() +T42A8 007:012.332 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:013.181 - 7.323ms returns TRUE +T42A8 007:013.230 JLINK_ReadReg(R15 (PC)) +T42A8 007:013.253 - 0.021ms returns 0x20003000 +T42A8 007:013.273 JLINK_ClrBPEx(BPHandle = 0x00000127) +T42A8 007:013.289 - 0.016ms returns 0x00 +T42A8 007:013.309 JLINK_ReadReg(R0) +T42A8 007:013.324 - 0.015ms returns 0x00000000 +T42A8 007:014.541 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:014.570 Data: 49 1C FF F7 79 FB 07 80 46 80 03 99 01 71 A9 8E ... +T42A8 007:014.629 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:018.702 - 4.160ms returns 0x100 +T42A8 007:018.756 JLINK_HasError() +T42A8 007:018.781 JLINK_WriteReg(R0, 0x18014000) +T42A8 007:018.805 - 0.023ms returns 0 +T42A8 007:018.826 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:018.844 - 0.017ms returns 0 +T42A8 007:018.863 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:018.878 - 0.015ms returns 0 +T42A8 007:018.897 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:018.913 - 0.015ms returns 0 +T42A8 007:018.933 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:018.948 - 0.015ms returns 0 +T42A8 007:018.968 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:018.984 - 0.016ms returns 0 +T42A8 007:019.002 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:019.017 - 0.015ms returns 0 +T42A8 007:019.035 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:019.049 - 0.014ms returns 0 +T42A8 007:019.068 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:019.083 - 0.015ms returns 0 +T42A8 007:019.101 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:019.115 - 0.014ms returns 0 +T42A8 007:019.145 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:019.160 - 0.015ms returns 0 +T42A8 007:019.179 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:019.193 - 0.015ms returns 0 +T42A8 007:019.212 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:019.226 - 0.014ms returns 0 +T42A8 007:019.245 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:019.261 - 0.016ms returns 0 +T42A8 007:019.279 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:019.294 - 0.014ms returns 0 +T42A8 007:019.313 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:019.328 - 0.015ms returns 0 +T42A8 007:019.346 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:019.361 - 0.015ms returns 0 +T42A8 007:019.379 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:019.393 - 0.014ms returns 0 +T42A8 007:019.412 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:019.429 - 0.017ms returns 0 +T42A8 007:019.448 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:019.462 - 0.014ms returns 0 +T42A8 007:019.483 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:019.502 - 0.020ms returns 0x00000128 +T42A8 007:019.521 JLINK_Go() +T42A8 007:019.551 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:025.893 - 6.370ms +T42A8 007:025.947 JLINK_IsHalted() +T42A8 007:026.675 - 0.726ms returns FALSE +T42A8 007:026.717 JLINK_HasError() +T42A8 007:028.633 JLINK_IsHalted() +T42A8 007:034.796 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:035.493 - 6.859ms returns TRUE +T42A8 007:035.529 JLINK_ReadReg(R15 (PC)) +T42A8 007:035.582 - 0.052ms returns 0x20003000 +T42A8 007:035.604 JLINK_ClrBPEx(BPHandle = 0x00000128) +T42A8 007:035.621 - 0.016ms returns 0x00 +T42A8 007:035.642 JLINK_ReadReg(R0) +T42A8 007:035.660 - 0.017ms returns 0x00000000 +T42A8 007:036.871 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:036.901 Data: 12 09 20 46 40 30 62 64 C2 8E 52 1C C2 86 A0 7D ... +T42A8 007:036.937 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:040.937 - 4.066ms returns 0x100 +T42A8 007:040.974 JLINK_HasError() +T42A8 007:040.997 JLINK_WriteReg(R0, 0x18014100) +T42A8 007:041.019 - 0.021ms returns 0 +T42A8 007:041.038 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:041.054 - 0.015ms returns 0 +T42A8 007:041.073 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:041.089 - 0.015ms returns 0 +T42A8 007:041.107 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:041.123 - 0.015ms returns 0 +T42A8 007:041.142 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:041.157 - 0.015ms returns 0 +T42A8 007:041.183 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:041.199 - 0.016ms returns 0 +T42A8 007:041.217 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:041.232 - 0.015ms returns 0 +T42A8 007:041.251 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:041.265 - 0.014ms returns 0 +T42A8 007:041.283 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:041.298 - 0.014ms returns 0 +T42A8 007:041.316 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:041.330 - 0.014ms returns 0 +T42A8 007:041.349 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:041.363 - 0.015ms returns 0 +T42A8 007:041.381 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:041.397 - 0.015ms returns 0 +T42A8 007:041.414 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:041.429 - 0.014ms returns 0 +T42A8 007:041.448 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:041.463 - 0.016ms returns 0 +T42A8 007:041.481 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:041.497 - 0.015ms returns 0 +T42A8 007:041.515 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:041.529 - 0.015ms returns 0 +T42A8 007:041.548 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:041.568 - 0.014ms returns 0 +T42A8 007:041.597 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:041.628 - 0.031ms returns 0 +T42A8 007:041.665 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:041.683 - 0.018ms returns 0 +T42A8 007:041.702 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:041.717 - 0.015ms returns 0 +T42A8 007:041.737 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:041.755 - 0.018ms returns 0x00000129 +T42A8 007:041.773 JLINK_Go() +T42A8 007:041.801 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:048.031 - 6.256ms +T42A8 007:048.063 JLINK_IsHalted() +T42A8 007:048.798 - 0.734ms returns FALSE +T42A8 007:048.829 JLINK_HasError() +T42A8 007:052.533 JLINK_IsHalted() +T42A8 007:058.662 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:059.320 - 6.787ms returns TRUE +T42A8 007:059.333 JLINK_ReadReg(R15 (PC)) +T42A8 007:059.341 - 0.006ms returns 0x20003000 +T42A8 007:059.347 JLINK_ClrBPEx(BPHandle = 0x00000129) +T42A8 007:059.353 - 0.005ms returns 0x00 +T42A8 007:059.359 JLINK_ReadReg(R0) +T42A8 007:059.364 - 0.005ms returns 0x00000000 +T42A8 007:059.739 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:059.747 Data: C2 49 06 B2 6B 31 06 E0 70 18 06 B2 0C 98 40 1E ... +T42A8 007:059.758 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:063.667 - 3.928ms returns 0x100 +T42A8 007:063.677 JLINK_HasError() +T42A8 007:063.684 JLINK_WriteReg(R0, 0x18014200) +T42A8 007:063.690 - 0.006ms returns 0 +T42A8 007:063.697 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:063.701 - 0.005ms returns 0 +T42A8 007:063.708 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:063.713 - 0.005ms returns 0 +T42A8 007:063.719 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:063.724 - 0.005ms returns 0 +T42A8 007:063.730 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:063.735 - 0.005ms returns 0 +T42A8 007:063.741 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:063.746 - 0.005ms returns 0 +T42A8 007:063.752 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:063.757 - 0.005ms returns 0 +T42A8 007:063.763 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:063.768 - 0.004ms returns 0 +T42A8 007:063.774 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:063.779 - 0.005ms returns 0 +T42A8 007:063.785 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:063.790 - 0.004ms returns 0 +T42A8 007:063.796 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:063.801 - 0.005ms returns 0 +T42A8 007:063.807 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:063.813 - 0.005ms returns 0 +T42A8 007:063.818 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:063.823 - 0.004ms returns 0 +T42A8 007:063.829 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:063.835 - 0.005ms returns 0 +T42A8 007:063.841 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:063.845 - 0.004ms returns 0 +T42A8 007:063.852 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:063.857 - 0.005ms returns 0 +T42A8 007:063.863 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:063.868 - 0.005ms returns 0 +T42A8 007:063.874 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:063.879 - 0.004ms returns 0 +T42A8 007:063.885 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:063.890 - 0.005ms returns 0 +T42A8 007:063.897 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:063.901 - 0.005ms returns 0 +T42A8 007:063.908 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:063.915 - 0.006ms returns 0x0000012A +T42A8 007:063.921 JLINK_Go() +T42A8 007:063.933 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:070.082 - 6.161ms +T42A8 007:070.093 JLINK_IsHalted() +T42A8 007:070.752 - 0.659ms returns FALSE +T42A8 007:070.761 JLINK_HasError() +T42A8 007:072.622 JLINK_IsHalted() +T42A8 007:078.618 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:079.313 - 6.690ms returns TRUE +T42A8 007:079.323 JLINK_ReadReg(R15 (PC)) +T42A8 007:079.329 - 0.006ms returns 0x20003000 +T42A8 007:079.336 JLINK_ClrBPEx(BPHandle = 0x0000012A) +T42A8 007:079.341 - 0.005ms returns 0x00 +T42A8 007:079.347 JLINK_ReadReg(R0) +T42A8 007:079.352 - 0.004ms returns 0x00000000 +T42A8 007:079.701 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:079.709 Data: A8 8A 69 46 40 06 C4 0F 06 22 03 A8 B0 47 03 AA ... +T42A8 007:079.719 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:083.585 - 3.883ms returns 0x100 +T42A8 007:083.600 JLINK_HasError() +T42A8 007:083.608 JLINK_WriteReg(R0, 0x18014300) +T42A8 007:083.615 - 0.007ms returns 0 +T42A8 007:083.621 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:083.627 - 0.005ms returns 0 +T42A8 007:083.635 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:083.640 - 0.005ms returns 0 +T42A8 007:083.646 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:083.652 - 0.005ms returns 0 +T42A8 007:083.658 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:083.663 - 0.005ms returns 0 +T42A8 007:083.669 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:083.675 - 0.005ms returns 0 +T42A8 007:083.681 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:083.691 - 0.009ms returns 0 +T42A8 007:083.697 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:083.702 - 0.005ms returns 0 +T42A8 007:083.709 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:083.714 - 0.005ms returns 0 +T42A8 007:083.721 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:083.725 - 0.005ms returns 0 +T42A8 007:083.732 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:083.737 - 0.005ms returns 0 +T42A8 007:083.744 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:083.749 - 0.005ms returns 0 +T42A8 007:083.755 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:083.760 - 0.005ms returns 0 +T42A8 007:083.767 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:083.773 - 0.005ms returns 0 +T42A8 007:083.779 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:083.784 - 0.005ms returns 0 +T42A8 007:083.790 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:083.795 - 0.005ms returns 0 +T42A8 007:083.802 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:083.807 - 0.005ms returns 0 +T42A8 007:083.813 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:083.819 - 0.005ms returns 0 +T42A8 007:083.825 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:083.830 - 0.005ms returns 0 +T42A8 007:083.837 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:083.842 - 0.005ms returns 0 +T42A8 007:083.849 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:083.855 - 0.006ms returns 0x0000012B +T42A8 007:083.861 JLINK_Go() +T42A8 007:083.870 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:089.982 - 6.120ms +T42A8 007:089.998 JLINK_IsHalted() +T42A8 007:090.566 - 0.567ms returns FALSE +T42A8 007:090.584 JLINK_HasError() +T42A8 007:092.491 JLINK_IsHalted() +T42A8 007:098.519 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:099.159 - 6.667ms returns TRUE +T42A8 007:099.173 JLINK_ReadReg(R15 (PC)) +T42A8 007:099.183 - 0.009ms returns 0x20003000 +T42A8 007:099.193 JLINK_ClrBPEx(BPHandle = 0x0000012B) +T42A8 007:099.200 - 0.007ms returns 0x00 +T42A8 007:099.209 JLINK_ReadReg(R0) +T42A8 007:099.217 - 0.007ms returns 0x00000000 +T42A8 007:100.689 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:100.708 Data: 0A 20 A0 75 A1 82 60 6A 66 60 E0 60 20 46 F7 F7 ... +T42A8 007:100.732 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:104.637 - 3.947ms returns 0x100 +T42A8 007:104.647 JLINK_HasError() +T42A8 007:104.654 JLINK_WriteReg(R0, 0x18014400) +T42A8 007:104.661 - 0.006ms returns 0 +T42A8 007:104.667 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:104.673 - 0.005ms returns 0 +T42A8 007:104.678 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:104.683 - 0.004ms returns 0 +T42A8 007:104.689 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:104.694 - 0.004ms returns 0 +T42A8 007:104.701 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:104.705 - 0.005ms returns 0 +T42A8 007:104.711 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:104.716 - 0.004ms returns 0 +T42A8 007:104.722 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:104.727 - 0.005ms returns 0 +T42A8 007:104.733 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:104.737 - 0.004ms returns 0 +T42A8 007:104.744 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:104.749 - 0.005ms returns 0 +T42A8 007:104.755 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:104.760 - 0.004ms returns 0 +T42A8 007:104.765 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:104.770 - 0.004ms returns 0 +T42A8 007:104.777 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:104.781 - 0.005ms returns 0 +T42A8 007:104.787 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:104.792 - 0.004ms returns 0 +T42A8 007:104.798 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:104.803 - 0.005ms returns 0 +T42A8 007:104.809 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:104.814 - 0.005ms returns 0 +T42A8 007:104.821 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:104.825 - 0.005ms returns 0 +T42A8 007:104.845 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:104.849 - 0.005ms returns 0 +T42A8 007:104.856 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:104.861 - 0.005ms returns 0 +T42A8 007:104.867 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:104.873 - 0.005ms returns 0 +T42A8 007:104.878 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:104.884 - 0.005ms returns 0 +T42A8 007:104.925 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:104.933 - 0.008ms returns 0x0000012C +T42A8 007:104.940 JLINK_Go() +T42A8 007:104.949 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:111.225 - 6.285ms +T42A8 007:111.252 JLINK_IsHalted() +T42A8 007:112.029 - 0.776ms returns FALSE +T42A8 007:112.056 JLINK_HasError() +T42A8 007:118.526 JLINK_IsHalted() +T42A8 007:124.748 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:125.520 - 6.992ms returns TRUE +T42A8 007:125.549 JLINK_ReadReg(R15 (PC)) +T42A8 007:125.560 - 0.010ms returns 0x20003000 +T42A8 007:125.567 JLINK_ClrBPEx(BPHandle = 0x0000012C) +T42A8 007:125.574 - 0.006ms returns 0x00 +T42A8 007:125.581 JLINK_ReadReg(R0) +T42A8 007:125.587 - 0.005ms returns 0x00000000 +T42A8 007:126.117 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:126.130 Data: 00 80 00 20 19 0F 00 00 76 0C 00 00 06 02 00 00 ... +T42A8 007:126.165 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:130.225 - 4.107ms returns 0x100 +T42A8 007:130.251 JLINK_HasError() +T42A8 007:130.261 JLINK_WriteReg(R0, 0x18014500) +T42A8 007:130.270 - 0.009ms returns 0 +T42A8 007:130.277 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:130.284 - 0.006ms returns 0 +T42A8 007:130.302 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:130.309 - 0.006ms returns 0 +T42A8 007:130.316 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:130.321 - 0.005ms returns 0 +T42A8 007:130.329 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:130.334 - 0.006ms returns 0 +T42A8 007:130.341 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:130.348 - 0.006ms returns 0 +T42A8 007:130.357 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:130.362 - 0.006ms returns 0 +T42A8 007:130.369 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:130.375 - 0.005ms returns 0 +T42A8 007:130.382 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:130.388 - 0.005ms returns 0 +T42A8 007:130.395 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:130.401 - 0.005ms returns 0 +T42A8 007:130.408 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:130.413 - 0.005ms returns 0 +T42A8 007:130.421 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:130.426 - 0.005ms returns 0 +T42A8 007:130.433 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:130.439 - 0.005ms returns 0 +T42A8 007:130.446 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:130.453 - 0.006ms returns 0 +T42A8 007:130.460 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:130.465 - 0.005ms returns 0 +T42A8 007:130.473 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:130.478 - 0.006ms returns 0 +T42A8 007:130.485 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:130.491 - 0.005ms returns 0 +T42A8 007:130.497 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:130.504 - 0.005ms returns 0 +T42A8 007:130.510 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:130.517 - 0.006ms returns 0 +T42A8 007:130.524 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:130.530 - 0.006ms returns 0 +T42A8 007:130.538 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:130.545 - 0.007ms returns 0x0000012D +T42A8 007:130.553 JLINK_Go() +T42A8 007:130.566 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:137.067 - 6.513ms +T42A8 007:137.093 JLINK_IsHalted() +T42A8 007:137.869 - 0.775ms returns FALSE +T42A8 007:137.895 JLINK_HasError() +T42A8 007:139.405 JLINK_IsHalted() +T42A8 007:145.440 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:146.097 - 6.692ms returns TRUE +T42A8 007:146.113 JLINK_ReadReg(R15 (PC)) +T42A8 007:146.121 - 0.008ms returns 0x20003000 +T42A8 007:146.129 JLINK_ClrBPEx(BPHandle = 0x0000012D) +T42A8 007:146.135 - 0.006ms returns 0x00 +T42A8 007:146.142 JLINK_ReadReg(R0) +T42A8 007:146.149 - 0.005ms returns 0x00000000 +T42A8 007:146.647 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:146.657 Data: A8 8A 40 06 C7 0F E7 75 02 E0 A0 7D FF 28 68 D0 ... +T42A8 007:146.669 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:150.502 - 3.855ms returns 0x100 +T42A8 007:150.517 JLINK_HasError() +T42A8 007:150.525 JLINK_WriteReg(R0, 0x18014600) +T42A8 007:150.533 - 0.007ms returns 0 +T42A8 007:150.540 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:150.545 - 0.006ms returns 0 +T42A8 007:150.553 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:150.635 - 0.082ms returns 0 +T42A8 007:150.645 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:150.650 - 0.005ms returns 0 +T42A8 007:150.657 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:150.663 - 0.005ms returns 0 +T42A8 007:150.669 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:150.675 - 0.005ms returns 0 +T42A8 007:150.682 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:150.688 - 0.005ms returns 0 +T42A8 007:150.694 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:150.700 - 0.005ms returns 0 +T42A8 007:150.706 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:150.712 - 0.005ms returns 0 +T42A8 007:150.718 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:150.724 - 0.005ms returns 0 +T42A8 007:150.731 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:150.736 - 0.005ms returns 0 +T42A8 007:150.743 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:150.749 - 0.005ms returns 0 +T42A8 007:150.755 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:150.761 - 0.005ms returns 0 +T42A8 007:150.767 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:150.773 - 0.006ms returns 0 +T42A8 007:150.780 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:150.785 - 0.005ms returns 0 +T42A8 007:150.792 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:150.797 - 0.005ms returns 0 +T42A8 007:150.805 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:150.809 - 0.005ms returns 0 +T42A8 007:150.817 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:150.822 - 0.005ms returns 0 +T42A8 007:150.829 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:150.834 - 0.005ms returns 0 +T42A8 007:150.841 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:150.846 - 0.005ms returns 0 +T42A8 007:150.853 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:150.860 - 0.006ms returns 0x0000012E +T42A8 007:150.867 JLINK_Go() +T42A8 007:150.877 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:156.848 - 5.980ms +T42A8 007:156.861 JLINK_IsHalted() +T42A8 007:157.529 - 0.667ms returns FALSE +T42A8 007:157.541 JLINK_HasError() +T42A8 007:160.302 JLINK_IsHalted() +T42A8 007:166.301 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:166.942 - 6.639ms returns TRUE +T42A8 007:166.958 JLINK_ReadReg(R15 (PC)) +T42A8 007:166.968 - 0.009ms returns 0x20003000 +T42A8 007:166.978 JLINK_ClrBPEx(BPHandle = 0x0000012E) +T42A8 007:166.986 - 0.008ms returns 0x00 +T42A8 007:166.996 JLINK_ReadReg(R0) +T42A8 007:167.004 - 0.007ms returns 0x00000000 +T42A8 007:167.546 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:167.558 Data: 08 18 01 8F C9 0B 03 D0 01 8F 49 04 49 0C 01 87 ... +T42A8 007:167.575 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:171.473 - 3.925ms returns 0x100 +T42A8 007:171.495 JLINK_HasError() +T42A8 007:171.508 JLINK_WriteReg(R0, 0x18014700) +T42A8 007:171.519 - 0.011ms returns 0 +T42A8 007:171.530 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:171.539 - 0.009ms returns 0 +T42A8 007:171.552 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:171.561 - 0.008ms returns 0 +T42A8 007:171.571 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:171.580 - 0.008ms returns 0 +T42A8 007:171.591 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:171.600 - 0.008ms returns 0 +T42A8 007:171.612 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:171.621 - 0.008ms returns 0 +T42A8 007:171.633 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:171.642 - 0.008ms returns 0 +T42A8 007:171.654 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:171.663 - 0.008ms returns 0 +T42A8 007:171.674 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:171.683 - 0.008ms returns 0 +T42A8 007:171.693 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:171.702 - 0.008ms returns 0 +T42A8 007:171.714 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:171.723 - 0.008ms returns 0 +T42A8 007:171.733 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:171.742 - 0.008ms returns 0 +T42A8 007:171.753 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:171.761 - 0.008ms returns 0 +T42A8 007:171.773 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:171.782 - 0.009ms returns 0 +T42A8 007:171.793 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:171.801 - 0.008ms returns 0 +T42A8 007:171.813 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:171.821 - 0.008ms returns 0 +T42A8 007:171.833 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:171.845 - 0.011ms returns 0 +T42A8 007:171.859 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:171.868 - 0.008ms returns 0 +T42A8 007:171.881 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:171.889 - 0.008ms returns 0 +T42A8 007:171.901 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:171.910 - 0.008ms returns 0 +T42A8 007:171.924 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:171.933 - 0.010ms returns 0x0000012F +T42A8 007:171.945 JLINK_Go() +T42A8 007:171.960 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:178.073 - 6.127ms +T42A8 007:178.111 JLINK_IsHalted() +T42A8 007:178.788 - 0.676ms returns FALSE +T42A8 007:178.809 JLINK_HasError() +T42A8 007:180.241 JLINK_IsHalted() +T42A8 007:186.285 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:186.984 - 6.742ms returns TRUE +T42A8 007:187.013 JLINK_ReadReg(R15 (PC)) +T42A8 007:187.032 - 0.017ms returns 0x20003000 +T42A8 007:187.050 JLINK_ClrBPEx(BPHandle = 0x0000012F) +T42A8 007:187.065 - 0.015ms returns 0x00 +T42A8 007:187.083 JLINK_ReadReg(R0) +T42A8 007:187.098 - 0.014ms returns 0x00000000 +T42A8 007:188.104 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:188.126 Data: 00 83 00 20 72 06 00 00 00 80 00 20 75 0F 00 00 ... +T42A8 007:188.172 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:192.104 - 4.000ms returns 0x100 +T42A8 007:192.147 JLINK_HasError() +T42A8 007:192.166 JLINK_WriteReg(R0, 0x18014800) +T42A8 007:192.185 - 0.018ms returns 0 +T42A8 007:192.203 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:192.218 - 0.015ms returns 0 +T42A8 007:192.236 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:192.250 - 0.014ms returns 0 +T42A8 007:192.274 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:192.289 - 0.014ms returns 0 +T42A8 007:192.306 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:192.321 - 0.014ms returns 0 +T42A8 007:192.338 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:192.353 - 0.014ms returns 0 +T42A8 007:192.370 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:192.384 - 0.014ms returns 0 +T42A8 007:192.401 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:192.415 - 0.014ms returns 0 +T42A8 007:192.433 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:192.446 - 0.014ms returns 0 +T42A8 007:192.464 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:192.478 - 0.014ms returns 0 +T42A8 007:192.495 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:192.509 - 0.014ms returns 0 +T42A8 007:192.526 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:192.541 - 0.014ms returns 0 +T42A8 007:192.558 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:192.573 - 0.014ms returns 0 +T42A8 007:192.590 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:192.605 - 0.015ms returns 0 +T42A8 007:192.623 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:192.637 - 0.014ms returns 0 +T42A8 007:192.654 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:192.669 - 0.014ms returns 0 +T42A8 007:192.686 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:192.701 - 0.014ms returns 0 +T42A8 007:192.718 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:192.732 - 0.014ms returns 0 +T42A8 007:192.749 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:192.763 - 0.014ms returns 0 +T42A8 007:192.781 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:192.794 - 0.014ms returns 0 +T42A8 007:192.813 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:192.829 - 0.016ms returns 0x00000130 +T42A8 007:192.845 JLINK_Go() +T42A8 007:192.870 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:199.081 - 6.234ms +T42A8 007:199.125 JLINK_IsHalted() +T42A8 007:199.921 - 0.794ms returns FALSE +T42A8 007:199.949 JLINK_HasError() +T42A8 007:201.172 JLINK_IsHalted() +T42A8 007:207.281 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:207.919 - 6.746ms returns TRUE +T42A8 007:207.954 JLINK_ReadReg(R15 (PC)) +T42A8 007:207.972 - 0.017ms returns 0x20003000 +T42A8 007:207.993 JLINK_ClrBPEx(BPHandle = 0x00000130) +T42A8 007:208.009 - 0.015ms returns 0x00 +T42A8 007:208.028 JLINK_ReadReg(R0) +T42A8 007:208.043 - 0.015ms returns 0x00000000 +T42A8 007:210.217 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:210.241 Data: 92 48 89 B0 05 68 68 58 06 90 28 7D 2F 46 80 06 ... +T42A8 007:210.273 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:214.245 - 4.028ms returns 0x100 +T42A8 007:214.280 JLINK_HasError() +T42A8 007:214.301 JLINK_WriteReg(R0, 0x18014900) +T42A8 007:214.319 - 0.018ms returns 0 +T42A8 007:214.337 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:214.350 - 0.014ms returns 0 +T42A8 007:214.368 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:214.381 - 0.014ms returns 0 +T42A8 007:214.398 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:214.413 - 0.013ms returns 0 +T42A8 007:214.429 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:214.443 - 0.014ms returns 0 +T42A8 007:214.461 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:214.474 - 0.013ms returns 0 +T42A8 007:214.491 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:214.505 - 0.013ms returns 0 +T42A8 007:214.521 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:214.535 - 0.013ms returns 0 +T42A8 007:214.552 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:214.565 - 0.013ms returns 0 +T42A8 007:214.582 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:214.596 - 0.013ms returns 0 +T42A8 007:214.613 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:214.627 - 0.014ms returns 0 +T42A8 007:214.643 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:214.657 - 0.013ms returns 0 +T42A8 007:214.673 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:214.687 - 0.013ms returns 0 +T42A8 007:214.705 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:214.719 - 0.014ms returns 0 +T42A8 007:214.736 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:214.749 - 0.013ms returns 0 +T42A8 007:214.766 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:214.780 - 0.013ms returns 0 +T42A8 007:214.797 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:214.810 - 0.013ms returns 0 +T42A8 007:214.827 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:214.841 - 0.013ms returns 0 +T42A8 007:214.857 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:214.871 - 0.013ms returns 0 +T42A8 007:214.888 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:214.901 - 0.013ms returns 0 +T42A8 007:214.920 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:214.935 - 0.016ms returns 0x00000131 +T42A8 007:214.952 JLINK_Go() +T42A8 007:214.977 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:221.151 - 6.198ms +T42A8 007:221.181 JLINK_IsHalted() +T42A8 007:221.917 - 0.734ms returns FALSE +T42A8 007:221.945 JLINK_HasError() +T42A8 007:233.234 JLINK_IsHalted() +T42A8 007:239.493 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:240.130 - 6.896ms returns TRUE +T42A8 007:240.168 JLINK_ReadReg(R15 (PC)) +T42A8 007:240.189 - 0.020ms returns 0x20003000 +T42A8 007:240.207 JLINK_ClrBPEx(BPHandle = 0x00000131) +T42A8 007:240.223 - 0.016ms returns 0x00 +T42A8 007:240.244 JLINK_ReadReg(R0) +T42A8 007:240.259 - 0.014ms returns 0x00000000 +T42A8 007:241.662 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:241.697 Data: 98 47 01 98 F9 78 01 71 01 98 39 79 41 71 78 79 ... +T42A8 007:241.742 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:245.947 - 4.284ms returns 0x100 +T42A8 007:246.047 JLINK_HasError() +T42A8 007:246.083 JLINK_WriteReg(R0, 0x18014A00) +T42A8 007:246.117 - 0.035ms returns 0 +T42A8 007:246.148 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:246.171 - 0.023ms returns 0 +T42A8 007:246.197 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:246.220 - 0.022ms returns 0 +T42A8 007:246.245 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:246.269 - 0.023ms returns 0 +T42A8 007:246.296 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:246.319 - 0.023ms returns 0 +T42A8 007:246.344 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:246.366 - 0.021ms returns 0 +T42A8 007:246.392 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:246.415 - 0.022ms returns 0 +T42A8 007:246.443 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:246.466 - 0.024ms returns 0 +T42A8 007:246.496 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:246.525 - 0.029ms returns 0 +T42A8 007:246.545 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:246.558 - 0.014ms returns 0 +T42A8 007:246.576 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:246.590 - 0.014ms returns 0 +T42A8 007:246.609 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:246.625 - 0.016ms returns 0 +T42A8 007:246.642 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:246.656 - 0.013ms returns 0 +T42A8 007:246.679 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:246.698 - 0.020ms returns 0 +T42A8 007:246.716 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:246.729 - 0.014ms returns 0 +T42A8 007:246.747 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:246.761 - 0.014ms returns 0 +T42A8 007:246.777 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:246.791 - 0.013ms returns 0 +T42A8 007:246.808 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:246.822 - 0.013ms returns 0 +T42A8 007:246.839 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:246.855 - 0.016ms returns 0 +T42A8 007:246.873 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:246.886 - 0.013ms returns 0 +T42A8 007:246.906 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:246.925 - 0.019ms returns 0x00000132 +T42A8 007:246.942 JLINK_Go() +T42A8 007:246.969 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:253.241 - 6.297ms +T42A8 007:253.287 JLINK_IsHalted() +T42A8 007:254.074 - 0.785ms returns FALSE +T42A8 007:254.124 JLINK_HasError() +T42A8 007:256.170 JLINK_IsHalted() +T42A8 007:262.316 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:263.145 - 6.975ms returns TRUE +T42A8 007:263.193 JLINK_ReadReg(R15 (PC)) +T42A8 007:263.214 - 0.020ms returns 0x20003000 +T42A8 007:263.233 JLINK_ClrBPEx(BPHandle = 0x00000132) +T42A8 007:263.248 - 0.015ms returns 0x00 +T42A8 007:263.265 JLINK_ReadReg(R0) +T42A8 007:263.280 - 0.014ms returns 0x00000000 +T42A8 007:264.597 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:264.631 Data: 00 28 DF D0 00 2E 01 D0 01 22 00 E0 00 22 00 99 ... +T42A8 007:264.669 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:268.785 - 4.186ms returns 0x100 +T42A8 007:268.840 JLINK_HasError() +T42A8 007:268.862 JLINK_WriteReg(R0, 0x18014B00) +T42A8 007:268.907 - 0.045ms returns 0 +T42A8 007:268.960 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:268.977 - 0.016ms returns 0 +T42A8 007:268.997 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:269.011 - 0.014ms returns 0 +T42A8 007:269.032 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:269.045 - 0.013ms returns 0 +T42A8 007:269.066 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:269.080 - 0.014ms returns 0 +T42A8 007:269.100 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:269.113 - 0.014ms returns 0 +T42A8 007:269.134 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:269.148 - 0.013ms returns 0 +T42A8 007:269.168 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:269.181 - 0.013ms returns 0 +T42A8 007:269.201 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:269.215 - 0.014ms returns 0 +T42A8 007:269.235 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:269.249 - 0.013ms returns 0 +T42A8 007:269.268 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:269.281 - 0.013ms returns 0 +T42A8 007:269.298 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:269.312 - 0.013ms returns 0 +T42A8 007:269.329 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:269.342 - 0.013ms returns 0 +T42A8 007:269.362 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:269.377 - 0.015ms returns 0 +T42A8 007:269.394 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:269.408 - 0.013ms returns 0 +T42A8 007:269.425 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:269.439 - 0.014ms returns 0 +T42A8 007:269.459 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:269.473 - 0.013ms returns 0 +T42A8 007:269.489 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:269.503 - 0.013ms returns 0 +T42A8 007:269.520 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:269.533 - 0.013ms returns 0 +T42A8 007:269.553 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:269.566 - 0.013ms returns 0 +T42A8 007:269.585 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:269.601 - 0.017ms returns 0x00000133 +T42A8 007:269.621 JLINK_Go() +T42A8 007:269.649 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:275.874 - 6.251ms +T42A8 007:275.923 JLINK_IsHalted() +T42A8 007:276.535 - 0.612ms returns FALSE +T42A8 007:276.547 JLINK_HasError() +T42A8 007:280.002 JLINK_IsHalted() +T42A8 007:286.025 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:286.661 - 6.659ms returns TRUE +T42A8 007:286.672 JLINK_ReadReg(R15 (PC)) +T42A8 007:286.679 - 0.006ms returns 0x20003000 +T42A8 007:286.685 JLINK_ClrBPEx(BPHandle = 0x00000133) +T42A8 007:286.693 - 0.008ms returns 0x00 +T42A8 007:286.702 JLINK_ReadReg(R0) +T42A8 007:286.708 - 0.005ms returns 0x00000000 +T42A8 007:287.116 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:287.125 Data: 8F 06 07 D5 9F 6A D7 1B 3F 01 3F 09 B7 42 01 D2 ... +T42A8 007:287.136 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:290.951 - 3.835ms returns 0x100 +T42A8 007:290.964 JLINK_HasError() +T42A8 007:290.971 JLINK_WriteReg(R0, 0x18014C00) +T42A8 007:290.978 - 0.006ms returns 0 +T42A8 007:290.985 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:290.990 - 0.005ms returns 0 +T42A8 007:290.997 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:291.001 - 0.005ms returns 0 +T42A8 007:291.008 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:291.013 - 0.005ms returns 0 +T42A8 007:291.019 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:291.025 - 0.005ms returns 0 +T42A8 007:291.031 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:291.036 - 0.005ms returns 0 +T42A8 007:291.042 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:291.047 - 0.005ms returns 0 +T42A8 007:291.053 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:291.058 - 0.005ms returns 0 +T42A8 007:291.065 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:291.070 - 0.005ms returns 0 +T42A8 007:291.076 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:291.081 - 0.005ms returns 0 +T42A8 007:291.088 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:291.093 - 0.005ms returns 0 +T42A8 007:291.099 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:291.104 - 0.005ms returns 0 +T42A8 007:291.110 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:291.115 - 0.005ms returns 0 +T42A8 007:291.121 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:291.127 - 0.005ms returns 0 +T42A8 007:291.133 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:291.138 - 0.005ms returns 0 +T42A8 007:291.145 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:291.150 - 0.005ms returns 0 +T42A8 007:291.157 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:291.161 - 0.005ms returns 0 +T42A8 007:291.168 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:291.173 - 0.005ms returns 0 +T42A8 007:291.179 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:291.184 - 0.005ms returns 0 +T42A8 007:291.190 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:291.195 - 0.005ms returns 0 +T42A8 007:291.202 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:291.208 - 0.006ms returns 0x00000134 +T42A8 007:291.214 JLINK_Go() +T42A8 007:291.224 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:297.283 - 6.068ms +T42A8 007:297.293 JLINK_IsHalted() +T42A8 007:297.970 - 0.676ms returns FALSE +T42A8 007:297.981 JLINK_HasError() +T42A8 007:300.002 JLINK_IsHalted() +T42A8 007:306.001 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:306.645 - 6.642ms returns TRUE +T42A8 007:306.657 JLINK_ReadReg(R15 (PC)) +T42A8 007:306.664 - 0.006ms returns 0x20003000 +T42A8 007:306.671 JLINK_ClrBPEx(BPHandle = 0x00000134) +T42A8 007:306.676 - 0.005ms returns 0x00 +T42A8 007:306.682 JLINK_ReadReg(R0) +T42A8 007:306.688 - 0.005ms returns 0x00000000 +T42A8 007:307.073 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:307.081 Data: 00 09 B0 42 24 D2 00 28 1E D0 02 28 0A D8 1B 48 ... +T42A8 007:307.097 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:310.959 - 3.885ms returns 0x100 +T42A8 007:310.975 JLINK_HasError() +T42A8 007:310.987 JLINK_WriteReg(R0, 0x18014D00) +T42A8 007:310.997 - 0.009ms returns 0 +T42A8 007:311.007 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:311.016 - 0.008ms returns 0 +T42A8 007:311.027 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:311.036 - 0.008ms returns 0 +T42A8 007:311.045 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:311.054 - 0.008ms returns 0 +T42A8 007:311.067 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:311.075 - 0.008ms returns 0 +T42A8 007:311.082 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:311.088 - 0.005ms returns 0 +T42A8 007:311.094 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:311.099 - 0.005ms returns 0 +T42A8 007:311.105 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:311.111 - 0.005ms returns 0 +T42A8 007:311.117 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:311.123 - 0.005ms returns 0 +T42A8 007:311.129 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:311.137 - 0.008ms returns 0 +T42A8 007:311.145 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:311.151 - 0.005ms returns 0 +T42A8 007:311.157 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:311.163 - 0.005ms returns 0 +T42A8 007:311.169 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:311.175 - 0.005ms returns 0 +T42A8 007:311.181 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:311.187 - 0.005ms returns 0 +T42A8 007:311.193 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:311.199 - 0.005ms returns 0 +T42A8 007:311.205 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:311.211 - 0.005ms returns 0 +T42A8 007:311.217 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:311.223 - 0.005ms returns 0 +T42A8 007:311.229 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:311.235 - 0.005ms returns 0 +T42A8 007:311.241 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:311.246 - 0.005ms returns 0 +T42A8 007:311.253 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:311.258 - 0.005ms returns 0 +T42A8 007:311.265 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:311.272 - 0.006ms returns 0x00000135 +T42A8 007:311.278 JLINK_Go() +T42A8 007:311.288 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:317.246 - 5.967ms +T42A8 007:317.261 JLINK_IsHalted() +T42A8 007:317.843 - 0.581ms returns FALSE +T42A8 007:317.856 JLINK_HasError() +T42A8 007:323.801 JLINK_IsHalted() +T42A8 007:330.026 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:330.782 - 6.980ms returns TRUE +T42A8 007:330.814 JLINK_ReadReg(R15 (PC)) +T42A8 007:330.825 - 0.010ms returns 0x20003000 +T42A8 007:330.834 JLINK_ClrBPEx(BPHandle = 0x00000135) +T42A8 007:330.841 - 0.007ms returns 0x00 +T42A8 007:330.849 JLINK_ReadReg(R0) +T42A8 007:330.856 - 0.006ms returns 0x00000000 +T42A8 007:331.385 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:331.424 Data: 28 82 28 8A 00 28 08 D0 41 1E 08 42 D1 D1 A8 7C ... +T42A8 007:331.441 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:335.364 - 3.982ms returns 0x100 +T42A8 007:335.392 JLINK_HasError() +T42A8 007:335.402 JLINK_WriteReg(R0, 0x18014E00) +T42A8 007:335.413 - 0.010ms returns 0 +T42A8 007:335.420 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:335.426 - 0.006ms returns 0 +T42A8 007:335.435 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:335.441 - 0.006ms returns 0 +T42A8 007:335.450 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:335.456 - 0.006ms returns 0 +T42A8 007:335.465 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:335.470 - 0.006ms returns 0 +T42A8 007:335.480 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:335.485 - 0.006ms returns 0 +T42A8 007:335.494 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:335.501 - 0.006ms returns 0 +T42A8 007:335.509 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:335.515 - 0.006ms returns 0 +T42A8 007:335.527 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:335.533 - 0.009ms returns 0 +T42A8 007:335.541 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:335.548 - 0.006ms returns 0 +T42A8 007:335.557 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:335.562 - 0.006ms returns 0 +T42A8 007:335.571 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:335.577 - 0.006ms returns 0 +T42A8 007:335.586 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:335.592 - 0.006ms returns 0 +T42A8 007:335.601 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:335.607 - 0.006ms returns 0 +T42A8 007:335.616 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:335.621 - 0.006ms returns 0 +T42A8 007:335.630 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:335.637 - 0.006ms returns 0 +T42A8 007:335.645 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:335.651 - 0.006ms returns 0 +T42A8 007:335.659 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:335.665 - 0.006ms returns 0 +T42A8 007:335.673 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:335.679 - 0.005ms returns 0 +T42A8 007:335.686 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:335.693 - 0.006ms returns 0 +T42A8 007:335.748 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:335.759 - 0.011ms returns 0x00000136 +T42A8 007:335.767 JLINK_Go() +T42A8 007:335.780 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:341.656 - 5.888ms +T42A8 007:341.668 JLINK_IsHalted() +T42A8 007:342.305 - 0.638ms returns FALSE +T42A8 007:342.320 JLINK_HasError() +T42A8 007:343.761 JLINK_IsHalted() +T42A8 007:349.819 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:350.553 - 6.792ms returns TRUE +T42A8 007:350.578 JLINK_ReadReg(R15 (PC)) +T42A8 007:350.587 - 0.009ms returns 0x20003000 +T42A8 007:350.593 JLINK_ClrBPEx(BPHandle = 0x00000136) +T42A8 007:350.600 - 0.005ms returns 0x00 +T42A8 007:350.605 JLINK_ReadReg(R0) +T42A8 007:350.611 - 0.004ms returns 0x00000000 +T42A8 007:351.071 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:351.083 Data: 9A 42 19 D0 0C DC 0F 49 51 18 13 D0 0E 4A 89 18 ... +T42A8 007:351.099 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:355.056 - 3.984ms returns 0x100 +T42A8 007:355.079 JLINK_HasError() +T42A8 007:355.087 JLINK_WriteReg(R0, 0x18014F00) +T42A8 007:355.096 - 0.008ms returns 0 +T42A8 007:355.102 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:355.107 - 0.005ms returns 0 +T42A8 007:355.113 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:355.118 - 0.005ms returns 0 +T42A8 007:355.125 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:355.129 - 0.004ms returns 0 +T42A8 007:355.136 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:355.141 - 0.004ms returns 0 +T42A8 007:355.146 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:355.151 - 0.004ms returns 0 +T42A8 007:355.157 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:355.161 - 0.004ms returns 0 +T42A8 007:355.168 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:355.173 - 0.004ms returns 0 +T42A8 007:355.178 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:355.183 - 0.004ms returns 0 +T42A8 007:355.189 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:355.194 - 0.004ms returns 0 +T42A8 007:355.200 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:355.205 - 0.004ms returns 0 +T42A8 007:355.211 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:355.216 - 0.005ms returns 0 +T42A8 007:355.222 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:355.227 - 0.004ms returns 0 +T42A8 007:355.233 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:355.238 - 0.005ms returns 0 +T42A8 007:355.245 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:355.249 - 0.005ms returns 0 +T42A8 007:355.256 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:355.261 - 0.005ms returns 0 +T42A8 007:355.266 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:355.271 - 0.005ms returns 0 +T42A8 007:355.277 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:355.283 - 0.006ms returns 0 +T42A8 007:355.289 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:355.294 - 0.004ms returns 0 +T42A8 007:355.301 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:355.305 - 0.004ms returns 0 +T42A8 007:355.312 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:355.318 - 0.006ms returns 0x00000137 +T42A8 007:355.325 JLINK_Go() +T42A8 007:355.336 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:361.574 - 6.248ms +T42A8 007:361.600 JLINK_IsHalted() +T42A8 007:362.341 - 0.741ms returns FALSE +T42A8 007:362.357 JLINK_HasError() +T42A8 007:363.809 JLINK_IsHalted() +T42A8 007:369.821 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:370.629 - 6.820ms returns TRUE +T42A8 007:370.665 JLINK_ReadReg(R15 (PC)) +T42A8 007:370.674 - 0.009ms returns 0x20003000 +T42A8 007:370.681 JLINK_ClrBPEx(BPHandle = 0x00000137) +T42A8 007:370.688 - 0.006ms returns 0x00 +T42A8 007:370.695 JLINK_ReadReg(R0) +T42A8 007:370.701 - 0.005ms returns 0x00000000 +T42A8 007:371.181 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:371.194 Data: 0B 48 40 18 70 47 01 29 09 D0 30 29 01 D0 31 29 ... +T42A8 007:371.209 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:375.094 - 3.912ms returns 0x100 +T42A8 007:375.129 JLINK_HasError() +T42A8 007:375.141 JLINK_WriteReg(R0, 0x18015000) +T42A8 007:375.153 - 0.012ms returns 0 +T42A8 007:375.163 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:375.173 - 0.010ms returns 0 +T42A8 007:375.182 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:375.189 - 0.006ms returns 0 +T42A8 007:375.197 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:375.202 - 0.005ms returns 0 +T42A8 007:375.210 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:375.217 - 0.006ms returns 0 +T42A8 007:375.224 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:375.230 - 0.006ms returns 0 +T42A8 007:375.245 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:375.253 - 0.007ms returns 0 +T42A8 007:375.261 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:375.267 - 0.006ms returns 0 +T42A8 007:375.277 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:375.285 - 0.007ms returns 0 +T42A8 007:375.291 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:375.297 - 0.005ms returns 0 +T42A8 007:375.304 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:375.309 - 0.005ms returns 0 +T42A8 007:375.317 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:375.322 - 0.005ms returns 0 +T42A8 007:375.329 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:375.335 - 0.005ms returns 0 +T42A8 007:375.342 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:375.349 - 0.006ms returns 0 +T42A8 007:375.356 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:375.361 - 0.005ms returns 0 +T42A8 007:375.369 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:375.394 - 0.025ms returns 0 +T42A8 007:375.404 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:375.409 - 0.005ms returns 0 +T42A8 007:375.417 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:375.422 - 0.005ms returns 0 +T42A8 007:375.429 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:375.435 - 0.005ms returns 0 +T42A8 007:375.442 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:375.448 - 0.005ms returns 0 +T42A8 007:375.456 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:375.463 - 0.007ms returns 0x00000138 +T42A8 007:375.469 JLINK_Go() +T42A8 007:375.484 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:381.642 - 6.171ms +T42A8 007:381.671 JLINK_IsHalted() +T42A8 007:382.221 - 0.547ms returns FALSE +T42A8 007:382.240 JLINK_HasError() +T42A8 007:384.656 JLINK_IsHalted() +T42A8 007:390.539 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:391.165 - 6.510ms returns TRUE +T42A8 007:391.185 JLINK_ReadReg(R15 (PC)) +T42A8 007:391.193 - 0.008ms returns 0x20003000 +T42A8 007:391.200 JLINK_ClrBPEx(BPHandle = 0x00000138) +T42A8 007:391.205 - 0.005ms returns 0x00 +T42A8 007:391.212 JLINK_ReadReg(R0) +T42A8 007:391.217 - 0.005ms returns 0x00000000 +T42A8 007:391.665 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:391.674 Data: B3 14 01 18 4B 8B 00 18 51 DE 00 18 CF DD 00 18 ... +T42A8 007:391.689 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:395.778 - 4.111ms returns 0x100 +T42A8 007:395.831 JLINK_HasError() +T42A8 007:395.843 JLINK_WriteReg(R0, 0x18015100) +T42A8 007:395.852 - 0.009ms returns 0 +T42A8 007:395.859 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:395.865 - 0.005ms returns 0 +T42A8 007:395.872 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:395.877 - 0.005ms returns 0 +T42A8 007:395.883 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:395.889 - 0.005ms returns 0 +T42A8 007:395.897 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:395.901 - 0.005ms returns 0 +T42A8 007:395.908 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:395.913 - 0.005ms returns 0 +T42A8 007:395.920 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:395.925 - 0.005ms returns 0 +T42A8 007:395.932 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:395.938 - 0.006ms returns 0 +T42A8 007:395.945 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:395.951 - 0.006ms returns 0 +T42A8 007:395.957 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:395.965 - 0.006ms returns 0 +T42A8 007:395.973 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:395.980 - 0.007ms returns 0 +T42A8 007:395.986 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:395.991 - 0.005ms returns 0 +T42A8 007:395.997 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:396.002 - 0.005ms returns 0 +T42A8 007:396.009 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:396.014 - 0.006ms returns 0 +T42A8 007:396.021 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:396.025 - 0.005ms returns 0 +T42A8 007:396.032 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:396.037 - 0.005ms returns 0 +T42A8 007:396.043 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:396.048 - 0.005ms returns 0 +T42A8 007:396.054 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:396.059 - 0.004ms returns 0 +T42A8 007:396.065 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:396.071 - 0.005ms returns 0 +T42A8 007:396.078 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:396.087 - 0.008ms returns 0 +T42A8 007:396.096 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:396.102 - 0.006ms returns 0x00000139 +T42A8 007:396.109 JLINK_Go() +T42A8 007:396.121 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:402.342 - 6.232ms +T42A8 007:402.366 JLINK_IsHalted() +T42A8 007:403.055 - 0.688ms returns FALSE +T42A8 007:403.069 JLINK_HasError() +T42A8 007:404.669 JLINK_IsHalted() +T42A8 007:410.728 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:411.397 - 6.726ms returns TRUE +T42A8 007:411.422 JLINK_ReadReg(R15 (PC)) +T42A8 007:411.432 - 0.009ms returns 0x20003000 +T42A8 007:411.441 JLINK_ClrBPEx(BPHandle = 0x00000139) +T42A8 007:411.448 - 0.007ms returns 0x00 +T42A8 007:411.457 JLINK_ReadReg(R0) +T42A8 007:411.464 - 0.006ms returns 0x00000000 +T42A8 007:411.992 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:412.002 Data: 7B F8 10 BD 10 B5 0F 48 00 24 C1 69 04 22 11 43 ... +T42A8 007:412.017 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:415.914 - 3.923ms returns 0x100 +T42A8 007:415.933 JLINK_HasError() +T42A8 007:415.943 JLINK_WriteReg(R0, 0x18015200) +T42A8 007:415.952 - 0.009ms returns 0 +T42A8 007:415.961 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:415.969 - 0.007ms returns 0 +T42A8 007:415.980 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:415.987 - 0.007ms returns 0 +T42A8 007:415.999 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:416.006 - 0.007ms returns 0 +T42A8 007:416.017 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:416.025 - 0.007ms returns 0 +T42A8 007:416.035 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:416.043 - 0.007ms returns 0 +T42A8 007:416.053 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:416.061 - 0.007ms returns 0 +T42A8 007:416.069 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:416.077 - 0.007ms returns 0 +T42A8 007:416.086 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:416.093 - 0.007ms returns 0 +T42A8 007:416.104 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:416.111 - 0.007ms returns 0 +T42A8 007:416.122 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:416.129 - 0.007ms returns 0 +T42A8 007:416.140 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:416.147 - 0.007ms returns 0 +T42A8 007:416.157 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:416.165 - 0.007ms returns 0 +T42A8 007:416.176 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:416.184 - 0.008ms returns 0 +T42A8 007:416.193 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:416.201 - 0.007ms returns 0 +T42A8 007:416.212 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:416.219 - 0.007ms returns 0 +T42A8 007:416.230 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:416.237 - 0.007ms returns 0 +T42A8 007:416.248 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:416.255 - 0.007ms returns 0 +T42A8 007:416.265 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:416.273 - 0.007ms returns 0 +T42A8 007:416.281 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:416.289 - 0.007ms returns 0 +T42A8 007:416.299 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:416.307 - 0.008ms returns 0x0000013A +T42A8 007:416.317 JLINK_Go() +T42A8 007:416.331 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:422.389 - 6.070ms +T42A8 007:422.407 JLINK_IsHalted() +T42A8 007:423.070 - 0.662ms returns FALSE +T42A8 007:423.089 JLINK_HasError() +T42A8 007:424.592 JLINK_IsHalted() +T42A8 007:430.672 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:431.237 - 6.644ms returns TRUE +T42A8 007:431.249 JLINK_ReadReg(R15 (PC)) +T42A8 007:431.256 - 0.006ms returns 0x20003000 +T42A8 007:431.262 JLINK_ClrBPEx(BPHandle = 0x0000013A) +T42A8 007:431.268 - 0.005ms returns 0x00 +T42A8 007:431.274 JLINK_ReadReg(R0) +T42A8 007:431.280 - 0.005ms returns 0x00000000 +T42A8 007:431.680 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:431.688 Data: 00 21 1D 48 A0 47 20 22 00 21 1D 48 A0 47 20 22 ... +T42A8 007:431.699 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:435.629 - 3.948ms returns 0x100 +T42A8 007:435.638 JLINK_HasError() +T42A8 007:435.645 JLINK_WriteReg(R0, 0x18015300) +T42A8 007:435.652 - 0.006ms returns 0 +T42A8 007:435.657 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:435.662 - 0.005ms returns 0 +T42A8 007:435.669 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:435.678 - 0.009ms returns 0 +T42A8 007:435.685 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:435.689 - 0.004ms returns 0 +T42A8 007:435.696 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:435.701 - 0.004ms returns 0 +T42A8 007:435.706 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:435.711 - 0.004ms returns 0 +T42A8 007:435.717 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:435.722 - 0.004ms returns 0 +T42A8 007:435.728 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:435.733 - 0.004ms returns 0 +T42A8 007:435.739 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:435.744 - 0.004ms returns 0 +T42A8 007:435.749 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:435.754 - 0.004ms returns 0 +T42A8 007:435.761 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:435.765 - 0.004ms returns 0 +T42A8 007:435.771 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:435.776 - 0.004ms returns 0 +T42A8 007:435.782 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:435.787 - 0.004ms returns 0 +T42A8 007:435.793 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:435.798 - 0.005ms returns 0 +T42A8 007:435.804 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:435.809 - 0.004ms returns 0 +T42A8 007:435.814 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:435.819 - 0.004ms returns 0 +T42A8 007:435.825 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:435.830 - 0.005ms returns 0 +T42A8 007:435.837 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:435.841 - 0.004ms returns 0 +T42A8 007:435.847 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:435.851 - 0.004ms returns 0 +T42A8 007:435.857 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:435.862 - 0.004ms returns 0 +T42A8 007:435.869 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:435.874 - 0.005ms returns 0x0000013B +T42A8 007:435.880 JLINK_Go() +T42A8 007:435.889 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:441.673 - 5.792ms +T42A8 007:441.684 JLINK_IsHalted() +T42A8 007:442.326 - 0.641ms returns FALSE +T42A8 007:442.336 JLINK_HasError() +T42A8 007:447.681 JLINK_IsHalted() +T42A8 007:453.967 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:454.730 - 7.048ms returns TRUE +T42A8 007:454.757 JLINK_ReadReg(R15 (PC)) +T42A8 007:454.765 - 0.008ms returns 0x20003000 +T42A8 007:454.773 JLINK_ClrBPEx(BPHandle = 0x0000013B) +T42A8 007:454.778 - 0.005ms returns 0x00 +T42A8 007:454.785 JLINK_ReadReg(R0) +T42A8 007:454.790 - 0.005ms returns 0x00000000 +T42A8 007:455.270 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:455.283 Data: 06 20 F1 F7 B8 F9 00 24 0C 48 0E 4B 04 70 28 22 ... +T42A8 007:455.298 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:459.233 - 3.961ms returns 0x100 +T42A8 007:459.257 JLINK_HasError() +T42A8 007:459.267 JLINK_WriteReg(R0, 0x18015400) +T42A8 007:459.276 - 0.009ms returns 0 +T42A8 007:459.282 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:459.288 - 0.005ms returns 0 +T42A8 007:459.294 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:459.300 - 0.005ms returns 0 +T42A8 007:459.306 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:459.312 - 0.005ms returns 0 +T42A8 007:459.317 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:459.323 - 0.005ms returns 0 +T42A8 007:459.329 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:459.334 - 0.005ms returns 0 +T42A8 007:459.341 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:459.345 - 0.005ms returns 0 +T42A8 007:459.352 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:459.357 - 0.005ms returns 0 +T42A8 007:459.363 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:459.369 - 0.005ms returns 0 +T42A8 007:459.375 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:459.380 - 0.005ms returns 0 +T42A8 007:459.386 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:459.391 - 0.005ms returns 0 +T42A8 007:459.397 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:459.403 - 0.005ms returns 0 +T42A8 007:459.411 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:459.417 - 0.005ms returns 0 +T42A8 007:459.423 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:459.429 - 0.006ms returns 0 +T42A8 007:459.435 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:459.440 - 0.005ms returns 0 +T42A8 007:459.446 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:459.452 - 0.005ms returns 0 +T42A8 007:459.458 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:459.470 - 0.011ms returns 0 +T42A8 007:459.477 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:459.481 - 0.005ms returns 0 +T42A8 007:459.487 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:459.493 - 0.005ms returns 0 +T42A8 007:459.499 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:459.504 - 0.005ms returns 0 +T42A8 007:459.511 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:459.517 - 0.006ms returns 0x0000013C +T42A8 007:459.524 JLINK_Go() +T42A8 007:459.537 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:465.674 - 6.150ms +T42A8 007:465.697 JLINK_IsHalted() +T42A8 007:466.403 - 0.704ms returns FALSE +T42A8 007:466.416 JLINK_HasError() +T42A8 007:468.510 JLINK_IsHalted() +T42A8 007:474.433 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:475.073 - 6.563ms returns TRUE +T42A8 007:475.086 JLINK_ReadReg(R15 (PC)) +T42A8 007:475.093 - 0.007ms returns 0x20003000 +T42A8 007:475.101 JLINK_ClrBPEx(BPHandle = 0x0000013C) +T42A8 007:475.106 - 0.005ms returns 0x00 +T42A8 007:475.113 JLINK_ReadReg(R0) +T42A8 007:475.118 - 0.005ms returns 0x00000000 +T42A8 007:475.534 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:475.542 Data: 49 31 C1 87 40 30 04 70 44 70 70 BD 08 49 00 20 ... +T42A8 007:475.579 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:479.511 - 3.977ms returns 0x100 +T42A8 007:479.522 JLINK_HasError() +T42A8 007:479.529 JLINK_WriteReg(R0, 0x18015500) +T42A8 007:479.536 - 0.006ms returns 0 +T42A8 007:479.542 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:479.548 - 0.005ms returns 0 +T42A8 007:479.554 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:479.559 - 0.005ms returns 0 +T42A8 007:479.565 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:479.571 - 0.005ms returns 0 +T42A8 007:479.577 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:479.582 - 0.005ms returns 0 +T42A8 007:479.589 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:479.593 - 0.005ms returns 0 +T42A8 007:479.600 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:479.605 - 0.005ms returns 0 +T42A8 007:479.611 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:479.616 - 0.005ms returns 0 +T42A8 007:479.622 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:479.627 - 0.005ms returns 0 +T42A8 007:479.633 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:479.639 - 0.005ms returns 0 +T42A8 007:479.645 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:479.650 - 0.005ms returns 0 +T42A8 007:479.656 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:479.661 - 0.005ms returns 0 +T42A8 007:479.668 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:479.673 - 0.005ms returns 0 +T42A8 007:479.679 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:479.685 - 0.005ms returns 0 +T42A8 007:479.691 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:479.696 - 0.005ms returns 0 +T42A8 007:479.702 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:479.707 - 0.005ms returns 0 +T42A8 007:479.714 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:479.719 - 0.005ms returns 0 +T42A8 007:479.725 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:479.731 - 0.005ms returns 0 +T42A8 007:479.737 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:479.742 - 0.005ms returns 0 +T42A8 007:479.749 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:479.753 - 0.005ms returns 0 +T42A8 007:479.760 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:479.766 - 0.006ms returns 0x0000013D +T42A8 007:479.772 JLINK_Go() +T42A8 007:479.781 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:485.941 - 6.168ms +T42A8 007:485.953 JLINK_IsHalted() +T42A8 007:486.518 - 0.564ms returns FALSE +T42A8 007:486.529 JLINK_HasError() +T42A8 007:491.393 JLINK_IsHalted() +T42A8 007:497.532 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:498.162 - 6.770ms returns TRUE +T42A8 007:498.173 JLINK_ReadReg(R15 (PC)) +T42A8 007:498.179 - 0.006ms returns 0x20003000 +T42A8 007:498.186 JLINK_ClrBPEx(BPHandle = 0x0000013D) +T42A8 007:498.191 - 0.005ms returns 0x00 +T42A8 007:498.197 JLINK_ReadReg(R0) +T42A8 007:498.202 - 0.004ms returns 0x00000000 +T42A8 007:498.661 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:498.669 Data: A9 FF 20 73 16 49 00 20 08 70 10 BD 10 B5 04 00 ... +T42A8 007:498.685 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:502.530 - 3.869ms returns 0x100 +T42A8 007:502.541 JLINK_HasError() +T42A8 007:502.547 JLINK_WriteReg(R0, 0x18015600) +T42A8 007:502.553 - 0.006ms returns 0 +T42A8 007:502.582 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:502.587 - 0.005ms returns 0 +T42A8 007:502.593 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:502.598 - 0.004ms returns 0 +T42A8 007:502.617 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:502.621 - 0.004ms returns 0 +T42A8 007:502.627 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:502.632 - 0.004ms returns 0 +T42A8 007:502.637 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:502.642 - 0.004ms returns 0 +T42A8 007:502.648 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:502.653 - 0.004ms returns 0 +T42A8 007:502.658 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:502.663 - 0.004ms returns 0 +T42A8 007:502.669 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:502.673 - 0.004ms returns 0 +T42A8 007:502.679 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:502.684 - 0.004ms returns 0 +T42A8 007:502.689 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:502.694 - 0.004ms returns 0 +T42A8 007:502.700 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:502.704 - 0.004ms returns 0 +T42A8 007:502.710 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:502.714 - 0.004ms returns 0 +T42A8 007:502.721 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:502.726 - 0.005ms returns 0 +T42A8 007:502.732 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:502.736 - 0.004ms returns 0 +T42A8 007:502.742 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:502.747 - 0.004ms returns 0 +T42A8 007:502.753 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:502.757 - 0.004ms returns 0 +T42A8 007:502.763 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:502.768 - 0.004ms returns 0 +T42A8 007:502.773 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:502.778 - 0.004ms returns 0 +T42A8 007:502.784 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:502.789 - 0.004ms returns 0 +T42A8 007:502.794 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:502.800 - 0.005ms returns 0x0000013E +T42A8 007:502.805 JLINK_Go() +T42A8 007:502.814 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:508.946 - 6.140ms +T42A8 007:508.957 JLINK_IsHalted() +T42A8 007:509.497 - 0.539ms returns FALSE +T42A8 007:509.507 JLINK_HasError() +T42A8 007:511.414 JLINK_IsHalted() +T42A8 007:517.435 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:518.088 - 6.673ms returns TRUE +T42A8 007:518.102 JLINK_ReadReg(R15 (PC)) +T42A8 007:518.109 - 0.006ms returns 0x20003000 +T42A8 007:518.117 JLINK_ClrBPEx(BPHandle = 0x0000013E) +T42A8 007:518.122 - 0.005ms returns 0x00 +T42A8 007:518.129 JLINK_ReadReg(R0) +T42A8 007:518.134 - 0.005ms returns 0x00000000 +T42A8 007:518.541 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:518.549 Data: 12 48 A0 47 94 22 00 21 12 48 A0 47 00 20 12 4A ... +T42A8 007:518.561 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:522.422 - 3.881ms returns 0x100 +T42A8 007:522.434 JLINK_HasError() +T42A8 007:522.442 JLINK_WriteReg(R0, 0x18015700) +T42A8 007:522.449 - 0.007ms returns 0 +T42A8 007:522.457 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:522.462 - 0.006ms returns 0 +T42A8 007:522.469 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:522.475 - 0.005ms returns 0 +T42A8 007:522.482 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:522.488 - 0.005ms returns 0 +T42A8 007:522.496 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:522.501 - 0.005ms returns 0 +T42A8 007:522.509 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:522.514 - 0.005ms returns 0 +T42A8 007:522.521 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:522.527 - 0.005ms returns 0 +T42A8 007:522.533 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:522.539 - 0.005ms returns 0 +T42A8 007:522.546 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:522.552 - 0.005ms returns 0 +T42A8 007:522.559 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:522.565 - 0.005ms returns 0 +T42A8 007:522.572 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:522.577 - 0.005ms returns 0 +T42A8 007:522.584 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:522.590 - 0.005ms returns 0 +T42A8 007:522.597 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:522.605 - 0.008ms returns 0 +T42A8 007:522.613 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:522.620 - 0.006ms returns 0 +T42A8 007:522.627 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:522.633 - 0.005ms returns 0 +T42A8 007:522.640 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:522.645 - 0.005ms returns 0 +T42A8 007:522.653 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:522.658 - 0.005ms returns 0 +T42A8 007:522.665 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:522.670 - 0.005ms returns 0 +T42A8 007:522.677 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:522.683 - 0.005ms returns 0 +T42A8 007:522.690 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:522.696 - 0.005ms returns 0 +T42A8 007:522.703 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:522.709 - 0.006ms returns 0x0000013F +T42A8 007:522.717 JLINK_Go() +T42A8 007:522.726 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:528.807 - 6.090ms +T42A8 007:528.818 JLINK_IsHalted() +T42A8 007:529.374 - 0.555ms returns FALSE +T42A8 007:529.384 JLINK_HasError() +T42A8 007:531.358 JLINK_IsHalted() +T42A8 007:537.350 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:537.941 - 6.581ms returns TRUE +T42A8 007:537.952 JLINK_ReadReg(R15 (PC)) +T42A8 007:537.958 - 0.006ms returns 0x20003000 +T42A8 007:537.965 JLINK_ClrBPEx(BPHandle = 0x0000013F) +T42A8 007:537.970 - 0.005ms returns 0x00 +T42A8 007:537.977 JLINK_ReadReg(R0) +T42A8 007:537.982 - 0.005ms returns 0x00000000 +T42A8 007:538.425 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:538.433 Data: 70 BD 00 00 8C 92 00 20 F9 3C 01 18 15 51 01 18 ... +T42A8 007:538.444 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:542.365 - 3.939ms returns 0x100 +T42A8 007:542.376 JLINK_HasError() +T42A8 007:542.383 JLINK_WriteReg(R0, 0x18015800) +T42A8 007:542.389 - 0.006ms returns 0 +T42A8 007:542.396 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:542.401 - 0.004ms returns 0 +T42A8 007:542.406 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:542.411 - 0.004ms returns 0 +T42A8 007:542.417 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:542.421 - 0.004ms returns 0 +T42A8 007:542.427 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:542.432 - 0.004ms returns 0 +T42A8 007:542.437 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:542.442 - 0.004ms returns 0 +T42A8 007:542.448 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:542.453 - 0.004ms returns 0 +T42A8 007:542.458 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:542.463 - 0.004ms returns 0 +T42A8 007:542.469 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:542.473 - 0.004ms returns 0 +T42A8 007:542.480 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:542.484 - 0.004ms returns 0 +T42A8 007:542.489 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:542.494 - 0.004ms returns 0 +T42A8 007:542.501 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:542.505 - 0.004ms returns 0 +T42A8 007:542.511 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:542.515 - 0.004ms returns 0 +T42A8 007:542.521 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:542.526 - 0.005ms returns 0 +T42A8 007:542.533 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:542.537 - 0.004ms returns 0 +T42A8 007:542.543 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:542.548 - 0.004ms returns 0 +T42A8 007:542.553 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:542.558 - 0.004ms returns 0 +T42A8 007:542.564 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:542.569 - 0.004ms returns 0 +T42A8 007:542.574 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:542.579 - 0.004ms returns 0 +T42A8 007:542.585 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:542.589 - 0.004ms returns 0 +T42A8 007:542.596 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:542.601 - 0.005ms returns 0x00000140 +T42A8 007:542.607 JLINK_Go() +T42A8 007:542.616 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:548.658 - 6.051ms +T42A8 007:548.672 JLINK_IsHalted() +T42A8 007:549.301 - 0.629ms returns FALSE +T42A8 007:549.326 JLINK_HasError() +T42A8 007:554.161 JLINK_IsHalted() +T42A8 007:560.325 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:560.924 - 6.763ms returns TRUE +T42A8 007:560.935 JLINK_ReadReg(R15 (PC)) +T42A8 007:560.941 - 0.006ms returns 0x20003000 +T42A8 007:560.948 JLINK_ClrBPEx(BPHandle = 0x00000140) +T42A8 007:560.957 - 0.009ms returns 0x00 +T42A8 007:560.964 JLINK_ReadReg(R0) +T42A8 007:560.969 - 0.004ms returns 0x00000000 +T42A8 007:561.350 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:561.358 Data: 26 2A 00 00 00 02 14 00 03 28 00 00 00 02 00 00 ... +T42A8 007:561.377 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:565.439 - 4.086ms returns 0x100 +T42A8 007:565.489 JLINK_HasError() +T42A8 007:565.521 JLINK_WriteReg(R0, 0x18015900) +T42A8 007:565.549 - 0.029ms returns 0 +T42A8 007:565.577 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:565.601 - 0.023ms returns 0 +T42A8 007:565.629 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:565.650 - 0.022ms returns 0 +T42A8 007:565.678 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:565.700 - 0.022ms returns 0 +T42A8 007:565.727 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:565.749 - 0.022ms returns 0 +T42A8 007:565.777 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:565.799 - 0.022ms returns 0 +T42A8 007:565.826 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:565.848 - 0.022ms returns 0 +T42A8 007:565.875 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:565.897 - 0.022ms returns 0 +T42A8 007:565.925 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:565.946 - 0.022ms returns 0 +T42A8 007:565.973 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:565.995 - 0.022ms returns 0 +T42A8 007:566.022 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:566.045 - 0.022ms returns 0 +T42A8 007:566.071 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:566.093 - 0.022ms returns 0 +T42A8 007:566.145 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:566.169 - 0.024ms returns 0 +T42A8 007:566.197 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:566.221 - 0.023ms returns 0 +T42A8 007:566.248 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:566.270 - 0.022ms returns 0 +T42A8 007:566.297 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:566.319 - 0.022ms returns 0 +T42A8 007:566.348 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:566.370 - 0.023ms returns 0 +T42A8 007:566.397 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:566.419 - 0.022ms returns 0 +T42A8 007:566.445 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:566.467 - 0.021ms returns 0 +T42A8 007:566.493 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:566.516 - 0.022ms returns 0 +T42A8 007:566.545 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:566.572 - 0.028ms returns 0x00000141 +T42A8 007:566.598 JLINK_Go() +T42A8 007:566.636 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:573.330 - 6.729ms +T42A8 007:573.399 JLINK_IsHalted() +T42A8 007:574.178 - 0.777ms returns FALSE +T42A8 007:574.237 JLINK_HasError() +T42A8 007:576.301 JLINK_IsHalted() +T42A8 007:582.830 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:583.548 - 7.245ms returns TRUE +T42A8 007:583.605 JLINK_ReadReg(R15 (PC)) +T42A8 007:583.636 - 0.030ms returns 0x20003000 +T42A8 007:583.665 JLINK_ClrBPEx(BPHandle = 0x00000141) +T42A8 007:583.689 - 0.024ms returns 0x00 +T42A8 007:583.717 JLINK_ReadReg(R0) +T42A8 007:583.740 - 0.022ms returns 0x00000000 +T42A8 007:586.397 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:586.439 Data: 00 02 02 00 03 28 00 00 00 02 00 00 04 2A 00 00 ... +T42A8 007:586.490 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:590.758 - 4.360ms returns 0x100 +T42A8 007:590.825 JLINK_HasError() +T42A8 007:590.857 JLINK_WriteReg(R0, 0x18015A00) +T42A8 007:590.888 - 0.031ms returns 0 +T42A8 007:590.915 JLINK_WriteReg(R1, 0x00000100) +T42A8 007:590.937 - 0.022ms returns 0 +T42A8 007:590.963 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:590.985 - 0.021ms returns 0 +T42A8 007:591.011 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:591.033 - 0.021ms returns 0 +T42A8 007:591.089 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:591.113 - 0.024ms returns 0 +T42A8 007:591.159 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:591.181 - 0.021ms returns 0 +T42A8 007:591.206 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:591.228 - 0.021ms returns 0 +T42A8 007:591.254 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:591.275 - 0.021ms returns 0 +T42A8 007:591.301 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:591.321 - 0.021ms returns 0 +T42A8 007:591.363 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:591.390 - 0.027ms returns 0 +T42A8 007:591.417 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:591.438 - 0.021ms returns 0 +T42A8 007:591.465 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:591.485 - 0.021ms returns 0 +T42A8 007:591.512 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:591.555 - 0.043ms returns 0 +T42A8 007:591.582 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:591.605 - 0.023ms returns 0 +T42A8 007:591.631 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:591.653 - 0.021ms returns 0 +T42A8 007:591.679 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:591.701 - 0.021ms returns 0 +T42A8 007:591.727 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:591.749 - 0.021ms returns 0 +T42A8 007:591.774 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:591.796 - 0.021ms returns 0 +T42A8 007:591.822 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:591.843 - 0.021ms returns 0 +T42A8 007:591.869 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:591.890 - 0.021ms returns 0 +T42A8 007:591.918 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:591.944 - 0.026ms returns 0x00000142 +T42A8 007:591.971 JLINK_Go() +T42A8 007:592.011 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:598.437 - 6.463ms +T42A8 007:598.500 JLINK_IsHalted() +T42A8 007:599.308 - 0.805ms returns FALSE +T42A8 007:599.359 JLINK_HasError() +T42A8 007:604.246 JLINK_IsHalted() +T42A8 007:610.649 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:611.445 - 7.199ms returns TRUE +T42A8 007:611.507 JLINK_ReadReg(R15 (PC)) +T42A8 007:611.538 - 0.030ms returns 0x20003000 +T42A8 007:611.568 JLINK_ClrBPEx(BPHandle = 0x00000142) +T42A8 007:611.592 - 0.024ms returns 0x00 +T42A8 007:611.620 JLINK_ReadReg(R0) +T42A8 007:611.644 - 0.023ms returns 0x00000000 +T42A8 007:614.142 JLINK_WriteMem(0x200039D4, 0x100 Bytes, ...) +T42A8 007:614.183 Data: 18 01 03 05 00 00 00 00 09 01 09 01 03 01 03 01 ... +T42A8 007:614.235 CPU_WriteMem(256 bytes @ 0x200039D4) +T42A8 007:618.265 - 4.122ms returns 0x100 +T42A8 007:618.341 JLINK_HasError() +T42A8 007:618.376 JLINK_WriteReg(R0, 0x18015B00) +T42A8 007:618.407 - 0.031ms returns 0 +T42A8 007:618.434 JLINK_WriteReg(R1, 0x000000D4) +T42A8 007:618.456 - 0.022ms returns 0 +T42A8 007:618.483 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:618.504 - 0.021ms returns 0 +T42A8 007:618.530 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:618.552 - 0.021ms returns 0 +T42A8 007:618.578 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:618.600 - 0.021ms returns 0 +T42A8 007:618.625 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:618.646 - 0.021ms returns 0 +T42A8 007:618.673 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:618.694 - 0.021ms returns 0 +T42A8 007:618.721 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:618.741 - 0.021ms returns 0 +T42A8 007:618.768 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:618.789 - 0.021ms returns 0 +T42A8 007:618.815 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:618.836 - 0.021ms returns 0 +T42A8 007:618.862 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:618.884 - 0.021ms returns 0 +T42A8 007:618.909 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:618.931 - 0.021ms returns 0 +T42A8 007:618.957 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:618.980 - 0.022ms returns 0 +T42A8 007:619.022 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:619.046 - 0.024ms returns 0 +T42A8 007:619.073 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:619.094 - 0.021ms returns 0 +T42A8 007:619.121 JLINK_WriteReg(R15 (PC), 0x200032FC) +T42A8 007:619.143 - 0.022ms returns 0 +T42A8 007:619.169 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:619.190 - 0.021ms returns 0 +T42A8 007:619.217 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:619.238 - 0.021ms returns 0 +T42A8 007:619.265 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:619.285 - 0.021ms returns 0 +T42A8 007:619.312 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:619.333 - 0.021ms returns 0 +T42A8 007:619.362 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:619.387 - 0.026ms returns 0x00000143 +T42A8 007:619.413 JLINK_Go() +T42A8 007:619.453 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:625.909 - 6.493ms +T42A8 007:626.008 JLINK_IsHalted() +T42A8 007:626.869 - 0.859ms returns FALSE +T42A8 007:626.941 JLINK_HasError() +T42A8 007:629.165 JLINK_IsHalted() +T42A8 007:635.557 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:636.299 - 7.132ms returns TRUE +T42A8 007:636.365 JLINK_ReadReg(R15 (PC)) +T42A8 007:636.395 - 0.030ms returns 0x20003000 +T42A8 007:636.424 JLINK_ClrBPEx(BPHandle = 0x00000143) +T42A8 007:636.449 - 0.024ms returns 0x00 +T42A8 007:636.477 JLINK_ReadReg(R0) +T42A8 007:636.500 - 0.022ms returns 0x00000000 +T42A8 007:636.528 JLINK_HasError() +T42A8 007:636.557 JLINK_WriteReg(R0, 0x00000002) +T42A8 007:636.581 - 0.024ms returns 0 +T42A8 007:636.609 JLINK_WriteReg(R1, 0x000000D4) +T42A8 007:636.632 - 0.022ms returns 0 +T42A8 007:636.658 JLINK_WriteReg(R2, 0x200039D4) +T42A8 007:636.681 - 0.022ms returns 0 +T42A8 007:636.708 JLINK_WriteReg(R3, 0x00000000) +T42A8 007:636.729 - 0.022ms returns 0 +T42A8 007:636.757 JLINK_WriteReg(R4, 0x00000000) +T42A8 007:636.848 - 0.090ms returns 0 +T42A8 007:636.876 JLINK_WriteReg(R5, 0x00000000) +T42A8 007:636.901 - 0.025ms returns 0 +T42A8 007:636.949 JLINK_WriteReg(R6, 0x00000000) +T42A8 007:636.975 - 0.045ms returns 0 +T42A8 007:637.003 JLINK_WriteReg(R7, 0x00000000) +T42A8 007:637.025 - 0.022ms returns 0 +T42A8 007:637.053 JLINK_WriteReg(R8, 0x00000000) +T42A8 007:637.074 - 0.022ms returns 0 +T42A8 007:637.101 JLINK_WriteReg(R9, 0x200039B4) +T42A8 007:637.123 - 0.022ms returns 0 +T42A8 007:637.150 JLINK_WriteReg(R10, 0x00000000) +T42A8 007:637.173 - 0.022ms returns 0 +T42A8 007:637.200 JLINK_WriteReg(R11, 0x00000000) +T42A8 007:637.221 - 0.022ms returns 0 +T42A8 007:637.249 JLINK_WriteReg(R12, 0x00000000) +T42A8 007:637.271 - 0.022ms returns 0 +T42A8 007:637.298 JLINK_WriteReg(R13 (SP), 0x20004000) +T42A8 007:637.321 - 0.023ms returns 0 +T42A8 007:637.348 JLINK_WriteReg(R14, 0x20003001) +T42A8 007:637.370 - 0.022ms returns 0 +T42A8 007:637.397 JLINK_WriteReg(R15 (PC), 0x20003218) +T42A8 007:637.419 - 0.022ms returns 0 +T42A8 007:637.446 JLINK_WriteReg(XPSR, 0x01000000) +T42A8 007:637.469 - 0.022ms returns 0 +T42A8 007:637.496 JLINK_WriteReg(MSP, 0x20004000) +T42A8 007:637.518 - 0.022ms returns 0 +T42A8 007:637.545 JLINK_WriteReg(PSP, 0x20004000) +T42A8 007:637.566 - 0.021ms returns 0 +T42A8 007:637.593 JLINK_WriteReg(CFBP, 0x00000000) +T42A8 007:637.616 - 0.022ms returns 0 +T42A8 007:637.645 JLINK_SetBPEx(Addr = 0x20003000, Type = 0xFFFFFFF2) +T42A8 007:637.669 - 0.025ms returns 0x00000144 +T42A8 007:637.695 JLINK_Go() +T42A8 007:637.733 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:644.135 - 6.437ms +T42A8 007:644.198 JLINK_IsHalted() +T42A8 007:645.053 - 0.851ms returns FALSE +T42A8 007:645.143 JLINK_HasError() +T42A8 007:661.072 JLINK_IsHalted() +T42A8 007:661.888 - 0.815ms returns FALSE +T42A8 007:661.923 JLINK_HasError() +T42A8 007:663.143 JLINK_IsHalted() +T42A8 007:663.976 - 0.831ms returns FALSE +T42A8 007:664.012 JLINK_HasError() +T42A8 007:666.048 JLINK_IsHalted() +T42A8 007:666.845 - 0.796ms returns FALSE +T42A8 007:666.891 JLINK_HasError() +T42A8 007:668.068 JLINK_IsHalted() +T42A8 007:668.893 - 0.824ms returns FALSE +T42A8 007:668.929 JLINK_HasError() +T42A8 007:670.061 JLINK_IsHalted() +T42A8 007:670.857 - 0.796ms returns FALSE +T42A8 007:670.887 JLINK_HasError() +T42A8 007:672.050 JLINK_IsHalted() +T42A8 007:672.881 - 0.829ms returns FALSE +T42A8 007:672.912 JLINK_HasError() +T42A8 007:674.097 JLINK_IsHalted() +T42A8 007:674.896 - 0.798ms returns FALSE +T42A8 007:674.927 JLINK_HasError() +T42A8 007:676.046 JLINK_IsHalted() +T42A8 007:676.846 - 0.799ms returns FALSE +T42A8 007:676.875 JLINK_HasError() +T42A8 007:678.039 JLINK_IsHalted() +T42A8 007:684.245 CPU_ReadMem(2 bytes @ 0x20003000) +T42A8 007:684.904 - 6.864ms returns TRUE +T42A8 007:684.927 JLINK_ReadReg(R15 (PC)) +T42A8 007:684.940 - 0.012ms returns 0x20003000 +T42A8 007:684.954 JLINK_ClrBPEx(BPHandle = 0x00000144) +T42A8 007:684.966 - 0.011ms returns 0x00 +T42A8 007:684.979 JLINK_ReadReg(R0) +T42A8 007:684.990 - 0.011ms returns 0x00000000 +T42A8 007:746.267 JLINK_WriteMem(0x20003000, 0x2 Bytes, ...) +T42A8 007:746.285 Data: FE E7 +T42A8 007:746.308 CPU_WriteMem(2 bytes @ 0x20003000) +T42A8 007:746.998 - 0.731ms returns 0x2 +T42A8 007:747.010 JLINK_HasError() +T42A8 007:747.017 JLINK_HasError() +T42A8 007:747.023 JLINK_SetResetType(JLINKARM_CM3_RESET_TYPE_NORMAL) +T42A8 007:747.029 - 0.005ms returns JLINKARM_CM3_RESET_TYPE_NORMAL +T42A8 007:747.035 JLINK_Reset() +T42A8 007:747.042 CPU_ReadMem(4 bytes @ 0x200039D4) +T42A8 007:747.589 CPU_WriteMem(4 bytes @ 0x200039D4) +T42A8 007:751.017 Memory map 'before startup completion point' is active +T42A8 007:751.031 CPU_WriteMem(4 bytes @ 0xE000EDF0) +T42A8 007:751.716 CPU_WriteMem(4 bytes @ 0xE000EDFC) +T42A8 007:754.925 Reset: Halt core after reset via DEMCR.VC_CORERESET. +T42A8 007:760.161 Reset: Reset device via AIRCR.SYSRESETREQ. +T42A8 007:760.187 CPU_WriteMem(4 bytes @ 0xE000ED0C) +T42A8 007:814.901 CPU_ReadMem(4 bytes @ 0xE000EDF0) +T42A8 007:815.639 CPU_ReadMem(4 bytes @ 0xE000EDF0) +T42A8 007:816.441 CPU_WriteMem(4 bytes @ 0xE000EDFC) +T42A8 007:822.575 CPU_ReadMem(4 bytes @ 0xE000EDF0) +T42A8 007:829.429 CPU_WriteMem(4 bytes @ 0xE0002000) +T42A8 007:830.184 CPU_ReadMem(4 bytes @ 0xE000EDFC) +T42A8 007:830.934 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:831.635 CPU_WriteMem(4 bytes @ 0xE0001000) +T42A8 007:832.303 - 85.267ms +T42A8 007:832.324 JLINK_Go() +T42A8 007:832.341 CPU_ReadMem(4 bytes @ 0xE0001000) +T42A8 007:832.993 CPU_WriteMem(4 bytes @ 0xE0001000) +T42A8 007:833.602 CPU_WriteMem(4 bytes @ 0xE0002008) +T42A8 007:833.617 CPU_WriteMem(4 bytes @ 0xE000200C) +T42A8 007:833.625 CPU_WriteMem(4 bytes @ 0xE0002010) +T42A8 007:833.633 CPU_WriteMem(4 bytes @ 0xE0002014) +T42A8 007:835.387 CPU_WriteMem(4 bytes @ 0xE0001004) +T42A8 007:839.641 Memory map 'after startup completion point' is active +T42A8 007:839.653 - 7.328ms +T42A8 007:848.479 JLINK_Close() +T42A8 007:848.873 CPU is running +T42A8 007:848.889 CPU_WriteMem(4 bytes @ 0xE0002008) +T42A8 007:849.470 CPU is running +T42A8 007:849.481 CPU_WriteMem(4 bytes @ 0xE000200C) +T42A8 007:850.045 CPU is running +T42A8 007:850.054 CPU_WriteMem(4 bytes @ 0xE0002010) +T42A8 007:850.576 CPU is running +T42A8 007:850.586 CPU_WriteMem(4 bytes @ 0xE0002014) +T42A8 007:861.705 - 13.225ms +T42A8 007:861.725 +T42A8 007:861.730 Closed diff --git a/projects/bleUart/mdk/JLinkSettings.ini b/projects/bleUart/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/projects/bleUart/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/projects/bleUart/mdk/bleUart.uvguix.Administrator b/projects/bleUart/mdk/bleUart.uvguix.Administrator new file mode 100644 index 0000000..829ef2d --- /dev/null +++ b/projects/bleUart/mdk/bleUart.uvguix.Administrator @@ -0,0 +1,1369 @@ + + + + -5.1 + +
### uVision Project, (C) Keil Software
+ + + + + + 38003 + Registers + 115 115 + + + 346 + Code Coverage + 1010 160 + + + 204 + Performance Analyzer + 1170 + + + + + + 1506 + Symbols + + 80 80 80 + + + 1936 + Watch 1 + + 80 80 80 + + + 1937 + Watch 2 + + 80 80 80 + + + 1935 + Call Stack + Locals + + 80 80 80 + + + 2506 + Trace Data + + 75 135 130 95 70 230 200 150 + + + + + + 1 + 1 + 0 + 0 + -1 + + + + + + + 44 + 2 + 1 + + -32000 + -32000 + + + -1 + -1 + + + 445 + 743 + 1297 + 964 + + + + 0 + + 402 + 0100000004000000010000000100000001000000010000000000000002000000000000000100000001000000000000002800000028000000010000000200000000000000010000005B433A5C55736572735C41646D696E6973747261746F725C4465736B746F705CB9A4D7F7CFEEC4BF5CD6D0BFD8CFEEC4BF5C626C6553444B365F76312E342E315C70726F6A656374735C626C65556172745C7372635C6D61696E2E6300000000066D61696E2E6300000000FFDC7800FFFFFFFF5B433A5C55736572735C41646D696E6973747261746F725C4465736B746F705CB9A4D7F7CFEEC4BF5CD6D0BFD8CFEEC4BF5C626C6553444B365F76312E342E315C70726F6A656374735C626C65556172745C7372635C70726F632E63000000000670726F632E6300000000D9ADC200FFFFFFFF0100000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD500010000000000000002000000F50000006E0000001003000015030000 + + + + 0 + Build + + -1 + -1 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + F40000004F00000090050000DF000000 + + + 16 + 2200000039000000EA020000C9000000 + + + + 1005 + 1005 + 1 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 0300000066000000ED000000DD020000 + + + 16 + 22000000390000001201000004010000 + + + + 109 + 109 + 1 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 0300000066000000ED000000DD020000 + + + 16 + 22000000390000003E01000079020000 + + + + 1465 + 1465 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 000000002D02000090050000BD020000 + + + 16 + 2200000039000000EA020000C9000000 + + + + 1466 + 1466 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000300200008D05000090020000 + + + 16 + 2200000039000000EA020000C9000000 + + + + 1467 + 1467 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000300200008D05000090020000 + + + 16 + 2200000039000000EA020000C9000000 + + + + 1468 + 1468 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000300200008D05000090020000 + + + 16 + 2200000039000000EA020000C9000000 + + + + 1506 + 1506 + 0 + 0 + 0 + 0 + 32767 + 0 + 16384 + 0 + + 16 + A3040000660000008D05000001010000 + + + 16 + 22000000390000001201000004010000 + + + + 1913 + 1913 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + F40000006300000090050000DF000000 + + + 16 + 2200000039000000EA020000C9000000 + + + + 1935 + 1935 + 0 + 0 + 0 + 0 + 32767 + 0 + 32768 + 0 + + 16 + 03000000300200008D050000A4020000 + + + 16 + 22000000390000001201000004010000 + + + + 1936 + 1936 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000300200008D05000090020000 + + + 16 + 22000000390000001201000004010000 + + + + 1937 + 1937 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000300200008D05000090020000 + + + 16 + 22000000390000001201000004010000 + + + + 1939 + 1939 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000300200008D05000090020000 + + + 16 + 2200000039000000EA020000C9000000 + + + + 1940 + 1940 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000300200008D05000090020000 + + + 16 + 2200000039000000EA020000C9000000 + + + + 1941 + 1941 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000300200008D05000090020000 + + + 16 + 2200000039000000EA020000C9000000 + + + + 1942 + 1942 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000300200008D05000090020000 + + + 16 + 2200000039000000EA020000C9000000 + + + + 195 + 195 + 1 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 0300000066000000ED000000DD020000 + + + 16 + 22000000390000003E01000079020000 + + + + 196 + 196 + 1 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 0300000066000000ED000000DD020000 + + + 16 + 22000000390000003E01000079020000 + + + + 197 + 197 + 1 + 0 + 0 + 0 + 32767 + 0 + 32768 + 0 + + 16 + 000000000E0300000F030000DD030000 + + + 16 + 2200000039000000EA020000C9000000 + + + + 198 + 198 + 0 + 0 + 0 + 0 + 32767 + 0 + 32768 + 0 + + 16 + 000000001902000090050000BD020000 + + + 16 + 2200000039000000EA020000C9000000 + + + + 199 + 199 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000110300008D05000071030000 + + + 16 + 2200000039000000EA020000C9000000 + + + + 203 + 203 + 0 + 0 + 0 + 0 + 32767 + 0 + 8192 + 0 + + 16 + F40000006300000090050000DF000000 + + + 16 + 2200000039000000EA020000C9000000 + + + + 204 + 204 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + F7000000660000008D050000C6000000 + + + 16 + 2200000039000000EA020000C9000000 + + + + 221 + 221 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 00000000000000000000000000000000 + + + 16 + 0A0000000A0000006E0000006E000000 + + + + 2506 + 2506 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A0040000630000009005000029020000 + + + 16 + 22000000390000001201000004010000 + + + + 2507 + 2507 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 000000002D02000090050000A9020000 + + + 16 + 2200000039000000EA020000C9000000 + + + + 343 + 343 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + F7000000660000008D050000C6000000 + + + 16 + 2200000039000000EA020000C9000000 + + + + 346 + 346 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + F7000000660000008D050000C6000000 + + + 16 + 2200000039000000EA020000C9000000 + + + + 35824 + 35824 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + F7000000660000008D050000C6000000 + + + 16 + 2200000039000000EA020000C9000000 + + + + 35885 + 35885 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D0500007C010000 + + + 16 + 22000000390000001201000004010000 + + + + 35886 + 35886 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D0500007C010000 + + + 16 + 22000000390000001201000004010000 + + + + 35887 + 35887 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D0500007C010000 + + + 16 + 22000000390000001201000004010000 + + + + 35888 + 35888 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D0500007C010000 + + + 16 + 22000000390000001201000004010000 + + + + 35889 + 35889 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D0500007C010000 + + + 16 + 22000000390000001201000004010000 + + + + 35890 + 35890 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D0500007C010000 + + + 16 + 22000000390000001201000004010000 + + + + 35891 + 35891 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D0500007C010000 + + + 16 + 22000000390000001201000004010000 + + + + 35892 + 35892 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D0500007C010000 + + + 16 + 22000000390000001201000004010000 + + + + 35893 + 35893 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D0500007C010000 + + + 16 + 22000000390000001201000004010000 + + + + 35894 + 35894 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D0500007C010000 + + + 16 + 22000000390000001201000004010000 + + + + 35895 + 35895 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D0500007C010000 + + + 16 + 22000000390000001201000004010000 + + + + 35896 + 35896 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D0500007C010000 + + + 16 + 22000000390000001201000004010000 + + + + 35897 + 35897 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D0500007C010000 + + + 16 + 22000000390000001201000004010000 + + + + 35898 + 35898 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D0500007C010000 + + + 16 + 22000000390000001201000004010000 + + + + 35899 + 35899 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D0500007C010000 + + + 16 + 22000000390000001201000004010000 + + + + 35900 + 35900 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D0500007C010000 + + + 16 + 22000000390000001201000004010000 + + + + 35901 + 35901 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D0500007C010000 + + + 16 + 22000000390000001201000004010000 + + + + 35902 + 35902 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D0500007C010000 + + + 16 + 22000000390000001201000004010000 + + + + 35903 + 35903 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D0500007C010000 + + + 16 + 22000000390000001201000004010000 + + + + 35904 + 35904 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D0500007C010000 + + + 16 + 22000000390000001201000004010000 + + + + 35905 + 35905 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + A3040000660000008D0500007C010000 + + + 16 + 22000000390000001201000004010000 + + + + 38003 + 38003 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 0300000066000000ED000000A4020000 + + + 16 + 22000000390000003E01000079020000 + + + + 38007 + 38007 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 000000000E030000900500008A030000 + + + 16 + 2200000039000000EA020000C9000000 + + + + 436 + 436 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000110300008D05000071030000 + + + 16 + 22000000390000003E01000079020000 + + + + 437 + 437 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000300200008D05000090020000 + + + 16 + 22000000390000001201000004010000 + + + + 440 + 440 + 0 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 03000000300200008D05000090020000 + + + 16 + 22000000390000001201000004010000 + + + + 59392 + 59392 + 1 + 0 + 0 + 0 + 32767 + 0 + 8192 + 0 + + 16 + 00000000000000000F0300001C000000 + + + 16 + 0A0000000A0000006E0000006E000000 + + + + 59393 + 0 + 1 + 0 + 0 + 0 + 32767 + 0 + 4096 + 0 + + 16 + 00000000DD0300000F030000F0030000 + + + 16 + 0A0000000A0000006E0000006E000000 + + + + 59399 + 59399 + 1 + 0 + 0 + 0 + 32767 + 0 + 8192 + 1 + + 16 + 000000001C000000DA01000038000000 + + + 16 + 0A0000000A0000006E0000006E000000 + + + + 59400 + 59400 + 0 + 0 + 0 + 0 + 32767 + 0 + 8192 + 2 + + 16 + 00000000380000006F02000054000000 + + + 16 + 0A0000000A0000006E0000006E000000 + + + + 2619 + 000000000B000000000000000020000000000000FFFFFFFFFFFFFFFFF4000000DF00000090050000E3000000000000000100001004000000010000000000000000000000FFFFFFFF06000000CB00000057010000CC000000F08B00005A01000079070000FFFF02000B004354616262656450616E6500200000000000002200000039000000EA020000C9000000F40000004F00000090050000DF0000000000000040280046060000000B446973617373656D626C7900000000CB00000001000000FFFFFFFFFFFFFFFF14506572666F726D616E636520416E616C797A6572000000005701000001000000FFFFFFFFFFFFFFFF14506572666F726D616E636520416E616C797A657200000000CC00000001000000FFFFFFFFFFFFFFFF0E4C6F67696320416E616C797A657200000000F08B000001000000FFFFFFFFFFFFFFFF0D436F646520436F766572616765000000005A01000001000000FFFFFFFFFFFFFFFF11496E737472756374696F6E205472616365000000007907000001000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000001000000FFFFFFFFCB00000001000000FFFFFFFFCB000000000000000040000000000000FFFFFFFFFFFFFFFF9C0400004F000000A004000029020000000000000200001004000000010000000000000000000000FFFFFFFF17000000E2050000CA0900002D8C00002E8C00002F8C0000308C0000318C0000328C0000338C0000348C0000358C0000368C0000378C0000388C0000398C00003A8C00003B8C00003C8C00003D8C00003E8C00003F8C0000408C0000418C00000180004000000000000022000000390000001201000004010000A00400004F00000090050000290200000000000040410046170000000753796D626F6C7300000000E205000001000000FFFFFFFFFFFFFFFF0A5472616365204461746100000000CA09000001000000FFFFFFFFFFFFFFFF00000000002D8C000001000000FFFFFFFFFFFFFFFF00000000002E8C000001000000FFFFFFFFFFFFFFFF00000000002F8C000001000000FFFFFFFFFFFFFFFF0000000000308C000001000000FFFFFFFFFFFFFFFF0000000000318C000001000000FFFFFFFFFFFFFFFF0000000000328C000001000000FFFFFFFFFFFFFFFF0000000000338C000001000000FFFFFFFFFFFFFFFF0000000000348C000001000000FFFFFFFFFFFFFFFF0000000000358C000001000000FFFFFFFFFFFFFFFF0000000000368C000001000000FFFFFFFFFFFFFFFF0000000000378C000001000000FFFFFFFFFFFFFFFF0000000000388C000001000000FFFFFFFFFFFFFFFF0000000000398C000001000000FFFFFFFFFFFFFFFF00000000003A8C000001000000FFFFFFFFFFFFFFFF00000000003B8C000001000000FFFFFFFFFFFFFFFF00000000003C8C000001000000FFFFFFFFFFFFFFFF00000000003D8C000001000000FFFFFFFFFFFFFFFF00000000003E8C000001000000FFFFFFFFFFFFFFFF00000000003F8C000001000000FFFFFFFFFFFFFFFF0000000000408C000001000000FFFFFFFFFFFFFFFF0000000000418C000001000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000001000000FFFFFFFFE205000001000000FFFFFFFFE2050000000000000010000001000000FFFFFFFFFFFFFFFFF00000004F000000F4000000F6020000010000000200001004000000010000000000000000000000FFFFFFFF05000000ED0300006D000000C3000000C4000000739400000180001000000100000022000000390000001201000004010000000000004F000000F0000000F60200000000000040410056050000000750726F6A65637401000000ED03000001000000FFFFFFFFFFFFFFFF05426F6F6B73010000006D00000001000000FFFFFFFFFFFFFFFF0946756E6374696F6E7301000000C300000001000000FFFFFFFFFFFFFFFF0954656D706C6174657301000000C400000001000000FFFFFFFFFFFFFFFF09526567697374657273000000007394000001000000FFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000001000000FFFFFFFFED03000001000000FFFFFFFFED030000000000000080000000000000FFFFFFFFFFFFFFFF0000000015020000900500001902000000000000010000100400000001000000000000000000000000000000000000000000000001000000C6000000FFFFFFFF0E0000008F070000930700009407000095070000960700009007000091070000B5010000B8010000B9050000BA050000BB050000BC050000CB0900000180008000000000000022000000390000001201000004010000000000001902000090050000BD02000000000000404100460E0000001343616C6C20537461636B202B204C6F63616C73000000008F07000001000000FFFFFFFFFFFFFFFF0755415254202331000000009307000001000000FFFFFFFFFFFFFFFF0755415254202332000000009407000001000000FFFFFFFFFFFFFFFF0755415254202333000000009507000001000000FFFFFFFFFFFFFFFF15446562756720287072696E74662920566965776572000000009607000001000000FFFFFFFFFFFFFFFF0757617463682031000000009007000001000000FFFFFFFFFFFFFFFF0757617463682032000000009107000001000000FFFFFFFFFFFFFFFF10547261636520457863657074696F6E7300000000B501000001000000FFFFFFFFFFFFFFFF0E4576656E7420436F756E7465727300000000B801000001000000FFFFFFFFFFFFFFFF084D656D6F7279203100000000B905000001000000FFFFFFFFFFFFFFFF084D656D6F7279203200000000BA05000001000000FFFFFFFFFFFFFFFF084D656D6F7279203300000000BB05000001000000FFFFFFFFFFFFFFFF084D656D6F7279203400000000BC05000001000000FFFFFFFFFFFFFFFF105472616365204E617669676174696F6E00000000CB09000001000000FFFFFFFFFFFFFFFFFFFFFFFF0000000001000000000000000000000001000000FFFFFFFFC802000019020000CC020000BD02000000000000020000000400000000000000000000000000000000000000000000000000000002000000C6000000FFFFFFFF8F07000001000000FFFFFFFF8F07000001000000C6000000000000000080000001000000FFFFFFFFFFFFFFFF00000000F60200000F030000FA0200000100000001000010040000000100000002FDFFFF8E000000FFFFFFFF04000000C5000000C7000000B401000077940000018000800000010000002200000039000000EA020000C900000000000000FA0200000F030000DD0300000000000040820056040000000C4275696C64204F757470757401000000C500000001000000FFFFFFFFFFFFFFFF0D46696E6420496E2046696C657300000000C700000001000000FFFFFFFFFFFFFFFF0A4572726F72204C69737400000000B401000001000000FFFFFFFFFFFFFFFF0742726F77736572000000007794000001000000FFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000001000000FFFFFFFFC500000001000000FFFFFFFFC5000000000000000000000000000000 + + + 59392 + File + + 2131 + 00200000010000002800FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000000000000000000000000000000000000000100000001000000018001E100000000000001000000000000000000000000000000000100000001000000018003E1000000000000020000000000000000000000000000000001000000010000000180CD7F0000000000000300000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018023E100000000000004000000000000000000000000000000000100000001000000018022E100000000000005000000000000000000000000000000000100000001000000018025E10000000000000600000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001802BE10000000004000700000000000000000000000000000000010000000100000001802CE10000000004000800000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001807A8A0000000000000900000000000000000000000000000000010000000100000001807B8A0000000004000A00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180D3B00000000000000B000000000000000000000000000000000100000001000000018015B10000000004000C0000000000000000000000000000000001000000010000000180F4B00000000004000D000000000000000000000000000000000100000001000000018036B10000000004000E00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FF88000000000000460000000000000000000000000000000001000000010000000180FE880000000000004500000000000000000000000000000000010000000100000001800B810000000000001300000000000000000000000000000000010000000100000001800C810000000000001400000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180F0880000020000000F000000000000000000000000000000000100000001000000FFFF0100120043555646696E64436F6D626F427574746F6EE80300000000000000000000000000000000000000000000000100000001000000960000000200205000000000106D625F636D645F706F7765725F6F666696000000000000000500106D625F636D645F706F7765725F6F66660F6D625F636D645F706F7765725F6F6E1276696F5F726561645F686F6C645F726567731E746573745F6D6F646275735F7274755F736C6176655F63616C6C6261636B09736D625F736C6176650000000000000000000000000000000000000000018024E10000000000001100000000000000000000000000000000010000000100000001800A810000000000001200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018022800000020000001500000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180C488000000000000160000000000000000000000000000000001000000010000000180C988000000000400180000000000000000000000000000000001000000010000000180C788000000000000190000000000000000000000000000000001000000010000000180C8880000000000001700000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000FFFF01001500434D4643546F6F6C4261724D656E75427574746F6E4C010000020001001A0000000F50726F6A6563742057696E646F7773000000000000000000000000010000000100000000000000000000000100000008002880DD880000000000001A0000000750726F6A656374000000000000000000000000010000000100000000000000000000000100000000002880DC8B0000000000003A00000005426F6F6B73000000000000000000000000010000000100000000000000000000000100000000002880E18B0000000000003B0000000946756E6374696F6E73000000000000000000000000010000000100000000000000000000000100000000002880E28B000000000000400000000954656D706C6174657300000000000000000000000001000000010000000000000000000000010000000000288018890000000000003D0000000E536F757263652042726F777365720000000000000000000000000100000001000000000000000000000001000000000028800000000000000400FFFFFFFF00000000000000000000000000010000000100000000000000000000000100000000002880D988000000000000390000000C4275696C64204F7574707574000000000000000000000000010000000100000000000000000000000100000000002880E38B000000000000410000000B46696E64204F75747075740000000000000000000000000100000001000000000000000000000001000000000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FB7F0000000000001B000000000000000000000000000000000100000001000000000000000446696C65FF7F0000 + + + 1423 + 2800FFFF01001100434D4643546F6F6C426172427574746F6E00E1000000000000FFFFFFFF000100000000000000010000000000000001000000018001E1000000000000FFFFFFFF000100000000000000010000000000000001000000018003E1000000000000FFFFFFFF0001000000000000000100000000000000010000000180CD7F000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF000000000000000000010000000000000001000000018023E1000000000000FFFFFFFF000100000000000000010000000000000001000000018022E1000000000000FFFFFFFF000100000000000000010000000000000001000000018025E1000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF00000000000000000001000000000000000100000001802BE1000000000000FFFFFFFF00010000000000000001000000000000000100000001802CE1000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF00000000000000000001000000000000000100000001807A8A000000000000FFFFFFFF00010000000000000001000000000000000100000001807B8A000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF0000000000000000000100000000000000010000000180D3B0000000000000FFFFFFFF000100000000000000010000000000000001000000018015B1000000000000FFFFFFFF0001000000000000000100000000000000010000000180F4B0000000000000FFFFFFFF000100000000000000010000000000000001000000018036B1000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF0000000000000000000100000000000000010000000180FF88000000000000FFFFFFFF0001000000000000000100000000000000010000000180FE88000000000000FFFFFFFF00010000000000000001000000000000000100000001800B81000000000000FFFFFFFF00010000000000000001000000000000000100000001800C81000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF0000000000000000000100000000000000010000000180F088000000000000FFFFFFFF0001000000000000000100000000000000010000000180EE7F000000000000FFFFFFFF000100000000000000010000000000000001000000018024E1000000000000FFFFFFFF00010000000000000001000000000000000100000001800A81000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF00000000000000000001000000000000000100000001802280000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF0000000000000000000100000000000000010000000180C488000000000000FFFFFFFF0001000000000000000100000000000000010000000180C988000000000000FFFFFFFF0001000000000000000100000000000000010000000180C788000000000000FFFFFFFF0001000000000000000100000000000000010000000180C888000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF0000000000000000000100000000000000010000000180DD88000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF0000000000000000000100000000000000010000000180FB7F000000000000FFFFFFFF000100000000000000010000000000000001000000 + + + 1423 + 2800FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000000000000000000000000000000000000000100000001000000018001E100000000000001000000000000000000000000000000000100000001000000018003E1000000000000020000000000000000000000000000000001000000010000000180CD7F0000000000000300000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018023E100000000000004000000000000000000000000000000000100000001000000018022E100000000000005000000000000000000000000000000000100000001000000018025E10000000000000600000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001802BE10000000000000700000000000000000000000000000000010000000100000001802CE10000000000000800000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001807A8A0000000000000900000000000000000000000000000000010000000100000001807B8A0000000000000A00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180D3B00000000000000B000000000000000000000000000000000100000001000000018015B10000000000000C0000000000000000000000000000000001000000010000000180F4B00000000000000D000000000000000000000000000000000100000001000000018036B10000000000000E00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FF880000000000000F0000000000000000000000000000000001000000010000000180FE880000000000001000000000000000000000000000000000010000000100000001800B810000000000001100000000000000000000000000000000010000000100000001800C810000000000001200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180F088000000000000130000000000000000000000000000000001000000010000000180EE7F00000000000014000000000000000000000000000000000100000001000000018024E10000000000001500000000000000000000000000000000010000000100000001800A810000000000001600000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018022800000000000001700000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180C488000000000000180000000000000000000000000000000001000000010000000180C988000000000000190000000000000000000000000000000001000000010000000180C7880000000000001A0000000000000000000000000000000001000000010000000180C8880000000000001B00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180DD880000000000001C00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FB7F0000000000001D000000000000000000000000000000000100000001000000 + + + + 59399 + Build + + 676 + 00200000010000001000FFFF01001100434D4643546F6F6C426172427574746F6ECF7F0000000000001C0000000000000000000000000000000001000000010000000180D07F0000000000001D000000000000000000000000000000000100000001000000018030800000000000001E00000000000000000000000000000000010000000100000001809E8A0000000000001F0000000000000000000000000000000001000000010000000180D17F0000000004002000000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001804C8A0000000000002100000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000FFFF01001900434D4643546F6F6C426172436F6D626F426F78427574746F6EBA000000000000000000000000000000000000000000000000010000000100000096000000030020500000000007626C65556172749600000000000000010007626C6555617274000000000180EB880000000000002200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180C07F000000000000230000000000000000000000000000000001000000010000000180B08A000000000400240000000000000000000000000000000001000000010000000180A8010000000000004E00000000000000000000000000000000010000000100000001807202000000000000530000000000000000000000000000000001000000010000000180BE010000000000005000000000000000000000000000000000010000000100000000000000054275696C64FF7F0000 + + + 583 + 1000FFFF01001100434D4643546F6F6C426172427574746F6ECF7F000000000000FFFFFFFF0001000000000000000100000000000000010000000180D07F000000000000FFFFFFFF00010000000000000001000000000000000100000001803080000000000000FFFFFFFF00010000000000000001000000000000000100000001809E8A000000000000FFFFFFFF0001000000000000000100000000000000010000000180D17F000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF00000000000000000001000000000000000100000001804C8A000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF00000000000000000001000000000000000100000001806680000000000000FFFFFFFF0001000000000000000100000000000000010000000180EB88000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF0000000000000000000100000000000000010000000180C07F000000000000FFFFFFFF0001000000000000000100000000000000010000000180B08A000000000000FFFFFFFF0001000000000000000100000000000000010000000180A801000000000000FFFFFFFF00010000000000000001000000000000000100000001807202000000000000FFFFFFFF0001000000000000000100000000000000010000000180BE01000000000000FFFFFFFF000100000000000000010000000000000001000000 + + + 583 + 1000FFFF01001100434D4643546F6F6C426172427574746F6ECF7F000000000000000000000000000000000000000000000001000000010000000180D07F00000000000001000000000000000000000000000000000100000001000000018030800000000000000200000000000000000000000000000000010000000100000001809E8A000000000000030000000000000000000000000000000001000000010000000180D17F0000000000000400000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001804C8A0000000000000500000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001806680000000000000060000000000000000000000000000000001000000010000000180EB880000000000000700000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180C07F000000000000080000000000000000000000000000000001000000010000000180B08A000000000000090000000000000000000000000000000001000000010000000180A8010000000000000A000000000000000000000000000000000100000001000000018072020000000000000B0000000000000000000000000000000001000000010000000180BE010000000000000C000000000000000000000000000000000100000001000000 + + + + 59400 + Debug + + 2220 + 00200000000000001900FFFF01001100434D4643546F6F6C426172427574746F6ECC880000000000002500000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018017800000000000002600000000000000000000000000000000010000000100000001801D800000000000002700000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001801A800000000000002800000000000000000000000000000000010000000100000001801B80000000000000290000000000000000000000000000000001000000010000000180E57F0000000000002A00000000000000000000000000000000010000000100000001801C800000000000002B00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018000890000000000002C00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180E48B0000000000002D0000000000000000000000000000000001000000010000000180F07F0000000000002E0000000000000000000000000000000001000000010000000180E8880000000000003700000000000000000000000000000000010000000100000001803B010000000000002F0000000000000000000000000000000001000000010000000180BB8A00000000000030000000000000000000000000000000000100000001000000FFFF01001500434D4643546F6F6C4261724D656E75427574746F6E0E01000000000000310000000D57617463682057696E646F7773000000000000000000000000010000000100000000000000000000000100000002001380D88B000000000000310000000757617463682031000000000000000000000000010000000100000000000000000000000100000000001380D98B0000000000003100000007576174636820320000000000000000000000000100000001000000000000000000000001000000000013800F01000000000000320000000E4D656D6F72792057696E646F7773000000000000000000000000010000000100000000000000000000000100000004001380D28B00000000000032000000084D656D6F72792031000000000000000000000000010000000100000000000000000000000100000000001380D38B00000000000032000000084D656D6F72792032000000000000000000000000010000000100000000000000000000000100000000001380D48B00000000000032000000084D656D6F72792033000000000000000000000000010000000100000000000000000000000100000000001380D58B00000000000032000000084D656D6F727920340000000000000000000000000100000001000000000000000000000001000000000013801001000000000000330000000E53657269616C2057696E646F77730000000000000000000000000100000001000000000000000000000001000000040013809307000000000000330000000755415254202331000000000000000000000000010000000100000000000000000000000100000000001380940700000000000033000000075541525420233200000000000000000000000001000000010000000000000000000000010000000000138095070000000000003300000007554152542023330000000000000000000000000100000001000000000000000000000001000000000013809607000000000000330000000E49544D2F525441205669657765720000000000000000000000000100000001000000000000000000000001000000000013803C010000000000003400000010416E616C797369732057696E646F7773000000000000000000000000010000000100000000000000000000000100000003001380658A000000000000340000000E4C6F67696320416E616C797A6572000000000000000000000000010000000100000000000000000000000100000000001380DC7F0000000000003E00000014506572666F726D616E636520416E616C797A6572000000000000000000000000010000000100000000000000000000000100000000001380E788000000000000380000000D436F646520436F76657261676500000000000000000000000001000000010000000000000000000000010000000000138053010000000000003F0000000D54726163652057696E646F77730000000000000000000000000100000001000000000000000000000001000000010013805401000000000000FFFFFFFF115472616365204D656E7520416E63686F720100000000000000000000000100000001000000000000000000000001000000000013802901000000000000350000001553797374656D205669657765722057696E646F77730000000000000000000000000100000001000000000000000000000001000000010013804B01000000000000FFFFFFFF1453797374656D2056696577657220416E63686F720100000000000000000000000100000001000000000000000000000001000000000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000138001890000000000003600000007546F6F6C626F7800000000000000000000000001000000010000000000000000000000010000000300138044C5000000000000FFFFFFFF0E5570646174652057696E646F77730100000000000000000000000100000001000000000000000000000001000000000013800000000000000400FFFFFFFF000000000000000000000000000100000001000000000000000000000001000000000013805B01000000000000FFFFFFFF12546F6F6C626F78204D656E75416E63686F720100000000000000000000000100000001000000000000000000000001000000000000000000054465627567FF7F0000 + + + 898 + 1900FFFF01001100434D4643546F6F6C426172427574746F6ECC88000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF00000000000000000001000000000000000100000001801780000000000000FFFFFFFF00010000000000000001000000000000000100000001801D80000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF00000000000000000001000000000000000100000001801A80000000000000FFFFFFFF00010000000000000001000000000000000100000001801B80000000000000FFFFFFFF0001000000000000000100000000000000010000000180E57F000000000000FFFFFFFF00010000000000000001000000000000000100000001801C80000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF00000000000000000001000000000000000100000001800089000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF0000000000000000000100000000000000010000000180E48B000000000000FFFFFFFF0001000000000000000100000000000000010000000180F07F000000000000FFFFFFFF0001000000000000000100000000000000010000000180E888000000000000FFFFFFFF00010000000000000001000000000000000100000001803B01000000000000FFFFFFFF0001000000000000000100000000000000010000000180BB8A000000000000FFFFFFFF0001000000000000000100000000000000010000000180D88B000000000000FFFFFFFF0001000000000000000100000000000000010000000180D28B000000000000FFFFFFFF00010000000000000001000000000000000100000001809307000000000000FFFFFFFF0001000000000000000100000000000000010000000180658A000000000000FFFFFFFF0001000000000000000100000000000000010000000180C18A000000000000FFFFFFFF0001000000000000000100000000000000010000000180EE8B000000000000FFFFFFFF00010000000000000001000000000000000100000001800000000000000000FFFFFFFF00000000000000000001000000000000000100000001800189000000000000FFFFFFFF000100000000000000010000000000000001000000 + + + 898 + 1900FFFF01001100434D4643546F6F6C426172427574746F6ECC880000000000000000000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018017800000000000000100000000000000000000000000000000010000000100000001801D800000000000000200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001801A800000000000000300000000000000000000000000000000010000000100000001801B80000000000000040000000000000000000000000000000001000000010000000180E57F0000000000000500000000000000000000000000000000010000000100000001801C800000000000000600000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018000890000000000000700000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180E48B000000000000080000000000000000000000000000000001000000010000000180F07F000000000000090000000000000000000000000000000001000000010000000180E8880000000000000A00000000000000000000000000000000010000000100000001803B010000000000000B0000000000000000000000000000000001000000010000000180BB8A0000000000000C0000000000000000000000000000000001000000010000000180D88B0000000000000D0000000000000000000000000000000001000000010000000180D28B0000000000000E000000000000000000000000000000000100000001000000018093070000000000000F0000000000000000000000000000000001000000010000000180658A000000000000100000000000000000000000000000000001000000010000000180C18A000000000000110000000000000000000000000000000001000000010000000180EE8B0000000000001200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180018900000000000013000000000000000000000000000000000100000001000000 + + + + 0 + 1920 + 1080 + + + + + + 1 + 0 + + 100 + 0 + + ..\src\main.c + 0 + 10 + 31 + 1 + 54 + 0 + + + ..\src\proc.c + 0 + 23 + 32 + 1 + 115 + 0 + + + + +
diff --git a/projects/bleUart/mdk/bleUart.uvoptx b/projects/bleUart/mdk/bleUart.uvoptx new file mode 100644 index 0000000..1fc28d5 --- /dev/null +++ b/projects/bleUart/mdk/bleUart.uvoptx @@ -0,0 +1,537 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + bleUart + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 6 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + DLGUARM + `E謜堘u `E謜堘u + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC1000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 2 + 1 + 0x18004000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + + + System Viewer\CSC + 35904 + + + System Viewer\UART1 + 35905 + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + 0 + ..\src\myapp.c + myapp.c + 0 + 0 + + + 2 + 5 + 1 + 1 + 0 + 0 + 0 + ..\src\proc.c + proc.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 6 + 5 + 0 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 7 + 4 + 0 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + modules + 1 + 0 + 0 + 0 + + 4 + 8 + 1 + 0 + 0 + 0 + 0 + ..\..\..\modules\src\leds.c + leds.c + 0 + 0 + + + 4 + 9 + 1 + 0 + 0 + 0 + 0 + ..\..\..\modules\src\sftmr.c + sftmr.c + 0 + 0 + + + 4 + 10 + 1 + 0 + 0 + 0 + 0 + ..\..\..\modules\src\uart1Rb.c + uart1Rb.c + 0 + 0 + + + + + ble\app + 1 + 0 + 0 + 0 + + 5 + 11 + 1 + 0 + 0 + 0 + 0 + ..\..\..\ble\app\app.c + app.c + 0 + 0 + + + 5 + 12 + 1 + 0 + 0 + 0 + 0 + ..\..\..\ble\app\app_actv.c + app_actv.c + 0 + 0 + + + 5 + 13 + 1 + 0 + 0 + 0 + 0 + ..\..\..\ble\app\app_msg.c + app_msg.c + 0 + 0 + + + 5 + 14 + 1 + 0 + 0 + 0 + 0 + ..\..\..\ble\app\app_gapm.c + app_gapm.c + 0 + 0 + + + 5 + 15 + 1 + 0 + 0 + 0 + 0 + ..\..\..\ble\app\app_gapc.c + app_gapc.c + 0 + 0 + + + 5 + 16 + 1 + 0 + 0 + 0 + 0 + ..\..\..\ble\app\app_gatt.c + app_gatt.c + 0 + 0 + + + + + ble\prf + 1 + 0 + 0 + 0 + + 6 + 17 + 1 + 0 + 0 + 0 + 0 + ..\..\..\ble\prf\prf_diss.c + prf_diss.c + 0 + 0 + + + 6 + 18 + 1 + 0 + 0 + 0 + 0 + ..\..\..\ble\prf\prf_sess.c + prf_sess.c + 0 + 0 + + + + + ble\lib + 1 + 0 + 0 + 0 + + 7 + 19 + 4 + 0 + 0 + 0 + 0 + ..\..\..\ble\lib\ble6.lib + ble6.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 8 + 20 + 1 + 0 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
diff --git a/projects/bleUart/mdk/bleUart.uvprojx b/projects/bleUart/mdk/bleUart.uvprojx new file mode 100644 index 0000000..fd87b5d --- /dev/null +++ b/projects/bleUart/mdk/bleUart.uvprojx @@ -0,0 +1,555 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + bleUart + 0x4 + ARM-ADS + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + bleUart + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + + + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + + 0 + 6 + + + + + + + + + + + + + + Segger\JL2CM3.dll + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 0 + 1 + 1 + + --c99 --thumb --gnu --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip_ble.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + myapp.c + 1 + ..\src\myapp.c + + + proc.c + 1 + ..\src\proc.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + modules + + + leds.c + 1 + ..\..\..\modules\src\leds.c + + + sftmr.c + 1 + ..\..\..\modules\src\sftmr.c + + + uart1Rb.c + 1 + ..\..\..\modules\src\uart1Rb.c + + + + + ble\app + + + app.c + 1 + ..\..\..\ble\app\app.c + + + app_actv.c + 1 + ..\..\..\ble\app\app_actv.c + + + app_msg.c + 1 + ..\..\..\ble\app\app_msg.c + + + app_gapm.c + 1 + ..\..\..\ble\app\app_gapm.c + + + app_gapc.c + 1 + ..\..\..\ble\app\app_gapc.c + + + app_gatt.c + 1 + ..\..\..\ble\app\app_gatt.c + + + + + ble\prf + + + prf_diss.c + 1 + ..\..\..\ble\prf\prf_diss.c + + + prf_sess.c + 1 + ..\..\..\ble\prf\prf_sess.c + + + + + ble\lib + + + ble6.lib + 4 + ..\..\..\ble\lib\ble6.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + +
diff --git a/projects/bleUart/mdk/clean.bat b/projects/bleUart/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/projects/bleUart/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/projects/bleUart/mdk/output/app.crf b/projects/bleUart/mdk/output/app.crf new file mode 100644 index 0000000..6f865f3 Binary files /dev/null and b/projects/bleUart/mdk/output/app.crf differ diff --git a/projects/bleUart/mdk/output/app.d b/projects/bleUart/mdk/output/app.d new file mode 100644 index 0000000..594a2dd --- /dev/null +++ b/projects/bleUart/mdk/output/app.d @@ -0,0 +1,63 @@ +.\output\app.o: ..\..\..\ble\app\app.c +.\output\app.o: ..\src\cfg.h +.\output\app.o: ..\..\..\ble\app\app.h +.\output\app.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h +.\output\app.o: ..\..\..\core\string.h +.\output\app.o: ..\..\..\ble\api\blelib.h +.\output\app.o: ..\..\..\ble\api\ke_api.h +.\output\app.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h +.\output\app.o: ..\..\..\ble\api\task.h +.\output\app.o: ..\..\..\ble\api\list.h +.\output\app.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stddef.h +.\output\app.o: ..\..\..\ble\api\utils.h +.\output\app.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdlib.h +.\output\app.o: ..\..\..\ble\app\app_actv.h +.\output\app.o: ..\..\..\ble\api\gapm.h +.\output\app.o: ..\..\..\ble\api\le_err.h +.\output\app.o: ..\..\..\ble\api\gap.h +.\output\app.o: ..\..\..\ble\api\gapc.h +.\output\app.o: ..\..\..\ble\api\bledef.h +.\output\app.o: ..\..\..\ble\api\gapm_api.h +.\output\app.o: ..\..\..\ble\api\gapc_api.h +.\output\app.o: ..\..\..\ble\api\gatt_api.h +.\output\app.o: ..\..\..\ble\api\gatt.h +.\output\app.o: ..\..\..\ble\api\att.h +.\output\app.o: ..\..\..\ble\prf\prf_api.h +.\output\app.o: ..\..\..\ble\prf\prf_diss.h +.\output\app.o: ..\..\..\ble\prf\prf_bass.h +.\output\app.o: ..\..\..\ble\prf\prf_hids.h +.\output\app.o: ..\..\..\ble\prf\prf_sess.h +.\output\app.o: ..\..\..\drivers\api\drvs.h +.\output\app.o: ..\..\..\core\b6x.h +.\output\app.o: ..\..\..\core\core_cm0plus.h +.\output\app.o: ..\..\..\core\core_cmInstr.h +.\output\app.o: ..\..\..\core\core_cmFunc.h +.\output\app.o: ..\..\..\core\rom.h +.\output\app.o: ..\..\..\drivers\api\core.h +.\output\app.o: ..\..\..\drivers\api\dma.h +.\output\app.o: ..\..\..\core\reg\reg_dmachcfg.h +.\output\app.o: ..\..\..\core\reg\reg_base.h +.\output\app.o: ..\..\..\drivers\api\exti.h +.\output\app.o: ..\..\..\core\reg\reg_exti.h +.\output\app.o: ..\..\..\drivers\api\fshc.h +.\output\app.o: ..\..\..\drivers\api\flash.h +.\output\app.o: ..\..\..\drivers\api\gpio.h +.\output\app.o: ..\..\..\drivers\api\iopad.h +.\output\app.o: ..\..\..\core\reg\reg_csc.h +.\output\app.o: ..\..\..\core\reg\reg_gpio.h +.\output\app.o: ..\..\..\drivers\api\i2c.h +.\output\app.o: ..\..\..\core\reg\reg_i2c.h +.\output\app.o: ..\..\..\drivers\api\iwdt.h +.\output\app.o: ..\..\..\drivers\api\pwm.h +.\output\app.o: ..\..\..\drivers\api\rcc.h +.\output\app.o: ..\..\..\core\reg\reg_rcc.h +.\output\app.o: ..\..\..\drivers\api\rtc.h +.\output\app.o: ..\..\..\core\reg\reg_apbmisc.h +.\output\app.o: ..\..\..\drivers\api\rco.h +.\output\app.o: ..\..\..\drivers\api\sadc.h +.\output\app.o: ..\..\..\drivers\api\spi.h +.\output\app.o: ..\..\..\drivers\api\timer.h +.\output\app.o: ..\..\..\core\reg\reg_timer.h +.\output\app.o: ..\..\..\drivers\api\trim.h +.\output\app.o: ..\..\..\drivers\api\uart.h +.\output\app.o: ..\..\..\core\reg\reg_uart.h diff --git a/projects/bleUart/mdk/output/app.o b/projects/bleUart/mdk/output/app.o new file mode 100644 index 0000000..c21d4ac Binary files /dev/null and b/projects/bleUart/mdk/output/app.o differ diff --git a/projects/bleUart/mdk/output/app_actv.crf b/projects/bleUart/mdk/output/app_actv.crf new file mode 100644 index 0000000..4de5ab7 Binary files /dev/null and b/projects/bleUart/mdk/output/app_actv.crf differ diff --git a/projects/bleUart/mdk/output/app_actv.d b/projects/bleUart/mdk/output/app_actv.d new file mode 100644 index 0000000..360383f --- /dev/null +++ b/projects/bleUart/mdk/output/app_actv.d @@ -0,0 +1,19 @@ +.\output\app_actv.o: ..\..\..\ble\app\app_actv.c +.\output\app_actv.o: ..\src\cfg.h +.\output\app_actv.o: ..\..\..\ble\app\app.h +.\output\app_actv.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h +.\output\app_actv.o: ..\..\..\core\string.h +.\output\app_actv.o: ..\..\..\ble\api\blelib.h +.\output\app_actv.o: ..\..\..\ble\api\ke_api.h +.\output\app_actv.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h +.\output\app_actv.o: ..\..\..\ble\api\task.h +.\output\app_actv.o: ..\..\..\ble\api\list.h +.\output\app_actv.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stddef.h +.\output\app_actv.o: ..\..\..\ble\api\utils.h +.\output\app_actv.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdlib.h +.\output\app_actv.o: ..\..\..\ble\app\app_actv.h +.\output\app_actv.o: ..\..\..\ble\api\gapm.h +.\output\app_actv.o: ..\..\..\ble\api\le_err.h +.\output\app_actv.o: ..\..\..\ble\api\gap.h +.\output\app_actv.o: ..\..\..\ble\api\gapc.h +.\output\app_actv.o: ..\..\..\ble\api\gapm_api.h diff --git a/projects/bleUart/mdk/output/app_actv.o b/projects/bleUart/mdk/output/app_actv.o new file mode 100644 index 0000000..e40868c Binary files /dev/null and b/projects/bleUart/mdk/output/app_actv.o differ diff --git a/projects/bleUart/mdk/output/app_gapc.crf b/projects/bleUart/mdk/output/app_gapc.crf new file mode 100644 index 0000000..b241216 Binary files /dev/null and b/projects/bleUart/mdk/output/app_gapc.crf differ diff --git a/projects/bleUart/mdk/output/app_gapc.d b/projects/bleUart/mdk/output/app_gapc.d new file mode 100644 index 0000000..f180513 --- /dev/null +++ b/projects/bleUart/mdk/output/app_gapc.d @@ -0,0 +1,31 @@ +.\output\app_gapc.o: ..\..\..\ble\app\app_gapc.c +.\output\app_gapc.o: ..\src\cfg.h +.\output\app_gapc.o: ..\..\..\ble\api\bledef.h +.\output\app_gapc.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h +.\output\app_gapc.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h +.\output\app_gapc.o: ..\..\..\ble\api\blelib.h +.\output\app_gapc.o: ..\..\..\ble\api\ke_api.h +.\output\app_gapc.o: ..\..\..\ble\api\task.h +.\output\app_gapc.o: ..\..\..\ble\api\list.h +.\output\app_gapc.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stddef.h +.\output\app_gapc.o: ..\..\..\ble\api\utils.h +.\output\app_gapc.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdlib.h +.\output\app_gapc.o: ..\..\..\ble\api\gapm_api.h +.\output\app_gapc.o: ..\..\..\ble\api\gapm.h +.\output\app_gapc.o: ..\..\..\ble\api\le_err.h +.\output\app_gapc.o: ..\..\..\ble\api\gap.h +.\output\app_gapc.o: ..\..\..\ble\api\gapc_api.h +.\output\app_gapc.o: ..\..\..\ble\api\gapc.h +.\output\app_gapc.o: ..\..\..\ble\api\gatt_api.h +.\output\app_gapc.o: ..\..\..\ble\api\gatt.h +.\output\app_gapc.o: ..\..\..\ble\api\att.h +.\output\app_gapc.o: ..\..\..\ble\prf\prf_api.h +.\output\app_gapc.o: ..\..\..\ble\prf\prf_diss.h +.\output\app_gapc.o: ..\..\..\ble\prf\prf_bass.h +.\output\app_gapc.o: ..\..\..\ble\prf\prf_hids.h +.\output\app_gapc.o: ..\..\..\ble\prf\prf_sess.h +.\output\app_gapc.o: ..\..\..\ble\app\app.h +.\output\app_gapc.o: ..\..\..\core\string.h +.\output\app_gapc.o: ..\..\..\ble\app\app_actv.h +.\output\app_gapc.o: ..\..\..\modules\api\dbg.h +.\output\app_gapc.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h diff --git a/projects/bleUart/mdk/output/app_gapc.o b/projects/bleUart/mdk/output/app_gapc.o new file mode 100644 index 0000000..77f4733 Binary files /dev/null and b/projects/bleUart/mdk/output/app_gapc.o differ diff --git a/projects/bleUart/mdk/output/app_gapm.crf b/projects/bleUart/mdk/output/app_gapm.crf new file mode 100644 index 0000000..3efb699 Binary files /dev/null and b/projects/bleUart/mdk/output/app_gapm.crf differ diff --git a/projects/bleUart/mdk/output/app_gapm.d b/projects/bleUart/mdk/output/app_gapm.d new file mode 100644 index 0000000..6aeb333 --- /dev/null +++ b/projects/bleUart/mdk/output/app_gapm.d @@ -0,0 +1,29 @@ +.\output\app_gapm.o: ..\..\..\ble\app\app_gapm.c +.\output\app_gapm.o: ..\src\cfg.h +.\output\app_gapm.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h +.\output\app_gapm.o: ..\..\..\ble\api\bledef.h +.\output\app_gapm.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h +.\output\app_gapm.o: ..\..\..\ble\api\blelib.h +.\output\app_gapm.o: ..\..\..\ble\api\ke_api.h +.\output\app_gapm.o: ..\..\..\ble\api\task.h +.\output\app_gapm.o: ..\..\..\ble\api\list.h +.\output\app_gapm.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stddef.h +.\output\app_gapm.o: ..\..\..\ble\api\utils.h +.\output\app_gapm.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdlib.h +.\output\app_gapm.o: ..\..\..\ble\api\gapm_api.h +.\output\app_gapm.o: ..\..\..\ble\api\gapm.h +.\output\app_gapm.o: ..\..\..\ble\api\le_err.h +.\output\app_gapm.o: ..\..\..\ble\api\gap.h +.\output\app_gapm.o: ..\..\..\ble\api\gapc_api.h +.\output\app_gapm.o: ..\..\..\ble\api\gapc.h +.\output\app_gapm.o: ..\..\..\ble\api\gatt_api.h +.\output\app_gapm.o: ..\..\..\ble\api\gatt.h +.\output\app_gapm.o: ..\..\..\ble\api\att.h +.\output\app_gapm.o: ..\..\..\ble\prf\prf_api.h +.\output\app_gapm.o: ..\..\..\ble\prf\prf_diss.h +.\output\app_gapm.o: ..\..\..\ble\prf\prf_bass.h +.\output\app_gapm.o: ..\..\..\ble\prf\prf_hids.h +.\output\app_gapm.o: ..\..\..\ble\prf\prf_sess.h +.\output\app_gapm.o: ..\..\..\ble\app\app.h +.\output\app_gapm.o: ..\..\..\core\string.h +.\output\app_gapm.o: ..\..\..\ble\app\app_actv.h diff --git a/projects/bleUart/mdk/output/app_gapm.o b/projects/bleUart/mdk/output/app_gapm.o new file mode 100644 index 0000000..b778c39 Binary files /dev/null and b/projects/bleUart/mdk/output/app_gapm.o differ diff --git a/projects/bleUart/mdk/output/app_gatt.crf b/projects/bleUart/mdk/output/app_gatt.crf new file mode 100644 index 0000000..bc19e90 Binary files /dev/null and b/projects/bleUart/mdk/output/app_gatt.crf differ diff --git a/projects/bleUart/mdk/output/app_gatt.d b/projects/bleUart/mdk/output/app_gatt.d new file mode 100644 index 0000000..b523ced --- /dev/null +++ b/projects/bleUart/mdk/output/app_gatt.d @@ -0,0 +1,2 @@ +.\output\app_gatt.o: ..\..\..\ble\app\app_gatt.c +.\output\app_gatt.o: ..\src\cfg.h diff --git a/projects/bleUart/mdk/output/app_gatt.o b/projects/bleUart/mdk/output/app_gatt.o new file mode 100644 index 0000000..b8e2f2d Binary files /dev/null and b/projects/bleUart/mdk/output/app_gatt.o differ diff --git a/projects/bleUart/mdk/output/app_msg.crf b/projects/bleUart/mdk/output/app_msg.crf new file mode 100644 index 0000000..727eab7 Binary files /dev/null and b/projects/bleUart/mdk/output/app_msg.crf differ diff --git a/projects/bleUart/mdk/output/app_msg.d b/projects/bleUart/mdk/output/app_msg.d new file mode 100644 index 0000000..09a24cd --- /dev/null +++ b/projects/bleUart/mdk/output/app_msg.d @@ -0,0 +1,52 @@ +.\output\app_msg.o: ..\..\..\ble\app\app_msg.c +.\output\app_msg.o: ..\src\cfg.h +.\output\app_msg.o: ..\..\..\ble\app\app.h +.\output\app_msg.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h +.\output\app_msg.o: ..\..\..\core\string.h +.\output\app_msg.o: ..\..\..\ble\api\blelib.h +.\output\app_msg.o: ..\..\..\ble\api\ke_api.h +.\output\app_msg.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h +.\output\app_msg.o: ..\..\..\ble\api\task.h +.\output\app_msg.o: ..\..\..\ble\api\list.h +.\output\app_msg.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stddef.h +.\output\app_msg.o: ..\..\..\ble\api\utils.h +.\output\app_msg.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdlib.h +.\output\app_msg.o: ..\..\..\ble\app\app_actv.h +.\output\app_msg.o: ..\..\..\ble\api\gapm.h +.\output\app_msg.o: ..\..\..\ble\api\le_err.h +.\output\app_msg.o: ..\..\..\ble\api\gap.h +.\output\app_msg.o: ..\..\..\ble\api\gapc.h +.\output\app_msg.o: ..\..\..\drivers\api\drvs.h +.\output\app_msg.o: ..\..\..\core\b6x.h +.\output\app_msg.o: ..\..\..\core\core_cm0plus.h +.\output\app_msg.o: ..\..\..\core\core_cmInstr.h +.\output\app_msg.o: ..\..\..\core\core_cmFunc.h +.\output\app_msg.o: ..\..\..\core\rom.h +.\output\app_msg.o: ..\..\..\drivers\api\core.h +.\output\app_msg.o: ..\..\..\drivers\api\dma.h +.\output\app_msg.o: ..\..\..\core\reg\reg_dmachcfg.h +.\output\app_msg.o: ..\..\..\core\reg\reg_base.h +.\output\app_msg.o: ..\..\..\drivers\api\exti.h +.\output\app_msg.o: ..\..\..\core\reg\reg_exti.h +.\output\app_msg.o: ..\..\..\drivers\api\fshc.h +.\output\app_msg.o: ..\..\..\drivers\api\flash.h +.\output\app_msg.o: ..\..\..\drivers\api\gpio.h +.\output\app_msg.o: ..\..\..\drivers\api\iopad.h +.\output\app_msg.o: ..\..\..\core\reg\reg_csc.h +.\output\app_msg.o: ..\..\..\core\reg\reg_gpio.h +.\output\app_msg.o: ..\..\..\drivers\api\i2c.h +.\output\app_msg.o: ..\..\..\core\reg\reg_i2c.h +.\output\app_msg.o: ..\..\..\drivers\api\iwdt.h +.\output\app_msg.o: ..\..\..\drivers\api\pwm.h +.\output\app_msg.o: ..\..\..\drivers\api\rcc.h +.\output\app_msg.o: ..\..\..\core\reg\reg_rcc.h +.\output\app_msg.o: ..\..\..\drivers\api\rtc.h +.\output\app_msg.o: ..\..\..\core\reg\reg_apbmisc.h +.\output\app_msg.o: ..\..\..\drivers\api\rco.h +.\output\app_msg.o: ..\..\..\drivers\api\sadc.h +.\output\app_msg.o: ..\..\..\drivers\api\spi.h +.\output\app_msg.o: ..\..\..\drivers\api\timer.h +.\output\app_msg.o: ..\..\..\core\reg\reg_timer.h +.\output\app_msg.o: ..\..\..\drivers\api\trim.h +.\output\app_msg.o: ..\..\..\drivers\api\uart.h +.\output\app_msg.o: ..\..\..\core\reg\reg_uart.h diff --git a/projects/bleUart/mdk/output/app_msg.o b/projects/bleUart/mdk/output/app_msg.o new file mode 100644 index 0000000..cb48033 Binary files /dev/null and b/projects/bleUart/mdk/output/app_msg.o differ diff --git a/projects/bleUart/mdk/output/bleUart.axf b/projects/bleUart/mdk/output/bleUart.axf new file mode 100644 index 0000000..f8bc3ca Binary files /dev/null and b/projects/bleUart/mdk/output/bleUart.axf differ diff --git a/projects/bleUart/mdk/output/bleUart.bin b/projects/bleUart/mdk/output/bleUart.bin new file mode 100644 index 0000000..33f01e5 Binary files /dev/null and b/projects/bleUart/mdk/output/bleUart.bin differ diff --git a/projects/bleUart/mdk/output/bleUart.build_log.htm b/projects/bleUart/mdk/output/bleUart.build_log.htm new file mode 100644 index 0000000..ed9e38b --- /dev/null +++ b/projects/bleUart/mdk/output/bleUart.build_log.htm @@ -0,0 +1,45 @@ + + +
+

Vision Build Log

+

Tool Versions:

+IDE-Version: Vision V5.15 +Copyright (C) 2015 ARM Ltd and ARM Germany GmbH. All rights reserved. +License Information: 1 Administrator, 1, LIC=9N0X7-E849S-C02N2-9LSNA-DAAN9-S9DGQ + +Tool Versions: +Toolchain: MDK-ARM Professional Version: 5.15.0 +Toolchain Path: C:\Keil_v5\ARM\ARMCC\Bin +C Compiler: Armcc.exe V5.05 update 2 (build 169) +Assembler: Armasm.exe V5.05 update 2 (build 169) +Linker/Locator: ArmLink.exe V5.05 update 2 (build 169) +Library Manager: ArmAr.exe V5.05 update 2 (build 169) +Hex Converter: FromElf.exe V5.05 update 2 (build 169) +CPU DLL: SARMCM3.DLL V5.15.0 +Dialog DLL: DARMCM1.DLL V1.12.0.0 +Target DLL: Segger\JL2CM3.dll V2.99.15.0 +Dialog DLL: TARMCM1.DLL V1.9.0.0 + +

Project:

+C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\projects\bleUart\mdk\bleUart.uvprojx +Project File Date: 03/29/2024 + +

Output:

+*** Using Compiler 'V5.05 update 2 (build 169)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin' +Build target 'bleUart' +compiling main.c... +compiling proc.c... +compiling uart1Rb.c... +linking... +Program Size: Code=71700 RO-data=956 RW-data=4 ZI-data=18240 +FromELF: creating hex file... +After Build - User command #1: fromelf.exe --bin -o "C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\projects\bleUart\mdk\output\bleUart.bin" "C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\projects\bleUart\mdk\output\bleUart.axf" +".\output\bleUart.axf" - 0 Error(s), 0 Warning(s). + +

Collection of Component include folders:

+ C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\projects\bleUart\mdk\RTE + +

Collection of Component Files used:

+
+ + diff --git a/projects/bleUart/mdk/output/bleUart.hex b/projects/bleUart/mdk/output/bleUart.hex new file mode 100644 index 0000000..2f550b4 --- /dev/null +++ b/projects/bleUart/mdk/output/bleUart.hex @@ -0,0 +1,4546 @@ +:020000041800E2 +:1040000000800020AD400018D3400018D5400018B3 +:1040100000000000000000000000000000000000A0 +:10402000000000000000000000000000D740001861 +:104030000000000000000000D9400018DB4000181C +:10404000DD400018DD400018694B0118DD40001804 +:10405000DD400018DD400018DD400018DD4000188C +:10406000DD400018DD400018DD400018DD4000187C +:1040700015170118DD400018DD400018DD4000185C +:10408000DD400018DD400018DD400018DD4000185C +:10409000DD400018DD400018034885460DF006FBA2 +:1040A00000480047B52C01180080002000200C4972 +:1040B00008600C480C49086001200C4908600C4855 +:1040C0000C4988470C480D4908600D4988470D4840 +:1040D0000047FEE7FEE7FEE7FEE7FEE7FEE700003B +:1040E0002C100040254000180C0000190000001999 +:1040F000004000181D280118944801005410034086 +:10410000F92E011899400018FEB531210902002549 +:1041100040182C46884F01900EF032FE401C0007DC +:10412000000E0090864E854830600198F061C821ED +:104130000098B847304641698907FCD54169890430 +:104140008E0E03210903C16164210098B847641CE5 +:104150007519E4B2042CDFD3A808FEBDF8B5784C7D +:104160007848A06025210120FFF7CEFF06460421F4 +:104170000320FFF7C9FF074608210720FFF7C4FF08 +:10418000850135430C210B20FFF7BEFF86013E431E +:104190000F210E20FFF7B8FF07036B482F43A060E5 +:1041A00013211220FFF7B0FF050335431721162016 +:1041B000FFF7AAFF86043E431B211A20FFF7A4FF46 +:1041C00087042F431F211E20FFF79EFF050635435E +:1041D00023212220FFF798FF060627213E430846A9 +:1041E000FFF792FF81010143256126636163574810 +:1041F000574A866011434560C160F8BDF8B5504824 +:104200004030C1694906CA0E0E2A00D114224C4D15 +:10421000E96989040C0F4D49082CC96803D10B0BBF +:104220001B0700D10F2401239B075F6A9E143743AD +:104230005F625F6AB7435F62464B2B62464B6B62BD +:10424000464BAB63464BC360464B0361464B4361F1 +:10425000464B8361464B92001A43C2611122D20140 +:104260000262444A42620722120482621722D20288 +:104270000263414E354A0B0CB34209D11368C36047 +:1042800050682861906828630805000D686303E0A2 +:1042900000F028F8FFF762FFA002E8613748686283 +:1042A00037482860F8BD0007000F254A8102D16118 +:1042B00026490F231B03CA6800039A430243CA60BE +:1042C0007047224948601E49086170471F4988604D +:1042D0001B490863704700051C49000D8860184998 +:1042E00048637047F8B50EF04BFD401C0007050E03 +:1042F000134C24484034E0602148114E3838306077 +:104300002148F061616B8805FCD50B4F642128467C +:10431000B847606BFC2108401A49703140180B49BE +:104320000860E0600020F06114212846B847144876 +:1043300008303060F8BD0000490700005A803200A4 +:1043400000C002400026730000266E00D88F0020B7 +:104350000000A55A11E34500280612038B23000034 +:10436000907D430072D50B05B26609001A33E00058 +:1043700001FFDA07087FFF07A55A00002806120789 +:1043800052922200907C430011020000174A41081B +:104390001140401A1649024680080A400840101889 +:1043A000010908181349084013494843000E704793 +:1043B0000CB5002807D011A106C968442038019225 +:1043C0000091C07F0CBDFF20F5300CBD0CB501463F +:1043D0000AA005C80192009000206A46135C8B4237 +:1043E00003D3401CC0B20728F8D30CBD5555555512 +:1043F000333333330F0F0F0F01010101FA96644B72 +:10440000321E1400F8B50746000214460E46002579 +:10441000C01D0FF0D8F9217843233F2818D01F285A +:1044200016D0FA49BA008A58B300D158A1420DD02B +:104430000121B140014201D002250EE00125D450F6 +:10444000C9B22A46384602F0DBFB06E0012504E04B +:104450000C3C2289384602F0EBFB2846F8BD70B5CB +:104460000D46044602F0E8FCC0B2294606F03AF9CF +:1044700000281AD0112809D004DC012806D00C2805 +:1044800014D103E0192801D01A280FD1DF4BA20064 +:10449000995840318D79AD0608D5487DFD242040DE +:1044A0004875985880680FF040F970BD9030C2B2DE +:1044B0000221204602F0CDFB70BDF7B5040205468F +:1044C000E61D30460FF07FF93F2822D01F2820D06C +:1044D0001F2130460FF04CF9CC4FAE00B95902986D +:1044E0008881284602F0A8FCC0B2019904F07DFB47 +:1044F00000280DD09030C3B201212846029A02F064 +:1045000097FBB859002803D1E01D00210FF030F9C6 +:10451000FEBD432301212846029A02F089FBFEBD1D +:10452000F8B50502ED1D0C4628460FF04CF93F2862 +:1045300031D020462030017A2E0ACA0719D0827A5B +:10454000304602F0EFFCB14FB5007959206948635D +:104550007959606A886378591022AD4B214614302E +:1045600098477859214610221431A94B2430984796 +:1045700004E000221146304602F0D4FC3502082443 +:10458000681D0FF020F9A0430146681D0FF0F0F8F8 +:10459000304604F004F9F8BDFFB5150A16460F467B +:1045A0000A4681B000212846FFF72CFF0446012867 +:1045B00022D13978072922D004DC032907D0042925 +:1045C0001AD10BE0182928D0192915D142E0284624 +:1045D00002F032FCC0B204F0CCFB05E0284602F049 +:1045E0002BFCC0B205F0AEF9002805D09030C2B265 +:1045F0000021284602F02DFB204605B0F0BD012326 +:104600003246844804990FF077F80646284602F0AF +:1046100013FCC0B207F064FD27E0284602F00CFC52 +:10462000C0B2694606F074FC07000ED17320022365 +:104630003246000104990FF05FF8694649784170ED +:104640006946097801700FF070F8002F00D090379C +:10465000FAB2CDE76F4801233246283004990FF0B3 +:104660004BF80646284602F01FFC307030460FF02B +:104670005CF80022BCE770B515460C4610460FF0FA +:10468000A2F82B0A00253F280BD0E188062908D183 +:10469000000701D5022504E02278211D184601F00B +:1046A000C7F9284670BD70B5154610460FF08BF857 +:1046B0002C0A3F2812D05548A10040588068002895 +:1046C0000CD00078092809D145220221204602F0A9 +:1046D000C0FA2A463B212046FFF7EFFE002070BDBE +:1046E000FFB50546000281B0C01D0FF06CF83F28F1 +:1046F00083D0464FAE00B8598468002C15D020787E +:10470000092812D1284602F097FBB959029A403184 +:10471000497DC0B2C9438907C917491C002A0FD077 +:10472000002903D0A11C06F045F866E76178002255 +:10473000284602F0C1FEA11C2846FFF790FE5CE768 +:10474000002903D0002106F035F804E06178012249 +:10475000284602F0B1FE48220221284602F079FAEA +:104760004BE7FFB5160A17460C460A4681B00221F0 +:104770003046FFF747FE054601285ED1207809281C +:1047800002D0172859D149E02389E2886188A0889E +:1047900002F0F4FB002813D01C48B1004158084631 +:1047A0004030427D920702D4807980061CD4049860 +:1047B000C0B2072806D0A11C3046FFF750FE3CE0EF +:1047C000402236E01348C98908233A46801D0EF07E +:1047D00093FF61880180A1884180E18881802189DF +:1047E000C1800EF0A2FF28E00EF0B4FE0106090E13 +:1047F00000D101216170A21C304602F074FE054810 +:10480000054A3946E9300EF0F7FF16E08C9000209B +:10481000190F00000907000030750000304602F053 +:104820000BFBC0B2611C06F086FB002805D090305F +:10483000C2B20221304602F00CFA2846DDE6000042 +:10484000F8B51E460546F84B174680001858002458 +:10485000069A012903D11A21403014460170012221 +:104860000821284602F0CCF9284602F0E5FAC0B249 +:1048700023463246394604F0CAFE002805D090305F +:10488000C2B20121284602F0E4F9F8BD70B516461F +:104890000C46054602F0D0FAC0B2002C08D03146D2 +:1048A00004F00AFF01220821284602F0A9F970BD90 +:1048B000002104F001FF96220121284602F0C9F9E7 +:1048C000D94AA800105800214030017070BDF3B5DE +:1048D00081B001980F468100D348212346580198A2 +:1048E000F18902023569D148D21D0EF005FF044658 +:1048F000077002213B000CF057FF080537373714CB +:1049000037100C37A87CC006C00E6070403631707E +:104910002AE0019802F0FAFA16E0132040363070CF +:1049200022E0687C012802D1287E01280BD0403685 +:10493000B079012280060028E87D0BDB022805D033 +:10494000042803D00FE0002060700DE0287C0228CE +:104950000ED108E000280BD0012809D0042802D18C +:10496000287C022804D0617020460EF0DEFEFEBDD9 +:104970006270F9E7F7B50F4606468100AA48320291 +:104980004558AA48E9891E23801CD21D0EF0B4FEAA +:1049900004460770B81EA64F03000CF005FF06087A +:1049A000042E1E231C2E02980078A0700DE02869AA +:1049B0004030C17BA170427CD207D20FE270407CB4 +:1049C000C207D20F304602F0ADFA4035A879BF21B8 +:1049D0000840A87111E01C2200E01722A01C0299D7 +:1049E000B8470AE01022A01C0299B84710222846B6 +:1049F00024300299B8470020A86320460EF095FEA7 +:104A0000FEBDF8B5884A81005558884F2E4620369D +:104A1000F17F04028907E137002903DAE11D3846F6 +:104A20000EF03DFFAA8F0A204243E11D38460EF0EA +:104A3000E3FEF07F02210843F077F8BD70B505462C +:104A4000794B800019583F22525C002492071CD5F4 +:104A50008A8F784CA24214D05204120C8A87A24248 +:104A60000DD38C8718582A02C18970481E23801CD8 +:104A7000D21D0EF041FE082101700EF056FE0324F7 +:104A800000E001242846FFF7BCFF204670BDF0B5CA +:104A90000446654BA2009A5801201269137DD57E09 +:104AA0002B409E46537D157F2B409C46937CA50052 +:104AB000DE075D4B5B591B69DF7E1D7D3D401F7F1F +:104AC0005B7D3B401D43002E05D0537EDB0702D0AB +:104AD000002D00D10020544BA4001B59ED071B6989 +:104AE00040335C7C002D07D001252C435C740129E8 +:104AF00005D0022903D007E064086400F6E74032DD +:104B0000527CD20700D10020032901D0042906D10C +:104B10007146490703D46146490700D40020F0BD1F +:104B20007FB50646404980000C586846007A1D460D +:104B300000281BD002AA03213046FFF71BFF002DDF +:104B400002D03046FFF75DFF00220121304602F01F +:104B500080F820690025002802D00EF067FD25614D +:104B6000304601F015F9403425707FBD0022022146 +:104B70003046FFF7FFFEE7E770B52B4B82009A58EF +:104B80001469403215782E46143E33000CF00CFEAA +:104B9000060C04090609090C162000E01820107004 +:104BA00070BD1423137001E0142DF9D14034237C1F +:104BB000DD0705D015201070207C4008400006E07D +:104BC0009D0706D517201070207CFD2107E020747A +:104BD00070BD5B0705D519201070207CFB210840B3 +:104BE000F5E7002904D000231A46FFF799FF70BDAE +:104BF000002100F0B7F870BD30B40B4B82009C5818 +:104C000085005B5922691B694033002908D0157D56 +:104C1000D27E154014221D744034227030BCABE7A4 +:104C2000557D127FF5E700008C90002013070000EF +:104C3000190F0000B80B0000F8B50E46FE4A8100BF +:104C4000545805022034E17FFC4FC907002907D0E2 +:104C5000E91D38460EF023FEE07F40084000E07773 +:104C6000304608380EF061FD30780B280AD0052850 +:104C700008D0E91DF24A38460EF0BEFDE07F012162 +:104C80000843E077F8BDF3B50646EB4980000D58C0 +:104C900081B02C6940352878102807D0112803D01E +:104CA000122801D013280FD1102028704034207C06 +:104CB000C1070AD0C0B24008400020740721304626 +:104CC000FFF705FE11202870FEBD81072CD5FD21C0 +:104CD00008402074DB48112287690821304602F021 +:104CE00080FB0090002F04D01022D74B3946401C87 +:104CF000984730460099FFF79FFF08220921304668 +:104D000002F06FFB0746CF48CE49203000791E31B4 +:104D1000C007C00F78700622CB4BB81C98473946A5 +:104D20003046FFF789FF0AE041070CD5FB21084018 +:104D300020741320287006213046FFF7C8FD28781C +:104D40001028B4D0FEBD0298002804D00146304699 +:104D5000FFF752FFFEBD002301461A463046FFF71B +:104D6000DFFEFEBD30B4B44B82009C5885005B5919 +:104D700022691B694033002908D0557D127F1540F8 +:104D800010221D744034227030BC7CE7157DD27E29 +:104D9000F5E710B58100A84AA74B51588000185874 +:104DA000096900694A7C00244030012A02D10A7E48 +:104DB000012A07D08A7C520706D44A7E520703D4C0 +:104DC00084730FE002220CE0CB7D0A7C032B05D01C +:104DD000032A03D0012B03D8012A01D8002200E0C6 +:104DE0000122827308464030827B002A06D0012AC5 +:104DF00001D0022A03D10422C27300E0C4738A7C6A +:104E0000D20706D0497EC90703D0C17B01221143D6 +:104E1000C17310BD00B5884A800010580029006990 +:104E200007D0417F0B000CF0BFFC06060608060801 +:104E30000C11817DF6E7012000BD4030C07B4007AA +:104E400002E04030C07B0007C00F00BD002000BD65 +:104E5000F7B5009816468500774800244759224642 +:104E60000821009801F0CCFE062E0AD0112E0AD09F +:104E7000222E0AD0002E0AD090363406240E06D0F8 +:104E80000BE0222409E0232407E0242405E038462F +:104E9000403081790822114381713E4640360099A5 +:104EA00030780A020E2830D00F282ED01A282BD1A5 +:104EB000002C22D1604F01237859D21DC1895F484F +:104EC000DA380EF019FC009A0021032A12D27A591E +:104ED000002A0FD040329279530700D50121920762 +:104EE000920F022A02D0032A04D101E0042200E03A +:104EF0000C22114301700EF018FC00203070224685 +:104F00000121009801F0A5FEFEBD002C06D0002373 +:104F1000224601990098FFF703FEFEBD0F2823D11A +:104F20003869817CC9071FD0407EC0071CD0424829 +:104F30001E234059D21DC1894048DE380EF0DCFBEB +:104F40000446072020701C223F4BA01C396998475B +:104F500020463D4B0822002114305C339847002046 +:104F6000608220460EF0E1FB0198002804D0012168 +:104F70000098FFF7F7FEFEBD00210098FFF73CFE0A +:104F8000FEBDF0B505462C4A8000105885B02E4F66 +:104F9000046903AE002918D00822214601A82E3149 +:104FA000B847082221461E313046B847FF2000028C +:104FB00085430320000228180090244B012201A9F8 +:104FC000204601F065FC05B0F0BD0822214601A88D +:104FD0001E31B847082221462E31E5E7F7B50546D0 +:104FE0008100154816464058174F8AB010220021FC +:104FF000046902A85C37B8471022002106A8B84708 +:105000000B98114F002844D00121284601F03CFFA5 +:105010008079694608720021284601F035FF8079C1 +:10502000694648720021284601F02EFF01460622FB +:1050300006A8B84701210BE08C900020F307000080 +:105040003075000064900020190F0000EB5000182C +:10505000284601F019FF0146062207A80230B8478A +:10506000012269468A7202A80330062221461031C5 +:10507000B84702206946487404A802300622214637 +:105080001731B847FF2000028543002E19D00120B8 +:1050900018E00021284601F0F7FE80796946087281 +:1050A0000121284601F0F0FE80796946487201210D +:1050B000284601F0E9FE0146062206A8B84700216D +:1050C000B9E7022000020543FE4801950090002E3A +:1050D00002D021461E3101E021462E3106AB02AA44 +:1050E000204601F086FC0DB0F0BDF7B50346D7B2FF +:1050F000F548B900405886B0002833D041680029EF +:1051000030D009780A292DD104464034A1798D0682 +:10511000ED0F002B03D09033DAB200235CE0066978 +:10512000100A0006000E1FD001282CD0022844D0FF +:10513000032817D1384601F0E9FE04460246E34B46 +:1051400001A8079998471020021B01A8DF4B0019FE +:1051500000215C339847002D55D001AA0121384623 +:10516000FFF794FB09B0F0BD10223046D74B1E303C +:1051700007999847A0794006F4D401222946384679 +:10518000FFF72CFFEEE74806ECD4079800901122B9 +:105190000321384602F025F906461022CB4B401C6D +:1051A0000099984731463846FFF746FD002D02D05A +:1051B00008202070D6E70720FBE73046C34B1022BB +:1051C0003E308A330799984700280AD00421384690 +:1051D00000F0F1FD0123642229463846FFF7A0FCC8 +:1051E000C0E7A0794006BDD40E202070002D05D068 +:1051F00031461E31384600F0EBFDB3E7002138465A +:10520000FFF7BFFEAEE7002003460146009001AA6B +:105210003846FFF715FBA5E7F8B50D460746AA493E +:1052200080000E584620805D002480064FD56878A7 +:1052300004280FD8E878410707D04007400F01281D +:1052400003D0042801D0052804D1A878002803D071 +:10525000012801D00A243AE02879C01F0A2801D386 +:10526000062434E03846FFF7E9FB002802D0032883 +:105270002DD12BE03069002829D19548007901070C +:10528000890F0ED0E97809070DD440070BD46320AD +:105290006946087003246A4621463846FFF76AFBD0 +:1052A00015E0052413E03902CA1D08238948C91DE9 +:1052B0000EF022FA06460A2030700622691C834B43 +:1052C000701C984730460EF030FA00E00924204662 +:1052D000F8BDF3B581B00F4601987B4980000E58A8 +:1052E00078780024042859D8F878410707D0400777 +:1052F000400F012803D0042801D005284ED1B878EA +:10530000002801D0012849D13879C01F0A2847D286 +:1053100035464035A879800650D4287801284DD1EB +:10532000781C00F011FD002838D030690622791C65 +:10533000664B173098473069417E090706D5807C57 +:10534000000703D5A87940210843A871A879400631 +:1053500003D45F480079400726D5019800F007FD87 +:1053600000281DD03069817D0198FFF790FB00284F +:1053700018D00198FFF70DFD00210198FFF74AFDB5 +:10538000002811D00520287030694030817B002929 +:105390000CD004210198FFF79AFA0FE00A240DE0DF +:1053A00006240BE0082409E0032407E0417C0422E2 +:1053B000114341740021019800F02AFD2046FEBDF2 +:1053C000F8B50746404A800014582069002819D0D3 +:1053D00025464035AA793D4B9206D60F10223E3025 +:1053E000491C9847287807280CD1002E0CD005209E +:1053F000287020694030407C400703D500213846A2 +:1054000000F006FD0020F8BD216938461E3100F08D +:10541000DFFC08202870F5E770B506462A4A8000B0 +:1054200014582069002815D04034A279274B9206E1 +:10543000D50F10222E30491C98472078082809D112 +:1054400006202070A079400604D400222946304668 +:10545000FFF7C4FD002070BD08B54A78511E0E2923 +:1054600000D3082270210A4369460A701649830056 +:10547000C9580B69002B07D0403189790023890670 +:10548000C90FFFF74DFB03E06A460321FFF772FAED +:10549000002008BD70B504460B4A80001258134620 +:1054A000403318781D4615280AD110691022074B81 +:1054B000491C9847A8798006C10F2046FFF75CFB7E +:1054C000002070BDEB5000188C900020190F0000D8 +:1054D0008490002012070000F0B50546FF4A8000C6 +:1054E000145887B026464036307816281ED1887862 +:1054F0004A78000210436A46108204A80822F84F36 +:105500000230C91CB847102268462169B8472846AE +:1055100001F0FCFC6A46907607212846FFF72AFA3C +:10552000B0798006C10F2846FFF726FB002007B0A0 +:10553000F0BD70B50446E94A800012581346403366 +:1055400018781D4617280AD110691022E44B491C0F +:105550009847A8798006C10F2046FFF70DFB002071 +:10556000AFE7F0B50D460646DC4980000C5887B021 +:10557000274640373878182817D10622D84BA91C5F +:1055800004A89847687869468875D54B1022684604 +:10559000216998476A4605213046FFF7EBF9B8794B +:1055A0008006C10F3046FFF7E7FA0020BFE770B56D +:1055B0000546CA4A800014584034207819280AD178 +:1055C0004A1C06212846FFF7D5F9A0798006C10FAD +:1055D0002846FFF7D1FA002073E7F8B506468700A2 +:1055E000BE480D46C059009048780024410709D0B4 +:1055F0004007400F012805D0042803D0052801D01A +:105600000A242DE0304601F023FC002828D1304642 +:10561000FFF714FA002823D1687800070DD4B148A9 +:105620000079400709D463206946087003246A465C +:1056300021463046FFF79EF912E0009800690028E5 +:105640000ED1A6483202C0590123C189A648D21DF5 +:105650000EF052F86978C906C90E01700EF065F8AF +:105660002046F8BDF3B581B00F4601989B498000F4 +:105670000E583F20805D0025410701D5452549E0B2 +:10568000800701D5692545E0384600F05DFB00281C +:1056900003D0F878C01F0A2801D36A253AE0B87809 +:1056A000010790480029007901DA000700E040076F +:1056B000002801DB63252DE0012152200DF05CFF65 +:1056C000874B5222002104465C3330619847072201 +:1056D0002046834B394610309847A07CC00701D143 +:1056E0002075607507220121019801F07AFE0146BC +:1056F000207C4870607C8870A07CC870E07C087159 +:10570000207D4871607D88710198FFF795FA01202E +:10571000403630702846FEBDF7B594460A460098DC +:105720006E4980000C580025002C35D026464036A6 +:10573000B0798006C70F206900281DD04030417C19 +:105740004B0729D40423194341742069002A0DD042 +:10575000634B102261469847002F02D0307805280D +:105760001AD10021009800F053FB15E04030807BF7 +:10577000012811D1012500E00825307800280BD040 +:105780002946009800F017FB2A46602002430123B7 +:1057900039460098FFF7C4F92846FEBDF3B581B03D +:1057A0000C4601984D49800008580026002838D042 +:1057B00040300178112934D180798006C00F0090E3 +:1057C000019801F0A3FB002102E02154401CC0B26B +:1057D0001028FAD311220621019801F002FE054695 +:1057E00010223F4F2146401CB84729460198FFF739 +:1057F00023FA0B220721019801F0F3FD0546401C16 +:10580000218A0170090A4170214608221231E81CE0 +:10581000B84729460198FFF70FFA00990198FFF75A +:1058200032FA3046FEBDF3B506462C4980000C58CE +:10583000002581B0002C22D0204640300178132969 +:105840001DD1807910228006C70F2046244B1430CA +:10585000029998470020606311220A21304601F026 +:10586000C0FD044610221E4B401C02999847214659 +:105870003046FFF7E1F939463046FFF704FA28468B +:10588000FEBDF3B583B00398144980000858002585 +:10589000009000286AD006464036B0798006C00FD6 +:1058A00001900098046901982746173410370028A2 +:1058B0005CD03078022859D10498002827D00146BE +:1058C000074B07222046984706480179090703D469 +:1058D000A178F7221140A170A17807E08C900020F8 +:1058E000190F0000849000201B070000090706D54F +:1058F000B978090703D5B17940221143B171B17963 +:105900004A0606D40079400703D403251FE0082582 +:1059100020E004984078002806D17878012803D147 +:10592000480601D4022512E0039800F020FA00286E +:1059300007D0049881790398FFF7A9F8002802D0CE +:1059400017E0062503E0B079400612D40825307828 +:1059500000280BD02946039800F02DFA2A46602033 +:105960000243012301990398FFF7DAF8284605B0AE +:10597000F0BD0398FFF70DFA01210398FFF74AFAEB +:105980000028C2D0A07841072DD04007400F04283E +:1059900029D02079397908402071607979790840D7 +:1059A000607107220221039801F01BFD0146207857 +:1059B000487060788870A078C870E07808712079A5 +:1059C0004871607988710398FFF736F907203070C5 +:1059D000009800694030817B002907D0042103989A +:1059E000FEF775FFC2E700202071D9E7417C042251 +:1059F00011434174BAE770B50E46FF4B81005C5805 +:105A00000025002C12D0214640318B799B060DD504 +:105A1000002A07D01A230B700121FEF737FF20342C +:105A2000A67703E000221146FEF730FF284648E53E +:105A300070B514000D4606460ED12A79291D07209F +:105A4000531E0A2B06D89000EC4A80188038C26F8B +:105A500030469047040013D02146304600F0ABF9A1 +:105A6000287901280CD00B280AD0304601F0F0F933 +:105A7000014660202246024301233046FFF750F8DA +:105A80001FE570B50646DC4980000C5800252069EA +:105A9000002802D00DF0CAFD2561304600F078F9EB +:105AA000403425700DE5FEB5140A16460D460A462B +:105AB0001F4601212046FEF7A5FC019001282AD1AE +:105AC000A000CD49029008584621095C2A78890631 +:105AD000C90F0A2A04D00B2A26D00C2A7CD150E008 +:105AE000002919D0BE421DD126460446012152206C +:105AF0006D1C0DF041FD5222C14B002120619847E1 +:105B0000BF4B206906225C3B294610309847002194 +:105B10003046FEF7DCFE5FE0691C2046FFF7A2FD81 +:105B2000024653E0422253E02A461435002918D099 +:105B3000BE42F7D12146941CC0890A0201460A23BD +:105B4000B048D21D0DF0D8FD0646208A3080AC4BFF +:105B50000822B01C29465C3B984730460DF0E5FD15 +:105B60003AE0518A961C009120462B46324601218C +:105B7000FEF766FEA0490298B27E08582030827770 +:105B80002AE00029CED020306E78C07F0025410762 +:105B900001D5452519E0800701D5692515E09A480A +:105BA00031070079002901DA000700E040070028EA +:105BB00001DB632509E002220B21204601F011FCE4 +:105BC000014646702046FFF737F82A46002A03D0E0 +:105BD0000121204601F03DF80198FEBD70B50D464B +:105BE0000646854980000C58002C1ED0042D1CD878 +:105BF00002220E21304601F0F4FB0146457030468A +:105C0000FFF71AF840342078401E19280DD27D4D38 +:105C10003402DC35E11D284600F0FBFD002804D0ED +:105C2000E11D7A4A28460DF0E7FD4AE470B50546C5 +:105C300016460C4608460DF0C6FD3F281DD0240A26 +:105C4000002E1AD06C48A10040584068002814D09B +:105C500000780A2811D12E2D10D008210D4620469B +:105C600000F0A9F8204601F0F3F860212A460A4323 +:105C7000014601232046FEF753FF22E40B21EDE706 +:105C800070B50546144610460DF09DFD3F281FD007 +:105C9000240A5949A00008585A49DC318D4210D1D4 +:105CA0004621095C2030C27F0423520852001A4367 +:105CB000C2778906C90F002345222046FEF730FF30 +:105CC00006E0C82181872030C17FFD221140C177C5 +:105CD000002045E470B516460D4601F09AF8FF28FD +:105CE0001ED04549820089584968002902D00978A8 +:105CF0000A2916D001024348CA1D1E23401FC91D90 +:105D00000DF0FAFC04460B20207020463C4B082284 +:105D10001430658231465C3B984720460DF005FD06 +:105D20001EE40121FFF72DF91AE470B50D4601F0CC +:105D300070F80446FF2806D001F08AF801462A468A +:105D40002046FFF785F80BE401460A780120042A73 +:105D500001D9002070474A78002A01D0012AF8D1E1 +:105D60000A79102AF5D849791029F2D870470146E6 +:105D7000214A8900525800201369D97C9B7E9942A0 +:105D800000D31946072902D30120203291777047AA +:105D900010B5194A810054582034E17FC90709D051 +:105DA00001021848C91DDC300DF079FDE07F400884 +:105DB0004000E07710BD70B50C4605460222052173 +:105DC00001F00FFB014644702846FEF735FF03E45F +:105DD00070B50E4605461122042101F002FB04466F +:105DE000074B1022401C31465C3B98472146284611 +:105DF000FEF722FF1BE600008C900020B859011826 +:105E0000750F000017070000849000203075000017 +:105E1000FF2212029043090210B50143014800F02D +:105E200068FD10BDEB50001870B50446F94A238890 +:105E300000201268002B0AD10CE054899C4205D343 +:105E400012895918914200D3012070BD1268002AAE +:105E5000F3D170BD012307E016895D18B54205D363 +:105E6000538912685B1C9BB2002AF5D1238070BD58 +:105E7000F8B50546CE88888868807004800F14467F +:105E8000022806D00F4601282AD00222022A29D051 +:105E90000EE00F68384601F0F7FB0246102807D0E5 +:105EA0000320400386430C37042AEFD1D002064377 +:105EB000A41AD94B394620469847601B2880F00B1E +:105EC00035D03005000D411D49084900641A208075 +:105ED00000206080601B310B09030843A88027E085 +:105EE0000422D3E77878397800020843CB49288028 +:105EF000884201D10020F1E7C849FF31884202D031 +:105F0000491C884203D1F004C00F801CE6E7C34956 +:105F1000491E884203D0292109028842CFD102209C +:105F2000A41F208060800021A180601BD6E7AE8086 +:105F30002046F8BDFFB583B00020009010200190EE +:105F4000907A15464006800F0F46029003D0022833 +:105F500009D001280CD00226022E02D03046103083 +:105F60000190002421E0286801F08EFB0646F3E74B +:105F70000426F1E7002F07D0601CC108795C4007B8 +:105F8000400FC140C8070ED06868E100401800F01B +:105F9000DBF9002838D00199081880B201900098E8 +:105FA000401CC0B20090641CE4B22889A042E1D831 +:105FB00000990398FFF738FF002826D100210198A7 +:105FC0000DF0DAFA044601986A89201801900298C7 +:105FD00002281CD02946069860600398008820811A +:105FE000009BC0186081A281022E1BD001988A4BB1 +:105FF000801B3246019098470198001B0838E081C9 +:106000000020064600902EE0402007B0F0BD296831 +:10601000102EE0D0602082430C31042EDBD12020F2 +:106020000243D8E74878097800020843E7E7002FE1 +:1060300007D0701CC108795C4007400FC140C807F9 +:106040000FD06868F10041180098062250430019EB +:106050001030019AFFF70CFF01900098401CC0B26D +:106060000090761CF6B22889B042E0D8694A002137 +:10607000106805E023890589AB4203D30146006817 +:106080000028F7D12060002901D00C6000E01460E6 +:10609000A089C00505D523460022069C0421104690 +:1060A000A0470020B1E770B506465A48046809E0E9 +:1060B000A089800505D50122656823460421304664 +:1060C000A8472468002CF3D170BDF8B507465148A5 +:1060D0000E02B61C046809E0A089400505D5656874 +:1060E0002346324604213846A8472468002CF3D1C1 +:1060F000F8BD70B5474E3468002C0ED0A08900055D +:1061000005D503220421656823460020A8472046C0 +:1061100025680DF08BFA2C00F0D100203060706003 +:1061200070BD30B53B4C024609CC083C002B13D067 +:106130001D89954210D85889904201D3184630BD28 +:10614000186809E0038993420AD84389934202D32D +:10615000037BDB0707D000680028F3D1002030BDA7 +:106160000029F5D1FAE7606030BD10B5294B1A68F7 +:1061700013E0548984420FD39089C407E40F8C4202 +:1061800003D040084000084390815868904201D1F4 +:1061900000205860002010BD1268002A02D0148927 +:1061A0008442E6D9012010BD30B583885C04A40F79 +:1061B0000BD104880525ED02651B032D03D9292584 +:1061C0002D02AC4201D1062030BDDC0B04D01B05F2 +:1061D0001B0D1818008801E01805000D824201D33C +:1061E000072030BD5118814201D90D2030BD00205B +:1061F00030BD10B50B46014600794006820FC888B5 +:106200000ED04118012A10D01846034B102298478F +:10621000102010BD98900020190F000003280000E6 +:106220001870000A58700220F3E7184601F045FA8A +:10623000EEE710B50B46014680884004820F0888BF +:1062400008D04118012A0AD01846624B10229847FC +:106250001020DEE71870000A58700220D9E71846AF +:1062600001F02BFAF4E7138983420BD1107B00066F +:1062700001D5594801E00520C0020870000A4870A5 +:1062800002207047C01A0623584380180A30D0E70E +:10629000F0B50E4600259C46144607462946FFF7F2 +:1062A00040FF01004DD00889B8423FD0381A06227D +:1062B000504340180A306246002A00D0106082889D +:1062C00053049B0F09D103880527FF02DF1B032F0F +:1062D0002CD929273F02BB4228D04088002C23D04C +:1062E0000346E340DB071ED0097BCB0601D508251A +:1062F0001AE08B0701D4D20400D50C250907890FB9 +:10630000092C09D00C2C0AD00D2C0AD00007800FC4 +:10631000814209D9084607E08007800FF8E70006A8 +:10632000F5E78006F3E7062530800BE0002C03D06C +:10633000092C04D0062505E001204002F4E70020E6 +:10634000F2E701252846F0BD70B505460188C088F2 +:1063500006244004800F1CD0012802D0022802D05D +:106360002CE0042009E0286801F08EF929684A7BB6 +:106370000B7B1102194302280BD0841DE888C10B46 +:1063800005D00005000D401D4008400004192046BE +:1063900070BD1148801C8142F9D0C01E81420DD0D1 +:1063A000401C81420AD00D48814202D0401C8142EB +:1063B00006D1A988052040028843E8D00024E6E7FA +:1063C0000548401C814203D0292000028142D5D1DA +:1063D0000C24DCE7190F000001280000022900004E +:1063E00048207047FFB581B0019816460402002589 +:1063F000E01D0DF0E8F93F282ED05F4AFF201188FC +:1064000000290AD0B14208D2701AC0B2062804D9B5 +:106410009178490601D4801CC0B2411ECA0F5118A0 +:10642000C9050F0E0299002918D001293BD0022975 +:1064300012D10027022802D0042850D08025E21D66 +:10644000611D06234D480DF057F94221017045703A +:10645000468087800DF069F905B0F0BD022814D0A0 +:106460000823621D0093114644489B1D0DF044F91A +:106470000446032F0BD0A31D3946009A01980CF057 +:10648000BBFAA080002807D007E02023E9E701201D +:10649000A0800020A07100E0802540202070657061 +:1064A00066802046D6E70498018812290BD008257B +:1064B000621D611D042331480DF01EF94121017058 +:1064C00045704680C6E7012F07D8428843683946A1 +:1064D0000198FFF785FF0546EAE78025E8E70227F0 +:1064E000ADE7F0B50C4685B01F210091610601D5DE +:1064F0007F210091210604D5FF22009981321143AA +:106500000091E10504D50322009952021143009144 +:10651000194D69466C802880194802900A208881AC +:106520000020C8810320C0028880164B01AA28469B +:10653000FFF700FD06001CD1A006134F400F0AD044 +:106540008000001F384382B228880F49001D80B2A6 +:106550000C3101F0E6F96007400F0AD08000001FFF +:10656000384382B228880849801C80B20C3101F07F +:10657000D8F9304670E70000E88F002011050000D0 +:10658000E4590118E563001800080000FFB581B068 +:106590000198164605020024681D0DF014F9102814 +:1065A00020D05B48019A00789200301AC7B2029955 +:1065B00058480092002917D0012931D0022911D161 +:1065C00000210091032F50D080246A1D691D0623ED +:1065D0000DF092F84221017044704680009981804C +:1065E0000DF0A3F805B0F0BD6A1D691D08230DF07C +:1065F00083F8032F07D000238024468083804470D3 +:1066000040210170ECE7444D009A0223AA58811DF5 +:10661000D28DD20700D002220A70120A4A70ECE72B +:10662000049A032F08D1516852880988022A03D19D +:1066300000290CD002290AD080246A1D691D042378 +:106640000DF05AF84121017044704680C8E7324A83 +:10665000009BD258D38D5B085B00022903D0002138 +:106660000B43D385E9E70121FAE702210091ACE76A +:1066700070B514460D46284A81005158C98DC90786 +:1066800015D00102491D51200C230A4600010DF0CE +:1066900033F814210170002141801D490988891CAB +:1066A00081800421C180058144810DF03EF870BDD8 +:1066B0001FB5FF21039116491A4B08801748019016 +:1066C00003206946088100204881154808806A46F1 +:1066D00003A90F48FFF72EFC04B010BDF8B5002445 +:1066E0000D4E04250827A300F1582046002909D0A3 +:1066F000CA8DAA43CA85F158BA43CA850A4A0121FC +:10670000FFF7B6FF641CE4B2032CECD3F8BD000025 +:10671000EC8F002011050000B4900020345A0118BD +:10672000011800008D650018FFFF000030B5D31C74 +:106730009C0883000A4D5118A40089085B19890040 +:10674000091B400040199C61018498694180996946 +:10675000044808809969002048609969886030BDC4 +:10676000F88F00205AA50000C088884201D101207E +:10677000704700207047082807D2EFF3108272B6E6 +:106780008000024B195082F3108870471C90002043 +:106790007FB505460E46EFF3108472B602A80DF0E1 +:1067A000E0F984F310880298039900900191281A67 +:1067B000000101210009C906884205D20098A842BB +:1067C00005D10198864202D8012004B070BD002096 +:1067D000FBE730B5C368826888680125141A240174 +:1067E000C9682409ED06AC4203D2904203D18B4222 +:1067F00001D8012030BD002030BD0A0C838889B249 +:10680000934204D1C088884201D101207047002002 +:106810007047094A126906E09388834202D1D388FF +:106820008B4203D01268002AF6D103E0002A01D07F +:106830000120704700207047F88F0020072803D2FE +:10684000024A800080184160704700003C900020A0 +:1068500070B50E461C46154601210CF08DFE4660B3 +:106860008560446170BD70B50C460646014615460C +:106870004F480CF05BFD4F4A3561F46013782046B9 +:106880002946002B03D1012313700DF014F970BDBC +:10689000F8B51C46069B002A0E46054622460DD03A +:1068A00000213820FFF7D4FF434F0446002D0CD0C1 +:1068B0001022204629461830B8470DE00021182044 +:1068C000FFF7C6FF3246294610E020463A4B102219 +:1068D000002118305C33984710222046283031467A +:1068E0000546B84721462A4618312046FFF7BBFF28 +:1068F000F8BDF0B589B00E460746002401AD0CF096 +:1069000029FEA100641CE4B26850082CF7D33B4672 +:10691000012205A901A80096FFF7BAFF09B0F0BD52 +:1069200070B505460E4622480CF01DFD0446204871 +:10693000002200681F4900280A7005D001220A7051 +:106940000169C0680DF0B7F8002C13D0002D07D1F5 +:106950006268002A04D0314620469047002809D0BA +:10696000A368002B03D03146284662699847204629 +:106970000CF05CFE70BD30B55B1E5BB2002B04DB1F +:10698000CC5CD55C6C40C454F6E730BD10B50F222A +:106990008418203C835CE47F5B00E40923438B5430 +:1069A000521E1206120EF3D100784000087010BD7E +:1069B0005C900020CF920020190F0000F8B5064629 +:1069C00004462036307E0025002802D001252846C6 +:1069D000F8BD204622461830102328320746FFF71C +:1069E000CAFF012030763A462046E168FFF73BFFB8 +:1069F000EDE7FFB581B016460F4605460E493C202F +:106A00000B9B0A9AFFF724FF0446324618301023E6 +:106A100039460646FFF7AFFF10222046074B2830C5 +:106A200004999847002138200155324629462046CE +:106A3000FFF719FF05B0F0BDBD690018190F000080 +:106A400070B505460C4606200CF0BDFE04280BD0A0 +:106A50000122AA40002C02D00243D1B201E09043AF +:106A6000014606200CF084FE70BD70B5564D0646FA +:106A700084002859002807D00C380168491C03D12C +:106A80000CF0D4FD0020285100213046FFF7D8FF3C +:106A900070BD70B5154604460622022310020CF0A4 +:106AA0002BFE047045700CF040FE70BD70B50646BC +:106AB0000D46002406200CF086FE042812D0424A1F +:106AC000B1005358AB420CD00123B340034201D074 +:106AD000022407E00124555021463046FFF7B0FF5D +:106AE00000E00124204670BD70B50A4605463649CF +:106AF0008000095800290BD008460C380389DCB205 +:106B0000062C05D0072C03D008781946FFF7C1FFE3 +:106B1000012D03D12C480421203041712846FFF774 +:106B2000A4FF70BDF8B5284B05461E330C46981CD3 +:106B300001792678C907C90F0322002E0BD180796D +:106B4000214A800080188068467C828A002E02D00C +:106B500003461633012100912946204600F0D5F85E +:106B60000446FF2807D000F037FB204600F045FA26 +:106B70002046FFF798FA2046F8BD70B51546044642 +:106B8000FF2811D000F089F80021204606F038FED9 +:106B90000021204600F077FB2046012100F098FA02 +:106BA00029462046FFF791FA70BD0020074A0146AA +:106BB0008B00D358002B01D0401CC0B2491CC9B275 +:106BC0000329F5D370470000649000208C900020CA +:106BD00070B50C460546012901D1FEF752FFF24E71 +:106BE000AD007059A4000059002808D00C38016885 +:106BF000491C01D10CF01AFD71590020085170BDDB +:106C000070B50502ED1D16460C4628460CF0DBFD5E +:106C10001F280CD028460CF0D6FD002E02D00146CD +:106C2000214301E0A043014628460CF0A1FD70BDC0 +:106C300070B5164602021C460D4607200223314657 +:106C40000002D21D0CF058FD057044700CF06DFD73 +:106C500070BD70B50D460646D349800008581346EE +:106C6000A9004258002A0CD010460C380489E0B222 +:106C7000052806D0062804D0117822463046FFF7B2 +:106C8000D7FF29463046FFF7A3FF0120A840C1B235 +:106C900000223046FFF7B4FF70BDF1B500988600C2 +:106CA000C148815900980502002920D0E81D0CF048 +:106CB0008AFD074600241F2F04D021460098FFF7C5 +:106CC00087FF0AE0B848A10080594058002804D046 +:106CD000462221460098FFF7BCFF641CE4B2032C57 +:106CE000E9D3B14CA0590CF0A1FC0020A051E81D43 +:106CF0003F210CF03DFDE91DAC480CF0D0FDAB4848 +:106D0000E91D801C0CF0CBFDF8BDFFB581B0054638 +:106D100000242002C01D0CF056FD3F2803D0641C47 +:106D2000E4B2032CF5D3032C71D0002158200CF0D1 +:106D300023FCA6009C4F58229D4BB8510021984738 +:106D4000B859C8218187B9590F20403148752002B0 +:106D500000900021C01D0CF00BFDB9590298403184 +:106D60008880B859E97B40308175B859DF214030BF +:106D700082790A402978002900D0012149010A437B +:106D800082718B4BB8590622A91C5C3B4E30984748 +:106D9000B859697840300175854BB85906225C3B7B +:106DA000473004999847B9590A9840314873B959FE +:106DB000FF208881B9590398C8810398062822D0FA +:106DC00001467A48009A1223F138D21D0CF094FC47 +:106DD0000646029830806878754BC007C00F707205 +:106DE00030460622A91C0A305C3B984728897080EF +:106DF0006889B080A889F080A87B307228783074C8 +:106E000030460CF092FC204605B0F0BDFFE7FF24B1 +:106E1000F9E70346644A002081005158002903D055 +:106E200040318988994203D0401CC0B20328F3D373 +:106E3000032800D1FF20704701465E48032906D28F +:106E40008A0059498958002901D040318888704703 +:106E500001460020FF2908D08A005349895800299B +:106E600003D0403188798006C00F704770B54E4D11 +:106E700084004F4B285906225C3B473098472859DD +:106E800001214030417370BD02460020FF2A0AD024 +:106E9000022908D29300444AD258002A03D0C800DD +:106EA000401A47301018704701468A003E490020BA +:106EB0008958002901D04031887D70470246002062 +:106EC0009200394B002909D001290CD0022904D1A4 +:106ED000985840308079C006C00F704798584030AD +:106EE00080794007F8E79858403080790007F3E749 +:106EF00001460020032908D28A002B49895800291D +:106F000003D0403188798007800F70470146002008 +:106F1000FF2906D08A0024498958002901D0203150 +:106F2000887F7047F0B5032827D21F4F8300FC5895 +:106F3000002C22D04034A579FB263540CE07760FB1 +:106F40003543A571FC58EF263540120115434034F6 +:106F50000020A5710A0701D5032008E04A0701D5E2 +:106F6000022004E0C90701D1290700D50120AA08A1 +:106F7000F9589200024340318A7146E710B519244E +:106F8000E401401EA0420AD2491EA14207D20A488B +:106F90000A3B834203D2FF20F430824201D9002011 +:106FA00010BD012010BD00008C900020F2070000F1 +:106FB000750F0000FFFF0000770C000070B5840023 +:106FC000814E0D46012909D13059816808300029C8 +:106FD00004D00CF0C8F90CF029FBF5E73059AD00EE +:106FE0004059002808D00C380168491C01D10CF028 +:106FF0001DFB31590020485170BD70B50446002179 +:1070000030200CF0B9FA3022704B05460021984729 +:107010001720A885A0006C4924020D50601D002196 +:107020000CF0A6FB0825601D0CF0CDFB01462943A2 +:10703000601D0CF09DFB70BDF8B51C46154607465B +:1070400000290BD1A08800F0A1FC060006D06570D5 +:10705000A288234603213846B047F8BD0A2D06D141 +:107060006088010403D500254004400C6080204660 +:107070000C3801893A02052004230002521D0CF04D +:107080003BFB457021780170618841800CF04DFB1D +:10709000F8BD70B50D4604464B4980000858A9005C +:1070A0004358002B03D029462046FFF7C5FF294649 +:1070B0002046FFF783FF0120A840C5B22402601DCF +:1070C0000CF081FBA8430146601D0CF051FB70BD24 +:1070D000F8B5064685003C480F464059002835D093 +:1070E0000024002F05D0462221463046FFF7D1FF6D +:1070F00003E021463046FFF761FF641CE4B2022C36 +:10710000EFD3304600F05CFD2F4F07E040880028A9 +:1071100001D00CF067F820460CF088FA7859016A23 +:107120002030002907D00CF01EF904460C300178FD +:107130000029F0D1EAE7304600F050FD304600F07B +:1071400077FC78590CF072FA00207851340215203F +:10715000611D80010CF0A3FB611D1D480CF09FFB1D +:10716000601D10210CF004FBF8BD17498000085881 +:10717000808D704770B5012217235202914200D3CF +:107180001146172900D219460F4D84002A590423AD +:1071900091851049020209590D48C9893F38521D8D +:1071A0000CF0AAFA2959898D0180295949680029CA +:1071B00002D00A78012A04D0002141800CF0B5FAEF +:1071C00070BD4988F9E70000B4900020750F0000F9 +:1071D000410500008C90002010B5044600020021FB +:1071E000001D0CF0C5FA002124200CF0C5F9002880 +:1071F00007D00021016041608160017301740421A6 +:107200004174984AA100505010BDF8B50646C8B266 +:10721000B4001746052814D0072811D108460CF0F1 +:10722000D2FA3F280CD0904800594068002807D077 +:1072300000780C2804D1002201213046FFF709FD17 +:10724000F8BD08460CF0BFFA1028F9D0874D285930 +:107250000068002807D00078122804D13A4600219F +:107260003046FFF716FF295900204968002900D051 +:1072700008780D2801D00E28E2D13A460121304687 +:10728000FFF707FFF8BDF3B507468600754881B0E4 +:107290008459002C27D0A068002801D00CF0C6F932 +:1072A0007349207B4A88101848800BE0A9887148F0 +:1072B000814204D1298946223846FFF7A6FF284695 +:1072C0000CF0B4F92068002807D020460CF04BF8E9 +:1072D000054602980028F2D1E8E7624CA0590CF06C +:1072E000A5F90020A05138023F21001D0CF040FA02 +:1072F000FEBDF3B585B005985A4980000E58002EA2 +:107300005FD03468002C04D00698002801D00120FA +:1073100000E00020039049E00020694688800127B2 +:107320000BF071FF05468088534943185149A088E6 +:107330004942C84225D121460C31081D0290E089FE +:10734000002800D000E0002701AA0097891C0298BD +:1073500006F06EFA0090002803D1029800880028F9 +:107360000FD12189009A0598FFF74FFF30460BF0A7 +:10737000FAFF20460CF05AF90020039000980028EC +:107380000DD16946898838030843E8800598FFF7DE +:1073900053FDC0B2294604F000FD002813D0A88890 +:1073A0000BF04BFF0698002802D003980028B3D1B9 +:1073B0003068002813D0002101204140059806F0D4 +:1073C0001FFA07B0F0BD2A494888401E4880307B2C +:1073D000401C30730698401EC0B20690E3E70121BE +:1073E000EAE770B50D46114608318BB2010214462A +:1073F000CA1D2048091D0CF07FF90621C180848038 +:107400000572083070BD70B50D46114609318BB25A +:10741000010214464A1D1748091D0CF06DF904219C +:10742000C18084800572083070BDF8B5069D1E4687 +:1074300014460F46042A11D0062C11D004212A46E6 +:107440000A32000293B2021D01430A48401C0CF0AC +:1074500053F90770C48085800672F8BD0521EEE7F8 +:107460000721ECE7C09000208C900020B490002011 +:107470008C9200200604000000800020F8B50F4622 +:10748000540021461E460E318BB2010215460A1DDC +:107490007A48091DA41C0CF02FF90521C180211D7B +:1074A000818001210172477244818581002D00D0C5 +:1074B000C6810CF03AF9F8BD70B50D4601021446CC +:1074C000CA1D0E236D48091D0CF016F90521C18057 +:1074D000062181801321017245720221418184813C +:1074E0000CF023F970BD70B50D4601021446CA1D9B +:1074F00014236248091D0CF0FFF80521C1800C21FE +:107500008180122101724572082141812188818187 +:107510006188C181A1880182E18841820CF005F96E +:1075200070BD10B50A790024012A0AD0122A0CD0A5 +:10753000132A0FD0002349791A46FFF79FFF2046F0 +:1075400010BD091D00F00AF802E0091D00F02BF83B +:107550000446F4E7091D00F062F8F9E770B58B887E +:1075600000244C220546002B04D0012B04D0022B12 +:1075700005D103E03C2202E0312200E03322404802 +:10758000AE00805900230068002800D00378092B42 +:1075900007D140784978814203D100212846FFF77E +:1075A00058FB204670BD70B50C4605460026FFF717 +:1075B0004FFC012825D063892289A188E088FFF744 +:1075C000DDFC002824D02902CA1D0E232D48C91D28 +:1075D0000CF092F80921017061784170A188418016 +:1075E000E18881802189C180618901810CF09DF849 +:1075F0002348A9004058FD224030417D114041758B +:107600000BE0002361781A462846FFF737FF04E0B5 +:10761000617801222846FFF74FFF304670BD70B5F4 +:107620000C4605460026FFF713FC002809D0144835 +:10763000A90040588268002A1ED01078092807D077 +:107640001AE0002361781A462846FFF717FF13E077 +:107650006078517888420FD1A088002801D0482254 +:1076600000E0002202212846FFF7F3FA054829022C +:10767000E430C91D0CF013F9304670BD060400005B +:107680008C9000200E0700003EB50546B8A107C942 +:107690006B4607C31024B94B0C226946284698470D +:1076A000002806D1A87B002802D1E87B002802D060 +:1076B000042420463EBD0224FBE7FEB50E460546E7 +:1076C000ABA207CA6B4607C3AC4C0C2269462846DE +:1076D0008A3CA0470422284631460C30A047FEBD14 +:1076E000F8B51E4615460C46B14202D10A46294657 +:1076F00012E00746102C03D1FFF7C6FF04460C37F3 +:10770000102E04D12846FFF7BFFF06460C35B442C1 +:1077100006D1224629463846984B9847002801D082 +:107720000020F8BD0120F8BD70B5154604461029AB +:1077300003D1FFF7A9FF01460C34022907D1607875 +:10774000217800020843A84201D1012070BD002029 +:1077500070BD10B5491EC9B2FEF766FB10BDF7B586 +:107760000E460025144629460098FEF7DAFC020072 +:1077700069D010890099824F884206D11046394657 +:1077800008302760FEF735FD55E0081A062148430A +:107790008018C1890A308C464904890F20D101889C +:1077A0000523DB02CB1A032B03D929231B029942A1 +:1077B00016D1744B994220D100995289491C8A42B2 +:1077C00019D327600289801D120A3A70226851700D +:1077D000090A91702168C91CFEF72BFDC01C2AE024 +:1077E0006146C90B2DD061460905090D0818011D18 +:1077F000216040881FE0802526E062461205120DB8 +:107800001018604A521E914217D180880021FEF75D +:1078100088FC0028EFD0276001893970090A797047 +:10782000216842898A70120ACA7021680830091DCD +:10783000FEF7DFFC001D308006E0001D2060022006 +:10784000F9E7062500E001252846FEBDFFB50F46F5 +:1078500081B01546064601240021FEF762FC00288F +:1078600030D001890624B1422CD0711A062251432E +:107870000818C2890A305104890F0FD101880523E5 +:10788000DB02CB1A032B1DD929231B02994219D0E5 +:107890009B1C994216D05B1C994213D0D10B11D07E +:1078A0001105090D0C1820887E19864209D8334B22 +:1078B00060198A3B3A46001D049998476680002467 +:1078C00000E00D24204605B0F0BDF8B50E46154683 +:1078D000074601240021FEF724FC00281FD001895F +:1078E000B9421CD0791A062251430B18D8890A33A1 +:1078F0004004800F09D118880521C902411A0329C3 +:107900000DD929210902884209D05E80E9041E4868 +:10791000998801D5014300E08143998000242046E5 +:10792000F8BDF8B50E461546074601240021FEF7BE +:10793000F8FB00281AD00189B94217D0791A06221B +:1079400051430B18D8890A334004800F09D1188895 +:107950000521C902411A032908D9292109028842AF +:1079600004D05888B0432843588000242046F8BDEE +:10797000FB349B5F8000008000100000A30F00001C +:10798000A0900020032800000010000010B5002186 +:10799000FEF7C7FB002800D0406810BDF8B51446BC +:1079A0000D4607460A46002669462046FEF770FC4B +:1079B000040006D00C2C02D0062C1CD036E000248B +:1079C000012668460088002830D03846FFF790FA34 +:1079D000002822D00E2D22D001213846FFF76EFA62 +:1079E000002812D0002E1AD03846FFF78FFA102840 +:1079F00015D20C241AE00C2D18D00D2D16D0092DFF +:107A000001D0032412E0022410E002213846FFF7DF +:107A100055FA002801D00F2408E0052406E0384676 +:107A2000FFF766FA694609888842F6D32046F8BD12 +:107A300070B5FF4D84002859806A002805D00C38A5 +:107A40000BF0F4FD29590020886270BDFFB581B0AC +:107A5000174601980D46F64A810050581E46806A26 +:107A6000002817D04388AB4211D14478062C02D0AD +:107A7000002C05D000E080240198FFF7D9FF0FE02B +:107A8000808838805058806A801D306013E00198EB +:107A9000FFF7CEFF324639462846FFF760FE044620 +:107AA000062C08D12846FFF771FF064600232A4618 +:107AB00019460198B047204605B0F0BDFFB585B026 +:107AC000088816460C460027049020880121FEF7FE +:107AD00028FB050015D021882889814200D220800A +:107AE00020883188884214D82A466946FEF7BBFBB5 +:107AF00003466A4608990E98FFF7F2FD00280AD15E +:107B000004E030882080002F1AD004E02088401C38 +:107B10002080002F0ED02288002309210598FFF72E +:107B20003DFF07462088294600F0ACFE3080002F3C +:107B30000AD010E0318880B2884201D80028C4D130 +:107B400004980A27208006E02188109B0F9A059848 +:107B5000FFF77CFF0746384609B0F0BDF8B5074689 +:107B60000020009008780C46122827D01D26E588B2 +:107B70003846FFF7FAFAC01E854200D2284685B281 +:107B8000281D82B231463846FFF73DFC0646A088E4 +:107B9000214670800831A74B2A46301D9847304651 +:107BA00008380BF0C2FD2078122805D03902A24A0D +:107BB000A248491D0BF020FE0098F8BD1B26D6E711 +:107BC00070B59B4D8400285901691030002904D0FC +:107BD0000BF0C9FB0BF02AFDF5E770BD70B5944DB5 +:107BE0008400285981691830002904D00BF0BBFBB0 +:107BF0000BF01CFDF5E770BD70B515460E461C4632 +:107C000005220121FFF7FFFB46704580047108380B +:107C10000BF08BFD70BD10B5002A05D013460A4647 +:107C20001221FFF7E9FF10BD01221321FFF7EBFB43 +:107C300008380BF07AFD10BDF3B5814F81B00E46C8 +:107C4000BD8B042203210198FFF7DDFBBA8B7188FD +:107C500004468A4200D211460198FFF78BFA20466B +:107C6000658008380BF061FD0020FEBDF3B585B0DE +:107C7000002002900F460598FFF777FA801E86B223 +:107C8000049605987C88B9888000002503908C4272 +:107C900001D8002C01D101201FE001212046FEF770 +:107CA00040FA0090002817D00089844200D2044690 +:107CB000B888A04226D3012118200BF05DFC01906A +:107CC000848001992046C91D009AFEF7CCFA0199DB +:107CD000002D887103D003E00A2002901AE00546C7 +:107CE000A84203D001980BF0A1FC13E0504903987F +:107CF0000858019918300BF019FB701B801E641C8A +:107D000086B2A4B2B888A04204D3002C02D0A81C2A +:107D10008642C2D2464C039820588069002812D06F +:107D200004980027801B801C82B205210598FFF76C +:107D30006AFB0646022D0AD00220707003983D4D62 +:107D40002058846913E00298002817D018E0012019 +:107D5000F3E7F019A1884180BF1CBFB2F019E11D03 +:107D6000A279801CA847A0792468C01987B2002C8A +:107D7000EFD1304608380BF0D8FC07E00A2002901B +:107D800003467A8839780598FFF736FF002007B058 +:107D9000F0BDF3B58BB00C46488869468881204613 +:107DA00040380990C68F0B9880000790002E0AD1AA +:107DB0000B98FFF7DAF9401E86B26088A1888842E6 +:107DC0001ED800281CD0A01D0A90801C0590099880 +:107DD0006946808F04AA083887B2A08808830A9869 +:107DE00008A96D4607C5022306AA03A90B98FFF749 +:107DF00065FE050006D00A2D50D0062D4ED03FE07E +:107E000001254BE0E0880521C902884202D0491CC7 +:107E1000884209D16846008CF9B2C3B2049A059829 +:107E2000FFF75EFC002815D16846008CB84209E0D7 +:107E3000B4900020190F00003075000041050000CB +:107E4000649000201CD1FD4B3A4604990598984750 +:107E5000002815D1012108200BF08EFB0146684651 +:107E6000808988806846008BC880F54A0798361F4D +:107E70001058B6B218300BF059FA0B98FFF7D8FD2E +:107E80006946088B401C8881A0888989884205D36F +:107E90006946098B884201D0042E98D20998062D94 +:107EA000C68734D0E64E0798305818300BF034FAB5 +:107EB000002822D08000801C82B2002407210B9869 +:107EC000FFF7A1FA01460798305880690CE063007B +:107ED00082885B185A80641CA2B254006418C3885C +:107EE0006380521C006894B20028F0D1084608381C +:107EF0000BF01BFC062D0DD006E068468289217828 +:107F00002B460B98FFF778FE00200DB0F0BD6846B9 +:107F1000808960800120F8E7F3B58DB000200690DD +:107F20000D46488869460882284640380A90C48F22 +:107F30000027002C0CD10D98FFF717F9801E84B292 +:107F40006888A988884201D8002801D101200690BC +:107F50000D98BB498000079008588069002800D020 +:107F600087790698002856D1A81D0B900A98A988F1 +:107F7000808F6A4691840B9908AB03AA6E460EC6A1 +:107F8000801FC3B209AA04A90D98FFF797FD0690B8 +:107F9000002840D1684681898F4201D0002F3AD114 +:107FA000A01EFD22FD2800D31046814200D20846C3 +:107FB00086B23046012108300BF0DEFA05906846A3 +:107FC0008789018A05989D4B818005988A3B867137 +:107FD00005983246C01D08999847A01B801E84B2A0 +:107FE000974907980858059918300BF09FF968468B +:107FF0008089864202D10D98FFF71AFD6A46908C5F +:10800000411C89B21182AA888A4204D3824202D0DA +:10801000B81C8442AAD20A98C487069806283FD082 +:10802000874C0798205818300BF076F900282DD08F +:108030000799002661588C69A179891C4143891CE4 +:108040008AB209210D98FFF7DEF90546A079801C58 +:10805000687011E0A819A1888170090AC170B61C66 +:10806000764BB6B2A819E11D8A3BA279801C9847CD +:10807000A0792468801986B2002CEBD128460838F4 +:108080000BF053FB069806280DD006E06846028ADE +:108090002978069B0D98FFF7AFFD00200FB0F0BDCB +:1080A0006846008A68800120F8E7F3B58BB00020AD +:1080B00002900D46488869468881284640380890D5 +:1080C000C48F00200490002C0CD10B98FFF74DF8C2 +:1080D000801E84B26888A988884201D8002801D10E +:1080E000012002900B98564980000790085880693B +:1080F000002801D080790490029800285BD1A81D47 +:108100000A900898A988808F6A4611830A9909AB5A +:1081100005AA6E460EC6801FC3B206AA03A90B9815 +:10812000FFF7CCFC0290002845D16946898A049863 +:10813000884201D000283ED1201FFB22FB2800D31B +:108140001046814200D2084686B2304601210C30EA +:108150000BF012FA07466846808A049068468089C8 +:10816000B8806846008BF8803846344B3E72093040 +:1081700032468A3B09999847A01B001F84B23049B8 +:1081800007980858394618300BF0D0F86846808AAE +:10819000864202D10B98FFF74BFC6A46108B411CBC +:1081A00089B29181AA888A4205D3824203D0049879 +:1081B000001D8442A5D20898C487029806284AD098 +:1081C0001F4C0798205818300BF0A6F8002839D01B +:1081D0000799002661588C69217A091D4143891C41 +:1081E0008AB211210B98FFF70EF90546207A001D7F +:1081F000687019E0A819A1888170090AC170B61CBD +:10820000B2B2A818E1888170090AC170921C96B2B6 +:108210000A4B2146A81909318A3B227A801C9847CB +:10822000207A2468801986B2002CE3D128460838C9 +:108230000BF07BFA0298062810D00AE0A30F00008A +:10824000B4900020684682892978029B0B98FFF73A +:10825000D3FC002059E6684680896880012054E6F6 +:108260007CB50C464A88054600230921FFF796FB9A +:10827000030007D1618801AB6A462846FFF7E6FB99 +:10828000030007D0062B2ED0628821782846FFF7FE +:10829000B3FC26E0684604882846FEF766FF401EC9 +:1082A000844200D2204684B2601C82B20B21284650 +:1082B000FFF7A9F80646FF4B2246401C0199984754 +:1082C000304608380BF031FA68460088844208D1FD +:1082D0002846FEF74AFF401EA04202D02846FFF77C +:1082E000A7FB00207CBD01207CBDFEB50D464A8861 +:1082F000064600230921FFF751FB040007D16988D6 +:1083000001AB6A463046FFF7A1FB04000AD0062CF9 +:108310003BD06A88297823463046FFF76DFC062C4F +:1083200033D030E06946A8880988884201D90724FB +:10833000EFE70C1A3046FEF718FF401E844200D2C9 +:10834000204684B2601C82B20D213046FFF75BF8F4 +:108350000746A8880199D74B41182246781C9847B0 +:10836000384608380BF0E1F9A888694609880019F1 +:10837000884208D13046FEF7F8FE401EA04202D0E7 +:108380003046FFF755FB0020FEBD0120FEBDF3B5D2 +:1083900087B00898C84940380390808F0025C003F3 +:1083A0004018000C05900798C449800002900858B6 +:1083B00018300AF0B1FF06460398C48F002C39D15B +:1083C0000798FEF7D2FE401E84B233E00898710091 +:1083D0000F187A88002309210798FFF7DFFA0500B4 +:1083E0002FD179886B4604AA0798FFF72FFB050069 +:1083F00020D16846008AA04200D3204687B2384682 +:10840000012108300BF0B8F8019087800198A94B42 +:108410003A46801D00999847A84902980858019942 +:1084200018300AF083FF0798FFF702FBE01B761C69 +:1084300084B2B6B20598B04203D9002C01D0002D09 +:10844000C4D00398002DC48722D10798FEF78DFE73 +:10845000001B82B200270F210798FEF7D4FF00907F +:1084600096490298085884690AE00098A11DC0192D +:10847000904BA288401C9847A0882468C01987B2F6 +:10848000002CF2D1009808380BF04FF9002D0BD0DA +:10849000062D0CD0089871000818428808982B46C1 +:1084A00001780798FFF7A8FB002009B0F0BD012074 +:1084B000FBE7F0B506460A78002085B0122A10D0F6 +:1084C000522A11D10C464039888F0027001F85B2EF +:1084D000628802AB0A213046FFF760FA002805D017 +:1084E0001FE0304600F036FA05B0F0BD0022294604 +:1084F0000298FDF759FE002813D152200390678897 +:10850000241D3846FFF742FA8446694603980880DE +:108510004D8001946B463A46012130466446A0479F +:1085200001273846E0E7F3B5084685B040380090AB +:108530000025C68F0C462F46002E07D162880023E7 +:108540000B210598FFF72AFA050037D105986388B3 +:1085500000218000594A049010589C4686460069C4 +:1085600005E0C28A9A4201D1012100E0006800289A +:1085700002D00029F5D003E0002901D1002E26D039 +:108580000098808F801F80B20290704620300AF0E1 +:10859000EAFE039060883105090D01910090A388DF +:1085A000029A0399059800F09CF905001CD04349F4 +:1085B00004980858039920300AF0CEFE628821788A +:1085C0002B460598FFF718FB384607B0F0BD60460C +:1085D000FFF7DCF906460023628802210598B047C0 +:1085E0000127002DEAD1EFE702981721801D82B202 +:1085F0000598FEF708FF054660886880A11D2D4B91 +:10860000A81D029A9847A088A880284608380BF031 +:108610008CF80227D8E7F3B587B0089800214038D6 +:108620000290C08F049100910899497801297DD169 +:1086300007998900039100285AD1204840580469BD +:10864000002C55D000200646054605902746E08AB6 +:1086500000211437FDF765FD00280DD001897A88C7 +:10866000914209D0511A0622514308182289618982 +:108670000A30FDF799FD00E00120009001200190F3 +:10868000009800280DD178880599884204D005907B +:10869000E68800202546A0802089B04213D9072013 +:1086A000009008987A880178009B0798FFF7A4FA51 +:1086B000079805E0190F00000000FFFFB4900020AC +:1086C000FFF77EFA11E0B04206D2A54204D0E68060 +:1086D00060892546A08005E06189401886B2A88897 +:1086E0004018A8802468002CB0D102990198C8874E +:1086F000B24E039830580469002C40D0E08A0490B0 +:10870000A0880690254614350498FFF73FF90746E0 +:10871000A088694648812089694608816089488027 +:10872000A81D019016200880002000E027E0059099 +:108730002668002E0ED0069800280BD0F18A354608 +:1087400004981435814205D101200590FF2017308F +:10875000694608806B460121049A0798B8479749F3 +:108760000398085810300AF0FEFD20460AF05EFF1C +:10877000059834460028CED1012004900DE00798DA +:10878000FFF71EFA0098002807D101221921079847 +:10879000FEF739FE08380AF0C8FF049885E6F1B5FF +:1087A0000098864F860024E02C46E8890C34002887 +:1087B00003D00AF017FD00206080207A8049C006AF +:1087C000000F401E0006800D0A582146083100980F +:1087D0009047002804D001280FD002280BD108E0D0 +:1087E0000098FFF7FBF9B85920300AF0BCFD0AF0F9 +:1087F0001DFFB859056A002DD6D1F8BDF8B506465B +:108800000A7A0402FF2580006C4B1E2A02D0D7078B +:1088100015D033E01858002100680D46002800D01C +:108820000178132901D0142928D1611D65480BF066 +:1088300036F8002211463046FEF72BFC1EE0002AD7 +:108840001CD0D706FF0E182F18D8142A16D01A5885 +:10885000126A002A14D000270022CA8018580C3946 +:1088600020300AF063FD0125601D0AF0ACFF00070F +:1088700004D4002F02D03046FFF791FF2846F8BD00 +:108880000127E9E7F0B50C89844201D14889F0BDA0 +:10889000021B06235A435218D3890A325B049B0FEA +:1088A000F5D11388484EB342F1D1401C002583B264 +:1088B000771E488910E05189921D4904890F04D11F +:1088C0001188B14205D0B94203D05B1C9BB2002D88 +:1088D00002D05B1E98B2F0BD9842FCD39C42EAD312 +:1088E000F0BDF8B58600002534480095855914463A +:1088F0002D69069A2746002D09D0AD8801272D192C +:108900007F02BD4202D911200090F8BDAFB24C8168 +:108910000B81079B2948CB8080590D460469103094 +:108920000AE0E18A914206D92A4621460AF077FDFB +:10893000002C03D008E02468002CF2D11F482946FF +:10894000805910300AF0F2FC1C4880590069878079 +:108950000098F8BDFEB5074608464038808F0C46A3 +:10896000001F85B24A8800266B460B213846FFF768 +:1089700015F8030006D1002229460098FDF714FCE3 +:10898000030006D0628821783846FFF735F9304673 +:10899000FEBD122002906688241D3046FEF7F6FFC9 +:1089A00084466946029808804D8001946B463246A1 +:1089B000012138466446A0470126E8E7B49000202C +:1089C0004C5A01184105000003280000F3B50024AB +:1089D000224FCE0781B0F60F1C206043C519A87B3B +:1089E00009280BD12946143101980AF0A6FD002868 +:1089F00004D0A87EC007C00F864204D0641CE4B235 +:108A0000042CE9D303E0042C01D20120FEBD002098 +:108A1000FEBD1C214843114910B540180021817347 +:108A200003F0C5FF10BD70B50C49054600241C209D +:108A300060434018807B002805D0641CE4B2042CFD +:108A4000F5D3072070BD1C20604340180822002188 +:108A5000034B143098472C70002070BDCC90002040 +:108A6000750F000010B50446814B80001B58403341 +:108A70009878002809D199701146204603F03BF9F7 +:108A800003220221204605F0CCF810BD70B5054642 +:108A9000774A800010580029046825D161780029A0 +:108AA00002D0012920D11AE003220221284605F034 +:108AB000B8F800220121284605F0F0F8217928466F +:108AC00000F019F80120607000221146284605F0D8 +:108AD0000FFA01220021284605F0E0F870BD617907 +:108AE00001222846FFF7BEFF0021284605F000F9C5 +:108AF00070BD0021CAE708B502226B461A70597092 +:108B0000C0B25C4A694605F077FA08BD002901D178 +:108B10001178BBE7704770B50E4604465449800093 +:108B20000D5800221146204605F0B8F80022012118 +:108B3000204605F0B3F8E88F7178C007C2172046C9 +:108B4000521CFFF78FFF002070BDF8B5150A484989 +:108B5000A8000C58D8B21646162801D04221085554 +:108B60002346423300221F461146284605F0E2F80C +:108B70003B4600220121284605F0DCF803220221B1 +:108B8000284605F04EF8FF2130460AF0F1FD40344A +:108B9000A2780021284604F099FC0021284604F020 +:108BA00098FF2846FFF735FF0020F8BD70B5144642 +:108BB00006462F4A80001058C08F800512D4002925 +:108BC00005D00022631D1146304605F0B3F801259B +:108BD00022460021304605F04BF800213046FFF7D1 +:108BE00055FF00E00225284670BD70B50E462049AD +:108BF00082008C580025002C09D040342178C943CC +:108C0000890704D06178C90703D03A2517E00C25FD +:108C100015E00102491CFF2006230A4607300AF02E +:108C20006BFD07210170002141700671132E08D0E1 +:108C300046710AF07AFD6078012108436070284689 +:108C400070BD16214171F4E710B50C460102491CB4 +:108C5000FF2006230A4607300AF04EFD0721017067 +:108C600000214170047144710AF05FFD10BD0000E5 +:108C700090920020F38A0018F8B50F46064681004E +:108C80005748445825686878002815D0012825D011 +:108C90001F27E87800280AD022463032394630466D +:108CA00004F047FC40346078FD21084060700021EA +:108CB000304605F01DF8F8BDE08F4007E9D4304696 +:108CC00000F07FF8E08F08210843E08701206870FA +:108CD00002460021304604F0E1FFF8BD00221146B3 +:108CE000304604F0DBFFD4E7002901D11178C3E757 +:108CF000704770B500250446FF2909D001250021E1 +:108D000004F0B6FF00212046FFF7B6FF284670BDED +:108D1000D0780028FAD03249A0000A584220815C5D +:108D20002046303204F005FCF0E770B52C4D82008F +:108D3000AC584E7830231E554B8863868988A186AF +:108D4000E38F04210B43E387A9580968002902D067 +:108D50000978012909D0190705D400F032F8E08F0D +:108D600008218843E087002070BD0021FFF784FFC1 +:108D7000F9E770B51A4982008C580025002C09D0FB +:108D800040342178C943890704D06178890703D525 +:108D90003A2514E00C2512E00102491CFF200423AF +:108DA0000A4607300AF0A8FC012101700022427037 +:108DB000C1700AF0BAFC607802210843607028464E +:108DC00070BD1CB50C216A4611700B21517005490C +:108DD0005180052191800022694605F00DF91CBDE6 +:108DE00090920020C509000010B5FF498200895803 +:108DF0004968002906D00978062903D100221121EB +:108E000000F010F810BD10B5F74982008958496884 +:108E1000002906D00978062903D10022122100F08A +:108E200001F810BDF0B51746064685B08000EE4A41 +:108E30000090155804206C6862788A420BD0132980 +:108E400001D03D2701E03D2F04D1012239463046B3 +:108E5000FFF708FEC0E00A390B0008F0A5FC090680 +:108E60003F46577389A8BDBC55000021304602F02B +:108E7000CEFF01220021304605F03AF82746E98F5F +:108E80002037B87D8906C90F884207D0D74B2422E6 +:108E90000321304605F000F912206070B87D0028EB +:108EA00012D00021304603F0CDF8012202213046D5 +:108EB00004F0B7FE0B256946304600220D7005F020 +:108EC0009BF8657001221BE002221146304604F037 +:108ED000A8FE304600F049FA0D203CE00021304663 +:108EE00003F098F80C206070ECE70222114630463F +:108EF00004F097FE304600F038FA0D206070002232 +:108F00000121304604F0CAFE05B0F0BD6A4610707B +:108F1000254600A820350822B54F013021462C31C6 +:108F2000B847042202A829460130B8470022694602 +:108F3000304605F061F8A18E221D3046FCF7CAFECE +:108F40000E2008E0002F08D0A84B0622032130464F +:108F500005F0A2F812206070D6E720462146A54B06 +:108F600001220C3024310096FDF792FC0F20F2E72D +:108F70002146224630460C311C3203F07BF8012199 +:108F8000304603F05FF805216A4611703046002232 +:108F9000694605F031F81020607001221146304614 +:108FA00004F07CFEE88F01214902084347E00022DB +:108FB0000121304604F072FE0121304603F02AF808 +:108FC0001120607006216B46197030468A4A694646 +:108FD00005F012F898E706278348009940580028C2 +:108FE00025D040300078C043800720D00121304692 +:108FF00002F00DFF00220221304604F012FE002F85 +:1090000003D02034A07D002803D039463046FCF739 +:109010008CFEE98F20208143002F12D000204001D8 +:109020000143E98700221146304604F061FF012127 +:10903000304604F05DFEE88F012149028843E8874D +:1090400062E70120EBE710B567498200895809689B +:10905000002906D00978062903D10022022100F058 +:1090600001F810BDF0B51746064687B080005E4A8D +:10907000009015582C68607888421CD0092901D0CE +:109080003D2712E0132F0ED004DC062F07D0082F47 +:10909000F6D108E01A2F04D0222FF1D103E00528E1 +:1090A00001D00428ECD13D2F04D1012239463046AD +:1090B000FFF7D8FCCCE0030008F076FB09061F1A86 +:1090C000427785A240C540000021304602F09FFE55 +:1090D0003620005D00280BD00A216A461170304608 +:1090E0000022694604F088FF01206070024657E0C4 +:1090F000304600F03AF903201FE0012200213046FB +:1091000004F08FFD01221146304604F0F1FE0022EA +:109110001146304604F0C2FD0021304602F092FFB5 +:109120000021304602F076FF0B216B461970304665 +:10913000324A694604F060FF0220607007B0F0BD5B +:109140002246A08E2432069203236A461370507280 +:10915000000A9072274600A81C370822244D0130CF +:10916000211DA847082202A803300699A847042217 +:1091700004A839460330A84700226946304604F067 +:109180003BFF0420607001220021304604F086FD80 +:109190002034A07D002802D00222114601E00222E4 +:1091A0000121304604F03DFDC8E70222002130468F +:1091B00004F037FD01221146304604F099FE0520E7 +:1091C000607001220BE0204621460A4B01220C3040 +:1091D00024310096FDF75CFB062060700022002120 +:1091E000304604F05BFDA9E790920020078E00183E +:1091F000190F0000BF920018E98D00184790001861 +:109200002146224630460C311C3202F033FF012148 +:10921000304602F017FF0121304602F0FBFE062126 +:109220006B46197030460022694604F0E5FE0820BE +:10923000607001220021304604F030FDE88F0121EA +:109240004902084337E000221146304604F026FD6B +:10925000FE4800994058002821D040300078C04393 +:1092600080071CD0284640304178F72211404170D9 +:109270000121304602F0CBFD00220221304604F0ED +:10928000D0FC00220121304604F032FEE98F20207C +:109290008143002F11D0002040010143E987394666 +:1092A0003046FCF742FD0021304604F021FDE88FF6 +:1092B000012149028843E88740E70120ECE7F8B53F +:1092C0000F461006E149800D0858154600282AD09F +:1092D0004022125CD243920725D0AA008958DC4E66 +:1092E000C98FC90720D00468002C1CD0207806281C +:1092F00019D16078032802D006280FD109E0042292 +:10930000204639461C30B0470822391D20462430FB +:1093100003E01022204639460C30B0476178E8B2AD +:109320000022FFF79FFEF8BD4468002CFBD0207898 +:109330000628F8D160780D2802D00F280FD109E057 +:109340000422204639462030B0470822391D2046E5 +:109350002C3003E01022204639460C30B0476178AB +:10936000E8B20022FFF75EFDF8BD10B50146B9482E +:10937000FDF7BFFA10BD30B4B44C8300E3580029A8 +:1093800010D0012910D0022912D0032912D151780E +:1093900003290BD04033197889070BD03D2230BC0C +:1093A00009215FE61278FAE71A22F8E79278F6E7E1 +:1093B0005278F4E730BC704710B5A44C8300E358F2 +:1093C00000290ED0012903D0022901D0032907D199 +:1093D00040331978890703D03D221321FFF722FD7E +:1093E00010BD1278F9E770B5054698498000085815 +:1093F0000024C18FC90702D14068002802D024246C +:10940000204670BD0122FF203823114607300AF0A4 +:1094100073F90246062010700A2050700121362090 +:109420008154284604F024FC00220A212846FFF734 +:10943000F9FCE5E710B58549820089580024CA8FF8 +:10944000D2070AD0096800290DD0097806290AD167 +:1094500000220121FFF706FE06E04968002902D03C +:109460000978062902D02424204610BD00220B21B1 +:10947000FFF7D8FCF8E7F7B500980D468100734870 +:1094800000264458E08FC0070BD02068002825D064 +:109490000078062822D13D2209210098FFF7E2FD3D +:1094A0001DE060680C27002814D10122FF2038231A +:1094B000114607300AF020F90746062038700020D0 +:1094C0003621C8553A460121009804F0D1FB0A2004 +:1094D0007870074660680178062902D02426304655 +:1094E000FEBD0446A97A687A09020143A18629468D +:1094F000042213312046564B1C3098472946082237 +:109500000B312046524B243098470822691C504B9F +:10951000201D9847002239460098FFF783FCDEE7BC +:10952000F8B50E4605468100484800244058C18FD2 +:10953000C90706D00068002809D0017806290FD095 +:1095400005E04068002802D00078062802D02424D4 +:109550002046F8BD3D2213212846FFF763FCF7E7BC +:109560003146074604220931394B203098470822FA +:10957000711C3846364B2C3098470022042128466F +:10958000FFF770FDE4E710B53049820089580024E8 +:10959000CA8FD20706D00968002909D009780629A0 +:1095A0000ED005E04968002902D00978062902D0CA +:1095B0002424204610BD3D221321FFF733FCF8E799 +:1095C00000220521FFF74EFDF3E710B51F49820089 +:1095D00089580024CA8FD20706D00968002909D00B +:1095E000097806290ED005E04968002902D00978DB +:1095F000062902D02424204610BD00221021FFF7A6 +:1096000011FCF8E700220821FFF72CFDF3E7FFB576 +:109610000E4982008E58002581B0002E1ED037469C +:1096200040373978C943890718D0F18FC90715D059 +:10963000042815D22821895DC907C90F00D001214E +:1096400000290DD0797809070CD505E0909200200B +:10965000190F0000BF9200183A252BE00C2529E0D5 +:109660001A2527E00102491CFF2038230A4607304B +:109670000AF042F80446062020700020607004982A +:10968000002805D0A0860822344B201D0399984756 +:1096900010222046314B0C3002999847F08F8006FB +:1096A000C10F3620015520460AF03FF8787808218E +:1096B00008437870284627E4F8B5294F0646850008 +:1096C00078590C2400282ED04022125CD2439207F5 +:1096D00029D04068002826D00278062A23D1427873 +:1096E0000E2A20D10024002905D010221B4B0C305B +:1096F0009847002213E02030807D00280ED0012101 +:10970000304604F0F5FA78590122C18F5202914394 +:10971000C18706213046FFF797FA04E006220E21A2 +:109720003046FFF77FFB2046F8BD70B500250446A4 +:10973000FF290AD00125002104F09AFA00221146DF +:109740002046FFF78FFC284670BD0549A000085849 +:10975000403081782046FCF7E8FAF4E7190F000062 +:10976000909200203EB56C462170EB236370D122AD +:10977000A2700122E27000226271A271E271227273 +:109780002271092906D19B4A810051582031097A5A +:109790000B4063700022214604F02EFC3EBDF8B55C +:1097A0000F4606468100934844582568687800288B +:1097B00015D0012826D01F27E87800280AD0224695 +:1097C00028323946304603F0F2FE40346078FB21FF +:1097D000084060700021304604F08AFAF8BDE08F3E +:1097E0000106E9D4C00701D0082100E00E2130466F +:1097F000FFF7B8FF0120687002460021304604F0F0 +:109800004DFAF8BD00221146304604F047FAD3E77E +:1098100030B400290ED001290ED002291ED0032910 +:109820001ED151780E291BD19178002918D01A2900 +:1098300006D011E01178F8E751780E2910D11A21DD +:10984000042809D26B4B82009A58002A04D0203297 +:10985000137A0824A343137230BCA0E75178E4E7DD +:1098600030BC704770B5634A8300D2580024D38F50 +:10987000DB0701D0242418E013464D7820321572FE +:109880008D785572CD7895720D79D5724D791573A5 +:109890008D795573CD799573097AD173D98F8022DB +:1098A0001143D9870921FFF75DFF204670BD70B5D0 +:1098B000504A8300D2580024D38FDB071AD01346B6 +:1098C0004D78203215728D785572CD7895720D795C +:1098D000D5724D7915738D795573CD799573097A54 +:1098E000D173D98F80221143D9870921FFF73AFF1D +:1098F000204670BD2424FBE770B53E4D84002B59F3 +:109900004E781A46203216728E785672CE7896723B +:109910000E79D6724E7916738E795673CE79967308 +:10992000097AD173D98F80221143D98729590968BF +:10993000002905D00978022902D10021FFF72FFF65 +:10994000002070BDF8B5014682002A4800248058E6 +:10995000021E0AD0054640352B78DB439B0704D016 +:109960006B785B0703D53A2426E00C2424E000261C +:109970000127042907D22030007A0823184000D09C +:109980000120002806D1D08FC20703D1000601D4E0 +:109990001A2411E00902491CFF2004230A4607305B +:1099A00009F0AAFE022101704670C77009F0BDFEE1 +:1099B00068780421084368702046F8BD70B500251A +:1099C0000446FF2909D00125002104F051F90021A6 +:1099D0002046FFF7E4FE284670BDD0780028FAD074 +:1099E0000449A0000A584220815C2046283203F036 +:1099F000DEFDF0E790920020F3B50646FE4A8000B7 +:109A0000155800272C6883B06178002902D00129FD +:109A100070D13BE001216170E98F09060CD5042E5D +:109A20000AD21058002807D02130007A08210840B7 +:109A300000D0012000280AD1E088F049884200D3F4 +:109A40000846E0806089884200D308466081E38848 +:109A5000A1886289248914276D462F706C70240AAE +:109A6000AC70EA70120A2A716971090AA971EB7166 +:109A7000190A297230460022694604F0BDFA012213 +:109A80000021304604F00AF905B0F0BD002211466D +:109A9000304604F003F90498002819D1298A208956 +:109AA00081420BD1E989A288914207D1A98A6289B2 +:109AB000914203D1698AE288914209D0009063897A +:109AC000A288E188304602F006FA00281FD000275D +:109AD000002F0FD020892882A088E8816089A88281 +:109AE000E0886882208900906389A288E1883046F6 +:109AF00003F031FEE078002804D040356878DF219B +:109B0000084068700021304604F0F2F8BCE70127F5 +:109B1000DEE7FFB583B003980C9C8500B64840593A +:109B2000C58EA54200D22C46058FA7B29D4200D318 +:109B30001D467C237C2A00D91A464524240116465A +:109B4000A14200D80C46C18F09060CD503990429FF +:109B500009D2010007D02921095C0822114000D058 +:109B60000121002906D1A5498D4200D30D468C4222 +:109B700000D30C46018AB14208D1C189B94205D14E +:109B8000818AA14202D1418AA94211D00682C781AD +:109B90008482458223463A4629460096039802F07D +:109BA0009AF923463A4629460096039803F0D3FDD6 +:109BB0001522694603980A704E70320A8A70CC707A +:109BC000220A0A714F713A0A8A71CD712A0A0A7201 +:109BD000002204F011FA07B0F0BD30B4002910D013 +:109BE000012910D0022920D0032920D1517814292D +:109BF0001DD1917800291AD0192908D01A2906D028 +:109C000011E01178F6E75178142910D119210428B0 +:109C100009D2794B82009A58002A04D02032137A54 +:109C20002024A343137230BCE6E65178E2E730BC4F +:109C30007047F8B5704B82009A5800255268002A88 +:109C400001D0242529E08B784E781C024A1C34432D +:109C50001B2C1DD3537916791A0232431B2A17D3B2 +:109C60000B79CE781B023343FF264936C91CB34219 +:109C70000ED34F7909793F023943B14208D3FB2C07 +:109C800006D8FB2A04D85E4EB34201D8B14201D9AE +:109C9000202502E00094FFF73CFF2846F8BDF8B508 +:109CA0000A460546810054480024405801680029AE +:109CB00002D00878042801D0242443E09078567814 +:109CC0000002531C30431B2816D35E791F793602DD +:109CD0003E431B2E10D31679D77836023E43FF271A +:109CE0004937D21CBE4207D35679177936023E4314 +:109CF000FF274937BE4201D220241FE08E888642CA +:109D000000D23046888050781778CE8800023843D9 +:109D1000864200D23046C88058791B790E890002ED +:109D20001843864200D230460881507912794B8917 +:109D300000021043834200D218464881214628463B +:109D4000FFF75AFE2046F8BDF7B517462A498200AC +:109D50008C580025002C0AD0264640363178C9435D +:109D6000890704D07178890603D53A2531E00C259E +:109D70002FE004282FD22821095D2022114000D095 +:109D80000121002927D0E28901998A4202D1618A02 +:109D9000B9421BD00102491CFF200C230A460730A0 +:109DA00009F0AAFC04210170002141700121C17059 +:109DB00001998180C7807C21018145210901418170 +:109DC00009F0B3FC70782021084370700198E08698 +:109DD00027872846FEBD1A25FBE738B5002405462F +:109DE000FF290FD00124002103F042FF0021284663 +:109DF000FFF702FE204638BD909200204808000080 +:109E000090420000D0780028F4D00020034602469B +:109E100001460090284603F09EFCEBE730B5F74C76 +:109E20000398E47AA40701D5012400E006248A42BD +:109E300016D8FF25F435AB4212D81925ED01A942F9 +:109E40000ED8A2420CD3A8420AD80A2808D30A2264 +:109E500050438A00891849085B1C5943884201DA3B +:109E6000002030BD012030BDF0B50C460746E44966 +:109E700080000E588DB0384602F041F9A1880222C8 +:109E800049000091E18849000191A189022900D887 +:109E900011460291E1890222022900D81146254685 +:109EA00020350391E9786A46490091741782F18F51 +:109EB000C9070BD10199401E081807F09DFB084601 +:109EC0000299C91C02910399C91C0391C107C90FCA +:109ED0006A46D174E17800291DD1697A00291AD126 +:109EE000618AC84A914216D0002914D0A1886A46D6 +:109EF0004900089102990991118A9185618A490066 +:109F00000818A188490007F077FB08A80A9102F019 +:109F1000B4FD00280BD0684602F04FFD00280AD09F +:109F20000020E084E088A084E8700DB0F0BD608A75 +:109F3000E084089815E0F18F0698C90704D1401C09 +:109F4000059907F059FB084683B20598218AC0039A +:109F5000020C384602F02BF8AB4907F063FBE084B3 +:109F60000598C003000CDEE770B586B014466A465B +:109F7000117005460822211DA44E00A80130B047EB +:109F80002320005D6A46507221460E22103102A83D +:109F90000230B04700226946284604F02DF806B08A +:109FA00070BDF7B5164686B0954A810001905458A9 +:109FB0002922F178925D114301D0012700E00027AA +:109FC0000799002945D1B18C2289914207D1328964 +:109FD00063899A4203D17289A3899A4205D021816B +:109FE000318961817189A18101271C21884A4143FE +:109FF0008D18B1890222022900D811460491F189F5 +:10A000000222022900D81146039102F078F800904C +:10A01000208940000290284602F0C9FC0298A880DE +:10A020000098E8800498288103996981E08FC0072F +:10A030000CD10098A988401E081807F0DDFAE980C5 +:10A040002889C01C28816889C01C6881284602F0C4 +:10A050007CFC002F07D0A089009063892289079992 +:10A06000019803F009FBF078002804D040346078B0 +:10A07000EF210840607009B0F0BDF0B51646074604 +:10A0800085B0BA005E4B00929D5800202C680629CE +:10A090000BD062788A427DD161780B0007F084FB97 +:10A0A000072B280896BCBABCBA0006216170F3E7FA +:10A0B00000221146384603F0F1FD002E18D0042F7F +:10A0C00016D24F4900980858002811D02030007A45 +:10A0D00000210222104000D00120002808D0E88F83 +:10A0E000C00704D11C204A4A78438018C17393E00A +:10A0F000012028210855E88F10210843E8872046D1 +:10A1000020300390007A0028384626D001F040FF26 +:10A1100001463B4A009810584089C2008018081830 +:10A1200009302084039A012191702082214638460B +:10A13000FFF79AFEE28CE2832089238C61896E46C8 +:10A140000BC60398A38C8178384601F083FE06463F +:10A1500004206070002E5FD121E001F019FF208201 +:10A1600021463846FFF780FEE08C60822548A082B9 +:10A17000E08220836083A08322460F213846FFF7C8 +:10A18000F3FE01220021384603F088FDE88FC00766 +:10A1900003D000E018E002202EE003202CE0002194 +:10A1A0006A4611700399384689785170E18B518065 +:10A1B000A18C91802189D18061891181218C51816B +:10A1C0000022694603F018FF05B0F0BD00221146D9 +:10A1D000384603F063FD002E1ED12089228C618950 +:10A1E0006B4607C32220015DA38CE28B384601F049 +:10A1F00031FE060010D104206070E5E75091002088 +:10A2000090920020FFFF0000E2040000190F000000 +:10A21000CC9000200028D7D0E078002805D128462F +:10A22000403041784906490E417022463146384651 +:10A23000FFF7B7FE0021384603F05AFDE88F1021E2 +:10A240008843E887C0E730B4F84B84001B59DC8FA3 +:10A25000E40701D0022400E00324002910D00129E2 +:10A2600011D002291FD003291FD151780F291CD1E9 +:10A270009278002A19D0192A09D01A2A07D00FE09B +:10A2800006241278F5E751780F290ED11A220428F6 +:10A2900006D2002B04D02033197A0225A943197263 +:10A2A000214630BCE9E65278E3E730BC7047F7B5A9 +:10A2B00084B0049B16469C00DC4B00221D591046BE +:10A2C0006C680B290BD063788B422DD16178C91F44 +:10A2D0000B0007F069FA05113D077F7F7B000B211A +:10A2E0006170F3E7002E75D100220121049803F07C +:10A2F000D5FC012028210855E88F10210843274666 +:10A30000E8872037387A002810D02089228C61898C +:10A310006B4607C3A38CE28BB978049801F09AFDD1 +:10A32000060057D10A20607007B0F0BDA1882889C7 +:10A33000814216D8E288824213D322896B899A42DD +:10A340000FD16289AB899A420BD1A0802889E08025 +:10A35000002E12D0002332460F21049803F09CFEF9 +:10A3600041E0608900902389E288049803F0CCF9E9 +:10A370000820607001207872D6E7E88FC00713D0FC +:10A3800004982A230102491CFF200A46073009F0DD +:10A39000B3F9A74B05462A22214698470120687049 +:10A3A000284609F0C2F91EE021460498FFF75CFD3B +:10A3B000224610210498FFF7D7FD09206070012282 +:10A3C0001146049803F06AFCAEE703E0002AABD024 +:10A3D000002808D1224631460498FFF7E2FDE98FB4 +:10A3E00010208143E9870121049803F081FC9BE759 +:10A3F000092300290AD0022906D003290CD151785B +:10A40000102909D1927803E0527801E012780B23E9 +:10A41000002A01D019464AE77047F7B582B00C46CA +:10A420000298824980000E5820890090A188174622 +:10A430000025E3880A460298FFF7F0FC002803D0C5 +:10A44000F08FC00741D101E020253FE060897949C4 +:10A45000381A80B2884201D2282537E030680028B7 +:10A4600002D00178032904D070680921002813D094 +:10A4700027E0A1888184E188018121894181618966 +:10A4800001846188C1836178203081702A4603216C +:10A490000298FFF7F2FD19E00122FF202A2311465E +:10A4A000073009F029F90246032010700021D1700D +:10A4B00029208154481E50820121029803F0D8FBC4 +:10A4C000072170680278032A02D0242528467BE6FB +:10A4D0004170A2888284E288028122894281628955 +:10A4E00002846288C2836278203082700122027204 +:10A4F00000220298FFF7DBFEE8E7F7B582B00C46D2 +:10A5000002984A49800008580190406800270028B6 +:10A5100001D0242779E0207AE179000208430090F5 +:10A52000A079617903020B43A078617802020A43A3 +:10A530002179E07809020143E61C651C0298FFF7C7 +:10A540006DFC00280AD00198C08FC00708D00321F5 +:10A55000029803F0F6FC070002D056E01E2754E0F4 +:10A5600002982A230102491CFF200A46073009F0FD +:10A57000C3F8024603201070072050700023D370E8 +:10A58000697828780902014391807178307809024E +:10A590000143D180687929790002084310817079DC +:10A5A00031790002084350811146657A2031CD701F +:10A5B000E07AA57A000228431082607B257B0002A6 +:10A5C00028435082E07BA57B000228439082607C78 +:10A5D000257C00022843D082E07CA57C0002284331 +:10A5E0001083607D257D000228435083E07DA47D9B +:10A5F0000002204390834B720121029803F038FB44 +:10A60000002207210298FFF752FE3846DCE5F7B535 +:10A6100082B0029800278200044880580468002C09 +:10A6200002D02078032807D0242759E090920020F8 +:10A63000190F0000FF7F0000087ACA79000210435A +:10A6400000908879CD1C4E1C497903020B43707829 +:10A65000317802020A436978287809020143029896 +:10A66000FFF7DCFB002833D0707831780002084314 +:10A67000A18888422ED3E288944690422AD86A78EC +:10A680002B7812021A43624524D88A4222D3727967 +:10A69000337912021A4323899A421BD1814200D98D +:10A6A0000846A08068782A7800021043844500D9C3 +:10A6B0006046A08068792A7961890002104381424E +:10A6C00000D9084660810020E0832034A07002E0B9 +:10A6D0001E2700E020273A4602210298FFF7CDFC12 +:10A6E000384671E5F8B50C4605468000A149009052 +:10A6F00008580026002810D0074640373978C9434B +:10A7000089070AD0042D0AD22821095C02221140AF +:10A7100000D00121002902D004E00C2648E0C08FBF +:10A72000C00704D07878C00603D53A2640E01A2640 +:10A730003EE02902491CFF202A230A46073008F080 +:10A74000DBFF03210170002141700123C370618888 +:10A75000628949008A4200D21146C181218822893A +:10A7600049008A4200D2114681816188C1802188D6 +:10A770008180A1880181E18800224181042D0CD2D1 +:10A780007C4C00996158002907D02031097A0222B7 +:10A79000114201D0012200E0002201465A4020313E +:10A7A0000A724B7208F0C1FF787810210843787064 +:10A7B0003046F8BD10B503466E4A9C0012590C2075 +:10A7C000002A25D04024A45CE443A40720D052688A +:10A7D000002915D0002A1BD0D4884888844200D98B +:10A7E0002046D08090880C88A04200D820469080D7 +:10A7F0005489C888844200D920465081002202E052 +:10A80000002A05D03B2208211846FFF750FD002002 +:10A8100010BD70B514460646564A800000251258F1 +:10A82000FF2912D0D08FC00602D5607800281CD036 +:10A83000012522460021304603F01AFA61780022F1 +:10A840003046FFF71AFC284670BDE078002806D095 +:10A850004032917822463046FFF7A3FBF3E74032BF +:10A8600050784006400E5070EDE70225EBE7F8B552 +:10A870000D46100A1C21404A414300278C18FF2B2B +:10A8800006D0DEB2314602F0DCFE012E0BD014E021 +:10A89000E088A188401C06F0AFFE288888420CD0D2 +:10A8A000204602F084F82888A1884018401E06F04F +:10A8B000A3FEE180204602F048F83846F8BD70B5A6 +:10A8C000C5B22C4EAC003059002850D04030017831 +:10A8D000C94389074BD04078C10648D4C00946D146 +:10A8E0002902491CFF202A230A46073008F004FFEA +:10A8F0001C21214A6943335989180A89DB8F498908 +:10A90000DB0701D1C91ED21E03230370002343704D +:10A91000C3708281C18131590989C1803159098946 +:10A920008180315949890181315989894181315960 +:10A93000CA8FD2070BD0042D1AD2002918D020318B +:10A94000097A0222114000D00121002910D00022F2 +:10A95000014620310A724B720021C943418208F03E +:10A96000E4FE30598022403041781143417070BD7F +:10A970000122EDE790920020CC900020F7B582B044 +:10A98000029817468200FD4800268558002F2C6843 +:10A9900005D000221146029803F080F9E8E06078C3 +:10A9A000884278D1030006F0FFFE0504403BC2EB6D +:10A9B000BB00E88F10210843E8872846E179203062 +:10A9C000C176A1798176E17A0177E179EA7D480063 +:10A9D000D040C00705D0A079AA7D4000D040C00774 +:10A9E0007ED1A27916266B4602981E7099705A7015 +:10A9F0000022694603F000FB01220021029803F0C7 +:10AA00004DF9E88FC00701D00220B7E0A0790121FD +:10AA1000C00700D00021029801F09DFA0320ADE0AC +:10AA200000221146029803F039F9A079012100288B +:10AA30000CD0AB7D4200DA40D20701D0002002E00A +:10AA4000800702D50220207200E02172E079002800 +:10AA50000CD0EB7D4200DA40D20701D0002002E0AA +:10AA6000800702D50220607200E06172A07A00289F +:10AA700012D0207AA97D002801D04108491C607AB3 +:10AA8000EA7D002801D04208521C914204D00020E7 +:10AA90006072207246E043E0207A002802D1617A99 +:10AAA00000293FD0A97D002801D04108491C491E3A +:10AAB000C8B20090607AE97D002801D04108491CA5 +:10AAC000491ECFB2029801F063FA6989CA00891859 +:10AAD0004018093083B2A3803A460099029800E0FA +:10AAE00045E001F014FA07001ED001260020A080E6 +:10AAF00020726072627A217A9446A2886B469646EA +:10AB0000182202981A70597062469A707246DA706A +:10AB1000110A19710022694603F06EFA002E41D124 +:10AB200005B0F0BD0126E5E704206070E2E70022F1 +:10AB30001146029803F0B2F8207A002802D1617A17 +:10AB4000002915D0617AAA7D002901D04A08521C3B +:10AB5000521ED1B2EA7D002801D04208521C521E7A +:10AB6000D2B2A388029801F0D2F9070005D019E00B +:10AB70000421029801F0EFF914E004206070CFE79F +:10AB8000E88FC00702D0617A207A01E0217A607AEA +:10AB9000002902D04908491CE975002802D0400864 +:10ABA000401CA875E98F10208143E987E0780028D0 +:10ABB00005D1207A002802D1607A00280DD0EB7DE3 +:10ABC000AA7D3946029802F0E6FDE078002804D01C +:10ABD00040356878BF21084068700021029803F072 +:10ABE00087F89DE7002910D0012910D0022920D034 +:10ABF000032920D1517816291DD19278002A1AD024 +:10AC0000192A08D01A2A06D011E01278F6E75178EE +:10AC1000162910D11922042809D2584B81005958FD +:10AC2000002904D021310B7A5B085B000B720021F4 +:10AC3000A4E65278E2E77047F8B517460646820068 +:10AC40004E48002F85586C6804D00421304601F02E +:10AC500082F914E06078884258D1052813D006287C +:10AC600055D0072852D1207A002802D04008401C35 +:10AC7000E875607A002802D04008401CA875E88F6B +:10AC8000C10767D075E0E88F10210843E887C00747 +:10AC90001ED03102491CFF200C230A46073008F061 +:10ACA0002BFD05210170012141700021C170294651 +:10ACB00020318A7EA3791A408271CA7EE3791A40D4 +:10ACC000C271097FC172A17A817208F02EFDD6E7A8 +:10ACD0002035A87EA27901211040C00700D00021B4 +:10ACE000304601F038F906206070A97EEA7E17230D +:10ACF0006C462370A270617030460022694603F0F2 +:10AD00007BF901221146304602F0C8FFF8BD00224F +:10AD10000121304602F0C2FF207A002802D1617A78 +:10AD2000002992D0617AAA7D002901D04A08521CDC +:10AD3000521ED1B2EA7D002801D04208521C521E98 +:10AD4000D2B2A388304601F0E2F8070097D107207D +:10AD50006070F8BD10218843E887207A002802D16E +:10AD6000607A002805D0EB7DAA7D3946304602F096 +:10AD700012FD0121304602F0BBFFF8BD9092002089 +:10AD8000002901D1127857E7704770B50C46064686 +:10AD9000A1498000085800254168002901D02425D8 +:10ADA00037E0A17800290CD06178002909D0C08F44 +:10ADB000C00708D00521304603F0C3F8050002D0D3 +:10ADC00027E01E2525E03102491CFF200C230A46FE +:10ADD000073008F091FC0521017041706178C17164 +:10ADE000A17881710246A0786178884206D1002856 +:10ADF00004D0411E084201D1012000E000209072E1 +:10AE00000121304602F034FF002205213046FFF7D1 +:10AE100013FF284670BD70B57F4A83008C78D258E6 +:10AE20000025002C02D04B78002B00D11E25D38F9B +:10AE3000DB0705D01368002B02D01A78052A01D051 +:10AE4000242517E09A7922409A71DA794C782240C9 +:10AE5000DA718C7849788C4206D1002C04D0611EBE +:10AE60000C4201D1012100E0002199722A46022101 +:10AE7000FFF784FD284670BDF8B513464A780546AD +:10AE800096080024B600C81C002E03D18E78B7089F +:10AE9000BF0001D020240DE0002A01D1002E09D0EE +:10AEA0004678077836023E439B1B5C4E9BB2B3420A +:10AEB00000D22824584BAE009E593368002B02D094 +:10AEC0001F78052F08D07368002B02D01E78052E3E +:10AED00010D02424204650E71A728978597241789C +:10AEE0000278080210439880224603212846FFF783 +:10AEF00045FDEFE71A7289785972417802780802A5 +:10AF000010439880224606212846FFF795FEE1E788 +:10AF100002469300404A0C20D258002A0AD040230F +:10AF20009B5CDB439B0705D0D07D4870907D08700B +:10AF3000002088707047F8B50C468200364900261C +:10AF40008F583146042807D2002F05D02921C95D2A +:10AF5000C907C90F00D001214D0001210D43002F69 +:10AF600009D040373978C943890704D07978490630 +:10AF700003D53A2625E00C2623E06178294202D049 +:10AF80002178294201D11A261BE00102491CFF2029 +:10AF90000C230A46073008F0AFFB052101700021A1 +:10AFA00041700121C17061782940C1712178294027 +:10AFB0008171A178C17208F0B8FB7878402108430C +:10AFC00078703046D9E6F8B515460746124A800033 +:10AFD00000261458FF2912D0E08FC00602D56878E9 +:10AFE000002817D001262A460021384602F040FEEC +:10AFF000697800223846FFF7C1FC3046BDE6E878A4 +:10B000000028FAD0E37DA27D4034A178384602F0D2 +:10B01000C2FBF2E70226F0E790920020FF7F0000DB +:10B0200070B5304D1C21A87A48432F494418A08C94 +:10B03000002802D108F0C0F8A084208A4004400C07 +:10B040002082A87A0621401C06F0D6FAA97270BDAB +:10B0500024491C22897A5143234A89180A8AD20B2F +:10B0600005D0898BC90A814201D101207047002097 +:10B070007047F8B50E46054608F06CFA194CC02228 +:10B08000A17B1346CB40217BC0B20907090F0B43BC +:10B090008707BF0F0121B9400B432B70A37B1746D5 +:10B0A000DF40237B1B091F436F70A37BDA4033070C +:10B0B0001B0F1A43AA70627B00095201203202431F +:10B0C0000A43EA70607B0321401C06F095FA617325 +:10B0D000A07B0221401C06F08FFAA173207B401C4C +:10B0E0002073F8BD5091002000830020F8B5FE4980 +:10B0F00080000C5826464036F08D009000281DD068 +:10B10000FA48216E0289708E0F4610184143F848A4 +:10B11000192278439202801A06F06EFA401E85B218 +:10B120003946606E06F068FA401E854200D2284615 +:10B13000009980B2884200D30846F085F8BDF8B582 +:10B140000F46E94980000C580821F940E07D23466C +:10B15000101A8033E74AC01E5043420894465A7B77 +:10B160004820D04062460830101A5A881D78963818 +:10B170001E46904200D310464822FA400832801AF8 +:10B180004034E28F520601D58A00801A06F034FA64 +:10B19000854200D22846B071F8BDF8B5D24A810088 +:10B1A000555800902E468036B07B4822C2407088A9 +:10B1B000B1880832884200D80846101895304000FF +:10B1C000CC4906F019FAEA7D296E401C8A1A101A39 +:10B1D000801E2F4644084037F88FC00713D0C3485D +:10B1E0007A8E0089801848431921890106F004FAF3 +:10B1F000C049103006F000FA241A388E002802D018 +:10B20000844200D30446009870214843BA4941184B +:10B210000C80B94940394018C4877088B1884018FB +:10B220004B214000C9004018A8652861F8BDFEB553 +:10B2300007468000AC4A0190105800284AD00646C4 +:10B2400038020A46411CAB48633808F07FFA3046A2 +:10B250002430009008F087F83446054680341CE01E +:10B26000207AA17A800040180006010DA348091831 +:10B27000488F8007800F012806D0022804D00328B9 +:10B2800002D1888F08F005F8207B0421401E20732E +:10B29000A07A401C06F0B0F9A172207B0028DFD113 +:10B2A000308C002809D007F0F4FF06E0A88807F0EA +:10B2B000C4FF009808F057F80546002DF6D139462E +:10B2C000042001F04DFC304608F0B0F986490198A1 +:10B2D00000220A50FEBDF8B50546834980000C588F +:10B2E000844B264640362902B078643B491C01282D +:10B2F00004D002280DD0032824D10FE003221846E1 +:10B3000008F024FA2846FFF748FF226E8034A17B1C +:10B3100015E00822184608F019FA13E0052218462D +:10B3200008F014FA204620302746417C8037797394 +:10B33000007CB8732846FFF730FFB97B226E2846A1 +:10B34000FFF7FDFE0020B070F8BDF7B588B0089893 +:10B350008C46810064483C274458002005902546CF +:10B3600000904035E88F666C810727D5C00725D04F +:10B370002146002080310874002A1FD05B48C07B22 +:10B3800000281BD1E88D002818D0EA8F530515D569 +:10B39000530713D4120711D4AA78002A04D0AA8E16 +:10B3A0002B8812189A4209D2226E42439219160132 +:10B3B000EA8E36091018E886012008740121C906B2 +:10B3C0006046801B00010009884207D2206E801968 +:10B3D0000601E88E3609401CE886F1E7606D0190B1 +:10B3E000A878012846D1204620300290C07F00284E +:10B3F00040D1A88EE98E40182988401A81B2404871 +:10B40000814237D20298807F002820D1208F801976 +:10B410000601E88F3609C10704D0A18F49088919B0 +:10B420000E013609226B2266618FE985626B6266C6 +:10B430000121029AC007917706D08820005DFFF7AE +:10B4400055FEE88FC00702D102990120C877019606 +:10B45000A88EE98E40182988401A80B205E0226E35 +:10B460000199891A0901090901910146401E80B21A +:10B470000029F4D1E88F800701D5606E01E0206ECD +:10B4800080000390C6E00296E88F0690C00764D063 +:10B49000002004902A20285E0090E16C701A0101BF +:10B4A000124809090289688E101848431921890138 +:10B4B00006F0A2F8470006984037800705D401201F +:10B4C0000490A88D0B494843C719A878012807D1D3 +:10B4D00020462030817F002902D0C07F002811D073 +:10B4E0000498002813D018E06091002050910020AB +:10B4F00090D0030071020000808100208083002032 +:10B50000FF7F0000A08FFD494843C71905E0FB49B4 +:10B51000206E48434008B84270D979080491F74931 +:10B52000049806F069F80299091A090109090291BB +:10B53000F24948430499091A0098401A009008D526 +:10B540000298EE49401E0001000902900098401840 +:10B550000090A060A06DC119216102986060204632 +:10B5600000F015FF002860D0A07D401CA075206E63 +:10B5700080190601E88E3609401C81B2E986A87858 +:10B58000012847D1204620300290C07F002841D1B9 +:10B59000A88E40182988401A81B2D948814239D2F0 +:10B5A0000298807F002821D1208F80190601E88F22 +:10B5B0003609C10704D0A18F490889190E0136093F +:10B5C000226B2266618FE985626B6266C00703D0D9 +:10B5D0008820005DFFF78AFD029901208877616E5F +:10B5E0000391E98FC90701D10299C8770196A88E06 +:10B5F000E98E40182988401A80B206E012E0226ED7 +:10B600000199891A0901090901910146401E80B278 +:10B610000029F4D10198301A0101039809098142E7 +:10B6200000D230E7059800280CD000208921085569 +:10B630006664E88FC00703D0009828853C37A7646C +:10B640000BB0F0BDE88F800701D5082100E03E2156 +:10B650000898FFF7ECFDF3E7F0B5AA4980000D5814 +:10B6600087B0E86A002808D1686AE862002804D038 +:10B67000C0888105890D7C2041532C464034E08FE1 +:10B68000EE6AC00609D5002E07D0A08F002802D18F +:10B690003068002801D0012000E000200290298CB1 +:10B6A000014318D02F468037387B042815D1F87A0B +:10B6B0000421C01C05F0A0FF387A8000081800069D +:10B6C000010D91480818018FC90B04D1428F102138 +:10B6D0008A430A43428707B0F0BD04900428FAD297 +:10B6E000288C002807D0698C0390032001900091DA +:10B6F000002028842DE002980028ECD0A08F00289C +:10B7000008D13068002805D00646E862C088800568 +:10B71000800DA087F088B1888205920D8A18A18FCC +:10B72000521A92B203928204920F012A00D002228E +:10B730000192BA79914200D3114600910321090385 +:10B740008843012109034018F080A08F0099401A16 +:10B75000A087387A82000292F87A1118C9B205914E +:10B760000421C01C05F048FF029A8818C2B2E08F7D +:10B77000C10609D5002E07D0A18F002902D131685A +:10B78000002901D0012100E000210291410603D5EA +:10B790000099091D89B2009181040DD402990029F4 +:10B7A00008D1C00708D00198032803D05748C07AB1 +:10B7B000C00701D0012000E00020059B00999C46B5 +:10B7C00009020001019B01431943634618014E4BD6 +:10B7D000C018418703998187E18F890409D4110139 +:10B7E000C9180A8FD20B04D14B8F102293431343F5 +:10B7F0004B87018F4904490C0187F87A0421401CCA +:10B8000005F0FAFEF972387B401C38730498401C2E +:10B81000C0B262E7FEB505007ED02E468036377A8C +:10B8200000202C46403401970290A08EE18E4018F3 +:10B83000A086019F70214F433549791800910886F1 +:10B84000E08FFF2101318843E087800516D5E08E27 +:10B85000F1794843618F4018252105F0CDFE08B2EB +:10B86000002801DA253000B2294AC1B2403ABB189B +:10B870001A8D920992010A431A8560870020E0869A +:10B88000E08FC0071BD0A86C2249401C40088842AA +:10B890000CD91A494A1E801805F0AEFE0121C903D1 +:10B8A00001431B4840383818C18508E0C103012016 +:10B8B000C00308181649000C40397918C885A178CA +:10B8C000002941D0A08E2288801A0D4A80B2904271 +:10B8D0003AD22846203002290CD1009A298E518074 +:10B8E000009A698E91800099027DCB885B095B018B +:10B8F0001343CB80A17803291ED10EE07102000012 +:10B90000FF7F000060910020808300205091002084 +:10B9100080810020FF3F000029E0FF49427C791828 +:10B92000CB8A0C27BB4392001343CB82027CCB8A89 +:10B930009B089B001343CB82A178012902D1C07FD1 +:10B94000002801D0012002900020019B00901A469F +:10B95000F249284600F042FE707A022801D0012008 +:10B9600070720298002802D0307AFFF7B4FCFEBD56 +:10B9700010B5040015D008F0E9F80146226E606C9D +:10B98000801800010009606420464030C28E521CBD +:10B99000C286A07D0022401CA0758034207AFFF76B +:10B9A000D4FC10BDF1B500988100DD484458214613 +:10B9B0008031487A00282AD125464035E88FC007D3 +:10B9C00025D0087C002822D0274608F0BFF8616CFB +:10B9D0000646881B0001216E0009884217D9002104 +:10B9E000384600F0CDFD216E06E0401A0001000946 +:10B9F0006064E88E401EE886606C821B12011209AA +:10BA00008A42F2D8002231460098FFF79EFCF8BD2A +:10BA1000F3B587B00798C24E8700F0590C250C4645 +:10BA200000287DD10021942007F0A6FDF0510028C8 +:10BA300076D007460020029008F088F80590079815 +:10BA400094220490B74B002138469847B648F861D5 +:10BA5000B648B8610320F87500211020B960B875A8 +:10BA60004002B8823E46803607983D4630724035E7 +:10BA7000E88F420820785200002800D001200243BD +:10BA8000012080028243EA870020A886E886688732 +:10BA900020462030039000798000A885608C8100CA +:10BAA000F9652089810039666089E885A0894101AE +:10BAB000796603984079F071A07BF8F779FC688685 +:10BAC000E88F10210843E88700213173B172F172C9 +:10BAD0003984F962A9871B22FF21328049317180A4 +:10BAE000B180B27103998979717303998979B173BE +:10BAF0000021F173C00702D0307AFFF7F7FA2178FE +:10BB0000049800297ED0032170225043824A0346C4 +:10BB1000801800900190018203981121807900E043 +:10BB2000E6E009028200114301430198C1820498B2 +:10BB3000010220200143019841820198218AC1839A +:10BB40000198618A0184A17E607E09020143019807 +:10BB500041840198E17E828C120A12020A43828497 +:10BB6000E07B002800D00120F1790122D2034003BC +:10BB7000C9060243C80C024301980285664A0021A7 +:10BB80004032981804900187E98F10158143E07BBB +:10BB900000286CD0002040020143E987019906206B +:10BBA00048850798FFF7F9FA04997C2008810499E1 +:10BBB000002048810146019A1E20D085049AA08A5F +:10BBC0005080049AE08A9080049A207ED080019868 +:10BBD00041870198C28ED209D201C2860198828D16 +:10BBE00052085200828500200190307A019980002D +:10BBF00004904018C0B20690481C042105F0FCFCDB +:10BC0000049800E031E0081801060A0D7721C90008 +:10BC100051188A080121C9030698114302014448BA +:10BC2000101801870021418781870198401C0190ED +:10BC30000428DADB307A81017720C00008180099E7 +:10BC400080088886EB8FD80713D00399E0698A793A +:10BC5000FF215931D140228C083149005118354C0F +:10BC600089B28446624202910FE002214CE7012032 +:10BC700091E7E1690020F9646885E06913E009193A +:10BC8000401C89B20001000902919142F7D261463D +:10BC9000F96402996985F96D001D0818A98D490894 +:10BCA000081800010009F96C396579657864D807CE +:10BCB00000D00298D90700B2288504D01D4AA98D6A +:10BCC0005242514300E03C21B964D90700D1002021 +:10BCD000B860002205990798FFF737FB0020009015 +:10BCE000388A317A83B204203A6E00F026FF0025AC +:10BCF000284609B0F0BD70B505460C22EFF310845C +:10BD000072B683000648C058002826D0034680300B +:10BD1000427A002A13D00FE0408100203F400118F2 +:10BD200060910020750F000071B9001815B8001857 +:10BD3000808300208FFDFFFF012A0DD10AE000293A +:10BD400008D00021184600F01BFC16212846FFF7FA +:10BD50006EFA01E002214172002284F3108810463D +:10BD600070BD70B505460C20EFF3108472B6AE00BE +:10BD7000ED4B9B59002B0DD01A8459844033D88F3A +:10BD800008210843D8872846FFF766FC2846FFF7B6 +:10BD900009FE002084F3108870BD70B5054684004C +:10BDA000E2480C23005900282FD040300278D243BB +:10BDB00092072AD0CA88960522D0C678002E04D0D1 +:10BDC0009E02B243CA800022C270EFF3108672B6A0 +:10BDD000D5480059002810D00446243007F0A6FAB0 +:10BDE00020464030C18F08221143C1872846FFF703 +:10BDF00033FC2846FFF7D6FD002386F3108804E0C5 +:10BE00009104890F01D10121C170184670BD70B530 +:10BE100006460C20EFF3108572B6B300C24AD25822 +:10BE2000002A14D014464032D08F102398430B01BF +:10BE30001843D087002909D03046FFF70DFC803425 +:10BE4000207B002802D03046FFF7ACFD002085F3B0 +:10BE5000108870BDF0B504460C20EFF31086079FE4 +:10BE600072B6A500B04C6459002C16D0254640355A +:10BE7000A87800280DD10120A8702F808800A08705 +:10BE800090002087980020630598608706984001FD +:10BE9000606300202034A077E07786F31088F0BD3F +:10BEA00070B50C24EFF3108572B683009E48C0581D +:10BEB00000280CD0034640339E78002E07D1022480 +:10BEC0009C701A8005229A4B30309847002485F3E5 +:10BED0001088204670BDF8B507460C20EFF3108699 +:10BEE00072B6BD00904C6559002D0DD02C468034A3 +:10BEF00022806180A3803846FFF74FF9A17B384646 +:10BF00002A6EFFF71CF9002086F31088F8BDF8B5FB +:10BF100094460C27EFF3108672B68400824A1459B7 +:10BF2000002C14D025464035AA78002A0FD10322D0 +:10BF3000AA702B80224620321174634653748E22DD +:10BF4000125D8A4202D9226EFFF7F9F8002786F3C4 +:10BF500010883846F8BD70B505460C20EFF3108404 +:10BF600072B6AB00704AD358002B0AD004290BD00C +:10BF70008E20C05C884203D91A6E2846FFF7DFF88E +:10BF8000002084F3108870BD1A6E8033997BF4E72B +:10BF900001460020EFF3108272B68B006249C95847 +:10BFA000002901D04031888E82F310887047F8B59F +:10BFB00000259C462E462C46EFF3108772B6830070 +:10BFC0005948C058002807D0034640339C8EDB8E6A +:10BFD000466CE318056E9CB287F310880123601A43 +:10BFE000DB03984200DC081B910400B20C0C684390 +:10BFF000614680194900401A00010009214605F0F8 +:10C00000FBFA601AA04200D100204A494843401C74 +:10C010004010F8BD10B5444A8300D258002A10D011 +:10C0200070235843444BC018438A0424A3438C0014 +:10C03000234343824032D08F4023984389010843F1 +:10C04000D08710BD10B5384A8300D258002A10D0CE +:10C0500070235843384BC018438A0224A3434C0032 +:10C06000234343824032D08F202398434901084321 +:10C07000D08710BDF0B52C4C8300E358002B2ED098 +:10C080002D4F7023002458434037C3199C84DC840F +:10C090001C855C859C85DC85234615196E782D787A +:10C0A00036022E435D004519ED19AE83A41C5B1CBE +:10C0B000DBB2E4B2042BF0D300220F23CC18257896 +:10C0C0001D3C247F2D0225436CBA55004519ED19FE +:10C0D000AC819B1E521CD2B2DBB2082AEED3F0BD5B +:10C0E00001460020EFF3108272B68B000E49C9584A +:10C0F000002901D08F20085682F31088704710B5B0 +:10C1000001460020EFF3108472B68A000649895870 +:10C11000002906D0086D096E4008490805F06CFA40 +:10C1200088B284F3108810BD6091002090920020A6 +:10C13000190F0000710200004081002072B6BFF3A9 +:10C140004F8F04490248C860BFF34F8FFEE70000DD +:10C150000400FA0500ED00E0F3B581B00F46486831 +:10C1600001994968421A140101222409D206944215 +:10C1700003D9081A0001000944420198BD68866885 +:10C18000002C02DC28D1AE4226D20069FA493018D0 +:10C19000451B281E04DD681E05F044FA201A03E042 +:10C1A00005F040FA201A401C002801DD0020FEBDE9 +:10C1B0003869F149281A002804DD401E05F032FADA +:10C1C000201A03E005F02EFA201A401C002801DD99 +:10C1D0000120FEBD0220FEBD3F69E749E819801B32 +:10C1E000002805DD401E05F01DFA0019401C02E084 +:10C1F00005F018FA0019002801DC0520FEBD0198A1 +:10C20000DD4900693018401BC01B002804DD401EBA +:10C2100005F008FA201A03E005F004FA201A401C81 +:10C22000002801DD0320FEBD0420FEBDF1B584B071 +:10C23000D24800900027046857E0A08A2268810550 +:10C24000890E0292820B4ED000294CD0002201921E +:10C250001646A27D03071B0FD2180901049D103951 +:10C26000A2758905890D3F22120190430143A182E5 +:10C2700034E029462046FFF76FFF002830D005281C +:10C280002AD02969A8684618BB49304605F0B4F998 +:10C2900001466868B84B40185943A268711A8A422F +:10C2A00000D2401C060136096660A08A800B022875 +:10C2B00012D3B149206905F09FF9E1680346881B54 +:10C2C000000101220009D206904203D9701A000130 +:10C2D00000094042834206DC2E462D68002DC8D15D +:10C2E0000198002817D02746029C002CA5D1009861 +:10C2F000006800280DD0082105200007016282692E +:10C300008A430A43826101680122D20691431143A4 +:10C31000016005B0F0BD22463946009807F048F8A4 +:10C320009648224631460C3807F08EF8DCE7FEB519 +:10C3300092480C380068002826D0C27D4168876882 +:10C34000891A0E013609684607F00BFC019D8A48E0 +:10C35000FF359135009C854204D340422D18641C62 +:10C3600024012409301B000101210009C90688426B +:10C3700003D2B44203D1AF4201D826462F463946F4 +:10C38000304607F00EFBFEBD0021481EF9E7F0B570 +:10C3900005467A4887B00C38059000200646019083 +:10C3A000009007460290EFF31080069072B603A843 +:10C3B00007F0D7FBE97D03987D224018049900011E +:10C3C000D2006D4B000989185B4203E0C918401C7C +:10C3D00000010009684A9142F8D26A68131A1C01E8 +:10C3E00001232409DB069C4204D282420DD1AA68B3 +:10C3F00091420AD9AA8A920B1FD06860AA688A4221 +:10C4000003D2401C000100096860A88A800B022842 +:10C4100016D35949286905F0EFF8EA6869680446B7 +:10C42000501A000101230009DB06984203D9881A3B +:10C43000000100094042844202DD0120029094E0A4 +:10C440004E480C388468002C67D10598046864E075 +:10C4500021462846FFF780FE002860D0052839D005 +:10C46000A97DA27D91420FD9444B0C3B9B68A3420E +:10C470000AD0002E00D126467F1CFFB2009401286E +:10C480004DD003284BD025E0AB8A9B0B17D02169F8 +:10C49000A06846183849304605F0AEF80146606895 +:10C4A000354B40185943AA68711A8A4200D2401C81 +:10C4B0000001000900266860374600960AE09142B4 +:10C4C000BBD92E490C398968A142B6D1032826D0A0 +:10C4D0000428B2D1A88A800B022815D326492869DE +:10C4E00005F08AF80346E86869688446401A000146 +:10C4F00001220009D206904204D96046081A0001C0 +:10C5000000094042834298DC1C480C388068A042F5 +:10C510009BD0002F00D101942468002C98D1029860 +:10C52000002822D1002E0AD01448009A0C38019914 +:10C5300006F04BFF31461148009A06F002FF0198C1 +:10C54000002806D001460D482A460C3806F07CFF2C +:10C5500006E00A4829460C3806F0FEFEFFF7E7FE23 +:10C56000002E02D02846FFF761FE069880F310885F +:10C57000029807B0F0BD000071020000C4910020D5 +:10C5800070B504460026EFF3108572B600281FD060 +:10C5900011488268A24202D10021816018E000297E +:10C5A00016D10068A04205D10B4806F0DCFEFFF76B +:10C5B000BEFE0DE02146084806F0DFFE002807D148 +:10C5C000054821460C3006F0D8FE002800D102268E +:10C5D00085F31088304670BDB8910020FFB5394D05 +:10C5E0000646EC7CA87C81B0201A0007000F8C4620 +:10C5F0000E2801D3012000E000200090314AA00065 +:10C60000803A811877680F64111980310B70614688 +:10C6100011500120298AA040014329822A49220180 +:10C62000B0885718788070680001000DB880308994 +:10C6300027210901081AF88024493069884208D95D +:10C640002349401804F0D8FF0121C903014379812F +:10C6500005E0C1030120C0030818000C78810A9886 +:10C660001F211F2800D308460002B881F8891F2126 +:10C67000090288430F2109020843F88103987021B9 +:10C680004843FF30513080083881B07D1F211F287A +:10C6900000D308460099C0028902022208431043D1 +:10C6A000388090070B4920430860E87C401C000755 +:10C6B000000FE8740848018820221143018005B06A +:10C6C000F0BD00004C92002000800020FF7F0000A1 +:10C6D0007102000000010050F08F0020FFB58FB004 +:10C6E000064611981F46304363D0012E01D1002F1A +:10C6F0005FD000200690012E04D011988068002E93 +:10C7000002D006E07868FAE71099002901D0119864 +:10C71000C0680890012E0AD01198008A0990012E55 +:10C7200007D01198C07C002803D0012002E0B8890E +:10C73000F4E70020009007F009FA0001C00F019013 +:10C74000D04800218160D0488079002815D0019818 +:10C75000002812D1CB4804680DE0A58801202946A5 +:10C76000000704F049FF681AE1884018294604F0E0 +:10C7700059FFE1802468002CEFD1C34901988871EA +:10C78000012E14D011984069019008980D900198DD +:10C7900000280ED00D9800280BD0012E0CD0009848 +:10C7A00000280BD00125B7480468059482E038685A +:10C7B000EAE7012013B0F0BDBD68F4E70025F2E719 +:10C7C000002E04D11098002801D0678900E0278945 +:10C7D000A088029000286CD0002F6AD0A189099807 +:10C7E000814266D001990298884200D3084604909D +:10C7F0000D9839180498814201D90320DAE7E088BE +:10C80000049904F0F9FECF1907917F1E049901984D +:10C8100004F0F2FE00294CD10499029804F0ECFED9 +:10C82000002946D12846049904F0E6FE0D980A91A5 +:10C830000818401E03900798814201D3B9421ED9BF +:10C8400007990398884201D3B84218D90A988842B8 +:10C8500002D80398B84212D20498874206D3014600 +:10C86000384604F0C9FE0A98814208D20499039818 +:10C8700088421ED304F0C0FE0798814219D3012ECE +:10C8800004D0781C049904F0B7FE05E07D48019DB2 +:10C8900084600CE004980918A942FBD900980D4661 +:10C8A000A84303D100988143C80700D06D1C059CA4 +:10C8B00000E02468002C02D00198854280D30198C2 +:10C8C000854202D3032006903DE0002E3BD1119813 +:10C8D0008561119846690898019500901198AD19E5 +:10C8E000008A03906D1E059C25E0A1890398814272 +:10C8F00020D0A0880290B04201D3374600E007461E +:10C900003946304604F078FE002913D139460298A2 +:10C9100004F072FE00290DD1E088394604F06CFE67 +:10C9200000E0C91901988142FBD90098081AA84271 +:10C9300000D205462468002CD7D13146284604F0A1 +:10C940005BFE1198C161069834E71FB504468088E4 +:10C95000009020890190A08969468881E0880022A2 +:10C9600002906B4611460120FFF7B8FE032819D14B +:10C9700044488068002815D0E17B002902D1C27BA1 +:10C98000002A0FD0002901D0224600E002460029EB +:10C9900005D0C37B002B02D0994200D20246908979 +:10C9A000FDF78DFF2146374806F0C0FC1FBD10B5CE +:10C9B0000146344806F0E1FC10BDFEB5044640686F +:10C9C00000906061216800980291814242D2002566 +:10C9D000ED432E4600212B4809E08289238A9A42A2 +:10C9E00005D0491C8288C9B2B24200D216460068FE +:10C9F0000028F2D1002908D00098B0420FD3314668 +:10CA000004F0FAFD704305461DE0A67C002E1AD006 +:10CA10003146009804F0F0FD3546454313E00746E3 +:10CA20000020019009E03946304604F0E5FD002978 +:10CA300002D101203D460190BF1E0298B84202D8A3 +:10CA400001980028EFD00298A84203D80098A84285 +:10CA500000D365610023224601211846FFF73EFE00 +:10CA6000002809D0E268A168914205D2002322463D +:10CA700019461846FFF732FEFEBD00220346114656 +:10CA800001202BE660920020C0920020F8B53E48BD +:10CA90003C4981800021C94301603C48384F4668C9 +:10CAA0001DE0304606F027FD1F210D1A3748A9006A +:10CAB00009188C68002C0FD069000818008B3449C5 +:10CAC00004F09AFD201A84B2022C01D9A41EA4B24B +:10CAD000A74200D23C46A7B20120A8408643002EC0 +:10CAE000DFD1294A2A4990884F43B84200D33846BB +:10CAF000908026480068411C0AD011684B1C06D063 +:10CB0000091A090101230909DB06994200D31060C3 +:10CB1000F8BD022801D11D480160B7E710B5022811 +:10CB200002D11A49C01E0860FFF7B0FF164800681E +:10CB3000401C01D101F0EEFE10BD30B4032801D03D +:10CB400004280BD111488C002418A2604A00121846 +:10CB50001383012342688B401A43426030BC95E73F +:10CB6000032801D0042809D108488B0000221B1893 +:10CB70009A60012342688B409A43426086E7000036 +:10CB8000FFFF0000E4570000C09200206C920020DC +:10CB900071020000F7B50098164605020F46002402 +:10CBA000681D06F010FE4322102811D00099BB002A +:10CBB0008A00F8498958CA58B2421CD00122BA40AA +:10CBC000024201D0022408E0C88DC00607D54322E6 +:10CBD000334639460098FAF72FFA2046FEBDCE506C +:10CBE0000124D6B2681D06F0EEFD30430146681DF3 +:10CBF00006F0BEFDF1E70124EFE7FEB5100A0C4692 +:10CC00000A4601210090FFF7C5FF029001287AD162 +:10CC10002178204605260C30F602DF4D01900B00EE +:10CC200004F0C2FD107109471A713A3A5365685E03 +:10CC3000A7D9BD71FE716088FF2201461739EA321B +:10CC4000D64C914200D8A083042202210098FAF722 +:10CC5000DAFB0146A08B8AE06078022815D010220A +:10CC6000062108320098FAF7CEFBA1884180E188BE +:10CC70008180C6806278214608310746042A06D0A2 +:10CC800038460830A8473946E1E00222E8E738464E +:10CC90000830FAF712FDF6E7082211460098FAF775 +:10CCA000B2FB0146A0884880E0888880BC4ACA80E0 +:10CCB000CDE0082210210098FAF7A5FB0146A088D4 +:10CCC0004880E0888880CE80C1E006220421009858 +:10CCD000FAF799FB0146A0884880E0888880B6E092 +:10CCE0000098AC4980000858806800280CD0E08883 +:10CCF000002835D006220C210098FAF784FB014663 +:10CD0000E088888032E0C1E0A188E088814201D9D2 +:10CD10004022B7E0207A102805D0042803D002284A +:10CD200001D05122AEE0022810D010220821921D1D +:10CD30000098FAF768FBA1884180E1888180227A17 +:10CD4000214609310646042A02D005E00222EDE719 +:10CD5000B01DFAF7B2FC01E0B01D76E0314676E096 +:10CD600004220A210098FAF74EFB0146A088488069 +:10CD70006DE060780E214200921C0098FAF743FBA8 +:10CD80000146002207E09000001953005B188088DC +:10CD9000521C588092B260789042F4D857E02646F0 +:10CDA00024890098FAF7E1F9C01E844200D2204697 +:10CDB00087B2381D82B252210098FAF724FB04464C +:10CDC000B08860803A46201D0199A847204608385F +:10CDD00006F0ABFC5AE06078002809D00098FAF71A +:10CDE000C4F92189C01E884202DBE088002820D0D7 +:10CDF0006189208981422ED2461A0098FAF7B5F946 +:10CE0000401F864200D2304687B2B81D82B216213A +:10CE10000098FAF7F8FA0646A0887080E08800E0EB +:10CE200036E061893A464018B08061890198091856 +:10CE300092E7091D8AB212210098FAF7E4FA064631 +:10CE4000A08870802289301D0199A84786E7009844 +:10CE500003F013F91AE06278002A0ED0022218219A +:10CE60000098FAF7D0FA014660892289904201D1F0 +:10CE7000012000E000204870E9E7814201D1002252 +:10CE800000E0522201210098FAF703F90298FEBD52 +:10CE9000022218210098FAF7B6FA01466078EAE70C +:10CEA00010B51046140A06F08EFC102802D0204659 +:10CEB00003F0DAF8002010BD70B5150A0E460A46D8 +:10CEC00000212846FFF766FE0446012816D13148A6 +:10CED000A9004058806A002806D04088B18888425E +:10CEE00002D12846FAF7A4FD31462846FAF736FE65 +:10CEF000020003D000212846FAF7CBF8204670BD87 +:10CF0000F8B515460C460027104606F05CFC1028C4 +:10CF10006CD0280A1F4E8500009073598446186A09 +:10CF2000002801D0017D00E000212278402A04D0B1 +:10CF3000412A0ED0422A59D146E0002956D0986A9B +:10CF4000002802D00C3806F071FB7059012784626A +:10CF500049E0122906D0182910D0522907D0D22929 +:10CF600023D104E0627861886046FAF754FE705974 +:10CF7000203006F0F8F906F059FB13E06378002B37 +:10CF800010D0628818216046FAF736FE0098FAF74A +:10CF900017FEECE7B4900020190F00006490002009 +:10CFA000032800000098FBF7FAFB607800281DD1E9 +:10CFB0007059806A002819D040886188884215D14C +:10CFC0000098FAF735FD11E016290FD16378002B90 +:10CFD0000ED062886046FAF70FFE7059203006F0D6 +:10CFE000C2F906F023FB0098FBF7D9FB3846F8BDE1 +:10CFF000A1880122D20311434182F4E7FFB581B039 +:10D000001746104606F0DFFB3D0A102821D02F4EB0 +:10D01000AC003059C08DC00606D42D483A460059A0 +:10D02000C1892C4806F092FB30591022C18D114362 +:10D03000C185152101988901401A02D0012808D123 +:10D0400002E04522012101E0452200212846FAF7AD +:10D0500020F8002005B0F0BD70B516460D4610460C +:10D0600006F0B1FB0024102825D02878360A0028C5 +:10D0700004D0342812D03F2810D024E0294630466E +:10D08000FBF7BCFB0446FF281DD12946304603F0C0 +:10D090008DFC0446FF2816D1002414E0297A4A06A4 +:10D0A00011D43F2805D0042300223046FAF7A4FD0E +:10D0B00009E00623F8E72878002804D168880028CA +:10D0C00001D006F08FF8204670BD0000B49000201B +:10D0D0008C9000201B05000030B504460120F84D5F +:10D0E00000218A0052199268002A09D0537B022B32 +:10D0F00001D0012B04D1527CA24201D0002030BDCE +:10D10000491CC9B20429ECD330BD10B5F9F74DFD67 +:10D11000EB4C002291000919896800290DD0CB7BC6 +:10D12000032B0AD14B7B002B02D0022B03D004E04F +:10D13000097C890601D5401CC0B2521C042AE9DBD7 +:10D14000032801D3012010BD002010BD70B50E468C +:10D1500005460021304606F00FFA04000AD0D94BEC +:10D1600032460021984725730020E073D449A80077 +:10D1700040188460204670BD30B50023D04C0AE0D2 +:10D18000820012199268002A04D0D57B8D4201D109 +:10D19000134602E0401C0428F2DB184630BD01466D +:10D1A0000120002904D1C64820300079C007C00FF3 +:10D1B000704770B50D00044607D0007B00F074F98D +:10D1C00029460120F9F790FC70BDA18A03230622AD +:10D1D000BD4806F091FA217B0170617B417006F039 +:10D1E000A4FAB74820300079C007C00F0ED0B44968 +:10D1F00020461630B34B06221E3106465C3B98474C +:10D20000607B002805D0304603F027FC0120E07346 +:10D21000D6E7207B314603F06CFCF7E770B5044697 +:10D220000D460120F9F760FC002D01D0012003E03C +:10D23000E07B022801D10320E07370BD70B50D467C +:10D240000446818AA04804230622401C06F054FAB2 +:10D25000217B0170617B4170857006F066FAE07B8E +:10D26000042819D1964900204968002900D008787F +:10D27000A52802D0A62805D00EE000210120F9F74C +:10D2800033FC09E0207B0321401CC0B2FFF774FF90 +:10D290000028F2D0416888470120E07370BD10B5C6 +:10D2A0008749044649680020002900D00878A7284B +:10D2B0000CD0A8280ED1207B0121401CC0B2FFF762 +:10D2C0005BFF002802D08168884703E0002101202D +:10D2D000F9F70AFC207B00F0E7F810BDFFB581B03C +:10D2E0000D460120F9F7E2FB009001287BD1297857 +:10D2F00000260846A43834460427714A030004F087 +:10D3000053FA050425313A4A57006878294604281B +:10D3100061D2800080188768002F04D0F87B012834 +:10D3200003D0032804D0432456E00220F87305E01C +:10D33000787B0028F7D1B87B0028F4D13A683846CA +:10D340009047040048D00120F87345E0687804282D +:10D3500041D28000801880680028E4D0C17B032976 +:10D36000E1D105E003210020FFF706FF00281DD0D2 +:10D37000C77341680DE0687804282CD280008018BB +:10D380008068002812D0C17B0129CCD10521C1734E +:10D390008168884720E003210020FFF7EDFE002888 +:10D3A000C1D10121FFF7E8FE0028EFD1012613E0EB +:10D3B00004200024A3009B189B68002B16D0641C3B +:10D3C000E4B2042CF6D3042812D0A02912D0A1294B +:10D3D00016D0A2291AD040242046304303D021463B +:10D3E0000120F9F781FB009805B0F0BD2046EAE77F +:10D3F0004B24F1E769782B1D049A02F038FA03E018 +:10D400006978049A02F0F2FB0446E5E76978049A29 +:10D4100002F04FFDF8E710B502462B480C460123F9 +:10D420000621401F06F068F9047006F07EF910BD71 +:10D4300010B5084600781946002800D09030204BDF +:10D44000C2B2586800281DD0007800281AD01846AB +:10D45000203040798000C0188068448A8C4211D105 +:10D4600000234382437B002B04D0012B05D0022BE9 +:10D4700008D105E002F059FA04E002F0E1FB01E016 +:10D4800002F07FFD002010BD10B514460246FF20BB +:10D49000002903D121461046F9F744FB21780029E1 +:10D4A00001D102F031FD10BD810010B504480C1807 +:10D4B000A068002801D006F0B9F80020A06010BDD7 +:10D4C00064900020750F0000A4060000F7B582B03C +:10D4D00016460546F9F79DFC04020090E01D06F093 +:10D4E00072F93F2823D000988700C248C05981892B +:10D4F000FF2900D1C189E21D0423BF4806F0FCF8D2 +:10D500000580867006F011F9BA48C0598289FF2A51 +:10D5100008D00398002800D09030C3B201210098B1 +:10D52000F9F786FB324629460098F9F726FB05B045 +:10D53000F0BDF8B516460D46F9F76BFC0746040238 +:10D54000E01D06F040F93F2812D0B800A94900902C +:10D5500008580068002806D00278032A03D1002D5D +:10D5600007D09035EDB22A4600213846F9F771FB15 +:10D57000F8BD0C380189A048E21D0623001D06F005 +:10D58000BBF8044630782071B088608070882080B5 +:10D59000204606F0CAF820790628E4D89549009874 +:10D5A000FD2208584030417D11404175DBE7F7B559 +:10D5B0000C46F9F72EFC06460502E81D06F003F9B5 +:10D5C0003F283DD08B4AB700D1590868002832D097 +:10D5D0000378042B2FD1002C0DD090344031887962 +:10D5E000E4B2800627D5A12C21D01CDC912C1ED0C2 +:10D5F0009C2C20D11BE00C380189E120EA1D082376 +:10D60000C00006F079F8054602987C4B017879480D +:10D61000C05940304175082228460299984728464B +:10D6200006F083F807E0A92C01D0AA2C03D1487D8D +:10D63000FD2210404875224600213046F9F709FBCB +:10D64000FEBDF8B50C460546F9F7E3FB06460702B2 +:10D65000F81D06F0B8F83F280DD06649B00008580C +:10D66000FA1DC18964480423401E06F045F8058070 +:10D67000847006F05AF8F8BDFFB581B00F46F9F78F +:10D68000C8FB05460602F01D06F09DF83F281FD096 +:10D690003C469034574A3946112F0BD006DC0029FE +:10D6A0001DD0012906D00C2F2AD103E0192901D061 +:10D6B0001A2F25D1A9005058403083799B061FD5D9 +:10D6C000437DFD24234043755058806806F02DF8B3 +:10D6D0002DE7E2B202212846F9F7BBFA27E7A800B6 +:10D6E0001058F21DC189444806230E3006F004F894 +:10D6F00003990180049941800A99818006F015F808 +:10D70000002FE6D10024E4E7FFB581B015460E46B0 +:10D71000F9F77FFB04460702F81D06F054F83F288E +:10D7200018D03548FA1DF91D0E230B3005F0E4FF23 +:10D730003049A2008958022340314A7D1A434A7574 +:10D7400009210170858046800499C1800A99018170 +:10D7500005F0EBFFEBE6FFB581B01C461546F9F787 +:10D7600058FB06460702F81D06F02DF83F2811D099 +:10D770002049B0000858FA1DC1891F4808232930E4 +:10D7800005F0BAFF0A998180C48005800299418022 +:10D7900005F0CBFFCBE6FFB581B00D46F9F739FBBD +:10D7A00004460702F81D06F00EF83F2821D0114E5E +:10D7B000002D0ED1A0003058FA1DC189732002231C +:10D7C000000105F099FF049941700399017005F07B +:10D7D000ACFFA0003058806800280AD000781728D5 +:10D7E00007D1002D00D09035EAB202212046F9F78A +:10D7F00030FA9CE68C90002003070000190F00000F +:10D8000070B50124094D8440288800290BD020429E +:10D8100005D16888002802D0062006F07DF8288807 +:10D820002043288070BDA043FBE700008C920020BD +:10D83000FFB583B00D46044600210C980193271DC7 +:10D840008E4B0091002814D026887C207C2E00D995 +:10D85000064628883246C1190198984705980680DF +:10D860002888801928802088801B2080009807B095 +:10D87000F0BD6188207904290AD18149C140C907D6 +:10D8800006D10121298078702088401E20807F1CCD +:10D890007C482188808B884202D231200090E6E7C4 +:10D8A000764B0422214601989847019826887821D2 +:10D8B000001D782E00D90E46704B324639469847E7 +:10D8C0000599301D0880CBE7FEB51D460023019366 +:10D8D0006D4B800014461B580A9A081D099E009043 +:10D8E000022A21D10879012222804A88042A08D1FB +:10D8F000634AC240D00704D1022020800888401C1F +:10D900000880587C1946401FC7B2228800981731FA +:10D9100010185A4B3A469847781C2988C0B2081A02 +:10D9200028802088C0192080002E12D02888B0427C +:10D930000DD321880098514B081832460899984712 +:10D940002088801920802888801B288001E03420CE +:10D9500001900198FEBDF8B506464B4980000C5871 +:10D960000025A068002806D0342101730C3005F092 +:10D97000DCFEA56011E0207C617C88420DD2042889 +:10D980000BD3A28A101F022807D80095A37D34214B +:10D990003046F9F74AFD05F0C8FE2574042060748E +:10D9A000F8BDF7B582B0002001900F4602983649C5 +:10D9B000800016460C5821E0904214D2121A8A4276 +:10D9C00000D2114622468DB2123280182B4B2A46C5 +:10D9D00039689847207C401920743088401B30807B +:10D9E000386840193860207C042807D1608A0C21EF +:10D9F0000C2800D30846617C40186074207C627C4F +:10DA0000904202D231880029D6D1C0B2D1B2884228 +:10DA100030D1A68A658AA77D301F02281FD81948F1 +:10DA2000808BA84206D3042E06D10298F9F79DFBFD +:10DA3000A84201D2312006E0002D03D00198002831 +:10DA40001AD001E034200190002000903B4632467D +:10DA500001990298F9F7E9FC0C38A060E581A0680B +:10DA6000002807D00199002904D00C3005F05DFE94 +:10DA70000020A06005B0F0BD2846E6E7190F0000C1 +:10DA800022AA0A4364900020C090002010B50C46E2 +:10DA90000102491C0346002C11D0FF200230002A4D +:10DAA00014D0FA4A9B00D258002A0BD040239B5C2A +:10DAB000DB439B0706D0F64A05F09EFE10BDFF2013 +:10DAC0000130ECE792890A235A43F5E705F0E7FEB7 +:10DAD00010BDF8B506468700EC48C559002D28D082 +:10DAE0002C6A03E02046246805F0A0FD002CF9D143 +:10DAF0000124A0002858002802D00C3805F096FD1B +:10DB0000641E64B2002CF4DA002211463046FFF79E +:10DB1000BDFF002201213046FFF7B8FF3002FF2190 +:10DB2000401C05F025FE284605F080FDD748002161 +:10DB3000C151F8BDF8B5D54C06468700E0590D46F1 +:10DB4000002802D0FF242046F8BD0021442005F023 +:10DB500013FDE051002862D0044630020021401C31 +:10DB600005F006FE4422CB4B002120469847298928 +:10DB7000218169896181A989A18129462046C54FF2 +:10DB80000522143118305C3FB84720462830EB217D +:10DB90000170D1214170012181700821C1700021E3 +:10DBA000017141718171C1711B23FF21E3814931F1 +:10DBB00061822382A182B84926228B8FE386C98F96 +:10DBC0002187515D0838491CA175E17502216177F3 +:10DBD000B14940310A7882764978C176E08F4108B0 +:10DBE00028784900002818D000200143E187294601 +:10DBF0003046FDF70DFF04461C204643A64806228A +:10DC00004038361830461430A91CB8476878B076CA +:10DC10002878F0760920B07395E70120E5E707241E +:10DC200091E770B5994C8300E358002B1AD040332C +:10DC30001C78E543AD0715D0A508ED43AD0711D01D +:10DC4000002910D0012905D002290BD1A108890093 +:10DC5000114319701978F32421409200114319706F +:10DC600000F086F970BDA00880001043187070BDE8 +:10DC7000F8B504020646641C17460D46204605F01A +:10DC8000A2FD824AB1005158AA008F500121A9403B +:10DC90000143C9B2204605F06BFDF8BD30B47B4BA3 +:10DCA00084001B59002B10D08C001B59002B0CD06A +:10DCB0009C78002C0BD0012C0ED0022C14D0032CFD +:10DCC00003D1002A01D00220987030BC7047002A8E +:10DCD000FBD001229A7001E0002A02D0012230BC60 +:10DCE000D4E600229A70FAE7002AEED10320EBE78F +:10DCF000F8B505460002401C0F46009005F063FD94 +:10DD000006466249A8000C58002239462846FFF70B +:10DD1000C5FFBD0060590C3805F088FC002060513B +:10DD2000FF2E06D00120B84031468143009805F00F +:10DD30001FFDF8BD70B51C461546544B82009A581D +:10DD4000002A11D08B00D258002A0DD0127813006F +:10DD500003F02AFD090A060B101A1F2933380A009E +:10DD600022462946FAF7C0FF70BD22462946FBF736 +:10DD70004FFD70BD00292246294602D0FCF738FB32 +:10DD800070BDFCF760FA70BD22462946FBF725FFFF +:10DD900070BD00292246294602D0FCF7F1FF70BD74 +:10DDA000FCF720FF70BD00292246294602D0FBF770 +:10DDB00003FB70BDFBF7DFFA70BD22462946FAF778 +:10DDC000A5FE70BD2246294603F0BBFB70BD70B5B1 +:10DDD00013461C0A2D4B0A46A5005B590020FF2163 +:10DDE0001578002B0BD04026F65CF643B60706D01C +:10DDF0001968002907D0072D04D0022070BD072D17 +:10DE0000FCD200E009782B0003F0CEFC0805060ADE +:10DE10000E12161A1E05F1E72046FAF76AFF70BDCA +:10DE20002046FBF7CBFD70BD2046FCF7F2FC70BD31 +:10DE30002046FBF7D2FF70BD2046FDF7C4F870BD49 +:10DE40002046FBF772FC70BD2046FAF7AFFE70BDAE +:10DE5000100A10B5D9B20D4A8300D258002A3DD01D +:10DE600040239B5CDB439B0738D01368002B1AD000 +:10DE70001B788B4217D1032902D005292ED10DE042 +:10DE800000220421FCF7F9F828E00000909200201D +:10DE9000409C0000750F00000C910020002204211E +:10DEA000FCF76CFD1AE05268002A17D012788A42FB +:10DEB00014D1032904D0052907D008290ED109E07F +:10DEC00000220A21FCF7F3F908E000220721FCF701 +:10DED000B3FE03E00022042103F00AFB002010BD82 +:10DEE00010B5100A01222221FAF7BCFD002010BD56 +:10DEF00010B51E4B84001B59002B10D08C001B59F1 +:10DF0000002B0CD09C78002C0AD0012C0CD0022CB9 +:10DF100010D0032C03D1002A01D10020987010BD2D +:10DF2000002AFCD00320F9E7002AF8D002229A70D8 +:10DF3000002203E0002AF2D101229A70FFF7A6FD29 +:10DF400010BD0246094B92009A5800201268002A20 +:10DF500003D012788A4201D123207047032A03D0CC +:10DF6000052A01D0082AF8D12A2070479092002073 +:10DF7000F8B50746824980000D58E88F800728D4FD +:10DF800001262A4640327F4B2C6A32E01078617AB3 +:10DF90000007800F4900C9184978C140C807C00F61 +:10DFA00025D005F05AF92146774B09310090C01869 +:10DFB000764B227A9847E88F02210843E887217A36 +:10DFC0003846009AFDF7CDFE002803D0009805F0F2 +:10DFD00060F9F8BD002EFCD12846203021460546C8 +:10DFE00005F0CBF92146284605F0B6F9F8BD2468BE +:10DFF0000026002CCAD1F8BDF7B50F46009860493D +:10E0000080000E58002F1ED0002E1CD03878192802 +:10E0100019D25C4940000D5C012128460C3005F006 +:10E02000ABFA0446029860602046584B2A463946AF +:10E0300009309847304625722146203005F076F9A0 +:10E040000098FFF795FFFEBD70B50C460B460546E0 +:10E0500002220021FFF76EFE2346022201212846FC +:10E06000FFF768FE002070BD70B50C460B460546F4 +:10E0700003220021FFF75EFE2346032201212846EA +:10E08000FFF758FE002070BD10B50B46012200219D +:10E09000FFF750FE002010BD38B504280CD2384DD3 +:10E0A00084002C59002C07D02034247A04252C40DD +:10E0B00000D00124002C01D10D2907D911246D466F +:10E0C0002C70AA7069701A46694605E00D216C46ED +:10E0D000217062701A466946FFF78EFF38BDF0B5B1 +:10E0E0000C460546264980000E582188264B1822EA +:10E0F000C9188BB0254B01A898474036307869463F +:10E1000080070979800F192926D21E4B4A0066889C +:10E110009F5CBE422AD1D2185278C240D2071DD08D +:10E120008800194664390B58E28801A928469847A7 +:10E13000010009D03D2914D0684600790A460146FD +:10E1400000232846FFF7A8FF208805F04BF80BB006 +:10E15000F0BD022804D0F7E7002807D00128F8D145 +:10E160003D2101222846FAF77DFCEDE707226B46A8 +:10E170001A705970284600226946FFF73DFFE3E711 +:10E1800090920020E05A011800800020190F000032 +:10E19000F7B5164607468500FE494859002828D09D +:10E1A00004460021FEF7ECF9A08E000702D50220FC +:10E1B000FEF7B4FC0198002815D00423FF220021AB +:10E1C000F54805F099FA077000214670C170002EDD +:10E1D00005D0218F002902D02034A17E00E000214B +:10E1E000817005F0A2FAEB4C605905F01FFA00208F +:10E1F0006051FEBDF8B51F4600230D4606461C467D +:10E20000002A04D0104605F06FF883780488B10026 +:10E2100048190006020DE1481218908F568F9B1D79 +:10E22000F6B21B021E4356879487012D10D10B06B0 +:10E23000548F0421240924010C435487190D77239A +:10E24000DB00C918138F89089B0B9B030B431387B3 +:10E25000002F03D0002801D005F04BF8F8BD38B5E9 +:10E26000002817D0014620310C46CA7E416A4B1C5B +:10E2700008D04368CA4DC91AC9037023090C534317 +:10E280005B1919800C2100911346C649FEF7A6F9C7 +:10E290000120207738BD70B504003DD0A08E254602 +:10E2A00000072035002803DAA07D401CA07523E07C +:10E2B000A16A6068411A0A01E16A120949008A42AA +:10E2C0001AD3A17D491CA175A06205F043F9112163 +:10E2D00003F092F94804E97F000C002907D00028D8 +:10E2E00002D0202802D002E0012000E01F20616857 +:10E2F00008180101090961602046FEF748F8002866 +:10E300000AD0E87F002807D1606A401C04D0E87E6C +:10E310003C220121FFF73CFF70BD30B5EFF31083C5 +:10E3200072B684009B48002500593A242554028780 +:10E33000828E120704D5012241681203891804E075 +:10E34000002905D04268490151180901090901E075 +:10E350000021C94383F31088416230BDF7B586B010 +:10E3600006988C4D8600A8590C2400287ED10021E7 +:10E37000402005F001F9A851002877D005460698FD +:10E380001C214843884940180190046905F0DEFBD0 +:10E39000069A039202904022844B00212846984717 +:10E3A0008348E8618348A8610320E8750520A875C3 +:10E3B0000020A8608048A88228462030069A009055 +:10E3C0000146C276A068E8626088A886607F4877C8 +:10E3D000207F401E887708982887F0B2761CF7B215 +:10E3E00004900026607805F05FF80146A88E132897 +:10E3F0000AD004DC10280DD012280FD108E015280F +:10E4000004D01D280AD101E06C4805E00126FBE795 +:10E410000626F9E76A480226414329610498012E3D +:10E4200004D1617BC90701D0012300E00023217BD7 +:10E43000DB01CA076349520EC97A4907C90F8C46E6 +:10E440000321490219430A43614649010A43010174 +:10E45000524832430E187287217B0422C907490EA5 +:10E4600011433A0110180592049000E0F4E041874E +:10E47000A88E400716D500980621C07E4B4B484316 +:10E48000AF21C9004718504821460E3106223818DE +:10E490005C3B9847708F0321C0B2890208437087A4 +:10E4A000B7870DE001980023027D19460698FFF713 +:10E4B000A1FE01980023827D01210698FFF79AFEB4 +:10E4C000A88E410701D4800704D4308F800B8003CD +:10E4D00030870EE077210598C9004018318F8008F9 +:10E4E000890B8903014331870498018F4904490C42 +:10E4F0000187308F4004400C3087A88E28490207DE +:10E50000069870235843403946180190002A0CDAC7 +:10E51000029849144018010109090220FEF7F9FA8E +:10E520002A4881880520296100E004203082A078F3 +:10E53000400701D5002000E0A07E01020198F1848F +:10E54000214BFF308D30C0182146184B0E3106226A +:10E550005C3B9847124A0198617B801807464182CC +:10E56000A88E000702D4F120000200E01848308590 +:10E570001F2070850098C07E8006000E0101772064 +:10E58000C00008188008B0860E498888F083C888C3 +:10E5900030841FE0A092002006020000808300204B +:10E5A000808100202F430118CC900020750F0000BF +:10E5B00097E200185FE20018016000002E070000DB +:10E5C000B20500005091002000800020C092002081 +:10E5D0002780000042487084B18C5520090A090246 +:10E5E0000143B184002038817881A88EC006C00F15 +:10E5F000C00038800098807F81000143F182217B38 +:10E600000398C907C90F00022022104308437082F3 +:10E6100001982146334BFF30143106225930C0187F +:10E62000314B98476178FA88E0239A4349010A43BD +:10E63000FA80029868600020A8602846FDF7A7FECF +:10E64000002808D106AB07CBFFF767FE0099002032 +:10E6500008776868A8620024204609B0F0BD10B5AC +:10E6600003460C20EFF3108472B69A001F498958B4 +:10E6700000291ED02031087F002802D0012817D1A0 +:10E6800005E0002201211846FFF782FD10E0CA7E56 +:10E6900070235A43164B0120D218108005231B0704 +:10E6A0001868012252069043104318600220087730 +:10E6B000002084F3108810BD70B5EFF3108472B69B +:10E6C00085000A4B5B593C25ED5C002D04D02031C0 +:10E6D0005A5484F3108870BD0123FFF78BFDF8E7CF +:10E6E0005555000000800020190F0000A092002066 +:10E6F0008081002070B5FF4C00252068006800284C +:10E7000028D0014620310A7E002A02D0012A21D1D8 +:10E710000FE00021FDF734FFFEF7B8F9206800682C +:10E7200004F084FF20680560017A490849000172FD +:10E7300010E0087D70235843EF4B0122C01802807F +:10E7400005200007026801231B069A431A43026052 +:10E75000022008762068007A00280FD10223FF22C9 +:10E760000021E64804F0C8FF2168497A417005702D +:10E7700004F0DBFF206804F059FF256070BDF7B599 +:10E780008100DC4882B005686C5826462036307D12 +:10E79000009005F0DBF903990746401A00010009D3 +:10E7A000401C216A4008814201D9091A12E0FEF793 +:10E7B0006DF9D3480068411C01D0606007E0A18D6D +:10E7C000E08D081A4000C119CE4801406160002068 +:10E7D000A060E18D21620846CB494843C849898839 +:10E7E000884200D308462061C6496868491C8842AF +:10E7F0000BD86168081A000101210009C906884286 +:10E8000003D2FFF777FF05B0F0BD0498002803D1CD +:10E810000521A17561686162BC49A182F17D012079 +:10E8200000038A0010430843009B70214B43B24908 +:10E83000403959180F46C882AF49208C59180880B2 +:10E84000B07D0B2801D00A2801D1B1480881B14A16 +:10E85000206A904200D310460122D2030243FA8577 +:10E860000020C884287C800708D52946AA48FF33A1 +:10E870000A31062259331818A84B9847287CA97CDE +:10E8800082076B7CD20F002901D1800701D50120BE +:10E8900000E000201B0209010B43910000250B43FF +:10E8A0000343FB84B17D3A8A520952010A433A82FA +:10E8B0002046FDF76CFD0028A5D175776586A2E797 +:10E8C00038B500280CD004462034227D0C2100915C +:10E8D000A37E9349FDF782FEFEF7D8F8012020764B +:10E8E00038BD10B5040014D03820005D002810D1C8 +:10E8F00005F02CF9616A411A0A01A18D120949003B +:10E900008A4203D3A17D491CA17560622046FDF7B0 +:10E910003EFD10BD70B577490C200968002920D054 +:10E920000D68002D1CD03820405D002818D105F05E +:10E930000DF969680446081B000101220009D2068E +:10E94000904203D9601A0001000940423C2807DDCB +:10E9500000212846FDF714FE28466C60FDF717FDE0 +:10E96000002070BDF1B5634D0C24286886B00028E6 +:10E9700076D10021142004F0FFFD286000286FD01C +:10E98000044605F0E3F804900020039006981C214B +:10E9900048436449614F40180090142200210669E1 +:10E9A0005C372868B847B078C00733D000216420AE +:10E9B00004F0E2FD206000282CD0642205460021EE +:10E9C000B8475948E8615948A8610320E87505200F +:10E9D000A87530894C49484349498988884200D301 +:10E9E00008464A492861A982F088A8853289EA85C3 +:10E9F00028463179203000234175C3752A62837619 +:10EA0000069A027501290BD000200390207A01217B +:10EA1000084320723078C007424803D0763002E0C5 +:10EA20000120F2E7703001460290062220463B4B5F +:10EA30000A30984730782074707860740698607255 +:10EA40000025A5740098808A00280AD038494843D8 +:10EA5000491102F0D1FD049940180001000902E0BB +:10EA6000F2E00020C0436060069827688006000E30 +:10EA700000010590002F7DD001972037387D0021BF +:10EA80003977092179762B491B4B8A8870214143BC +:10EA9000403BCD188C46EA83264AD2882A84264AEF +:10EAA0006A84AB8C55221B0A1B021343AB84124BA6 +:10EAB0000022C9180091CA843178A27C8907637C3E +:10EAC000C90F002A02D1227C920701D5012200E061 +:10EAD00000221B0289000B431343EB84174929854D +:10EAE000009A00211181009A51813178C907C90F1C +:10EAF000000225E0B0920020808100200502000085 +:10EB0000C0920020FEFFFF0FE20400000160000041 +:10EB1000723E0000FF3F000000800020190F00003F +:10EB200015470118CC900020E3E80018C1E8001850 +:10EB3000204E000050910020555500002780000015 +:10EB4000202210430843688260465B4BFF30062258 +:10EB50005930C018594B0299984706206885787D2E +:10EB600001280AD00020A88600998882387F0028D2 +:10EB700012D000E039E00A200FE077210598C900A3 +:10EB800040188008A88600998882387F002801D024 +:10EB90000B2002E0092000E00820B875C0B20B2865 +:10EBA00001D00A2802D1009945480881B87D288201 +:10EBB000F87D01210903820011430143E982019894 +:10EBC0000099008C088001983E49006A884200D371 +:10EBD00008460121C9030143E985E88EC009C00147 +:10EBE000E886A88D40084000A8850398002818D022 +:10EBF000354A059803218018428F120912010A43F1 +:10EC0000428700218187418F0322C9B292021143BA +:10EC10004187018F890B89030187018F4904490CC2 +:10EC200001872B49294848622068002500280AD01E +:10EC30000499416004464162FDF7A9FB002802D116 +:10EC40003D20055565860024204607B0F0BD10B56F +:10EC50000C20EFF3108472B61E490968002902D017 +:10EC6000FFF748FD002084F3108810BDF8B519495E +:10EC700005460C680C201646002C1BD0002D0BD02E +:10EC800004F064FF074614481449684302F0B4FCDA +:10EC900038180001000901E00020C0436060002E28 +:10ECA00005D006222046054B31460A309847FFF72B +:10ECB00031FE0020F8BD000000800020190F000088 +:10ECC000723E0000FF3F0000808300200100010031 +:10ECD00000010050B0920020204E000071020000A0 +:10ECE00070B5FA4C002520680068002827D001463E +:10ECF00020314A7B002A02D0012A20D10FE00021D6 +:10ED0000FDF73EFCFDF7C2FE2068006804F08EFCB3 +:10ED100020680560C17C49084900C1740FE0087E85 +:10ED200070235843EA4B0122C018028005231B07B9 +:10ED30001868120690431043186002204873206838 +:10ED4000C17C002912D14068002809D14120042348 +:10ED5000FF22C00004F0D0FC2168097D0170C5705D +:10ED600004F0E3FC206804F061FC256070BDF7B599 +:10ED70000D46D649800009680C5804F0E7FE0646A7 +:10ED8000401B000100092546401C2035216A40082F +:10ED90002F7E814201D9091A09E0FDF777FECD489F +:10EDA0000068411C11D060600020A060618D21626C +:10EDB0000846C9494843C7498988884200D308465C +:10EDC00020610298002808D00BE0218D608D081A80 +:10EDD0004000C24980190840E5E70A21A175616831 +:10EDE0006162BF49A1820120687570204743B8481D +:10EDF000218C38180180218C0122D2030A43B449A6 +:10EE000040397918CA850026C6842046FDF7BFFA26 +:10EE1000002800D1AE75FEBDFEB504002DD0AB4874 +:10EE2000254620350068297E01916E7D0291018979 +:10EE3000408900908F003946606802F0DDFB009841 +:10EE4000791A40000818B1000831814200D93818F9 +:10EE50000299702251439E4A8008801B403A8918CB +:10EE6000C8870C200090EB7D9E492046019AFDF753 +:10EE7000B5FBFDF70BFE01206873FEBD10B5040065 +:10EE800014D02D20005D002810D104F05FFE616ACF +:10EE9000411A0A01218D120949008A4203D3A17D3A +:10EEA000491CA17560622046FDF771FA10BDF1B5ED +:10EEB00092B003200990692000010F9004F046FEF3 +:10EEC0000E9004F047FB814C070220683F0A00289F +:10EED0007DD10021442004F04FFB2060002876D033 +:10EEE00000210D9112991C2251437F4A7F4B8918B2 +:10EEF00044220D69044600219847129921756978CA +:10EF0000A176A978E176264629782036F175002188 +:10EF10003176402001556878C007734801D07630BB +:10EF200000E07030014608902046704B06222630E3 +:10EF30005C3B984720466D4B0622E91C2C305C3B1D +:10EF40009847BF2060759F20A0750320E075CD20F5 +:10EF500020761F20607620461C3012990690FCF720 +:10EF600088F837802220390C01550220F07038468D +:10EF70000C2102F041FB4F1D5D4837710089F5F708 +:10EF800025FA7071594B042268465C3B06999847F4 +:10EF9000564B032231465C3B01A89847F0786946FE +:10EFA000C871002008812146504B052215315C3B79 +:10EFB00004A8984770796946400138434875274648 +:10EFC000687A0837C00748D000213C2000E028E1DB +:10EFD00004F0D2FA206000283FD03C22434B069038 +:10EFE00000210790984707984249C1610798424914 +:10EFF000816107980421C17507980A2181750798D6 +:10F0000000218160A889344A5043324A9288904254 +:10F0100000D31046079A10610798314A82820698F9 +:10F020006A8902850698AA8942850698203001736C +:10F03000069B1A62C1757F22027501234375129ADD +:10F040000276688B3880A88B7880688AB880A88A16 +:10F05000F8803972E07C1843E0743888694648814A +:10F06000B8888881F888214BC881162223485C3BE8 +:10F0700098470120A07468780021B174129A800723 +:10F080009206120E21681201C00F0C9200297DD049 +:10F09000069120311091097E70230B9159430C4B3E +:10F0A0000622403BCF180A917A85094B2289C9185C +:10F0B00007914A8077230C9ADB00D2189208BA860F +:10F0C0008A82A17C00291BD00F211AE0B492002073 +:10F0D00080810020C0920020E2040000FCFFFF0FAE +:10F0E00001600000514A0118CC900020750F00000B +:10F0F000509100207DEE001819EE00189086002037 +:10F100000E2100233982504A9188F983D1883984AD +:10F110004E497984BA8C5521120A12020A43BA84E4 +:10F120000799CB842978B27C090280000143500002 +:10F130000143F984B07C002802D007990D9888819A +:10F14000287800280ED1B07C00280BD10A98404BBB +:10F15000FF30E91C06228D30C0183E4B98470799B6 +:10F16000A87848820126F6033B4900203985079993 +:10F1700008810799488169780B98C907C90F00026F +:10F180002022104308437882062200E017E00A9804 +:10F190002F4BFF305930C0182E4B089998471098C4 +:10F1A000B110007B820011430143F9820698079950 +:10F1B000008C088006983146008C0143F985274A67 +:10F1C0000C9805218018428F120912010A434287C8 +:10F1D0000F998187418F1122C9B252021143418791 +:10F1E000018F890B89030187A9781D4BCA07120E6D +:10F1F000052100251A430A434287018F4904490C1F +:10F2000001876560206800280BD00E994160044694 +:10F210004162FDF7BCF8002801D12034A57500201B +:10F220000990099813B0F0BD10B50C20EFF31084CD +:10F2300072B60C490968002902D0FFF751FD002081 +:10F2400084F3108810BD0000509100205555000037 +:10F2500000800020190F000027800000808300201C +:10F2600020220000B49200201CB541480468002C04 +:10F270001ED0684604F075FC01980099E02801D37F +:10F28000012000E00020401C081800010009009047 +:10F2900060680099401A000101210009C9068842EE +:10F2A00001D2606801E00098606004F069FB1CBD59 +:10F2B0000020C043F9E7FEB506460025EFF31087AE +:10F2C00072B6684604F04DFC019800997C2801D381 +:10F2D000012000E00020401C0818000100090090F7 +:10F2E00070680099401A010101200909C006814295 +:10F2F00001D3009971601E490C6808E0616872686A +:10F30000891A09010909814203D325462468002C82 +:10F31000F4D1002D05D032462946154804F094F862 +:10F3200005E03146124804F017F8FFF79DFF87F318 +:10F330001088FEBD70B50025EFF3108472B60C4E38 +:10F340003168814208D1304604F00DF83068002859 +:10F3500009D0FFF789FF06E00146054804F00DF8E3 +:10F36000002800D1022584F31088284670BD0000D3 +:10F37000B8920020F8B51F4614460D46104604F01A +:10F3800022FA0026240A3F280DD0574A2946A00019 +:10F390000C39105803F0CAFF012631462046FEF70B +:10F3A0002FFA3046F8BD462239462046F7F72DFFA2 +:10F3B000F7E770B54D4D6C88F7F72BFDFF2808D0A7 +:10F3C0006988491C6980810047484058017B491E73 +:10F3D0000173002C02D1062004F09EFA70BDF0B536 +:10F3E00087B014460E46104604F0EDF93F284CD085 +:10F3F000200A05903C4980000D5800200490708838 +:10F400006946888130883A49401804903779012F3D +:10F4100004D0022F39D10598FEF79DFA287C697C2B +:10F42000884205D203AA04A90598FEF7BAFA022772 +:10F43000A968002929D088882E4AD04225D10C46B7 +:10F440006846808904990C3400912B4601900E3354 +:10F45000A21C0297211D0598FEF736FA070002D17B +:10F46000E889002811D10020A8602770204604F008 +:10F470005CF9E088042808D100206080002F04D1C6 +:10F48000207A522807D01B2805D0308803F0AAFE26 +:10F49000002007B0F0BD30886080F9E770B51446F1 +:10F4A0000D46104604F08FF90146200A00243F293A +:10F4B00011D0EA88291D052A0DD12A78002A0CD0FE +:10F4C000332A08D04979312A0BD0002903D00023F0 +:10F4D0001A46F7F7D3FF204670BDF8F722F8044626 +:10F4E000F9E717230122F4E7C09000208C92002056 +:10F4F00000800020F9FBFFFFF8B50020009008789D +:10F500001D460C46012807D003280BD0402219467F +:10F51000F7F7BFFA0098F8BD05F0D0FE00222946A3 +:10F520000120F5E70020F7F7C1FA00900128F1D19A +:10F530006078002507073F0FF7F737FB002808D151 +:10F5400029484068002804D10321FDF715FE002852 +:10F5500001D0432543E00020002801D042253EE0B1 +:10F56000608C1B38E12807D2A08CFF2149318842EA +:10F5700002D31E49884201D9402530E0E17E1A4E6F +:10F58000C9073801490F084320363071B8080DD03B +:10F59000E08C012217215202904200D31046172816 +:10F5A00000D2084610498883F6F7A3FD3079A17E82 +:10F5B00080088000084330710B480622211D0C4B47 +:10F5C0001E309847201D01F06AFA20462030017A4B +:10F5D000407A01F021FAA18C608C01F02EFA2946C4 +:10F5E0000020F7F781FA95E76490002048080000B2 +:10F5F000190F000070B50C46062004F0E4F804284A +:10F600001BD061480068002817D00178192914D14F +:10F610000C380189C320002510230622C00004F005 +:10F620006BF85A4B0646102221469847304604F0A4 +:10F630007CF829460020F7F757FA70BDF7B5044665 +:10F6400086B01546062004F0BEF804282BD04E4F95 +:10F650003968002927D00878182824D1002C02D036 +:10F660009034E1B21CE02846484D01260C460028A3 +:10F670001BD00F460C39C120098908230622C0007F +:10F6800004F03AF804460322791CC01CA847032260 +:10F6900020460799A847A671204604F046F80021A5 +:10F6A0000020F7F721FA09B0F0BD0322601C07998A +:10F6B000A847E07821798006800E0843334BE0703C +:10F6C0001022002101A85C3398470322611C01A885 +:10F6D000A847B8692E4B012201A90096F7F7D8F880 +:10F6E000E1E770B50C46062004F06DF804281AD046 +:10F6F00025480068002816D001781A2913D10C3843 +:10F700000189002508230622224803F0F5FF1F4B3C +:10F710000646082221469847304604F006F8294656 +:10F720000020F7F7E1F970BD38B50C460020F7F777 +:10F73000BDF90546012821D12078182804D01928C0 +:10F7400013D01A281AD11BE02079C02808D000282D +:10F7500006D0402804D040210020F7F7C5F90DE07D +:10F7600000210B48F7F7C5F808E000210091214679 +:10F77000094B01221131601CF7F78AF8284638BD81 +:10F7800000210648EEE7000064900020190F0000F9 +:10F790003DF600181A060000F5F50018E3F600180B +:10F7A0001CB5027B6B461A70002906D001225A70E4 +:10F7B0004A885A800979197101E000215970E44C96 +:10F7C0004482184601F064FA0146684640780843CE +:10F7D00002D02046FDF71FFE1CBD70B50446012572 +:10F7E0000878002A11D0A28B4B889A420DD1A92803 +:10F7F00002D0AA2803D006E0207C042101E0207C6E +:10F80000082108432074002509E0A92801D0AA286E +:10F8100005D1204600F064F9A18B4018A08328464A +:10F8200070BD10B50024C477CA4A037B5371FFF73B +:10F83000B7FF204610BD0021C177C649027B4A713F +:10F84000017C490601D50021AAE7704710B50021C7 +:10F85000C177C049BE4C027B4A71E41C4482007BE4 +:10F8600001F07FFA01462046FDF7D5FD10BDFFB53A +:10F870000F4658881021084381B058801C46164610 +:10F88000002520210198FDF761FC00282FD00021E0 +:10F8900041732278827347748682C1776178817759 +:10F8A000AD490160AD494160AD498160A94A019906 +:10F8B0005171817B0029A1781BD0890706D4017C76 +:10F8C000022211430174A178890703D5017C01222A +:10F8D00011430174A178C90703D0017C2022114390 +:10F8E0000174214600F0BCF8284605B0F0BD4B2558 +:10F8F000FAE74907E3D5E6E770B50C460120F7F7CC +:10F90000D5F8054601280ED160789249800020394B +:10F9100040188068002181838E4962784A710022F4 +:10F920002146FFF75AFF284670BDF8B5C77B894DC1 +:10F93000874C203DBF263B0001F036FF0604101D1A +:10F940001037420F824BDB1C994200D0C277418AAC +:10F95000002902D1C17FFDF72CFCF8BD69681400B5 +:10F9600004D10122FFF739FF0028F6D121460120FA +:10F97000F7F7BAF8F8BDA14205D1C37F002B02D03A +:10F98000017C314009E0C277002A07D1704A524217 +:10F99000D14203D1017C402211430174418A0029E4 +:10F9A000E8D1C17FFDF73AFCF8BDA14202D1017C4C +:10F9B00031400174418A0029F6D1FDF73FFCF8BDC2 +:10F9C000FDF76DFCF8BDF7B50E46624905468000AF +:10F9D000203940188068002814D0C17B032911D138 +:10F9E000818AD52008230622C00003F085FE057019 +:10F9F0000446C67106225B4B02A9401C984720466C +:10FA000003F093FEFEBD70B5524B8000203BC01842 +:10FA100084680025002C22D0607B00281FD1E07B69 +:10FA200003281CD1207CBF2318402074002904D057 +:10FA30003C290FD043290ED10CE0607C00280AD06D +:10FA40001046F7F7E6F9FF2805D021461631F7F7FB +:10FA50000DFA00E0452529462046FDF7EFFB70BD75 +:10FA6000F8B50D4606460021202003F085FD04462A +:10FA7000307B2070A8784006400E60802869606066 +:10FA80006869A060287E6070687E2077707CFDF7D2 +:10FA900086FB2073A878400707D5287B6073062271 +:10FAA000A91D20462F4B0E3098476879A0762879FB +:10FAB000E0766888C00501D5012000E00020244FD1 +:10FAC0006077FF1E7782204601F03EF8050002D0E5 +:10FAD000204603F0ABFD29463846FDF79CFCF8BDF7 +:10FAE0007CB50A4653880146FB2B01D8032007E06A +:10FAF000888B002806D0181A83B2FB2B04D802206A +:10FB0000DCB203E0012000E00020FB240B7B6D460B +:10FB10002B706870EC708B8B101D1818019010788A +:10FB2000A9280ED001202A46A870094D6D1E4D82CD +:10FB3000104601F04AF801462846FDF76CFC2046C5 +:10FB40007CBD00202A46A870014DAD1EEFE70000E5 +:10FB5000392000008490002023F8001837F800189E +:10FB60004DF80018190F00007CB50C46B1496B46E2 +:10FB700049681C700A795A70827B012300259B0218 +:10FB8000891C012A12D0002A10D08A896B465A801B +:10FB9000C9899980A84D4582684601F0AEF90146B1 +:10FBA0000C4302D02846FDF736FC7CBD69464B80ED +:10FBB0008D80EFE710B58A788273CA780024891C9B +:10FBC000920603D4027C01231A430274994A037BF0 +:10FBD00020325371037BD37100F0EDF8204610BD45 +:10FBE0009449027B20314A710021BDE770B504467B +:10FBF00090481646203000790D46C00601D44324B3 +:10FC000018E00846FDF768FA002815D01C212046A8 +:10FC1000FDF79CFA002811D00121417345748682BA +:10FC200086490160864941608649002481602146F9 +:10FC3000FDF7BFFA204670BD4024FBE74B24F9E7EF +:10FC400070B57C4BC57B04242033022D06D0042DD7 +:10FC500003D1DC710021FDF7F1FA70BD002A04D058 +:10FC6000DC711146FDF7DAFA70BD734A521E9142FB +:10FC700003D10121FFF778FF70BD6F4A9142FBD19C +:10FC80000021EFE7F8B505466A482030C07904281E +:10FC90007AD06849800040188768B87B042802D36E +:10FCA000687DC00770D0687D00214006800F0091FC +:10FCB000002802D0022803D005E00120009002E0D5 +:10FCC000387CC00760D06E7FB98A3346163306226F +:10FCD0005D4803F011FD0446002E0BD0A682298C4E +:10FCE000AA7F20468918594B163089B2C918584B3B +:10FCF00032469847687D010747D5C00601D50320E5 +:10FD000000E002206070687DC00703D06078102199 +:10FD100008436070687D800703D560782021084320 +:10FD20006070687D400703D56078402108436070AB +:10FD30000098002803D06078082108436070387B61 +:10FD40002070287F6074E87E2074687E401CA07458 +:10FD5000E87DFF281CD0C007C00F20720622291D95 +:10FD60003B4BA01C9847687D40070AD5287E294652 +:10FD7000C007C00FE07306220A312046344B093019 +:10FD80009847204603F0D1FCF8BDC006C00FB9E784 +:10FD9000FF202072E7E7274910B52031C8790428F1 +:10FDA00008D0244A8000801880680422CA71452146 +:10FDB000FDF744FA10BDF8B50D4606460021442073 +:10FDC00003F0DAFB044600274030C7708770707C70 +:10FDD000FDF7E5F920706770B07B0121032801D0A1 +:10FDE000052800D16170707C012806D16878C006B2 +:10FDF00003D56078022210436070A7706878C0074E +:10FE000008D0A170A888E080E88820816878400741 +:10FE1000C00F2071084F20467F1E778201F032F814 +:10FE2000050002D0204603F001FC29463846FDF7C4 +:10FE3000F2FAF8BD6490002042200000B5FB0018E3 +:10FE4000E1FB00189FD20018A706000000800020E8 +:10FE5000190F000070B504468878A073002654205E +:10FE600006558A888D1C002A05D00A2042430621A7 +:10FE7000764803F0C1FC7648217B4171217B81717A +:10FE80002946204600F0A3F8304670BD70B5044600 +:10FE900006216E4803F003FD6D48217B41716D4DD5 +:10FEA000658201F06FFA010002D02846FDF7B3FA2F +:10FEB00070BDF8B5074666480D4600790024010973 +:10FEC00005201646884301D0432417E02846FDF755 +:10FED00003F9002814D058213846FDF737F90028D7 +:10FEE00010D002214173457486825B4901605B49F1 +:10FEF00041605B4981600021FDF75BF92046F8BD58 +:10FF00004024FBE74B24F9E770B5514E0025B17949 +:10FF100032468900203A89188C68FF280DD0617C10 +:10FF2000002903D021461631F6F7A0FFA07B002858 +:10FF30000AD10621454803F0B2FC042201252046DF +:10FF40000021B271FDF77AF9284670BD70B54048BE +:10FF50008479042C13D03E49A000203940188568CC +:10FF60000622352002231146400103F0C5FBA521DE +:10FF70000170447003F0D9FB4520403528750020FE +:10FF800070BDF8B50746C17B04263048304C0229C5 +:10FF900007D0032910D004290DD154213846C95D5A +:10FFA00011E0150003D0062103F079FCA671294663 +:10FFB0003846FDF733F9F8BD1500FCD0062103F0F3 +:10FFC0006EFC38462946A671FDF738F9F8BDF8B53C +:10FFD0000D46064600211E2003F0CEFA0446707C32 +:10FFE000FDF7DDF86070002020703620405D294666 +:10FFF000A070062230311B4BE01C98476878C00780 +:020000041801E1 +:10000000C00F60726878C0070FD0A8886081E88848 +:10001000A081A889E081E8892082A88AE082E88A14 +:100020002083288A6082688AA0820A4F204635375A +:10003000778201F025F9050002D0204603F0F6FA98 +:1000400029463846FDF7E7F9F8BD0000F206000042 +:10005000849000200E20000055FE00188DFE001830 +:100060009FD20018190F000010B501221E21F7F7CA +:10007000CAF9083803F059FB10BD10B50C4601024F +:100080001520F74A8001491D03F0B6FB20460838C9 +:1000900003F04BFB10BDFEB501468000F14B029012 +:1000A0001A589468002C64D050680190E28900923C +:1000B000921D0C3893B200890A02264601460C367E +:1000C0000027E948521D03F017FB009A054682807D +:1000D0000198818829800198C1886980307A09282F +:1000E00019D137460837727AA81D391DDF4B921E89 +:1000F00098477878811E8FB22168002903D06988DB +:10010000081A801C6880304624680C3803F08EFA88 +:1001100026460C3622E008360196403EB08F401E3F +:1001200086B2009887420AD2C01B3246864200D36C +:100130000246E8190199CD4B801D491C9847B81912 +:1001400087B22068002802D06888801B68802468F5 +:10015000019826460C36143803F068FA002CDAD1E0 +:10016000C0490298085800218160C160284603F008 +:10017000DCFAFEBD10B50446BD484988828B8A4230 +:1001800000D211462046F6F7F5FFB648A1004058C8 +:100190004068002802D00078012801D0412200E008 +:1001A000002201212046F6F774FF002010BDF3B5B0 +:1001B00083B00398AB4A8000019010584068002833 +:1001C00002D00178072901D040223AE0009004983B +:1001D0004078012809D01027049800254038808FE6 +:1001E0002E46801E80B2029024E00227F4E79D494B +:1001F00001983B1D085840680C3801890398020299 +:100200009948521D801E03F077FA04460498974BD4 +:10021000401946882680A770AD1C0498ADB24119DC +:10022000E01C3A46891C9847E81985B2204603F03D +:100230007CFA02988542DAD30098C088B04205D88B +:10024000002201210398F6F724FF0FE00098761CA6 +:100250008680009801214088C9030843009948809E +:10026000804901980858406803F05FFA002005B003 +:10027000F0BDF3B583B003987A4980000090085828 +:100280004468002C02D02078032801D040223AE0B4 +:10029000049878494038808F0026C0034018000C2D +:1002A0003746019029E06F490098637808589B1DF4 +:1002B00040680C380189039802026B48521D401FA8 +:1002C00003F01AFA054671000498761C0818B1B2BA +:1002D0004A00408828800498491C101847886F807D +:1002E0008EB26078287121460831604B6278681DB3 +:1002F0009847284603F019FA01988642D3D3E0883C +:10030000B84205D8002201210398F6F7C2FE0CE09E +:100310007F1CA78060880121C90308436080514980 +:1003200000980858406803F000FA00209FE7F3B5F2 +:1003300089B000250846019540380595808F0C4608 +:10034000801E80B204900999464E8F00F1592846CC +:100350004968002900D00878099A120203920428FB +:100360006ED0052805D0062803D00A2872D0402276 +:10037000D6E000916078072801D9102000E0022023 +:1003800002900520079048E06019C1788278080241 +:100390001043069001900098007805280CD0009832 +:1003A000009A43780798083228180019801C02998F +:1003B000F7F796F900282DD02A48039AC059029BD6 +:1003C0004068521D0C38018927489B1DC01E03F050 +:1003D00093F9064606983080AD1CA8B2211889789A +:1003E000401C317180B22118CA788B7811021943F0 +:1003F000801C718085B2029870716119B01D1B4B11 +:10040000891C029A98470298281885B2304603F052 +:100410008CF902E06078401985B204988542B3D324 +:100420000098C1880198814279D90099401C888040 +:10043000009801214088C90308430099488077E06B +:1004400000200646029004980691400703D0102031 +:10045000009040E073E0012002900220F8E70000E5 +:1004600030750000B490002009050000190F00004D +:10047000649000200000FFFFF748039AC059009BDA +:100480004068521D0C380189F448083303F034F9F0 +:100490000646601941883180AD1CA9B260184288B7 +:1004A000891C89B2601872804288B280891C0298C7 +:1004B0008DB2002816D00098B0716119F01DE84B7C +:1004C000891C009A98470098281885B230880190B6 +:1004D000304603F02AF904988542CDD302980028CB +:1004E00007D017E0DC483146C0590C39083002F01B +:1004F0001DFF002E0ED004220A210998F6F783FF73 +:100500000146708848800998FFF7B7FD00200BB0BE +:10051000F0BD04E00698C1880198814205D8002208 +:1005200001210998F6F7B5FD07E00699401C88807F +:10053000C948C059406803F0F8F80598E7E70998FA +:10054000F6F713FE6378801E98421BDDF059039A7C +:100550004068521D0C380189C0481B1D001D03F066 +:10056000CBF80546608828806078211D801E82B205 +:10057000AA8000206880BA4BA81D9847284603F03F +:10058000D4F8CCE7F05962884068214682806278CE +:100590000839921EC280002202816078801E488045 +:1005A000F0590C39083002F0C1FE01200590F059D5 +:1005B000C0E7F3B508464038808F85B0801E80B212 +:1005C00004904C780F46214601F016F80599A24A8E +:1005D0008900039151584D68002D69D0297802296E +:1005E00066D1002864D000260196142C01D0022088 +:1005F00000E0102000900020029032E0964903981D +:10060000009B08589B1D40680C3801890598020220 +:100610009248521D401E03F06FF80446B8194088F6 +:10062000B61C2080B1B2781842886280019200988E +:10063000891C20718EB2B919601D894B891C009AE2 +:10064000984700992A46701886B26B780832601D68 +:10065000F7F746F8002801D001200290204603F069 +:1006600064F804988642029806D200280AD17D498F +:1006700001988842C2D101E0002803D1E98801989D +:10068000814205D8002201210598F6F702FD0CE011 +:10069000401CA88068880121C903084368806E490E +:1006A00003980858406803F040F8002007B02FE78F +:1006B0004122E8E7F3B581B0002000900198664A36 +:1006C000860090590F4645680021002D00D02978FA +:1006D000042907D008291FD009291DD00A291BD0B9 +:1006E00041223AE0083002F03EFE04460C3410226B +:1006F000791C5B4B133098471020A071204603F003 +:1007000014F82088E988814201D8002225E0401CA5 +:10071000A880514880593CE03946403FBA8F4E4846 +:10072000521E94B2083900224A8080590C39083090 +:1007300002F0FCFD2889002802D0844200D3044640 +:10074000454FB8598068C189091989B2C181012012 +:1007500000904002814205D9112201210198F6F74B +:1007600098FC19E00198F6F700FD401EA04204DC59 +:100770002889A04205D8002803D00198FFF78BFCF8 +:10078000C3E7E9880919E980002801D0001B288106 +:10079000B859406802F0C9FF0098FEBDF3B585B0B6 +:1007A00005982D4A8000039010584068002802D018 +:1007B00001780B2901D0412247E006994039898F01 +:1007C0000190491E002589B22E460095029132E023 +:1007D00021490398B200085840680C3801890198F3 +:1007E0001718F888801D83B2059802021B48521D15 +:1007F000001D02F081FFB988044601800298F98843 +:10080000401B814200D2084682B2A2800020608054 +:100810000698134B4119A01D491C9847A0884119FF +:100820008DB2F988884201D050200090204602F015 +:100830007CFF761CF6B201984078B042C8D8029886 +:10084000854201D050200090009A01210598F6F7CA +:1008500020FC00202AE70000B490002005050000DD +:10086000190F0000FFFF000010B56649820089588B +:100870004968002902D009780C2901D0412200E002 +:1008800000220121F6F705FC002010BDF8B55D4FF0 +:100890000B468600B9594C68002C02D021780C29EF +:1008A00005D041220121F6F7F4FB0020F8BD1846DF +:1008B0004038808FE188801F85B298882A46401A88 +:1008C00080B221460C3160814118981D4E4B9847EB +:1008D000002804D1608921894019884201D900206B +:1008E000C0436081B859406802F01FFFDDE710B5D2 +:1008F00044498300C95800224968002900D00A7879 +:100900000C2A03D00F2A0BD0412204E04A8909891E +:100910008A4205D052220121F6F7BBFB002010BD10 +:100920000022F8E770B50D464039898F374A091F14 +:100930008EB281005158B21D93B202022878C98943 +:10094000521D1B2816D0324802F0D6FE04462878E5 +:100950001B2812D01320207066806888A0802A4B44 +:10096000291DA01D32468A3B9847204602F0DDFE35 +:10097000002070BD2648401EE6E71220EBE770B568 +:10098000044608790D46122809D12049A0000858CC +:100990002202C1891E48521D163002F0D7FE2A7964 +:1009A00001212046F6F775FB002070BDF8B507461B +:1009B000087A0C46FF260025C10707D0002805D07D +:1009C0001D2803D84008134980000D58608800286E +:1009D00003D002F007FC00206080002D0FD0207AA9 +:1009E0001D2807D01B2805D0390215208001491D7C +:1009F00002F055FF214608313846A84706463046E2 +:100A0000F8BD0000B4900020A30F00008C900020DF +:100A10000D050000145B0118032283079B0F02D011 +:100A200083079B0F00E01346244843708B079B0FFE +:100A300001D08A07920F0270704702461B3AE02AE3 +:100A40000AD8FF224932904206D31D4A904203D869 +:100A50001A4A403A9087D187704770B50146174DC2 +:100A60000C240020803D1C2242435219937B072B0B +:100A700003D116693678F6070FD1052B03D1126919 +:100A80005278D20709D1401CC0B20428EBD30B48DE +:100A900006220C4B0A3898470024204670BD70B5DA +:100AA0000546014605480622064C0A38A047034879 +:100AB000062229461038A04770BD00004C91002046 +:100AC00090420000190F000010B50346E94C0020C9 +:100AD0001C21414309198A7B521E022A03D8096945 +:100AE0000978994204D0401CC0B20428F0D3FF20FA +:100AF00010BDF3B581B04227FFF7E6FF0446042896 +:100B000020D21C20DB4960434618356900270622A5 +:100B1000D94B2846143002999847B07B022811D14E +:100B2000EFF3108672B6287BC00709D070204443CB +:100B3000D248FF3406225934CF4B201802999847E7 +:100B400086F310883846FEBDF8B504460C260078BA +:100B5000FFF7BAFF6946C74D0870FF2806D01C2171 +:100B600048434019807B01282DD104E00846F7F75F +:100B70005AFF060027D1684600781C2148434019D7 +:100B80000069002801D002F051FD684600781C2160 +:100B900048434119FF200C610876217B002903D0CE +:100BA000012908D0022906D1B24906227031204617 +:100BB000B14B14309847684600781C2250430121FD +:100BC0004019817300263046F8BDFEB50546422027 +:100BD00000902878FFF778FF0746FF2850D00720BD +:100BE00000901C20A349784340180190A978002662 +:100BF00049004418607D143400280DD002F074FBC5 +:100C000006464088E9784018402805D9607802F007 +:100C100070FB0020607033E06878032801D0012861 +:100C20000CD16078002801D002F063FB02F044FB95 +:100C30006070002824D002F057FB06463088728886 +:100C40008E4B801880B2C0188B4BEA786968984741 +:100C50007088E978401870806878032801D00228ED +:100C60000CD10198807B02280CD02078002801D07C +:100C700002F03FFB60782070002060700020009040 +:100C80000098FEBD6278A9783846FDF715FDF1E7BA +:100C9000F8B5054612260078FFF716FF0746FF282D +:100CA00008D01C203946414372480C18617D002948 +:100CB00055D101E0422652E0E17D00294FD169780B +:100CC000002944D0064620694188CA0717D0090781 +:100CD000890F07D0417B0E30F7F778FE002801D04E +:100CE0000B263CE000201C2141438919897B002907 +:100CF00003D0401CC0B20428F5D304280BD0A07B3D +:100D000002280AD02A79698838462669FDF726FB29 +:100D1000002808D022E0072621E02A796988384691 +:100D2000FDF7FBFA1AE00220A073B078514DC0071E +:100D300014D06846F7F777FE00280FD16846007890 +:100D400020761C22042150434019817306E0384666 +:100D5000FDF785FC002801D10320A0730026304652 +:100D6000F8BD10B5FFF7B0FEFF2808D01C21414A9E +:100D700041438918897B012903D00C2010BD4220F2 +:100D800010BD00F05BF8002010BDF8B50C460978E6 +:100D90001C225143374AE0788E18211D3769009193 +:100DA000B17B357E032918D000281BD02846009936 +:100DB000FCF7C0FE28461C2148432E49401800215C +:100DC000C180009909894900818005210181418103 +:100DD0000121C1738581B17317E000212848FCF718 +:100DE0001AFB04E060783C2801D0432801D101209F +:100DF000B073B878C00705D01C211E4A0020694393 +:100E00008918887360783C2809D1E078002801D0DF +:100E1000002100E03C212846009AFCF735FBE078F1 +:100E2000002802D16078002804D0617838782A46FA +:100E3000FEF7E9FDFF2030760020F8BDF8B500246C +:100E40000C491C225043274645182E19307D002896 +:100E500002D002F04EFA3775641CE4B2042CF4D3CD +:100E60002869002802D002F0E1FB2F610020A8735E +:100E7000F8BD0000CC900020190F00000080002079 +:100E80003920000038B505460C2300206946F94C8E +:100E9000087009781C2048430019827B062A01D378 +:100EA000082A05D9491CC8B2694608700428F0D33D +:100EB00068460078042806D21C2148430019807B2C +:100EC000062818D104E06846F7F7ADFD030012D1FB +:100ED000684600781C21484300190069002801D0A9 +:100EE00002F0A4FB684600781C2148430019062143 +:100EF000056181730023184638BD70B503460C2583 +:100F0000DC4A00201C2141438918897B062901D332 +:100F1000082903D9401CC0B20428F3D3197800294A +:100F200004D0012917D01225284670BD0428FBD211 +:100F30001C2148438418A07B0728F5D1FDF787FEC4 +:100F4000050006D00620A0730021032002F0A7FCB4 +:100F5000EAE7082023E00428E6D21C2141438C184C +:100F6000A27B082AE0D0217E5E784908002549004E +:100F7000002E00D0012631432176FD2631405E78D7 +:100F8000022E0ED000267600314321765988A182A8 +:100F90009988E182072A06D0FDF7E4FC0720A073B8 +:100FA000C2E70126EFE720690078800702D5B14A41 +:100FB000763200E0002299885888FDF757FEB3E7A3 +:100FC00010B5AC4A00201C2141438918897B0729B0 +:100FD00004D0401CC0B20428F5D303E0042801D299 +:100FE000FDF7C0FC002010BDF0B5487E8FB0401C5E +:100FF000C0B209900C46087D1C2148439D49062239 +:10100000401807699C4D002105A8A8470622002129 +:101010006846A8470025E07D2E460290FF282BD089 +:10102000954B0622211D05A85C3B9847607D400733 +:101030002FD56078002810D03878C507E07BED0FF9 +:101040008009012801D1022005438A498A4B0622E2 +:10105000703168465C3B98470EE02146864B06227D +:101060000A3168465C3B9847257E002D04D0E07B22 +:101070008009032800D0FE25607D400709D5684619 +:1010800040798009012804D1FE2D02D17878022808 +:101090007ED3207D1C21484376494018007EC1073D +:1010A00077D00999012905D08006800F06D0022843 +:1010B00003D101E00007F8E701267DE0A27CFF21D3 +:1010C0000020002A03D0208A010B0005000D05AA8C +:1010D0000B920A37029A03970C92627D079108924D +:1010E0000290608C049000200D90054620370A90F5 +:1010F00036E00E2003996843461831460B9802F0FB +:101100001CFA00282BD0F17A0C98814227D1B17AB1 +:101110000898814223D1317B079881421FD10799DA +:101120000020FF2909D00E21039A69438918CA8833 +:1011300002998A4201D0F18001200499062909D33D +:101140000E214D43039969180A8904998A4201D0F6 +:10115000318130E000282ED101200A902BE06D1C57 +:10116000787EA842C5DC0D98002824D1387E0E2157 +:1011700048430399404B4518062228465C3B0B998F +:1011800098470898A8720C98E8720798287301E0AD +:1011900039E035E00298E88004982881387E401CC8 +:1011A000C0B23876042801D100203876787E042831 +:1011B00001D2401C78760A9EA07D012801D0002033 +:1011C00004E0002E01D0022000E001200999227DD8 +:1011D00001290CD01C214A432649CF2351180A7EED +:1011E0001A40000102430A76002E09D00BE01C21B0 +:1011F0004A432049F32351180A7E1A408000F1E740 +:101200002046FEF73FFD607F002802D0208C01F0D1 +:10121000E9FF00200FB0F0BD10B548781C2148430D +:1012200014494418A07B08280ED0E08A002810D06A +:10123000052109024843A18A0A225143421A00218A +:10124000032002F0D9FA08E000210C48FCF7E3F88B +:1012500001E0FEF7A0FD0620A073A07B062802D0C7 +:10126000207E800704D5206900214030C170817044 +:10127000002010BDCC900020750F0000422000001F +:10128000F0B5002689B0054668460C240670704B00 +:101290002022314601A898476846067068460078C3 +:1012A0001C216C4A41438918897B052905D0401CC3 +:1012B000C0B2694608700428F0D368460078042854 +:1012C0005DD3687A02F0F0F806466846F7F7ABFBA4 +:1012D000040054D12EE0142060434119CA89C88A01 +:1012E0005200904200D3104682B20220022A00D857 +:1012F00002460B8A088B5F00B84200D3384683B29F +:10130000934200D813469C46630101A81818476011 +:10131000C98901AF4900F9506346C360002182606A +:101320008174C174694609780182FBF746FB002885 +:1013300002D1641CB442CEDBB44201DA3B241EE08D +:10134000684601781C204143424801AB081805213A +:101350000561817300200BE04101C9184A69D2037D +:10136000140C1422424352195483098B9183401C5C +:10137000B042F1DB68460078FDF799FD044620464F +:1013800009B0F0BD70B50024324D0C261C2060431E +:101390004019807B052804D0641CE4B2042CF5D3EA +:1013A0000BE0042C09D2FDF73FFF1C2044436419D5 +:1013B000206902F03BF900202061304670BDF8B58D +:1013C0000E781C22234B487872430090D418A27BDD +:1013D000C878052A3AD1091D27690D46002F27D064 +:1013E000002822D03046FCF7A5FB698CE1802989D2 +:1013F00014224900A180009902235143CA19D18ABD +:101400002046022900D819460181128B8A4200D950 +:101410001146418186810421C173FBF796FA2A4661 +:1014200000213046FCF730F808E00020A07308E007 +:1014300000210948FBF7EFFF0020A0732069002876 +:1014400004D0206902F0F2F8002020610020F8BDED +:10145000750F0000CC9000200E20000070B51546DE +:10146000100A0C46214A81005158002911D02279D6 +:10147000032A10D0403109788907890F032905D044 +:1014800000290CD001223D21F7F7ECFA208801F069 +:10149000A9FE002070BD2146FCF721FEF9E7F5F713 +:1014A000B8FC01022A462046091D02F056F9012027 +:1014B00070BD70B5150AD8B2032804D02846FDF7D0 +:1014C00078FF002070BD0949A8000C58002C09D0F5 +:1014D0002046203001F047FF02F0A8F8E08F0221FB +:1014E0008843E0872846FCF743FDEAE79092002016 +:1014F000F7B50098042682003C4810278458656898 +:101500006878884209D103280FD004280CD12046DE +:1015100005221830364B291D9847E08F0121B8432A +:10152000E0870098FCF7E4FBFEBDE08F291D3843FF +:10153000E0876A890098FAF7B3FC0028EDD16E7055 +:10154000FEBD00290BD129498300C958127849688A +:10155000002904D00978082901D10521C8E770477E +:10156000F8B50E4607462149800008580025C18F6E +:10157000C90702D14068002801D0242525E0F08861 +:101580001C49101A80B2884201D228251DE0390278 +:10159000491CFF200C230A46073002F0ADF8044630 +:1015A00008202070032060700522711C104B201D44 +:1015B0009847F0886081224601213846FCF758FBA5 +:1015C000002203213846FFF793FF2846F8BD81002B +:1015D00006484058002806D04021095CC9438907C5 +:1015E00001D0183070470020704700009092002012 +:1015F000190F0000FF7F000030B50B4601460020A8 +:101600002022012409E00D46D5409D4205D31D4608 +:101610009540491B2546954040191546521E002D00 +:10162000F1DC30BD70B500242546002801DA012424 +:101630004042002901DA01254942FFF7DDFFAC42B3 +:1016400000D04042002C00D0494270BDF0B51FB41C +:101650000646002082B005464024019100901BE020 +:10166000019922460F46304600F042F8049A059B45 +:10167000801A994110D310461946224600F028F8E6 +:10168000361A8F410197224601200021009F00F069 +:101690001FF838184D4100902046641E0028DFDCFA +:1016A000019B00982946324607B0F0BD064C012543 +:1016B000064E05E0E36807CC2B430C3C98471034FA +:1016C000B442F7D3F2F7ECFCB05B0118D05B011821 +:1016D00010B5202A04DB0146203A9140002010BDBD +:1016E000914020239C1A0346E3401943904010BDCB +:1016F00010B5202A04DB0846203AD040002110BD56 +:101700000B46D340D0402024A21A914008431946EA +:1017100010BD0000F0B51A4D6C6BE00716D0A86A3A +:1017200001273843A862002116482B6802888618D2 +:10173000521C3371D2B20280491CC9B20829F3D3BA +:10174000A86B3843A863686A38436862E00615D519 +:10175000A86A10231843A86207E00A482A6801888B +:101760004418491C2271C9B20180286A0005F4D4CA +:10177000A86B1843A863686A18436862F0BD00004C +:1017800000300240563100200FB410B503A9044BBD +:10179000044A029800F024F810BC08BC04B01847B2 +:1017A000E92901189830002030B47446641E257869 +:1017B000641CAB4200D21D46635D5B00E31830BC85 +:1017C000184702E008C8121F08C1002AFAD1704762 +:1017D0007047002001E001C1121F002AFBD17047B1 +:1017E000FFB591B00F460546002606E025280AD031 +:1017F000149A139990476D1C761C28780028F5D10F +:10180000304615B0F0BD002400940121F34A029443 +:1018100000E004436D1C2B780846203B98401042A2 +:10182000F7D128782A280ED0022128780246303AAB +:10183000092A15D8009A0A235A43303A80180C43D3 +:101840006D1C0090F1E701CF0090002805DA01201F +:1018500040030443009840420090022004436D1C62 +:1018600028782E2815D10420044368786D1C2A2876 +:101870000AD101CF6D1C02900BE002990A2251435C +:10188000303940186D1C02902878014630390929FA +:10189000F3D928786C2810D006DC4C281AD0682898 +:1018A0000ED06A2817D104E0742813D07A2812D1F8 +:1018B00010E00120400504430CE00121090501E08E +:1018C000032109050C436978814203D101200005F9 +:1018D00024186D1C6D1C287803906E281ED00CDC1B +:1018E000632831D004DC00288AD0582811D1B2E016 +:1018F00064287BD069280CD178E073282DD004DCD3 +:101900006F2870D0702804D1A7E075286CD0782893 +:101910006BD0149A13999047761C62E06002400FD6 +:10192000022807D003280AD0042838680AD00660A5 +:101930003F1D56E03868F11706604160F8E73868E7 +:101940000680F5E70670F3E73878694608740020EA +:10195000487404A80390012003E038680390002035 +:10196000C0433F1D61070FD5002101E00199491CCB +:10197000029A0191914213DA8142F7DB019A0399AD +:10198000895C0029F2D10BE0002101E00199491C9A +:1019900001918142FADB019A0399895C0029F5D112 +:1019A00001990098139A401A00902146149B00F068 +:1019B0003BF901998019461807E0039803990078CC +:1019C000491C0391149A139990470198401E019065 +:1019D000401CF2D12146149B139A009800F014F990 +:1019E00086196D1C09E741E033E034E00A2000214C +:1019F000049005916002410F022905D001CFC21762 +:101A00009446032905D007E0FF1DFF08FF0003CF20 +:101A100006E000B2C2179446042902D140B2C117B1 +:101A20008C4600226146944506DA0A46002140426F +:101A300091418C462D2102E0210504D52B216A46D7 +:101A40001176012103E0E10701D02021F7E70191A0 +:101A500054E00A200BE0102009E01020049000213F +:101A60000420044308200591029003E0082000218F +:101A7000059104906002410F022905D001CF002298 +:101A80009446032906D006E0FF1DFF08FF0003CFA0 +:101A90008C4603E080B2042900D1C0B2002101913C +:101AA00021072BD50399702906D0049A1021059B94 +:101AB0004A401A4305D00EE040216A4611760121C2 +:101AC00008E06146014306D030216A461176039949 +:101AD000517602210191049A0821059B4A401A433C +:101AE0000CD16146014301D1610707D530216A4617 +:101AF0001176012101910299491E029103995829F9 +:101B000004D037A103910FA90F910DE039A1F9E796 +:101B10006146059B049AFFF799FD039B8C469B5CED +:101B20000F9A521E0F92137061460143F0D10F9825 +:101B300007A9081A20300390600704D5012000048B +:101B40008443029801E0012002900399884201DD5C +:101B5000401A00E0002041180290019809180098EE +:101B6000401A0090E00306D42146149B139A009873 +:101B700000F05AF886190020049008E006A9085CD5 +:101B8000149A139990470498401C761C049001996C +:101B90008842F3DBE0030CD52146149B139A00988E +:101BA00000F042F8861904E0149A30201399904707 +:101BB000761C0299481E02900029F5DC08E00F9877 +:101BC0000F990078491C0F91149A13999047761C2D +:101BD0000399481E03900029F1DCFBE60928010067 +:101BE0003031323334353637383961626364656693 +:101BF0000000000030313233343536373839414255 +:101C00004344454600000000F8B5044600251E4642 +:101C10001746880404D405E039462020B0476D1CDF +:101C2000641EF9D52846F8BDFFB50446002581B0ED +:101C30001E46C80301D5302700E02027880404D5BC +:101C400005E038460399B0476D1C641EF9D5284657 +:101C500005B0F0BD10B5A02803D0A92801D0AA284E +:101C600001D100F07DF810BD10B50222044B002117 +:101C700002489847002000F021F810BD5A32002099 +:101C8000750F0000002801D1014801707047000065 +:101C90005A32002010B5144600280CD11146A52058 +:101CA00000F05EF8452C06D103480078022802D1E6 +:101CB000012000F0ADFD10BD62320020F8B51C4FD0 +:101CC0000246002404250126797838781300FFF7AE +:101CD0006BFD0504070F151D0600002920D0F8BD77 +:101CE0000229FCD1002100F05FFF03207870F8BDCD +:101CF0000329FCD100F061FF7D70F8BD0029FCD004 +:101D00000329FAD000F0BCFE7C70F8BD03290BD08B +:101D1000002905D0032903D0387800F0B1FE7C708B +:101D200000F008F87E70F8BD00F047FF7D70F3E723 +:101D30005A32002000B589B000206B46187001218E +:101D4000597003225A80587159760720187620203E +:101D5000049005906946002000F078FE09B000BDAF +:101D600030B50221204C89B0A0280ED0A52834D04F +:101D7000A92820D0AA2806D161700120FFF79EFF74 +:101D8000022000F045FD09B030BD6B4619700120FE +:101D90005870062098700320D8701871002159716E +:101DA000FF259D71D87119201872597299720B22F2 +:101DB0002078A9210EE000A91420023100F0F0FCE7 +:101DC000411C6A461170092151702478821C6B46AF +:101DD000AA21204600F076FED5E76078032801D0DE +:101DE0000428D0D16170CEE75A32002010B5002807 +:101DF00007D0012000F00CFD00F0FCFCFFF734FFE1 +:101E000010BD0222054B00210348984704490022D7 +:101E1000881D00F075FE10BD62320020750F0000B5 +:101E2000AC58011810B50C46022808D0032810D071 +:101E3000042803D10021204600F0B1FC10BD084861 +:101E40004470032000F0E4FC0021204600F0E4FD93 +:101E500010BD022000F0DCFC0120FFF72FFF10BDB9 +:101E6000623200200020704738B51D0A0C460B78FE +:101E7000D62234A136A0FFF787FC2078801E03000D +:101E8000FFF792FC070513122312481A1200E0789C +:101E90000090A378DC222BA134A0FFF775FC22462A +:101EA00029460420FFF7BEFF38BDA378E32225A111 +:101EB00039A0FFF769FC38BDE92222A140A0FFF755 +:101EC00063FC284600F0BCFD38BDEF221DA143A0F5 +:101ED000FFF75AFCF0221BA147A0FFF755FC002595 +:101EE0006019817846A0FFF74FFC6D1C102DF7DBC1 +:101EF0001DA0FFF749FCF12212A13FA0FFF744FC0F +:101F000000256019817C3EA0FFF73EFC6D1C062D6C +:101F1000F7DB13E0237FF8220AA13BA0FFF734FC94 +:101F2000F92208A134A0FFF72FFC00256019817861 +:101F300033A0FFF729FC6D1C1C2DF7D30AA0FFF777 +:101F400023FC38BD6170705F676170632E630000B1 +:101F50003C25732C25643E626F6E645F696E642855 +:101F6000696E666F3A2564290D0A00003C25732CC2 +:101F700025643E50414952494E475F5355434345BE +:101F8000454428617574683A25582C6C746B3A2561 +:101F900064290D0A000000003C25732C25643E5086 +:101FA000414952494E475F4641494C454428726574 +:101FB00061736F6E3A30782558290D0A00000000D1 +:101FC0003C25732C25643E52455045415445445FA1 +:101FD000415454454D50540D0A0000003C25732CCB +:101FE00025643E49524B5F455843482869726B2C23 +:101FF00061646472290D0A003C25732C25643E003F +:1020000025303258200000003C25732C25643E42C8 +:102010006F6E64204C544B5F455843482873697A6F +:10202000653A2564290D0A0070B51E0A0C460B7826 +:1020300088B06F2248A14BA0FFF7A6FB2078514D36 +:102040000300FFF7B1FB080540404046427A2140BB +:10205000684600F0C3FB69463046F3F712FC63782C +:102060007B223DA148A0FFF78FFB7C223AA14EA026 +:10207000FFF78AFB00246D46295D4DA0FFF784FB26 +:10208000641C072CF8D31BE06946304600F086FB41 +:1020900069463046F3F782FB637887222EA146A07B +:1020A000FFF772FB88222CA13FA0FFF76DFB0024F5 +:1020B0006D46295D3EA0FFF767FB641C1C2CF8D31E +:1020C00043A0FFF761FB08B070BD8D2222A141A0A3 +:1020D0000DE06378992220A143A0FFF755FB6078BB +:1020E000002807D0012809D0AE221BA145A0FFF788 +:1020F0004BFBE8E79D2218A149A0F8E701F02AFA76 +:102100004C49FFF779FA4C4810220C180021684618 +:10211000A84769460C70200A4870200C8870200E71 +:10212000C8702346A9220CA144A0FFF72DFB6A46E4 +:1021300001213046F3F7F0FAC5E7B62206A146A022 +:10214000FFF722FB102200216846A8476946304667 +:10215000F3F769FBB7E700006170705F6761706358 +:102160002E6300003C25732C25643E626F6E645F15 +:102170007265715F696E64287265713A2564290D14 +:102180000A000000750F00003C25732C25643E50AA +:10219000414952494E475F52455128617574683A2A +:1021A00030782558290D0A003C25732C25643E0003 +:1021B00025303258200000003C25732C25643E4C0D +:1021C000544B5F455843482873697A653A2564291A +:1021D0000D0A00003C25732C25643E49524B5F4597 +:1021E0005843480D0A0000003C25732C25643E54DA +:1021F0004B5F4558434828747970653A2564290D2A +:102200000A0000003C25732C25643E544B5F4B456F +:10221000595F454E5452593E3E3E0D0A00000000A3 +:102220003C25732C25643E544B5F4F4F423E3E3E4F +:102230000D0A0000A0BB0D00A08601003C25732CF8 +:1022400025643E544B5F444953504C41593A253024 +:1022500036640D0A000000003C25732C25643E43C3 +:1022600053524B5F455843480D0A000030B50D46A8 +:102270004C7A0A7A87B0C988A888059402AC07C44A +:1022800069882888019100901B0A34220B490C4868 +:10229000FFF77AFA362209490AA0FFF775FA0024F7 +:1022A0002819817A09A0FFF76FFA641C062CF7DB66 +:1022B0000848FFF769FA07B030BD00006C25011827 +:1022C000505B01183C25732C25643E0025303258A4 +:1022D000200000008426011870B51E0A0D460B88E8 +:1022E000FF220C321BA11EA0FFF74EFAFF220D3277 +:1022F00018A126A0FFF748FA00242819817825A004 +:10230000FFF742FA641C082CF7DB24A0FFF73CFA25 +:102310002888A91C00F040FA04000BD0FF221332D9 +:102320000CA11FA0FFF730FA224610213046F3F728 +:1023300062FB70BDFF22193206A120A0FFF724FA2C +:10234000002211463046F3F756FB304600F078FB8A +:1023500070BD00006170705F676170632E63000084 +:102360003C25732C25643E656E63727970745F72D0 +:1023700065715F696E6428656469763A30782558BE +:102380002C72616E64290D0A000000003C25732C3C +:1023900025643E0025303258200000000D0A000060 +:1023A0003C25732C25643E2D3E46696E64205361A6 +:1023B0006D65204C544B0D0A000000003C25732C29 +:1023C00025643E2D3E46696E642044696666204C55 +:1023D000544B0D0A000000007FB5574E1C46851B6C +:1023E0001B0AB04274D011DC544E851BB0423BD066 +:1023F00007DC534D451B1BD0012D22D0022D11D1DE +:1024000023E00C2D41D00E2D0CD154E0062D6BD0C5 +:1024100004DC022D60D0042D04D161E0082D72D0BF +:10242000192D78D00346FF227A3246A148A06FE0EA +:10243000487800900B782B224CA14FA0FFF7A4F90D +:1024400076E02346FFF712FF72E00C468978208879 +:10245000019100901D46412244A150A0FFF794F93C +:102460002246294602200DE00C46897820880191F9 +:1024700000901D464B223DA156A0FFF785F922464C +:1024800029460320FFF7CEFC52E01C46CA88888804 +:102490000B884988019303920091029023465422AD +:1024A00032A15AA0FFF770F904230222012120462D +:1024B000F2F716F93CE088884A8809880192009171 +:1024C00002905D2229A161A0FFF75EF930E0FFE7ED +:1024D0002346FFF7A9FD2BE02346FFF7C5FC27E0C5 +:1024E0002346FFF7F9FE23E01D460C460B78FF223A +:1024F00023321EA164A0FFF747F922462946052092 +:10250000C0E700E007E00B78FF222C3217A166A09D +:10251000FFF73AF90CE0CA888C884888098803924A +:10252000009101900294662210A167A0FFF72CF998 +:10253000002004B070BD0000130700000307000076 +:10254000000700006170705F676170632E630000B8 +:102550003C25732C25643E556E6B6E6F77204D7352 +:102560006749643A307825580D0A00006170705F41 +:10257000676170632E6300003C25732C25643E4325 +:102580004D505F455654286F703A25642C73746122 +:102590003A30782578290D0A000000003C25732C7C +:1025A00025643E676170635F636F6E6E6563746917 +:1025B0006F6E5F696E64286369643A25642C636892 +:1025C000646C3A25642C726F6C653A2564290D0A97 +:1025D000000000003C25732C25643E676170635F3A +:1025E000646973636F6E6E6563745F696E6428639C +:1025F00069643A25642C68646C3A25642C726561C0 +:10260000736F6E3A30782558290D0A003C25732CDB +:1026100025643E706172616D5F75706461746528D8 +:102620006369643A25642C696E764D3A25642C6999 +:102630006E76493A25642C6C6174653A25642C7475 +:10264000696D6F3A2564290D0A0000003C25732C42 +:1026500025643E706172616D5F757064617465645C +:102660005F696E64286369643A25642C696E7476C8 +:102670003A25642C6C6174653A25642C74696D6F1D +:102680003A2564290D0A00003C25732C25643E651B +:102690006E637279705F696E6428617574683A253B +:1026A00064290D0A000000003C25732C25643E734C +:1026B000656375726974795F696E642861757468A1 +:1026C0003A2564290D0A00003C25732C25643E6CD4 +:1026D000655F706B745F73697A655F696E642863A8 +:1026E00069643A25642C7478423A25642C747854D1 +:1026F0003A25642C7278423A25642C7278543A2533 +:1027000064290D0A00000000032210B55202801A4D +:1027100004D0A42813D0A5281DD116E008780128DC +:1027200007D0032807D0A02815D34978FFF792FADD +:1027300011E0002000E00120FFF758FB0BE00A78D1 +:1027400048781146FFF79EFA05E00B788A784878BA +:102750001946FFF79FFA002010BD00000EB50B4888 +:102760000090032080026946088109480190001406 +:102770004881684602F042FD02F044FD02F057FD38 +:1027800002F003FD0349042008600EBD004E002046 +:10279000005A002000E100E00020704770477047B9 +:1027A00070B50A22094B0D460C2805D20446024694 +:1027B00007A12846984707E005A1284698473220F8 +:1027C000A8723620E8720C24204670BD190F000054 +:1027D0006D79426C652D55617274000003210170A2 +:1027E0000021417081701022C2700171012242717A +:1027F0008171704710B500210846F3F772FE002082 +:10280000F3F756FF00F092F800F044FB10BD000013 +:1028100001490870704700006232002010B5084B73 +:1028200000218A008458D2181460491C2629F8D344 +:10283000BFF35F8F03488360BFF34F8F10BD00006D +:102840000030002000ED00E070B51E4CB62160881D +:10285000261D091A89B2301800F0ECFB002500286B +:1028600006D06188081880B26080B6281DD308E0C1 +:102870006088002819D06078411C6170142814D930 +:102880006570114908780328307802D0AA2815D03D +:1028900016E0AA280AD053280DD00A4A4878121DFB +:1028A000618800F009FB00280AD070BD25704878C7 +:1028B00000F0C6F804E00120207001E000F0F4F818 +:1028C000658070BD9C300020623200207CB51446CB +:1028D000154A054610885688801C83B2002032466F +:1028E000C240D20703D0A34206D09B1C9BB2401C1F +:1028F000C0B20928F3D3092000290ED109280DD22E +:1029000001A900F039F8002808D0009068468388B3 +:1029100022460021284600F097F97CBD002003469E +:10292000224680210090F5E76432002038B500216E +:102930000E4800910180FF211E31418000200324B8 +:102940000A46C240D20706D0430022465B1C9A408A +:10295000009B1A430092401CC0B20928F0D3044BDC +:10296000044A69460148F3F7E5FA38BD64320020AD +:10297000CD2801184859011810B504460022104608 +:102980002300FEF711FF090615090C0F1515151286 +:102990001500052209A00EE009220AA00BE005227D +:1029A0000BA008E006220CA005E007220CA002E024 +:1029B000142A00D914220A8010BD0000424C45356B +:1029C0007800000031312E302E322D4C45000000B1 +:1029D000312E302E3000000031312E302E320000EA +:1029E000025E04400000030010B50446C1B200209E +:1029F00000F0AAFB204610BD10B5002903D0012924 +:102A000006D0002010BD19461420FFF7C9FE10BDE6 +:102A100000201880022010BD30B58BB00C46054652 +:102A20002C22064B00216846984708A80472694684 +:102A30002846F1F775FD0BB030BD0000750F0000A2 +:102A400010B503221321F1F738FD10BD70B505460E +:102A50000E463520202303220621400100F04CFEC3 +:102A60000446A02020701C22044B65703146201DB6 +:102A70009847204600F059FE70BD0000190F000075 +:102A800010B504463520022303220621400100F040 +:102A900033FE042C01D3A82100E0A721017044706B +:102AA00000F043FE10BD000010B5012303220621F3 +:102AB000034800F021FE0121017000F036FE10BD38 +:102AC00001060000FFB515460E46074681B02323D8 +:102AD00003220621084800F00FFE0670477045806B +:102AE0000446064B2A46001D04999847204600F0EC +:102AF0001CFE05B0F0BD0000A6060000190F000086 +:102B000070B50E4605462A2303220621154800F01B +:102B1000F3FD03210170297841706978C176A98895 +:102B2000C1840446A97820300172A97841727C21C1 +:102B3000618445210901A184002E0CD0707980099F +:102B4000032803D1A07E01210843A0760622064B6C +:102B50003146201D9847204600F0E7FD0449034810 +:102B6000086070BD01060000190F0000FD4100184B +:102B700050910020F8B5064617460D4635203A23F9 +:102B800003220621400100F0B7FD0446A420207076 +:102B9000044B66702A463946A01C9847204600F030 +:102BA000C4FDF8BD190F000008B56A461180002168 +:102BB00091700421FFF7DEFF08BD10B504463520F3 +:102BC000022303220621400100F096FDA521017099 +:102BD000447000F0AAFD10BD70B50E4601021C46FF +:102BE0001546062303220648491D00F085FD467060 +:102BF000458084804221017000F097FD70BD000087 +:102C000011050000F8B50F4611461E4608318BB27B +:102C100001021546512003220001491D00F06CFD00 +:102C2000044612202070A780E580002E05D02046A3 +:102C3000044B2A46314608309847204600F075FD7F +:102C4000F8BD0000190F0000F8B50F461D46991D8C +:102C50008BB20102164603220A48491D00F04CFDC2 +:102C600047704680044685804020207006980028E2 +:102C700004D00146044B2A46A01D9847204600F088 +:102C800054FDF8BD11050000190F000070B50D4688 +:102C900001021446042303220548491D00F02CFDBF +:102CA000457044804121017000F03FFD70BD00007F +:102CB0001105000000201349884700F041F800F09A +:102CC0002FF810490A205A3988470F484169890965 +:102CD0008901223141610B488C388047044600F05D +:102CE0008BF9214609A0FEF74FFD2046FFF736FD80 +:102CF0000C20F1F7D8FA62B600F046FF00F046FA71 +:102D0000FAE70000D10800004010034053746172DC +:102D1000742872736E3A2558292E2E2E0D0A000043 +:102D200001208007826A80218A438262026A0A4304 +:102D30000262026A8A430262826A0A4382627047BE +:102D400001208007C16A0322D2021143C1620A48EE +:102D50000168082211430160026801210A430260F0 +:102D600002688A4302600548026902239A430261AD +:102D700002690A43026170474000004000000340BE +:102D80000121890708690007000F022805D00428DF +:102D900005D008280DD0042070470020704708692E +:102DA000C00501D50220704748680128FBD00320E8 +:102DB00070470520704710B5002000F0CFF910BD16 +:102DC000FEB50C46324906460878101AC5B20846C8 +:102DD00047887000002C09D0012C1BD0022C46D053 +:102DE000032C02D10879401C0871FEBD032D07D0C9 +:102DF00000200346802100903046FFF725FFFEBDEE +:102E0000C740B807800F6946888001A802230021C7 +:102E10000090F1E71C46052D02D0032D0DD024E0D3 +:102E20006078002803D100213046FFF72FFF61882A +:102E300030466268FFF7BFFFFEBD6378002B14D1F8 +:102E40006388022B11D163685C781D7823022B43C1 +:102E5000022B0AD803248440A74383401F434F809A +:102E600000213046FFF712FFFEBD8021F9E7002167 +:102E70000B46052D06D0032D07D003213046FFF762 +:102E8000ABFEFEBD01235B02F8E70223F6E700007C +:102E90005C32002010B50548002101800522027136 +:102EA0004180034B034AF3F745F810BD5C32002024 +:102EB000C12D0118AC59011870B58924002917D00B +:102EC0000C4D2B79002B13D06B884400E3409B07FB +:102ED0009B0F0CD02B8800249B1C9EB213460A46E5 +:102EE0003146FFF78FFE2879401E287100E08A24C2 +:102EF000204670BD5C320020F0B5364C87B0A0682B +:102F000081B235480818A060354D3448E86335492A +:102F100010208860344FB8693449884257D16E46D2 +:102F2000002001A98200D3191B68401CB350062859 +:102F3000F8D308690A22431C002B25D0134683438B +:102F400022D1A3681F263605C005C00EB343000575 +:102F50000343A360E86B0B8A400940019B04DB0E2E +:102F60001843E863A0680E690F231B04B603360FED +:102F7000984336043043A060E86B98430B699B028A +:102F80001B0F1B041843E863C868194B441C05D089 +:102F90001446844302D18005800E18610868441CE1 +:102FA00008D0824306D15A69800592099201800EA9 +:102FB00002435A618868411C09D0002807D00D4B94 +:102FC000D9697C22800A914310400143D96107B03E +:102FD000F0BD0000000003400000B10114037400C4 +:102FE0000010034000100040000F0018B6D5F5C8CF +:102FF0004010034040C0024010B5042203210020CD +:1030000000F06AF803228B21002000F037F811232A +:1030100014222121002000F049F8044800214180B9 +:103020000180012002490003086010BD56310020D4 +:1030300000E100E030B5104C054620886288801A17 +:10304000FF300130C3171B0E1B181B0A1B02C01ACE +:1030500080B2884200D9084600280BD0002306E041 +:10306000A1180979521CE9545B1CD2B29BB283426D +:10307000F6D3628030BD0000563100200A4B0003B9 +:1030800010B5C0180023C360C36880242343C36005 +:103090008160C168A143C160C16907231943C1614F +:1030A00020210A43C26010BD0030024010B5084C18 +:1030B00000030019C1618261A415C168002A01D012 +:1030C000214300E0A143C16002498162436210BD17 +:1030D00000300240FF0F000030B5FF24174B823450 +:1030E0009500ED182C60A1248900CB181C604300CA +:1030F0008024134D234349190B60114621430F4C83 +:10310000C300803C1B195960E105CC6A0123C01C37 +:1031100083401C43CC62486A18434862486A98431B +:1031200048620920074B03E05969D140C90704D11F +:103130000146401EC0B20029F6D130BD002100403A +:103140000020004000000140034A00038018026A8A +:103150009206FCD541607047003002400A4B0003E4 +:10316000C01805E0036A9B06FCD513784360521C27 +:103170000B46491E89B2002BF4D1016A8906FCD5A1 +:10318000016AC905FCD470470030024010B5FFF752 +:103190005BFB07480178032909D106490978002912 +:1031A00005D0044A4078121DB621FFF785FE10BDF8 +:1031B000623200209C30002010B5554C0021208840 +:1031C00000280DD000F097F91F21081A2188C0B2FD +:1031D0000122824091432180DF21C001C9004118B2 +:1031E000084610BDDF21C90010B5401AC109EFF330 +:1031F000108072B6464A138801248C402343138002 +:1032000080F3108810BD70B5414C00206188002902 +:1032100012D0084600F06FF91F21081AC1B2C80089 +:103220000019EFF3108272B6638801258D40AB431D +:10323000638082F31088183070BD364910B540188D +:10324000C109EFF3108072B6314A538801248C40D3 +:103250002343538080F3108810BD70B52C4C0020A0 +:10326000A188002914D0084600F045F91F21081A4A +:10327000C1B2182097224843D2008018EFF3108281 +:1032800072B6A38801258D40AB43A38082F31088DA +:1032900070BD972210B5D2001821801AFEF7ACF944 +:1032A000EFF3108172B61A4CA288012383401A43AF +:1032B000A28081F3108810BD10B5154C0021E08864 +:1032C00000280FD000F017F91F21081AE188C0B2BA +:1032D000012282409143E180820000211219518134 +:1032E000401CC1B2084610BD094980004018001DAD +:1032F000704759210901884202D3401A800900E031 +:10330000401E034AD188012383401943D18070476E +:103310007091002008F4FFFF01460020096802E0D8 +:103320000968401C80B20029FAD170470268002A5F +:1033300005D042681160416000200860704701605C +:10334000F9E70368002B05D043681960426000204C +:10335000106070470160F9E70268002A00D14160FF +:103360000A600160704702460068002804D00168C6 +:103370001160002900D15160704710B50024234628 +:10338000026805E08A4201D1012405E01346126873 +:10339000002AF7D1002C07D00A68002B06D01A604B +:1033A00042688A4200D14360204610BD0260F7E7C0 +:1033B000002906D013680B604368934200D1416036 +:1033C000704703681B680360F6E71368002905D09F +:1033D0000B604368934200D1416070470360F8E797 +:1033E000F7B50F4606460025046814E0204602990A +:1033F000B84700280DD02068002D01D0286000E0DB +:1034000030602068002802D00020206005E0756050 +:1034100003E025462468002CE8D12046FEBD10B408 +:103420000C000ED00023016801E00B460968A142A0 +:1034300001D00029F9D1002B03D01A60116010BC13 +:10344000704710BC114687E70B000DD0016800E003 +:103450000968994202D00029FAD105E0002903D079 +:103460000B68002B02D002E011465FE7426008685B +:1034700010600A607047F7B504680E4607460025DD +:10348000002C08D0029A214630469047002803D1EC +:1034900025462468F4E77E603460002D01D02E605C +:1034A000FEBD3E60FEBD0000410855221140401A9D +:1034B0000246332180080A40084010180109081804 +:1034C0000007000F70472021020401D01021104690 +:1034D000020201D010460839020101D01046091F2E +:1034E000820001D01046891E420001D01046491EBC +:1034F000C00F081A70472021020C01D0102110467D +:10350000020A01D010460839020901D01046091FED +:10351000820801D01046891E420801D0881E7047DB +:10352000081A70470021425C002A01D00020704731 +:10353000491C0629F7DB0120704710B50022835C87 +:103540008C5CA34201D0002010BD521C062AF6DB81 +:10355000012010BD0549064A08685043054A8018F5 +:10356000086040087047014908607047C892002011 +:103570006D4EC64187D61200F3B5C01C00248508E5 +:10358000AD002D1D81B0264627460C2D00D20C25FE +:10359000EFF31080009072B6029802213018FEF707 +:1035A0002BF80806810D4F482A46081880690C320E +:1035B0000EE04188A9420AD3914202D28368002BCF +:1035C00005D0002C02D063888B4200D904464068A5 +:1035D0000028EED1002C03D06088904200D205462E +:1035E000761CF6B2022E02D2002CD5D001E0002CBF +:1035F0000BD06088A8420CD1A16860684860606800 +:1036000000280AD0A168816007E03748F8F796FDE6 +:1036100007E0401B80B26080041965803348208039 +:10362000271D009880F310883846FEBDF0B50023B2 +:10363000021F2F49118054881946EFF31085AC46BC +:1036400072B69D00274E5F00AD19AD69BE19368C6C +:10365000A84204D3AE19864201D3294601E05B1C7F +:10366000DBB2022B01D20029EBD00020214B2DE050 +:103670004D886D18954211D14888001982B24A8050 +:1036800048685318984228D14388D2184A80426823 +:103690004A604068002820D081601EE08A4213D230 +:1036A0004260906010191380884209D148685060C8 +:1036B0004868002800D082604888001950800CE0DB +:1036C00051608A60548008E0084649680029CFD1DB +:1036D00042605160906054801380604680F310888F +:1036E000F0BD0000F88F0020F2F2F2F23883000003 +:1036F0000FF000005AA50000F8B504460F46184622 +:103700001D46164601210C30FFF736FF0021C94344 +:1037100001608480C780068145810C30114B0446CE +:103720002A46002198472046F8BD10B501460C39BD +:10373000EFF3108472B60C48FFF7F8FD0B480168F0 +:1037400008221143016084F3108810BD10B50023D6 +:10375000FFF7D2FFFFF7E9FF10BD03460C3BD9800E +:103760001A81E2E7750F0000F88F00203C900020DE +:10377000F8B50C460746010AC0B2082822D21A4AF8 +:10378000800012580020904700281BD00178A142E9 +:1037900018D004701548164D082600903A46154971 +:1037A0000098FFF71DFE01000CD0EFF3108472B6F5 +:1037B0000E480838FFF7BAFD28683043286084F3C4 +:1037C0001088EBE7F8BD10B5010AC0B2FF24082845 +:1037D00007D2054A8000125800209047002800D0E8 +:1037E0000478204610BD00001C90002000900020AE +:1037F0003C90002069670018F0B50746414885B045 +:1038000015460E46824201D9054602E0002D00D140 +:103810000A253A043D4832433B490490FFF7E0FD56 +:10382000040006D101211020FFF7A6FE8780044680 +:10383000C680EFF3108672B602A800F092F986F304 +:103840001088029800907D200399000145436D186F +:1038500001912F492846FDF7CFFE2D492D4A4143BE +:10386000691AE1600099081800010009A06021466A +:103870000498FFF700FE254810380069A04203D1E4 +:10388000C168806800F0A3F8E168A068F2F780FFE3 +:10389000002802D0042000F03FF805B0F0BD70B55C +:1038A0001A4C0246103C2569002D29D0AB881748D8 +:1038B00093421AD1EB888B4217D1FFF754FD24694C +:1038C000002C0DD0E168A06800F081F8E168A068E4 +:1038D000F2F75EFF00280ED0042000F01DF80AE089 +:1038E0000021481E00F073F805E012040A4306495F +:1038F000FFF776FD0546002D02D02846FFF796FE1D +:1039000070BD0000FFFF7F02FB67001808900020D9 +:1039100071020000D367001810B5EFF3108172B682 +:103920000A4B1A680124844022431A6081F31088EC +:1039300010BD10B5EFF3108172B6044B1A68012464 +:103940008440A2431A6081F3108810BD3C9000208F +:103950000A49002804D048694004400E18307047D6 +:1039600008694004400E28307047002902D08000CA +:103970002C307047C000503070470000800000506D +:103980000521431C10220907002B06D0694B586201 +:103990000A6288699043104301E088699043886116 +:1039A000704710B50522441C20231207002C0AD0B2 +:1039B00027242401611A5F4CA062E16213629069BE +:1039C0009843184301E090699843906110BD30B569 +:1039D000EFF3108472B6451C052240231207002D18 +:1039E0000AD027252D01691A524D28636963136295 +:1039F00090699843184301E090699843906184F37B +:103A0000108830BDF0B5002084460120494EC00723 +:103A1000B063B06BC00FFCD1B06B050146482D09F7 +:103A20000088002845D145480068002841D101217F +:103A3000C90600220520000783697020034038D0A2 +:103A40003F4FD80609D5706A401B04012409A01E07 +:103A5000B8422ED28C4200D2214698060DD5B06ACB +:103A6000401B04012409A01EB84222D28C4204D279 +:103A7000F06A214627221201121A580612D5306B1D +:103A8000401B00010009831EBB4212D2884209D8A4 +:103A9000736B27242401E31A884201D3934201D295 +:103AA00001461A46F06B80180A22800951434018DB +:103AB00084466046F0BD7FB504461020EFF31082C7 +:103AC00072B61D4B1D8805431D8082F310881E4E63 +:103AD0001C481D4D5C36002902D01022A84702E088 +:103AE00010220021B047002C04D010222146684645 +:103AF000A84703E0102200216846B0470D4800990E +:103B000040384163019981630299C163094A03996D +:103B100011604C2151600421052212071162936942 +:103B20008B430B439361026B01218A430A43026377 +:103B30007FBD0000C0000050F08F00203C900020AE +:103B4000FFFFFF0730810020190F000001200D4901 +:103B5000C0078863886BC00FFCD1886B0001000927 +:103B600070470121074AC9079163916BC90FFCD1C6 +:103B7000916BD26B0901090927231B019A1A06C010 +:103B800070470000C000005070B50B480088400727 +:103B900010D40A4C20681F250AE0FFF7ACFC281A55 +:103BA0000006800D00194068002800D0804720687A +:103BB0000028F2D170BD0000F08F00203C90002062 +:103BC0001FB50220FFF7B5FE054B684610220349DA +:103BD000984769460020F2F7A3FE1FBD40810020F0 +:103BE000190F000070B5EFF3108572B62048FFF78B +:103BF000BAFB040002D00020C043206085F3108887 +:103C0000002C26D020464038808F1A49884220D187 +:103C1000E088194B010A0006A288800D1B58104647 +:103C20009847051E05D021460C312389E288A088DB +:103C3000A847002804D001280BD0022809D103E0AE +:103C40002046FFF7F3FC04E0094821460830FFF75F +:103C50006DFBEFF3108072B605490968002904D1A5 +:103C600006490A6808239A430A6080F3108870BDE9 +:103C7000F88F0020388300001C9000203C9000202A +:103C80007FB51C4D0420FFF754FE2C69002C30D06A +:103C9000EFF3108672B66846FFF763FF86F310886D +:103CA00001990098039102900146A0680122411AEF +:103CB000C91E09010909D20691420CD2E168FFF739 +:103CC00086FEE168A068F2F763FD002811D00021AC +:103CD000481EFFF77CFE07481030FFF744FB044600 +:103CE000C1888088FF22FFF731FD2046FFF79EFC48 +:103CF000C8E77FBDF88F0020F8B50620FFF719FE52 +:103D0000104E3588002D1BD0002401270CE03846CA +:103D1000A040284204D07088C1B22046F3F7E9FAE7 +:103D2000641CE4B2032C02D270880028EFD13088E2 +:103D3000002805D07088002802D00620FFF7ECFD8F +:103D4000F8BD00008C920020F1B582B00298F549D0 +:103D5000800001900D582C468034207AA17A800092 +:103D600040180299C0B20902009155E0708FB18FDE +:103D70008007800F012816D0022814D003283AD1DA +:103D80000846FFF786FAE8490198029B0858002880 +:103D900006D0006A4268002A02D0417A184690474D +:103DA0000322009922E0708F000A042805D97E22A0 +:103DB000525B520601D5001F80B200281BD06F6AEB +:103DC0000818FA88B9889205920D8918884212D38A +:103DD00028462430FFF7C7FAE86AB84201D100202C +:103DE000E862B888FFF729FA009902228320800050 +:103DF000491CFFF7ABFC708F102188437087207B34 +:103E00000421401E2073A07A401CFDF7F5FBA1722F +:103E1000207A80004018C0B2217B002905D0010122 +:103E2000C2480E18308FC00BA0D14035E98F082052 +:103E30008143207B002800D00120C0000143E98796 +:103E4000FEBDF1B588B00898B64980000C58042131 +:103E500025464035E88F8843E8870898000202909D +:103E6000E5E0B34B1C21987A4843B04980394018AB +:103E70000090478A818A01918907890F0391C18A3D +:103E80000026C9B20691216D0591E98F4904490CBC +:103E9000002F11D00022D2031143E987FA070DD079 +:103EA000A4490878401C0006000E087003D018686A +:103EB0000028FBD08047B5E00122ECE79D4A0023B3 +:103EC0001370CA0704D0428B008B16040643E664C5 +:103ED000C80570D4FF2001300143E987C8070CD022 +:103EE000A878012809D120462030817F002904D0FC +:103EF0000121C1770898F7F7EEF9A88E2887E88F97 +:103F0000C00711D00098808B27218005800D090102 +:103F1000081A04908D20005DFFF71AFD41000498F7 +:103F2000401A00B2844908E0606CE064206509E052 +:103F30004018761E360100B236090028F8DB688585 +:103F400066642665E88F810707D402210843C2070B +:103F5000E887D20F0223029911E0C0071FD0206D1D +:103F6000410805984008081A216E00010009490817 +:103F7000FDF742FB002912D002230299FF226E486E +:103F8000491C6238FFF7B8FB0646206D216E4008D9 +:103F90004908FDF731FB31803046FFF7C6FBE88F5B +:103FA000410508D4810706D50199490703D50121A8 +:103FB00089020843E887380734D4E06C60656620DE +:103FC00007422FD1F80607D5E88F80210843E887FC +:103FD00002208921085525E00198060A22D003987D +:103FE00000281FD0042E04D9E88F800601D5361F83 +:103FF000B6B20098878C504802990823FF22663891 +:10400000491CFFF779FB0780468003990171A98E4F +:10401000C180FFF78AFBE88F04210843E8870099F5 +:10402000002088848F2106980855F6F7F9FF089834 +:10403000F7F70EF8002800D013E709B0F0BDF8B587 +:104040000F46384889004458002C3AD01300FDF739 +:10405000ABFB0504043B3F463800154601212046D2 +:10406000F8F78EFA8920005D022822D0FFF76EFD56 +:10407000014620464030C28F930723D5530721D4F1 +:1040800012071FD48278012A1CD00E22266E636C80 +:104090009B191B011B096364C38E26465B1CC386E8 +:1040A000002D01D0A27D521CB275C08FC20B3846C4 +:1040B00033E04034E08F000632D53D213846F7F733 +:1040C000B6F8F8BD1022E1E73846FFF7BAFEF8BDB2 +:1040D0003846FFF739FE3846F7F7BEFAF8BDFFF766 +:1040E00035FD054601212046F8F74AFA2046803082 +:1040F0000146407A022813D0626C206E101802012B +:104100001209204640306264C28E521CC286A07DD5 +:104110000022401CA075087A2946F7F716F9F8BD69 +:104120001621CBE760910020909200208083002030 +:1041300050910020D092002071020000F1B590B0A3 +:104140001098002780000B90E8E0EB481C21807A53 +:104150004843EA494518688A3D21084206D1A88AA1 +:104160000007000F052802D0032877D0D4E0A98CDF +:104170006846E34B2222E34CC918A0476846428BAD +:10418000E14910460A388842F0D86846C08A0628B5 +:10419000ECD31921C9018842E8D86946098BFF236D +:1041A000F4339942E2D8491C414390008142DDD268 +:1041B000A88A69464006C00F0D90062209A823462A +:1041C000984709A80D99F4F701FC0028CED12C23BB +:1041D000FF220021CD48FFF78FFA0746041D688BA8 +:1041E000298B00040843A98B272289050C90890D8F +:1041F0001201E88A561A800BFFF7AAFB4000301A1A +:10420000C24906B26B3106E0701806B20C98401E27 +:10421000000100090C90002EF6DB10983870002089 +:1042200078700120F8702070B9490B980858808E7A +:10423000C00607D5A88A8006C00F05D0AE48C07A50 +:10424000400701D5012000E00020E0730B980858DA +:10425000018F002903D02030807E01E042E0002061 +:10426000B87004222046A74B103003A998470322B8 +:104270002046A44B193004A998476846C17C2046C3 +:1042800020300E9001716846808A60846846C08A3A +:1042900020816846008B60816846408BA0810522A2 +:1042A0002046984B143007A9984708A84078062262 +:1042B000C1060E98C90E417108A84078914B40097B +:1042C000A07309A9A01C98470D9860700C98E06134 +:1042D0002684E88A810B0E9881713846FFF725FA0B +:1042E000012719E08A490B9808582030407F0028A0 +:1042F00012D0A98C6846824B0C22824EC918B04756 +:10430000A88A69464006C40F062203A8B04703AA3C +:1043100021461098FBF757FBF6F782FE1098F6F748 +:1043200097FE002800D010E7384611B0F0BDFEB56A +:10433000064677488B00C458002C41D00027002A3D +:1043400016D0012A14D0022A3AD0042A38D12546A0 +:1043500008462035297F02297CD001212046F8F724 +:104360000FF9A08E000776D5A07D401CA075B3E0A4 +:104370000091019201212046F8F702F925462035E7 +:10438000A87E401CC0B2A876297F022904D0218FC4 +:1043900000290BD0884209D3218F002903D08842FD +:1043A00001D3432200E00022012106E0E87EFFF76E +:1043B000C5FE002805D0002211460098F9F7E8FE56 +:1043C000FEBDA08E400711D42A78002A05D0012313 +:1043D00000210098F9F70EFF2F706A78002A05D0A7 +:1043E000012319460098F9F705FF6F70A08E49491F +:1043F0000007019813D5002802D0A07D401C00E0E2 +:104400000A20A075A182606A6660E0602046F7F726 +:10441000BEFF002801D12F77FEBD3C22C4E7002853 +:104420001AD0A06A301A0201E06A120940008242E2 +:1044300002D3A07D401CA075A662E87F002802D0B0 +:104440006068B04202D0606A401C08D0A182616AF4 +:10445000E16006E031E032E00522A275ECE72E498A +:10446000A182FFF777F81121FDF7C6F84804E97F2C +:10447000000C002907D0002802D0202802D002E03A +:10448000012000E01F20E16A490089190818010194 +:10449000090920466160F7F77AFF0028BBD0E87F62 +:1044A000002803D00021C94361602F77606A411C56 +:1044B000B2D0E1688142B0D0FEBD002219E0A06A0E +:1044C000301A0101E06A09094000814204D3A07D4D +:1044D000401CA0756168A1622046F7F758FF0028CC +:1044E00099D0E87F0028E7D1606A401CE4D0E87EDC +:1044F0003C22012162E7000050910020008300204F +:1045000000800020190F0000760C00000602000059 +:10451000A092002001A0000001600000F0B5810021 +:10452000B54889B0006841580591407A8006000E70 +:10453000203103910890D8E0B0481C21807A48438C +:10454000AF494518A88C00900598AE4A408E90421D +:104550007ED8688A3D220290104001D0102877D181 +:104560000020059C01903E3406900490FF2703989C +:10457000012207944277A88A0607360F072E44D2F5 +:104580000027042E0CD1A04900984018211DFEF7E9 +:10459000D4FF002812D00398407E062811D01B2794 +:1045A00024229A4B002120469847012E0BD0002E42 +:1045B00011D0022E11D0062E11D011E0FF20A075CF +:1045C0008FE01A27ECE7A88A15270006C00F20768F +:1045D000062001900BE0132702E0102700E01227CD +:1045E00006200690A88A000A801FC0B2049000200E +:1045F000A075677560760421A176A0747F20E076AF +:10460000A88A4006C70FE77502E0A07DFF2868D0A2 +:104610000298C00607D5607D4007CFD57648006870 +:10462000407C0128CAD9607D15281ED1019A0099C5 +:10463000754B891889B2C9182046744B0A30062276 +:104640005C3B9847688A4006C00F00D0012000E01C +:1046500049E06070688A4006C00F06D1207E0028BD +:10466000ACD0E07B80090328A8D0FF2F12D0664988 +:104670000098231D41181846644B06225C3B98475E +:1046800002980006C00F2070288C60800298C00637 +:10469000C00FE0742423FF2200215D48FFF72CF8AF +:1046A0000746E88A2077594B242238465C3B079915 +:1046B000984704987877049800280BD0009838849D +:1046C0000698B8774D481C22807A002150434C4A06 +:1046D0008018818448480068407A38753846FFF76A +:1046E00024F803984676F6F79BFC0398007DF6F7CE +:1046F000AFFC002800D01FE7089801014048803037 +:104700000818018FC90B03D0018F4904490C018798 +:1047100009B0F0BDF8B5044637480068002832D02B +:104720008B00C05800282ED00027002A13D0012A61 +:1047300011D0022A46D0042A25D10446FFF706FAF2 +:10474000214605462031087E02283FD000200F7602 +:10475000002816D13CE01646024620300091017E2A +:10476000057D022904D000210776002904D10BE041 +:104770000121F9E7F6F754FC2846F6F769FC002812 +:10478000F8D1F9F7B7FFF8BD01211046F7F7F8FEA9 +:10479000702045431F482818418D4905C90F04D092 +:1047A000418D01229202914341850098FFF7B6FEA8 +:1047B000002E01D0012200E0002221460098F9F7E6 +:1047C000DEFFF8BD0846FFF7A9FEF8BD0120BEE7F1 +:1047D00001212046F7F7D4FE606A281A0101A08D56 +:1047E00009094000814203D3A07D401CA075656289 +:1047F0002046F7F7CCFDF8BDB09200205091002084 +:10480000008300207206000000800020750F000069 +:104810000102000040810020F0B58100CB4887B044 +:104820000568685802902030019060E0C8481C215B +:10483000807A4843C7494418608A3D21084253D1D1 +:104840002E462036307E00284ED1A08AA18C00074B +:10485000000F05910121019A0028917501D00128CE +:1048600042D1A08AE18A000A890B0091618B0A0477 +:10487000218B0A430492A18B27228905890D1201FD +:10488000511A22300391C0B20099FFF76EF8074623 +:104890000098FFF75DF8381A039940004018AE49B8 +:1048A000FF304A1E2D308018FCF7A6FE049A8018AF +:1048B00000010009E863208CA886A08A8006C00F4A +:1048C00000D00120402148550098B075A34B0599B0 +:1048D0000298C9180622A24B2E309847A08A40069B +:1048E000C00FE87601203076F6F79AFB0198007E3B +:1048F000F6F7AEFB002899D107B0F0BDF0B5810006 +:10490000924889B0056868580690287D2F46800631 +:10491000000E20370590387E00287DD005980101D3 +:104920008C4880300818008FC00B75D041202C2394 +:10493000FF220021C000FEF7DFFE0490041D069850 +:10494000B97D0A2220305143007E4E197021484320 +:1049500084494018808C80000790E86B0190708932 +:1049600041000198401A3189000189000009029133 +:1049700008360391FCF740FE08460399091A01988E +:1049800008180101090901980091081A0101079806 +:104990000909814205D200990298401800010009D6 +:1049A000009000202070E87E0622C007C00F6070D3 +:1049B0000699A01C6A4B2E319847294604221C31C7 +:1049C0002046674B1030984730882081708860847B +:1049D0002946052215312046614B1430984704982A +:1049E000317A41702046B97D203001908171B088C4 +:1049F0006081F088A08103222046594B3946193046 +:104A000098470198F978017101983979417178795D +:104A1000A0730098E06100E00DE04020405DE0738D +:104A200004980121C1700498297D01700498686080 +:104A3000FAF756F901E0002038760598010145485B +:104A400080300818018F4904490C018709B0F0BD76 +:104A5000FEB53E4B05461868002833D08C0000593F +:104A600000282FD00027002A13D0012A11D0022AB3 +:104A700052D0042A26D10446FFF768F8214605469D +:104A80002031487B02284BD000204F73002817D1DB +:104A900048E016460246203000950191417B057E94 +:104AA000022904D000214773002904D10BE0012121 +:104AB000F9E7F6F7B5FA2846F6F7CAFA0028F8D16A +:104AC000FAF70EF9FEBD01211046F7F759FD7020E7 +:104AD0004543244840382818418D4905C90F04D062 +:104AE000418D01229202914341850198FFF794FE86 +:104AF0000198FFF703FF154800680028E2D000592D +:104B00000028DFD0002E01D0012200E00022009911 +:104B10000198FAF72CF9FEBD0846FFF77DFEFEBDB1 +:104B20000120B2E701212046F7F72AFD606A281A22 +:104B30000101208D09094000814203D3A07D401C62 +:104B4000A07565622046F7F722FCFEBDB4920020F6 +:104B5000509100200083002071020000008000209E +:104B6000190F000080810020F8B505252D07EC699C +:104B7000534EA00726D502202862A96B514C3E2037 +:104B80006268521853085F00D21B4143CF184E4948 +:104B900038466260FCF730FD4C4906434E604A4A95 +:104BA0005043381A521E101A08600B202863012047 +:104BB000A861801E286221880820014304208143C7 +:104BC0002180F8BDE00737D0012028620020A861CD +:104BD0003F49E9603D4B80339E63996BC90FFCD11F +:104BE000996B3C4E0A01374912094988CF0607D50F +:104BF0005F6AD71B3F013F09B74201D210273843F4 +:104C00008F0607D59F6AD71B3F013F09B74201D2E4 +:104C1000202738434F0607D51B6BD21A1201120901 +:104C2000B24201D240221043264A8143A96113882F +:104C300008218B4313800443E00606D51020286228 +:104C4000A9698143A96100F01FF9A00606D52020BB +:104C50002862A9698143A96100F040F8200404D5C5 +:104C600000F08EF80120C00328621B49600608D5B9 +:104C700040202862AA698243AA6108681022104372 +:104C8000086060070CD504202862AA698243AA61E3 +:104C90000C4A13881026B34313800A6802430A6043 +:104CA000200706D508212962A8698843A86100F079 +:104CB00057F82869C00384D5012000046861F8BD55 +:104CC00000000080F08F00207102000040000050C2 +:104CD0001E000100000000083C900020FEB5274D9A +:104CE00068462C68FEF73DFF0126F6062F460C3776 +:104CF00016E0E17D6068401A0099401A401C0001EE +:104D00000009B04224D200281ED002280AD81B482D +:104D1000FEF729FBA8608169002900D088472C682C +:104D2000002CE6D1386800280BD0082105200007A8 +:104D3000016282698A430A4382610168B143314357 +:104D40000160F7F7F4FAFEBD0198A1688842DED948 +:104D50000A48FEF708FB01463846FEF7E7FADEE7A9 +:104D600010B5064C0C342046FEF7FDFA002804D09E +:104D7000C1690029F7D08847F5E710BDB891002038 +:104D8000F8B505200007416A0801040F0E0F3B48E3 +:104D90000A0701D5032202E0CA060BD50222A500AC +:104DA0004359002B05D00119803128180978006C6F +:104DB0009847F8BD314D4A07314B01278035002A0D +:104DC00031DA298AB74039421BD03201D11809881B +:104DD0008906490F062914D1B40003590422002B77 +:104DE00005D08119803120180978006C9847A87C7B +:104DF000B04203D1401C0007000FA874288AB843B2 +:104E00002882288A002808D0411E0842D1D1A87CD7 +:104E1000401C0007000FE874F8BD1A4801882022E2 +:104E200091430180F8BD8907FCD52201D11809887A +:104E30008906490F042911D00022A6008359002BAE +:104E400005D00119803130180978006C9847288AFC +:104E50003946A14088432882E97C04E00122ECE73E +:104E6000641C2407240F3A46A240104201D1A142FB +:104E7000F6D1AC740028D0D0F8BD0000CC91002051 +:104E800000800020F08F0020F8B5012700250E4E8D +:104E9000FF06FEF75BFE3468002C12D06168401AF2 +:104EA00000010009B8420CD20748FEF75CFAA1687D +:104EB000002901D020468847002DEAD0FAF7D4F91E +:104EC000F8BD002CFAD1F8BDB8920020000A0628DF +:104ED00003D0072803D003487047034870470348AE +:104EE00070470000651E011809270118D923011811 +:104EF0000246002003290FD2002A0ED0104BD11AEF +:104F00009A4219D00CDC0F49511813D00E4A891857 +:104F10000ED0092900D10D4870470D484018704740 +:104F2000E0290BD0E12901D0E229F8D109487047E6 +:104F30000948704709487047094870470948704751 +:104F400012070000F9FBFFFF02FDFFFF6347001897 +:104F5000CC920020815C0018994500187746001813 +:104F6000A75A0018A74600180246002000290FD1B2 +:104F7000002A0ED035235B01D11A9A4213D00ADCE5 +:104F80000C49511813D012290BD09E2900D10A4880 +:104F900070470A487047062907D05229FAD10848B5 +:104FA00070470848704708487047084870470848E5 +:104FB00070470000FFF9FFFF31D40018D1920020A4 +:104FC0004DFF001829F70018DDD20018F9F8001875 +:104FD000F9F4001802460020032910D2002A0FD04D +:104FE00051231B01D11A9A421BD00CDC0E495118D7 +:104FF00011D0FA2911D0FF39082900D10B48704788 +:105000000B4840187047012909D0302901D03129B7 +:10501000F8D1084870470848704708487047084862 +:105020007047084870470000F9FBFFFFA1CE001849 +:10503000D2920020FDCF001859D00018FBCB0018E9 +:1050400001CF0018B9CE001801460D4B0020CA1A36 +:10505000994210D007DC03290FD0FF39FF3903290B +:1050600000D108487047012A03D0032AFAD1064824 +:10507000704706487047064870470648704700006A +:1050800005020000E90F0118BF1301188B0D01186C +:1050900019120118C10F011802460020042912D26A +:1050A000002A11D083239B00D11A9A4217D00EDC1C +:1050B000FF3A521E1BD0012A19D0062A15D0FF3AFA +:1050C0000C2A00D10B4870470B4840187047012943 +:1050D00009D0022905D00329F8D1084870470848AB +:1050E00070470848704708487047084870470848A4 +:1050F000704700005D140118D59200206FA80018B9 +:10510000B31401184B8B001851DE0018CFDD0018C6 +:10511000E1DE00180246002003290AD2002A09D045 +:105120000849511809D0FF39FC3908D0012900D1AC +:1051300005487047054840187047054870470548BE +:1051400070470000F5FDFFFF9DF40018D992002084 +:10515000DFF3001875F300181C490020C8601C49D3 +:1051600025220A70491C0870401CC0B2491C0B283B +:10517000F9D326220A7002E00870401CC0B2491C14 +:105180002528F9D327200870704710B51248114917 +:1051900041631249020481631149C163816B032396 +:1051A0009B059943114381630B480E4940300160D0 +:1051B0000D4941600D4901610D494161EFF71EF84C +:1051C0000C48812101600C49416010BDD88F00203E +:1051D00000810020205000004000005040004000AE +:1051E00000E400E4550A5A0050065000051A030076 +:1051F000070A030000900040B034E80310B500F047 +:105200007BF810BD10B50F480024C169042211437A +:10521000C16111074A6A881302434A624A6A82439B +:105220004A62FFF799FF204600F012F810BD10B552 +:1052300005490320F1F79FFAFDF736FC03490420E6 +:10524000086010BD00000340CD4E011800E100E0F1 +:1052500070B5064600F0B4F8304600F0FBF8304672 +:1052600000F0A2FA304600F01DFA304600F0CEF908 +:10527000304600F01DF905241A4D2407002E14D0E5 +:10528000304600F085F800F037FA2068400040080A +:10529000E100084320602068C00FFCD11349124888 +:1052A000086200202880686070BD11490220F1F773 +:1052B000C5FA1048A0610120288070BD70B509486A +:1052C0000088C00701D0012400E00224EFF310851C +:1052D00072B600F033F82046FFF7BAFF85F3108866 +:1052E00070BD0000F08F0020C8002C01C0000050ED +:1052F000C13B01180C80000070B5054624221F4CEC +:1053000000211D48A047202200211D48A04720223F +:1053100000211C48A0471B481B4901611B49002470 +:105320004161A0002A586000401901892046F1F728 +:10533000FDF9641CE4B2022CF3D370BD10B50E4825 +:10534000FEF711F8002802D0FEF770F9F7E70A4CD3 +:1053500008342046FEF707F8002802D0FEF766F969 +:10536000F7E7054C10342046FDF7FDFF002802D07A +:10537000FEF75CF9F7E710BDF88F0020750F00000D +:105380001C9000203C900020E53B0118813C011856 +:1053900010B5094C022808D12068002805D006481D +:1053A000FDF7E1FFFEF742F9F6E700202060034930 +:1053B0006060087010BD00005C900020CF9200205B +:1053C00070B505001BD0012D11D0022D16D100247F +:1053D0002046F1F74AFB641CE4B2022CF8D3002407 +:1053E0002046F1F75AFC641CE4B2032CF8D328469B +:1053F00000F0BEF900210620FEF7BAF970BD0E4993 +:105400000620F1F7B8F900240C480E4B047028224E +:1054100021460B4898470C490720F1F7ACF90020CA +:105420000A4A0B4B3F2111548500401CC0B25C510D +:105430000328F8D370BD0000694F0118D1920020F5 +:1054400064900020750F0000F14E0118CC920020EE +:105450008C90002070B5002400280ED001281CD0AC +:10546000022809D1F0F745FE00212046F1F730FE71 +:10547000641CE4B2032CF7D370BD09490520F1F791 +:105480007AF90020074A084B102111548500401C6E +:10549000C0B25C510328F8D370BD0448046070BDED +:1054A000D54F0118D2920020B4900020989000208F +:1054B00070B51D4D002829D0012817D0022824D10D +:1054C0001A4E002401212046F8F703FB1C206043FC +:1054D00080190069002801D0FEF7A8F8641CE4B226 +:1054E000042CEFD300210420FEF7D9F903248422F1 +:1054F00000210E48A8470D481B2140308187FF211D +:105500004931C18740300470447070BD08490020A3 +:10551000F1F731F907490120F1F72DF910220021A7 +:105520000548A84770BD0000750F0000CC90002012 +:10553000495001189950011890920020F8B5FF25A4 +:10554000052401352407022814D12068A8432060CF +:10555000206840004008E100084320602068C00F38 +:10556000FCD1E060401E60613349086901221203EA +:1055700090430861314820603148E0602E4931484D +:10558000403108620026701C0621FCF735F81C200B +:1055900041433120000108188003010C1C203246D1 +:1055A0004243294817183982FDF706FEB884761C55 +:1055B000062EE8DBC420A0620020E062234E1F23F9 +:1055C0001B027021414389194A8A07029A433A43D0 +:1055D0004A82401C0428F4DB2068A843284320604A +:1055E000F8BD10B510221B4B002119489847FF2029 +:1055F000174CF53020811848A0801848E080FDF74E +:10560000A9FF207316490020087010BD10B50400D2 +:1056100010D0FFF7E6FF2046FFF790FF204600F08E +:10562000FBF8204600F012F9204600F023F920464E +:1056300000F018F810BD0000C00000500F06100068 +:105640001E000100D902FFFF0083002040810020DE +:1056500050910020750F0000D6BE0000898E00001A +:10566000D092002070B50E4E02280FD10024A50064 +:105670007059002806D021460420F7F771FA7059B6 +:10568000FDF7D4FF641CE4B2042CF0D300200146E3 +:105690008200401CC0B2B1500428F9D370BD000094 +:1056A0006091002010B51149002808D010480880EA +:1056B0003F204880FF2088800F20C88010BD0D4B00 +:1056C0000020C201C400D2186418401CA28306281E +:1056D000F7D3002059231B0182018400D2186418DB +:1056E000401C22810428F7D310BD000070910020D7 +:1056F000FF030000F80B000070B51422144C0021C9 +:105700001248A047942200211248A0470020124AC4 +:1057100005461A2103019B181980401CC0B21028AD +:10572000F8D30E482022056045600D480021056031 +:1057300045600C48A04700210A48C94301600A4857 +:1057400001600A498180857170BD0000B891002018 +:10575000750F0000CC910020008000206092002096 +:10576000B89200206C920020C0920020E457000004 +:1057700010B502280BD010220A4B00210848984788 +:105780000748042118304171C171817110BD002496 +:105790002046F7F789FE641CE4B2042CF8D3EFE747 +:1057A0006C900020750F000070B50025002814D003 +:1057B00001280DD002280FD10620FEF7BAF80024E8 +:1057C00001212046F1F75FFD641CE4B2032CF7D3FE +:1057D0000C4805800621418070BD0B490620F1F779 +:1057E0002DF80A490420F0F7C6FF0020084A094BAB +:1057F0003F2111548400401CC0B21D510328F8D32E +:1058000070BD00008C920020F93C01181551011860 +:10581000D9920020C090002070B50B4D02280AD10B +:105820000324A0002858002801D0FDF7FFFE641EC5 +:1058300064B2002CF5DA002001468200401CC0B2A0 +:10584000A9500428F9D370BDA092002010B5084CCF +:1058500002280AD12068002807D00068002801D05B +:10586000FDF7E4FE2068FDF7E1FE0020206010BD9A +:10587000B092002010B50C4C022811D120680028ED +:105880000ED04068002802D00C38FDF7CFFE20680B +:105890000068002801D0FDF7C9FE2068FDF7C6FEAC +:1058A0000020206010BD0000B4920020260833A123 +:1058B00001D20A010100B900032800000002000023 +:1058C000292A000000021400032800000002000042 +:1058D000242A000000021400032800000002000037 +:1058E000252A000000021400032800000002000026 +:1058F000272A000000021400032800000002000014 +:10590000262A000000021400032800000002000004 +:10591000282A0000000214000328000000020000F2 +:10592000232A0000000208000328000000020000F3 +:105930002A2A0000000208000328000000020000DC +:10594000502A0000000207000A180000B858011889 +:1059500012000000160A1040D19F4C6CB455E3F7BA +:1059600000FF0000160A1040D19F4C6CB455E3F7BD +:1059700001FF0000160A1040D19F4C6CB455E3F7AC +:1059800002FF000003280000000200006459011813 +:105990000030004002290000000A02000328000035 +:1059A0000002000074590118000C004254590118FB +:1059B000845901180500400019520018D3520018EC +:1059C000C153001819540018595400189554001860 +:1059D000D95400183355001863550018AF550018F6 +:1059E000DB5500180328000000020000002A000018 +:1059F000000220000328000000020000012A00002D +:105A0000000202000328000000020000042A000037 +:105A1000000208000328000000020000A62A00007F +:105A2000000201000328000000020000C92A000053 +:105A3000000201800328000000020000052A000087 +:105A40000020040002290000000A0000397C001830 +:105A50006D7C0018937D0018197F00186182001872 +:105A6000EB8200188F830018AB800018B3840018F5 +:105A70000000000027850018178600181BA40018D6 +:105A800061150118178B00187794001821950018DC +:105A900087950018CB95001889E0001865980018C4 +:105AA000F9980018E7930018359400182B8D00180A +:105AB00049E00018AF980018FBA400180FA60018C2 +:105AC00069E000180000000000000000339C00188E +:105AD0009F9C00188BAD001817AE001879AE001807 +:105AE0000C010801020F17070D050105010D020148 +:105AF000090109010101010306010205090118015B +:105B00001801030500000000090109010301030158 +:105B1000050100007F09011875010118AF01011886 +:105B2000730201182F030118B5060118B5060118F4 +:105B30009D070118B305011869080118000000004D +:105B40008D080118EF080118250901182509011809 +:105B50003C25732C25643E676170635F636F6E6ED6 +:105B6000656374696F6E5F7265715F696E642863E7 +:105B700069643A25642C6368646C3A25642C636F0D +:105B80006E6E5B696E74763A25642C6C6174653A4E +:105B900025642C746F3A25645D2C6163633A256437 +:105BA0002C63616464723A2564290D0A00000000C8 +:105BB000D05B01189830002004000000C2170118C3 +:105BC000D45B01189C300020CC010000D2170118D2 +:045BD00000000000D1 +:040000051800409906 +:00000001FF diff --git a/projects/bleUart/mdk/output/bleUart.htm b/projects/bleUart/mdk/output/bleUart.htm new file mode 100644 index 0000000..ef95043 --- /dev/null +++ b/projects/bleUart/mdk/output/bleUart.htm @@ -0,0 +1,6995 @@ + + +Static Call Graph - [.\output\bleUart.axf] +
+

Static Call Graph for image .\output\bleUart.axf


+

#<CALLGRAPH># ARM Linker, 5050169: Last Updated: Thu Apr 11 13:45:44 2024 +

+

Maximum Stack Usage = 476 bytes + Unknown(Cycles, Untraceable Function Pointers)

+Call chain for Maximum Stack Depth:

+app_gapc_msg_handler ⇒ gapc_param_update_rsp ⇒ le_rem_con_param_req_reply ⇒ llc_rem_con_upd_proc_fsm ⇒ llc_ll_con_param_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +

+

+Mutually Recursive functions +

  • NMI_Handler   ⇒   NMI_Handler
    +
  • HardFault_Handler   ⇒   HardFault_Handler
    +
  • SVCall_Handler   ⇒   SVCall_Handler
    +
  • PendSV_Handler   ⇒   PendSV_Handler
    +
  • SysTick_Handler   ⇒   SysTick_Handler
    +
  • AON_PMU_IRQHandler   ⇒   AON_PMU_IRQHandler
    +
  • gapc_smp_tkdp_rcp_continue   ⇒   gapc_smp_tkdp_send_start
    + +

    +

    +Function Pointers +

    +

    +

    +Global Symbols +

    +

    __main (Thumb, 0 bytes, Stack size unknown bytes, entry.o(.ARM.Collect$$$$00000000)) +
    [Address Reference Count : 1]

    • startup.o(.INT) +
    +

    _main_stk (Thumb, 0 bytes, Stack size unknown bytes, entry2.o(.ARM.Collect$$$$00000001)) + +

    _main_scatterload (Thumb, 0 bytes, Stack size unknown bytes, entry5.o(.ARM.Collect$$$$00000004)) +

    [Calls]

    • >>   __scatterload +
    + +

    __main_after_scatterload (Thumb, 0 bytes, Stack size unknown bytes, entry5.o(.ARM.Collect$$$$00000004)) +

    [Called By]

    • >>   __scatterload +
    + +

    _main_clock (Thumb, 0 bytes, Stack size unknown bytes, entry7b.o(.ARM.Collect$$$$00000008)) + +

    _main_cpp_init (Thumb, 0 bytes, Stack size unknown bytes, entry8b.o(.ARM.Collect$$$$0000000A)) + +

    _main_init (Thumb, 0 bytes, Stack size unknown bytes, entry9a.o(.ARM.Collect$$$$0000000B)) + +

    __rt_final_cpp (Thumb, 0 bytes, Stack size unknown bytes, entry10a.o(.ARM.Collect$$$$0000000D)) + +

    __rt_final_exit (Thumb, 0 bytes, Stack size unknown bytes, entry11a.o(.ARM.Collect$$$$0000000F)) + +

    Reset_Handler (Thumb, 38 bytes, Stack size 0 bytes, startup.o(.INT)) +
    [Address Reference Count : 1]

    • startup.o(RESET) +
    +

    NMI_Handler (Thumb, 2 bytes, Stack size 0 bytes, startup.o(.INT)) +

    [Calls]

    • >>   NMI_Handler +
    +
    [Called By]
    • >>   NMI_Handler +
    +
    [Address Reference Count : 1]
    • startup.o(RESET) +
    +

    HardFault_Handler (Thumb, 2 bytes, Stack size 0 bytes, startup.o(.INT)) +

    [Calls]

    • >>   HardFault_Handler +
    +
    [Called By]
    • >>   HardFault_Handler +
    +
    [Address Reference Count : 1]
    • startup.o(RESET) +
    +

    SVCall_Handler (Thumb, 2 bytes, Stack size 0 bytes, startup.o(.INT)) +

    [Calls]

    • >>   SVCall_Handler +
    +
    [Called By]
    • >>   SVCall_Handler +
    +
    [Address Reference Count : 1]
    • startup.o(RESET) +
    +

    PendSV_Handler (Thumb, 2 bytes, Stack size 0 bytes, startup.o(.INT)) +

    [Calls]

    • >>   PendSV_Handler +
    +
    [Called By]
    • >>   PendSV_Handler +
    +
    [Address Reference Count : 1]
    • startup.o(RESET) +
    +

    SysTick_Handler (Thumb, 2 bytes, Stack size 0 bytes, startup.o(.INT)) +

    [Calls]

    • >>   SysTick_Handler +
    +
    [Called By]
    • >>   SysTick_Handler +
    +
    [Address Reference Count : 1]
    • startup.o(RESET) +
    +

    AON_PMU_IRQHandler (Thumb, 0 bytes, Stack size 0 bytes, startup.o(.INT)) +

    [Calls]

    • >>   AON_PMU_IRQHandler +
    +
    [Called By]
    • >>   AON_PMU_IRQHandler +
    +
    [Address Reference Count : 1]
    • startup.o(RESET) +
    +

    ATMR_IRQHandler (Thumb, 0 bytes, Stack size 0 bytes, startup.o(.INT)) +
    [Address Reference Count : 1]

    • startup.o(RESET) +
    +

    BB_LP_IRQHandler (Thumb, 0 bytes, Stack size 0 bytes, startup.o(.INT)) +
    [Address Reference Count : 1]

    • startup.o(RESET) +
    +

    BOD12_IRQHandler (Thumb, 0 bytes, Stack size 0 bytes, startup.o(.INT)) +
    [Address Reference Count : 1]

    • startup.o(RESET) +
    +

    BTMR_IRQHandler (Thumb, 0 bytes, Stack size 0 bytes, startup.o(.INT)) +
    [Address Reference Count : 1]

    • startup.o(RESET) +
    +

    CTMR_IRQHandler (Thumb, 0 bytes, Stack size 0 bytes, startup.o(.INT)) +
    [Address Reference Count : 1]

    • startup.o(RESET) +
    +

    DMAC_IRQHandler (Thumb, 0 bytes, Stack size 0 bytes, startup.o(.INT)) +
    [Address Reference Count : 1]

    • startup.o(RESET) +
    +

    EXTI_IRQHandler (Thumb, 0 bytes, Stack size 0 bytes, startup.o(.INT)) +
    [Address Reference Count : 1]

    • startup.o(RESET) +
    +

    FSHC_IRQHandler (Thumb, 0 bytes, Stack size 0 bytes, startup.o(.INT)) +
    [Address Reference Count : 1]

    • startup.o(RESET) +
    +

    I2C_IRQHandler (Thumb, 0 bytes, Stack size 0 bytes, startup.o(.INT)) +
    [Address Reference Count : 1]

    • startup.o(RESET) +
    +

    IWDT_IRQHandler (Thumb, 0 bytes, Stack size 0 bytes, startup.o(.INT)) +
    [Address Reference Count : 1]

    • startup.o(RESET) +
    +

    LVD33_IRQHandler (Thumb, 0 bytes, Stack size 0 bytes, startup.o(.INT)) +
    [Address Reference Count : 1]

    • startup.o(RESET) +
    +

    MDM_IRQHandler (Thumb, 0 bytes, Stack size 0 bytes, startup.o(.INT)) +
    [Address Reference Count : 1]

    • startup.o(RESET) +
    +

    RF_IRQHandler (Thumb, 0 bytes, Stack size 0 bytes, startup.o(.INT)) +
    [Address Reference Count : 1]

    • startup.o(RESET) +
    +

    RTC_IRQHandler (Thumb, 0 bytes, Stack size 0 bytes, startup.o(.INT)) +
    [Address Reference Count : 1]

    • startup.o(RESET) +
    +

    SPIM_IRQHandler (Thumb, 0 bytes, Stack size 0 bytes, startup.o(.INT)) +
    [Address Reference Count : 1]

    • startup.o(RESET) +
    +

    SPIS_IRQHandler (Thumb, 0 bytes, Stack size 0 bytes, startup.o(.INT)) +
    [Address Reference Count : 1]

    • startup.o(RESET) +
    +

    UART2_IRQHandler (Thumb, 0 bytes, Stack size 0 bytes, startup.o(.INT)) +
    [Address Reference Count : 1]

    • startup.o(RESET) +
    +

    USB_IRQHandler (Thumb, 0 bytes, Stack size 0 bytes, startup.o(.INT)) +
    [Address Reference Count : 1]

    • startup.o(RESET) +
    +

    USB_SOF_IRQHandler (Thumb, 0 bytes, Stack size 0 bytes, startup.o(.INT)) +
    [Address Reference Count : 1]

    • startup.o(RESET) +
    +

    rf_reset (Thumb, 170 bytes, Stack size 24 bytes, rf_mdm.o(.text)) +

    [Stack]

    • Max Depth = 80
    • Call Chain = rf_reset ⇒ rf_gain_cal ⇒ rf_dac_adjust +
    +
    [Calls]
    • >>   rf_cbpf_cal +
    • >>   rf_gain_cal +
    +
    [Called By]
    • >>   rfmdm_init +
    +
    [Address Reference Count : 1]
    • gap_api.o(i.gapm_set_dev) +
    +

    rf_pa_set (Thumb, 28 bytes, Stack size 0 bytes, rf_mdm.o(.text)) +

    [Called By]

    • >>   main +
    + +

    rf_dac_tab0_set (Thumb, 10 bytes, Stack size 0 bytes, rf_mdm.o(.text), UNUSED) + +

    rf_dac_tab1_set (Thumb, 10 bytes, Stack size 0 bytes, rf_mdm.o(.text), UNUSED) + +

    rf_dac_tab2_set (Thumb, 14 bytes, Stack size 0 bytes, rf_mdm.o(.text), UNUSED) + +

    co_ones (Thumb, 36 bytes, Stack size 0 bytes, utils.o(.text), UNUSED) + +

    le_sca2ppm (Thumb, 28 bytes, Stack size 12 bytes, utils.o(.text)) +

    [Stack]

    • Max Depth = 12
    • Call Chain = le_sca2ppm +
    +
    [Called By]
    • >>   lld_con_start +
    + +

    le_ppm2sca (Thumb, 32 bytes, Stack size 12 bytes, utils.o(.text)) +

    [Stack]

    • Max Depth = 12
    • Call Chain = le_ppm2sca +
    +
    [Called By]
    • >>   lld_init_start +
    + +

    gapc_process_op_simple (Thumb, 90 bytes, Stack size 24 bytes, gapc_task.o(.text)) +

    [Stack]

    • Max Depth = 108
    • Call Chain = gapc_process_op_simple ⇒ gapc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_state_get +
    • >>   gapc_update_state +
    • >>   gapc_send_cmp_evt +
    +
    [Called By]
    • >>   gapc_smp_cmd_handler +
    • >>   gapc_link_upd_cmd_handler +
    • >>   gapc_get_info_cmd_handler +
    + +

    gapc_disconnect_cmd_send (Thumb, 102 bytes, Stack size 32 bytes, gapc_task.o(.text)) +

    [Stack]

    • Max Depth = 116
    • Call Chain = gapc_disconnect_cmd_send ⇒ le_disconnect ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   le_disconnect +
    • >>   ke_state_set +
    • >>   ke_state_get +
    • >>   gapc_send_cmp_evt +
    • >>   gapc_get_conhdl +
    +
    [Called By]
    • >>   gapc_disconnect +
    • >>   gapc_param_upd_to_handler +
    + +

    gapc_connection_cfg_send (Thumb, 120 bytes, Stack size 24 bytes, gapc_task.o(.text)) +

    [Stack]

    • Max Depth = 84
    • Call Chain = gapc_connection_cfg_send ⇒ atts_process_pdu ⇒ atts_clear_rsp_data ⇒ ke_free +
    +
    [Calls]
    • >>   ke_state_set +
    • >>   ke_state_get +
    • >>   gapc_auth_set +
    • >>   atts_process_pdu +
    +
    [Called By]
    • >>   gapc_connect_rsp +
    + +

    gapc_param_update_rsp (Thumb, 130 bytes, Stack size 40 bytes, gapc_task.o(.text)) +

    [Stack]

    • Max Depth = 444
    • Call Chain = gapc_param_update_rsp ⇒ le_rem_con_param_req_reply ⇒ llc_rem_con_upd_proc_fsm ⇒ llc_ll_con_param_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   le_rem_con_param_req_reply +
    • >>   l2cc_sig_send_param_resp +
    • >>   ke_state_get +
    • >>   gapc_send_complete_evt +
    • >>   gapc_con_param_upd_send +
    • >>   gapc_get_conhdl +
    +
    [Called By]
    • >>   app_gapc_msg_handler +
    + +

    gapc_smp_pairing_tk_exch (Thumb, 132 bytes, Stack size 32 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 180
    • Call Chain = gapc_smp_pairing_tk_exch ⇒ gapc_smp_generate_rand ⇒ aes_rand ⇒ aes_encrypt ⇒ aes_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapc_smp_generate_rand +
    • >>   gapc_smp_pair_fail_send +
    • >>   gapc_smp_pairing_end +
    +
    [Called By]
    • >>   app_gapc_bond_req_ind_handler +
    + +

    gapc_smp_pairing_ltk_exch (Thumb, 138 bytes, Stack size 32 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 228
    • Call Chain = gapc_smp_pairing_ltk_exch ⇒ gapc_smp_tkdp_send_continue ⇒ gapc_smp_tkdp_rcp_start ⇒ gapc_smp_tkdp_rcp_continue ⇒ gapc_smp_tkdp_send_start (Cycle) +
    +
    [Calls]
    • >>   l2cc_smp_pdu_alloc +
    • >>   gapc_enc_keysize_get +
    • >>   gapc_smp_tkdp_send_continue +
    • >>   gapc_smp_pdu_send +
    +
    [Called By]
    • >>   app_gapc_bond_req_ind_handler +
    + +

    gapc_smp_pairing_csrk_exch (Thumb, 92 bytes, Stack size 32 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 228
    • Call Chain = gapc_smp_pairing_csrk_exch ⇒ gapc_smp_tkdp_send_continue ⇒ gapc_smp_tkdp_rcp_start ⇒ gapc_smp_tkdp_rcp_continue ⇒ gapc_smp_tkdp_send_start (Cycle) +
    +
    [Calls]
    • >>   l2cc_smp_pdu_alloc +
    • >>   gapc_smp_tkdp_send_continue +
    • >>   gapc_smp_pdu_send +
    +
    [Called By]
    • >>   app_gapc_bond_req_ind_handler +
    + +

    gapc_smp_pairing_rsp (Thumb, 372 bytes, Stack size 40 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 180
    • Call Chain = gapc_smp_pairing_rsp ⇒ gapc_smp_pairing_end ⇒ gapc_smp_launch_rep_att_timer ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   l2cc_smp_pdu_alloc +
    • >>   gapc_smp_pair_fail_send +
    • >>   gapc_smp_check_max_key_size +
    • >>   gapc_smp_is_sec_mode_reached +
    • >>   gapc_smp_get_key_sec_prop +
    • >>   gapc_smp_pdu_send +
    • >>   gapc_smp_pairing_end +
    • >>   gapc_smp_check_key_distrib +
    • >>   gapc_smp_send_pairing_req_ind +
    +
    [Called By]
    • >>   app_gapc_bond_req_ind_handler +
    + +

    gapc_smp_encrypt_cfm (Thumb, 58 bytes, Stack size 16 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 420
    • Call Chain = gapc_smp_encrypt_cfm ⇒ gapc_smp_send_ltk_req_rsp ⇒ le_ltk_req_reply ⇒ llc_rem_encrypt_proc_fsm ⇒ llc_ll_reject_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapc_smp_send_ltk_req_rsp +
    +
    [Called By]
    • >>   app_gapc_encrypt_req_ind_handler +
    + +

    gapc_smp_pdu_recv (Thumb, 82 bytes, Stack size 16 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 156
    • Call Chain = gapc_smp_pdu_recv ⇒ gapc_smp_pairing_end ⇒ gapc_smp_launch_rep_att_timer ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapc_get_role +
    • >>   gapc_smp_pair_fail_send +
    • >>   gapc_smp_pairing_end +
    +
    [Called By]
    • >>   l2cc_pdu_recv_ind_handler +
    + +

    gapc_smp_cleanup (Thumb, 36 bytes, Stack size 16 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 72
    • Call Chain = gapc_smp_cleanup ⇒ gapc_smp_clear_timeout_timer ⇒ ke_timer_clear ⇒ ke_time_past +
    +
    [Calls]
    • >>   ke_free +
    • >>   gapc_smp_clear_timeout_timer +
    +
    [Called By]
    • >>   gapc_operation_cleanup +
    + +

    gapc_smp_cmd_handler (Thumb, 310 bytes, Stack size 32 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 172
    • Call Chain = gapc_smp_cmd_handler ⇒ gapc_smp_pairing_start ⇒ gapc_smp_pdu_send ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   l2cc_smp_pdu_alloc +
    • >>   ke_malloc +
    • >>   gapc_smp_pairing_start +
    • >>   gapc_smp_pdu_send +
    • >>   gapc_smp_send_pairing_req_ind +
    • >>   gapc_smp_send_start_enc_cmd +
    • >>   gapc_send_complete_evt +
    • >>   gapc_process_op_simple +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Address Reference Count : 1]
    • gapc_task.o(le_task_hdl_func) +
    +

    gapc_key_press_notify (Thumb, 80 bytes, Stack size 16 bytes, gapc_smp.o(.text), UNUSED) +

    [Calls]

    • >>   l2cc_smp_pdu_alloc +
    • >>   ke_timer_active +
    • >>   gapc_smp_pdu_send +
    • >>   ke_timer_set +
    + +

    gapc_smp_gapm_cmp_evt (Thumb, 84 bytes, Stack size 16 bytes, gapc_smp.o(.text), UNUSED) +

    [Calls]

    • >>   gapc_get_role +
    • >>   gapc_smp_pair_fail_send +
    • >>   gapc_smp_pairing_end +
    • >>   ke_state_get +
    + +

    gapc_smp_timer_ind_handler (Thumb, 84 bytes, Stack size 16 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 156
    • Call Chain = gapc_smp_timer_ind_handler ⇒ gapc_smp_pairing_end ⇒ gapc_smp_launch_rep_att_timer ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapc_smp_pairing_end +
    • >>   ke_state_get +
    +
    [Address Reference Count : 1]
    • gapc_task.o(le_task_hdl_func) +
    +

    le_ltk_req_evt (Thumb, 86 bytes, Stack size 16 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 140
    • Call Chain = le_ltk_req_evt ⇒ gapc_smp_generate_stk ⇒ aes_encrypt ⇒ aes_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapc_get_conidx +
    • >>   gapc_smp_generate_stk +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   llc_rem_encrypt_proc_fsm +
    + +

    le_enc_chg_evt (Thumb, 30 bytes, Stack size 16 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 252
    • Call Chain = le_enc_chg_evt ⇒ gapc_smp_handle_enc_change_evt ⇒ gapc_smp_tkdp_send_start ⇒ gapc_smp_tkdp_send_continue ⇒ gapc_smp_tkdp_rcp_start ⇒ gapc_smp_tkdp_rcp_continue ⇒ gapc_smp_tkdp_send_start (Cycle) +
    +
    [Calls]
    • >>   gapc_get_role +
    • >>   gapc_get_conidx +
    • >>   gapc_smp_handle_enc_change_evt +
    +
    [Called By]
    • >>   llc_op_encrypt_ind_cb +
    • >>   llc_loc_encrypt_proc_fsm +
    • >>   llc_rem_encrypt_proc_fsm +
    + +

    attmdb_svc_check_hdl (Thumb, 72 bytes, Stack size 16 bytes, attm_db.o(.text)) +

    [Stack]

    • Max Depth = 16
    • Call Chain = attmdb_svc_check_hdl +
    +
    [Called By]
    • >>   attmdb_svc_create +
    • >>   attm_reserve_handle_range +
    + +

    attmdb_svc_create (Thumb, 370 bytes, Stack size 48 bytes, attm_db.o(.text)) +

    [Stack]

    • Max Depth = 96
    • Call Chain = attmdb_svc_create ⇒ attmdb_svc_att_desc ⇒ attm_is_bt_uuid +
    +
    [Calls]
    • >>   attm_is_bt_uuid +
    • >>   attmdb_svc_check_hdl +
    • >>   attmdb_svc_att_size +
    • >>   attmdb_svc_att_desc +
    • >>   ke_malloc +
    +
    [Called By]
    • >>   sess_svc_init +
    • >>   gatt_svc_init +
    • >>   gap_svc_init +
    • >>   diss_svc_init +
    + +

    attm_con_create (Thumb, 36 bytes, Stack size 16 bytes, attm_db.o(.text)) +

    [Stack]

    • Max Depth = 16
    • Call Chain = attm_con_create +
    +
    [Called By]
    • >>   gapm_con_create +
    + +

    attm_con_cleanup (Thumb, 40 bytes, Stack size 24 bytes, attm_db.o(.text)) +

    [Stack]

    • Max Depth = 24
    • Call Chain = attm_con_cleanup +
    +
    [Called By]
    • >>   gapm_con_cleanup +
    + +

    attmdb_destroy (Thumb, 48 bytes, Stack size 16 bytes, attm_db.o(.text)) +

    [Stack]

    • Max Depth = 36
    • Call Chain = attmdb_destroy ⇒ ke_free +
    +
    [Calls]
    • >>   ke_free +
    +
    [Called By]
    • >>   gapm_config_cmd_handler +
    • >>   gattm_init +
    + +

    attmdb_get_service2 (Thumb, 72 bytes, Stack size 12 bytes, attm_db.o(.text)) +

    [Stack]

    • Max Depth = 12
    • Call Chain = attmdb_get_service2 +
    +
    [Called By]
    • >>   atts_execute_write_req +
    • >>   atts_find_info_req +
    • >>   atts_find_value_by_uuid +
    • >>   attm_att_set_perm +
    • >>   attm_att_set_value +
    • >>   attm_get_value +
    • >>   atts_get_svc_func +
    • >>   attm_att_update_perm +
    • >>   attmdb_att_get_perm +
    + +

    attmdb_svc_visibility_set (Thumb, 62 bytes, Stack size 8 bytes, attm_db.o(.text), UNUSED) + +

    attmdb_chk_wr_len (Thumb, 74 bytes, Stack size 12 bytes, attm_db.o(.text)) +

    [Stack]

    • Max Depth = 12
    • Call Chain = attmdb_chk_wr_len +
    +
    [Called By]
    • >>   atts_write_req +
    • >>   atts_execute_write_req +
    • >>   atts_write_common +
    + +

    attm_get_svc_uuid (Thumb, 64 bytes, Stack size 8 bytes, attm_db.o(.text)) +

    [Stack]

    • Max Depth = 40
    • Call Chain = attm_get_svc_uuid ⇒ attm_uuid32_conv +
    +
    [Calls]
    • >>   attm_uuid32_conv +
    +
    [Called By]
    • >>   attm_get_value +
    + +

    attm_get_att_uuid (Thumb, 52 bytes, Stack size 8 bytes, attm_db.o(.text)) +

    [Stack]

    • Max Depth = 40
    • Call Chain = attm_get_att_uuid ⇒ attm_uuid32_conv +
    +
    [Calls]
    • >>   attm_uuid32_conv +
    +
    [Called By]
    • >>   attm_get_value +
    • >>   attm_get_hdl_uuid +
    + +

    attm_get_hdl_uuid (Thumb, 42 bytes, Stack size 0 bytes, attm_db.o(.text)) +

    [Stack]

    • Max Depth = 40
    • Call Chain = attm_get_hdl_uuid ⇒ attm_get_att_uuid ⇒ attm_uuid32_conv +
    +
    [Calls]
    • >>   attm_get_att_uuid +
    +
    [Called By]
    • >>   atts_find_info_req +
    • >>   atts_find_value_by_uuid +
    + +

    attmdb_att_get_perm (Thumb, 184 bytes, Stack size 20 bytes, attm_db.o(.text)) +

    [Stack]

    • Max Depth = 32
    • Call Chain = attmdb_att_get_perm ⇒ attmdb_get_service2 +
    +
    [Calls]
    • >>   attmdb_get_service2 +
    +
    [Called By]
    • >>   atts_get_att_chk_perm +
    + +

    gap_svc_set_dev_info (Thumb, 4 bytes, Stack size 0 bytes, gap_svc.o(.text)) +

    [Called By]

    • >>   gap_svc_func +
    + +

    gap_svc_func (Thumb, 254 bytes, Stack size 40 bytes, gap_svc.o(.text)) +

    [Stack]

    • Max Depth = 108
    • Call Chain = gap_svc_func ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gap_svc_get_dev_info +
    • >>   gap_svc_set_dev_info +
    • >>   ke_state_get +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Address Reference Count : 1]
    • gap_svc.o(.text) +
    +

    gap_svc_init (Thumb, 148 bytes, Stack size 40 bytes, gap_svc.o(.text)) +

    [Stack]

    • Max Depth = 136
    • Call Chain = gap_svc_init ⇒ attmdb_svc_create ⇒ attmdb_svc_att_desc ⇒ attm_is_bt_uuid +
    +
    [Calls]
    • >>   attmdb_svc_create +
    • >>   attm_att_update_perm +
    +
    [Called By]
    • >>   app_prf_create +
    + +

    gatt_svc_func (Thumb, 228 bytes, Stack size 40 bytes, gatt_svc.o(.text)) +

    [Stack]

    • Max Depth = 108
    • Call Chain = gatt_svc_func ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_state_get +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Address Reference Count : 1]
    • gatt_svc.o(.text) +
    +

    gattc_svc_chg_ind_send (Thumb, 64 bytes, Stack size 16 bytes, gatt_svc.o(.text), UNUSED) +

    [Calls]

    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   gattm_db_updated +
    + +

    gatt_svc_init (Thumb, 44 bytes, Stack size 24 bytes, gatt_svc.o(.text)) +

    [Stack]

    • Max Depth = 120
    • Call Chain = gatt_svc_init ⇒ attmdb_svc_create ⇒ attmdb_svc_att_desc ⇒ attm_is_bt_uuid +
    +
    [Calls]
    • >>   attmdb_svc_create +
    +
    [Called By]
    • >>   app_prf_create +
    + +

    gattm_db_updated (Thumb, 50 bytes, Stack size 24 bytes, gatt_svc.o(.text), UNUSED) +

    [Calls]

    • >>   gattc_svc_chg_ind_send +
    + +

    ke_mem_init (Thumb, 52 bytes, Stack size 12 bytes, ke_mem.o(.text)) +

    [Stack]

    • Max Depth = 12
    • Call Chain = ke_mem_init +
    +
    [Called By]
    • >>   ke_init +
    + +

    ke_task_create (Thumb, 22 bytes, Stack size 0 bytes, ke_task.o(.text)) +

    [Called By]

    • >>   ble_app +
    • >>   llm_init +
    • >>   l2cm_init +
    • >>   gattm_init +
    • >>   gapm_init +
    + +

    ke_timer_active (Thumb, 38 bytes, Stack size 0 bytes, ke_timer.o(.text), UNUSED) +

    [Called By]

    • >>   gapc_key_press_notify +
    + +

    ke_event_callback_set (Thumb, 14 bytes, Stack size 0 bytes, ke_event.o(.text)) +

    [Called By]

    • >>   l2cm_init +
    • >>   ble_drv_init +
    + +

    aes_alloc (Thumb, 22 bytes, Stack size 16 bytes, aes.o(.text)) +

    [Stack]

    • Max Depth = 60
    • Call Chain = aes_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_malloc +
    +
    [Called By]
    • >>   aes_encrypt +
    • >>   aes_c1 +
    + +

    aes_start (Thumb, 42 bytes, Stack size 16 bytes, aes.o(.text)) +

    [Stack]

    • Max Depth = 48
    • Call Chain = aes_start ⇒ ble_aes_encrypt +
    +
    [Calls]
    • >>   list_push_back +
    • >>   ble_aes_encrypt +
    +
    [Called By]
    • >>   aes_c1_continue +
    • >>   aes_encrypt +
    • >>   aes_c1 +
    + +

    aes_encrypt (Thumb, 98 bytes, Stack size 24 bytes, aes.o(.text)) +

    [Stack]

    • Max Depth = 84
    • Call Chain = aes_encrypt ⇒ aes_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   aes_start +
    • >>   aes_alloc +
    +
    [Called By]
    • >>   gapm_sec_enc_aes_cmd_handler +
    • >>   llc_loc_encrypt_proc_fsm +
    • >>   llc_rem_encrypt_proc_fsm +
    • >>   aes_rand +
    • >>   gapc_smp_generate_stk +
    • >>   gapm_smp_gen_rand_addr_cb +
    + +

    aes_rand (Thumb, 46 bytes, Stack size 56 bytes, aes.o(.text)) +

    [Stack]

    • Max Depth = 140
    • Call Chain = aes_rand ⇒ aes_encrypt ⇒ aes_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   rand +
    • >>   aes_encrypt +
    +
    [Called By]
    • >>   gapm_sec_enc_aes_cmd_handler +
    • >>   llc_iv_skd_rand_gen +
    • >>   gapc_smp_generate_rand +
    + +

    aes_result_handler (Thumb, 86 bytes, Stack size 16 bytes, aes.o(.text)) +

    [Stack]

    • Max Depth = 48
    • Call Chain = aes_result_handler ⇒ ble_aes_encrypt +
    +
    [Calls]
    • >>   list_pop_front +
    • >>   ble_aes_encrypt +
    • >>   ke_free +
    +
    [Called By]
    • >>   aes_crypt_evt_handler +
    + +

    aes_xor_128 (Thumb, 22 bytes, Stack size 12 bytes, aes.o(.text)) +

    [Stack]

    • Max Depth = 12
    • Call Chain = aes_xor_128 +
    +
    [Called By]
    • >>   aes_c1_continue +
    • >>   aes_c1 +
    + +

    aes_shift_left_128 (Thumb, 36 bytes, Stack size 8 bytes, aes.o(.text), UNUSED) + +

    aes_c1 (Thumb, 70 bytes, Stack size 40 bytes, aes_c1.o(.text)) +

    [Stack]

    • Max Depth = 100
    • Call Chain = aes_c1 ⇒ aes_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   aes_xor_128 +
    • >>   aes_start +
    • >>   aes_alloc +
    +
    [Called By]
    • >>   gapc_smp_comp_cnf_val +
    + +

    gapm_update_state (Thumb, 42 bytes, Stack size 16 bytes, gapm.o(.text)) +

    [Stack]

    • Max Depth = 72
    • Call Chain = gapm_update_state ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   ke_state_set +
    • >>   ke_state_get +
    +
    [Called By]
    • >>   gapm_process_op_simple +
    • >>   gapm_operation_cleanup +
    + +

    gapm_send_cmp_evt (Thumb, 26 bytes, Stack size 16 bytes, gapm.o(.text)) +

    [Stack]

    • Max Depth = 84
    • Call Chain = gapm_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   gapm_config_cmd_handler +
    • >>   gapm_send_complete_evt +
    + +

    gapm_process_op_simple (Thumb, 60 bytes, Stack size 16 bytes, gapm.o(.text)) +

    [Stack]

    • Max Depth = 88
    • Call Chain = gapm_process_op_simple ⇒ gapm_update_state ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   gapm_update_state +
    • >>   ke_state_get +
    +
    [Called By]
    • >>   gapm_set_adv_data_cmd_handler +
    • >>   gapm_sec_enc_aes_cmd_handler +
    • >>   gapm_config_cmd_handler +
    • >>   gapm_actv_cmd_handler +
    + +

    gapm_send_complete_evt (Thumb, 60 bytes, Stack size 16 bytes, gapm.o(.text)) +

    [Stack]

    • Max Depth = 104
    • Call Chain = gapm_send_complete_evt ⇒ gapm_operation_cleanup ⇒ gapm_update_state ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   gapm_send_cmp_evt +
    • >>   gapm_operation_cleanup +
    +
    [Called By]
    • >>   gapm_sec_enc_aes_cmd_handler +
    • >>   gapm_config_cmd_handler +
    • >>   gapm_actv_cmd_handler +
    • >>   gapm_smp_gen_rand_nb_cb +
    • >>   gapm_smp_gen_rand_addr_cb +
    • >>   gapm_smp_use_enc_block_cb +
    • >>   gapm_actv_adv_fsm +
    • >>   gapm_actv_deleted +
    • >>   gapm_actv_stopped +
    • >>   gapm_actv_started +
    • >>   gapm_actv_created +
    + +

    gapm_con_create (Thumb, 86 bytes, Stack size 24 bytes, gapm.o(.text)) +

    [Stack]

    • Max Depth = 132
    • Call Chain = gapm_con_create ⇒ gapc_con_create ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   l2cc_create +
    • >>   gattc_create +
    • >>   gapc_con_create +
    • >>   attm_con_create +
    +
    [Called By]
    • >>   le_enh_con_cmp_evt +
    + +

    gapm_con_cleanup (Thumb, 48 bytes, Stack size 16 bytes, gapm.o(.text)) +

    [Stack]

    • Max Depth = 180
    • Call Chain = gapm_con_cleanup ⇒ l2cc_cleanup ⇒ l2cc_send_cmp_evt_status ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   l2cm_tx_status +
    • >>   l2cc_cleanup +
    • >>   gattc_cleanup +
    • >>   gapc_cleanup +
    • >>   attm_con_cleanup +
    +
    [Called By]
    • >>   le_disc_cmp_evt +
    + +

    gapm_con_number (Thumb, 28 bytes, Stack size 0 bytes, gapm.o(.text)) +

    [Called By]

    • >>   gapm_config_cmd_handler +
    • >>   gapm_is_con_actv_full +
    + +

    gapc_update_state (Thumb, 48 bytes, Stack size 16 bytes, gapc.o(.text)) +

    [Stack]

    • Max Depth = 72
    • Call Chain = gapc_update_state ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   ke_state_set +
    • >>   ke_state_get +
    +
    [Called By]
    • >>   gapc_smp_handle_enc_change_evt +
    • >>   gapc_smp_send_ltk_req_rsp +
    • >>   gapc_smp_send_start_enc_cmd +
    • >>   gapc_send_complete_evt +
    • >>   gapc_process_op_simple +
    + +

    gapc_send_cmp_evt (Thumb, 34 bytes, Stack size 16 bytes, gapc.o(.text)) +

    [Stack]

    • Max Depth = 84
    • Call Chain = gapc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   le_disc_cmp_evt +
    • >>   gapc_send_complete_evt +
    • >>   gapc_process_op_simple +
    • >>   gapc_disconnect_cmd_send +
    + +

    gapc_send_complete_evt (Thumb, 72 bytes, Stack size 16 bytes, gapc.o(.text)) +

    [Stack]

    • Max Depth = 104
    • Call Chain = gapc_send_complete_evt ⇒ gapc_operation_cleanup ⇒ gapc_smp_cleanup ⇒ gapc_smp_clear_timeout_timer ⇒ ke_timer_clear ⇒ ke_time_past +
    +
    [Calls]
    • >>   gapc_operation_cleanup +
    • >>   gapc_update_state +
    • >>   gapc_send_cmp_evt +
    +
    [Called By]
    • >>   gapc_param_update_rsp +
    • >>   le_phy_upd_cmp_evt +
    • >>   le_con_update_cmp_evt +
    • >>   le_rd_rem_feats_cmp_evt +
    • >>   le_rd_rem_ver_info_cmp_evt +
    • >>   l2c_code_con_param_upd_rsp_handler +
    • >>   l2c_code_reject_handler +
    • >>   l2cc_send_cmp_evt_status +
    • >>   gapc_cleanup +
    • >>   gapc_smp_handle_enc_change_evt +
    • >>   gapc_smp_pairing_end +
    • >>   gapc_smp_send_ltk_req_rsp +
    • >>   gapc_smp_send_start_enc_cmd +
    • >>   gapc_smp_cmd_handler +
    • >>   gapc_link_upd_cmd_handler +
    • >>   gapc_param_upd_to_handler +
    • >>   gapc_get_info_cmd_handler +
    • >>   gapc_con_param_upd_send +
    + +

    gapc_cleanup (Thumb, 112 bytes, Stack size 24 bytes, gapc.o(.text)) +

    [Stack]

    • Max Depth = 128
    • Call Chain = gapc_cleanup ⇒ gapc_send_complete_evt ⇒ gapc_operation_cleanup ⇒ gapc_smp_cleanup ⇒ gapc_smp_clear_timeout_timer ⇒ ke_timer_clear ⇒ ke_time_past +
    +
    [Calls]
    • >>   gapc_operation_cleanup +
    • >>   ke_timer_clear +
    • >>   ke_free +
    • >>   ke_state_set +
    • >>   ke_state_get +
    • >>   gapc_send_complete_evt +
    +
    [Called By]
    • >>   gapm_con_cleanup +
    • >>   gapm_init +
    + +

    gapc_con_create (Thumb, 264 bytes, Stack size 40 bytes, gapc.o(.text)) +

    [Stack]

    • Max Depth = 108
    • Call Chain = gapc_con_create ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_malloc +
    • >>   ke_state_set +
    • >>   ke_state_get +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   gapm_con_create +
    + +

    gapc_get_conidx (Thumb, 38 bytes, Stack size 0 bytes, gapc.o(.text)) +

    [Called By]

    • >>   le_phy_upd_cmp_evt +
    • >>   le_rem_con_param_req_evt +
    • >>   le_con_update_cmp_evt +
    • >>   le_con_estab_evt +
    • >>   le_data_len_chg_evt +
    • >>   le_rd_rem_feats_cmp_evt +
    • >>   le_rd_rem_ver_info_cmp_evt +
    • >>   le_disc_cmp_evt +
    • >>   le_enc_chg_evt +
    • >>   le_ltk_req_evt +
    • >>   le_adv_set_term_evt +
    • >>   le_nb_cmp_pkts_evt +
    • >>   lld_con_rx_ind_handler +
    + +

    gapc_get_conhdl (Thumb, 24 bytes, Stack size 0 bytes, gapc.o(.text)) +

    [Called By]

    • >>   gapc_param_update_rsp +
    • >>   l2cc_data_send +
    • >>   gapc_smp_send_ltk_req_rsp +
    • >>   gapc_smp_send_start_enc_cmd +
    • >>   gapc_link_upd_cmd_handler +
    • >>   gapc_get_info_cmd_handler +
    • >>   gapc_con_param_upd_send +
    • >>   gapc_disconnect_cmd_send +
    + +

    gapc_get_role (Thumb, 28 bytes, Stack size 0 bytes, gapc.o(.text)) +

    [Called By]

    • >>   l2c_code_con_param_upd_rsp_handler +
    • >>   l2c_code_con_param_upd_req_handler +
    • >>   le_enc_chg_evt +
    • >>   gapc_smp_gapm_cmp_evt +
    • >>   gapc_smp_recv_sec_req +
    • >>   gapc_smp_pdu_recv +
    + +

    gapc_set_local_addr (Thumb, 28 bytes, Stack size 16 bytes, gapc.o(.text)) +

    [Stack]

    • Max Depth = 16
    • Call Chain = gapc_set_local_addr +
    +
    [Called By]
    • >>   le_adv_set_term_evt +
    • >>   gapm_init_connection_ind +
    + +

    gapc_get_bdaddr (Thumb, 32 bytes, Stack size 0 bytes, gapc.o(.text)) +

    [Called By]

    • >>   gapc_smp_comp_cnf_val +
    + +

    gapc_get_chan_sel_algo (Thumb, 20 bytes, Stack size 0 bytes, gapc.o(.text)) +

    [Called By]

    • >>   gapc_get_info_cmd_handler +
    + +

    gapc_is_sec_set (Thumb, 52 bytes, Stack size 0 bytes, gapc.o(.text)) +

    [Called By]

    • >>   atts_get_att_chk_perm +
    + +

    gapc_lk_sec_lvl_get (Thumb, 28 bytes, Stack size 0 bytes, gapc.o(.text)) +

    [Called By]

    • >>   atts_get_att_chk_perm +
    + +

    gapc_enc_keysize_get (Thumb, 24 bytes, Stack size 0 bytes, gapc.o(.text)) +

    [Called By]

    • >>   gapc_smp_pairing_ltk_exch +
    • >>   atts_get_att_chk_perm +
    • >>   gapc_smp_recv_mst_id +
    • >>   gapc_smp_aes_res_cb +
    • >>   gapc_smp_send_pairing_req_ind +
    + +

    gapc_auth_set (Thumb, 88 bytes, Stack size 20 bytes, gapc.o(.text)) +

    [Stack]

    • Max Depth = 20
    • Call Chain = gapc_auth_set +
    +
    [Called By]
    • >>   gapc_smp_send_pairing_ind +
    • >>   gapc_connection_cfg_send +
    + +

    gapc_param_update_sanity (Thumb, 42 bytes, Stack size 8 bytes, gapc.o(.text)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = gapc_param_update_sanity +
    +
    [Called By]
    • >>   l2c_code_con_param_upd_req_handler +
    • >>   gapc_link_upd_cmd_handler +
    + +

    gattc_create (Thumb, 62 bytes, Stack size 16 bytes, gattc.o(.text)) +

    [Stack]

    • Max Depth = 72
    • Call Chain = gattc_create ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   ke_malloc +
    • >>   ke_state_set +
    • >>   ke_state_get +
    +
    [Called By]
    • >>   gapm_con_create +
    + +

    gattc_send_cmp_evt (Thumb, 90 bytes, Stack size 24 bytes, gattc.o(.text)) +

    [Stack]

    • Max Depth = 92
    • Call Chain = gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   atts_get_svc_func +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   gattc_send_complete_evt +
    • >>   gattc_process_op_simple +
    + +

    gattc_send_complete_evt (Thumb, 62 bytes, Stack size 16 bytes, gattc.o(.text)) +

    [Stack]

    • Max Depth = 108
    • Call Chain = gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gattc_send_cmp_evt +
    • >>   gatt_operation_cleanup +
    • >>   ke_state_set +
    • >>   ke_state_get +
    +
    [Called By]
    • >>   atts_pdu_recv_handler +
    • >>   l2cc_send_cmp_evt_status +
    • >>   gattc_cleanup +
    • >>   attc_err_rsp +
    • >>   attc_exe_wr_rsp +
    • >>   attc_prep_wr_rsp +
    • >>   attc_wr_rsp +
    • >>   attc_rd_mult_rsp +
    • >>   attc_rd_rsp +
    • >>   attc_rd_by_grp_type_rsp +
    • >>   attc_rd_by_type_rsp +
    • >>   attc_find_by_type_rsp +
    • >>   attc_find_info_rsp +
    • >>   attc_exc_mtu_rsp +
    • >>   gatt_timeout_handler +
    • >>   gatt_send_evt_cmd_handler +
    • >>   gatt_op_cmd_handler +
    + +

    gattc_cleanup (Thumb, 154 bytes, Stack size 24 bytes, gattc.o(.text)) +

    [Stack]

    • Max Depth = 132
    • Call Chain = gattc_cleanup ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ble_buf_rx_free +
    • >>   atts_clear_rsp_data +
    • >>   atts_clear_read_cache +
    • >>   atts_clear_prep_data +
    • >>   gattc_send_complete_evt +
    • >>   gatt_operation_cleanup +
    • >>   list_pop_front +
    • >>   ke_timer_clear +
    • >>   ke_free +
    • >>   ke_state_set +
    +
    [Called By]
    • >>   gapm_con_cleanup +
    • >>   gattm_init +
    + +

    gatt_get_mtu (Thumb, 10 bytes, Stack size 0 bytes, gattc.o(.text)) +

    [Called By]

    • >>   atts_send_event +
    • >>   atts_read_mult_req +
    • >>   atts_read_blob_req +
    • >>   atts_read_req +
    • >>   atts_read_by_grp_type_req +
    • >>   atts_read_by_type_req +
    • >>   atts_find_by_type_req +
    • >>   atts_find_info_req +
    • >>   attc_rd_rsp +
    • >>   attc_rd_by_type_rsp +
    • >>   l2cc_pdu_header_check +
    • >>   gatt_op_cmd_handler +
    + +

    gatt_set_mtu (Thumb, 82 bytes, Stack size 16 bytes, gattc.o(.text)) +

    [Stack]

    • Max Depth = 84
    • Call Chain = gatt_set_mtu ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   atts_mtu_exc_req +
    • >>   attc_exc_mtu_rsp +
    + +

    l2cc_create (Thumb, 50 bytes, Stack size 8 bytes, l2cc.o(.text)) +

    [Stack]

    • Max Depth = 64
    • Call Chain = l2cc_create ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   ke_malloc +
    • >>   ke_state_set +
    +
    [Called By]
    • >>   gapm_con_create +
    + +

    l2cc_send_cmp_evt_status (Thumb, 124 bytes, Stack size 24 bytes, l2cc.o(.text)) +

    [Stack]

    • Max Depth = 132
    • Call Chain = l2cc_send_cmp_evt_status ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gattc_send_complete_evt +
    • >>   ke_state_get +
    • >>   gapc_send_complete_evt +
    +
    [Called By]
    • >>   l2cc_data_send +
    • >>   l2cc_cleanup +
    • >>   l2cc_pdu_send_cmd_handler +
    + +

    l2cc_cleanup (Thumb, 108 bytes, Stack size 32 bytes, l2cc.o(.text)) +

    [Stack]

    • Max Depth = 164
    • Call Chain = l2cc_cleanup ⇒ l2cc_send_cmp_evt_status ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   l2cc_send_cmp_evt_status +
    • >>   list_pop_front +
    • >>   ke_free +
    • >>   ke_state_set +
    +
    [Called By]
    • >>   gapm_con_cleanup +
    • >>   l2cm_init +
    + +

    l2cc_data_send (Thumb, 240 bytes, Stack size 48 bytes, l2cc.o(.text)) +

    [Stack]

    • Max Depth = 300
    • Call Chain = l2cc_data_send ⇒ lld_con_data_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_con_data_tx +
    • >>   l2cc_pdu_pack +
    • >>   ble_buf_acl_tx_free +
    • >>   ble_buf_acl_tx_alloc +
    • >>   l2cc_send_cmp_evt_status +
    • >>   l2cm_tx_status +
    • >>   list_pop_front +
    • >>   ke_free +
    • >>   gapc_get_conhdl +
    +
    [Called By]
    • >>   l2cm_pdu_tx_handler +
    + +

    l2cc_smp_pdu_alloc (Thumb, 36 bytes, Stack size 16 bytes, l2cc.o(.text)) +

    [Stack]

    • Max Depth = 84
    • Call Chain = l2cc_smp_pdu_alloc ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   gapc_smp_pairing_rsp +
    • >>   gapc_smp_pairing_ltk_exch +
    • >>   gapc_smp_pairing_csrk_exch +
    • >>   gapc_key_press_notify +
    • >>   gapc_smp_pair_rand_send +
    • >>   gapc_smp_pair_fail_send +
    • >>   gapc_smp_pairing_start +
    • >>   gapc_smp_aes_res_cb +
    • >>   gapc_smp_tkdp_send_continue +
    • >>   gapc_smp_cmd_handler +
    + +

    l2cc_att_pdu_alloc (Thumb, 36 bytes, Stack size 16 bytes, l2cc.o(.text)) +

    [Stack]

    • Max Depth = 84
    • Call Chain = l2cc_att_pdu_alloc ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   atts_write_rsp_send +
    • >>   atts_send_error +
    • >>   atts_send_event +
    • >>   atts_execute_write_req +
    • >>   atts_prepare_write_req +
    • >>   atts_read_mult_req +
    • >>   atts_read_blob_req +
    • >>   atts_read_req +
    • >>   atts_read_by_grp_type_req +
    • >>   atts_read_by_type_req +
    • >>   atts_find_by_type_req +
    • >>   atts_find_info_req +
    • >>   atts_mtu_exc_req +
    • >>   attc_rd_by_type_rsp +
    • >>   attc_send_hdl_cfm +
    • >>   gatt_op_cmd_handler +
    + +

    l2cc_ind_pdu_alloc (Thumb, 58 bytes, Stack size 24 bytes, l2cc.o(.text)) +

    [Stack]

    • Max Depth = 92
    • Call Chain = l2cc_ind_pdu_alloc ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   l2cc_pdu_header_check +
    • >>   l2cc_pdu_rx_init +
    + +

    l2cc_sig_send_cmd_reject (Thumb, 60 bytes, Stack size 24 bytes, l2cc_sig.o(.text)) +

    [Stack]

    • Max Depth = 92
    • Call Chain = l2cc_sig_send_cmd_reject ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   l2cc_sig_pdu_recv_handler +
    • >>   l2c_code_con_param_upd_rsp_handler +
    • >>   l2c_code_con_param_upd_req_handler +
    • >>   l2cc_pdu_recv_ind_handler +
    + +

    l2cc_sig_send_param_resp (Thumb, 46 bytes, Stack size 16 bytes, l2cc_sig.o(.text)) +

    [Stack]

    • Max Depth = 84
    • Call Chain = l2cc_sig_send_param_resp ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   gapc_param_update_rsp +
    • >>   l2c_code_con_param_upd_req_handler +
    + +

    l2cc_sig_send_param_upd_req (Thumb, 60 bytes, Stack size 16 bytes, l2cc_sig.o(.text)) +

    [Stack]

    • Max Depth = 84
    • Call Chain = l2cc_sig_send_param_upd_req ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   gapc_link_upd_cmd_handler +
    + +

    l2cc_sig_pdu_recv_handler (Thumb, 58 bytes, Stack size 8 bytes, l2cc_sig.o(.text)) +

    [Stack]

    • Max Depth = 128
    • Call Chain = l2cc_sig_pdu_recv_handler ⇒ l2c_code_con_param_upd_rsp_handler ⇒ gapc_send_complete_evt ⇒ gapc_operation_cleanup ⇒ gapc_smp_cleanup ⇒ gapc_smp_clear_timeout_timer ⇒ ke_timer_clear ⇒ ke_time_past +
    +
    [Calls]
    • >>   l2cc_sig_send_cmd_reject +
    • >>   l2c_code_con_param_upd_rsp_handler +
    • >>   l2c_code_con_param_upd_req_handler +
    • >>   l2c_code_reject_handler +
    +
    [Called By]
    • >>   l2cc_pdu_recv_ind_handler +
    + +

    attm_is_bt_uuid (Thumb, 50 bytes, Stack size 24 bytes, attm.o(.text)) +

    [Stack]

    • Max Depth = 24
    • Call Chain = attm_is_bt_uuid +
    +
    [Called By]
    • >>   attmdb_svc_create +
    • >>   attm_uuid16_comp +
    • >>   attm_uuid_comp +
    • >>   attmdb_svc_att_size +
    • >>   attmdb_svc_att_desc +
    + +

    attm_uuid32_conv (Thumb, 38 bytes, Stack size 32 bytes, attm.o(.text)) +

    [Stack]

    • Max Depth = 32
    • Call Chain = attm_uuid32_conv +
    +
    [Called By]
    • >>   attm_get_att_uuid +
    • >>   attm_get_svc_uuid +
    • >>   gatt_op_cmd_handler +
    + +

    attm_uuid_comp (Thumb, 72 bytes, Stack size 24 bytes, attm.o(.text)) +

    [Stack]

    • Max Depth = 48
    • Call Chain = attm_uuid_comp ⇒ attm_is_bt_uuid +
    +
    [Calls]
    • >>   attm_is_bt_uuid +
    +
    [Called By]
    • >>   atts_find_by_type_req +
    • >>   atts_find_value_by_uuid +
    • >>   attc_rd_by_grp_type_rsp +
    • >>   attc_rd_by_type_rsp +
    + +

    attm_uuid16_comp (Thumb, 42 bytes, Stack size 16 bytes, attm.o(.text), UNUSED) +

    [Calls]

    • >>   attm_is_bt_uuid +
    + +

    attm_reserve_handle_range (Thumb, 12 bytes, Stack size 8 bytes, attm.o(.text), UNUSED) +

    [Calls]

    • >>   attmdb_svc_check_hdl +
    + +

    attm_get_value (Thumb, 238 bytes, Stack size 32 bytes, attm.o(.text)) +

    [Stack]

    • Max Depth = 72
    • Call Chain = attm_get_value ⇒ attm_get_att_uuid ⇒ attm_uuid32_conv +
    +
    [Calls]
    • >>   attm_get_att_uuid +
    • >>   attm_get_svc_uuid +
    • >>   attmdb_get_service2 +
    +
    [Called By]
    • >>   atts_get_value +
    + +

    attm_att_set_value (Thumb, 126 bytes, Stack size 40 bytes, attm.o(.text), UNUSED) +

    [Calls]

    • >>   attmdb_get_service2 +
    + +

    attm_att_set_perm (Thumb, 88 bytes, Stack size 24 bytes, attm.o(.text), UNUSED) +

    [Calls]

    • >>   attmdb_get_service2 +
    + +

    attm_att_update_perm (Thumb, 78 bytes, Stack size 24 bytes, attm.o(.text)) +

    [Stack]

    • Max Depth = 36
    • Call Chain = attm_att_update_perm ⇒ attmdb_get_service2 +
    +
    [Calls]
    • >>   attmdb_get_service2 +
    +
    [Called By]
    • >>   gap_svc_init +
    + +

    atts_get_svc_func (Thumb, 16 bytes, Stack size 8 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 20
    • Call Chain = atts_get_svc_func ⇒ attmdb_get_service2 +
    +
    [Calls]
    • >>   attmdb_get_service2 +
    +
    [Called By]
    • >>   atts_write_req +
    • >>   atts_execute_write_req +
    • >>   atts_prepare_write_req +
    • >>   atts_write_common +
    • >>   atts_get_value +
    • >>   gattc_send_cmp_evt +
    + +

    atts_clear_read_cache (Thumb, 28 bytes, Stack size 16 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 36
    • Call Chain = atts_clear_read_cache ⇒ ke_free +
    +
    [Calls]
    • >>   ke_free +
    +
    [Called By]
    • >>   atts_read_mult_req +
    • >>   atts_read_blob_req +
    • >>   atts_read_req +
    • >>   atts_read_by_grp_type_req +
    • >>   atts_read_by_type_req +
    • >>   atts_find_by_type_req +
    • >>   atts_get_value +
    • >>   gattc_cleanup +
    • >>   gatt_op_cfm_handler +
    • >>   gatt_send_evt_cmd_handler +
    + +

    atts_send_event (Thumb, 100 bytes, Stack size 24 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 108
    • Call Chain = atts_send_event ⇒ l2cc_att_pdu_alloc ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   l2cc_att_pdu_alloc +
    • >>   gatt_get_mtu +
    • >>   ke_timer_set +
    • >>   ke_msg_send +
    +
    [Called By]
    • >>   gatt_send_evt_cmd_handler +
    + +

    atts_clear_prep_data (Thumb, 28 bytes, Stack size 16 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 36
    • Call Chain = atts_clear_prep_data ⇒ ke_free +
    +
    [Calls]
    • >>   list_pop_front +
    • >>   ke_free +
    +
    [Called By]
    • >>   atts_execute_write_req +
    • >>   gattc_cleanup +
    • >>   gatt_op_cfm_handler +
    + +

    atts_clear_rsp_data (Thumb, 28 bytes, Stack size 16 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 36
    • Call Chain = atts_clear_rsp_data ⇒ ke_free +
    +
    [Calls]
    • >>   list_pop_front +
    • >>   ke_free +
    +
    [Called By]
    • >>   gattc_cleanup +
    • >>   atts_process_pdu +
    + +

    atts_send_error (Thumb, 30 bytes, Stack size 16 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 100
    • Call Chain = atts_send_error ⇒ l2cc_att_pdu_alloc ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   l2cc_att_pdu_alloc +
    • >>   ke_msg_send +
    +
    [Called By]
    • >>   atts_write_rsp_send +
    • >>   atts_write_req +
    • >>   atts_execute_write_req +
    • >>   atts_prepare_write_req +
    • >>   atts_read_mult_req +
    • >>   atts_read_blob_req +
    • >>   atts_read_req +
    • >>   atts_read_by_grp_type_req +
    • >>   atts_read_by_type_req +
    • >>   atts_find_by_type_req +
    • >>   atts_find_info_req +
    • >>   l2cc_pdu_recv_ind_handler +
    • >>   gatt_op_cfm_handler +
    + +

    atts_write_rsp_send (Thumb, 34 bytes, Stack size 8 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 108
    • Call Chain = atts_write_rsp_send ⇒ atts_send_error ⇒ l2cc_att_pdu_alloc ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   atts_send_error +
    • >>   l2cc_att_pdu_alloc +
    • >>   ke_msg_send +
    +
    [Called By]
    • >>   gatt_op_cfm_handler +
    + +

    atts_process_pdu (Thumb, 94 bytes, Stack size 24 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 60
    • Call Chain = atts_process_pdu ⇒ atts_clear_rsp_data ⇒ ke_free +
    +
    [Calls]
    • >>   ble_buf_rx_free +
    • >>   atts_clear_rsp_data +
    • >>   list_pop_front +
    • >>   ke_free +
    +
    [Called By]
    • >>   atts_pdu_recv_handler +
    • >>   gapc_connection_cfg_send +
    • >>   gatt_op_cfm_handler +
    + +

    atts_pdu_recv_handler (Thumb, 136 bytes, Stack size 24 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 132
    • Call Chain = atts_pdu_recv_handler ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gattc_send_complete_evt +
    • >>   list_push_back +
    • >>   ke_timer_clear +
    • >>   ke_state_get +
    • >>   atts_process_pdu +
    +
    [Called By]
    • >>   l2cc_pdu_recv_ind_handler +
    + +

    llm_is_dev_connected (Thumb, 70 bytes, Stack size 32 bytes, llm.o(.text)) +

    [Stack]

    • Max Depth = 40
    • Call Chain = llm_is_dev_connected ⇒ bdaddr_is_same +
    +
    [Calls]
    • >>   bdaddr_is_same +
    +
    [Called By]
    • >>   le_set_ext_adv_en +
    • >>   lld_adv_pkt_rx +
    + +

    llm_link_disc (Thumb, 20 bytes, Stack size 8 bytes, llm.o(.text)) +

    [Stack]

    • Max Depth = 24
    • Call Chain = llm_link_disc ⇒ sch_plan_rem ⇒ list_extract +
    +
    [Calls]
    • >>   sch_plan_rem +
    +
    [Called By]
    • >>   lld_disc_ind_handler +
    + +

    llm_activity_free_get (Thumb, 54 bytes, Stack size 16 bytes, llm.o(.text)) +

    [Stack]

    • Max Depth = 16
    • Call Chain = llm_activity_free_get +
    +
    [Called By]
    • >>   le_ext_create_con +
    • >>   le_set_ext_scan_param +
    • >>   le_set_ext_adv_param +
    • >>   le_set_ext_adv_en +
    + +

    llc_disconnect (Thumb, 40 bytes, Stack size 8 bytes, llc_disconnect.o(.text)) +

    [Stack]

    • Max Depth = 300
    • Call Chain = llc_disconnect ⇒ llc_llcp_state_set ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_con_stop +
    • >>   llc_llcp_state_set +
    +
    [Called By]
    • >>   llc_loc_encrypt_proc_fsm +
    • >>   llc_rem_encrypt_proc_fsm +
    • >>   ll_terminate_ind_handler +
    • >>   llc_disconnect_proc_fsm +
    • >>   lld_llcp_rx_ind +
    • >>   lld_con_rx_ind_handler +
    • >>   llc_llcp_rsp_to_handler +
    + +

    llc_disconnect_proc_err (Thumb, 10 bytes, Stack size 0 bytes, llc_disconnect.o(.text)) +

    [Stack]

    • Max Depth = 332
    • Call Chain = llc_disconnect_proc_err ⇒ llc_disconnect_proc_fsm ⇒ llc_ll_terminate_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_disconnect_proc_fsm +
    +
    [Called By]
    • >>   llc_proc_err_ind +
    + +

    ll_terminate_ind_handler (Thumb, 52 bytes, Stack size 16 bytes, llc_disconnect.o(.text)) +

    [Stack]

    • Max Depth = 316
    • Call Chain = ll_terminate_ind_handler ⇒ llc_disconnect ⇒ llc_llcp_state_set ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_proc_timer_set +
    • >>   llc_disconnect +
    +
    [Address Reference Count : 1]
    • llc_llcp.o(.constdata) +
    +

    lld_disc_ind_handler (Thumb, 98 bytes, Stack size 24 bytes, llc_disconnect.o(.text)) +

    [Stack]

    • Max Depth = 436
    • Call Chain = lld_disc_ind_handler ⇒ llc_proc_err_ind ⇒ llc_rem_con_upd_proc_err ⇒ llc_rem_con_upd_proc_fsm ⇒ llc_ll_con_param_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_proc_err_ind +
    • >>   llc_llcp_state_set +
    • >>   le_disc_cmp_evt +
    • >>   llc_cleanup +
    • >>   llm_link_disc +
    • >>   ke_state_set +
    +
    [Address Reference Count : 1]
    • llc_task.o(le_task_hdl_func) +
    +

    llc_op_disconnect_ind_cb (Thumb, 62 bytes, Stack size 16 bytes, llc_disconnect.o(.text)) +

    [Stack]

    • Max Depth = 428
    • Call Chain = llc_op_disconnect_ind_cb ⇒ llc_proc_err_ind ⇒ llc_rem_con_upd_proc_err ⇒ llc_rem_con_upd_proc_fsm ⇒ llc_ll_con_param_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_proc_reg +
    • >>   llc_proc_err_ind +
    • >>   llc_disconnect_proc_fsm +
    +
    [Called By]
    • >>   llc_proc_op_ind_handler +
    + +

    le_disconnect (Thumb, 94 bytes, Stack size 16 bytes, llc_disconnect.o(.text)) +

    [Stack]

    • Max Depth = 84
    • Call Chain = le_disconnect ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   gapc_disconnect_cmd_send +
    + +

    llc_init_term_proc (Thumb, 38 bytes, Stack size 8 bytes, llc_disconnect.o(.text)) +

    [Stack]

    • Max Depth = 76
    • Call Chain = llc_init_term_proc ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   le_ltk_req_reply +
    + +

    llc_ver_exch_proc_err (Thumb, 10 bytes, Stack size 0 bytes, llc_ver_exch.o(.text)) +

    [Stack]

    • Max Depth = 348
    • Call Chain = llc_ver_exch_proc_err ⇒ llc_ver_exch_proc_fsm ⇒ llc_llcp_version_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_ver_exch_proc_fsm +
    +
    [Called By]
    • >>   llc_proc_err_ind +
    + +

    llc_op_ver_exch_ind_cb (Thumb, 56 bytes, Stack size 16 bytes, llc_ver_exch.o(.text)) +

    [Stack]

    • Max Depth = 364
    • Call Chain = llc_op_ver_exch_ind_cb ⇒ llc_ver_exch_proc_fsm ⇒ llc_llcp_version_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   le_rd_rem_ver_info_cmp_evt +
    • >>   llc_ver_exch_proc_fsm +
    • >>   llc_proc_reg +
    +
    [Called By]
    • >>   llc_proc_op_ind_handler +
    + +

    ll_version_ind_handler (Thumb, 72 bytes, Stack size 16 bytes, llc_ver_exch.o(.text)) +

    [Stack]

    • Max Depth = 364
    • Call Chain = ll_version_ind_handler ⇒ llc_ver_exch_proc_fsm ⇒ llc_llcp_version_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_llcp_version_ind_pdu_send +
    • >>   llc_ver_exch_proc_fsm +
    +
    [Address Reference Count : 1]
    • llc_llcp.o(.constdata) +
    +

    le_rd_rem_ver_info (Thumb, 80 bytes, Stack size 16 bytes, llc_ver_exch.o(.text)) +

    [Stack]

    • Max Depth = 84
    • Call Chain = le_rd_rem_ver_info ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   gapc_get_info_cmd_handler +
    + +

    llc_loc_encrypt_proc_err (Thumb, 66 bytes, Stack size 8 bytes, llc_encrypt.o(.text)) +

    [Stack]

    • Max Depth = 364
    • Call Chain = llc_loc_encrypt_proc_err ⇒ llc_loc_encrypt_proc_fsm ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_loc_encrypt_proc_fsm +
    +
    [Called By]
    • >>   llc_proc_err_ind +
    + +

    llc_rem_encrypt_proc_err (Thumb, 46 bytes, Stack size 8 bytes, llc_encrypt.o(.text)) +

    [Stack]

    • Max Depth = 372
    • Call Chain = llc_rem_encrypt_proc_err ⇒ llc_rem_encrypt_proc_fsm ⇒ llc_ll_reject_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_rem_encrypt_proc_fsm +
    +
    [Called By]
    • >>   llc_proc_err_ind +
    + +

    ll_pause_enc_req_handler (Thumb, 78 bytes, Stack size 16 bytes, llc_encrypt.o(.text)) +

    [Stack]

    • Max Depth = 380
    • Call Chain = ll_pause_enc_req_handler ⇒ llc_rem_encrypt_proc_fsm ⇒ llc_ll_reject_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_rem_encrypt_proc_fsm +
    • >>   llc_proc_reg +
    • >>   ke_msg_alloc +
    +
    [Address Reference Count : 1]
    • llc_llcp.o(.constdata) +
    +

    ll_pause_enc_rsp_handler (Thumb, 66 bytes, Stack size 8 bytes, llc_encrypt.o(.text)) +

    [Stack]

    • Max Depth = 372
    • Call Chain = ll_pause_enc_rsp_handler ⇒ llc_rem_encrypt_proc_fsm ⇒ llc_ll_reject_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_loc_encrypt_proc_fsm +
    • >>   llc_rem_encrypt_proc_fsm +
    +
    [Address Reference Count : 1]
    • llc_llcp.o(.constdata) +
    +

    ll_enc_req_handler (Thumb, 170 bytes, Stack size 32 bytes, llc_encrypt.o(.text)) +

    [Stack]

    • Max Depth = 396
    • Call Chain = ll_enc_req_handler ⇒ llc_rem_encrypt_proc_fsm ⇒ llc_ll_reject_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_loc_encrypt_proc_fsm +
    • >>   llc_rem_encrypt_proc_fsm +
    • >>   llc_proc_reg +
    • >>   ke_msg_alloc +
    +
    [Address Reference Count : 1]
    • llc_llcp.o(.constdata) +
    +

    ll_enc_rsp_handler (Thumb, 102 bytes, Stack size 24 bytes, llc_encrypt.o(.text)) +

    [Stack]

    • Max Depth = 388
    • Call Chain = ll_enc_rsp_handler ⇒ llc_rem_encrypt_proc_fsm ⇒ llc_ll_reject_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_loc_encrypt_proc_fsm +
    • >>   llc_rem_encrypt_proc_fsm +
    +
    [Address Reference Count : 1]
    • llc_llcp.o(.constdata) +
    +

    ll_start_enc_req_handler (Thumb, 68 bytes, Stack size 8 bytes, llc_encrypt.o(.text)) +

    [Stack]

    • Max Depth = 372
    • Call Chain = ll_start_enc_req_handler ⇒ llc_rem_encrypt_proc_fsm ⇒ llc_ll_reject_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_loc_encrypt_proc_fsm +
    • >>   llc_rem_encrypt_proc_fsm +
    +
    [Address Reference Count : 1]
    • llc_llcp.o(.constdata) +
    +

    ll_start_enc_rsp_handler (Thumb, 68 bytes, Stack size 8 bytes, llc_encrypt.o(.text)) +

    [Stack]

    • Max Depth = 372
    • Call Chain = ll_start_enc_rsp_handler ⇒ llc_rem_encrypt_proc_fsm ⇒ llc_ll_reject_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_loc_encrypt_proc_fsm +
    • >>   llc_rem_encrypt_proc_fsm +
    +
    [Address Reference Count : 1]
    • llc_llcp.o(.constdata) +
    +

    le_start_enc (Thumb, 170 bytes, Stack size 40 bytes, llc_encrypt.o(.text)) +

    [Stack]

    • Max Depth = 108
    • Call Chain = le_start_enc ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   gapc_smp_send_start_enc_cmd +
    + +

    le_ltk_req_reply (Thumb, 114 bytes, Stack size 24 bytes, llc_encrypt.o(.text)) +

    [Stack]

    • Max Depth = 388
    • Call Chain = le_ltk_req_reply ⇒ llc_rem_encrypt_proc_fsm ⇒ llc_ll_reject_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_rem_encrypt_proc_fsm +
    • >>   llc_proc_unreg +
    • >>   llc_init_term_proc +
    +
    [Called By]
    • >>   gapc_smp_send_ltk_req_rsp +
    + +

    llc_op_encrypt_ind_cb (Thumb, 50 bytes, Stack size 16 bytes, llc_encrypt.o(.text)) +

    [Stack]

    • Max Depth = 372
    • Call Chain = llc_op_encrypt_ind_cb ⇒ llc_loc_encrypt_proc_fsm ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_loc_encrypt_proc_fsm +
    • >>   llc_proc_reg +
    • >>   le_enc_chg_evt +
    +
    [Called By]
    • >>   llc_proc_op_ind_handler +
    + +

    llc_feats_exch_proc_err (Thumb, 84 bytes, Stack size 8 bytes, llc_feat_exch.o(.text)) +

    [Stack]

    • Max Depth = 364
    • Call Chain = llc_feats_exch_proc_err ⇒ llc_loc_feats_exch_proc_fsm ⇒ llc_ll_feature_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_loc_feats_exch_proc_fsm +
    +
    [Called By]
    • >>   llc_proc_err_ind +
    + +

    ll_feature_req_handler (Thumb, 74 bytes, Stack size 16 bytes, llc_feat_exch.o(.text)) +

    [Stack]

    • Max Depth = 348
    • Call Chain = ll_feature_req_handler ⇒ llc_ll_feature_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_ll_feature_pdu_send +
    +
    [Address Reference Count : 1]
    • llc_llcp.o(.constdata) +
    +

    ll_slave_feature_req_handler (Thumb, 74 bytes, Stack size 16 bytes, llc_feat_exch.o(.text)) +

    [Stack]

    • Max Depth = 348
    • Call Chain = ll_slave_feature_req_handler ⇒ llc_ll_feature_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_ll_feature_pdu_send +
    +
    [Address Reference Count : 1]
    • llc_llcp.o(.constdata) +
    +

    ll_feature_rsp_handler (Thumb, 76 bytes, Stack size 16 bytes, llc_feat_exch.o(.text)) +

    [Stack]

    • Max Depth = 372
    • Call Chain = ll_feature_rsp_handler ⇒ llc_loc_feats_exch_proc_fsm ⇒ llc_ll_feature_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_loc_feats_exch_proc_fsm +
    +
    [Address Reference Count : 1]
    • llc_llcp.o(.constdata) +
    +

    le_rd_rem_feats (Thumb, 120 bytes, Stack size 24 bytes, llc_feat_exch.o(.text)) +

    [Stack]

    • Max Depth = 92
    • Call Chain = le_rd_rem_feats ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   gapc_get_info_cmd_handler +
    + +

    llc_op_feats_exch_ind_cb (Thumb, 56 bytes, Stack size 16 bytes, llc_feat_exch.o(.text)) +

    [Stack]

    • Max Depth = 372
    • Call Chain = llc_op_feats_exch_ind_cb ⇒ llc_loc_feats_exch_proc_fsm ⇒ llc_ll_feature_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   le_rd_rem_feats_cmp_evt +
    • >>   llc_loc_feats_exch_proc_fsm +
    • >>   llc_proc_reg +
    +
    [Called By]
    • >>   llc_proc_op_ind_handler +
    + +

    llc_dle_proc_err (Thumb, 88 bytes, Stack size 8 bytes, llc_dl_upd.o(.text)) +

    [Stack]

    • Max Depth = 356
    • Call Chain = llc_dle_proc_err ⇒ llc_loc_dl_upd_proc_fsm ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_loc_dl_upd_proc_fsm +
    +
    [Called By]
    • >>   llc_proc_err_ind +
    + +

    ll_length_req_handler (Thumb, 108 bytes, Stack size 24 bytes, llc_dl_upd.o(.text)) +

    [Stack]

    • Max Depth = 380
    • Call Chain = ll_length_req_handler ⇒ llc_rem_dl_upd_proc ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_rem_dl_upd_proc +
    +
    [Address Reference Count : 1]
    • llc_llcp.o(.constdata) +
    +

    ll_length_rsp_handler (Thumb, 170 bytes, Stack size 24 bytes, llc_dl_upd.o(.text)) +

    [Stack]

    • Max Depth = 372
    • Call Chain = ll_length_rsp_handler ⇒ llc_loc_dl_upd_proc_fsm ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_loc_dl_upd_proc_fsm +
    +
    [Address Reference Count : 1]
    • llc_llcp.o(.constdata) +
    +

    le_set_data_len (Thumb, 146 bytes, Stack size 32 bytes, llc_dl_upd.o(.text), UNUSED) +

    [Calls]

    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    + +

    llc_op_dl_upd_ind_cb (Thumb, 66 bytes, Stack size 16 bytes, llc_dl_upd.o(.text)) +

    [Stack]

    • Max Depth = 364
    • Call Chain = llc_op_dl_upd_ind_cb ⇒ llc_loc_dl_upd_proc_fsm ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   le_data_len_chg_evt +
    • >>   llc_loc_dl_upd_proc_fsm +
    • >>   llc_proc_reg +
    +
    [Called By]
    • >>   llc_proc_op_ind_handler +
    + +

    llc_loc_con_upd_proc_fsm (Thumb, 460 bytes, Stack size 40 bytes, llc_con_upd.o(.text)) +

    [Stack]

    • Max Depth = 388
    • Call Chain = llc_loc_con_upd_proc_fsm ⇒ llc_ll_con_param_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   __ARM_common_switch8 +
    • >>   lld_con_param_update +
    • >>   lld_con_event_counter_get +
    • >>   llc_con_upd_info_send +
    • >>   llc_ll_con_param_pdu_send +
    • >>   llc_pref_param_compute +
    • >>   llc_proc_unreg +
    • >>   llc_proc_timer_set +
    • >>   llc_llcp_send +
    +
    [Called By]
    • >>   llc_op_con_upd_ind_cb +
    • >>   ll_con_param_rsp_handler +
    • >>   ll_con_update_ind_handler +
    • >>   llc_loc_con_upd_proc_err +
    • >>   lld_proc_upd_cfm_handler +
    + +

    llc_loc_con_upd_proc_err (Thumb, 104 bytes, Stack size 8 bytes, llc_con_upd.o(.text)) +

    [Stack]

    • Max Depth = 396
    • Call Chain = llc_loc_con_upd_proc_err ⇒ llc_loc_con_upd_proc_fsm ⇒ llc_ll_con_param_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_loc_con_upd_proc_fsm +
    +
    [Called By]
    • >>   llc_proc_err_ind +
    + +

    llc_rem_con_upd_proc_fsm (Thumb, 322 bytes, Stack size 48 bytes, llc_con_upd.o(.text)) +

    [Stack]

    • Max Depth = 396
    • Call Chain = llc_rem_con_upd_proc_fsm ⇒ llc_ll_con_param_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   __ARM_common_switch8 +
    • >>   lld_con_param_update +
    • >>   le_rem_con_param_req_evt +
    • >>   llc_con_upd_info_send +
    • >>   llc_ll_con_param_pdu_send +
    • >>   llc_pref_param_compute +
    • >>   llc_ll_reject_ind_pdu_send +
    • >>   llc_proc_unreg +
    • >>   llc_proc_timer_set +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   ll_con_param_req_handler +
    • >>   ll_con_update_ind_handler +
    • >>   llc_rem_con_upd_proc_err +
    • >>   le_rem_con_param_req_reply +
    • >>   lld_proc_upd_cfm_handler +
    + +

    llc_rem_con_upd_proc_err (Thumb, 42 bytes, Stack size 0 bytes, llc_con_upd.o(.text)) +

    [Stack]

    • Max Depth = 396
    • Call Chain = llc_rem_con_upd_proc_err ⇒ llc_rem_con_upd_proc_fsm ⇒ llc_ll_con_param_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_rem_con_upd_proc_fsm +
    +
    [Called By]
    • >>   llc_proc_err_ind +
    + +

    ll_con_update_ind_handler (Thumb, 224 bytes, Stack size 40 bytes, llc_con_upd.o(.text)) +

    [Stack]

    • Max Depth = 436
    • Call Chain = ll_con_update_ind_handler ⇒ llc_rem_con_upd_proc_fsm ⇒ llc_ll_con_param_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_rem_con_upd_proc_fsm +
    • >>   llc_loc_con_upd_proc_fsm +
    • >>   llc_con_upd_param_in_range +
    • >>   llc_proc_reg +
    • >>   ke_msg_alloc +
    +
    [Address Reference Count : 1]
    • llc_llcp.o(.constdata) +
    +

    ll_con_param_req_handler (Thumb, 276 bytes, Stack size 40 bytes, llc_con_upd.o(.text)) +

    [Stack]

    • Max Depth = 436
    • Call Chain = ll_con_param_req_handler ⇒ llc_rem_con_upd_proc_fsm ⇒ llc_ll_con_param_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_proc_collision_check +
    • >>   llc_rem_con_upd_proc_fsm +
    • >>   llc_con_upd_param_in_range +
    • >>   llc_proc_reg +
    • >>   ke_msg_alloc +
    +
    [Address Reference Count : 1]
    • llc_llcp.o(.constdata) +
    +

    ll_con_param_rsp_handler (Thumb, 214 bytes, Stack size 40 bytes, llc_con_upd.o(.text)) +

    [Stack]

    • Max Depth = 428
    • Call Chain = ll_con_param_rsp_handler ⇒ llc_loc_con_upd_proc_fsm ⇒ llc_ll_con_param_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_loc_con_upd_proc_fsm +
    • >>   llc_con_upd_param_in_range +
    +
    [Address Reference Count : 1]
    • llc_llcp.o(.constdata) +
    +

    le_con_param_upd (Thumb, 208 bytes, Stack size 24 bytes, llc_con_upd.o(.text)) +

    [Stack]

    • Max Depth = 92
    • Call Chain = le_con_param_upd ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   gapc_con_param_upd_send +
    + +

    le_rem_con_param_req_reply (Thumb, 94 bytes, Stack size 8 bytes, llc_con_upd.o(.text)) +

    [Stack]

    • Max Depth = 404
    • Call Chain = le_rem_con_param_req_reply ⇒ llc_rem_con_upd_proc_fsm ⇒ llc_ll_con_param_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_rem_con_upd_proc_fsm +
    +
    [Called By]
    • >>   gapc_param_update_rsp +
    + +

    llc_op_con_upd_ind_cb (Thumb, 92 bytes, Stack size 16 bytes, llc_con_upd.o(.text)) +

    [Stack]

    • Max Depth = 404
    • Call Chain = llc_op_con_upd_ind_cb ⇒ llc_loc_con_upd_proc_fsm ⇒ llc_ll_con_param_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_loc_con_upd_proc_fsm +
    • >>   llc_con_upd_info_send +
    • >>   llc_proc_reg +
    +
    [Called By]
    • >>   llc_proc_op_ind_handler +
    + +

    lld_con_offset_ind_handler (Thumb, 80 bytes, Stack size 24 bytes, llc_con_upd.o(.text)) +

    [Stack]

    • Max Depth = 172
    • Call Chain = lld_con_offset_ind_handler ⇒ sch_plan_set ⇒ sch_plan_offset_req ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_plan_set +
    • >>   le_con_estab_evt +
    • >>   sch_plan_rem +
    • >>   __aeabi_uidivmod +
    +
    [Address Reference Count : 1]
    • llc_task.o(le_task_hdl_func) +
    +

    llc_con_move_cbk (Thumb, 182 bytes, Stack size 16 bytes, llc_con_upd.o(.text)) +

    [Stack]

    • Max Depth = 84
    • Call Chain = llc_con_move_cbk ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   sch_plan_set +
    + +

    llc_loc_phy_upd_proc_fsm (Thumb, 616 bytes, Stack size 40 bytes, llc_phy_upd.o(.text)) +

    [Stack]

    • Max Depth = 348
    • Call Chain = llc_loc_phy_upd_proc_fsm ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   __ARM_common_switch8 +
    • >>   lld_con_tx_rate_update +
    • >>   lld_con_phys_update +
    • >>   le_phy_upd_cmp_evt +
    • >>   lld_con_event_counter_get +
    • >>   llc_proc_unreg +
    • >>   llc_proc_timer_set +
    • >>   llc_llcp_send +
    +
    [Called By]
    • >>   llc_op_phy_upd_ind_cb +
    • >>   ll_phy_upd_ind_handler +
    • >>   ll_phy_rsp_handler +
    • >>   llc_loc_phy_upd_proc_err +
    • >>   lld_proc_upd_cfm_handler +
    + +

    llc_loc_phy_upd_proc_err (Thumb, 84 bytes, Stack size 0 bytes, llc_phy_upd.o(.text)) +

    [Stack]

    • Max Depth = 348
    • Call Chain = llc_loc_phy_upd_proc_err ⇒ llc_loc_phy_upd_proc_fsm ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_loc_phy_upd_proc_fsm +
    +
    [Called By]
    • >>   llc_proc_err_ind +
    + +

    llc_rem_phy_upd_proc_fsm (Thumb, 328 bytes, Stack size 24 bytes, llc_phy_upd.o(.text)) +

    [Stack]

    • Max Depth = 332
    • Call Chain = llc_rem_phy_upd_proc_fsm ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_con_tx_rate_update +
    • >>   lld_con_phys_update +
    • >>   le_phy_upd_cmp_evt +
    • >>   llc_proc_unreg +
    • >>   llc_proc_timer_set +
    • >>   llc_llcp_send +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   ll_phy_upd_ind_handler +
    • >>   ll_phy_req_handler +
    • >>   llc_rem_phy_upd_proc_err +
    • >>   lld_proc_upd_cfm_handler +
    + +

    llc_rem_phy_upd_proc_err (Thumb, 10 bytes, Stack size 0 bytes, llc_phy_upd.o(.text)) +

    [Stack]

    • Max Depth = 332
    • Call Chain = llc_rem_phy_upd_proc_err ⇒ llc_rem_phy_upd_proc_fsm ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_rem_phy_upd_proc_fsm +
    +
    [Called By]
    • >>   llc_proc_err_ind +
    + +

    ll_phy_req_handler (Thumb, 140 bytes, Stack size 16 bytes, llc_phy_upd.o(.text)) +

    [Stack]

    • Max Depth = 348
    • Call Chain = ll_phy_req_handler ⇒ llc_rem_phy_upd_proc_fsm ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_rem_phy_upd_proc_fsm +
    • >>   llc_proc_collision_check +
    • >>   llc_proc_reg +
    • >>   ke_msg_alloc +
    +
    [Address Reference Count : 1]
    • llc_llcp.o(.constdata) +
    +

    ll_phy_rsp_handler (Thumb, 98 bytes, Stack size 16 bytes, llc_phy_upd.o(.text)) +

    [Stack]

    • Max Depth = 364
    • Call Chain = ll_phy_rsp_handler ⇒ llc_loc_phy_upd_proc_fsm ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_loc_phy_upd_proc_fsm +
    +
    [Address Reference Count : 1]
    • llc_llcp.o(.constdata) +
    +

    ll_phy_upd_ind_handler (Thumb, 152 bytes, Stack size 24 bytes, llc_phy_upd.o(.text)) +

    [Stack]

    • Max Depth = 372
    • Call Chain = ll_phy_upd_ind_handler ⇒ llc_loc_phy_upd_proc_fsm ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_rem_phy_upd_proc_fsm +
    • >>   llc_loc_phy_upd_proc_fsm +
    +
    [Address Reference Count : 1]
    • llc_llcp.o(.constdata) +
    +

    le_rd_phy (Thumb, 38 bytes, Stack size 0 bytes, llc_phy_upd.o(.text)) +

    [Called By]

    • >>   gapc_get_info_cmd_handler +
    + +

    le_set_phy (Thumb, 144 bytes, Stack size 24 bytes, llc_phy_upd.o(.text)) +

    [Stack]

    • Max Depth = 92
    • Call Chain = le_set_phy ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   gapc_link_upd_cmd_handler +
    + +

    llc_op_phy_upd_ind_cb (Thumb, 82 bytes, Stack size 24 bytes, llc_phy_upd.o(.text)) +

    [Stack]

    • Max Depth = 372
    • Call Chain = llc_op_phy_upd_ind_cb ⇒ llc_loc_phy_upd_proc_fsm ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   le_phy_upd_cmp_evt +
    • >>   llc_loc_phy_upd_proc_fsm +
    • >>   llc_proc_reg +
    +
    [Called By]
    • >>   llc_proc_op_ind_handler +
    + +

    lld_rxdesc_free (Thumb, 48 bytes, Stack size 16 bytes, lld.o(.text)) +

    [Stack]

    • Max Depth = 28
    • Call Chain = lld_rxdesc_free ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ble_buf_rx_alloc +
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   lld_con_pkt_rx +
    • >>   lld_init_frm_cbk +
    • >>   lld_init_pkt_rx +
    • >>   lld_scan_frm_cbk +
    • >>   lld_scan_pkt_rx +
    • >>   lld_adv_pkt_rx +
    + +

    lld_rxdesc_check (Thumb, 34 bytes, Stack size 0 bytes, lld.o(.text)) +

    [Called By]

    • >>   lld_con_pkt_rx +
    • >>   lld_init_frm_cbk +
    • >>   lld_init_pkt_rx +
    • >>   lld_scan_frm_cbk +
    • >>   lld_scan_pkt_rx +
    • >>   lld_adv_pkt_rx +
    + +

    lld_aa_gen (Thumb, 114 bytes, Stack size 24 bytes, lld.o(.text)) +

    [Stack]

    • Max Depth = 36
    • Call Chain = lld_aa_gen ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   rand +
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   lld_init_start +
    + +

    lld_con_start (Thumb, 742 bytes, Stack size 56 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 268
    • Call Chain = lld_con_start ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   slot_clock_get +
    • >>   sch_slice_per_add +
    • >>   lld_con_sched +
    • >>   lld_con_evt_time_update +
    • >>   lld_con_max_lat_calc +
    • >>   ke_malloc +
    • >>   le_sca2ppm +
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   llc_start +
    + +

    lld_con_stop (Thumb, 108 bytes, Stack size 16 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 124
    • Call Chain = lld_con_stop ⇒ lld_con_cleanup ⇒ ke_msg_send_basic ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_arb_remove +
    • >>   lld_con_cleanup +
    +
    [Called By]
    • >>   llc_disconnect +
    + +

    lld_con_llcp_tx (Thumb, 56 bytes, Stack size 16 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 252
    • Call Chain = lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_con_slave_latency +
    • >>   lld_con_tx_prog +
    +
    [Called By]
    • >>   llc_llcp_tx_check +
    + +

    lld_con_data_tx (Thumb, 116 bytes, Stack size 16 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 252
    • Call Chain = lld_con_data_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_con_slave_latency +
    • >>   lld_con_tx_prog +
    • >>   list_push_back +
    +
    [Called By]
    • >>   l2cc_data_send +
    + +

    lld_con_data_flow_set (Thumb, 70 bytes, Stack size 16 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 252
    • Call Chain = lld_con_data_flow_set ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_con_slave_latency +
    • >>   lld_con_tx_prog +
    +
    [Called By]
    • >>   llc_loc_encrypt_proc_fsm +
    • >>   llc_rem_encrypt_proc_fsm +
    + +

    lld_con_param_update (Thumb, 76 bytes, Stack size 20 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 20
    • Call Chain = lld_con_param_update +
    +
    [Called By]
    • >>   llc_rem_con_upd_proc_fsm +
    • >>   llc_loc_con_upd_proc_fsm +
    + +

    lld_con_ch_map_update (Thumb, 54 bytes, Stack size 16 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 16
    • Call Chain = lld_con_ch_map_update +
    +
    [Called By]
    • >>   llc_rem_ch_map_proc_fsm +
    + +

    lld_con_data_len_update (Thumb, 56 bytes, Stack size 24 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 60
    • Call Chain = lld_con_data_len_update ⇒ lld_con_evt_time_update ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_con_evt_time_update +
    • >>   lld_con_tx_len_update +
    +
    [Called By]
    • >>   llc_rem_dl_upd_proc +
    • >>   llc_loc_dl_upd_proc_fsm +
    + +

    lld_con_phys_update (Thumb, 72 bytes, Stack size 24 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 60
    • Call Chain = lld_con_phys_update ⇒ lld_con_tx_len_update ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_con_tx_len_update +
    +
    [Called By]
    • >>   llc_rem_phy_upd_proc_fsm +
    • >>   llc_loc_phy_upd_proc_fsm +
    + +

    lld_con_tx_rate_update (Thumb, 58 bytes, Stack size 16 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 52
    • Call Chain = lld_con_tx_rate_update ⇒ lld_con_tx_len_update ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_con_tx_len_update +
    +
    [Called By]
    • >>   llc_rem_phy_upd_proc_fsm +
    • >>   llc_loc_phy_upd_proc_fsm +
    + +

    lld_con_event_counter_get (Thumb, 30 bytes, Stack size 0 bytes, lld_con.o(.text)) +

    [Called By]

    • >>   llc_loc_phy_upd_proc_fsm +
    • >>   llc_loc_con_upd_proc_fsm +
    + +

    lld_con_actv_offset_compute (Thumb, 102 bytes, Stack size 24 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 36
    • Call Chain = lld_con_actv_offset_compute ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   llc_pref_param_compute +
    + +

    lld_con_tx_enc (Thumb, 48 bytes, Stack size 8 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = lld_con_tx_enc +
    +
    [Called By]
    • >>   llc_loc_encrypt_proc_fsm +
    • >>   llc_rem_encrypt_proc_fsm +
    + +

    lld_con_rx_enc (Thumb, 48 bytes, Stack size 8 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = lld_con_rx_enc +
    +
    [Called By]
    • >>   llc_loc_encrypt_proc_fsm +
    • >>   llc_rem_encrypt_proc_fsm +
    + +

    lld_con_enc_key_load (Thumb, 108 bytes, Stack size 20 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 20
    • Call Chain = lld_con_enc_key_load +
    +
    [Called By]
    • >>   llc_loc_encrypt_proc_fsm +
    • >>   llc_rem_encrypt_proc_fsm +
    + +

    lld_con_rssi_get (Thumb, 30 bytes, Stack size 0 bytes, lld_con.o(.text)) +

    [Called By]

    • >>   gapc_get_info_cmd_handler +
    + +

    lld_con_offset_get (Thumb, 42 bytes, Stack size 8 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 20
    • Call Chain = lld_con_offset_get ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   llc_con_upd_info_send +
    • >>   llc_pref_param_compute +
    + +

    plf_reset (Thumb, 18 bytes, Stack size 0 bytes, plf.o(.text)) +

    [Called By]

    • >>   ke_malloc +
    + +

    sch_arb_insert (Thumb, 498 bytes, Stack size 48 bytes, sch_arb.o(.text)) +

    [Stack]

    • Max Depth = 148
    • Call Chain = sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_arb_prog_timer +
    • >>   sch_arb_elt_cancel +
    • >>   sch_arb_conflict_check +
    • >>   list_insert_after +
    • >>   list_extract_sublist +
    • >>   list_push_back_sublist +
    • >>   list_push_front +
    • >>   slot_time_get +
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   lld_scan_restart +
    • >>   lld_con_sched +
    • >>   lld_init_frm_cbk +
    • >>   lld_init_start +
    • >>   lld_init_evt_cancel_cbk +
    • >>   lld_init_sched +
    • >>   lld_scan_frm_cbk +
    • >>   lld_scan_start +
    • >>   lld_scan_evt_cancel_cbk +
    • >>   lld_scan_sched +
    • >>   lld_adv_frm_cbk +
    • >>   lld_adv_start +
    • >>   lld_adv_evt_cancel_cbk +
    + +

    sch_arb_remove (Thumb, 88 bytes, Stack size 16 bytes, sch_arb.o(.text)) +

    [Stack]

    • Max Depth = 56
    • Call Chain = sch_arb_remove ⇒ sch_arb_prog_timer ⇒ ble_timer_hus_set +
    +
    [Calls]
    • >>   sch_arb_prog_timer +
    • >>   list_extract +
    • >>   list_pop_front +
    +
    [Called By]
    • >>   lld_scan_restart +
    • >>   lld_con_frm_cbk +
    • >>   lld_con_slave_latency +
    • >>   lld_con_stop +
    • >>   lld_init_frm_cbk +
    • >>   lld_init_end +
    • >>   lld_scan_frm_cbk +
    • >>   lld_scan_end +
    • >>   lld_adv_frm_cbk +
    • >>   lld_adv_end +
    + +

    sch_prog_push0 (Thumb, 230 bytes, Stack size 40 bytes, sch_prog.o(.text)) +

    [Stack]

    • Max Depth = 52
    • Call Chain = sch_prog_push0 ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   lld_con_evt_start_cbk +
    • >>   lld_init_evt_start_cbk +
    • >>   lld_scan_evt_start_cbk +
    • >>   lld_adv_evt_start_cbk +
    + +

    sch_plan_set (Thumb, 100 bytes, Stack size 24 bytes, sch_plan.o(.text)) +

    [Stack]

    • Max Depth = 148
    • Call Chain = sch_plan_set ⇒ sch_plan_offset_req ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_plan_offset_req +
    • >>   llc_con_move_cbk +
    • >>   list_push_back +
    +
    [Called By]
    • >>   lld_con_offset_ind_handler +
    • >>   llc_con_upd_info_send +
    • >>   lld_init_end_ind_handler +
    + +

    sch_plan_rem (Thumb, 12 bytes, Stack size 8 bytes, sch_plan.o(.text)) +

    [Stack]

    • Max Depth = 16
    • Call Chain = sch_plan_rem ⇒ list_extract +
    +
    [Calls]
    • >>   list_extract +
    +
    [Called By]
    • >>   lld_con_offset_ind_handler +
    • >>   llc_con_upd_info_send +
    • >>   llm_link_disc +
    + +

    sch_plan_req (Thumb, 192 bytes, Stack size 32 bytes, sch_plan.o(.text)) +

    [Stack]

    • Max Depth = 156
    • Call Chain = sch_plan_req ⇒ sch_plan_offset_req ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_plan_offset_req +
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   llc_pref_param_compute +
    • >>   le_ext_create_con +
    + +

    sch_plan_chk (Thumb, 10 bytes, Stack size 0 bytes, sch_plan.o(.text)) +

    [Stack]

    • Max Depth = 124
    • Call Chain = sch_plan_chk ⇒ sch_plan_offset_req ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_plan_offset_req +
    +
    [Called By]
    • >>   llc_pref_param_compute +
    + +

    sch_slice_compute (Thumb, 134 bytes, Stack size 24 bytes, sch_slice.o(.text)) +

    [Stack]

    • Max Depth = 36
    • Call Chain = sch_slice_compute ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   co_clz +
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   sch_slice_fg_remove +
    • >>   sch_slice_fg_add +
    • >>   sch_slice_per_remove +
    • >>   sch_slice_per_add +
    • >>   lld_init_evt_start_cbk +
    • >>   lld_init_sched +
    • >>   lld_init_end +
    • >>   lld_scan_evt_start_cbk +
    • >>   lld_scan_sched +
    • >>   lld_scan_end +
    + +

    sch_slice_fg_add (Thumb, 10 bytes, Stack size 0 bytes, sch_slice.o(.text)) +

    [Stack]

    • Max Depth = 36
    • Call Chain = sch_slice_fg_add ⇒ sch_slice_compute ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_slice_compute +
    +
    [Called By]
    • >>   lld_adv_start +
    + +

    sch_slice_fg_remove (Thumb, 30 bytes, Stack size 8 bytes, sch_slice.o(.text)) +

    [Stack]

    • Max Depth = 172
    • Call Chain = sch_slice_fg_remove ⇒ lld_scan_restart ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_scan_restart +
    • >>   sch_slice_compute +
    +
    [Called By]
    • >>   lld_adv_end +
    + +

    sch_slice_per_add (Thumb, 38 bytes, Stack size 8 bytes, sch_slice.o(.text)) +

    [Stack]

    • Max Depth = 44
    • Call Chain = sch_slice_per_add ⇒ sch_slice_compute ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_slice_compute +
    +
    [Called By]
    • >>   lld_con_start +
    + +

    sch_slice_per_remove (Thumb, 30 bytes, Stack size 0 bytes, sch_slice.o(.text)) +

    [Stack]

    • Max Depth = 36
    • Call Chain = sch_slice_per_remove ⇒ sch_slice_compute ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_slice_compute +
    +
    [Called By]
    • >>   lld_con_cleanup +
    • >>   lld_con_init +
    + +

    gattc_process_op_simple (Thumb, 102 bytes, Stack size 32 bytes, gattc_task.o(.text)) +

    [Stack]

    • Max Depth = 124
    • Call Chain = gattc_process_op_simple ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gattc_send_cmp_evt +
    • >>   ke_state_set +
    • >>   ke_state_get +
    +
    [Called By]
    • >>   gatt_send_evt_cmd_handler +
    • >>   gatt_op_cmd_handler +
    + +

    gapm_is_addr_type_valid (Thumb, 50 bytes, Stack size 12 bytes, gapm_actv.o(.text)) +

    [Stack]

    • Max Depth = 12
    • Call Chain = gapm_is_addr_type_valid +
    +
    [Called By]
    • >>   gapm_scan_create +
    • >>   gapm_init_create +
    + +

    gapm_is_con_actv_full (Thumb, 66 bytes, Stack size 8 bytes, gapm_actv.o(.text), UNUSED) +

    [Calls]

    • >>   gapm_con_number +
    + +

    gapm_actv_alloc (Thumb, 44 bytes, Stack size 16 bytes, gapm_actv.o(.text)) +

    [Stack]

    • Max Depth = 60
    • Call Chain = gapm_actv_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_malloc +
    +
    [Called By]
    • >>   gapm_scan_create +
    • >>   gapm_init_create +
    • >>   gapm_adv_create +
    + +

    gapm_actv_get_next (Thumb, 38 bytes, Stack size 12 bytes, gapm_actv.o(.text)) +

    [Stack]

    • Max Depth = 12
    • Call Chain = gapm_actv_get_next +
    +
    [Called By]
    • >>   gapm_config_cmd_handler +
    • >>   gapm_actv_cmd_handler +
    • >>   gapm_actv_deleted +
    • >>   gapm_actv_stopped +
    + +

    gapm_actv_get_own_addr_type (Thumb, 20 bytes, Stack size 0 bytes, gapm_actv.o(.text)) +

    [Called By]

    • >>   gapm_init_send_en_cmd +
    • >>   gapm_scan_send_param_cmd +
    • >>   gapm_adv_send_param_cmd +
    + +

    gapm_actv_created (Thumb, 106 bytes, Stack size 16 bytes, gapm_actv.o(.text)) +

    [Stack]

    • Max Depth = 120
    • Call Chain = gapm_actv_created ⇒ gapm_send_complete_evt ⇒ gapm_operation_cleanup ⇒ gapm_update_state ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   gapm_send_complete_evt +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    • >>   le_set_rand_addr +
    • >>   le_set_adv_set_rand_addr +
    • >>   gapm_actv_free +
    +
    [Called By]
    • >>   gapm_scan_create +
    • >>   gapm_init_create +
    • >>   gapm_actv_adv_fsm +
    + +

    gapm_actv_started (Thumb, 32 bytes, Stack size 16 bytes, gapm_actv.o(.text)) +

    [Stack]

    • Max Depth = 120
    • Call Chain = gapm_actv_started ⇒ gapm_send_complete_evt ⇒ gapm_operation_cleanup ⇒ gapm_update_state ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   gapm_send_complete_evt +
    +
    [Called By]
    • >>   gapm_actv_scan_fsm +
    • >>   gapm_actv_init_fsm +
    • >>   gapm_actv_adv_fsm +
    + +

    gapm_actv_stopped (Thumb, 98 bytes, Stack size 16 bytes, gapm_actv.o(.text)) +

    [Stack]

    • Max Depth = 120
    • Call Chain = gapm_actv_stopped ⇒ gapm_send_complete_evt ⇒ gapm_operation_cleanup ⇒ gapm_update_state ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   gapm_send_complete_evt +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    • >>   gapm_actv_get_next +
    +
    [Called By]
    • >>   le_scan_timeout_evt +
    • >>   le_adv_set_term_evt +
    • >>   gapm_init_connection_ind +
    • >>   gapm_actv_scan_fsm +
    • >>   gapm_actv_init_fsm +
    • >>   gapm_actv_adv_fsm +
    + +

    gapm_actv_deleted (Thumb, 62 bytes, Stack size 8 bytes, gapm_actv.o(.text)) +

    [Stack]

    • Max Depth = 112
    • Call Chain = gapm_actv_deleted ⇒ gapm_send_complete_evt ⇒ gapm_operation_cleanup ⇒ gapm_update_state ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   gapm_send_complete_evt +
    • >>   gapm_actv_get_next +
    • >>   gapm_actv_free +
    +
    [Called By]
    • >>   gapm_actv_adv_fsm +
    +
    [Address Reference Count : 2]
    • gapm_init.o(.text) +
    • gapm_scan.o(.text) +
    +

    gapm_actv_cmd_handler (Thumb, 314 bytes, Stack size 40 bytes, gapm_actv.o(.text)) +

    [Stack]

    • Max Depth = 184
    • Call Chain = gapm_actv_cmd_handler ⇒ gapm_init_create ⇒ gapm_actv_created ⇒ gapm_send_complete_evt ⇒ gapm_operation_cleanup ⇒ gapm_update_state ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   __ARM_common_switch8 +
    • >>   gapm_send_complete_evt +
    • >>   gapm_process_op_simple +
    • >>   gapm_scan_create +
    • >>   gapm_init_create +
    • >>   gapm_adv_create +
    • >>   gapm_actv_get_next +
    +
    [Address Reference Count : 1]
    • gapm_task.o(le_task_hdl_func) +
    +

    le_actv_cmp_send (Thumb, 26 bytes, Stack size 8 bytes, gapm_actv.o(.text)) +

    [Stack]

    • Max Depth = 76
    • Call Chain = le_actv_cmp_send ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   gapm_init_send_en_cmd +
    • >>   gapm_init_stop +
    • >>   gapm_scan_send_param_cmd +
    • >>   gapm_scan_send_en_cmd +
    • >>   gapm_adv_send_data_cmd +
    • >>   gapm_adv_send_param_cmd +
    • >>   gapm_adv_delete +
    • >>   gapm_adv_send_en_cmd +
    • >>   lld_scan_end_ind_handler +
    • >>   lld_init_end_ind_handler +
    • >>   lld_adv_end_ind_handler +
    + +

    gapm_actv_cmp_evt_handler (Thumb, 88 bytes, Stack size 8 bytes, gapm_actv.o(.text)) +

    [Stack]

    • Max Depth = 260
    • Call Chain = gapm_actv_cmp_evt_handler ⇒ gapm_actv_scan_fsm ⇒ gapm_scan_send_en_cmd ⇒ le_set_ext_scan_en ⇒ lld_scan_start ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapm_actv_scan_fsm +
    • >>   gapm_actv_init_fsm +
    • >>   gapm_actv_adv_fsm +
    +
    [Address Reference Count : 1]
    • gapm_task.o(le_task_hdl_func) +
    +

    le_enh_con_cmp_evt (Thumb, 32 bytes, Stack size 8 bytes, gapm_actv.o(.text)) +

    [Stack]

    • Max Depth = 144
    • Call Chain = le_enh_con_cmp_evt ⇒ gapm_init_connection_ind ⇒ gapm_actv_stopped ⇒ gapm_send_complete_evt ⇒ gapm_operation_cleanup ⇒ gapm_update_state ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   gapm_con_create +
    • >>   gapm_init_connection_ind +
    +
    [Called By]
    • >>   lld_init_end_ind_handler +
    • >>   lld_adv_end_ind_handler +
    + +

    le_disc_cmp_evt (Thumb, 102 bytes, Stack size 40 bytes, gapc_hci.o(.text)) +

    [Stack]

    • Max Depth = 220
    • Call Chain = le_disc_cmp_evt ⇒ gapm_con_cleanup ⇒ l2cc_cleanup ⇒ l2cc_send_cmp_evt_status ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapm_con_cleanup +
    • >>   gapc_get_conidx +
    • >>   ke_state_get +
    • >>   gapc_send_cmp_evt +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   lld_disc_ind_handler +
    + +

    le_rd_rem_ver_info_cmp_evt (Thumb, 124 bytes, Stack size 24 bytes, gapc_hci.o(.text)) +

    [Stack]

    • Max Depth = 128
    • Call Chain = le_rd_rem_ver_info_cmp_evt ⇒ gapc_send_complete_evt ⇒ gapc_operation_cleanup ⇒ gapc_smp_cleanup ⇒ gapc_smp_clear_timeout_timer ⇒ ke_timer_clear ⇒ ke_time_past +
    +
    [Calls]
    • >>   gapc_get_conidx +
    • >>   ke_state_get +
    • >>   gapc_send_complete_evt +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   llc_op_ver_exch_ind_cb +
    • >>   llc_ver_exch_proc_fsm +
    + +

    le_rd_rem_feats_cmp_evt (Thumb, 148 bytes, Stack size 32 bytes, gapc_hci.o(.text)) +

    [Stack]

    • Max Depth = 136
    • Call Chain = le_rd_rem_feats_cmp_evt ⇒ gapc_send_complete_evt ⇒ gapc_operation_cleanup ⇒ gapc_smp_cleanup ⇒ gapc_smp_clear_timeout_timer ⇒ ke_timer_clear ⇒ ke_time_past +
    +
    [Calls]
    • >>   gapc_get_conidx +
    • >>   ke_state_get +
    • >>   gapc_send_complete_evt +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   llc_op_feats_exch_ind_cb +
    • >>   llc_loc_feats_exch_proc_fsm +
    + +

    le_con_estab_evt (Thumb, 54 bytes, Stack size 24 bytes, gapc_hci.o(.text)) +

    [Stack]

    • Max Depth = 92
    • Call Chain = le_con_estab_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapc_get_conidx +
    • >>   ke_state_get +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   lld_con_offset_ind_handler +
    + +

    le_con_update_cmp_evt (Thumb, 144 bytes, Stack size 40 bytes, gapc_hci.o(.text)) +

    [Stack]

    • Max Depth = 144
    • Call Chain = le_con_update_cmp_evt ⇒ gapc_send_complete_evt ⇒ gapc_operation_cleanup ⇒ gapc_smp_cleanup ⇒ gapc_smp_clear_timeout_timer ⇒ ke_timer_clear ⇒ ke_time_past +
    +
    [Calls]
    • >>   gapc_get_conidx +
    • >>   ke_state_get +
    • >>   gapc_send_complete_evt +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   llc_con_upd_info_send +
    + +

    le_rem_con_param_req_evt (Thumb, 78 bytes, Stack size 40 bytes, gapc_hci.o(.text)) +

    [Stack]

    • Max Depth = 108
    • Call Chain = le_rem_con_param_req_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapc_get_conidx +
    • >>   ke_state_get +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   llc_rem_con_upd_proc_fsm +
    + +

    le_data_len_chg_evt (Thumb, 64 bytes, Stack size 40 bytes, gapc_hci.o(.text)) +

    [Stack]

    • Max Depth = 108
    • Call Chain = le_data_len_chg_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapc_get_conidx +
    • >>   ke_state_get +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   llc_op_dl_upd_ind_cb +
    • >>   llc_rem_dl_upd_proc +
    • >>   llc_loc_dl_upd_proc_fsm +
    + +

    le_phy_upd_cmp_evt (Thumb, 94 bytes, Stack size 40 bytes, gapc_hci.o(.text)) +

    [Stack]

    • Max Depth = 144
    • Call Chain = le_phy_upd_cmp_evt ⇒ gapc_send_complete_evt ⇒ gapc_operation_cleanup ⇒ gapc_smp_cleanup ⇒ gapc_smp_clear_timeout_timer ⇒ ke_timer_clear ⇒ ke_time_past +
    +
    [Calls]
    • >>   gapc_get_conidx +
    • >>   ke_state_get +
    • >>   gapc_send_complete_evt +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   llc_op_phy_upd_ind_cb +
    • >>   llc_rem_phy_upd_proc_fsm +
    • >>   llc_loc_phy_upd_proc_fsm +
    + +

    l2cm_tx_status (Thumb, 42 bytes, Stack size 16 bytes, l2cm.o(.text)) +

    [Stack]

    • Max Depth = 24
    • Call Chain = l2cm_tx_status ⇒ ke_event_set +
    +
    [Calls]
    • >>   ke_event_set +
    +
    [Called By]
    • >>   l2cc_data_send +
    • >>   gapm_con_cleanup +
    • >>   l2cc_pdu_send_cmd_handler +
    + +

    l2cc_pdu_pack (Thumb, 152 bytes, Stack size 48 bytes, l2cc_pdu.o(.text)) +

    [Stack]

    • Max Depth = 48
    • Call Chain = l2cc_pdu_pack +
    +
    [Called By]
    • >>   l2cc_data_send +
    + +

    l2cc_pdu_unpack (Thumb, 142 bytes, Stack size 32 bytes, l2cc_pdu.o(.text)) +

    [Stack]

    • Max Depth = 32
    • Call Chain = l2cc_pdu_unpack +
    +
    [Called By]
    • >>   l2cc_acl_data_handler +
    + +

    l2cc_pdu_rx_init (Thumb, 76 bytes, Stack size 24 bytes, l2cc_pdu.o(.text)) +

    [Stack]

    • Max Depth = 116
    • Call Chain = l2cc_pdu_rx_init ⇒ l2cc_ind_pdu_alloc ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   l2cc_ind_pdu_alloc +
    • >>   ke_msg_send +
    +
    [Called By]
    • >>   l2cc_acl_data_handler +
    + +

    l2cc_pdu_header_check (Thumb, 218 bytes, Stack size 40 bytes, l2cc_pdu.o(.text)) +

    [Stack]

    • Max Depth = 132
    • Call Chain = l2cc_pdu_header_check ⇒ l2cc_ind_pdu_alloc ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   l2cc_ind_pdu_alloc +
    • >>   gatt_get_mtu +
    • >>   ke_msg_send +
    +
    [Called By]
    • >>   l2cc_acl_data_handler +
    + +

    llc_cleanup (Thumb, 98 bytes, Stack size 24 bytes, llc.o(.text)) +

    [Stack]

    • Max Depth = 116
    • Call Chain = llc_cleanup ⇒ llc_llcp_trans_timer_set ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_free +
    • >>   ke_state_set +
    • >>   llc_llcp_trans_timer_set +
    +
    [Called By]
    • >>   lld_disc_ind_handler +
    • >>   llm_init +
    + +

    llc_start (Thumb, 238 bytes, Stack size 24 bytes, llc.o(.text)) +

    [Stack]

    • Max Depth = 292
    • Call Chain = llc_start ⇒ lld_con_start ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_con_start +
    • >>   ke_malloc +
    • >>   ke_state_set +
    +
    [Called By]
    • >>   lld_init_end_ind_handler +
    • >>   lld_adv_end_ind_handler +
    + +

    llc_llcp_state_set (Thumb, 78 bytes, Stack size 16 bytes, llc.o(.text)) +

    [Stack]

    • Max Depth = 292
    • Call Chain = llc_llcp_state_set ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_llcp_tx_check +
    +
    [Called By]
    • >>   llc_loc_encrypt_proc_fsm +
    • >>   llc_rem_encrypt_proc_fsm +
    • >>   lld_disc_ind_handler +
    • >>   llc_disconnect +
    • >>   llc_disconnect_proc_fsm +
    + +

    llc_proc_reg (Thumb, 44 bytes, Stack size 24 bytes, llc.o(.text)) +

    [Stack]

    • Max Depth = 80
    • Call Chain = llc_proc_reg ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   ke_state_set +
    • >>   ke_state_get +
    +
    [Called By]
    • >>   llc_op_phy_upd_ind_cb +
    • >>   ll_phy_req_handler +
    • >>   llc_op_con_upd_ind_cb +
    • >>   ll_con_param_req_handler +
    • >>   ll_con_update_ind_handler +
    • >>   llc_op_dl_upd_ind_cb +
    • >>   llc_op_feats_exch_ind_cb +
    • >>   llc_op_encrypt_ind_cb +
    • >>   ll_enc_req_handler +
    • >>   ll_pause_enc_req_handler +
    • >>   llc_op_ver_exch_ind_cb +
    • >>   llc_op_disconnect_ind_cb +
    • >>   ll_channel_map_ind_handler +
    + +

    llc_proc_timer_set (Thumb, 84 bytes, Stack size 8 bytes, llc.o(.text)) +

    [Stack]

    • Max Depth = 100
    • Call Chain = llc_proc_timer_set ⇒ llc_llcp_trans_timer_set ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_llcp_trans_timer_set +
    +
    [Called By]
    • >>   llc_rem_phy_upd_proc_fsm +
    • >>   llc_loc_phy_upd_proc_fsm +
    • >>   llc_rem_con_upd_proc_fsm +
    • >>   llc_loc_con_upd_proc_fsm +
    • >>   llc_loc_dl_upd_proc_fsm +
    • >>   llc_loc_feats_exch_proc_fsm +
    • >>   llc_loc_encrypt_proc_fsm +
    • >>   llc_rem_encrypt_proc_fsm +
    • >>   llc_ver_exch_proc_fsm +
    • >>   llc_proc_unreg +
    • >>   ll_terminate_ind_handler +
    • >>   llc_disconnect_proc_fsm +
    + +

    llc_proc_unreg (Thumb, 68 bytes, Stack size 24 bytes, llc.o(.text)) +

    [Stack]

    • Max Depth = 124
    • Call Chain = llc_proc_unreg ⇒ llc_proc_timer_set ⇒ llc_llcp_trans_timer_set ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_proc_timer_set +
    • >>   ke_free +
    • >>   ke_state_set +
    • >>   ke_state_get +
    +
    [Called By]
    • >>   llc_rem_phy_upd_proc_fsm +
    • >>   llc_loc_phy_upd_proc_fsm +
    • >>   llc_rem_con_upd_proc_fsm +
    • >>   llc_loc_con_upd_proc_fsm +
    • >>   llc_loc_dl_upd_proc_fsm +
    • >>   llc_loc_feats_exch_proc_fsm +
    • >>   llc_loc_encrypt_proc_fsm +
    • >>   llc_rem_encrypt_proc_fsm +
    • >>   llc_ver_exch_proc_fsm +
    • >>   llc_disconnect_proc_fsm +
    • >>   le_ltk_req_reply +
    • >>   llc_rem_ch_map_proc_fsm +
    + +

    llc_proc_err_ind (Thumb, 154 bytes, Stack size 16 bytes, llc.o(.text)) +

    [Stack]

    • Max Depth = 412
    • Call Chain = llc_proc_err_ind ⇒ llc_rem_con_upd_proc_err ⇒ llc_rem_con_upd_proc_fsm ⇒ llc_ll_con_param_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   __ARM_common_switch8 +
    • >>   llc_rem_phy_upd_proc_err +
    • >>   llc_loc_phy_upd_proc_err +
    • >>   llc_rem_con_upd_proc_err +
    • >>   llc_loc_con_upd_proc_err +
    • >>   llc_dle_proc_err +
    • >>   llc_feats_exch_proc_err +
    • >>   llc_rem_encrypt_proc_err +
    • >>   llc_loc_encrypt_proc_err +
    • >>   llc_ver_exch_proc_err +
    • >>   llc_disconnect_proc_err +
    • >>   llc_ch_map_up_proc_err +
    +
    [Called By]
    • >>   llc_op_disconnect_ind_cb +
    • >>   lld_disc_ind_handler +
    • >>   ll_unknown_rsp_handler +
    • >>   ll_reject_ext_ind_handler +
    • >>   ll_reject_ind_handler +
    + +

    llc_proc_op_ind_handler (Thumb, 130 bytes, Stack size 16 bytes, llc.o(.text)) +

    [Stack]

    • Max Depth = 444
    • Call Chain = llc_proc_op_ind_handler ⇒ llc_op_disconnect_ind_cb ⇒ llc_proc_err_ind ⇒ llc_rem_con_upd_proc_err ⇒ llc_rem_con_upd_proc_fsm ⇒ llc_ll_con_param_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   __ARM_common_switch8 +
    • >>   llc_op_phy_upd_ind_cb +
    • >>   llc_op_con_upd_ind_cb +
    • >>   llc_op_dl_upd_ind_cb +
    • >>   llc_op_feats_exch_ind_cb +
    • >>   llc_op_encrypt_ind_cb +
    • >>   llc_op_ver_exch_ind_cb +
    • >>   llc_op_disconnect_ind_cb +
    +
    [Address Reference Count : 1]
    • llc_task.o(le_task_hdl_func) +
    +

    lld_proc_upd_cfm_handler (Thumb, 144 bytes, Stack size 8 bytes, llc.o(.text)) +

    [Stack]

    • Max Depth = 404
    • Call Chain = lld_proc_upd_cfm_handler ⇒ llc_rem_con_upd_proc_fsm ⇒ llc_ll_con_param_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_rem_phy_upd_proc_fsm +
    • >>   llc_loc_phy_upd_proc_fsm +
    • >>   llc_rem_con_upd_proc_fsm +
    • >>   llc_loc_con_upd_proc_fsm +
    • >>   llc_rem_ch_map_proc_fsm +
    +
    [Address Reference Count : 1]
    • llc_task.o(le_task_hdl_func) +
    +

    llc_llcp_rsp_to_handler (Thumb, 16 bytes, Stack size 8 bytes, llc.o(.text)) +

    [Stack]

    • Max Depth = 308
    • Call Chain = llc_llcp_rsp_to_handler ⇒ llc_disconnect ⇒ llc_llcp_state_set ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_disconnect +
    +
    [Address Reference Count : 1]
    • llc_task.o(le_task_hdl_func) +
    +

    llc_proc_timer_pause_set (Thumb, 82 bytes, Stack size 8 bytes, llc.o(.text)) +

    [Stack]

    • Max Depth = 100
    • Call Chain = llc_proc_timer_pause_set ⇒ llc_llcp_trans_timer_set ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_llcp_trans_timer_set +
    +
    [Called By]
    • >>   llc_loc_encrypt_proc_fsm +
    • >>   llc_rem_encrypt_proc_fsm +
    • >>   llc_disconnect_proc_fsm +
    + +

    llc_proc_collision_check (Thumb, 42 bytes, Stack size 0 bytes, llc.o(.text)) +

    [Called By]

    • >>   ll_phy_req_handler +
    • >>   ll_con_param_req_handler +
    + +

    llc_llcp_tx_check (Thumb, 136 bytes, Stack size 24 bytes, llc_llcp.o(.text)) +

    [Stack]

    • Max Depth = 276
    • Call Chain = llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   list_extract +
    • >>   ble_buf_llcp_tx_alloc +
    • >>   ble_buf_llcp_tx_free +
    • >>   lld_con_llcp_tx +
    • >>   list_push_front +
    +
    [Called By]
    • >>   llc_llcp_state_set +
    • >>   llc_llcp_send +
    • >>   lld_con_tx_cfm_handler +
    + +

    llc_llcp_send (Thumb, 80 bytes, Stack size 32 bytes, llc_llcp.o(.text)) +

    [Stack]

    • Max Depth = 308
    • Call Chain = llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   list_push_back +
    • >>   ke_malloc +
    • >>   llc_llcp_tx_check +
    +
    [Called By]
    • >>   llc_rem_phy_upd_proc_fsm +
    • >>   llc_loc_phy_upd_proc_fsm +
    • >>   llc_loc_con_upd_proc_fsm +
    • >>   llc_ll_con_param_pdu_send +
    • >>   llc_rem_dl_upd_proc +
    • >>   llc_loc_dl_upd_proc_fsm +
    • >>   llc_ll_feature_pdu_send +
    • >>   llc_ll_reject_ind_pdu_send +
    • >>   llc_loc_encrypt_proc_fsm +
    • >>   llc_rem_encrypt_proc_fsm +
    • >>   llc_llcp_version_ind_pdu_send +
    • >>   llc_ll_terminate_ind_pdu_send +
    • >>   lld_llcp_rx_ind +
    + +

    llc_ll_reject_ind_pdu_send (Thumb, 70 bytes, Stack size 16 bytes, llc_llcp.o(.text)) +

    [Stack]

    • Max Depth = 324
    • Call Chain = llc_ll_reject_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_llcp_send +
    +
    [Called By]
    • >>   llc_rem_con_upd_proc_fsm +
    • >>   llc_rem_encrypt_proc_fsm +
    • >>   lld_llcp_rx_ind +
    + +

    lld_llcp_rx_ind (Thumb, 162 bytes, Stack size 64 bytes, llc_llcp.o(.text)) +

    [Stack]

    • Max Depth = 388
    • Call Chain = lld_llcp_rx_ind ⇒ llc_ll_reject_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_ll_reject_ind_pdu_send +
    • >>   llc_llcp_send +
    • >>   llc_disconnect +
    • >>   ble_buf_rx_free +
    +
    [Called By]
    • >>   lld_con_rx_ind_handler +
    + +

    lld_adv_restart (Thumb, 66 bytes, Stack size 12 bytes, lld_adv.o(.text)) +

    [Stack]

    • Max Depth = 12
    • Call Chain = lld_adv_restart +
    +
    [Called By]
    • >>   le_set_ext_adv_en +
    • >>   lld_adv_start +
    + +

    lld_adv_start (Thumb, 770 bytes, Stack size 56 bytes, lld_adv.o(.text)) +

    [Stack]

    • Max Depth = 204
    • Call Chain = lld_adv_start ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_slice_fg_add +
    • >>   slot_clock_get +
    • >>   sch_arb_insert +
    • >>   ke_malloc +
    • >>   popcnt8 +
    • >>   lld_adv_restart +
    • >>   lld_adv_data_set +
    +
    [Called By]
    • >>   le_set_ext_adv_en +
    + +

    lld_adv_stop (Thumb, 90 bytes, Stack size 8 bytes, lld_adv.o(.text)) +

    [Stack]

    • Max Depth = 212
    • Call Chain = lld_adv_stop ⇒ lld_adv_end ⇒ sch_slice_fg_remove ⇒ lld_scan_restart ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_adv_end +
    +
    [Called By]
    • >>   le_set_ext_adv_en +
    + +

    lld_adv_data_update (Thumb, 40 bytes, Stack size 16 bytes, lld_adv.o(.text)) +

    [Stack]

    • Max Depth = 40
    • Call Chain = lld_adv_data_update ⇒ lld_adv_data_set +
    +
    [Calls]
    • >>   lld_adv_data_set +
    +
    [Called By]
    • >>   le_set_ext_adv_data +
    + +

    lld_scan_restart (Thumb, 80 bytes, Stack size 16 bytes, lld_scan.o(.text)) +

    [Stack]

    • Max Depth = 164
    • Call Chain = lld_scan_restart ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   slot_clock_get +
    • >>   sch_arb_remove +
    • >>   sch_arb_insert +
    +
    [Called By]
    • >>   sch_slice_fg_remove +
    • >>   lld_scan_params_update +
    + +

    lld_scan_start (Thumb, 746 bytes, Stack size 48 bytes, lld_scan.o(.text)) +

    [Stack]

    • Max Depth = 196
    • Call Chain = lld_scan_start ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   slot_clock_get +
    • >>   sch_arb_insert +
    • >>   ke_malloc +
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   le_set_ext_scan_en +
    • >>   llm_scan_period_to_handler +
    + +

    lld_scan_stop (Thumb, 30 bytes, Stack size 8 bytes, lld_scan.o(.text)) +

    [Stack]

    • Max Depth = 92
    • Call Chain = lld_scan_stop ⇒ lld_scan_end ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_scan_end +
    +
    [Called By]
    • >>   le_set_ext_scan_en +
    + +

    lld_scan_params_update (Thumb, 74 bytes, Stack size 24 bytes, lld_scan.o(.text)) +

    [Stack]

    • Max Depth = 188
    • Call Chain = lld_scan_params_update ⇒ lld_scan_restart ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_scan_restart +
    • >>   slot_clock_get +
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   le_set_ext_scan_en +
    + +

    lld_init_start (Thumb, 890 bytes, Stack size 96 bytes, lld_init.o(.text)) +

    [Stack]

    • Max Depth = 244
    • Call Chain = lld_init_start ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   rand +
    • >>   slot_clock_get +
    • >>   sch_arb_insert +
    • >>   lld_aa_gen +
    • >>   ke_malloc +
    • >>   le_ppm2sca +
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   le_ext_create_con +
    + +

    lld_init_stop (Thumb, 30 bytes, Stack size 8 bytes, lld_init.o(.text)) +

    [Stack]

    • Max Depth = 92
    • Call Chain = lld_init_stop ⇒ lld_init_end ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_init_end +
    +
    [Called By]
    • >>   le_create_con_cancel +
    + +

    sch_alarm_set (Thumb, 126 bytes, Stack size 32 bytes, sch_alarm.o(.text), UNUSED) +

    [Calls]

    • >>   list_insert_after +
    • >>   list_push_front +
    • >>   slot_time_get +
    • >>   sch_alarm_prog +
    + +

    sch_alarm_clear (Thumb, 58 bytes, Stack size 16 bytes, sch_alarm.o(.text), UNUSED) +

    [Calls]

    • >>   list_extract +
    • >>   list_pop_front +
    • >>   sch_alarm_prog +
    + +

    le_nb_cmp_pkts_evt (Thumb, 44 bytes, Stack size 16 bytes, l2cc_task.o(.text)) +

    [Stack]

    • Max Depth = 24
    • Call Chain = le_nb_cmp_pkts_evt ⇒ ke_event_set +
    +
    [Calls]
    • >>   ke_event_set +
    • >>   gapc_get_conidx +
    +
    [Called By]
    • >>   lld_con_tx_cfm_handler +
    + +

    gapm_config_cmd_handler (Thumb, 240 bytes, Stack size 24 bytes, gapm_cfg.o(.text)) +

    [Stack]

    • Max Depth = 236
    • Call Chain = gapm_config_cmd_handler ⇒ ble_drv_reset ⇒ ble_drv_init ⇒ l2cm_init ⇒ l2cc_cleanup ⇒ l2cc_send_cmp_evt_status ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapm_con_number +
    • >>   gapm_send_complete_evt +
    • >>   gapm_process_op_simple +
    • >>   gapm_send_cmp_evt +
    • >>   ble_drv_reset +
    • >>   attmdb_destroy +
    • >>   le_wr_suggted_dft_data_len +
    • >>   le_set_static_addr +
    • >>   le_set_dft_phy +
    • >>   gapm_actv_get_next +
    +
    [Address Reference Count : 1]
    • gapm_task.o(le_task_hdl_func) +
    +

    gapm_sec_enc_aes_cmd_handler (Thumb, 94 bytes, Stack size 16 bytes, gapm_smp.o(.text)) +

    [Stack]

    • Max Depth = 156
    • Call Chain = gapm_sec_enc_aes_cmd_handler ⇒ aes_rand ⇒ aes_encrypt ⇒ aes_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapm_send_complete_evt +
    • >>   gapm_process_op_simple +
    • >>   aes_rand +
    • >>   aes_encrypt +
    +
    [Address Reference Count : 1]
    • gapm_task.o(le_task_hdl_func) +
    +

    gapm_adv_create (Thumb, 138 bytes, Stack size 40 bytes, gapm_adv.o(.text)) +

    [Stack]

    • Max Depth = 140
    • Call Chain = gapm_adv_create ⇒ gapm_adv_send_param_cmd ⇒ le_actv_cmp_send ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapm_adv_send_param_cmd +
    • >>   gapm_actv_alloc +
    +
    [Called By]
    • >>   gapm_actv_cmd_handler +
    + +

    gapm_set_adv_data_cmd_handler (Thumb, 50 bytes, Stack size 16 bytes, gapm_adv.o(.text)) +

    [Stack]

    • Max Depth = 132
    • Call Chain = gapm_set_adv_data_cmd_handler ⇒ gapm_adv_set_data ⇒ gapm_adv_send_data_cmd ⇒ le_actv_cmp_send ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapm_process_op_simple +
    • >>   gapm_adv_set_data +
    +
    [Address Reference Count : 1]
    • gapm_task.o(le_task_hdl_func) +
    +

    gapm_actv_adv_fsm (Thumb, 156 bytes, Stack size 24 bytes, gapm_adv.o(.text)) +

    [Stack]

    • Max Depth = 144
    • Call Chain = gapm_actv_adv_fsm ⇒ gapm_actv_stopped ⇒ gapm_send_complete_evt ⇒ gapm_operation_cleanup ⇒ gapm_update_state ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   __ARM_common_switch8 +
    • >>   gapm_send_complete_evt +
    • >>   gapm_adv_set_data +
    • >>   gapm_actv_deleted +
    • >>   gapm_actv_stopped +
    • >>   gapm_actv_started +
    • >>   gapm_actv_created +
    +
    [Called By]
    • >>   gapm_actv_cmp_evt_handler +
    + +

    le_scan_req_rcvd_evt (Thumb, 64 bytes, Stack size 32 bytes, gapm_adv.o(.text)) +

    [Stack]

    • Max Depth = 100
    • Call Chain = le_scan_req_rcvd_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   lld_adv_pkt_rx +
    + +

    le_adv_set_term_evt (Thumb, 90 bytes, Stack size 16 bytes, gapm_adv.o(.text)) +

    [Stack]

    • Max Depth = 136
    • Call Chain = le_adv_set_term_evt ⇒ gapm_actv_stopped ⇒ gapm_send_complete_evt ⇒ gapm_operation_cleanup ⇒ gapm_update_state ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   gapc_set_local_addr +
    • >>   gapc_get_conidx +
    • >>   gapm_actv_stopped +
    +
    [Called By]
    • >>   lld_adv_end_ind_handler +
    + +

    gapm_scan_create (Thumb, 84 bytes, Stack size 16 bytes, gapm_scan.o(.text)) +

    [Stack]

    • Max Depth = 136
    • Call Chain = gapm_scan_create ⇒ gapm_actv_created ⇒ gapm_send_complete_evt ⇒ gapm_operation_cleanup ⇒ gapm_update_state ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   gapm_actv_created +
    • >>   gapm_actv_alloc +
    • >>   gapm_is_addr_type_valid +
    +
    [Called By]
    • >>   gapm_actv_cmd_handler +
    + +

    gapm_actv_scan_fsm (Thumb, 68 bytes, Stack size 16 bytes, gapm_scan.o(.text)) +

    [Stack]

    • Max Depth = 252
    • Call Chain = gapm_actv_scan_fsm ⇒ gapm_scan_send_en_cmd ⇒ le_set_ext_scan_en ⇒ lld_scan_start ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapm_scan_send_en_cmd +
    • >>   gapm_actv_stopped +
    • >>   gapm_actv_started +
    +
    [Called By]
    • >>   gapm_actv_cmp_evt_handler +
    + +

    le_ext_adv_report_evt (Thumb, 274 bytes, Stack size 24 bytes, gapm_scan.o(.text)) +

    [Stack]

    • Max Depth = 92
    • Call Chain = le_ext_adv_report_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   lld_adv_rep_ind_handler +
    + +

    le_scan_timeout_evt (Thumb, 32 bytes, Stack size 8 bytes, gapm_scan.o(.text)) +

    [Stack]

    • Max Depth = 128
    • Call Chain = le_scan_timeout_evt ⇒ gapm_actv_stopped ⇒ gapm_send_complete_evt ⇒ gapm_operation_cleanup ⇒ gapm_update_state ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   gapm_actv_stopped +
    +
    [Called By]
    • >>   lld_scan_end_ind_handler +
    + +

    gapm_init_create (Thumb, 86 bytes, Stack size 24 bytes, gapm_init.o(.text)) +

    [Stack]

    • Max Depth = 144
    • Call Chain = gapm_init_create ⇒ gapm_actv_created ⇒ gapm_send_complete_evt ⇒ gapm_operation_cleanup ⇒ gapm_update_state ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   gapm_actv_created +
    • >>   gapm_actv_alloc +
    • >>   gapm_is_addr_type_valid +
    +
    [Called By]
    • >>   gapm_actv_cmd_handler +
    + +

    gapm_init_connection_ind (Thumb, 68 bytes, Stack size 16 bytes, gapm_init.o(.text)) +

    [Stack]

    • Max Depth = 136
    • Call Chain = gapm_init_connection_ind ⇒ gapm_actv_stopped ⇒ gapm_send_complete_evt ⇒ gapm_operation_cleanup ⇒ gapm_update_state ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   gapc_set_local_addr +
    • >>   ke_timer_clear +
    • >>   gapm_actv_stopped +
    +
    [Called By]
    • >>   le_enh_con_cmp_evt +
    + +

    gapm_init_conn_to_handler (Thumb, 54 bytes, Stack size 16 bytes, gapm_init.o(.text)) +

    [Stack]

    • Max Depth = 84
    • Call Chain = gapm_init_conn_to_handler ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Address Reference Count : 1]
    • gapm_task.o(le_task_hdl_func) +
    +

    gapm_actv_init_fsm (Thumb, 76 bytes, Stack size 24 bytes, gapm_init.o(.text)) +

    [Stack]

    • Max Depth = 144
    • Call Chain = gapm_actv_init_fsm ⇒ gapm_actv_stopped ⇒ gapm_send_complete_evt ⇒ gapm_operation_cleanup ⇒ gapm_update_state ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   ke_timer_clear +
    • >>   gapm_actv_stopped +
    • >>   gapm_actv_started +
    +
    [Called By]
    • >>   gapm_actv_cmp_evt_handler +
    + +

    attc_send_hdl_cfm (Thumb, 18 bytes, Stack size 8 bytes, attc.o(.text)) +

    [Stack]

    • Max Depth = 92
    • Call Chain = attc_send_hdl_cfm ⇒ l2cc_att_pdu_alloc ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   l2cc_att_pdu_alloc +
    • >>   ke_msg_send +
    +
    [Called By]
    • >>   gatt_event_cfm_handler +
    + +

    attc_send_att_req (Thumb, 28 bytes, Stack size 8 bytes, attc.o(.text)) +

    [Stack]

    • Max Depth = 92
    • Call Chain = attc_send_att_req ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_timer_set +
    • >>   ke_msg_send +
    +
    [Called By]
    • >>   attc_rd_by_type_rsp +
    • >>   gatt_op_cmd_handler +
    + +

    attc_send_read_ind (Thumb, 222 bytes, Stack size 32 bytes, attc.o(.text)) +

    [Stack]

    • Max Depth = 100
    • Call Chain = attc_send_read_ind ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_free +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   attc_rd_rsp +
    + +

    attc_pdu_recv_handler (Thumb, 86 bytes, Stack size 24 bytes, attc.o(.text)) +

    [Stack]

    • Max Depth = 72
    • Call Chain = attc_pdu_recv_handler ⇒ ke_timer_clear ⇒ ke_time_past +
    +
    [Calls]
    • >>   ble_buf_rx_free +
    • >>   ke_timer_clear +
    +
    [Called By]
    • >>   l2cc_pdu_recv_ind_handler +
    + +

    le_set_dft_phy (Thumb, 34 bytes, Stack size 0 bytes, llm_hci.o(.text)) +

    [Called By]

    • >>   gapm_config_cmd_handler +
    + +

    le_wr_suggted_dft_data_len (Thumb, 32 bytes, Stack size 0 bytes, llm_hci.o(.text)) +

    [Called By]

    • >>   gapm_config_cmd_handler +
    + +

    le_set_rand_addr (Thumb, 68 bytes, Stack size 16 bytes, llm_hci.o(.text)) +

    [Stack]

    • Max Depth = 16
    • Call Chain = le_set_rand_addr +
    +
    [Called By]
    • >>   gapm_actv_created +
    + +

    le_set_static_addr (Thumb, 28 bytes, Stack size 16 bytes, llm_hci.o(.text)) +

    [Stack]

    • Max Depth = 16
    • Call Chain = le_set_static_addr +
    +
    [Called By]
    • >>   gapm_config_cmd_handler +
    + +

    llm_adv_hdl_to_id (Thumb, 42 bytes, Stack size 8 bytes, llm_adv.o(.text)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = llm_adv_hdl_to_id +
    +
    [Called By]
    • >>   le_set_ext_adv_param +
    • >>   le_set_ext_adv_en +
    • >>   le_set_ext_adv_data +
    • >>   le_rmv_adv_set +
    • >>   le_set_adv_set_rand_addr +
    + +

    le_set_adv_set_rand_addr (Thumb, 86 bytes, Stack size 32 bytes, llm_adv.o(.text)) +

    [Stack]

    • Max Depth = 40
    • Call Chain = le_set_adv_set_rand_addr ⇒ llm_adv_hdl_to_id +
    +
    [Calls]
    • >>   llm_adv_hdl_to_id +
    +
    [Called By]
    • >>   gapm_actv_created +
    + +

    le_set_ext_adv_param (Thumb, 130 bytes, Stack size 24 bytes, llm_adv.o(.text)) +

    [Stack]

    • Max Depth = 44
    • Call Chain = le_set_ext_adv_param ⇒ ke_free +
    +
    [Calls]
    • >>   llm_activity_free_get +
    • >>   ke_free +
    • >>   llm_adv_hdl_to_id +
    +
    [Called By]
    • >>   gapm_adv_send_param_cmd +
    + +

    le_set_ext_adv_data (Thumb, 198 bytes, Stack size 32 bytes, llm_adv.o(.text)) +

    [Stack]

    • Max Depth = 72
    • Call Chain = le_set_ext_adv_data ⇒ lld_adv_data_update ⇒ lld_adv_data_set +
    +
    [Calls]
    • >>   ble_buf_adv_tx_free +
    • >>   ble_buf_adv_tx_elt_get +
    • >>   ble_buf_adv_tx_alloc +
    • >>   llm_adv_hdl_to_id +
    • >>   lld_adv_data_update +
    +
    [Called By]
    • >>   gapm_adv_send_data_cmd +
    + +

    le_set_ext_adv_en (Thumb, 210 bytes, Stack size 24 bytes, llm_adv.o(.text)) +

    [Stack]

    • Max Depth = 236
    • Call Chain = le_set_ext_adv_en ⇒ lld_adv_stop ⇒ lld_adv_end ⇒ sch_slice_fg_remove ⇒ lld_scan_restart ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llm_activity_free_get +
    • >>   llm_is_dev_connected +
    • >>   llm_adv_hdl_to_id +
    • >>   lld_adv_stop +
    • >>   lld_adv_start +
    • >>   lld_adv_restart +
    +
    [Called By]
    • >>   gapm_adv_send_en_cmd +
    + +

    le_rmv_adv_set (Thumb, 40 bytes, Stack size 8 bytes, llm_adv.o(.text)) +

    [Stack]

    • Max Depth = 52
    • Call Chain = le_rmv_adv_set ⇒ llm_adv_set_release ⇒ ke_free +
    +
    [Calls]
    • >>   llm_adv_hdl_to_id +
    • >>   llm_adv_set_release +
    +
    [Called By]
    • >>   gapm_adv_delete +
    + +

    lld_adv_end_ind_handler (Thumb, 178 bytes, Stack size 24 bytes, llm_adv.o(.text)) +

    [Stack]

    • Max Depth = 316
    • Call Chain = lld_adv_end_ind_handler ⇒ llc_start ⇒ lld_con_start ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   le_adv_set_term_evt +
    • >>   llc_start +
    • >>   le_enh_con_cmp_evt +
    • >>   le_actv_cmp_send +
    +
    [Address Reference Count : 1]
    • llm_task.o(le_task_hdl_func) +
    +

    le_set_ext_scan_param (Thumb, 118 bytes, Stack size 16 bytes, llm_scan.o(.text)) +

    [Stack]

    • Max Depth = 36
    • Call Chain = le_set_ext_scan_param ⇒ ke_free +
    +
    [Calls]
    • >>   llm_activity_free_get +
    • >>   ke_free +
    +
    [Called By]
    • >>   gapm_scan_send_param_cmd +
    + +

    le_set_ext_scan_en (Thumb, 198 bytes, Stack size 16 bytes, llm_scan.o(.text)) +

    [Stack]

    • Max Depth = 212
    • Call Chain = le_set_ext_scan_en ⇒ lld_scan_start ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_timer_clear +
    • >>   lld_scan_params_update +
    • >>   lld_scan_stop +
    • >>   lld_scan_start +
    +
    [Called By]
    • >>   gapm_scan_send_en_cmd +
    + +

    llm_scan_period_to_handler (Thumb, 40 bytes, Stack size 8 bytes, llm_scan.o(.text)) +

    [Stack]

    • Max Depth = 204
    • Call Chain = llm_scan_period_to_handler ⇒ lld_scan_start ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_scan_start +
    +
    [Address Reference Count : 1]
    • llm_task.o(le_task_hdl_func) +
    +

    lld_adv_rep_ind_handler (Thumb, 560 bytes, Stack size 80 bytes, llm_scan.o(.text)) +

    [Stack]

    • Max Depth = 172
    • Call Chain = lld_adv_rep_ind_handler ⇒ le_ext_adv_report_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ble_buf_rx_free +
    • >>   bdaddr_is_same +
    • >>   le_ext_adv_report_evt +
    +
    [Address Reference Count : 1]
    • llm_task.o(le_task_hdl_func) +
    +

    lld_scan_end_ind_handler (Thumb, 104 bytes, Stack size 8 bytes, llm_scan.o(.text)) +

    [Stack]

    • Max Depth = 136
    • Call Chain = lld_scan_end_ind_handler ⇒ le_scan_timeout_evt ⇒ gapm_actv_stopped ⇒ gapm_send_complete_evt ⇒ gapm_operation_cleanup ⇒ gapm_update_state ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   ke_timer_set +
    • >>   le_scan_timeout_evt +
    • >>   le_actv_cmp_send +
    +
    [Address Reference Count : 1]
    • llm_task.o(le_task_hdl_func) +
    +

    le_ext_create_con (Thumb, 260 bytes, Stack size 56 bytes, llm_init.o(.text)) +

    [Stack]

    • Max Depth = 300
    • Call Chain = le_ext_create_con ⇒ lld_init_start ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_plan_req +
    • >>   llm_activity_free_get +
    • >>   popcnt8 +
    • >>   lld_init_start +
    +
    [Called By]
    • >>   gapm_init_send_en_cmd +
    + +

    le_create_con_cancel (Thumb, 58 bytes, Stack size 16 bytes, llm_init.o(.text)) +

    [Stack]

    • Max Depth = 108
    • Call Chain = le_create_con_cancel ⇒ lld_init_stop ⇒ lld_init_end ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_free +
    • >>   lld_init_stop +
    +
    [Called By]
    • >>   gapm_init_stop +
    + +

    lld_init_end_ind_handler (Thumb, 146 bytes, Stack size 24 bytes, llm_init.o(.text)) +

    [Stack]

    • Max Depth = 316
    • Call Chain = lld_init_end_ind_handler ⇒ llc_start ⇒ lld_con_start ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_plan_set +
    • >>   ke_free +
    • >>   llc_start +
    • >>   le_enh_con_cmp_evt +
    • >>   le_actv_cmp_send +
    +
    [Address Reference Count : 1]
    • llm_task.o(le_task_hdl_func) +
    +

    lld_con_rx_ind_handler (Thumb, 86 bytes, Stack size 16 bytes, llc_hci.o(.text)) +

    [Stack]

    • Max Depth = 404
    • Call Chain = lld_con_rx_ind_handler ⇒ lld_llcp_rx_ind ⇒ llc_ll_reject_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_disconnect +
    • >>   ble_buf_rx_free +
    • >>   ke_msg_forward +
    • >>   gapc_get_conidx +
    • >>   lld_llcp_rx_ind +
    +
    [Address Reference Count : 1]
    • llc_task.o(le_task_hdl_func) +
    +

    lld_con_tx_cfm_handler (Thumb, 58 bytes, Stack size 16 bytes, llc_hci.o(.text)) +

    [Stack]

    • Max Depth = 292
    • Call Chain = lld_con_tx_cfm_handler ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   list_pop_front +
    • >>   ke_free +
    • >>   le_nb_cmp_pkts_evt +
    • >>   llc_llcp_tx_check +
    +
    [Address Reference Count : 1]
    • llc_task.o(le_task_hdl_func) +
    +

    llc_rem_ch_map_proc_fsm (Thumb, 82 bytes, Stack size 32 bytes, llc_chmap_upd.o(.text)) +

    [Stack]

    • Max Depth = 156
    • Call Chain = llc_rem_ch_map_proc_fsm ⇒ llc_proc_unreg ⇒ llc_proc_timer_set ⇒ llc_llcp_trans_timer_set ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_con_ch_map_update +
    • >>   llc_proc_unreg +
    +
    [Called By]
    • >>   ll_channel_map_ind_handler +
    • >>   llc_ch_map_up_proc_err +
    • >>   lld_proc_upd_cfm_handler +
    + +

    llc_ch_map_up_proc_err (Thumb, 30 bytes, Stack size 0 bytes, llc_chmap_upd.o(.text)) +

    [Stack]

    • Max Depth = 156
    • Call Chain = llc_ch_map_up_proc_err ⇒ llc_rem_ch_map_proc_fsm ⇒ llc_proc_unreg ⇒ llc_proc_timer_set ⇒ llc_llcp_trans_timer_set ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_rem_ch_map_proc_fsm +
    +
    [Called By]
    • >>   llc_proc_err_ind +
    + +

    ll_channel_map_ind_handler (Thumb, 110 bytes, Stack size 24 bytes, llc_chmap_upd.o(.text)) +

    [Stack]

    • Max Depth = 180
    • Call Chain = ll_channel_map_ind_handler ⇒ llc_rem_ch_map_proc_fsm ⇒ llc_proc_unreg ⇒ llc_proc_timer_set ⇒ llc_llcp_trans_timer_set ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_proc_reg +
    • >>   ke_msg_alloc +
    • >>   llc_rem_ch_map_proc_fsm +
    +
    [Address Reference Count : 1]
    • llc_llcp.o(.constdata) +
    +

    le_rd_chnl_map (Thumb, 28 bytes, Stack size 0 bytes, llc_chmap_upd.o(.text), UNUSED) + +

    __aeabi_uidiv (Thumb, 0 bytes, Stack size 12 bytes, uidiv.o(.text), UNUSED) + +

    __aeabi_uidivmod (Thumb, 44 bytes, Stack size 12 bytes, uidiv.o(.text)) +

    [Stack]

    • Max Depth = 12
    • Call Chain = __aeabi_uidivmod +
    +
    [Called By]
    • >>   app_gapc_bond_req_ind_handler +
    • >>   sch_slice_compute +
    • >>   sch_plan_offset_req +
    • >>   sch_arb_elt_cancel +
    • >>   BLE_IRQHandler +
    • >>   sch_prog_push0 +
    • >>   sch_arb_insert +
    • >>   ble_buf_llcp_tx_free +
    • >>   lld_con_pkt_rx +
    • >>   lld_con_pkt_tx +
    • >>   lld_con_start +
    • >>   lld_con_evt_start_cbk +
    • >>   lld_con_tx_prog +
    • >>   lld_con_sched +
    • >>   lld_con_cleanup +
    • >>   lld_con_evt_time_update +
    • >>   lld_con_tx_len_update +
    • >>   lld_con_max_lat_calc +
    • >>   lld_core_init +
    • >>   lld_aa_gen +
    • >>   lld_rxdesc_free +
    • >>   sch_plan_req +
    • >>   lld_con_offset_get +
    • >>   lld_con_actv_offset_compute +
    • >>   lld_con_offset_ind_handler +
    • >>   llc_con_upd_info_send +
    • >>   llc_pref_param_compute +
    • >>   ke_malloc +
    • >>   ke_timer_set +
    • >>   __aeabi_idivmod +
    • >>   attc_rd_by_grp_type_rsp +
    • >>   lld_init_pkt_tx +
    • >>   lld_init_pkt_rx +
    • >>   lld_init_start +
    • >>   lld_init_evt_start_cbk +
    • >>   lld_scan_params_update +
    • >>   lld_scan_start +
    • >>   lld_adv_frm_cbk +
    • >>   lld_adv_evt_cancel_cbk +
    + +

    __aeabi_idiv (Thumb, 0 bytes, Stack size 16 bytes, idiv.o(.text), UNUSED) + +

    __aeabi_idivmod (Thumb, 40 bytes, Stack size 16 bytes, idiv.o(.text)) +

    [Stack]

    • Max Depth = 28
    • Call Chain = __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   sch_plan_offset_req +
    • >>   sch_arb_conflict_check +
    • >>   llc_pref_param_compute +
    + +

    __aeabi_uldivmod (Thumb, 96 bytes, Stack size 48 bytes, uldiv.o(.text), UNUSED) +

    [Calls]

    • >>   __aeabi_llsr +
    • >>   __aeabi_llsl +
    +
    [Called By]
    • >>   _printf_core +
    + +

    __scatterload (Thumb, 28 bytes, Stack size 0 bytes, init.o(.text)) +

    [Calls]

    • >>   __main_after_scatterload +
    +
    [Called By]
    • >>   _main_scatterload +
    + +

    __scatterload_rt2 (Thumb, 0 bytes, Stack size 0 bytes, init.o(.text), UNUSED) + +

    __aeabi_llsl (Thumb, 32 bytes, Stack size 8 bytes, llshl.o(.text), UNUSED) +

    [Called By]

    • >>   __aeabi_uldivmod +
    + +

    _ll_shift_l (Thumb, 0 bytes, Stack size 8 bytes, llshl.o(.text), UNUSED) + +

    __aeabi_llsr (Thumb, 34 bytes, Stack size 8 bytes, llushr.o(.text), UNUSED) +

    [Called By]

    • >>   __aeabi_uldivmod +
    + +

    _ll_ushift_r (Thumb, 0 bytes, Stack size 8 bytes, llushr.o(.text), UNUSED) + +

    UART1_IRQHandler (Thumb, 106 bytes, Stack size 20 bytes, uart1rb.o(i.UART1_IRQHandler)) +

    [Stack]

    • Max Depth = 20
    • Call Chain = UART1_IRQHandler +
    +
    [Address Reference Count : 1]
    • startup.o(RESET) +
    +

    __0printf$8 (Thumb, 24 bytes, Stack size 24 bytes, printf8.o(i.__0printf$8), UNUSED) +

    [Calls]

    • >>   _printf_core +
    + +

    __1printf$8 (Thumb, 0 bytes, Stack size 24 bytes, printf8.o(i.__0printf$8), UNUSED) + +

    __2printf (Thumb, 0 bytes, Stack size 24 bytes, printf8.o(i.__0printf$8)) +

    [Stack]

    • Max Depth = 24
    • Call Chain = __2printf +
    +
    [Called By]
    • >>   app_gapc_encrypt_req_ind_handler +
    • >>   app_gapc_connection_req_ind_handler +
    • >>   app_gapc_bond_req_ind_handler +
    • >>   app_gapc_bond_ind_handler +
    • >>   app_gapc_msg_handler +
    • >>   main +
    + +

    __ARM_common_switch8 (Thumb, 26 bytes, Stack size 8 bytes, app_actv.o(i.__ARM_common_switch8)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = __ARM_common_switch8 +
    +
    [Called By]
    • >>   diss_value_get +
    • >>   app_gapc_bond_req_ind_handler +
    • >>   app_gapc_bond_ind_handler +
    • >>   app_adv_action +
    • >>   gapm_actv_cmd_handler +
    • >>   lld_con_frm_cbk +
    • >>   llc_loc_phy_upd_proc_fsm +
    • >>   llc_rem_con_upd_proc_fsm +
    • >>   llc_loc_con_upd_proc_fsm +
    • >>   llc_loc_encrypt_proc_fsm +
    • >>   llc_rem_encrypt_proc_fsm +
    • >>   llc_proc_err_ind +
    • >>   gapc_smp_is_sec_mode_reached +
    • >>   gapc_smp_tkdp_rcp_continue +
    • >>   gapc_smp_send_pairing_ind +
    • >>   gapc_smp_send_pairing_req_ind +
    • >>   llc_proc_op_ind_handler +
    • >>   gapm_actv_adv_fsm +
    • >>   gatt_op_cmd_handler +
    + +

    __scatterload_copy (Thumb, 14 bytes, Stack size unknown bytes, handlers.o(i.__scatterload_copy), UNUSED) + +

    __scatterload_null (Thumb, 2 bytes, Stack size unknown bytes, handlers.o(i.__scatterload_null), UNUSED) + +

    __scatterload_zeroinit (Thumb, 14 bytes, Stack size unknown bytes, handlers.o(i.__scatterload_zeroinit), UNUSED) + +

    app_actv_cmp_evt (Thumb, 20 bytes, Stack size 8 bytes, app_actv.o(i.app_actv_cmp_evt)) +

    [Stack]

    • Max Depth = 204
    • Call Chain = app_actv_cmp_evt ⇒ app_adv_event ⇒ app_adv_action ⇒ app_adv_create ⇒ gapm_create_advertising ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   app_adv_event +
    +
    [Called By]
    • >>   app_gapm_msg_handler +
    + +

    app_actv_create (Thumb, 20 bytes, Stack size 8 bytes, app_actv.o(i.app_actv_create)) +

    [Stack]

    • Max Depth = 156
    • Call Chain = app_actv_create ⇒ app_adv_action ⇒ app_adv_create ⇒ gapm_create_advertising ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   app_adv_action +
    +
    [Called By]
    • >>   app_conf_fsm +
    + +

    app_actv_created_ind (Thumb, 10 bytes, Stack size 0 bytes, app_actv.o(i.app_actv_created_ind)) +

    [Called By]

    • >>   app_gapm_msg_handler +
    + +

    app_actv_stopped_ind (Thumb, 36 bytes, Stack size 8 bytes, app_actv.o(i.app_actv_stopped_ind)) +

    [Stack]

    • Max Depth = 204
    • Call Chain = app_actv_stopped_ind ⇒ app_adv_event ⇒ app_adv_action ⇒ app_adv_create ⇒ gapm_create_advertising ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   app_adv_event +
    • >>   app_state_set +
    +
    [Called By]
    • >>   app_gapm_msg_handler +
    + +

    app_adv_action (Thumb, 116 bytes, Stack size 24 bytes, app_actv.o(i.app_adv_action)) +

    [Stack]

    • Max Depth = 148
    • Call Chain = app_adv_action ⇒ app_adv_create ⇒ gapm_create_advertising ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapm_stop_activity +
    • >>   gapm_start_advertising +
    • >>   gapm_delete_activity +
    • >>   __ARM_common_switch8 +
    • >>   app_adv_create +
    +
    [Called By]
    • >>   app_adv_event +
    • >>   app_conn_fsm +
    • >>   app_actv_create +
    + +

    app_adv_event (Thumb, 136 bytes, Stack size 48 bytes, app_actv.o(i.app_adv_event)) +

    [Stack]

    • Max Depth = 196
    • Call Chain = app_adv_event ⇒ app_adv_action ⇒ app_adv_create ⇒ gapm_create_advertising ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapm_set_adv_data +
    • >>   app_state_set +
    • >>   app_name_get +
    • >>   app_adv_action +
    +
    [Called By]
    • >>   app_actv_stopped_ind +
    • >>   app_actv_cmp_evt +
    + +

    app_conf_fsm (Thumb, 44 bytes, Stack size 8 bytes, app.o(i.app_conf_fsm)) +

    [Stack]

    • Max Depth = 164
    • Call Chain = app_conf_fsm ⇒ app_actv_create ⇒ app_adv_action ⇒ app_adv_create ⇒ gapm_create_advertising ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   app_state_set +
    • >>   app_prf_create +
    • >>   gapm_set_dev +
    • >>   app_actv_create +
    +
    [Called By]
    • >>   app_gapm_msg_handler +
    + +

    app_conn_fsm (Thumb, 60 bytes, Stack size 8 bytes, app.o(i.app_conn_fsm)) +

    [Stack]

    • Max Depth = 156
    • Call Chain = app_conn_fsm ⇒ app_adv_action ⇒ app_adv_create ⇒ gapm_create_advertising ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   app_state_set +
    • >>   app_ltk_save +
    • >>   gapc_connect_rsp +
    • >>   app_adv_action +
    +
    [Called By]
    • >>   app_gapc_bond_ind_handler +
    • >>   app_gapc_msg_handler +
    + +

    app_custom_handler (Thumb, 4 bytes, Stack size 0 bytes, app_msg.o(i.app_custom_handler)) +
    [Address Reference Count : 1]

    • app_msg.o(le_task_hdl_func) +
    +

    app_gapc_msg_handler (Thumb, 350 bytes, Stack size 32 bytes, app_gapc.o(i.app_gapc_msg_handler)) +

    [Stack]

    • Max Depth = 476
    • Call Chain = app_gapc_msg_handler ⇒ gapc_param_update_rsp ⇒ le_rem_con_param_req_reply ⇒ llc_rem_con_upd_proc_fsm ⇒ llc_ll_con_param_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapc_param_update_rsp +
    • >>   app_gapc_encrypt_req_ind_handler +
    • >>   app_gapc_connection_req_ind_handler +
    • >>   app_gapc_bond_req_ind_handler +
    • >>   app_gapc_bond_ind_handler +
    • >>   app_conn_fsm +
    • >>   __2printf +
    +
    [Address Reference Count : 1]
    • app_msg.o(le_task_hdl_func) +
    +

    app_gapm_msg_handler (Thumb, 82 bytes, Stack size 8 bytes, app_gapm.o(i.app_gapm_msg_handler)) +

    [Stack]

    • Max Depth = 212
    • Call Chain = app_gapm_msg_handler ⇒ app_actv_stopped_ind ⇒ app_adv_event ⇒ app_adv_action ⇒ app_adv_create ⇒ gapm_create_advertising ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   app_actv_stopped_ind +
    • >>   app_actv_created_ind +
    • >>   app_actv_cmp_evt +
    • >>   app_conf_fsm +
    +
    [Address Reference Count : 1]
    • app_msg.o(le_task_hdl_func) +
    +

    app_init (Thumb, 48 bytes, Stack size 16 bytes, app.o(i.app_init)) +

    [Stack]

    • Max Depth = 220
    • Call Chain = app_init ⇒ ble_init ⇒ ble_drv_init ⇒ l2cm_init ⇒ l2cc_cleanup ⇒ l2cc_send_cmp_evt_status ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   rfmdm_init +
    • >>   ble_init +
    • >>   ble_heap +
    • >>   ble_app +
    +
    [Called By]
    • >>   main +
    + +

    app_ltk_find (Thumb, 4 bytes, Stack size 0 bytes, app.o(i.app_ltk_find)) +

    [Called By]

    • >>   app_gapc_encrypt_req_ind_handler +
    + +

    app_ltk_gen (Thumb, 2 bytes, Stack size 0 bytes, app.o(i.app_ltk_gen)) +

    [Called By]

    • >>   app_gapc_bond_req_ind_handler +
    + +

    app_ltk_save (Thumb, 2 bytes, Stack size 0 bytes, app.o(i.app_ltk_save)) +

    [Called By]

    • >>   app_conn_fsm +
    + +

    app_name_get (Thumb, 44 bytes, Stack size 16 bytes, app.o(i.app_name_get)) +

    [Stack]

    • Max Depth = 16
    • Call Chain = app_name_get +
    +
    [Called By]
    • >>   app_adv_event +
    • >>   gap_svc_get_dev_info +
    + +

    app_pairing_get (Thumb, 24 bytes, Stack size 0 bytes, app.o(i.app_pairing_get)) +

    [Called By]

    • >>   app_gapc_bond_req_ind_handler +
    + +

    app_prf_create (Thumb, 26 bytes, Stack size 8 bytes, app.o(i.app_prf_create)) +

    [Stack]

    • Max Depth = 144
    • Call Chain = app_prf_create ⇒ gap_svc_init ⇒ attmdb_svc_create ⇒ attmdb_svc_att_desc ⇒ attm_is_bt_uuid +
    +
    [Calls]
    • >>   sess_svc_init +
    • >>   gatt_svc_init +
    • >>   gap_svc_init +
    • >>   diss_svc_init +
    +
    [Called By]
    • >>   app_conf_fsm +
    + +

    app_state_set (Thumb, 6 bytes, Stack size 0 bytes, app.o(i.app_state_set)) +

    [Called By]

    • >>   app_adv_event +
    • >>   app_actv_stopped_ind +
    • >>   app_conn_fsm +
    • >>   app_conf_fsm +
    + +

    core_vector (Thumb, 34 bytes, Stack size 8 bytes, core.o(i.core_vector)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = core_vector +
    +
    [Address Reference Count : 1]
    • startup.o(.INT) +
    +

    diss_svc_init (Thumb, 64 bytes, Stack size 16 bytes, prf_diss.o(i.diss_svc_init)) +

    [Stack]

    • Max Depth = 112
    • Call Chain = diss_svc_init ⇒ attmdb_svc_create ⇒ attmdb_svc_att_desc ⇒ attm_is_bt_uuid +
    +
    [Calls]
    • >>   attmdb_svc_create +
    +
    [Called By]
    • >>   app_prf_create +
    + +

    diss_value_get (Thumb, 66 bytes, Stack size 8 bytes, prf_diss.o(i.diss_value_get)) +

    [Stack]

    • Max Depth = 16
    • Call Chain = diss_value_get ⇒ __ARM_common_switch8 +
    +
    [Calls]
    • >>   __ARM_common_switch8 +
    +
    [Called By]
    • >>   diss_svc_func +
    + +

    fputc (Thumb, 16 bytes, Stack size 8 bytes, debug.o(i.fputc)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = fputc +
    +
    [Calls]
    • >>   uart_putc +
    +
    [Address Reference Count : 1]
    • printf8.o(i.__0printf$8) +
    +

    gap_svc_get_dev_info (Thumb, 32 bytes, Stack size 8 bytes, app.o(i.gap_svc_get_dev_info)) +

    [Stack]

    • Max Depth = 24
    • Call Chain = gap_svc_get_dev_info ⇒ app_name_get +
    +
    [Calls]
    • >>   app_name_get +
    +
    [Called By]
    • >>   gap_svc_func +
    + +

    gapc_connect_rsp (Thumb, 34 bytes, Stack size 56 bytes, gap_api.o(i.gapc_connect_rsp)) +

    [Stack]

    • Max Depth = 140
    • Call Chain = gapc_connect_rsp ⇒ gapc_connection_cfg_send ⇒ atts_process_pdu ⇒ atts_clear_rsp_data ⇒ ke_free +
    +
    [Calls]
    • >>   gapc_connection_cfg_send +
    +
    [Called By]
    • >>   app_conn_fsm +
    + +

    gapc_disconnect (Thumb, 12 bytes, Stack size 8 bytes, gap_api.o(i.gapc_disconnect)) +

    [Stack]

    • Max Depth = 124
    • Call Chain = gapc_disconnect ⇒ gapc_disconnect_cmd_send ⇒ le_disconnect ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapc_disconnect_cmd_send +
    +
    [Called By]
    • >>   app_gapc_encrypt_req_ind_handler +
    • >>   app_gapc_bond_ind_handler +
    • >>   data_proc +
    + +

    gapm_create_advertising (Thumb, 46 bytes, Stack size 16 bytes, gap_api.o(i.gapm_create_advertising)) +

    [Stack]

    • Max Depth = 84
    • Call Chain = gapm_create_advertising ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   app_adv_create +
    + +

    gapm_delete_activity (Thumb, 38 bytes, Stack size 8 bytes, gap_api.o(i.gapm_delete_activity)) +

    [Stack]

    • Max Depth = 76
    • Call Chain = gapm_delete_activity ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   app_adv_action +
    + +

    gapm_reset (Thumb, 24 bytes, Stack size 8 bytes, gap_api.o(i.gapm_reset)) +

    [Stack]

    • Max Depth = 76
    • Call Chain = gapm_reset ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   ble_app +
    • >>   data_proc +
    + +

    gapm_set_adv_data (Thumb, 50 bytes, Stack size 40 bytes, gap_api.o(i.gapm_set_adv_data)) +

    [Stack]

    • Max Depth = 108
    • Call Chain = gapm_set_adv_data ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   app_adv_event +
    + +

    gapm_set_dev (Thumb, 100 bytes, Stack size 16 bytes, gap_api.o(i.gapm_set_dev)) +

    [Stack]

    • Max Depth = 84
    • Call Chain = gapm_set_dev ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   app_conf_fsm +
    + +

    gapm_start_activity (Thumb, 48 bytes, Stack size 24 bytes, gap_api.o(i.gapm_start_activity)) +

    [Stack]

    • Max Depth = 92
    • Call Chain = gapm_start_activity ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   gapm_start_advertising +
    + +

    gapm_start_advertising (Thumb, 18 bytes, Stack size 8 bytes, gap_api.o(i.gapm_start_advertising)) +

    [Stack]

    • Max Depth = 100
    • Call Chain = gapm_start_advertising ⇒ gapm_start_activity ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapm_start_activity +
    +
    [Called By]
    • >>   app_adv_action +
    + +

    gapm_stop_activity (Thumb, 30 bytes, Stack size 8 bytes, gap_api.o(i.gapm_stop_activity)) +

    [Stack]

    • Max Depth = 76
    • Call Chain = gapm_stop_activity ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   app_adv_action +
    + +

    gatt_info_cfm (Thumb, 38 bytes, Stack size 16 bytes, gatt_api.o(i.gatt_info_cfm)) +

    [Stack]

    • Max Depth = 84
    • Call Chain = gatt_info_cfm ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   sess_svc_func +
    + +

    gatt_ntf_send (Thumb, 62 bytes, Stack size 24 bytes, gatt_api.o(i.gatt_ntf_send)) +

    [Stack]

    • Max Depth = 92
    • Call Chain = gatt_ntf_send ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   sess_txd_send +
    + +

    gatt_read_cfm (Thumb, 60 bytes, Stack size 24 bytes, gatt_api.o(i.gatt_read_cfm)) +

    [Stack]

    • Max Depth = 92
    • Call Chain = gatt_read_cfm ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   sess_svc_func +
    • >>   diss_svc_func +
    + +

    gatt_write_cfm (Thumb, 34 bytes, Stack size 16 bytes, gatt_api.o(i.gatt_write_cfm)) +

    [Stack]

    • Max Depth = 84
    • Call Chain = gatt_write_cfm ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   sess_svc_func +
    + +

    main (Thumb, 78 bytes, Stack size 0 bytes, main.o(i.main)) +

    [Stack]

    • Max Depth = 220
    • Call Chain = main ⇒ app_init ⇒ ble_init ⇒ ble_drv_init ⇒ l2cm_init ⇒ l2cc_cleanup ⇒ l2cc_send_cmp_evt_status ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   user_procedure +
    • >>   uart1Rb_Init +
    • >>   rf_pa_set +
    • >>   rcc_ble_en +
    • >>   rcc_adc_en +
    • >>   ble_schedule +
    • >>   app_init +
    • >>   __2printf +
    +
    [Address Reference Count : 1]
    • entry9a.o(.ARM.Collect$$$$0000000B) +
    +

    rcc_adc_en (Thumb, 32 bytes, Stack size 0 bytes, rcc.o(i.rcc_adc_en)) +

    [Called By]

    • >>   main +
    + +

    rcc_ble_en (Thumb, 56 bytes, Stack size 0 bytes, rcc.o(i.rcc_ble_en)) +

    [Called By]

    • >>   main +
    + +

    rcc_sysclk_get (Thumb, 54 bytes, Stack size 0 bytes, rcc.o(i.rcc_sysclk_get)) +

    [Called By]

    • >>   rf_cbpf_cal +
    • >>   rf_dac_adjust +
    + +

    sess_cb_rxd (Thumb, 10 bytes, Stack size 8 bytes, proc.o(i.sess_cb_rxd)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = sess_cb_rxd +
    +
    [Calls]
    • >>   uart_send +
    +
    [Called By]
    • >>   sess_svc_func +
    + +

    sess_svc_init (Thumb, 24 bytes, Stack size 8 bytes, prf_sess.o(i.sess_svc_init)) +

    [Stack]

    • Max Depth = 104
    • Call Chain = sess_svc_init ⇒ attmdb_svc_create ⇒ attmdb_svc_att_desc ⇒ attm_is_bt_uuid +
    +
    [Calls]
    • >>   attmdb_svc_create +
    +
    [Called By]
    • >>   app_prf_create +
    + +

    sess_txd_send (Thumb, 60 bytes, Stack size 16 bytes, prf_sess.o(i.sess_txd_send)) +

    [Stack]

    • Max Depth = 108
    • Call Chain = sess_txd_send ⇒ gatt_ntf_send ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gatt_ntf_send +
    +
    [Called By]
    • >>   data_proc +
    • >>   user_procedure +
    + +

    trim_load (Thumb, 218 bytes, Stack size 48 bytes, trim.o(i.trim_load)) +

    [Stack]

    • Max Depth = 48
    • Call Chain = trim_load +
    +
    [Address Reference Count : 1]
    • startup.o(.INT) +
    +

    uart1Rb_Init (Thumb, 52 bytes, Stack size 8 bytes, uart1rb.o(i.uart1Rb_Init)) +

    [Stack]

    • Max Depth = 20
    • Call Chain = uart1Rb_Init ⇒ uart_init +
    +
    [Calls]
    • >>   uart_init +
    • >>   uart_fctl +
    • >>   uart_conf +
    +
    [Called By]
    • >>   main +
    + +

    uart1Rb_Read (Thumb, 66 bytes, Stack size 12 bytes, uart1rb.o(i.uart1Rb_Read)) +

    [Stack]

    • Max Depth = 12
    • Call Chain = uart1Rb_Read +
    +
    [Called By]
    • >>   data_proc +
    + +

    uart_conf (Thumb, 44 bytes, Stack size 8 bytes, uart.o(i.uart_conf)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = uart_conf +
    +
    [Called By]
    • >>   uart1Rb_Init +
    + +

    uart_fctl (Thumb, 36 bytes, Stack size 8 bytes, uart.o(i.uart_fctl)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = uart_fctl +
    +
    [Called By]
    • >>   uart1Rb_Init +
    + +

    uart_init (Thumb, 100 bytes, Stack size 12 bytes, uart.o(i.uart_init)) +

    [Stack]

    • Max Depth = 12
    • Call Chain = uart_init +
    +
    [Called By]
    • >>   uart1Rb_Init +
    + +

    uart_putc (Thumb, 16 bytes, Stack size 0 bytes, uart.o(i.uart_putc)) +

    [Called By]

    • >>   fputc +
    + +

    uart_send (Thumb, 44 bytes, Stack size 0 bytes, uart.o(i.uart_send)) +

    [Called By]

    • >>   sess_cb_rxd +
    + +

    user_procedure (Thumb, 36 bytes, Stack size 8 bytes, proc.o(i.user_procedure)) +

    [Stack]

    • Max Depth = 148
    • Call Chain = user_procedure ⇒ data_proc ⇒ gapc_disconnect ⇒ gapc_disconnect_cmd_send ⇒ le_disconnect ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sess_txd_send +
    • >>   data_proc +
    +
    [Called By]
    • >>   main +
    + +

    ble_buf_rx_alloc (Thumb, 44 bytes, Stack size 8 bytes, ble_buf.o(ke_list_api_func)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = ble_buf_rx_alloc +
    +
    [Calls]
    • >>   co_clz +
    +
    [Called By]
    • >>   lld_core_init +
    • >>   lld_rxdesc_free +
    + +

    ble_buf_rx_free (Thumb, 34 bytes, Stack size 8 bytes, ble_buf.o(ke_list_api_func)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = ble_buf_rx_free +
    +
    [Called By]
    • >>   gattc_cleanup +
    • >>   atts_process_pdu +
    • >>   l2cc_acl_data_handler +
    • >>   lld_llcp_rx_ind +
    • >>   lld_con_rx_ind_handler +
    • >>   lld_adv_rep_ind_handler +
    • >>   attc_pdu_recv_handler +
    • >>   l2cc_pdu_recv_ind_handler +
    + +

    ble_buf_acl_tx_alloc (Thumb, 52 bytes, Stack size 16 bytes, ble_buf.o(ke_list_api_func)) +

    [Stack]

    • Max Depth = 16
    • Call Chain = ble_buf_acl_tx_alloc +
    +
    [Calls]
    • >>   co_clz +
    +
    [Called By]
    • >>   l2cc_data_send +
    + +

    ble_buf_acl_tx_free (Thumb, 32 bytes, Stack size 8 bytes, ble_buf.o(ke_list_api_func)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = ble_buf_acl_tx_free +
    +
    [Called By]
    • >>   lld_con_pkt_tx +
    • >>   lld_con_cleanup +
    • >>   l2cc_data_send +
    + +

    ble_buf_llcp_tx_alloc (Thumb, 56 bytes, Stack size 16 bytes, ble_buf.o(ke_list_api_func)) +

    [Stack]

    • Max Depth = 16
    • Call Chain = ble_buf_llcp_tx_alloc +
    +
    [Calls]
    • >>   co_clz +
    +
    [Called By]
    • >>   llc_llcp_tx_check +
    + +

    ble_buf_llcp_tx_free (Thumb, 38 bytes, Stack size 8 bytes, ble_buf.o(ke_list_api_func)) +

    [Stack]

    • Max Depth = 20
    • Call Chain = ble_buf_llcp_tx_free ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   lld_con_pkt_tx +
    • >>   lld_con_cleanup +
    • >>   llc_llcp_tx_check +
    + +

    ble_buf_adv_tx_alloc (Thumb, 48 bytes, Stack size 8 bytes, ble_buf.o(ke_list_api_func)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = ble_buf_adv_tx_alloc +
    +
    [Calls]
    • >>   co_clz +
    +
    [Called By]
    • >>   le_set_ext_adv_data +
    + +

    ble_buf_adv_tx_elt_get (Thumb, 10 bytes, Stack size 0 bytes, ble_buf.o(ke_list_api_func)) +

    [Called By]

    • >>   le_set_ext_adv_data +
    • >>   lld_adv_data_set +
    + +

    ble_buf_adv_tx_free (Thumb, 30 bytes, Stack size 0 bytes, ble_buf.o(ke_list_api_func)) +

    [Called By]

    • >>   llm_adv_set_release +
    • >>   le_set_ext_adv_data +
    • >>   lld_adv_data_set +
    + +

    list_size (Thumb, 20 bytes, Stack size 0 bytes, list.o(ke_list_api_func)) +

    [Called By]

    • >>   atts_read_mult_req +
    • >>   atts_read_by_grp_type_req +
    • >>   atts_read_by_type_req +
    • >>   atts_find_by_type_req +
    + +

    list_push_back (Thumb, 22 bytes, Stack size 0 bytes, list.o(ke_list_api_func)) +

    [Called By]

    • >>   list_insert_after +
    • >>   sch_arb_evt_isr +
    • >>   sch_plan_set +
    • >>   llc_llcp_send +
    • >>   atts_pdu_recv_handler +
    • >>   atts_store_prep_data +
    • >>   atts_read_mult_req +
    • >>   atts_read_by_grp_type_req +
    • >>   atts_read_by_type_req +
    • >>   atts_find_by_type_req +
    • >>   atts_find_info_req +
    • >>   lld_con_data_tx +
    • >>   aes_start +
    • >>   ke_task_schedule +
    • >>   ke_state_set +
    • >>   ke_msg_send +
    • >>   attc_rd_rsp +
    • >>   attc_rd_by_type_rsp +
    • >>   l2cc_pdu_send_cmd_handler +
    + +

    list_push_back_sublist (Thumb, 22 bytes, Stack size 0 bytes, list.o(ke_list_api_func)) +

    [Called By]

    • >>   sch_arb_insert +
    + +

    list_push_front (Thumb, 14 bytes, Stack size 0 bytes, list.o(ke_list_api_func)) +

    [Called By]

    • >>   sch_arb_insert +
    • >>   list_insert_before +
    • >>   atts_prepare_write_req +
    • >>   sch_alarm_set +
    • >>   llc_llcp_tx_check +
    + +

    list_pop_front (Thumb, 20 bytes, Stack size 0 bytes, list.o(ke_list_api_func)) +

    [Called By]

    • >>   sch_arb_sw_isr +
    • >>   sch_arb_evt_isr +
    • >>   sch_alarm_timer_isr +
    • >>   sch_arb_remove +
    • >>   lld_con_pkt_tx +
    • >>   lld_con_cleanup +
    • >>   atts_execute_write_req +
    • >>   atts_prepare_write_req +
    • >>   l2cc_data_send +
    • >>   atts_clear_rsp_data +
    • >>   atts_clear_prep_data +
    • >>   gatt_operation_cleanup +
    • >>   l2cc_cleanup +
    • >>   gattc_cleanup +
    • >>   ke_timer_schedule +
    • >>   ke_task_schedule +
    • >>   ke_flush +
    • >>   aes_result_handler +
    • >>   aes_init +
    • >>   ke_timer_clear +
    • >>   atts_process_pdu +
    • >>   attc_rd_rsp +
    • >>   sch_alarm_clear +
    • >>   lld_con_tx_cfm_handler +
    • >>   gatt_op_cfm_handler +
    + +

    list_extract (Thumb, 54 bytes, Stack size 8 bytes, list.o(ke_list_api_func)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = list_extract +
    +
    [Called By]
    • >>   sch_arb_remove +
    • >>   sch_plan_rem +
    • >>   sch_alarm_clear +
    • >>   llc_llcp_tx_check +
    + +

    list_extract_after (Thumb, 26 bytes, Stack size 0 bytes, list.o(ke_list_api_func)) +

    [Called By]

    • >>   sch_arb_elt_cancel +
    + +

    list_extract_sublist (Thumb, 22 bytes, Stack size 0 bytes, list.o(ke_list_api_func)) +

    [Called By]

    • >>   sch_arb_insert +
    + +

    list_extract_given (Thumb, 62 bytes, Stack size 32 bytes, list.o(ke_list_api_func)) +

    [Stack]

    • Max Depth = 32
    • Call Chain = list_extract_given +
    +
    [Called By]
    • >>   ke_timer_clear +
    • >>   ke_timer_set +
    • >>   ke_state_set +
    + +

    list_insert_before (Thumb, 42 bytes, Stack size 4 bytes, list.o(ke_list_api_func)) +

    [Stack]

    • Max Depth = 4
    • Call Chain = list_insert_before +
    +
    [Calls]
    • >>   list_push_front +
    +
    [Called By]
    • >>   atts_store_prep_data +
    + +

    list_insert_after (Thumb, 46 bytes, Stack size 0 bytes, list.o(ke_list_api_func)) +

    [Calls]

    • >>   list_push_back +
    +
    [Called By]
    • >>   sch_arb_elt_cancel +
    • >>   sch_arb_insert +
    • >>   sch_alarm_set +
    + +

    list_insert_given (Thumb, 48 bytes, Stack size 32 bytes, list.o(ke_list_api_func)) +

    [Stack]

    • Max Depth = 32
    • Call Chain = list_insert_given +
    +
    [Called By]
    • >>   ke_timer_set +
    + +

    popcnt8 (Thumb, 30 bytes, Stack size 0 bytes, utils.o(ke_util_api_func)) +

    [Called By]

    • >>   le_ext_create_con +
    • >>   lld_adv_start +
    + +

    co_ctz (Thumb, 48 bytes, Stack size 0 bytes, utils.o(ke_util_api_func), UNUSED) + +

    co_clz (Thumb, 46 bytes, Stack size 0 bytes, utils.o(ke_util_api_func)) +

    [Called By]

    • >>   ble_schedule +
    • >>   sch_slice_compute +
    • >>   ble_buf_adv_tx_alloc +
    • >>   ble_buf_llcp_tx_alloc +
    • >>   ble_buf_rx_alloc +
    • >>   ble_buf_acl_tx_alloc +
    + +

    bdaddr_is_null (Thumb, 22 bytes, Stack size 0 bytes, utils.o(ke_util_api_func), UNUSED) + +

    bdaddr_is_same (Thumb, 26 bytes, Stack size 8 bytes, utils.o(ke_util_api_func)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = bdaddr_is_same +
    +
    [Called By]
    • >>   llm_is_dev_connected +
    • >>   lld_scan_pkt_rx +
    • >>   lld_adv_rep_ind_handler +
    + +

    rand (Thumb, 18 bytes, Stack size 0 bytes, utils.o(ke_util_api_func)) +

    [Called By]

    • >>   app_gapc_bond_req_ind_handler +
    • >>   lld_env_init +
    • >>   lld_aa_gen +
    • >>   aes_rand +
    • >>   gapc_link_upd_cmd_handler +
    • >>   lld_init_start +
    • >>   lld_adv_frm_cbk +
    • >>   lld_adv_evt_cancel_cbk +
    + +

    srand (Thumb, 6 bytes, Stack size 0 bytes, utils.o(ke_util_api_func), UNUSED) + +

    ke_malloc (Thumb, 180 bytes, Stack size 32 bytes, ke_mem.o(ke_util_api_func)) +

    [Stack]

    • Max Depth = 44
    • Call Chain = ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   plf_reset +
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   attmdb_svc_create +
    • >>   lld_con_start +
    • >>   llc_llcp_send +
    • >>   atts_read_mult_req +
    • >>   atts_read_by_grp_type_req +
    • >>   atts_read_by_type_req +
    • >>   atts_find_by_type_req +
    • >>   atts_find_info_req +
    • >>   l2cc_create +
    • >>   gattc_create +
    • >>   gapc_con_create +
    • >>   aes_alloc +
    • >>   gapc_smp_pairing_start +
    • >>   ke_timer_set +
    • >>   gapc_smp_cmd_handler +
    • >>   ke_msg_alloc +
    • >>   gapm_init_send_en_cmd +
    • >>   gapm_scan_send_param_cmd +
    • >>   gapm_adv_send_param_cmd +
    • >>   lld_init_start +
    • >>   lld_scan_start +
    • >>   lld_adv_start +
    • >>   llc_start +
    • >>   gapm_actv_alloc +
    + +

    ke_free (Thumb, 182 bytes, Stack size 20 bytes, ke_mem.o(ke_util_api_func)) +

    [Stack]

    • Max Depth = 20
    • Call Chain = ke_free +
    +
    [Called By]
    • >>   lld_con_cleanup +
    • >>   lld_scan_init +
    • >>   lld_init_init +
    • >>   lld_con_init +
    • >>   lld_adv_init +
    • >>   llc_proc_unreg +
    • >>   llc_cleanup +
    • >>   atts_execute_write_req +
    • >>   atts_find_info_req +
    • >>   l2cc_data_send +
    • >>   atts_clear_rsp_data +
    • >>   atts_clear_read_cache +
    • >>   atts_clear_prep_data +
    • >>   gatt_operation_cleanup +
    • >>   gapc_operation_cleanup +
    • >>   l2cc_cleanup +
    • >>   gattc_cleanup +
    • >>   gapc_cleanup +
    • >>   gapm_operation_cleanup +
    • >>   ke_timer_schedule +
    • >>   ke_task_schedule +
    • >>   llm_init +
    • >>   ke_flush +
    • >>   aes_result_handler +
    • >>   aes_init +
    • >>   attmdb_destroy +
    • >>   ke_timer_clear +
    • >>   gapc_smp_cleanup +
    • >>   gapc_smp_pairing_end +
    • >>   atts_process_pdu +
    • >>   llm_adv_set_release +
    • >>   attc_send_read_ind +
    • >>   le_create_con_cancel +
    • >>   gapm_init_send_en_cmd +
    • >>   le_set_ext_scan_param +
    • >>   gapm_scan_send_param_cmd +
    • >>   le_set_ext_adv_param +
    • >>   gapm_adv_send_param_cmd +
    • >>   lld_init_end +
    • >>   lld_scan_end +
    • >>   lld_adv_end +
    • >>   lld_con_tx_cfm_handler +
    • >>   lld_init_end_ind_handler +
    • >>   gapm_actv_free +
    • >>   gatt_op_cfm_handler +
    + +

    ke_msg_alloc (Thumb, 50 bytes, Stack size 24 bytes, ke_msg.o(ke_util_api_func)) +

    [Stack]

    • Max Depth = 68
    • Call Chain = ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_malloc +
    +
    [Called By]
    • >>   gatt_read_cfm +
    • >>   gapm_stop_activity +
    • >>   gapm_set_adv_data +
    • >>   gapm_delete_activity +
    • >>   gapm_create_advertising +
    • >>   gapm_set_dev +
    • >>   gapm_reset +
    • >>   gapm_init_conn_to_handler +
    • >>   lld_con_pkt_rx +
    • >>   le_phy_upd_cmp_evt +
    • >>   ll_phy_req_handler +
    • >>   llc_rem_phy_upd_proc_fsm +
    • >>   le_rem_con_param_req_evt +
    • >>   le_con_update_cmp_evt +
    • >>   le_con_estab_evt +
    • >>   llc_con_move_cbk +
    • >>   ll_con_param_req_handler +
    • >>   ll_con_update_ind_handler +
    • >>   llc_rem_con_upd_proc_fsm +
    • >>   le_data_len_chg_evt +
    • >>   le_rd_rem_feats_cmp_evt +
    • >>   ll_enc_req_handler +
    • >>   ll_pause_enc_req_handler +
    • >>   le_rd_rem_ver_info_cmp_evt +
    • >>   le_disc_cmp_evt +
    • >>   llc_init_term_proc +
    • >>   l2cc_sig_send_cmd_reject +
    • >>   l2c_code_con_param_upd_req_handler +
    • >>   l2cc_ind_pdu_alloc +
    • >>   l2cc_att_pdu_alloc +
    • >>   gatt_set_mtu +
    • >>   gattc_send_cmp_evt +
    • >>   gapc_con_create +
    • >>   gapm_send_cmp_evt +
    • >>   ke_msg_send_basic +
    • >>   gattc_svc_chg_ind_send +
    • >>   gatt_svc_func +
    • >>   gap_svc_func +
    • >>   le_start_enc +
    • >>   l2cc_smp_pdu_alloc +
    • >>   le_ltk_req_evt +
    • >>   gapc_smp_recv_sec_req +
    • >>   gapc_smp_recv_pair_req +
    • >>   gapc_smp_handle_enc_change_evt +
    • >>   gapc_smp_check_repeated_attempts +
    • >>   gapc_smp_send_pairing_ind +
    • >>   gapc_smp_send_pairing_req_ind +
    • >>   le_set_phy +
    • >>   le_rd_rem_ver_info +
    • >>   le_rd_rem_feats +
    • >>   le_disconnect +
    • >>   le_con_param_upd +
    • >>   l2cc_sig_send_param_upd_req +
    • >>   l2cc_sig_send_param_resp +
    • >>   gapc_smp_cmd_handler +
    • >>   gapc_send_cmp_evt +
    • >>   gapc_link_upd_cmd_handler +
    • >>   gapc_get_info_cmd_handler +
    • >>   le_set_data_len +
    • >>   gapm_start_activity +
    • >>   gatt_write_cfm +
    • >>   gatt_ntf_send +
    • >>   gatt_info_cfm +
    • >>   attc_send_read_ind +
    • >>   attc_hdl_val_ntf_ind +
    • >>   attc_rd_mult_rsp +
    • >>   attc_rd_by_grp_type_rsp +
    • >>   attc_rd_by_type_rsp +
    • >>   attc_find_by_type_rsp +
    • >>   attc_find_info_rsp +
    • >>   le_ext_adv_report_evt +
    • >>   gapm_smp_gen_rand_nb_cb +
    • >>   gapm_smp_gen_rand_addr_cb +
    • >>   gapm_smp_use_enc_block_cb +
    • >>   lld_init_pkt_tx +
    • >>   lld_init_end +
    • >>   lld_scan_pkt_rx +
    • >>   lld_scan_end +
    • >>   le_scan_req_rcvd_evt +
    • >>   lld_adv_pkt_rx +
    • >>   lld_adv_end +
    • >>   ll_channel_map_ind_handler +
    • >>   le_actv_cmp_send +
    • >>   gapm_actv_stopped +
    • >>   gapm_actv_created +
    + +

    ke_msg_send (Thumb, 34 bytes, Stack size 8 bytes, ke_msg.o(ke_util_api_func)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = ke_msg_send +
    +
    [Calls]
    • >>   list_push_back +
    +
    [Called By]
    • >>   gatt_read_cfm +
    • >>   gapm_stop_activity +
    • >>   gapm_set_adv_data +
    • >>   gapm_delete_activity +
    • >>   gapm_create_advertising +
    • >>   gapm_set_dev +
    • >>   gapm_reset +
    • >>   gapm_init_conn_to_handler +
    • >>   lld_con_pkt_rx +
    • >>   le_phy_upd_cmp_evt +
    • >>   llc_rem_phy_upd_proc_fsm +
    • >>   le_rem_con_param_req_evt +
    • >>   le_con_update_cmp_evt +
    • >>   le_con_estab_evt +
    • >>   llc_con_move_cbk +
    • >>   llc_rem_con_upd_proc_fsm +
    • >>   le_data_len_chg_evt +
    • >>   le_rd_rem_feats_cmp_evt +
    • >>   le_rd_rem_ver_info_cmp_evt +
    • >>   le_disc_cmp_evt +
    • >>   llc_init_term_proc +
    • >>   atts_write_rsp_send +
    • >>   atts_send_error +
    • >>   atts_send_event +
    • >>   atts_execute_write_req +
    • >>   atts_prepare_write_req +
    • >>   atts_read_mult_req +
    • >>   atts_read_blob_req +
    • >>   atts_read_req +
    • >>   atts_read_by_grp_type_req +
    • >>   atts_read_by_type_req +
    • >>   atts_find_by_type_req +
    • >>   atts_find_info_req +
    • >>   atts_mtu_exc_req +
    • >>   l2cc_sig_send_cmd_reject +
    • >>   l2c_code_con_param_upd_req_handler +
    • >>   gatt_set_mtu +
    • >>   gattc_send_cmp_evt +
    • >>   gapc_con_create +
    • >>   gapm_send_cmp_evt +
    • >>   ke_msg_forward +
    • >>   ke_msg_send_basic +
    • >>   gattc_svc_chg_ind_send +
    • >>   gatt_svc_func +
    • >>   gap_svc_func +
    • >>   le_start_enc +
    • >>   le_ltk_req_evt +
    • >>   gapc_smp_recv_sec_req +
    • >>   gapc_smp_recv_pair_req +
    • >>   gapc_smp_handle_enc_change_evt +
    • >>   gapc_smp_pdu_send +
    • >>   gapc_smp_check_repeated_attempts +
    • >>   gapc_smp_send_pairing_ind +
    • >>   gapc_smp_send_pairing_req_ind +
    • >>   le_set_phy +
    • >>   le_rd_rem_ver_info +
    • >>   le_rd_rem_feats +
    • >>   le_disconnect +
    • >>   le_con_param_upd +
    • >>   l2cc_sig_send_param_upd_req +
    • >>   l2cc_sig_send_param_resp +
    • >>   gapc_smp_cmd_handler +
    • >>   gapc_send_cmp_evt +
    • >>   gapc_link_upd_cmd_handler +
    • >>   gapc_get_info_cmd_handler +
    • >>   gapc_con_param_upd_send +
    • >>   le_set_data_len +
    • >>   gapm_start_activity +
    • >>   gatt_write_cfm +
    • >>   gatt_ntf_send +
    • >>   gatt_info_cfm +
    • >>   attc_send_read_ind +
    • >>   attc_hdl_val_ntf_ind +
    • >>   attc_prep_wr_rsp +
    • >>   attc_rd_mult_rsp +
    • >>   attc_rd_rsp +
    • >>   attc_rd_by_grp_type_rsp +
    • >>   attc_rd_by_type_rsp +
    • >>   attc_find_by_type_rsp +
    • >>   attc_find_info_rsp +
    • >>   le_ext_adv_report_evt +
    • >>   gapm_smp_gen_rand_nb_cb +
    • >>   gapm_smp_gen_rand_addr_cb +
    • >>   gapm_smp_use_enc_block_cb +
    • >>   l2cc_acl_data_handler +
    • >>   lld_init_end +
    • >>   lld_scan_pkt_rx +
    • >>   lld_scan_end +
    • >>   le_scan_req_rcvd_evt +
    • >>   lld_adv_pkt_rx +
    • >>   lld_adv_end +
    • >>   l2cc_pdu_header_check +
    • >>   l2cc_pdu_rx_init +
    • >>   le_actv_cmp_send +
    • >>   gapm_actv_stopped +
    • >>   gapm_actv_created +
    • >>   attc_send_hdl_cfm +
    • >>   attc_send_att_req +
    • >>   gatt_op_cmd_handler +
    + +

    ke_msg_send_basic (Thumb, 14 bytes, Stack size 8 bytes, ke_msg.o(ke_util_api_func)) +

    [Stack]

    • Max Depth = 76
    • Call Chain = ke_msg_send_basic ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   lld_con_pkt_tx +
    • >>   lld_instant_proc_end +
    • >>   lld_con_cleanup +
    • >>   ke_timer_schedule +
    • >>   attc_err_rsp +
    • >>   gatt_timeout_handler +
    + +

    ke_msg_forward (Thumb, 10 bytes, Stack size 0 bytes, ke_msg.o(ke_util_api_func)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = ke_msg_forward ⇒ ke_msg_send +
    +
    [Calls]
    • >>   ke_msg_send +
    +
    [Called By]
    • >>   lld_con_rx_ind_handler +
    + +

    ke_state_set (Thumb, 86 bytes, Stack size 24 bytes, ke_task.o(ke_util_api_func)) +

    [Stack]

    • Max Depth = 56
    • Call Chain = ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   list_extract_given +
    • >>   list_push_back +
    +
    [Called By]
    • >>   llc_proc_unreg +
    • >>   llc_proc_reg +
    • >>   lld_disc_ind_handler +
    • >>   llc_cleanup +
    • >>   gattc_send_complete_evt +
    • >>   l2cc_create +
    • >>   l2cc_cleanup +
    • >>   gattc_create +
    • >>   gattc_cleanup +
    • >>   gapc_con_create +
    • >>   gapc_cleanup +
    • >>   gapm_update_state +
    • >>   gapm_init +
    • >>   gapc_update_state +
    • >>   gapc_disconnect_cmd_send +
    • >>   gapc_connection_cfg_send +
    • >>   llc_start +
    • >>   gattc_process_op_simple +
    + +

    ke_state_get (Thumb, 32 bytes, Stack size 8 bytes, ke_task.o(ke_util_api_func)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = ke_state_get +
    +
    [Called By]
    • >>   gapc_param_update_rsp +
    • >>   le_phy_upd_cmp_evt +
    • >>   le_rem_con_param_req_evt +
    • >>   le_con_update_cmp_evt +
    • >>   le_con_estab_evt +
    • >>   le_data_len_chg_evt +
    • >>   le_rd_rem_feats_cmp_evt +
    • >>   le_rd_rem_ver_info_cmp_evt +
    • >>   llc_proc_unreg +
    • >>   llc_proc_reg +
    • >>   le_disc_cmp_evt +
    • >>   atts_pdu_recv_handler +
    • >>   l2cc_send_cmp_evt_status +
    • >>   gattc_send_complete_evt +
    • >>   gattc_create +
    • >>   gapc_con_create +
    • >>   gapc_cleanup +
    • >>   gapm_process_op_simple +
    • >>   gapm_update_state +
    • >>   gatt_svc_func +
    • >>   gap_svc_func +
    • >>   gapc_smp_gapm_cmp_evt +
    • >>   gapc_update_state +
    • >>   gapc_smp_timer_ind_handler +
    • >>   gapc_process_op_simple +
    • >>   gapc_param_upd_to_handler +
    • >>   l2cc_pdu_recv_ind_handler +
    • >>   gapc_disconnect_cmd_send +
    • >>   gapc_connection_cfg_send +
    • >>   gapm_smp_gen_rand_nb_cb +
    • >>   gapm_smp_gen_rand_addr_cb +
    • >>   gapm_smp_use_enc_block_cb +
    • >>   l2cc_pdu_recv_ind_handler +
    • >>   l2cc_acl_data_handler +
    • >>   l2cc_pdu_send_cmd_handler +
    • >>   gattc_process_op_simple +
    • >>   l2cc_pdu_recv_ind_handler +
    • >>   gatt_timeout_handler +
    • >>   gatt_op_cfm_handler +
    • >>   gatt_event_cfm_handler +
    + +

    ke_timer_set (Thumb, 166 bytes, Stack size 40 bytes, ke_timer.o(ke_util_api_func)) +

    [Stack]

    • Max Depth = 84
    • Call Chain = ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   slot_time_get +
    • >>   list_insert_given +
    • >>   ke_event_set +
    • >>   ke_time_past +
    • >>   list_extract_given +
    • >>   ble_timer_1ms_set +
    • >>   ke_malloc +
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   atts_send_event +
    • >>   gapc_key_press_notify +
    • >>   gapc_smp_pdu_send +
    • >>   gapc_smp_launch_rep_att_timer +
    • >>   gapc_link_upd_cmd_handler +
    • >>   gapm_init_start +
    • >>   llc_llcp_trans_timer_set +
    • >>   lld_scan_end_ind_handler +
    • >>   attc_send_att_req +
    + +

    ke_timer_clear (Thumb, 100 bytes, Stack size 16 bytes, ke_timer.o(ke_util_api_func)) +

    [Stack]

    • Max Depth = 48
    • Call Chain = ke_timer_clear ⇒ ke_time_past +
    +
    [Calls]
    • >>   ke_event_set +
    • >>   ke_time_past +
    • >>   list_extract_given +
    • >>   list_pop_front +
    • >>   ble_timer_1ms_set +
    • >>   ke_free +
    +
    [Called By]
    • >>   atts_pdu_recv_handler +
    • >>   l2c_code_con_param_upd_rsp_handler +
    • >>   gattc_cleanup +
    • >>   gapc_cleanup +
    • >>   llm_init +
    • >>   gapc_smp_clear_timeout_timer +
    • >>   gapc_smp_pdu_send +
    • >>   gapc_smp_launch_rep_att_timer +
    • >>   gapm_init_stop +
    • >>   le_set_ext_scan_en +
    • >>   llc_llcp_trans_timer_set +
    • >>   gapm_init_connection_ind +
    • >>   gapm_actv_init_fsm +
    • >>   attc_pdu_recv_handler +
    + +

    ke_event_set (Thumb, 26 bytes, Stack size 8 bytes, ke_event.o(ke_util_api_func)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = ke_event_set +
    +
    [Called By]
    • >>   l2cm_tx_status +
    • >>   ke_timer_clear +
    • >>   ke_timer_set +
    • >>   le_nb_cmp_pkts_evt +
    • >>   l2cm_pdu_tx_handler +
    + +

    ke_event_clear (Thumb, 26 bytes, Stack size 8 bytes, ke_event.o(ke_util_api_func)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = ke_event_clear +
    +
    [Called By]
    • >>   ke_timer_schedule +
    • >>   l2cm_init +
    • >>   aes_crypt_evt_handler +
    • >>   l2cm_pdu_tx_handler +
    + +

    lld_exp_sync_pos (Thumb, 26 bytes, Stack size 0 bytes, lld.o(ke_util_api_func)) +

    [Called By]

    • >>   lld_con_pkt_rx +
    • >>   lld_init_pkt_rx +
    • >>   lld_adv_pkt_rx +
    + +

    le_pkt_dur_in_us (Thumb, 16 bytes, Stack size 0 bytes, lld.o(ke_util_api_func)) +

    [Called By]

    • >>   lld_init_pkt_rx +
    + +

    ble_timer_hs_set (Thumb, 34 bytes, Stack size 0 bytes, ble_drv.o(le_drv_api_func)) +

    [Called By]

    • >>   sch_alarm_prog +
    + +

    ble_timer_hus_set (Thumb, 44 bytes, Stack size 8 bytes, ble_drv.o(le_drv_api_func)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = ble_timer_hus_set +
    +
    [Called By]
    • >>   sch_arb_prog_timer +
    + +

    ble_timer_1ms_set (Thumb, 54 bytes, Stack size 12 bytes, ble_drv.o(le_drv_api_func)) +

    [Stack]

    • Max Depth = 12
    • Call Chain = ble_timer_1ms_set +
    +
    [Called By]
    • >>   ke_timer_schedule +
    • >>   ke_timer_clear +
    • >>   ke_timer_set +
    + +

    ble_timer_winsize (Thumb, 178 bytes, Stack size 20 bytes, ble_drv.o(le_drv_api_func), UNUSED) + +

    ble_aes_encrypt (Thumb, 124 bytes, Stack size 32 bytes, ble_drv.o(le_drv_api_func)) +

    [Stack]

    • Max Depth = 32
    • Call Chain = ble_aes_encrypt +
    +
    [Called By]
    • >>   aes_start +
    • >>   aes_result_handler +
    + +

    slot_clock_get (Thumb, 22 bytes, Stack size 0 bytes, ble_irq.o(le_drv_api_func)) +

    [Called By]

    • >>   lld_scan_restart +
    • >>   sch_plan_offset_req +
    • >>   sch_alarm_timer_isr +
    • >>   lld_con_frm_cbk +
    • >>   lld_con_start +
    • >>   lld_con_slave_latency +
    • >>   lld_con_evt_cancel_cbk +
    • >>   lld_init_frm_cbk +
    • >>   lld_init_start +
    • >>   lld_init_evt_cancel_cbk +
    • >>   lld_init_sched +
    • >>   lld_scan_frm_cbk +
    • >>   lld_scan_params_update +
    • >>   lld_scan_start +
    • >>   lld_scan_evt_cancel_cbk +
    • >>   lld_scan_sched +
    • >>   lld_adv_start +
    + +

    slot_time_get (Thumb, 32 bytes, Stack size 0 bytes, ble_irq.o(le_drv_api_func)) +

    [Called By]

    • >>   sch_arb_prog_timer +
    • >>   sch_arb_evt_isr +
    • >>   sch_arb_insert +
    • >>   ke_time_past +
    • >>   ke_timer_schedule +
    • >>   ke_timer_set +
    • >>   sch_alarm_set +
    • >>   sch_alarm_prog +
    + +

    ble_schedule (Thumb, 46 bytes, Stack size 16 bytes, ble_api.o(le_evt_hdl_func)) +

    [Stack]

    • Max Depth = 16
    • Call Chain = ble_schedule +
    +
    [Calls]
    • >>   co_clz +
    +
    [Called By]
    • >>   main +
    + +

    aes_crypt_evt_handler (Thumb, 28 bytes, Stack size 24 bytes, ble_drv.o(le_evt_hdl_func)) +

    [Stack]

    • Max Depth = 72
    • Call Chain = aes_crypt_evt_handler ⇒ aes_result_handler ⇒ ble_aes_encrypt +
    +
    [Calls]
    • >>   ke_event_clear +
    • >>   aes_result_handler +
    +
    [Address Reference Count : 1]
    • ble_drv.o(ri_one_cal_func) +
    +

    ke_task_schedule (Thumb, 140 bytes, Stack size 16 bytes, ke_task.o(le_evt_hdl_func)) +

    [Stack]

    • Max Depth = 36
    • Call Chain = ke_task_schedule ⇒ ke_free +
    +
    [Calls]
    • >>   list_push_back +
    • >>   list_pop_front +
    • >>   ke_free +
    +
    [Address Reference Count : 1]
    • ke.o(ri_one_cal_func) +
    +

    ke_timer_schedule (Thumb, 116 bytes, Stack size 32 bytes, ke_timer.o(le_evt_hdl_func)) +

    [Stack]

    • Max Depth = 108
    • Call Chain = ke_timer_schedule ⇒ ke_msg_send_basic ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   slot_time_get +
    • >>   ke_time_past +
    • >>   ke_msg_send_basic +
    • >>   list_pop_front +
    • >>   ke_event_clear +
    • >>   ble_timer_1ms_set +
    • >>   ke_free +
    +
    [Address Reference Count : 1]
    • ke.o(ri_one_cal_func) +
    +

    l2cm_pdu_tx_handler (Thumb, 74 bytes, Stack size 24 bytes, l2cm.o(le_evt_hdl_func)) +

    [Stack]

    • Max Depth = 324
    • Call Chain = l2cm_pdu_tx_handler ⇒ l2cc_data_send ⇒ lld_con_data_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   l2cc_data_send +
    • >>   ke_event_set +
    • >>   ke_event_clear +
    +
    [Address Reference Count : 1]
    • l2cm.o(ri_one_cal_func) +
    +

    lld_con_pkt_tx (Thumb, 250 bytes, Stack size 32 bytes, lld_con.o(le_irq_frm_cbk)) +

    [Stack]

    • Max Depth = 108
    • Call Chain = lld_con_pkt_tx ⇒ ke_msg_send_basic ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ble_buf_llcp_tx_free +
    • >>   ble_buf_acl_tx_free +
    • >>   ke_msg_send_basic +
    • >>   list_pop_front +
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   lld_con_frm_cbk +
    + +

    lld_con_pkt_rx (Thumb, 508 bytes, Stack size 56 bytes, lld_con.o(le_irq_frm_cbk)) +

    [Stack]

    • Max Depth = 156
    • Call Chain = lld_con_pkt_rx ⇒ lld_instant_proc_end ⇒ ke_msg_send_basic ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_instant_proc_end +
    • >>   lld_exp_sync_pos +
    • >>   lld_rxdesc_check +
    • >>   lld_rxdesc_free +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   lld_con_frm_cbk +
    + +

    lld_con_frm_cbk (Thumb, 230 bytes, Stack size 24 bytes, lld_con.o(le_irq_frm_cbk)) +

    [Stack]

    • Max Depth = 236
    • Call Chain = lld_con_frm_cbk ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   __ARM_common_switch8 +
    • >>   slot_clock_get +
    • >>   sch_arb_remove +
    • >>   lld_con_pkt_rx +
    • >>   lld_con_pkt_tx +
    • >>   lld_con_tx_prog +
    • >>   lld_con_sched +
    • >>   lld_con_cleanup +
    +
    [Address Reference Count : 1]
    • lld_con.o(.text) +
    +

    lld_adv_pkt_rx (Thumb, 498 bytes, Stack size 88 bytes, lld_adv.o(le_irq_frm_cbk)) +

    [Stack]

    • Max Depth = 188
    • Call Chain = lld_adv_pkt_rx ⇒ le_scan_req_rcvd_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_exp_sync_pos +
    • >>   lld_rxdesc_check +
    • >>   lld_rxdesc_free +
    • >>   llm_is_dev_connected +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    • >>   le_scan_req_rcvd_evt +
    +
    [Called By]
    • >>   lld_adv_frm_cbk +
    + +

    lld_adv_frm_cbk (Thumb, 456 bytes, Stack size 32 bytes, lld_adv.o(le_irq_frm_cbk)) +

    [Stack]

    • Max Depth = 236
    • Call Chain = lld_adv_frm_cbk ⇒ lld_adv_end ⇒ sch_slice_fg_remove ⇒ lld_scan_restart ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   rand +
    • >>   sch_arb_remove +
    • >>   sch_arb_insert +
    • >>   __aeabi_uidivmod +
    • >>   lld_adv_pkt_rx +
    • >>   lld_adv_data_set +
    • >>   lld_adv_end +
    +
    [Address Reference Count : 1]
    • lld_adv.o(.text) +
    +

    lld_scan_pkt_rx (Thumb, 504 bytes, Stack size 56 bytes, lld_scan.o(le_irq_frm_cbk)) +

    [Stack]

    • Max Depth = 124
    • Call Chain = lld_scan_pkt_rx ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_rxdesc_check +
    • >>   lld_rxdesc_free +
    • >>   bdaddr_is_same +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   lld_scan_frm_cbk +
    + +

    lld_scan_frm_cbk (Thumb, 228 bytes, Stack size 24 bytes, lld_scan.o(le_irq_frm_cbk)) +

    [Stack]

    • Max Depth = 212
    • Call Chain = lld_scan_frm_cbk ⇒ lld_scan_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   slot_clock_get +
    • >>   sch_arb_remove +
    • >>   sch_arb_insert +
    • >>   lld_rxdesc_check +
    • >>   lld_rxdesc_free +
    • >>   lld_scan_pkt_rx +
    • >>   lld_scan_sched +
    • >>   lld_scan_end +
    +
    [Address Reference Count : 1]
    • lld_scan.o(.text) +
    +

    lld_init_pkt_rx (Thumb, 228 bytes, Stack size 48 bytes, lld_init.o(le_irq_frm_cbk)) +

    [Stack]

    • Max Depth = 76
    • Call Chain = lld_init_pkt_rx ⇒ lld_rxdesc_free ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   le_pkt_dur_in_us +
    • >>   lld_exp_sync_pos +
    • >>   lld_rxdesc_check +
    • >>   lld_rxdesc_free +
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   lld_init_frm_cbk +
    + +

    lld_init_pkt_tx (Thumb, 340 bytes, Stack size 56 bytes, lld_init.o(le_irq_frm_cbk)) +

    [Stack]

    • Max Depth = 140
    • Call Chain = lld_init_pkt_tx ⇒ lld_init_end ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_alloc +
    • >>   __aeabi_uidivmod +
    • >>   lld_init_end +
    +
    [Called By]
    • >>   lld_init_frm_cbk +
    + +

    lld_init_frm_cbk (Thumb, 252 bytes, Stack size 32 bytes, lld_init.o(le_irq_frm_cbk)) +

    [Stack]

    • Max Depth = 212
    • Call Chain = lld_init_frm_cbk ⇒ lld_init_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   slot_clock_get +
    • >>   sch_arb_remove +
    • >>   sch_arb_insert +
    • >>   lld_rxdesc_check +
    • >>   lld_rxdesc_free +
    • >>   lld_init_pkt_tx +
    • >>   lld_init_pkt_rx +
    • >>   lld_init_sched +
    • >>   lld_init_end +
    +
    [Address Reference Count : 1]
    • lld_init.o(.text) +
    +

    BLE_IRQHandler (Thumb, 344 bytes, Stack size 24 bytes, ble_irq.o(le_irq_func)) +

    [Stack]

    • Max Depth = 96
    • Call Chain = BLE_IRQHandler ⇒ sch_arb_evt_isr ⇒ sch_arb_prog_timer ⇒ ble_timer_hus_set +
    +
    [Calls]
    • >>   sch_prog_fifo_isr +
    • >>   sch_arb_sw_isr +
    • >>   sch_arb_evt_isr +
    • >>   sch_alarm_timer_isr +
    • >>   __aeabi_uidivmod +
    +
    [Address Reference Count : 1]
    • startup.o(RESET) +
    +

    sch_arb_evt_isr (Thumb, 132 bytes, Stack size 32 bytes, sch_arb.o(le_irq_hdl_isr)) +

    [Stack]

    • Max Depth = 72
    • Call Chain = sch_arb_evt_isr ⇒ sch_arb_prog_timer ⇒ ble_timer_hus_set +
    +
    [Calls]
    • >>   sch_arb_prog_timer +
    • >>   slot_time_get +
    • >>   list_push_back +
    • >>   list_pop_front +
    +
    [Called By]
    • >>   BLE_IRQHandler +
    + +

    sch_arb_sw_isr (Thumb, 28 bytes, Stack size 8 bytes, sch_arb.o(le_irq_hdl_isr)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = sch_arb_sw_isr +
    +
    [Calls]
    • >>   list_pop_front +
    +
    [Called By]
    • >>   BLE_IRQHandler +
    + +

    sch_prog_fifo_isr (Thumb, 250 bytes, Stack size 24 bytes, sch_prog.o(le_irq_hdl_isr)) +

    [Stack]

    • Max Depth = 24
    • Call Chain = sch_prog_fifo_isr +
    +
    [Called By]
    • >>   BLE_IRQHandler +
    + +

    sch_alarm_timer_isr (Thumb, 64 bytes, Stack size 24 bytes, sch_alarm.o(le_irq_hdl_isr)) +

    [Stack]

    • Max Depth = 40
    • Call Chain = sch_alarm_timer_isr ⇒ sch_alarm_prog +
    +
    [Calls]
    • >>   slot_clock_get +
    • >>   list_pop_front +
    • >>   sch_alarm_prog +
    +
    [Called By]
    • >>   BLE_IRQHandler +
    + +

    app_task_dispatch (Thumb, 22 bytes, Stack size 0 bytes, app_msg.o(le_task_hdl_func)) +
    [Address Reference Count : 1]

    • ble_api.o(ri_one_cal_func) +
    +

    gapc_task_dispatch (Thumb, 80 bytes, Stack size 0 bytes, gapc_task.o(le_task_hdl_func)) +
    [Address Reference Count : 1]

    • gapm.o(ri_one_cal_func) +
    +

    gapm_task_dispatch (Thumb, 74 bytes, Stack size 0 bytes, gapm_task.o(le_task_hdl_func)) +
    [Address Reference Count : 1]

    • gapm.o(ri_one_cal_func) +
    +

    gatt_task_dispatch (Thumb, 82 bytes, Stack size 0 bytes, gattc_task.o(le_task_hdl_func)) +
    [Address Reference Count : 1]

    • gattm.o(ri_one_cal_func) +
    +

    llm_task_dispatch (Thumb, 54 bytes, Stack size 0 bytes, llm_task.o(le_task_hdl_func)) +
    [Address Reference Count : 1]

    • llm.o(ri_one_cal_func) +
    +

    llc_task_dispatch (Thumb, 90 bytes, Stack size 0 bytes, llc_task.o(le_task_hdl_func)) +
    [Address Reference Count : 1]

    • llm.o(ri_one_cal_func) +
    +

    l2cc_task_dispatch (Thumb, 46 bytes, Stack size 0 bytes, l2cc_task.o(le_task_hdl_func)) +
    [Address Reference Count : 1]

    • l2cm.o(ri_one_cal_func) +
    +

    rf_init (Thumb, 50 bytes, Stack size 0 bytes, rf_mdm.o(ri_one_cal_func)) +

    [Called By]

    • >>   ble_init +
    + +

    rfmdm_init (Thumb, 66 bytes, Stack size 8 bytes, rf_mdm.o(ri_one_cal_func)) +

    [Stack]

    • Max Depth = 88
    • Call Chain = rfmdm_init ⇒ rf_reset ⇒ rf_gain_cal ⇒ rf_dac_adjust +
    +
    [Calls]
    • >>   rf_reset +
    +
    [Called By]
    • >>   app_init +
    + +

    ble_heap (Thumb, 8 bytes, Stack size 8 bytes, ble_api.o(ri_one_cal_func)) +

    [Stack]

    • Max Depth = 36
    • Call Chain = ble_heap ⇒ ke_init ⇒ ke_mem_init +
    +
    [Calls]
    • >>   ke_init +
    +
    [Called By]
    • >>   app_init +
    + +

    ble_init (Thumb, 42 bytes, Stack size 8 bytes, ble_api.o(ri_one_cal_func)) +

    [Stack]

    • Max Depth = 204
    • Call Chain = ble_init ⇒ ble_drv_init ⇒ l2cm_init ⇒ l2cc_cleanup ⇒ l2cc_send_cmp_evt_status ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ble_drv_init +
    • >>   rf_init +
    +
    [Called By]
    • >>   app_init +
    + +

    ble_app (Thumb, 22 bytes, Stack size 8 bytes, ble_api.o(ri_one_cal_func)) +

    [Stack]

    • Max Depth = 84
    • Call Chain = ble_app ⇒ gapm_reset ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapm_reset +
    • >>   ke_task_create +
    +
    [Called By]
    • >>   app_init +
    + +

    ble_drv_init (Thumb, 108 bytes, Stack size 16 bytes, ble_drv.o(ri_one_cal_func)) +

    [Stack]

    • Max Depth = 196
    • Call Chain = ble_drv_init ⇒ l2cm_init ⇒ l2cc_cleanup ⇒ l2cc_send_cmp_evt_status ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_init +
    • >>   llm_init +
    • >>   lld_init +
    • >>   l2cm_init +
    • >>   ke_event_callback_set +
    • >>   gattm_init +
    • >>   gapm_init +
    • >>   ble_buf_init +
    • >>   aes_init +
    +
    [Called By]
    • >>   ble_init +
    • >>   ble_drv_reset +
    + +

    ble_drv_reset (Thumb, 38 bytes, Stack size 16 bytes, ble_drv.o(ri_one_cal_func)) +

    [Stack]

    • Max Depth = 212
    • Call Chain = ble_drv_reset ⇒ ble_drv_init ⇒ l2cm_init ⇒ l2cc_cleanup ⇒ l2cc_send_cmp_evt_status ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_flush +
    • >>   ble_drv_init +
    +
    [Called By]
    • >>   gapm_config_cmd_handler +
    + +

    ke_init (Thumb, 68 bytes, Stack size 16 bytes, ke.o(ri_one_cal_func)) +

    [Stack]

    • Max Depth = 28
    • Call Chain = ke_init ⇒ ke_mem_init +
    +
    [Calls]
    • >>   ke_mem_init +
    +
    [Called By]
    • >>   ble_heap +
    + +

    ke_flush (Thumb, 60 bytes, Stack size 8 bytes, ke.o(ri_one_cal_func)) +

    [Stack]

    • Max Depth = 28
    • Call Chain = ke_flush ⇒ ke_free +
    +
    [Calls]
    • >>   list_pop_front +
    • >>   ke_free +
    +
    [Called By]
    • >>   ble_drv_reset +
    + +

    aes_init (Thumb, 38 bytes, Stack size 8 bytes, aes.o(ri_one_cal_func)) +

    [Stack]

    • Max Depth = 28
    • Call Chain = aes_init ⇒ ke_free +
    +
    [Calls]
    • >>   list_pop_front +
    • >>   ke_free +
    +
    [Called By]
    • >>   ble_drv_init +
    + +

    gapm_init (Thumb, 118 bytes, Stack size 16 bytes, gapm.o(ri_one_cal_func)) +

    [Stack]

    • Max Depth = 144
    • Call Chain = gapm_init ⇒ gapc_cleanup ⇒ gapc_send_complete_evt ⇒ gapc_operation_cleanup ⇒ gapc_smp_cleanup ⇒ gapc_smp_clear_timeout_timer ⇒ ke_timer_clear ⇒ ke_time_past +
    +
    [Calls]
    • >>   gapm_actv_reset +
    • >>   gapc_cleanup +
    • >>   gapm_operation_cleanup +
    • >>   ke_state_set +
    • >>   ke_task_create +
    +
    [Called By]
    • >>   ble_drv_init +
    + +

    gattm_init (Thumb, 76 bytes, Stack size 16 bytes, gattm.o(ri_one_cal_func)) +

    [Stack]

    • Max Depth = 148
    • Call Chain = gattm_init ⇒ gattc_cleanup ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gattc_cleanup +
    • >>   attmdb_destroy +
    • >>   ke_task_create +
    +
    [Called By]
    • >>   ble_drv_init +
    + +

    llm_init (Thumb, 118 bytes, Stack size 16 bytes, llm.o(ri_one_cal_func)) +

    [Stack]

    • Max Depth = 132
    • Call Chain = llm_init ⇒ llc_cleanup ⇒ llc_llcp_trans_timer_set ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_cleanup +
    • >>   ke_timer_clear +
    • >>   ke_free +
    • >>   ke_task_create +
    +
    [Called By]
    • >>   ble_drv_init +
    + +

    lld_core_init (Thumb, 166 bytes, Stack size 24 bytes, lld.o(ri_one_cal_func)) +

    [Stack]

    • Max Depth = 36
    • Call Chain = lld_core_init ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ble_buf_rx_alloc +
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   lld_init +
    + +

    lld_env_init (Thumb, 42 bytes, Stack size 8 bytes, lld.o(ri_one_cal_func)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = lld_env_init +
    +
    [Calls]
    • >>   rand +
    +
    [Called By]
    • >>   lld_init +
    + +

    lld_init (Thumb, 42 bytes, Stack size 8 bytes, lld.o(ri_one_cal_func)) +

    [Stack]

    • Max Depth = 60
    • Call Chain = lld_init ⇒ lld_con_init ⇒ sch_slice_per_remove ⇒ sch_slice_compute ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_scan_init +
    • >>   lld_init_init +
    • >>   lld_con_init +
    • >>   lld_adv_init +
    • >>   lld_env_init +
    • >>   lld_core_init +
    +
    [Called By]
    • >>   ble_drv_init +
    + +

    lld_con_init (Thumb, 58 bytes, Stack size 16 bytes, lld_con.o(ri_one_cal_func)) +

    [Stack]

    • Max Depth = 52
    • Call Chain = lld_con_init ⇒ sch_slice_per_remove ⇒ sch_slice_compute ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_slice_per_remove +
    • >>   ke_free +
    +
    [Called By]
    • >>   lld_init +
    + +

    ble_buf_init (Thumb, 70 bytes, Stack size 8 bytes, ble_buf.o(ri_one_cal_func)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = ble_buf_init +
    +
    [Called By]
    • >>   ble_drv_init +
    + +

    sch_init (Thumb, 82 bytes, Stack size 16 bytes, sch.o(ri_one_cal_func)) +

    [Stack]

    • Max Depth = 16
    • Call Chain = sch_init +
    +
    [Called By]
    • >>   ble_drv_init +
    + +

    gapm_actv_reset (Thumb, 48 bytes, Stack size 8 bytes, gapm_actv.o(ri_one_cal_func)) +

    [Stack]

    • Max Depth = 36
    • Call Chain = gapm_actv_reset ⇒ gapm_actv_free ⇒ ke_free +
    +
    [Calls]
    • >>   gapm_actv_free +
    +
    [Called By]
    • >>   gapm_init +
    + +

    l2cm_init (Thumb, 90 bytes, Stack size 16 bytes, l2cm.o(ri_one_cal_func)) +

    [Stack]

    • Max Depth = 180
    • Call Chain = l2cm_init ⇒ l2cc_cleanup ⇒ l2cc_send_cmp_evt_status ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   l2cc_cleanup +
    • >>   ke_event_clear +
    • >>   ke_event_callback_set +
    • >>   ke_task_create +
    +
    [Called By]
    • >>   ble_drv_init +
    + +

    lld_adv_init (Thumb, 48 bytes, Stack size 16 bytes, lld_adv.o(ri_one_cal_func)) +

    [Stack]

    • Max Depth = 36
    • Call Chain = lld_adv_init ⇒ ke_free +
    +
    [Calls]
    • >>   ke_free +
    +
    [Called By]
    • >>   lld_init +
    + +

    lld_scan_init (Thumb, 36 bytes, Stack size 8 bytes, lld_scan.o(ri_one_cal_func)) +

    [Stack]

    • Max Depth = 28
    • Call Chain = lld_scan_init ⇒ ke_free +
    +
    [Calls]
    • >>   ke_free +
    +
    [Called By]
    • >>   lld_init +
    + +

    lld_init_init (Thumb, 50 bytes, Stack size 8 bytes, lld_init.o(ri_one_cal_func)) +

    [Stack]

    • Max Depth = 28
    • Call Chain = lld_init_init ⇒ ke_free +
    +
    [Calls]
    • >>   ke_free +
    +
    [Called By]
    • >>   lld_init +
    +

    +

    +Local Symbols +

    +

    data_proc (Thumb, 124 bytes, Stack size 16 bytes, proc.o(i.data_proc)) +

    [Stack]

    • Max Depth = 140
    • Call Chain = data_proc ⇒ gapc_disconnect ⇒ gapc_disconnect_cmd_send ⇒ le_disconnect ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   uart1Rb_Read +
    • >>   sess_txd_send +
    • >>   gapm_reset +
    • >>   gapc_disconnect +
    +
    [Called By]
    • >>   user_procedure +
    + +

    app_adv_create (Thumb, 44 bytes, Stack size 40 bytes, app_actv.o(i.app_adv_create)) +

    [Stack]

    • Max Depth = 124
    • Call Chain = app_adv_create ⇒ gapm_create_advertising ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapm_create_advertising +
    +
    [Called By]
    • >>   app_adv_action +
    + +

    app_gapc_bond_ind_handler (Thumb, 220 bytes, Stack size 16 bytes, app_gapc.o(i.app_gapc_bond_ind_handler)) +

    [Stack]

    • Max Depth = 172
    • Call Chain = app_gapc_bond_ind_handler ⇒ app_conn_fsm ⇒ app_adv_action ⇒ app_adv_create ⇒ gapm_create_advertising ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   __ARM_common_switch8 +
    • >>   app_conn_fsm +
    • >>   gapc_disconnect +
    • >>   __2printf +
    +
    [Called By]
    • >>   app_gapc_msg_handler +
    + +

    app_gapc_bond_req_ind_handler (Thumb, 302 bytes, Stack size 48 bytes, app_gapc.o(i.app_gapc_bond_req_ind_handler)) +

    [Stack]

    • Max Depth = 276
    • Call Chain = app_gapc_bond_req_ind_handler ⇒ gapc_smp_pairing_ltk_exch ⇒ gapc_smp_tkdp_send_continue ⇒ gapc_smp_tkdp_rcp_start ⇒ gapc_smp_tkdp_rcp_continue ⇒ gapc_smp_tkdp_send_start (Cycle) +
    +
    [Calls]
    • >>   rand +
    • >>   gapc_smp_pairing_tk_exch +
    • >>   gapc_smp_pairing_rsp +
    • >>   gapc_smp_pairing_ltk_exch +
    • >>   gapc_smp_pairing_csrk_exch +
    • >>   __ARM_common_switch8 +
    • >>   app_pairing_get +
    • >>   app_ltk_gen +
    • >>   __2printf +
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   app_gapc_msg_handler +
    + +

    app_gapc_connection_req_ind_handler (Thumb, 78 bytes, Stack size 40 bytes, app_gapc.o(i.app_gapc_connection_req_ind_handler)) +

    [Stack]

    • Max Depth = 64
    • Call Chain = app_gapc_connection_req_ind_handler ⇒ __2printf +
    +
    [Calls]
    • >>   __2printf +
    +
    [Called By]
    • >>   app_gapc_msg_handler +
    + +

    app_gapc_encrypt_req_ind_handler (Thumb, 122 bytes, Stack size 16 bytes, app_gapc.o(i.app_gapc_encrypt_req_ind_handler)) +

    [Stack]

    • Max Depth = 436
    • Call Chain = app_gapc_encrypt_req_ind_handler ⇒ gapc_smp_encrypt_cfm ⇒ gapc_smp_send_ltk_req_rsp ⇒ le_ltk_req_reply ⇒ llc_rem_encrypt_proc_fsm ⇒ llc_ll_reject_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapc_smp_encrypt_cfm +
    • >>   app_ltk_find +
    • >>   gapc_disconnect +
    • >>   __2printf +
    +
    [Called By]
    • >>   app_gapc_msg_handler +
    + +

    diss_svc_func (Thumb, 92 bytes, Stack size 24 bytes, prf_diss.o(i.diss_svc_func)) +

    [Stack]

    • Max Depth = 116
    • Call Chain = diss_svc_func ⇒ gatt_read_cfm ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   diss_value_get +
    • >>   gatt_read_cfm +
    +
    [Address Reference Count : 1]
    • prf_diss.o(i.diss_svc_init) +
    +

    sess_svc_func (Thumb, 206 bytes, Stack size 32 bytes, prf_sess.o(i.sess_svc_func)) +

    [Stack]

    • Max Depth = 124
    • Call Chain = sess_svc_func ⇒ gatt_read_cfm ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gatt_read_cfm +
    • >>   sess_cb_rxd +
    • >>   gatt_write_cfm +
    • >>   gatt_info_cfm +
    +
    [Address Reference Count : 1]
    • prf_sess.o(i.sess_svc_init) +
    +

    rf_dac_adjust (Thumb, 84 bytes, Stack size 32 bytes, rf_mdm.o(.text)) +

    [Stack]

    • Max Depth = 32
    • Call Chain = rf_dac_adjust +
    +
    [Calls]
    • >>   rcc_sysclk_get +
    +
    [Called By]
    • >>   rf_gain_cal +
    + +

    rf_gain_cal (Thumb, 160 bytes, Stack size 24 bytes, rf_mdm.o(.text)) +

    [Stack]

    • Max Depth = 56
    • Call Chain = rf_gain_cal ⇒ rf_dac_adjust +
    +
    [Calls]
    • >>   rf_dac_adjust +
    +
    [Called By]
    • >>   rf_reset +
    + +

    rf_cbpf_cal (Thumb, 82 bytes, Stack size 24 bytes, rf_mdm.o(.text)) +

    [Stack]

    • Max Depth = 24
    • Call Chain = rf_cbpf_cal +
    +
    [Calls]
    • >>   rcc_sysclk_get +
    +
    [Called By]
    • >>   rf_reset +
    + +

    gapc_con_param_upd_send (Thumb, 92 bytes, Stack size 16 bytes, gapc_task.o(.text)) +

    [Stack]

    • Max Depth = 120
    • Call Chain = gapc_con_param_upd_send ⇒ gapc_send_complete_evt ⇒ gapc_operation_cleanup ⇒ gapc_smp_cleanup ⇒ gapc_smp_clear_timeout_timer ⇒ ke_timer_clear ⇒ ke_time_past +
    +
    [Calls]
    • >>   le_con_param_upd +
    • >>   gapc_send_complete_evt +
    • >>   ke_msg_send +
    • >>   gapc_get_conhdl +
    +
    [Called By]
    • >>   gapc_param_update_rsp +
    • >>   gapc_link_upd_cmd_handler +
    + +

    gapc_get_info_cmd_handler (Thumb, 222 bytes, Stack size 40 bytes, gapc_task.o(.text)) +

    [Stack]

    • Max Depth = 148
    • Call Chain = gapc_get_info_cmd_handler ⇒ gapc_process_op_simple ⇒ gapc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_con_rssi_get +
    • >>   le_rd_rem_ver_info +
    • >>   le_rd_rem_feats +
    • >>   le_rd_phy +
    • >>   gapc_send_complete_evt +
    • >>   gapc_get_chan_sel_algo +
    • >>   gapc_process_op_simple +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    • >>   gapc_get_conhdl +
    +
    [Address Reference Count : 1]
    • gapc_task.o(le_task_hdl_func) +
    +

    l2cc_pdu_recv_ind_handler (Thumb, 48 bytes, Stack size 16 bytes, gapc_task.o(.text)) +

    [Stack]

    • Max Depth = 172
    • Call Chain = l2cc_pdu_recv_ind_handler ⇒ gapc_smp_pdu_recv ⇒ gapc_smp_pairing_end ⇒ gapc_smp_launch_rep_att_timer ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_state_get +
    • >>   gapc_smp_pdu_recv +
    +
    [Address Reference Count : 1]
    • gapc_task.o(le_task_hdl_func) +
    +

    gapc_param_upd_to_handler (Thumb, 58 bytes, Stack size 16 bytes, gapc_task.o(.text)) +

    [Stack]

    • Max Depth = 132
    • Call Chain = gapc_param_upd_to_handler ⇒ gapc_disconnect_cmd_send ⇒ le_disconnect ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_state_get +
    • >>   gapc_send_complete_evt +
    • >>   gapc_disconnect_cmd_send +
    +
    [Address Reference Count : 1]
    • gapc_task.o(le_task_hdl_func) +
    +

    gapc_link_upd_cmd_handler (Thumb, 220 bytes, Stack size 40 bytes, gapc_task.o(.text)) +

    [Stack]

    • Max Depth = 160
    • Call Chain = gapc_link_upd_cmd_handler ⇒ gapc_con_param_upd_send ⇒ gapc_send_complete_evt ⇒ gapc_operation_cleanup ⇒ gapc_smp_cleanup ⇒ gapc_smp_clear_timeout_timer ⇒ ke_timer_clear ⇒ ke_time_past +
    +
    [Calls]
    • >>   rand +
    • >>   le_set_phy +
    • >>   l2cc_sig_send_param_upd_req +
    • >>   ke_timer_set +
    • >>   gapc_send_complete_evt +
    • >>   gapc_param_update_sanity +
    • >>   gapc_process_op_simple +
    • >>   gapc_con_param_upd_send +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    • >>   gapc_get_conhdl +
    +
    [Address Reference Count : 1]
    • gapc_task.o(le_task_hdl_func) +
    +

    gapc_smp_send_start_enc_cmd (Thumb, 76 bytes, Stack size 24 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 132
    • Call Chain = gapc_smp_send_start_enc_cmd ⇒ le_start_enc ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   le_start_enc +
    • >>   gapc_update_state +
    • >>   gapc_send_complete_evt +
    • >>   gapc_get_conhdl +
    +
    [Called By]
    • >>   gapc_smp_aes_res_cb +
    • >>   gapc_smp_cmd_handler +
    + +

    gapc_smp_send_ltk_req_rsp (Thumb, 66 bytes, Stack size 16 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 404
    • Call Chain = gapc_smp_send_ltk_req_rsp ⇒ le_ltk_req_reply ⇒ llc_rem_encrypt_proc_fsm ⇒ llc_ll_reject_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   le_ltk_req_reply +
    • >>   gapc_update_state +
    • >>   gapc_send_complete_evt +
    • >>   gapc_get_conhdl +
    +
    [Called By]
    • >>   gapc_smp_encrypt_cfm +
    • >>   gapc_smp_aes_res_cb +
    + +

    gapc_smp_send_pairing_req_ind (Thumb, 166 bytes, Stack size 32 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 100
    • Call Chain = gapc_smp_send_pairing_req_ind ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   __ARM_common_switch8 +
    • >>   gapc_enc_keysize_get +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   gapc_smp_pairing_rsp +
    • >>   gapc_smp_recv_pair_rsp +
    • >>   gapc_smp_tkdp_send_continue +
    • >>   gapc_smp_cmd_handler +
    + +

    gapc_smp_send_pairing_ind (Thumb, 142 bytes, Stack size 32 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 100
    • Call Chain = gapc_smp_send_pairing_ind ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   __ARM_common_switch8 +
    • >>   gapc_auth_set +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   gapc_smp_recv_sec_req +
    • >>   gapc_smp_recv_sign_info +
    • >>   gapc_smp_recv_id_addr_info +
    • >>   gapc_smp_recv_mst_id +
    • >>   gapc_smp_recv_pair_fail +
    • >>   gapc_smp_recv_pair_req +
    • >>   gapc_smp_pairing_end +
    + +

    gapc_smp_launch_rep_att_timer (Thumb, 58 bytes, Stack size 24 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 108
    • Call Chain = gapc_smp_launch_rep_att_timer ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_timer_clear +
    • >>   ke_timer_set +
    +
    [Called By]
    • >>   gapc_smp_pairing_end +
    • >>   gapc_smp_check_repeated_attempts +
    + +

    gapc_smp_check_repeated_attempts (Thumb, 82 bytes, Stack size 16 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 124
    • Call Chain = gapc_smp_check_repeated_attempts ⇒ gapc_smp_launch_rep_att_timer ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapc_smp_launch_rep_att_timer +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   gapc_smp_recv_sec_req +
    • >>   gapc_smp_recv_pair_req +
    + +

    gapc_smp_check_key_distrib (Thumb, 146 bytes, Stack size 20 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 20
    • Call Chain = gapc_smp_check_key_distrib +
    +
    [Called By]
    • >>   gapc_smp_pairing_rsp +
    • >>   gapc_smp_recv_pair_rsp +
    + +

    gapc_smp_pairing_end (Thumb, 88 bytes, Stack size 32 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 140
    • Call Chain = gapc_smp_pairing_end ⇒ gapc_smp_launch_rep_att_timer ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_free +
    • >>   gapc_smp_clear_timeout_timer +
    • >>   gapc_smp_launch_rep_att_timer +
    • >>   gapc_smp_send_pairing_ind +
    • >>   gapc_send_complete_evt +
    +
    [Called By]
    • >>   gapc_smp_pairing_tk_exch +
    • >>   gapc_smp_pairing_rsp +
    • >>   gapc_smp_gapm_cmp_evt +
    • >>   gapc_smp_recv_pair_fail +
    • >>   gapc_smp_aes_res_cb +
    • >>   gapc_smp_handle_enc_change_evt +
    • >>   gapc_smp_tkdp_send_continue +
    • >>   gapc_smp_tkdp_rcp_continue +
    • >>   gapc_smp_timer_ind_handler +
    • >>   gapc_smp_pdu_recv +
    + +

    gapc_smp_tkdp_rcp_continue (Thumb, 128 bytes, Stack size 16 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 156 + In Cycle +
    • Call Chain = gapc_smp_tkdp_rcp_continue ⇒ gapc_smp_tkdp_send_start (Cycle) +
    +
    [Calls]
    • >>   __ARM_common_switch8 +
    • >>   gapc_smp_tkdp_send_start +
    • >>   gapc_smp_pairing_end +
    +
    [Called By]
    • >>   gapc_smp_recv_sign_info +
    • >>   gapc_smp_recv_id_addr_info +
    • >>   gapc_smp_recv_id_info +
    • >>   gapc_smp_recv_mst_id +
    • >>   gapc_smp_recv_enc_info +
    • >>   gapc_smp_tkdp_rcp_start +
    + +

    gapc_smp_tkdp_rcp_start (Thumb, 64 bytes, Stack size 8 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 164
    • Call Chain = gapc_smp_tkdp_rcp_start ⇒ gapc_smp_tkdp_rcp_continue ⇒ gapc_smp_tkdp_send_start (Cycle) +
    +
    [Calls]
    • >>   gapc_smp_tkdp_rcp_continue +
    +
    [Called By]
    • >>   gapc_smp_handle_enc_change_evt +
    • >>   gapc_smp_tkdp_send_continue +
    + +

    gapc_smp_pdu_send (Thumb, 78 bytes, Stack size 24 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 108
    • Call Chain = gapc_smp_pdu_send ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_timer_clear +
    • >>   ke_timer_set +
    • >>   ke_msg_send +
    +
    [Called By]
    • >>   gapc_smp_pairing_rsp +
    • >>   gapc_smp_pairing_ltk_exch +
    • >>   gapc_smp_pairing_csrk_exch +
    • >>   gapc_key_press_notify +
    • >>   gapc_smp_pair_rand_send +
    • >>   gapc_smp_pair_fail_send +
    • >>   gapc_smp_pairing_start +
    • >>   gapc_smp_aes_res_cb +
    • >>   gapc_smp_tkdp_send_continue +
    • >>   gapc_smp_cmd_handler +
    + +

    gapc_smp_tkdp_send_continue (Thumb, 222 bytes, Stack size 32 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 196
    • Call Chain = gapc_smp_tkdp_send_continue ⇒ gapc_smp_tkdp_rcp_start ⇒ gapc_smp_tkdp_rcp_continue ⇒ gapc_smp_tkdp_send_start (Cycle) +
    +
    [Calls]
    • >>   l2cc_smp_pdu_alloc +
    • >>   gapc_smp_pdu_send +
    • >>   gapc_smp_tkdp_rcp_start +
    • >>   gapc_smp_pairing_end +
    • >>   gapc_smp_send_pairing_req_ind +
    +
    [Called By]
    • >>   gapc_smp_pairing_ltk_exch +
    • >>   gapc_smp_pairing_csrk_exch +
    • >>   gapc_smp_tkdp_send_start +
    + +

    gapc_smp_tkdp_send_start (Thumb, 46 bytes, Stack size 8 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 204
    • Call Chain = gapc_smp_tkdp_send_start ⇒ gapc_smp_tkdp_send_continue ⇒ gapc_smp_tkdp_rcp_start ⇒ gapc_smp_tkdp_rcp_continue ⇒ gapc_smp_tkdp_send_start (Cycle) +
    +
    [Calls]
    • >>   gapc_smp_tkdp_send_continue +
    +
    [Called By]
    • >>   gapc_smp_handle_enc_change_evt +
    • >>   gapc_smp_tkdp_rcp_continue +
    + +

    gapc_smp_get_key_sec_prop (Thumb, 130 bytes, Stack size 8 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 8
    • Call Chain = gapc_smp_get_key_sec_prop +
    +
    [Called By]
    • >>   gapc_smp_pairing_rsp +
    • >>   gapc_smp_recv_pair_rsp +
    + +

    gapc_smp_is_sec_mode_reached (Thumb, 60 bytes, Stack size 4 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 12
    • Call Chain = gapc_smp_is_sec_mode_reached ⇒ __ARM_common_switch8 +
    +
    [Calls]
    • >>   __ARM_common_switch8 +
    +
    [Called By]
    • >>   gapc_smp_pairing_rsp +
    • >>   gapc_smp_recv_pair_rsp +
    + +

    gapc_smp_handle_enc_change_evt (Thumb, 306 bytes, Stack size 32 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 236
    • Call Chain = gapc_smp_handle_enc_change_evt ⇒ gapc_smp_tkdp_send_start ⇒ gapc_smp_tkdp_send_continue ⇒ gapc_smp_tkdp_rcp_start ⇒ gapc_smp_tkdp_rcp_continue ⇒ gapc_smp_tkdp_send_start (Cycle) +
    +
    [Calls]
    • >>   gapc_smp_tkdp_send_start +
    • >>   gapc_smp_tkdp_rcp_start +
    • >>   gapc_smp_pairing_end +
    • >>   gapc_update_state +
    • >>   gapc_send_complete_evt +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   le_enc_chg_evt +
    + +

    gapc_smp_generate_stk (Thumb, 90 bytes, Stack size 40 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 124
    • Call Chain = gapc_smp_generate_stk ⇒ aes_encrypt ⇒ aes_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   aes_encrypt +
    +
    [Called By]
    • >>   le_ltk_req_evt +
    • >>   gapc_smp_aes_res_cb +
    + +

    gapc_smp_comp_cnf_val (Thumb, 270 bytes, Stack size 72 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 172
    • Call Chain = gapc_smp_comp_cnf_val ⇒ aes_c1 ⇒ aes_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapc_get_bdaddr +
    • >>   aes_c1 +
    +
    [Called By]
    • >>   gapc_smp_recv_pair_rand +
    • >>   gapc_smp_aes_res_cb +
    + +

    gapc_smp_aes_res_cb (Thumb, 302 bytes, Stack size 56 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 460
    • Call Chain = gapc_smp_aes_res_cb ⇒ gapc_smp_send_ltk_req_rsp ⇒ le_ltk_req_reply ⇒ llc_rem_encrypt_proc_fsm ⇒ llc_ll_reject_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   l2cc_smp_pdu_alloc +
    • >>   gapc_enc_keysize_get +
    • >>   gapc_smp_pair_rand_send +
    • >>   gapc_smp_pair_fail_send +
    • >>   gapc_smp_comp_cnf_val +
    • >>   gapc_smp_generate_stk +
    • >>   gapc_smp_pdu_send +
    • >>   gapc_smp_pairing_end +
    • >>   gapc_smp_send_ltk_req_rsp +
    • >>   gapc_smp_send_start_enc_cmd +
    +
    [Address Reference Count : 1]
    • gapc_smp.o(.text) +
    +

    gapc_smp_recv_pair_req (Thumb, 186 bytes, Stack size 24 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 148
    • Call Chain = gapc_smp_recv_pair_req ⇒ gapc_smp_check_repeated_attempts ⇒ gapc_smp_launch_rep_att_timer ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapc_smp_check_repeated_attempts +
    • >>   gapc_smp_send_pairing_ind +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Address Reference Count : 1]
    • gapc_smp.o(.constdata) +
    +

    gapc_smp_recv_pair_rsp (Thumb, 238 bytes, Stack size 32 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 180
    • Call Chain = gapc_smp_recv_pair_rsp ⇒ gapc_smp_generate_rand ⇒ aes_rand ⇒ aes_encrypt ⇒ aes_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapc_smp_generate_rand +
    • >>   gapc_smp_check_max_key_size +
    • >>   gapc_smp_check_pairing_feat +
    • >>   gapc_smp_is_sec_mode_reached +
    • >>   gapc_smp_get_key_sec_prop +
    • >>   gapc_smp_check_key_distrib +
    • >>   gapc_smp_send_pairing_req_ind +
    +
    [Address Reference Count : 1]
    • gapc_smp.o(.constdata) +
    +

    gapc_smp_recv_pair_cfm (Thumb, 88 bytes, Stack size 24 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 172
    • Call Chain = gapc_smp_recv_pair_cfm ⇒ gapc_smp_generate_rand ⇒ aes_rand ⇒ aes_encrypt ⇒ aes_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapc_smp_generate_rand +
    • >>   gapc_smp_pair_rand_send +
    +
    [Address Reference Count : 1]
    • gapc_smp.o(.constdata) +
    +

    gapc_smp_recv_pair_rand (Thumb, 64 bytes, Stack size 16 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 188
    • Call Chain = gapc_smp_recv_pair_rand ⇒ gapc_smp_comp_cnf_val ⇒ aes_c1 ⇒ aes_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapc_smp_comp_cnf_val +
    +
    [Address Reference Count : 1]
    • gapc_smp.o(.constdata) +
    +

    gapc_smp_recv_pair_fail (Thumb, 60 bytes, Stack size 8 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 148
    • Call Chain = gapc_smp_recv_pair_fail ⇒ gapc_smp_pairing_end ⇒ gapc_smp_launch_rep_att_timer ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapc_smp_pairing_end +
    • >>   gapc_smp_send_pairing_ind +
    +
    [Address Reference Count : 1]
    • gapc_smp.o(.constdata) +
    +

    gapc_smp_recv_enc_info (Thumb, 68 bytes, Stack size 16 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 172
    • Call Chain = gapc_smp_recv_enc_info ⇒ gapc_smp_tkdp_rcp_continue ⇒ gapc_smp_tkdp_send_start (Cycle) +
    +
    [Calls]
    • >>   gapc_smp_tkdp_rcp_continue +
    +
    [Address Reference Count : 1]
    • gapc_smp.o(.constdata) +
    +

    gapc_smp_recv_mst_id (Thumb, 90 bytes, Stack size 48 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 204
    • Call Chain = gapc_smp_recv_mst_id ⇒ gapc_smp_tkdp_rcp_continue ⇒ gapc_smp_tkdp_send_start (Cycle) +
    +
    [Calls]
    • >>   gapc_enc_keysize_get +
    • >>   gapc_smp_tkdp_rcp_continue +
    • >>   gapc_smp_send_pairing_ind +
    +
    [Address Reference Count : 1]
    • gapc_smp.o(.constdata) +
    +

    gapc_smp_recv_id_info (Thumb, 48 bytes, Stack size 16 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 172
    • Call Chain = gapc_smp_recv_id_info ⇒ gapc_smp_tkdp_rcp_continue ⇒ gapc_smp_tkdp_send_start (Cycle) +
    +
    [Calls]
    • >>   gapc_smp_tkdp_rcp_continue +
    +
    [Address Reference Count : 1]
    • gapc_smp.o(.constdata) +
    +

    gapc_smp_recv_id_addr_info (Thumb, 76 bytes, Stack size 48 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 204
    • Call Chain = gapc_smp_recv_id_addr_info ⇒ gapc_smp_tkdp_rcp_continue ⇒ gapc_smp_tkdp_send_start (Cycle) +
    +
    [Calls]
    • >>   gapc_smp_tkdp_rcp_continue +
    • >>   gapc_smp_send_pairing_ind +
    +
    [Address Reference Count : 1]
    • gapc_smp.o(.constdata) +
    +

    gapc_smp_recv_sign_info (Thumb, 44 bytes, Stack size 16 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 172
    • Call Chain = gapc_smp_recv_sign_info ⇒ gapc_smp_tkdp_rcp_continue ⇒ gapc_smp_tkdp_send_start (Cycle) +
    +
    [Calls]
    • >>   gapc_smp_tkdp_rcp_continue +
    • >>   gapc_smp_send_pairing_ind +
    +
    [Address Reference Count : 1]
    • gapc_smp.o(.constdata) +
    +

    gapc_smp_recv_sec_req (Thumb, 138 bytes, Stack size 24 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 148
    • Call Chain = gapc_smp_recv_sec_req ⇒ gapc_smp_check_repeated_attempts ⇒ gapc_smp_launch_rep_att_timer ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapc_get_role +
    • >>   gapc_smp_check_repeated_attempts +
    • >>   gapc_smp_send_pairing_ind +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Address Reference Count : 1]
    • gapc_smp.o(.constdata) +
    +

    gapc_smp_pairing_start (Thumb, 180 bytes, Stack size 32 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 140
    • Call Chain = gapc_smp_pairing_start ⇒ gapc_smp_pdu_send ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   l2cc_smp_pdu_alloc +
    • >>   ke_malloc +
    • >>   gapc_smp_check_pairing_feat +
    • >>   gapc_smp_pdu_send +
    +
    [Called By]
    • >>   gapc_smp_cmd_handler +
    + +

    gapc_smp_check_pairing_feat (Thumb, 38 bytes, Stack size 0 bytes, gapc_smp.o(.text)) +

    [Called By]

    • >>   gapc_smp_pairing_start +
    • >>   gapc_smp_recv_pair_rsp +
    + +

    gapc_smp_check_max_key_size (Thumb, 34 bytes, Stack size 0 bytes, gapc_smp.o(.text)) +

    [Called By]

    • >>   gapc_smp_pairing_rsp +
    • >>   gapc_smp_recv_pair_rsp +
    + +

    gapc_smp_clear_timeout_timer (Thumb, 38 bytes, Stack size 8 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 56
    • Call Chain = gapc_smp_clear_timeout_timer ⇒ ke_timer_clear ⇒ ke_time_past +
    +
    [Calls]
    • >>   ke_timer_clear +
    +
    [Called By]
    • >>   gapc_smp_cleanup +
    • >>   gapc_smp_pairing_end +
    + +

    gapc_smp_pair_fail_send (Thumb, 26 bytes, Stack size 16 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 124
    • Call Chain = gapc_smp_pair_fail_send ⇒ gapc_smp_pdu_send ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   l2cc_smp_pdu_alloc +
    • >>   gapc_smp_pdu_send +
    +
    [Called By]
    • >>   gapc_smp_pairing_tk_exch +
    • >>   gapc_smp_pairing_rsp +
    • >>   gapc_smp_gapm_cmp_evt +
    • >>   gapc_smp_aes_res_cb +
    • >>   gapc_smp_pdu_recv +
    + +

    gapc_smp_pair_rand_send (Thumb, 64 bytes, Stack size 16 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 124
    • Call Chain = gapc_smp_pair_rand_send ⇒ gapc_smp_pdu_send ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   l2cc_smp_pdu_alloc +
    • >>   gapc_smp_pdu_send +
    +
    [Called By]
    • >>   gapc_smp_recv_pair_cfm +
    • >>   gapc_smp_aes_res_cb +
    + +

    gapc_smp_generate_rand (Thumb, 20 bytes, Stack size 8 bytes, gapc_smp.o(.text)) +

    [Stack]

    • Max Depth = 148
    • Call Chain = gapc_smp_generate_rand ⇒ aes_rand ⇒ aes_encrypt ⇒ aes_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   aes_rand +
    +
    [Called By]
    • >>   gapc_smp_pairing_tk_exch +
    • >>   gapc_smp_recv_pair_cfm +
    • >>   gapc_smp_recv_pair_rsp +
    + +

    attmdb_svc_att_desc (Thumb, 196 bytes, Stack size 24 bytes, attm_db.o(.text)) +

    [Stack]

    • Max Depth = 48
    • Call Chain = attmdb_svc_att_desc ⇒ attm_is_bt_uuid +
    +
    [Calls]
    • >>   attm_is_bt_uuid +
    +
    [Called By]
    • >>   attmdb_svc_create +
    + +

    attmdb_svc_att_size (Thumb, 140 bytes, Stack size 16 bytes, attm_db.o(.text)) +

    [Stack]

    • Max Depth = 40
    • Call Chain = attmdb_svc_att_size ⇒ attm_is_bt_uuid +
    +
    [Calls]
    • >>   attm_is_bt_uuid +
    +
    [Called By]
    • >>   attmdb_svc_create +
    + +

    cmp_dest_id (Thumb, 14 bytes, Stack size 0 bytes, ke_task.o(.text)) +
    [Address Reference Count : 1]

    • ke_task.o(ke_util_api_func) +
    +

    ke_time_past (Thumb, 66 bytes, Stack size 32 bytes, ke_timer.o(.text)) +

    [Stack]

    • Max Depth = 32
    • Call Chain = ke_time_past +
    +
    [Calls]
    • >>   slot_time_get +
    +
    [Called By]
    • >>   ke_timer_schedule +
    • >>   ke_timer_clear +
    • >>   ke_timer_set +
    + +

    cmp_abs_time (Thumb, 40 bytes, Stack size 12 bytes, ke_timer.o(.text)) +

    [Stack]

    • Max Depth = 12
    • Call Chain = cmp_abs_time +
    +
    [Address Reference Count : 1]
    • ke_timer.o(ke_util_api_func) +
    +

    cmp_timer_id (Thumb, 24 bytes, Stack size 0 bytes, ke_timer.o(.text)) +
    [Address Reference Count : 1]

    • ke_timer.o(ke_util_api_func) +
    +

    aes_c1_continue (Thumb, 54 bytes, Stack size 24 bytes, aes_c1.o(.text)) +

    [Stack]

    • Max Depth = 72
    • Call Chain = aes_c1_continue ⇒ aes_start ⇒ ble_aes_encrypt +
    +
    [Calls]
    • >>   aes_xor_128 +
    • >>   aes_start +
    +
    [Address Reference Count : 1]
    • aes_c1.o(.text) +
    +

    gapm_operation_cleanup (Thumb, 40 bytes, Stack size 16 bytes, gapm.o(.text)) +

    [Stack]

    • Max Depth = 88
    • Call Chain = gapm_operation_cleanup ⇒ gapm_update_state ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   gapm_update_state +
    • >>   ke_free +
    +
    [Called By]
    • >>   gapm_send_complete_evt +
    • >>   gapm_init +
    + +

    gapc_operation_cleanup (Thumb, 48 bytes, Stack size 16 bytes, gapc.o(.text)) +

    [Stack]

    • Max Depth = 88
    • Call Chain = gapc_operation_cleanup ⇒ gapc_smp_cleanup ⇒ gapc_smp_clear_timeout_timer ⇒ ke_timer_clear ⇒ ke_time_past +
    +
    [Calls]
    • >>   ke_free +
    • >>   gapc_smp_cleanup +
    +
    [Called By]
    • >>   gapc_cleanup +
    • >>   gapc_send_complete_evt +
    + +

    gatt_operation_cleanup (Thumb, 62 bytes, Stack size 16 bytes, gattc.o(.text)) +

    [Stack]

    • Max Depth = 36
    • Call Chain = gatt_operation_cleanup ⇒ ke_free +
    +
    [Calls]
    • >>   list_pop_front +
    • >>   ke_free +
    +
    [Called By]
    • >>   gattc_send_complete_evt +
    • >>   gattc_cleanup +
    + +

    l2c_code_reject_handler (Thumb, 74 bytes, Stack size 16 bytes, l2cc_sig.o(.text)) +

    [Stack]

    • Max Depth = 120
    • Call Chain = l2c_code_reject_handler ⇒ gapc_send_complete_evt ⇒ gapc_operation_cleanup ⇒ gapc_smp_cleanup ⇒ gapc_smp_clear_timeout_timer ⇒ ke_timer_clear ⇒ ke_time_past +
    +
    [Calls]
    • >>   gapc_send_complete_evt +
    +
    [Called By]
    • >>   l2cc_sig_pdu_recv_handler +
    + +

    l2c_code_con_param_upd_req_handler (Thumb, 120 bytes, Stack size 16 bytes, l2cc_sig.o(.text)) +

    [Stack]

    • Max Depth = 108
    • Call Chain = l2c_code_con_param_upd_req_handler ⇒ l2cc_sig_send_cmd_reject ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   l2cc_sig_send_cmd_reject +
    • >>   gapc_get_role +
    • >>   l2cc_sig_send_param_resp +
    • >>   gapc_param_update_sanity +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   l2cc_sig_pdu_recv_handler +
    + +

    l2c_code_con_param_upd_rsp_handler (Thumb, 94 bytes, Stack size 16 bytes, l2cc_sig.o(.text)) +

    [Stack]

    • Max Depth = 120
    • Call Chain = l2c_code_con_param_upd_rsp_handler ⇒ gapc_send_complete_evt ⇒ gapc_operation_cleanup ⇒ gapc_smp_cleanup ⇒ gapc_smp_clear_timeout_timer ⇒ ke_timer_clear ⇒ ke_time_past +
    +
    [Calls]
    • >>   l2cc_sig_send_cmd_reject +
    • >>   ke_timer_clear +
    • >>   gapc_get_role +
    • >>   gapc_send_complete_evt +
    +
    [Called By]
    • >>   l2cc_sig_pdu_recv_handler +
    + +

    atts_get_att_chk_perm (Thumb, 148 bytes, Stack size 24 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 56
    • Call Chain = atts_get_att_chk_perm ⇒ attmdb_att_get_perm ⇒ attmdb_get_service2 +
    +
    [Calls]
    • >>   gapc_lk_sec_lvl_get +
    • >>   gapc_is_sec_set +
    • >>   attmdb_att_get_perm +
    • >>   gapc_enc_keysize_get +
    +
    [Called By]
    • >>   atts_write_req +
    • >>   atts_prepare_write_req +
    • >>   atts_write_common +
    • >>   atts_read_mult_req +
    • >>   atts_read_blob_req +
    • >>   atts_read_req +
    • >>   atts_find_value_by_uuid +
    + +

    atts_get_value (Thumb, 112 bytes, Stack size 40 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 112
    • Call Chain = atts_get_value ⇒ attm_get_value ⇒ attm_get_att_uuid ⇒ attm_uuid32_conv +
    +
    [Calls]
    • >>   attm_get_value +
    • >>   atts_get_svc_func +
    • >>   atts_clear_read_cache +
    +
    [Called By]
    • >>   atts_read_mult_req +
    • >>   atts_read_blob_req +
    • >>   atts_read_req +
    • >>   atts_find_value_by_uuid +
    + +

    atts_find_value_by_uuid (Thumb, 160 bytes, Stack size 56 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 168
    • Call Chain = atts_find_value_by_uuid ⇒ atts_get_value ⇒ attm_get_value ⇒ attm_get_att_uuid ⇒ attm_uuid32_conv +
    +
    [Calls]
    • >>   atts_find_end +
    • >>   atts_get_value +
    • >>   atts_get_att_chk_perm +
    • >>   attm_uuid_comp +
    • >>   attm_get_hdl_uuid +
    • >>   attmdb_get_service2 +
    +
    [Called By]
    • >>   atts_read_by_grp_type_req +
    • >>   atts_read_by_type_req +
    • >>   atts_find_by_type_req +
    + +

    atts_mtu_exc_req (Thumb, 52 bytes, Stack size 32 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 116
    • Call Chain = atts_mtu_exc_req ⇒ l2cc_att_pdu_alloc ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   l2cc_att_pdu_alloc +
    • >>   gatt_set_mtu +
    • >>   ke_msg_send +
    +
    [Address Reference Count : 1]
    • atts.o(.constdata) +
    +

    atts_find_info_req (Thumb, 294 bytes, Stack size 48 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 148
    • Call Chain = atts_find_info_req ⇒ atts_send_error ⇒ l2cc_att_pdu_alloc ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   atts_send_error +
    • >>   l2cc_att_pdu_alloc +
    • >>   gatt_get_mtu +
    • >>   list_push_back +
    • >>   attm_get_hdl_uuid +
    • >>   attmdb_get_service2 +
    • >>   ke_malloc +
    • >>   ke_free +
    • >>   ke_msg_send +
    +
    [Address Reference Count : 1]
    • atts.o(.constdata) +
    +

    atts_find_by_type_req (Thumb, 390 bytes, Stack size 72 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 240
    • Call Chain = atts_find_by_type_req ⇒ atts_find_value_by_uuid ⇒ atts_get_value ⇒ attm_get_value ⇒ attm_get_att_uuid ⇒ attm_uuid32_conv +
    +
    [Calls]
    • >>   list_size +
    • >>   atts_send_error +
    • >>   atts_find_value_by_uuid +
    • >>   attm_uuid_comp +
    • >>   l2cc_att_pdu_alloc +
    • >>   atts_clear_read_cache +
    • >>   gatt_get_mtu +
    • >>   list_push_back +
    • >>   ke_malloc +
    • >>   ke_msg_send +
    +
    [Address Reference Count : 1]
    • atts.o(.constdata) +
    +

    atts_read_by_type_req (Thumb, 402 bytes, Stack size 80 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 248
    • Call Chain = atts_read_by_type_req ⇒ atts_find_value_by_uuid ⇒ atts_get_value ⇒ attm_get_value ⇒ attm_get_att_uuid ⇒ attm_uuid32_conv +
    +
    [Calls]
    • >>   list_size +
    • >>   atts_send_error +
    • >>   atts_find_value_by_uuid +
    • >>   l2cc_att_pdu_alloc +
    • >>   atts_clear_read_cache +
    • >>   gatt_get_mtu +
    • >>   list_push_back +
    • >>   ke_malloc +
    • >>   ke_msg_send +
    +
    [Address Reference Count : 1]
    • atts.o(.constdata) +
    +

    atts_read_by_grp_type_req (Thumb, 438 bytes, Stack size 72 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 240
    • Call Chain = atts_read_by_grp_type_req ⇒ atts_find_value_by_uuid ⇒ atts_get_value ⇒ attm_get_value ⇒ attm_get_att_uuid ⇒ attm_uuid32_conv +
    +
    [Calls]
    • >>   list_size +
    • >>   atts_send_error +
    • >>   atts_find_value_by_uuid +
    • >>   l2cc_att_pdu_alloc +
    • >>   atts_clear_read_cache +
    • >>   gatt_get_mtu +
    • >>   list_push_back +
    • >>   ke_malloc +
    • >>   ke_msg_send +
    +
    [Address Reference Count : 1]
    • atts.o(.constdata) +
    +

    atts_read_req (Thumb, 138 bytes, Stack size 24 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 136
    • Call Chain = atts_read_req ⇒ atts_get_value ⇒ attm_get_value ⇒ attm_get_att_uuid ⇒ attm_uuid32_conv +
    +
    [Calls]
    • >>   atts_send_error +
    • >>   atts_get_value +
    • >>   atts_get_att_chk_perm +
    • >>   l2cc_att_pdu_alloc +
    • >>   atts_clear_read_cache +
    • >>   gatt_get_mtu +
    • >>   ke_msg_send +
    +
    [Address Reference Count : 1]
    • atts.o(.constdata) +
    +

    atts_read_blob_req (Thumb, 164 bytes, Stack size 32 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 144
    • Call Chain = atts_read_blob_req ⇒ atts_get_value ⇒ attm_get_value ⇒ attm_get_att_uuid ⇒ attm_uuid32_conv +
    +
    [Calls]
    • >>   atts_send_error +
    • >>   atts_get_value +
    • >>   atts_get_att_chk_perm +
    • >>   l2cc_att_pdu_alloc +
    • >>   atts_clear_read_cache +
    • >>   gatt_get_mtu +
    • >>   ke_msg_send +
    +
    [Address Reference Count : 1]
    • atts.o(.constdata) +
    +

    atts_read_mult_req (Thumb, 292 bytes, Stack size 56 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 168
    • Call Chain = atts_read_mult_req ⇒ atts_get_value ⇒ attm_get_value ⇒ attm_get_att_uuid ⇒ attm_uuid32_conv +
    +
    [Calls]
    • >>   list_size +
    • >>   atts_send_error +
    • >>   atts_get_value +
    • >>   atts_get_att_chk_perm +
    • >>   l2cc_att_pdu_alloc +
    • >>   atts_clear_read_cache +
    • >>   gatt_get_mtu +
    • >>   list_push_back +
    • >>   ke_malloc +
    • >>   ke_msg_send +
    +
    [Address Reference Count : 1]
    • atts.o(.constdata) +
    +

    atts_write_common (Thumb, 116 bytes, Stack size 40 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 172
    • Call Chain = atts_write_common ⇒ atts_write_req ⇒ atts_send_error ⇒ l2cc_att_pdu_alloc ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   atts_write_req +
    • >>   atts_get_att_chk_perm +
    • >>   atts_get_svc_func +
    • >>   attmdb_chk_wr_len +
    +
    [Address Reference Count : 1]
    • atts.o(.constdata) +
    +

    atts_prepare_write_req (Thumb, 240 bytes, Stack size 48 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 148
    • Call Chain = atts_prepare_write_req ⇒ atts_send_error ⇒ l2cc_att_pdu_alloc ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   list_push_front +
    • >>   atts_send_error +
    • >>   atts_store_prep_data +
    • >>   atts_get_att_chk_perm +
    • >>   l2cc_att_pdu_alloc +
    • >>   atts_get_svc_func +
    • >>   list_pop_front +
    • >>   ke_msg_send +
    +
    [Address Reference Count : 1]
    • atts.o(.constdata) +
    +

    atts_execute_write_req (Thumb, 392 bytes, Stack size 56 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 156
    • Call Chain = atts_execute_write_req ⇒ atts_send_error ⇒ l2cc_att_pdu_alloc ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   atts_send_error +
    • >>   l2cc_att_pdu_alloc +
    • >>   atts_get_svc_func +
    • >>   atts_clear_prep_data +
    • >>   list_pop_front +
    • >>   attmdb_chk_wr_len +
    • >>   attmdb_get_service2 +
    • >>   ke_free +
    • >>   ke_msg_send +
    +
    [Address Reference Count : 1]
    • atts.o(.constdata) +
    +

    atts_find_end (Thumb, 94 bytes, Stack size 20 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 20
    • Call Chain = atts_find_end +
    +
    [Called By]
    • >>   atts_find_value_by_uuid +
    + +

    atts_store_prep_data (Thumb, 114 bytes, Stack size 24 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 28
    • Call Chain = atts_store_prep_data ⇒ list_insert_before +
    +
    [Calls]
    • >>   list_insert_before +
    • >>   list_push_back +
    +
    [Called By]
    • >>   atts_prepare_write_req +
    + +

    atts_write_req (Thumb, 104 bytes, Stack size 32 bytes, atts.o(.text)) +

    [Stack]

    • Max Depth = 132
    • Call Chain = atts_write_req ⇒ atts_send_error ⇒ l2cc_att_pdu_alloc ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   atts_send_error +
    • >>   atts_get_att_chk_perm +
    • >>   atts_get_svc_func +
    • >>   attmdb_chk_wr_len +
    +
    [Called By]
    • >>   atts_write_common +
    + +

    llc_disconnect_proc_fsm (Thumb, 102 bytes, Stack size 16 bytes, llc_disconnect.o(.text)) +

    [Stack]

    • Max Depth = 332
    • Call Chain = llc_disconnect_proc_fsm ⇒ llc_ll_terminate_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_proc_unreg +
    • >>   llc_proc_timer_set +
    • >>   llc_proc_timer_pause_set +
    • >>   llc_llcp_state_set +
    • >>   llc_disconnect +
    • >>   llc_ll_terminate_ind_pdu_send +
    +
    [Called By]
    • >>   llc_op_disconnect_ind_cb +
    • >>   llc_disconnect_proc_err +
    • >>   llc_ll_terminate_ind_ack +
    + +

    llc_ll_terminate_ind_ack (Thumb, 4 bytes, Stack size 0 bytes, llc_disconnect.o(.text)) +

    [Stack]

    • Max Depth = 332
    • Call Chain = llc_ll_terminate_ind_ack ⇒ llc_disconnect_proc_fsm ⇒ llc_ll_terminate_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_disconnect_proc_fsm +
    +
    [Address Reference Count : 1]
    • llc_disconnect.o(.text) +
    +

    llc_ll_terminate_ind_pdu_send (Thumb, 22 bytes, Stack size 8 bytes, llc_disconnect.o(.text)) +

    [Stack]

    • Max Depth = 316
    • Call Chain = llc_ll_terminate_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_llcp_send +
    +
    [Called By]
    • >>   llc_disconnect_proc_fsm +
    + +

    llc_ver_exch_proc_fsm (Thumb, 112 bytes, Stack size 24 bytes, llc_ver_exch.o(.text)) +

    [Stack]

    • Max Depth = 348
    • Call Chain = llc_ver_exch_proc_fsm ⇒ llc_llcp_version_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   le_rd_rem_ver_info_cmp_evt +
    • >>   llc_llcp_version_ind_pdu_send +
    • >>   llc_proc_unreg +
    • >>   llc_proc_timer_set +
    +
    [Called By]
    • >>   ll_version_ind_handler +
    • >>   llc_op_ver_exch_ind_cb +
    • >>   llc_ver_exch_proc_err +
    + +

    llc_llcp_version_ind_pdu_send (Thumb, 30 bytes, Stack size 16 bytes, llc_ver_exch.o(.text)) +

    [Stack]

    • Max Depth = 324
    • Call Chain = llc_llcp_version_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_llcp_send +
    +
    [Called By]
    • >>   ll_version_ind_handler +
    • >>   llc_ver_exch_proc_fsm +
    + +

    llc_ll_start_enc_rsp_ack_handler (Thumb, 30 bytes, Stack size 8 bytes, llc_encrypt.o(.text)) +

    [Stack]

    • Max Depth = 372
    • Call Chain = llc_ll_start_enc_rsp_ack_handler ⇒ llc_rem_encrypt_proc_fsm ⇒ llc_ll_reject_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_rem_encrypt_proc_fsm +
    +
    [Address Reference Count : 1]
    • llc_encrypt.o(.text) +
    +

    llc_ll_reject_ind_ack_handler (Thumb, 30 bytes, Stack size 8 bytes, llc_encrypt.o(.text)) +

    [Stack]

    • Max Depth = 372
    • Call Chain = llc_ll_reject_ind_ack_handler ⇒ llc_rem_encrypt_proc_fsm ⇒ llc_ll_reject_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_rem_encrypt_proc_fsm +
    +
    [Address Reference Count : 1]
    • llc_encrypt.o(.text) +
    +

    llc_rem_encrypt_proc_fsm (Thumb, 546 bytes, Stack size 40 bytes, llc_encrypt.o(.text)) +

    [Stack]

    • Max Depth = 364
    • Call Chain = llc_rem_encrypt_proc_fsm ⇒ llc_ll_reject_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   __ARM_common_switch8 +
    • >>   lld_con_tx_enc +
    • >>   lld_con_rx_enc +
    • >>   lld_con_enc_key_load +
    • >>   lld_con_data_flow_set +
    • >>   llc_ll_reject_ind_pdu_send +
    • >>   llc_iv_skd_rand_gen +
    • >>   llc_proc_unreg +
    • >>   llc_proc_timer_set +
    • >>   llc_proc_timer_pause_set +
    • >>   llc_llcp_state_set +
    • >>   llc_llcp_send +
    • >>   llc_disconnect +
    • >>   aes_encrypt +
    • >>   le_enc_chg_evt +
    • >>   le_ltk_req_evt +
    +
    [Called By]
    • >>   ll_start_enc_rsp_handler +
    • >>   ll_start_enc_req_handler +
    • >>   ll_enc_rsp_handler +
    • >>   ll_enc_req_handler +
    • >>   ll_pause_enc_rsp_handler +
    • >>   ll_pause_enc_req_handler +
    • >>   llc_rem_encrypt_proc_err +
    • >>   llc_aes_res_cb +
    • >>   llc_ll_reject_ind_ack_handler +
    • >>   llc_ll_start_enc_rsp_ack_handler +
    • >>   le_ltk_req_reply +
    + +

    llc_ll_pause_enc_rsp_ack_handler (Thumb, 30 bytes, Stack size 8 bytes, llc_encrypt.o(.text)) +

    [Stack]

    • Max Depth = 364
    • Call Chain = llc_ll_pause_enc_rsp_ack_handler ⇒ llc_loc_encrypt_proc_fsm ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_loc_encrypt_proc_fsm +
    +
    [Address Reference Count : 1]
    • llc_encrypt.o(.text) +
    +

    llc_loc_encrypt_proc_fsm (Thumb, 602 bytes, Stack size 48 bytes, llc_encrypt.o(.text)) +

    [Stack]

    • Max Depth = 356
    • Call Chain = llc_loc_encrypt_proc_fsm ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   __ARM_common_switch8 +
    • >>   lld_con_tx_enc +
    • >>   lld_con_rx_enc +
    • >>   lld_con_enc_key_load +
    • >>   lld_con_data_flow_set +
    • >>   llc_iv_skd_rand_gen +
    • >>   llc_proc_unreg +
    • >>   llc_proc_timer_set +
    • >>   llc_proc_timer_pause_set +
    • >>   llc_llcp_state_set +
    • >>   llc_llcp_send +
    • >>   llc_disconnect +
    • >>   aes_encrypt +
    • >>   le_enc_chg_evt +
    +
    [Called By]
    • >>   llc_op_encrypt_ind_cb +
    • >>   ll_start_enc_rsp_handler +
    • >>   ll_start_enc_req_handler +
    • >>   ll_enc_rsp_handler +
    • >>   ll_enc_req_handler +
    • >>   ll_pause_enc_rsp_handler +
    • >>   llc_loc_encrypt_proc_err +
    • >>   llc_aes_res_cb +
    • >>   llc_ll_pause_enc_rsp_ack_handler +
    + +

    llc_aes_res_cb (Thumb, 172 bytes, Stack size 24 bytes, llc_encrypt.o(.text)) +

    [Stack]

    • Max Depth = 388
    • Call Chain = llc_aes_res_cb ⇒ llc_rem_encrypt_proc_fsm ⇒ llc_ll_reject_ind_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_loc_encrypt_proc_fsm +
    • >>   llc_rem_encrypt_proc_fsm +
    +
    [Address Reference Count : 1]
    • llc_encrypt.o(.text) +
    +

    llc_iv_skd_rand_gen (Thumb, 12 bytes, Stack size 8 bytes, llc_encrypt.o(.text)) +

    [Stack]

    • Max Depth = 148
    • Call Chain = llc_iv_skd_rand_gen ⇒ aes_rand ⇒ aes_encrypt ⇒ aes_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   aes_rand +
    +
    [Called By]
    • >>   llc_loc_encrypt_proc_fsm +
    • >>   llc_rem_encrypt_proc_fsm +
    + +

    llc_ll_feature_pdu_send (Thumb, 58 bytes, Stack size 24 bytes, llc_feat_exch.o(.text)) +

    [Stack]

    • Max Depth = 332
    • Call Chain = llc_ll_feature_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_llcp_send +
    +
    [Called By]
    • >>   ll_slave_feature_req_handler +
    • >>   ll_feature_req_handler +
    • >>   llc_loc_feats_exch_proc_fsm +
    + +

    llc_loc_feats_exch_proc_fsm (Thumb, 114 bytes, Stack size 24 bytes, llc_feat_exch.o(.text)) +

    [Stack]

    • Max Depth = 356
    • Call Chain = llc_loc_feats_exch_proc_fsm ⇒ llc_ll_feature_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   le_rd_rem_feats_cmp_evt +
    • >>   llc_ll_feature_pdu_send +
    • >>   llc_proc_unreg +
    • >>   llc_proc_timer_set +
    +
    [Called By]
    • >>   llc_op_feats_exch_ind_cb +
    • >>   ll_feature_rsp_handler +
    • >>   llc_feats_exch_proc_err +
    + +

    llc_loc_dl_upd_proc_fsm (Thumb, 282 bytes, Stack size 40 bytes, llc_dl_upd.o(.text)) +

    [Stack]

    • Max Depth = 348
    • Call Chain = llc_loc_dl_upd_proc_fsm ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_con_data_len_update +
    • >>   le_data_len_chg_evt +
    • >>   llc_proc_unreg +
    • >>   llc_proc_timer_set +
    • >>   llc_llcp_send +
    +
    [Called By]
    • >>   llc_op_dl_upd_ind_cb +
    • >>   ll_length_rsp_handler +
    • >>   llc_dle_proc_err +
    + +

    llc_rem_dl_upd_proc (Thumb, 200 bytes, Stack size 48 bytes, llc_dl_upd.o(.text)) +

    [Stack]

    • Max Depth = 356
    • Call Chain = llc_rem_dl_upd_proc ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_con_data_len_update +
    • >>   le_data_len_chg_evt +
    • >>   llc_llcp_send +
    +
    [Called By]
    • >>   ll_length_req_handler +
    + +

    llc_con_upd_param_in_range (Thumb, 76 bytes, Stack size 12 bytes, llc_con_upd.o(.text)) +

    [Stack]

    • Max Depth = 12
    • Call Chain = llc_con_upd_param_in_range +
    +
    [Called By]
    • >>   ll_con_param_rsp_handler +
    • >>   ll_con_param_req_handler +
    • >>   ll_con_update_ind_handler +
    + +

    llc_pref_param_compute (Thumb, 256 bytes, Stack size 72 bytes, llc_con_upd.o(.text)) +

    [Stack]

    • Max Depth = 228
    • Call Chain = llc_pref_param_compute ⇒ sch_plan_req ⇒ sch_plan_offset_req ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_plan_req +
    • >>   sch_plan_chk +
    • >>   lld_con_offset_get +
    • >>   lld_con_actv_offset_compute +
    • >>   __aeabi_idivmod +
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   llc_rem_con_upd_proc_fsm +
    • >>   llc_loc_con_upd_proc_fsm +
    + +

    llc_ll_con_param_pdu_send (Thumb, 58 bytes, Stack size 40 bytes, llc_con_upd.o(.text)) +

    [Stack]

    • Max Depth = 348
    • Call Chain = llc_ll_con_param_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_llcp_send +
    +
    [Called By]
    • >>   llc_rem_con_upd_proc_fsm +
    • >>   llc_loc_con_upd_proc_fsm +
    + +

    llc_con_upd_info_send (Thumb, 216 bytes, Stack size 56 bytes, llc_con_upd.o(.text)) +

    [Stack]

    • Max Depth = 204
    • Call Chain = llc_con_upd_info_send ⇒ sch_plan_set ⇒ sch_plan_offset_req ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_plan_set +
    • >>   lld_con_offset_get +
    • >>   le_con_update_cmp_evt +
    • >>   sch_plan_rem +
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   llc_op_con_upd_ind_cb +
    • >>   llc_rem_con_upd_proc_fsm +
    • >>   llc_loc_con_upd_proc_fsm +
    + +

    lld_con_max_lat_calc (Thumb, 82 bytes, Stack size 24 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 36
    • Call Chain = lld_con_max_lat_calc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   lld_con_start +
    • >>   lld_con_sched +
    + +

    lld_con_tx_len_update (Thumb, 92 bytes, Stack size 24 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 36
    • Call Chain = lld_con_tx_len_update ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   lld_instant_proc_end +
    • >>   lld_con_tx_rate_update +
    • >>   lld_con_phys_update +
    • >>   lld_con_data_len_update +
    + +

    lld_con_evt_time_update (Thumb, 148 bytes, Stack size 24 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 36
    • Call Chain = lld_con_evt_time_update ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   lld_con_start +
    • >>   lld_instant_proc_end +
    • >>   lld_con_data_len_update +
    + +

    lld_con_cleanup (Thumb, 168 bytes, Stack size 32 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 108
    • Call Chain = lld_con_cleanup ⇒ ke_msg_send_basic ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_slice_per_remove +
    • >>   ble_buf_llcp_tx_free +
    • >>   ble_buf_acl_tx_free +
    • >>   ke_msg_send_basic +
    • >>   list_pop_front +
    • >>   ke_free +
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   lld_con_frm_cbk +
    • >>   lld_con_sched +
    • >>   lld_con_stop +
    + +

    lld_instant_proc_end (Thumb, 116 bytes, Stack size 24 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 100
    • Call Chain = lld_instant_proc_end ⇒ ke_msg_send_basic ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   lld_con_evt_time_update +
    • >>   lld_con_tx_len_update +
    • >>   ke_msg_send_basic +
    +
    [Called By]
    • >>   lld_con_pkt_rx +
    • >>   lld_con_evt_start_cbk +
    + +

    lld_con_sched (Thumb, 782 bytes, Stack size 64 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 212
    • Call Chain = lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_arb_insert +
    • >>   lld_con_cleanup +
    • >>   lld_con_max_lat_calc +
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   lld_con_frm_cbk +
    • >>   lld_con_start +
    • >>   lld_con_slave_latency +
    • >>   lld_con_evt_cancel_cbk +
    + +

    lld_con_tx_prog (Thumb, 444 bytes, Stack size 48 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 60
    • Call Chain = lld_con_tx_prog ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   lld_con_frm_cbk +
    • >>   lld_con_llcp_tx +
    • >>   lld_con_data_flow_set +
    • >>   lld_con_data_tx +
    + +

    lld_con_evt_start_cbk (Thumb, 348 bytes, Stack size 32 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 132
    • Call Chain = lld_con_evt_start_cbk ⇒ lld_instant_proc_end ⇒ ke_msg_send_basic ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_prog_push0 +
    • >>   lld_instant_proc_end +
    • >>   __aeabi_uidivmod +
    +
    [Address Reference Count : 1]
    • lld_con.o(.text) +
    +

    lld_con_evt_cancel_cbk (Thumb, 52 bytes, Stack size 8 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 220
    • Call Chain = lld_con_evt_cancel_cbk ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   slot_clock_get +
    • >>   lld_con_sched +
    +
    [Address Reference Count : 1]
    • lld_con.o(.text) +
    +

    lld_con_slave_latency (Thumb, 108 bytes, Stack size 24 bytes, lld_con.o(.text)) +

    [Stack]

    • Max Depth = 236
    • Call Chain = lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   slot_clock_get +
    • >>   sch_arb_remove +
    • >>   lld_con_sched +
    +
    [Called By]
    • >>   lld_con_llcp_tx +
    • >>   lld_con_data_flow_set +
    • >>   lld_con_data_tx +
    + +

    sch_arb_conflict_check (Thumb, 212 bytes, Stack size 32 bytes, sch_arb.o(.text)) +

    [Stack]

    • Max Depth = 60
    • Call Chain = sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   __aeabi_idivmod +
    +
    [Called By]
    • >>   sch_arb_elt_cancel +
    • >>   sch_arb_insert +
    + +

    sch_arb_elt_cancel (Thumb, 258 bytes, Stack size 40 bytes, sch_arb.o(.text)) +

    [Stack]

    • Max Depth = 100
    • Call Chain = sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_arb_conflict_check +
    • >>   list_insert_after +
    • >>   list_extract_after +
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   sch_arb_insert +
    + +

    sch_arb_prog_timer (Thumb, 96 bytes, Stack size 32 bytes, sch_arb.o(.text)) +

    [Stack]

    • Max Depth = 40
    • Call Chain = sch_arb_prog_timer ⇒ ble_timer_hus_set +
    +
    [Calls]
    • >>   slot_time_get +
    • >>   ble_timer_hus_set +
    +
    [Called By]
    • >>   sch_arb_evt_isr +
    • >>   sch_arb_remove +
    • >>   sch_arb_insert +
    + +

    sch_plan_offset_req (Thumb, 622 bytes, Stack size 96 bytes, sch_plan.o(.text)) +

    [Stack]

    • Max Depth = 124
    • Call Chain = sch_plan_offset_req ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   slot_clock_get +
    • >>   __aeabi_idivmod +
    • >>   __aeabi_uidivmod +
    +
    [Called By]
    • >>   sch_plan_set +
    • >>   sch_plan_req +
    • >>   sch_plan_chk +
    + +

    gatt_op_cmd_handler (Thumb, 678 bytes, Stack size 32 bytes, gattc_task.o(.text)) +

    [Stack]

    • Max Depth = 156
    • Call Chain = gatt_op_cmd_handler ⇒ gattc_process_op_simple ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   __ARM_common_switch8 +
    • >>   l2cc_att_pdu_alloc +
    • >>   gatt_get_mtu +
    • >>   gattc_send_complete_evt +
    • >>   attm_uuid32_conv +
    • >>   ke_msg_send +
    • >>   attc_send_att_req +
    • >>   gattc_process_op_simple +
    +
    [Address Reference Count : 1]
    • gattc_task.o(le_task_hdl_func) +
    +

    gatt_event_cfm_handler (Thumb, 24 bytes, Stack size 8 bytes, gattc_task.o(.text)) +

    [Stack]

    • Max Depth = 100
    • Call Chain = gatt_event_cfm_handler ⇒ attc_send_hdl_cfm ⇒ l2cc_att_pdu_alloc ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_state_get +
    • >>   attc_send_hdl_cfm +
    +
    [Address Reference Count : 1]
    • gattc_task.o(le_task_hdl_func) +
    +

    gatt_send_evt_cmd_handler (Thumb, 72 bytes, Stack size 16 bytes, gattc_task.o(.text)) +

    [Stack]

    • Max Depth = 140
    • Call Chain = gatt_send_evt_cmd_handler ⇒ gattc_process_op_simple ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   atts_send_event +
    • >>   atts_clear_read_cache +
    • >>   gattc_send_complete_evt +
    • >>   gattc_process_op_simple +
    +
    [Address Reference Count : 1]
    • gattc_task.o(le_task_hdl_func) +
    +

    gatt_op_cfm_handler (Thumb, 252 bytes, Stack size 24 bytes, gattc_task.o(.text)) +

    [Stack]

    • Max Depth = 132
    • Call Chain = gatt_op_cfm_handler ⇒ atts_write_rsp_send ⇒ atts_send_error ⇒ l2cc_att_pdu_alloc ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   atts_write_rsp_send +
    • >>   atts_send_error +
    • >>   atts_clear_read_cache +
    • >>   atts_clear_prep_data +
    • >>   list_pop_front +
    • >>   ke_free +
    • >>   ke_state_get +
    • >>   atts_process_pdu +
    +
    [Address Reference Count : 1]
    • gattc_task.o(le_task_hdl_func) +
    +

    gatt_timeout_handler (Thumb, 92 bytes, Stack size 40 bytes, gattc_task.o(.text)) +

    [Stack]

    • Max Depth = 148
    • Call Chain = gatt_timeout_handler ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gattc_send_complete_evt +
    • >>   ke_msg_send_basic +
    • >>   ke_state_get +
    +
    [Address Reference Count : 1]
    • gattc_task.o(le_task_hdl_func) +
    +

    l2cc_pdu_recv_ind_handler (Thumb, 114 bytes, Stack size 16 bytes, gattc_task.o(.text)) +

    [Stack]

    • Max Depth = 148
    • Call Chain = l2cc_pdu_recv_ind_handler ⇒ atts_pdu_recv_handler ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   atts_pdu_recv_handler +
    • >>   atts_send_error +
    • >>   ble_buf_rx_free +
    • >>   ke_state_get +
    • >>   attc_pdu_recv_handler +
    +
    [Address Reference Count : 1]
    • gattc_task.o(le_task_hdl_func) +
    +

    gapm_actv_free (Thumb, 36 bytes, Stack size 8 bytes, gapm_actv.o(.text)) +

    [Stack]

    • Max Depth = 28
    • Call Chain = gapm_actv_free ⇒ ke_free +
    +
    [Calls]
    • >>   ke_free +
    +
    [Called By]
    • >>   gapm_actv_reset +
    • >>   gapm_actv_deleted +
    • >>   gapm_actv_created +
    + +

    llc_llcp_trans_timer_set (Thumb, 70 bytes, Stack size 8 bytes, llc.o(.text)) +

    [Stack]

    • Max Depth = 92
    • Call Chain = llc_llcp_trans_timer_set ⇒ ke_timer_set ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_timer_clear +
    • >>   ke_timer_set +
    +
    [Called By]
    • >>   llc_proc_timer_set +
    • >>   llc_proc_timer_pause_set +
    • >>   llc_cleanup +
    + +

    ll_reject_ind_handler (Thumb, 32 bytes, Stack size 16 bytes, llc_llcp.o(.text)) +

    [Stack]

    • Max Depth = 428
    • Call Chain = ll_reject_ind_handler ⇒ llc_proc_err_ind ⇒ llc_rem_con_upd_proc_err ⇒ llc_rem_con_upd_proc_fsm ⇒ llc_ll_con_param_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_proc_err_ind +
    +
    [Address Reference Count : 1]
    • llc_llcp.o(.constdata) +
    +

    ll_reject_ext_ind_handler (Thumb, 32 bytes, Stack size 16 bytes, llc_llcp.o(.text)) +

    [Stack]

    • Max Depth = 428
    • Call Chain = ll_reject_ext_ind_handler ⇒ llc_proc_err_ind ⇒ llc_rem_con_upd_proc_err ⇒ llc_rem_con_upd_proc_fsm ⇒ llc_ll_con_param_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_proc_err_ind +
    +
    [Address Reference Count : 1]
    • llc_llcp.o(.constdata) +
    +

    ll_unknown_rsp_handler (Thumb, 16 bytes, Stack size 8 bytes, llc_llcp.o(.text)) +

    [Stack]

    • Max Depth = 420
    • Call Chain = ll_unknown_rsp_handler ⇒ llc_proc_err_ind ⇒ llc_rem_con_upd_proc_err ⇒ llc_rem_con_upd_proc_fsm ⇒ llc_ll_con_param_pdu_send ⇒ llc_llcp_send ⇒ llc_llcp_tx_check ⇒ lld_con_llcp_tx ⇒ lld_con_slave_latency ⇒ lld_con_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   llc_proc_err_ind +
    +
    [Address Reference Count : 1]
    • llc_llcp.o(.constdata) +
    +

    lld_adv_end (Thumb, 100 bytes, Stack size 32 bytes, lld_adv.o(.text)) +

    [Stack]

    • Max Depth = 204
    • Call Chain = lld_adv_end ⇒ sch_slice_fg_remove ⇒ lld_scan_restart ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_slice_fg_remove +
    • >>   sch_arb_remove +
    • >>   ke_free +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   lld_adv_frm_cbk +
    • >>   lld_adv_stop +
    • >>   lld_adv_evt_cancel_cbk +
    + +

    lld_adv_data_set (Thumb, 106 bytes, Stack size 24 bytes, lld_adv.o(.text)) +

    [Stack]

    • Max Depth = 24
    • Call Chain = lld_adv_data_set +
    +
    [Calls]
    • >>   ble_buf_adv_tx_free +
    • >>   ble_buf_adv_tx_elt_get +
    +
    [Called By]
    • >>   lld_adv_frm_cbk +
    • >>   lld_adv_data_update +
    • >>   lld_adv_start +
    + +

    lld_adv_evt_start_cbk (Thumb, 56 bytes, Stack size 16 bytes, lld_adv.o(.text)) +

    [Stack]

    • Max Depth = 68
    • Call Chain = lld_adv_evt_start_cbk ⇒ sch_prog_push0 ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_prog_push0 +
    +
    [Address Reference Count : 1]
    • lld_adv.o(.text) +
    +

    lld_adv_evt_cancel_cbk (Thumb, 132 bytes, Stack size 16 bytes, lld_adv.o(.text)) +

    [Stack]

    • Max Depth = 220
    • Call Chain = lld_adv_evt_cancel_cbk ⇒ lld_adv_end ⇒ sch_slice_fg_remove ⇒ lld_scan_restart ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   rand +
    • >>   sch_arb_insert +
    • >>   __aeabi_uidivmod +
    • >>   lld_adv_end +
    +
    [Address Reference Count : 1]
    • lld_adv.o(.text) +
    +

    lld_scan_end (Thumb, 138 bytes, Stack size 16 bytes, lld_scan.o(.text)) +

    [Stack]

    • Max Depth = 84
    • Call Chain = lld_scan_end ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_slice_compute +
    • >>   sch_arb_remove +
    • >>   ke_free +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   lld_scan_frm_cbk +
    • >>   lld_scan_stop +
    • >>   lld_scan_sched +
    + +

    lld_scan_sched (Thumb, 322 bytes, Stack size 40 bytes, lld_scan.o(.text)) +

    [Stack]

    • Max Depth = 188
    • Call Chain = lld_scan_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_slice_compute +
    • >>   slot_clock_get +
    • >>   sch_arb_insert +
    • >>   lld_scan_end +
    +
    [Called By]
    • >>   lld_scan_frm_cbk +
    + +

    lld_scan_evt_start_cbk (Thumb, 34 bytes, Stack size 16 bytes, lld_scan.o(.text)) +

    [Stack]

    • Max Depth = 68
    • Call Chain = lld_scan_evt_start_cbk ⇒ sch_prog_push0 ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_slice_compute +
    • >>   sch_prog_push0 +
    +
    [Address Reference Count : 1]
    • lld_scan.o(.text) +
    +

    lld_scan_evt_cancel_cbk (Thumb, 50 bytes, Stack size 8 bytes, lld_scan.o(.text)) +

    [Stack]

    • Max Depth = 156
    • Call Chain = lld_scan_evt_cancel_cbk ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   slot_clock_get +
    • >>   sch_arb_insert +
    +
    [Address Reference Count : 1]
    • lld_scan.o(.text) +
    +

    lld_init_end (Thumb, 142 bytes, Stack size 16 bytes, lld_init.o(.text)) +

    [Stack]

    • Max Depth = 84
    • Call Chain = lld_init_end ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_slice_compute +
    • >>   sch_arb_remove +
    • >>   ke_free +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Called By]
    • >>   lld_init_frm_cbk +
    • >>   lld_init_pkt_tx +
    • >>   lld_init_stop +
    + +

    lld_init_sched (Thumb, 170 bytes, Stack size 32 bytes, lld_init.o(.text)) +

    [Stack]

    • Max Depth = 180
    • Call Chain = lld_init_sched ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_slice_compute +
    • >>   slot_clock_get +
    • >>   sch_arb_insert +
    +
    [Called By]
    • >>   lld_init_frm_cbk +
    + +

    lld_init_evt_start_cbk (Thumb, 100 bytes, Stack size 32 bytes, lld_init.o(.text)) +

    [Stack]

    • Max Depth = 84
    • Call Chain = lld_init_evt_start_cbk ⇒ sch_prog_push0 ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   sch_slice_compute +
    • >>   sch_prog_push0 +
    • >>   __aeabi_uidivmod +
    +
    [Address Reference Count : 1]
    • lld_init.o(.text) +
    +

    lld_init_evt_cancel_cbk (Thumb, 50 bytes, Stack size 8 bytes, lld_init.o(.text)) +

    [Stack]

    • Max Depth = 156
    • Call Chain = lld_init_evt_cancel_cbk ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   slot_clock_get +
    • >>   sch_arb_insert +
    +
    [Address Reference Count : 1]
    • lld_init.o(.text) +
    +

    sch_alarm_prog (Thumb, 78 bytes, Stack size 16 bytes, sch_alarm.o(.text)) +

    [Stack]

    • Max Depth = 16
    • Call Chain = sch_alarm_prog +
    +
    [Calls]
    • >>   slot_time_get +
    • >>   ble_timer_hs_set +
    +
    [Called By]
    • >>   sch_alarm_timer_isr +
    • >>   sch_alarm_clear +
    • >>   sch_alarm_set +
    + +

    l2cc_pdu_send_cmd_handler (Thumb, 62 bytes, Stack size 24 bytes, l2cc_task.o(.text)) +

    [Stack]

    • Max Depth = 156
    • Call Chain = l2cc_pdu_send_cmd_handler ⇒ l2cc_send_cmp_evt_status ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   l2cc_send_cmp_evt_status +
    • >>   l2cm_tx_status +
    • >>   list_push_back +
    • >>   ke_state_get +
    +
    [Address Reference Count : 1]
    • l2cc_task.o(le_task_hdl_func) +
    +

    l2cc_acl_data_handler (Thumb, 190 bytes, Stack size 48 bytes, l2cc_task.o(.text)) +

    [Stack]

    • Max Depth = 180
    • Call Chain = l2cc_acl_data_handler ⇒ l2cc_pdu_header_check ⇒ l2cc_ind_pdu_alloc ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ble_buf_rx_free +
    • >>   ke_state_get +
    • >>   ke_msg_send +
    • >>   l2cc_pdu_header_check +
    • >>   l2cc_pdu_rx_init +
    • >>   l2cc_pdu_unpack +
    +
    [Address Reference Count : 1]
    • l2cc_task.o(le_task_hdl_func) +
    +

    l2cc_pdu_recv_ind_handler (Thumb, 76 bytes, Stack size 16 bytes, l2cc_task.o(.text)) +

    [Stack]

    • Max Depth = 144
    • Call Chain = l2cc_pdu_recv_ind_handler ⇒ l2cc_sig_pdu_recv_handler ⇒ l2c_code_con_param_upd_rsp_handler ⇒ gapc_send_complete_evt ⇒ gapc_operation_cleanup ⇒ gapc_smp_cleanup ⇒ gapc_smp_clear_timeout_timer ⇒ ke_timer_clear ⇒ ke_time_past +
    +
    [Calls]
    • >>   l2cc_sig_pdu_recv_handler +
    • >>   l2cc_sig_send_cmd_reject +
    • >>   ke_state_get +
    +
    [Address Reference Count : 1]
    • l2cc_task.o(le_task_hdl_func) +
    +

    gapm_smp_use_enc_block_cb (Thumb, 72 bytes, Stack size 16 bytes, gapm_smp.o(.text)) +

    [Stack]

    • Max Depth = 120
    • Call Chain = gapm_smp_use_enc_block_cb ⇒ gapm_send_complete_evt ⇒ gapm_operation_cleanup ⇒ gapm_update_state ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   gapm_send_complete_evt +
    • >>   ke_state_get +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Address Reference Count : 1]
    • gapm_smp.o(.text) +
    +

    gapm_smp_gen_rand_addr_cb (Thumb, 166 bytes, Stack size 56 bytes, gapm_smp.o(.text)) +

    [Stack]

    • Max Depth = 160
    • Call Chain = gapm_smp_gen_rand_addr_cb ⇒ gapm_send_complete_evt ⇒ gapm_operation_cleanup ⇒ gapm_update_state ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   gapm_send_complete_evt +
    • >>   aes_encrypt +
    • >>   ke_state_get +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Address Reference Count : 1]
    • gapm_smp.o(.text) +
    +

    gapm_smp_gen_rand_nb_cb (Thumb, 70 bytes, Stack size 16 bytes, gapm_smp.o(.text)) +

    [Stack]

    • Max Depth = 120
    • Call Chain = gapm_smp_gen_rand_nb_cb ⇒ gapm_send_complete_evt ⇒ gapm_operation_cleanup ⇒ gapm_update_state ⇒ ke_state_set ⇒ list_extract_given +
    +
    [Calls]
    • >>   gapm_send_complete_evt +
    • >>   ke_state_get +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Address Reference Count : 1]
    • gapm_smp.o(.text) +
    +

    gapm_adv_send_en_cmd (Thumb, 58 bytes, Stack size 16 bytes, gapm_adv.o(.text)) +

    [Stack]

    • Max Depth = 252
    • Call Chain = gapm_adv_send_en_cmd ⇒ le_set_ext_adv_en ⇒ lld_adv_stop ⇒ lld_adv_end ⇒ sch_slice_fg_remove ⇒ lld_scan_restart ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   le_set_ext_adv_en +
    • >>   le_actv_cmp_send +
    +
    [Called By]
    • >>   gapm_adv_stop +
    • >>   gapm_adv_start +
    + +

    gapm_adv_set_data (Thumb, 72 bytes, Stack size 16 bytes, gapm_adv.o(.text)) +

    [Stack]

    • Max Depth = 116
    • Call Chain = gapm_adv_set_data ⇒ gapm_adv_send_data_cmd ⇒ le_actv_cmp_send ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapm_adv_send_data_cmd +
    +
    [Called By]
    • >>   gapm_set_adv_data_cmd_handler +
    • >>   gapm_actv_adv_fsm +
    + +

    gapm_adv_start (Thumb, 20 bytes, Stack size 8 bytes, gapm_adv.o(.text)) +

    [Stack]

    • Max Depth = 260
    • Call Chain = gapm_adv_start ⇒ gapm_adv_send_en_cmd ⇒ le_set_ext_adv_en ⇒ lld_adv_stop ⇒ lld_adv_end ⇒ sch_slice_fg_remove ⇒ lld_scan_restart ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapm_adv_send_en_cmd +
    +
    [Address Reference Count : 1]
    • gapm_adv.o(.text) +
    +

    gapm_adv_stop (Thumb, 22 bytes, Stack size 0 bytes, gapm_adv.o(.text)) +

    [Stack]

    • Max Depth = 252
    • Call Chain = gapm_adv_stop ⇒ gapm_adv_send_en_cmd ⇒ le_set_ext_adv_en ⇒ lld_adv_stop ⇒ lld_adv_end ⇒ sch_slice_fg_remove ⇒ lld_scan_restart ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapm_adv_send_en_cmd +
    +
    [Address Reference Count : 1]
    • gapm_adv.o(.text) +
    +

    gapm_adv_delete (Thumb, 34 bytes, Stack size 8 bytes, gapm_adv.o(.text)) +

    [Stack]

    • Max Depth = 84
    • Call Chain = gapm_adv_delete ⇒ le_actv_cmp_send ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   le_rmv_adv_set +
    • >>   le_actv_cmp_send +
    +
    [Address Reference Count : 1]
    • gapm_adv.o(.text) +
    +

    gapm_adv_send_param_cmd (Thumb, 128 bytes, Stack size 24 bytes, gapm_adv.o(.text)) +

    [Stack]

    • Max Depth = 100
    • Call Chain = gapm_adv_send_param_cmd ⇒ le_actv_cmp_send ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_malloc +
    • >>   ke_free +
    • >>   le_set_ext_adv_param +
    • >>   le_actv_cmp_send +
    • >>   gapm_actv_get_own_addr_type +
    +
    [Called By]
    • >>   gapm_adv_create +
    + +

    gapm_adv_send_data_cmd (Thumb, 110 bytes, Stack size 24 bytes, gapm_adv.o(.text)) +

    [Stack]

    • Max Depth = 100
    • Call Chain = gapm_adv_send_data_cmd ⇒ le_actv_cmp_send ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   le_set_ext_adv_data +
    • >>   le_actv_cmp_send +
    +
    [Called By]
    • >>   gapm_adv_set_data +
    + +

    gapm_scan_send_en_cmd (Thumb, 76 bytes, Stack size 24 bytes, gapm_scan.o(.text)) +

    [Stack]

    • Max Depth = 236
    • Call Chain = gapm_scan_send_en_cmd ⇒ le_set_ext_scan_en ⇒ lld_scan_start ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   le_set_ext_scan_en +
    • >>   le_actv_cmp_send +
    +
    [Called By]
    • >>   gapm_scan_stop +
    • >>   gapm_actv_scan_fsm +
    + +

    gapm_scan_start (Thumb, 44 bytes, Stack size 8 bytes, gapm_scan.o(.text)) +

    [Stack]

    • Max Depth = 108
    • Call Chain = gapm_scan_start ⇒ gapm_scan_send_param_cmd ⇒ le_actv_cmp_send ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapm_scan_send_param_cmd +
    +
    [Address Reference Count : 1]
    • gapm_scan.o(.text) +
    +

    gapm_scan_stop (Thumb, 12 bytes, Stack size 0 bytes, gapm_scan.o(.text)) +

    [Stack]

    • Max Depth = 236
    • Call Chain = gapm_scan_stop ⇒ gapm_scan_send_en_cmd ⇒ le_set_ext_scan_en ⇒ lld_scan_start ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gapm_scan_send_en_cmd +
    +
    [Address Reference Count : 1]
    • gapm_scan.o(.text) +
    +

    gapm_scan_send_param_cmd (Thumb, 126 bytes, Stack size 24 bytes, gapm_scan.o(.text)) +

    [Stack]

    • Max Depth = 100
    • Call Chain = gapm_scan_send_param_cmd ⇒ le_actv_cmp_send ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_malloc +
    • >>   ke_free +
    • >>   le_set_ext_scan_param +
    • >>   le_actv_cmp_send +
    • >>   gapm_actv_get_own_addr_type +
    +
    [Called By]
    • >>   gapm_scan_start +
    + +

    gapm_init_start (Thumb, 56 bytes, Stack size 16 bytes, gapm_init.o(.text)) +

    [Stack]

    • Max Depth = 340
    • Call Chain = gapm_init_start ⇒ gapm_init_send_en_cmd ⇒ le_ext_create_con ⇒ lld_init_start ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_timer_set +
    • >>   gapm_init_send_en_cmd +
    +
    [Address Reference Count : 1]
    • gapm_init.o(.text) +
    +

    gapm_init_stop (Thumb, 38 bytes, Stack size 16 bytes, gapm_init.o(.text)) +

    [Stack]

    • Max Depth = 124
    • Call Chain = gapm_init_stop ⇒ le_create_con_cancel ⇒ lld_init_stop ⇒ lld_init_end ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_timer_clear +
    • >>   le_create_con_cancel +
    • >>   le_actv_cmp_send +
    +
    [Address Reference Count : 1]
    • gapm_init.o(.text) +
    +

    gapm_init_send_en_cmd (Thumb, 124 bytes, Stack size 24 bytes, gapm_init.o(.text)) +

    [Stack]

    • Max Depth = 324
    • Call Chain = gapm_init_send_en_cmd ⇒ le_ext_create_con ⇒ lld_init_start ⇒ sch_arb_insert ⇒ sch_arb_elt_cancel ⇒ sch_arb_conflict_check ⇒ __aeabi_idivmod ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_malloc +
    • >>   ke_free +
    • >>   le_ext_create_con +
    • >>   le_actv_cmp_send +
    • >>   gapm_actv_get_own_addr_type +
    +
    [Called By]
    • >>   gapm_init_start +
    + +

    attc_exc_mtu_rsp (Thumb, 58 bytes, Stack size 8 bytes, attc.o(.text)) +

    [Stack]

    • Max Depth = 116
    • Call Chain = attc_exc_mtu_rsp ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gatt_set_mtu +
    • >>   gattc_send_complete_evt +
    +
    [Address Reference Count : 1]
    • attc.o(.constdata) +
    +

    attc_find_info_rsp (Thumb, 196 bytes, Stack size 40 bytes, attc.o(.text)) +

    [Stack]

    • Max Depth = 148
    • Call Chain = attc_find_info_rsp ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gattc_send_complete_evt +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Address Reference Count : 1]
    • attc.o(.constdata) +
    +

    attc_find_by_type_rsp (Thumb, 188 bytes, Stack size 40 bytes, attc.o(.text)) +

    [Stack]

    • Max Depth = 148
    • Call Chain = attc_find_by_type_rsp ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gattc_send_complete_evt +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Address Reference Count : 1]
    • attc.o(.constdata) +
    +

    attc_rd_by_type_rsp (Thumb, 644 bytes, Stack size 64 bytes, attc.o(.text)) +

    [Stack]

    • Max Depth = 172
    • Call Chain = attc_rd_by_type_rsp ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   attm_uuid_comp +
    • >>   l2cc_att_pdu_alloc +
    • >>   gatt_get_mtu +
    • >>   gattc_send_complete_evt +
    • >>   list_push_back +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    • >>   attc_send_att_req +
    +
    [Address Reference Count : 1]
    • attc.o(.constdata) +
    +

    attc_rd_by_grp_type_rsp (Thumb, 258 bytes, Stack size 48 bytes, attc.o(.text)) +

    [Stack]

    • Max Depth = 156
    • Call Chain = attc_rd_by_grp_type_rsp ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   attm_uuid_comp +
    • >>   gattc_send_complete_evt +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    • >>   __aeabi_uidivmod +
    +
    [Address Reference Count : 1]
    • attc.o(.constdata) +
    +

    attc_rd_rsp (Thumb, 232 bytes, Stack size 32 bytes, attc.o(.text)) +

    [Stack]

    • Max Depth = 140
    • Call Chain = attc_rd_rsp ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gatt_get_mtu +
    • >>   gattc_send_complete_evt +
    • >>   list_push_back +
    • >>   list_pop_front +
    • >>   ke_msg_send +
    • >>   attc_send_read_ind +
    +
    [Address Reference Count : 1]
    • attc.o(.constdata) +
    +

    attc_rd_mult_rsp (Thumb, 204 bytes, Stack size 48 bytes, attc.o(.text)) +

    [Stack]

    • Max Depth = 156
    • Call Chain = attc_rd_mult_rsp ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gattc_send_complete_evt +
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Address Reference Count : 1]
    • attc.o(.constdata) +
    +

    attc_wr_rsp (Thumb, 36 bytes, Stack size 8 bytes, attc.o(.text)) +

    [Stack]

    • Max Depth = 116
    • Call Chain = attc_wr_rsp ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gattc_send_complete_evt +
    +
    [Address Reference Count : 1]
    • attc.o(.constdata) +
    +

    attc_prep_wr_rsp (Thumb, 98 bytes, Stack size 24 bytes, attc.o(.text)) +

    [Stack]

    • Max Depth = 132
    • Call Chain = attc_prep_wr_rsp ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gattc_send_complete_evt +
    • >>   ke_msg_send +
    +
    [Address Reference Count : 1]
    • attc.o(.constdata) +
    +

    attc_exe_wr_rsp (Thumb, 54 bytes, Stack size 8 bytes, attc.o(.text)) +

    [Stack]

    • Max Depth = 116
    • Call Chain = attc_exe_wr_rsp ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gattc_send_complete_evt +
    +
    [Address Reference Count : 1]
    • attc.o(.constdata) +
    +

    attc_hdl_val_ntf_ind (Thumb, 90 bytes, Stack size 16 bytes, attc.o(.text)) +

    [Stack]

    • Max Depth = 84
    • Call Chain = attc_hdl_val_ntf_ind ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   ke_msg_send +
    • >>   ke_msg_alloc +
    +
    [Address Reference Count : 1]
    • attc.o(.constdata) +
    +

    attc_err_rsp (Thumb, 46 bytes, Stack size 16 bytes, attc.o(.text)) +

    [Stack]

    • Max Depth = 124
    • Call Chain = attc_err_rsp ⇒ gattc_send_complete_evt ⇒ gattc_send_cmp_evt ⇒ ke_msg_alloc ⇒ ke_malloc ⇒ __aeabi_uidivmod +
    +
    [Calls]
    • >>   gattc_send_complete_evt +
    • >>   ke_msg_send_basic +
    +
    [Address Reference Count : 1]
    • attc.o(.constdata) +
    +

    llm_adv_set_release (Thumb, 54 bytes, Stack size 24 bytes, llm_adv.o(.text)) +

    [Stack]

    • Max Depth = 44
    • Call Chain = llm_adv_set_release ⇒ ke_free +
    +
    [Calls]
    • >>   ble_buf_adv_tx_free +
    • >>   ke_free +
    +
    [Called By]
    • >>   le_rmv_adv_set +
    + +

    _printf_core (Thumb, 1020 bytes, Stack size 104 bytes, printf8.o(i._printf_core), UNUSED) +

    [Calls]

    • >>   __aeabi_uldivmod +
    • >>   _printf_pre_padding +
    • >>   _printf_post_padding +
    +
    [Called By]
    • >>   __0printf$8 +
    + +

    _printf_post_padding (Thumb, 32 bytes, Stack size 24 bytes, printf8.o(i._printf_post_padding), UNUSED) +

    [Called By]

    • >>   _printf_core +
    + +

    _printf_pre_padding (Thumb, 44 bytes, Stack size 40 bytes, printf8.o(i._printf_pre_padding), UNUSED) +

    [Called By]

    • >>   _printf_core +
    +

    +

    +Undefined Global Symbols +


    diff --git a/projects/bleUart/mdk/output/bleUart.lnp b/projects/bleUart/mdk/output/bleUart.lnp new file mode 100644 index 0000000..4ce7710 --- /dev/null +++ b/projects/bleUart/mdk/output/bleUart.lnp @@ -0,0 +1,23 @@ +--cpu Cortex-M0 +".\output\startup.o" +".\output\main.o" +".\output\myapp.o" +".\output\proc.o" +"..\..\..\drivers\lib\drvs.lib" +".\output\leds.o" +".\output\sftmr.o" +".\output\uart1rb.o" +".\output\app.o" +".\output\app_actv.o" +".\output\app_msg.o" +".\output\app_gapm.o" +".\output\app_gapc.o" +".\output\app_gatt.o" +".\output\prf_diss.o" +".\output\prf_sess.o" +"..\..\..\ble\lib\ble6.lib" +".\output\debug.o" +--library_type=microlib --strict --scatter "..\..\..\core\mdk\link_xip_ble.sct" +--diag_suppress=L6312,L6314,L6329 --summary_stderr --info summarysizes --map --callgraph --symbols +--info sizes --info totals +--list ".\output\bleUart.map" -o .\output\bleUart.axf \ No newline at end of file diff --git a/projects/bleUart/mdk/output/bleUart.map b/projects/bleUart/mdk/output/bleUart.map new file mode 100644 index 0000000..21d4ebb --- /dev/null +++ b/projects/bleUart/mdk/output/bleUart.map @@ -0,0 +1,1695 @@ +Component: ARM Compiler 5.05 update 2 (build 169) Tool: armlink [4d0f33] + +============================================================================== + +Image Symbol Table + + Local Symbols + + Symbol Name Value Ov Type Size Object(Section) + + ../clib/microlib/division.c 0x00000000 Number 0 uidiv.o ABSOLUTE + ../clib/microlib/division.c 0x00000000 Number 0 uldiv.o ABSOLUTE + ../clib/microlib/division.c 0x00000000 Number 0 idiv.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry5.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry7a.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry7b.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry8a.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry8b.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry2.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry9a.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry9b.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry10a.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry10b.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry11a.o ABSOLUTE + ../clib/microlib/init/entry.s 0x00000000 Number 0 entry11b.o ABSOLUTE + ../clib/microlib/longlong.c 0x00000000 Number 0 llsshr.o ABSOLUTE + ../clib/microlib/longlong.c 0x00000000 Number 0 llshl.o ABSOLUTE + ../clib/microlib/longlong.c 0x00000000 Number 0 llushr.o ABSOLUTE + ../clib/microlib/printf/printf.c 0x00000000 Number 0 printfb.o ABSOLUTE + ../clib/microlib/printf/printf.c 0x00000000 Number 0 printf0.o ABSOLUTE + ../clib/microlib/printf/printf.c 0x00000000 Number 0 printf1.o ABSOLUTE + ../clib/microlib/printf/printf.c 0x00000000 Number 0 printf2.o ABSOLUTE + ../clib/microlib/printf/printf.c 0x00000000 Number 0 printf3.o ABSOLUTE + ../clib/microlib/printf/printf.c 0x00000000 Number 0 printf4.o ABSOLUTE + ../clib/microlib/printf/printf.c 0x00000000 Number 0 printf5.o ABSOLUTE + ../clib/microlib/printf/printf.c 0x00000000 Number 0 printf6.o ABSOLUTE + ../clib/microlib/printf/printf.c 0x00000000 Number 0 printf7.o ABSOLUTE + ../clib/microlib/printf/printf.c 0x00000000 Number 0 printf8.o ABSOLUTE + ../clib/microlib/printf/printf.c 0x00000000 Number 0 printfa.o ABSOLUTE + ../clib/microlib/printf/stubs.s 0x00000000 Number 0 stubs.o ABSOLUTE + ../clib/microlib/stdio/streams.c 0x00000000 Number 0 stdout.o ABSOLUTE + ../clib/microlib/stubs.s 0x00000000 Number 0 iusefp.o ABSOLUTE + ../fplib/microlib/fpadd.c 0x00000000 Number 0 dadd.o ABSOLUTE + ../fplib/microlib/fpdiv.c 0x00000000 Number 0 ddiv.o ABSOLUTE + ../fplib/microlib/fpepilogue.c 0x00000000 Number 0 depilogue.o ABSOLUTE + ../fplib/microlib/fpfix.c 0x00000000 Number 0 dfixul.o ABSOLUTE + ../fplib/microlib/fpmul.c 0x00000000 Number 0 dmul.o ABSOLUTE + ..\..\..\ble\app\app.c 0x00000000 Number 0 app.o ABSOLUTE + ..\..\..\ble\app\app_actv.c 0x00000000 Number 0 app_actv.o ABSOLUTE + ..\..\..\ble\app\app_gapc.c 0x00000000 Number 0 app_gapc.o ABSOLUTE + ..\..\..\ble\app\app_gapm.c 0x00000000 Number 0 app_gapm.o ABSOLUTE + ..\..\..\ble\app\app_gatt.c 0x00000000 Number 0 app_gatt.o ABSOLUTE + ..\..\..\ble\app\app_msg.c 0x00000000 Number 0 app_msg.o ABSOLUTE + ..\..\..\ble\prf\prf_diss.c 0x00000000 Number 0 prf_diss.o ABSOLUTE + ..\..\..\ble\prf\prf_sess.c 0x00000000 Number 0 prf_sess.o ABSOLUTE + ..\..\..\core\mdk\startup.s 0x00000000 Number 0 startup.o ABSOLUTE + ..\..\..\modules\src\debug.c 0x00000000 Number 0 debug.o ABSOLUTE + ..\..\..\modules\src\leds.c 0x00000000 Number 0 leds.o ABSOLUTE + ..\..\..\modules\src\sftmr.c 0x00000000 Number 0 sftmr.o ABSOLUTE + ..\..\..\modules\src\uart1Rb.c 0x00000000 Number 0 uart1rb.o ABSOLUTE + ..\\..\\..\\ble\\app\\app.c 0x00000000 Number 0 app.o ABSOLUTE + ..\\..\\..\\ble\\app\\app_msg.c 0x00000000 Number 0 app_msg.o ABSOLUTE + ..\\..\\..\\modules\\src\\sftmr.c 0x00000000 Number 0 sftmr.o ABSOLUTE + ..\\..\\..\\modules\\src\\uart1Rb.c 0x00000000 Number 0 uart1rb.o ABSOLUTE + ..\\src\\main.c 0x00000000 Number 0 main.o ABSOLUTE + ..\\src\\myapp.c 0x00000000 Number 0 myapp.o ABSOLUTE + ..\\src\\proc.c 0x00000000 Number 0 proc.o ABSOLUTE + ..\src\core.c 0x00000000 Number 0 core.o ABSOLUTE + ..\src\ip\ble\hl\src\gap\gapc\gapc.c 0x00000000 Number 0 gapc.o ABSOLUTE + ..\src\ip\ble\hl\src\gap\gapc\gapc_hci.c 0x00000000 Number 0 gapc_hci.o ABSOLUTE + ..\src\ip\ble\hl\src\gap\gapc\gapc_smp.c 0x00000000 Number 0 gapc_smp.o ABSOLUTE + ..\src\ip\ble\hl\src\gap\gapc\gapc_task.c 0x00000000 Number 0 gapc_task.o ABSOLUTE + ..\src\ip\ble\hl\src\gap\gapm\gapm.c 0x00000000 Number 0 gapm.o ABSOLUTE + ..\src\ip\ble\hl\src\gap\gapm\gapm_actv.c 0x00000000 Number 0 gapm_actv.o ABSOLUTE + ..\src\ip\ble\hl\src\gap\gapm\gapm_adv.c 0x00000000 Number 0 gapm_adv.o ABSOLUTE + ..\src\ip\ble\hl\src\gap\gapm\gapm_cfg.c 0x00000000 Number 0 gapm_cfg.o ABSOLUTE + ..\src\ip\ble\hl\src\gap\gapm\gapm_init.c 0x00000000 Number 0 gapm_init.o ABSOLUTE + ..\src\ip\ble\hl\src\gap\gapm\gapm_scan.c 0x00000000 Number 0 gapm_scan.o ABSOLUTE + ..\src\ip\ble\hl\src\gap\gapm\gapm_smp.c 0x00000000 Number 0 gapm_smp.o ABSOLUTE + ..\src\ip\ble\hl\src\gap\gapm\gapm_task.c 0x00000000 Number 0 gapm_task.o ABSOLUTE + ..\src\ip\ble\hl\src\gatt\attc\attc.c 0x00000000 Number 0 attc.o ABSOLUTE + ..\src\ip\ble\hl\src\gatt\attm\attm.c 0x00000000 Number 0 attm.o ABSOLUTE + ..\src\ip\ble\hl\src\gatt\attm\attm_db.c 0x00000000 Number 0 attm_db.o ABSOLUTE + ..\src\ip\ble\hl\src\gatt\atts\atts.c 0x00000000 Number 0 atts.o ABSOLUTE + ..\src\ip\ble\hl\src\gatt\gattc\gattc.c 0x00000000 Number 0 gattc.o ABSOLUTE + ..\src\ip\ble\hl\src\gatt\gattc\gattc_task.c 0x00000000 Number 0 gattc_task.o ABSOLUTE + ..\src\ip\ble\hl\src\gatt\gattm\gattm.c 0x00000000 Number 0 gattm.o ABSOLUTE + ..\src\ip\ble\hl\src\l2c\l2cc\l2cc.c 0x00000000 Number 0 l2cc.o ABSOLUTE + ..\src\ip\ble\hl\src\l2c\l2cc\l2cc_pdu.c 0x00000000 Number 0 l2cc_pdu.o ABSOLUTE + ..\src\ip\ble\hl\src\l2c\l2cc\l2cc_sig.c 0x00000000 Number 0 l2cc_sig.o ABSOLUTE + ..\src\ip\ble\hl\src\l2c\l2cc\l2cc_task.c 0x00000000 Number 0 l2cc_task.o ABSOLUTE + ..\src\ip\ble\hl\src\l2c\l2cm\l2cm.c 0x00000000 Number 0 l2cm.o ABSOLUTE + ..\src\ip\ble\hl\src\prf\gap_svc.c 0x00000000 Number 0 gap_svc.o ABSOLUTE + ..\src\ip\ble\hl\src\prf\gatt_svc.c 0x00000000 Number 0 gatt_svc.o ABSOLUTE + ..\src\ip\ble\ll\src\llc\llc.c 0x00000000 Number 0 llc.o ABSOLUTE + ..\src\ip\ble\ll\src\llc\llc_chmap_upd.c 0x00000000 Number 0 llc_chmap_upd.o ABSOLUTE + ..\src\ip\ble\ll\src\llc\llc_con_upd.c 0x00000000 Number 0 llc_con_upd.o ABSOLUTE + ..\src\ip\ble\ll\src\llc\llc_disconnect.c 0x00000000 Number 0 llc_disconnect.o ABSOLUTE + ..\src\ip\ble\ll\src\llc\llc_dl_upd.c 0x00000000 Number 0 llc_dl_upd.o ABSOLUTE + ..\src\ip\ble\ll\src\llc\llc_encrypt.c 0x00000000 Number 0 llc_encrypt.o ABSOLUTE + ..\src\ip\ble\ll\src\llc\llc_feat_exch.c 0x00000000 Number 0 llc_feat_exch.o ABSOLUTE + ..\src\ip\ble\ll\src\llc\llc_hci.c 0x00000000 Number 0 llc_hci.o ABSOLUTE + ..\src\ip\ble\ll\src\llc\llc_llcp.c 0x00000000 Number 0 llc_llcp.o ABSOLUTE + ..\src\ip\ble\ll\src\llc\llc_phy_upd.c 0x00000000 Number 0 llc_phy_upd.o ABSOLUTE + ..\src\ip\ble\ll\src\llc\llc_task.c 0x00000000 Number 0 llc_task.o ABSOLUTE + ..\src\ip\ble\ll\src\llc\llc_ver_exch.c 0x00000000 Number 0 llc_ver_exch.o ABSOLUTE + ..\src\ip\ble\ll\src\lld\lld.c 0x00000000 Number 0 lld.o ABSOLUTE + ..\src\ip\ble\ll\src\lld\lld_adv.c 0x00000000 Number 0 lld_adv.o ABSOLUTE + ..\src\ip\ble\ll\src\lld\lld_con.c 0x00000000 Number 0 lld_con.o ABSOLUTE + ..\src\ip\ble\ll\src\lld\lld_init.c 0x00000000 Number 0 lld_init.o ABSOLUTE + ..\src\ip\ble\ll\src\lld\lld_scan.c 0x00000000 Number 0 lld_scan.o ABSOLUTE + ..\src\ip\ble\ll\src\llm\llm.c 0x00000000 Number 0 llm.o ABSOLUTE + ..\src\ip\ble\ll\src\llm\llm_adv.c 0x00000000 Number 0 llm_adv.o ABSOLUTE + ..\src\ip\ble\ll\src\llm\llm_hci.c 0x00000000 Number 0 llm_hci.o ABSOLUTE + ..\src\ip\ble\ll\src\llm\llm_init.c 0x00000000 Number 0 llm_init.o ABSOLUTE + ..\src\ip\ble\ll\src\llm\llm_scan.c 0x00000000 Number 0 llm_scan.o ABSOLUTE + ..\src\ip\ble\ll\src\llm\llm_task.c 0x00000000 Number 0 llm_task.o ABSOLUTE + ..\src\ip\sch\src\sch.c 0x00000000 Number 0 sch.o ABSOLUTE + ..\src\ip\sch\src\sch_alarm.c 0x00000000 Number 0 sch_alarm.o ABSOLUTE + ..\src\ip\sch\src\sch_arb.c 0x00000000 Number 0 sch_arb.o ABSOLUTE + ..\src\ip\sch\src\sch_plan.c 0x00000000 Number 0 sch_plan.o ABSOLUTE + ..\src\ip\sch\src\sch_prog.c 0x00000000 Number 0 sch_prog.o ABSOLUTE + ..\src\ip\sch\src\sch_slice.c 0x00000000 Number 0 sch_slice.o ABSOLUTE + ..\src\main.c 0x00000000 Number 0 main.o ABSOLUTE + ..\src\modules\aes\src\aes.c 0x00000000 Number 0 aes.o ABSOLUTE + ..\src\modules\aes\src\aes_c1.c 0x00000000 Number 0 aes_c1.o ABSOLUTE + ..\src\modules\ble\src\ble_api.c 0x00000000 Number 0 ble_api.o ABSOLUTE + ..\src\modules\ble\src\ble_buf.c 0x00000000 Number 0 ble_buf.o ABSOLUTE + ..\src\modules\ble\src\ble_drv.c 0x00000000 Number 0 ble_drv.o ABSOLUTE + ..\src\modules\ble\src\ble_irq.c 0x00000000 Number 0 ble_irq.o ABSOLUTE + ..\src\modules\ble\src\gap_api.c 0x00000000 Number 0 gap_api.o ABSOLUTE + ..\src\modules\ble\src\gatt_api.c 0x00000000 Number 0 gatt_api.o ABSOLUTE + ..\src\modules\common\src\list.c 0x00000000 Number 0 list.o ABSOLUTE + ..\src\modules\common\src\utils.c 0x00000000 Number 0 utils.o ABSOLUTE + ..\src\modules\ke\src\ke.c 0x00000000 Number 0 ke.o ABSOLUTE + ..\src\modules\ke\src\ke_event.c 0x00000000 Number 0 ke_event.o ABSOLUTE + ..\src\modules\ke\src\ke_mem.c 0x00000000 Number 0 ke_mem.o ABSOLUTE + ..\src\modules\ke\src\ke_msg.c 0x00000000 Number 0 ke_msg.o ABSOLUTE + ..\src\modules\ke\src\ke_task.c 0x00000000 Number 0 ke_task.o ABSOLUTE + ..\src\modules\ke\src\ke_timer.c 0x00000000 Number 0 ke_timer.o ABSOLUTE + ..\src\myapp.c 0x00000000 Number 0 myapp.o ABSOLUTE + ..\src\plf\plf.c 0x00000000 Number 0 plf.o ABSOLUTE + ..\src\plf\rf\rf_mdm.c 0x00000000 Number 0 rf_mdm.o ABSOLUTE + ..\src\proc.c 0x00000000 Number 0 proc.o ABSOLUTE + ..\src\rcc.c 0x00000000 Number 0 rcc.o ABSOLUTE + ..\src\rtc.c 0x00000000 Number 0 rtc.o ABSOLUTE + ..\src\trim.c 0x00000000 Number 0 trim.o ABSOLUTE + ..\src\uart.c 0x00000000 Number 0 uart.o ABSOLUTE + cdrcmple.s 0x00000000 Number 0 cdrcmple.o ABSOLUTE + dc.s 0x00000000 Number 0 dc.o ABSOLUTE + handlers.s 0x00000000 Number 0 handlers.o ABSOLUTE + init.s 0x00000000 Number 0 init.o ABSOLUTE + RESET 0x18004000 Section 152 startup.o(RESET) + .ARM.Collect$$$$00000000 0x18004098 Section 0 entry.o(.ARM.Collect$$$$00000000) + .ARM.Collect$$$$00000001 0x18004098 Section 4 entry2.o(.ARM.Collect$$$$00000001) + .ARM.Collect$$$$00000004 0x1800409c Section 4 entry5.o(.ARM.Collect$$$$00000004) + .ARM.Collect$$$$00000008 0x180040a0 Section 0 entry7b.o(.ARM.Collect$$$$00000008) + .ARM.Collect$$$$0000000A 0x180040a0 Section 0 entry8b.o(.ARM.Collect$$$$0000000A) + .ARM.Collect$$$$0000000B 0x180040a0 Section 8 entry9a.o(.ARM.Collect$$$$0000000B) + .ARM.Collect$$$$0000000D 0x180040a8 Section 0 entry10a.o(.ARM.Collect$$$$0000000D) + .ARM.Collect$$$$0000000F 0x180040a8 Section 0 entry11a.o(.ARM.Collect$$$$0000000F) + .ARM.Collect$$$$00002712 0x180040a8 Section 4 entry2.o(.ARM.Collect$$$$00002712) + __lit__00000000 0x180040a8 Data 4 entry2.o(.ARM.Collect$$$$00002712) + .INT 0x180040ac Section 92 startup.o(.INT) + .text 0x18004108 Section 0 rf_mdm.o(.text) + rf_dac_adjust 0x18004109 Thumb Code 84 rf_mdm.o(.text) + rf_gain_cal 0x1800415d Thumb Code 160 rf_mdm.o(.text) + rf_cbpf_cal 0x180042e5 Thumb Code 82 rf_mdm.o(.text) + .text 0x1800438c Section 0 utils.o(.text) + .text 0x18004404 Section 0 gapc_task.o(.text) + gapc_con_param_upd_send 0x1800445f Thumb Code 92 gapc_task.o(.text) + gapc_get_info_cmd_handler 0x18004599 Thumb Code 222 gapc_task.o(.text) + l2cc_pdu_recv_ind_handler 0x18004677 Thumb Code 48 gapc_task.o(.text) + gapc_param_upd_to_handler 0x180046a7 Thumb Code 58 gapc_task.o(.text) + gapc_link_upd_cmd_handler 0x18004763 Thumb Code 220 gapc_task.o(.text) + .text 0x18004840 Section 0 gapc_smp.o(.text) + gapc_smp_send_start_enc_cmd 0x18004841 Thumb Code 76 gapc_smp.o(.text) + gapc_smp_send_ltk_req_rsp 0x1800488d Thumb Code 66 gapc_smp.o(.text) + gapc_smp_send_pairing_req_ind 0x180048cf Thumb Code 166 gapc_smp.o(.text) + gapc_smp_send_pairing_ind 0x18004975 Thumb Code 142 gapc_smp.o(.text) + gapc_smp_launch_rep_att_timer 0x18004a03 Thumb Code 58 gapc_smp.o(.text) + gapc_smp_check_repeated_attempts 0x18004a3d Thumb Code 82 gapc_smp.o(.text) + gapc_smp_check_key_distrib 0x18004a8f Thumb Code 146 gapc_smp.o(.text) + gapc_smp_pairing_end 0x18004b21 Thumb Code 88 gapc_smp.o(.text) + gapc_smp_tkdp_rcp_continue 0x18004b79 Thumb Code 128 gapc_smp.o(.text) + gapc_smp_tkdp_rcp_start 0x18004bf9 Thumb Code 64 gapc_smp.o(.text) + gapc_smp_pdu_send 0x18004c39 Thumb Code 78 gapc_smp.o(.text) + gapc_smp_tkdp_send_continue 0x18004c87 Thumb Code 222 gapc_smp.o(.text) + gapc_smp_tkdp_send_start 0x18004d65 Thumb Code 46 gapc_smp.o(.text) + gapc_smp_get_key_sec_prop 0x18004d93 Thumb Code 130 gapc_smp.o(.text) + gapc_smp_is_sec_mode_reached 0x18004e15 Thumb Code 60 gapc_smp.o(.text) + gapc_smp_handle_enc_change_evt 0x18004e51 Thumb Code 306 gapc_smp.o(.text) + gapc_smp_generate_stk 0x18004f83 Thumb Code 90 gapc_smp.o(.text) + gapc_smp_comp_cnf_val 0x18004fdd Thumb Code 270 gapc_smp.o(.text) + gapc_smp_aes_res_cb 0x180050eb Thumb Code 302 gapc_smp.o(.text) + gapc_smp_recv_pair_req 0x18005219 Thumb Code 186 gapc_smp.o(.text) + gapc_smp_recv_pair_rsp 0x180052d3 Thumb Code 238 gapc_smp.o(.text) + gapc_smp_recv_pair_cfm 0x180053c1 Thumb Code 88 gapc_smp.o(.text) + gapc_smp_recv_pair_rand 0x18005419 Thumb Code 64 gapc_smp.o(.text) + gapc_smp_recv_pair_fail 0x18005459 Thumb Code 60 gapc_smp.o(.text) + gapc_smp_recv_enc_info 0x18005495 Thumb Code 68 gapc_smp.o(.text) + gapc_smp_recv_mst_id 0x180054d9 Thumb Code 90 gapc_smp.o(.text) + gapc_smp_recv_id_info 0x18005533 Thumb Code 48 gapc_smp.o(.text) + gapc_smp_recv_id_addr_info 0x18005563 Thumb Code 76 gapc_smp.o(.text) + gapc_smp_recv_sign_info 0x180055af Thumb Code 44 gapc_smp.o(.text) + gapc_smp_recv_sec_req 0x180055db Thumb Code 138 gapc_smp.o(.text) + gapc_smp_pairing_start 0x18005665 Thumb Code 180 gapc_smp.o(.text) + gapc_smp_check_pairing_feat 0x18005d49 Thumb Code 38 gapc_smp.o(.text) + gapc_smp_check_max_key_size 0x18005d6f Thumb Code 34 gapc_smp.o(.text) + gapc_smp_clear_timeout_timer 0x18005d91 Thumb Code 38 gapc_smp.o(.text) + gapc_smp_pair_fail_send 0x18005db7 Thumb Code 26 gapc_smp.o(.text) + gapc_smp_pair_rand_send 0x18005dd1 Thumb Code 64 gapc_smp.o(.text) + gapc_smp_generate_rand 0x18005e11 Thumb Code 20 gapc_smp.o(.text) + .text 0x18005e28 Section 0 attm_db.o(.text) + attmdb_svc_att_desc 0x18005e71 Thumb Code 196 attm_db.o(.text) + attmdb_svc_att_size 0x18006349 Thumb Code 140 attm_db.o(.text) + .text 0x180063e0 Section 0 gap_svc.o(.text) + .text 0x1800658c Section 0 gatt_svc.o(.text) + .text 0x1800672c Section 0 ke_mem.o(.text) + .text 0x18006768 Section 0 ke_task.o(.text) + cmp_dest_id 0x18006769 Thumb Code 14 ke_task.o(.text) + .text 0x18006790 Section 0 ke_timer.o(.text) + ke_time_past 0x18006791 Thumb Code 66 ke_timer.o(.text) + cmp_abs_time 0x180067d3 Thumb Code 40 ke_timer.o(.text) + cmp_timer_id 0x180067fb Thumb Code 24 ke_timer.o(.text) + .text 0x1800683c Section 0 ke_event.o(.text) + .text 0x18006850 Section 0 aes.o(.text) + .text 0x180069bc Section 0 aes_c1.o(.text) + aes_c1_continue 0x180069bd Thumb Code 54 aes_c1.o(.text) + .text 0x18006a40 Section 0 gapm.o(.text) + gapm_operation_cleanup 0x18006a6b Thumb Code 40 gapm.o(.text) + .text 0x18006bd0 Section 0 gapc.o(.text) + gapc_operation_cleanup 0x18006bd1 Thumb Code 48 gapc.o(.text) + .text 0x18006fbc Section 0 gattc.o(.text) + gatt_operation_cleanup 0x18006fbd Thumb Code 62 gattc.o(.text) + .text 0x180071d8 Section 0 l2cc.o(.text) + .text 0x1800747c Section 0 l2cc_sig.o(.text) + l2c_code_reject_handler 0x1800755d Thumb Code 74 l2cc_sig.o(.text) + l2c_code_con_param_upd_req_handler 0x180075a7 Thumb Code 120 l2cc_sig.o(.text) + l2c_code_con_param_upd_rsp_handler 0x1800761f Thumb Code 94 l2cc_sig.o(.text) + .text 0x18007688 Section 0 attm.o(.text) + .text 0x1800798c Section 0 atts.o(.text) + atts_get_att_chk_perm 0x1800799d Thumb Code 148 atts.o(.text) + atts_get_value 0x18007a4d Thumb Code 112 atts.o(.text) + atts_find_value_by_uuid 0x18007abd Thumb Code 160 atts.o(.text) + atts_mtu_exc_req 0x18007c39 Thumb Code 52 atts.o(.text) + atts_find_info_req 0x18007c6d Thumb Code 294 atts.o(.text) + atts_find_by_type_req 0x18007d93 Thumb Code 390 atts.o(.text) + atts_read_by_type_req 0x18007f19 Thumb Code 402 atts.o(.text) + atts_read_by_grp_type_req 0x180080ab Thumb Code 438 atts.o(.text) + atts_read_req 0x18008261 Thumb Code 138 atts.o(.text) + atts_read_blob_req 0x180082eb Thumb Code 164 atts.o(.text) + atts_read_mult_req 0x1800838f Thumb Code 292 atts.o(.text) + atts_write_common 0x180084b3 Thumb Code 116 atts.o(.text) + atts_prepare_write_req 0x18008527 Thumb Code 240 atts.o(.text) + atts_execute_write_req 0x18008617 Thumb Code 392 atts.o(.text) + atts_find_end 0x18008885 Thumb Code 94 atts.o(.text) + atts_store_prep_data 0x180088e3 Thumb Code 114 atts.o(.text) + atts_write_req 0x18008955 Thumb Code 104 atts.o(.text) + .text 0x180089cc Section 0 llm.o(.text) + .text 0x18008a64 Section 0 llc_disconnect.o(.text) + llc_disconnect_proc_fsm 0x18008a8d Thumb Code 102 llc_disconnect.o(.text) + llc_ll_terminate_ind_ack 0x18008af3 Thumb Code 4 llc_disconnect.o(.text) + llc_ll_terminate_ind_pdu_send 0x18008af7 Thumb Code 22 llc_disconnect.o(.text) + .text 0x18008c78 Section 0 llc_ver_exch.o(.text) + llc_ver_exch_proc_fsm 0x18008c79 Thumb Code 112 llc_ver_exch.o(.text) + llc_llcp_version_ind_pdu_send 0x18008dc3 Thumb Code 30 llc_ver_exch.o(.text) + .text 0x18008de8 Section 0 llc_encrypt.o(.text) + llc_ll_start_enc_rsp_ack_handler 0x18008de9 Thumb Code 30 llc_encrypt.o(.text) + llc_ll_reject_ind_ack_handler 0x18008e07 Thumb Code 30 llc_encrypt.o(.text) + llc_rem_encrypt_proc_fsm 0x18008e25 Thumb Code 546 llc_encrypt.o(.text) + llc_ll_pause_enc_rsp_ack_handler 0x18009047 Thumb Code 30 llc_encrypt.o(.text) + llc_loc_encrypt_proc_fsm 0x18009065 Thumb Code 602 llc_encrypt.o(.text) + llc_aes_res_cb 0x180092bf Thumb Code 172 llc_encrypt.o(.text) + llc_iv_skd_rand_gen 0x1800936b Thumb Code 12 llc_encrypt.o(.text) + .text 0x18009764 Section 0 llc_feat_exch.o(.text) + llc_ll_feature_pdu_send 0x18009765 Thumb Code 58 llc_feat_exch.o(.text) + llc_loc_feats_exch_proc_fsm 0x1800979f Thumb Code 114 llc_feat_exch.o(.text) + .text 0x180099f8 Section 0 llc_dl_upd.o(.text) + llc_loc_dl_upd_proc_fsm 0x180099f9 Thumb Code 282 llc_dl_upd.o(.text) + llc_rem_dl_upd_proc 0x18009b13 Thumb Code 200 llc_dl_upd.o(.text) + .text 0x18009e1c Section 0 llc_con_upd.o(.text) + llc_con_upd_param_in_range 0x18009e1d Thumb Code 76 llc_con_upd.o(.text) + llc_pref_param_compute 0x18009e69 Thumb Code 256 llc_con_upd.o(.text) + llc_ll_con_param_pdu_send 0x18009f69 Thumb Code 58 llc_con_upd.o(.text) + llc_con_upd_info_send 0x18009fa3 Thumb Code 216 llc_con_upd.o(.text) + .text 0x1800a97c Section 0 llc_phy_upd.o(.text) + .text 0x1800b020 Section 0 lld.o(.text) + .text 0x1800b0ec Section 0 lld_con.o(.text) + lld_con_max_lat_calc 0x1800b0ed Thumb Code 82 lld_con.o(.text) + lld_con_tx_len_update 0x1800b13f Thumb Code 92 lld_con.o(.text) + lld_con_evt_time_update 0x1800b19b Thumb Code 148 lld_con.o(.text) + lld_con_cleanup 0x1800b22f Thumb Code 168 lld_con.o(.text) + lld_instant_proc_end 0x1800b2d7 Thumb Code 116 lld_con.o(.text) + lld_con_sched 0x1800b34b Thumb Code 782 lld_con.o(.text) + lld_con_tx_prog 0x1800b659 Thumb Code 444 lld_con.o(.text) + lld_con_evt_start_cbk 0x1800b815 Thumb Code 348 lld_con.o(.text) + lld_con_evt_cancel_cbk 0x1800b971 Thumb Code 52 lld_con.o(.text) + lld_con_slave_latency 0x1800b9a5 Thumb Code 108 lld_con.o(.text) + .text 0x1800c13c Section 0 plf.o(.text) + .text 0x1800c158 Section 0 sch_arb.o(.text) + sch_arb_conflict_check 0x1800c159 Thumb Code 212 sch_arb.o(.text) + sch_arb_elt_cancel 0x1800c22d Thumb Code 258 sch_arb.o(.text) + sch_arb_prog_timer 0x1800c32f Thumb Code 96 sch_arb.o(.text) + .text 0x1800c5dc Section 0 sch_prog.o(.text) + .text 0x1800c6dc Section 0 sch_plan.o(.text) + sch_plan_offset_req 0x1800c6dd Thumb Code 622 sch_plan.o(.text) + .text 0x1800ca8c Section 0 sch_slice.o(.text) + .text 0x1800cb94 Section 0 gattc_task.o(.text) + gatt_op_cmd_handler 0x1800cbfb Thumb Code 678 gattc_task.o(.text) + gatt_event_cfm_handler 0x1800cea1 Thumb Code 24 gattc_task.o(.text) + gatt_send_evt_cmd_handler 0x1800ceb9 Thumb Code 72 gattc_task.o(.text) + gatt_op_cfm_handler 0x1800cf01 Thumb Code 252 gattc_task.o(.text) + gatt_timeout_handler 0x1800cffd Thumb Code 92 gattc_task.o(.text) + l2cc_pdu_recv_ind_handler 0x1800d059 Thumb Code 114 gattc_task.o(.text) + .text 0x1800d0d8 Section 0 gapm_actv.o(.text) + gapm_actv_free 0x1800d4a9 Thumb Code 36 gapm_actv.o(.text) + .text 0x1800d4cc Section 0 gapc_hci.o(.text) + .text 0x1800d800 Section 0 l2cm.o(.text) + .text 0x1800d830 Section 0 l2cc_pdu.o(.text) + .text 0x1800da8c Section 0 llc.o(.text) + llc_llcp_trans_timer_set 0x1800da8d Thumb Code 70 llc.o(.text) + .text 0x1800df70 Section 0 llc_llcp.o(.text) + ll_reject_ind_handler 0x1800e049 Thumb Code 32 llc_llcp.o(.text) + ll_reject_ext_ind_handler 0x1800e069 Thumb Code 32 llc_llcp.o(.text) + ll_unknown_rsp_handler 0x1800e089 Thumb Code 16 llc_llcp.o(.text) + .text 0x1800e190 Section 0 lld_adv.o(.text) + lld_adv_end 0x1800e191 Thumb Code 100 lld_adv.o(.text) + lld_adv_data_set 0x1800e1f5 Thumb Code 106 lld_adv.o(.text) + lld_adv_evt_start_cbk 0x1800e25f Thumb Code 56 lld_adv.o(.text) + lld_adv_evt_cancel_cbk 0x1800e297 Thumb Code 132 lld_adv.o(.text) + .text 0x1800e6f4 Section 0 lld_scan.o(.text) + lld_scan_end 0x1800e6f5 Thumb Code 138 lld_scan.o(.text) + lld_scan_sched 0x1800e77f Thumb Code 322 lld_scan.o(.text) + lld_scan_evt_start_cbk 0x1800e8c1 Thumb Code 34 lld_scan.o(.text) + lld_scan_evt_cancel_cbk 0x1800e8e3 Thumb Code 50 lld_scan.o(.text) + .text 0x1800ece0 Section 0 lld_init.o(.text) + lld_init_end 0x1800ece1 Thumb Code 142 lld_init.o(.text) + lld_init_sched 0x1800ed6f Thumb Code 170 lld_init.o(.text) + lld_init_evt_start_cbk 0x1800ee19 Thumb Code 100 lld_init.o(.text) + lld_init_evt_cancel_cbk 0x1800ee7d Thumb Code 50 lld_init.o(.text) + .text 0x1800f268 Section 0 sch_alarm.o(.text) + sch_alarm_prog 0x1800f269 Thumb Code 78 sch_alarm.o(.text) + .text 0x1800f374 Section 0 l2cc_task.o(.text) + l2cc_pdu_send_cmd_handler 0x1800f375 Thumb Code 62 l2cc_task.o(.text) + l2cc_acl_data_handler 0x1800f3df Thumb Code 190 l2cc_task.o(.text) + l2cc_pdu_recv_ind_handler 0x1800f49d Thumb Code 76 l2cc_task.o(.text) + .text 0x1800f4f8 Section 0 gapm_cfg.o(.text) + .text 0x1800f5f4 Section 0 gapm_smp.o(.text) + gapm_smp_use_enc_block_cb 0x1800f5f5 Thumb Code 72 gapm_smp.o(.text) + gapm_smp_gen_rand_addr_cb 0x1800f63d Thumb Code 166 gapm_smp.o(.text) + gapm_smp_gen_rand_nb_cb 0x1800f6e3 Thumb Code 70 gapm_smp.o(.text) + .text 0x1800f7a0 Section 0 gapm_adv.o(.text) + gapm_adv_send_en_cmd 0x1800f7a1 Thumb Code 58 gapm_adv.o(.text) + gapm_adv_set_data 0x1800f7db Thumb Code 72 gapm_adv.o(.text) + gapm_adv_start 0x1800f823 Thumb Code 20 gapm_adv.o(.text) + gapm_adv_stop 0x1800f837 Thumb Code 22 gapm_adv.o(.text) + gapm_adv_delete 0x1800f84d Thumb Code 34 gapm_adv.o(.text) + gapm_adv_send_param_cmd 0x1800fa61 Thumb Code 128 gapm_adv.o(.text) + gapm_adv_send_data_cmd 0x1800fae1 Thumb Code 110 gapm_adv.o(.text) + .text 0x1800fb68 Section 0 gapm_scan.o(.text) + gapm_scan_send_en_cmd 0x1800fb69 Thumb Code 76 gapm_scan.o(.text) + gapm_scan_start 0x1800fbb5 Thumb Code 44 gapm_scan.o(.text) + gapm_scan_stop 0x1800fbe1 Thumb Code 12 gapm_scan.o(.text) + gapm_scan_send_param_cmd 0x1800fdb7 Thumb Code 126 gapm_scan.o(.text) + .text 0x1800fe54 Section 0 gapm_init.o(.text) + gapm_init_start 0x1800fe55 Thumb Code 56 gapm_init.o(.text) + gapm_init_stop 0x1800fe8d Thumb Code 38 gapm_init.o(.text) + gapm_init_send_en_cmd 0x1800ffcf Thumb Code 124 gapm_init.o(.text) + .text 0x18010068 Section 0 attc.o(.text) + attc_exc_mtu_rsp 0x18010175 Thumb Code 58 attc.o(.text) + attc_find_info_rsp 0x180101af Thumb Code 196 attc.o(.text) + attc_find_by_type_rsp 0x18010273 Thumb Code 188 attc.o(.text) + attc_rd_by_type_rsp 0x1801032f Thumb Code 644 attc.o(.text) + attc_rd_by_grp_type_rsp 0x180105b3 Thumb Code 258 attc.o(.text) + attc_rd_rsp 0x180106b5 Thumb Code 232 attc.o(.text) + attc_rd_mult_rsp 0x1801079d Thumb Code 204 attc.o(.text) + attc_wr_rsp 0x18010869 Thumb Code 36 attc.o(.text) + attc_prep_wr_rsp 0x1801088d Thumb Code 98 attc.o(.text) + attc_exe_wr_rsp 0x180108ef Thumb Code 54 attc.o(.text) + attc_hdl_val_ntf_ind 0x18010925 Thumb Code 90 attc.o(.text) + attc_err_rsp 0x1801097f Thumb Code 46 attc.o(.text) + .text 0x18010a18 Section 0 llm_hci.o(.text) + .text 0x18010ac8 Section 0 llm_adv.o(.text) + llm_adv_set_release 0x18010e3d Thumb Code 54 llm_adv.o(.text) + .text 0x18010e84 Section 0 llm_scan.o(.text) + .text 0x18011280 Section 0 llm_init.o(.text) + .text 0x1801145c Section 0 llc_hci.o(.text) + .text 0x180114f0 Section 0 llc_chmap_upd.o(.text) + .text 0x180115f8 Section 0 uidiv.o(.text) + .text 0x18011624 Section 0 idiv.o(.text) + .text 0x1801164c Section 0 uldiv.o(.text) + .text 0x180116ac Section 36 init.o(.text) + .text 0x180116d0 Section 0 llshl.o(.text) + .text 0x180116f0 Section 0 llushr.o(.text) + i.UART1_IRQHandler 0x18011714 Section 0 uart1rb.o(i.UART1_IRQHandler) + i.__0printf$8 0x18011788 Section 0 printf8.o(i.__0printf$8) + i.__ARM_common_switch8 0x180117a8 Section 0 app_actv.o(i.__ARM_common_switch8) + i.__scatterload_copy 0x180117c2 Section 14 handlers.o(i.__scatterload_copy) + i.__scatterload_null 0x180117d0 Section 2 handlers.o(i.__scatterload_null) + i.__scatterload_zeroinit 0x180117d2 Section 14 handlers.o(i.__scatterload_zeroinit) + i._printf_core 0x180117e0 Section 0 printf8.o(i._printf_core) + _printf_core 0x180117e1 Thumb Code 1020 printf8.o(i._printf_core) + i._printf_post_padding 0x18011c08 Section 0 printf8.o(i._printf_post_padding) + _printf_post_padding 0x18011c09 Thumb Code 32 printf8.o(i._printf_post_padding) + i._printf_pre_padding 0x18011c28 Section 0 printf8.o(i._printf_pre_padding) + _printf_pre_padding 0x18011c29 Thumb Code 44 printf8.o(i._printf_pre_padding) + i.app_actv_cmp_evt 0x18011c54 Section 0 app_actv.o(i.app_actv_cmp_evt) + i.app_actv_create 0x18011c68 Section 0 app_actv.o(i.app_actv_create) + i.app_actv_created_ind 0x18011c84 Section 0 app_actv.o(i.app_actv_created_ind) + i.app_actv_stopped_ind 0x18011c94 Section 0 app_actv.o(i.app_actv_stopped_ind) + i.app_adv_action 0x18011cbc Section 0 app_actv.o(i.app_adv_action) + i.app_adv_create 0x18011d34 Section 0 app_actv.o(i.app_adv_create) + app_adv_create 0x18011d35 Thumb Code 44 app_actv.o(i.app_adv_create) + i.app_adv_event 0x18011d60 Section 0 app_actv.o(i.app_adv_event) + i.app_conf_fsm 0x18011dec Section 0 app.o(i.app_conf_fsm) + i.app_conn_fsm 0x18011e24 Section 0 app.o(i.app_conn_fsm) + i.app_custom_handler 0x18011e64 Section 0 app_msg.o(i.app_custom_handler) + i.app_gapc_bond_ind_handler 0x18011e68 Section 0 app_gapc.o(i.app_gapc_bond_ind_handler) + app_gapc_bond_ind_handler 0x18011e69 Thumb Code 220 app_gapc.o(i.app_gapc_bond_ind_handler) + i.app_gapc_bond_req_ind_handler 0x18012028 Section 0 app_gapc.o(i.app_gapc_bond_req_ind_handler) + app_gapc_bond_req_ind_handler 0x18012029 Thumb Code 302 app_gapc.o(i.app_gapc_bond_req_ind_handler) + i.app_gapc_connection_req_ind_handler 0x1801226c Section 0 app_gapc.o(i.app_gapc_connection_req_ind_handler) + app_gapc_connection_req_ind_handler 0x1801226d Thumb Code 78 app_gapc.o(i.app_gapc_connection_req_ind_handler) + i.app_gapc_encrypt_req_ind_handler 0x180122d8 Section 0 app_gapc.o(i.app_gapc_encrypt_req_ind_handler) + app_gapc_encrypt_req_ind_handler 0x180122d9 Thumb Code 122 app_gapc.o(i.app_gapc_encrypt_req_ind_handler) + i.app_gapc_msg_handler 0x180123d8 Section 0 app_gapc.o(i.app_gapc_msg_handler) + i.app_gapm_msg_handler 0x18012708 Section 0 app_gapm.o(i.app_gapm_msg_handler) + i.app_init 0x1801275c Section 0 app.o(i.app_init) + i.app_ltk_find 0x18012798 Section 0 app.o(i.app_ltk_find) + i.app_ltk_gen 0x1801279c Section 0 app.o(i.app_ltk_gen) + i.app_ltk_save 0x1801279e Section 0 app.o(i.app_ltk_save) + i.app_name_get 0x180127a0 Section 0 app.o(i.app_name_get) + i.app_pairing_get 0x180127dc Section 0 app.o(i.app_pairing_get) + i.app_prf_create 0x180127f4 Section 0 app.o(i.app_prf_create) + i.app_state_set 0x18012810 Section 0 app.o(i.app_state_set) + i.core_vector 0x1801281c Section 0 core.o(i.core_vector) + i.data_proc 0x18012848 Section 0 proc.o(i.data_proc) + data_proc 0x18012849 Thumb Code 124 proc.o(i.data_proc) + i.diss_svc_func 0x180128cc Section 0 prf_diss.o(i.diss_svc_func) + diss_svc_func 0x180128cd Thumb Code 92 prf_diss.o(i.diss_svc_func) + i.diss_svc_init 0x1801292c Section 0 prf_diss.o(i.diss_svc_init) + i.diss_value_get 0x18012978 Section 0 prf_diss.o(i.diss_value_get) + i.fputc 0x180129e8 Section 0 debug.o(i.fputc) + i.gap_svc_get_dev_info 0x180129f8 Section 0 app.o(i.gap_svc_get_dev_info) + i.gapc_connect_rsp 0x18012a18 Section 0 gap_api.o(i.gapc_connect_rsp) + i.gapc_disconnect 0x18012a40 Section 0 gap_api.o(i.gapc_disconnect) + i.gapm_create_advertising 0x18012a4c Section 0 gap_api.o(i.gapm_create_advertising) + i.gapm_delete_activity 0x18012a80 Section 0 gap_api.o(i.gapm_delete_activity) + i.gapm_reset 0x18012aa8 Section 0 gap_api.o(i.gapm_reset) + i.gapm_set_adv_data 0x18012ac4 Section 0 gap_api.o(i.gapm_set_adv_data) + i.gapm_set_dev 0x18012b00 Section 0 gap_api.o(i.gapm_set_dev) + i.gapm_start_activity 0x18012b74 Section 0 gap_api.o(i.gapm_start_activity) + i.gapm_start_advertising 0x18012ba8 Section 0 gap_api.o(i.gapm_start_advertising) + i.gapm_stop_activity 0x18012bba Section 0 gap_api.o(i.gapm_stop_activity) + i.gatt_info_cfm 0x18012bd8 Section 0 gatt_api.o(i.gatt_info_cfm) + i.gatt_ntf_send 0x18012c04 Section 0 gatt_api.o(i.gatt_ntf_send) + i.gatt_read_cfm 0x18012c48 Section 0 gatt_api.o(i.gatt_read_cfm) + i.gatt_write_cfm 0x18012c8c Section 0 gatt_api.o(i.gatt_write_cfm) + i.main 0x18012cb4 Section 0 main.o(i.main) + i.rcc_adc_en 0x18012d20 Section 0 rcc.o(i.rcc_adc_en) + i.rcc_ble_en 0x18012d40 Section 0 rcc.o(i.rcc_ble_en) + i.rcc_sysclk_get 0x18012d80 Section 0 rcc.o(i.rcc_sysclk_get) + i.sess_cb_rxd 0x18012db6 Section 0 proc.o(i.sess_cb_rxd) + i.sess_svc_func 0x18012dc0 Section 0 prf_sess.o(i.sess_svc_func) + sess_svc_func 0x18012dc1 Thumb Code 206 prf_sess.o(i.sess_svc_func) + i.sess_svc_init 0x18012e94 Section 0 prf_sess.o(i.sess_svc_init) + i.sess_txd_send 0x18012eb8 Section 0 prf_sess.o(i.sess_txd_send) + i.trim_load 0x18012ef8 Section 0 trim.o(i.trim_load) + i.uart1Rb_Init 0x18012ff8 Section 0 uart1rb.o(i.uart1Rb_Init) + i.uart1Rb_Read 0x18013034 Section 0 uart1rb.o(i.uart1Rb_Read) + i.uart_conf 0x1801307c Section 0 uart.o(i.uart_conf) + i.uart_fctl 0x180130ac Section 0 uart.o(i.uart_fctl) + i.uart_init 0x180130d8 Section 0 uart.o(i.uart_init) + i.uart_putc 0x18013148 Section 0 uart.o(i.uart_putc) + i.uart_send 0x1801315c Section 0 uart.o(i.uart_send) + i.user_procedure 0x1801318c Section 0 proc.o(i.user_procedure) + ke_list_api_func 0x180131b8 Section 0 ble_buf.o(ke_list_api_func) + ke_list_api_func 0x18013318 Section 0 list.o(ke_list_api_func) + ke_util_api_func 0x180134a8 Section 0 utils.o(ke_util_api_func) + ke_util_api_func 0x18013578 Section 0 ke_mem.o(ke_util_api_func) + ke_util_api_func 0x180136f8 Section 0 ke_msg.o(ke_util_api_func) + ke_util_api_func 0x18013770 Section 0 ke_task.o(ke_util_api_func) + ke_util_api_func 0x180137f8 Section 0 ke_timer.o(ke_util_api_func) + ke_util_api_func 0x18013918 Section 0 ke_event.o(ke_util_api_func) + ke_util_api_func 0x18013950 Section 0 lld.o(ke_util_api_func) + le_drv_api_func 0x18013980 Section 0 ble_drv.o(le_drv_api_func) + le_drv_api_func 0x18013b4c Section 0 ble_irq.o(le_drv_api_func) + le_evt_hdl_func 0x18013b88 Section 0 ble_api.o(le_evt_hdl_func) + le_evt_hdl_func 0x18013bc0 Section 0 ble_drv.o(le_evt_hdl_func) + le_evt_hdl_func 0x18013be4 Section 0 ke_task.o(le_evt_hdl_func) + le_evt_hdl_func 0x18013c80 Section 0 ke_timer.o(le_evt_hdl_func) + le_evt_hdl_func 0x18013cf8 Section 0 l2cm.o(le_evt_hdl_func) + le_irq_frm_cbk 0x18013d48 Section 0 lld_con.o(le_irq_frm_cbk) + le_irq_frm_cbk 0x1801413c Section 0 lld_adv.o(le_irq_frm_cbk) + le_irq_frm_cbk 0x1801451c Section 0 lld_scan.o(le_irq_frm_cbk) + le_irq_frm_cbk 0x18014818 Section 0 lld_init.o(le_irq_frm_cbk) + le_irq_func 0x18014b68 Section 0 ble_irq.o(le_irq_func) + le_irq_hdl_isr 0x18014cdc Section 0 sch_arb.o(le_irq_hdl_isr) + le_irq_hdl_isr 0x18014d80 Section 0 sch_prog.o(le_irq_hdl_isr) + le_irq_hdl_isr 0x18014e88 Section 0 sch_alarm.o(le_irq_hdl_isr) + le_task_hdl_func 0x18014ecc Section 0 app_msg.o(le_task_hdl_func) + le_task_hdl_func 0x18014ef0 Section 0 gapc_task.o(le_task_hdl_func) + le_task_hdl_func 0x18014f68 Section 0 gapm_task.o(le_task_hdl_func) + le_task_hdl_func 0x18014fd4 Section 0 gattc_task.o(le_task_hdl_func) + le_task_hdl_func 0x18015048 Section 0 llm_task.o(le_task_hdl_func) + le_task_hdl_func 0x18015098 Section 0 llc_task.o(le_task_hdl_func) + le_task_hdl_func 0x18015114 Section 0 l2cc_task.o(le_task_hdl_func) + ri_one_cal_func 0x18015158 Section 0 rf_mdm.o(ri_one_cal_func) + ri_one_cal_func 0x180151fc Section 0 ble_api.o(ri_one_cal_func) + ri_one_cal_func 0x18015250 Section 0 ble_drv.o(ri_one_cal_func) + ri_one_cal_func 0x180152f8 Section 0 ke.o(ri_one_cal_func) + ri_one_cal_func 0x18015390 Section 0 aes.o(ri_one_cal_func) + ri_one_cal_func 0x180153c0 Section 0 gapm.o(ri_one_cal_func) + ri_one_cal_func 0x18015454 Section 0 gattm.o(ri_one_cal_func) + ri_one_cal_func 0x180154b0 Section 0 llm.o(ri_one_cal_func) + ri_one_cal_func 0x1801553c Section 0 lld.o(ri_one_cal_func) + ri_one_cal_func 0x18015664 Section 0 lld_con.o(ri_one_cal_func) + ri_one_cal_func 0x180156a4 Section 0 ble_buf.o(ri_one_cal_func) + ri_one_cal_func 0x180156f8 Section 0 sch.o(ri_one_cal_func) + ri_one_cal_func 0x18015770 Section 0 gapm_actv.o(ri_one_cal_func) + ri_one_cal_func 0x180157a8 Section 0 l2cm.o(ri_one_cal_func) + ri_one_cal_func 0x18015818 Section 0 lld_adv.o(ri_one_cal_func) + ri_one_cal_func 0x1801584c Section 0 lld_scan.o(ri_one_cal_func) + ri_one_cal_func 0x18015874 Section 0 lld_init.o(ri_one_cal_func) + .constdata 0x180158ac Section 12 app.o(.constdata) + .constdata 0x180158b8 Section 144 prf_diss.o(.constdata) + .constdata 0x18015948 Section 12 prf_diss.o(.constdata) + .constdata 0x18015954 Section 16 prf_sess.o(.constdata) + .constdata 0x18015964 Section 16 prf_sess.o(.constdata) + .constdata 0x18015974 Section 16 prf_sess.o(.constdata) + .constdata 0x18015984 Section 40 prf_sess.o(.constdata) + .constdata 0x180159ac Section 12 prf_sess.o(.constdata) + .constdata 0x180159b8 Section 44 gapc_smp.o(.constdata) + .constdata 0x180159e4 Section 80 gap_svc.o(.constdata) + gapm_att_db 0x180159e4 Data 80 gap_svc.o(.constdata) + .constdata 0x18015a34 Section 24 gatt_svc.o(.constdata) + gattm_att_db 0x18015a34 Data 24 gatt_svc.o(.constdata) + .constdata 0x18015a4c Section 48 atts.o(.constdata) + .constdata 0x18015a7c Section 150 llc_llcp.o(.constdata) + .constdata 0x18015b14 Section 60 attc.o(.constdata) + .conststring 0x18015b50 Section 93 app_gapc.o(.conststring) + .data 0x20003098 Section 4 stdout.o(.data) + .bss 0x2000309c Section 186 proc.o(.bss) + null_cnt 0x2000309d Data 1 proc.o(.bss) + buff_len 0x2000309e Data 2 proc.o(.bss) + buff 0x200030a0 Data 182 proc.o(.bss) + .bss 0x20003156 Section 260 uart1rb.o(.bss) + uart1RbRx 0x20003156 Data 260 uart1rb.o(.bss) + .bss 0x2000325a Section 2 app_actv.o(.bss) + .bss 0x2000325c Section 6 prf_sess.o(.bss) + le_env_mem_area 0x20003262 Section 2 app.o(le_env_mem_area) + le_env_mem_area 0x20003264 Section 4 prf_diss.o(le_env_mem_area) + STACK 0x20007a00 Section 1536 startup.o(STACK) + var_env_mem_area 0x20008fd8 Section 16 rf_mdm.o(var_env_mem_area) + var_env_mem_area 0x20008fe8 Section 4 gap_svc.o(var_env_mem_area) + var_env_mem_area 0x20008fec Section 2 gatt_svc.o(var_env_mem_area) + var_env_mem_area 0x20008ff0 Section 8 ble_drv.o(var_env_mem_area) + var_env_mem_area 0x20008ff8 Section 36 ke.o(var_env_mem_area) + var_env_mem_area 0x2000901c Section 32 ke_task.o(var_env_mem_area) + var_env_mem_area 0x2000903c Section 32 ke_event.o(var_env_mem_area) + var_env_mem_area 0x2000905c Section 8 aes.o(var_env_mem_area) + var_env_mem_area 0x20009064 Section 40 gapm.o(var_env_mem_area) + var_env_mem_area 0x2000908c Section 12 gapc.o(var_env_mem_area) + var_env_mem_area 0x20009098 Section 28 gattm.o(var_env_mem_area) + var_env_mem_area 0x200090b4 Section 12 gattc.o(var_env_mem_area) + var_env_mem_area 0x200090c0 Section 12 l2cc.o(var_env_mem_area) + var_env_mem_area 0x200090cc Section 132 llm.o(var_env_mem_area) + var_env_mem_area 0x20009150 Section 16 lld.o(var_env_mem_area) + var_env_mem_area 0x20009160 Section 16 lld_con.o(var_env_mem_area) + var_env_mem_area 0x20009170 Section 72 ble_buf.o(var_env_mem_area) + var_env_mem_area 0x200091b8 Section 20 sch_arb.o(var_env_mem_area) + var_env_mem_area 0x200091cc Section 148 sch_prog.o(var_env_mem_area) + var_env_mem_area 0x20009260 Section 12 sch_plan.o(var_env_mem_area) + var_env_mem_area 0x2000926c Section 32 sch_slice.o(var_env_mem_area) + var_env_mem_area 0x2000928c Section 4 l2cm.o(var_env_mem_area) + var_env_mem_area 0x20009290 Section 16 llc.o(var_env_mem_area) + var_env_mem_area 0x200092a0 Section 16 lld_adv.o(var_env_mem_area) + var_env_mem_area 0x200092b0 Section 4 lld_scan.o(var_env_mem_area) + var_env_mem_area 0x200092b4 Section 4 lld_init.o(var_env_mem_area) + var_env_mem_area 0x200092b8 Section 8 sch_alarm.o(var_env_mem_area) + var_ext_mem_area 0x200092c0 Section 8 sch_slice.o(var_ext_mem_area) + var_rnd_mem_area 0x200092c8 Section 4 utils.o(var_rnd_mem_area) + var_sta_mem_area 0x200092cc Section 3 gapc_task.o(var_sta_mem_area) + var_sta_mem_area 0x200092cf Section 1 aes.o(var_sta_mem_area) + var_sta_mem_area 0x200092d0 Section 1 lld.o(var_sta_mem_area) + var_sta_mem_area 0x200092d1 Section 1 gapm_task.o(var_sta_mem_area) + var_sta_mem_area 0x200092d2 Section 3 gattc_task.o(var_sta_mem_area) + var_sta_mem_area 0x200092d5 Section 4 llc_task.o(var_sta_mem_area) + var_sta_mem_area 0x200092d9 Section 3 l2cc_task.o(var_sta_mem_area) + + Global Symbols + + Symbol Name Value Ov Type Size Object(Section) + + BuildAttributes$$THM_ISAv3M$S$PE$A:L22$X:L11$S22$IEEE1$IW$USESV6$~STKCKD$USESV7$~SHL$OSPACE$ROPI$EBA8$MICROLIB$REQ8$PRES8$EABIv2 0x00000000 Number 0 anon$$obj.o ABSOLUTE + __ARM_use_no_argv 0x00000000 Number 0 main.o ABSOLUTE + _printf_a 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_c 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_charcount 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_d 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_e 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_f 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_flags 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_fp_dec 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_fp_hex 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_g 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_i 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_int_dec 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_l 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_lc 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_ll 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_lld 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_lli 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_llo 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_llu 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_llx 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_longlong_dec 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_longlong_hex 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_longlong_oct 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_ls 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_mbtowc 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_n 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_o 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_p 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_percent 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_pre_padding 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_return_value 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_s 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_sizespec 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_str 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_truncate_signed 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_truncate_unsigned 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_u 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_wc 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_wctomb 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_widthprec 0x00000000 Number 0 stubs.o ABSOLUTE + _printf_x 0x00000000 Number 0 stubs.o ABSOLUTE + __cpp_initialize__aeabi_ - Undefined Weak Reference + __cxa_finalize - Undefined Weak Reference + __decompress - Undefined Weak Reference + _clock_init - Undefined Weak Reference + _microlib_exit - Undefined Weak Reference + __Vectors 0x18004000 Data 4 startup.o(RESET) + __main 0x18004099 Thumb Code 0 entry.o(.ARM.Collect$$$$00000000) + _main_stk 0x18004099 Thumb Code 0 entry2.o(.ARM.Collect$$$$00000001) + _main_scatterload 0x1800409d Thumb Code 0 entry5.o(.ARM.Collect$$$$00000004) + __main_after_scatterload 0x180040a1 Thumb Code 0 entry5.o(.ARM.Collect$$$$00000004) + _main_clock 0x180040a1 Thumb Code 0 entry7b.o(.ARM.Collect$$$$00000008) + _main_cpp_init 0x180040a1 Thumb Code 0 entry8b.o(.ARM.Collect$$$$0000000A) + _main_init 0x180040a1 Thumb Code 0 entry9a.o(.ARM.Collect$$$$0000000B) + __rt_final_cpp 0x180040a9 Thumb Code 0 entry10a.o(.ARM.Collect$$$$0000000D) + __rt_final_exit 0x180040a9 Thumb Code 0 entry11a.o(.ARM.Collect$$$$0000000F) + Reset_Handler 0x180040ad Thumb Code 38 startup.o(.INT) + NMI_Handler 0x180040d3 Thumb Code 2 startup.o(.INT) + HardFault_Handler 0x180040d5 Thumb Code 2 startup.o(.INT) + SVCall_Handler 0x180040d7 Thumb Code 2 startup.o(.INT) + PendSV_Handler 0x180040d9 Thumb Code 2 startup.o(.INT) + SysTick_Handler 0x180040db Thumb Code 2 startup.o(.INT) + AON_PMU_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + ATMR_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + BB_LP_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + BOD12_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + BTMR_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + CTMR_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + DMAC_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + EXTI_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + FSHC_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + I2C_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + IWDT_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + LVD33_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + MDM_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + RF_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + RTC_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + SPIM_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + SPIS_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + UART2_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + USB_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + USB_SOF_IRQHandler 0x180040dd Thumb Code 0 startup.o(.INT) + rf_reset 0x180041fd Thumb Code 170 rf_mdm.o(.text) + rf_pa_set 0x180042a7 Thumb Code 28 rf_mdm.o(.text) + rf_dac_tab0_set 0x180042c3 Thumb Code 10 rf_mdm.o(.text) + rf_dac_tab1_set 0x180042cd Thumb Code 10 rf_mdm.o(.text) + rf_dac_tab2_set 0x180042d7 Thumb Code 14 rf_mdm.o(.text) + co_ones 0x1800438d Thumb Code 36 utils.o(.text) + le_sca2ppm 0x180043b1 Thumb Code 28 utils.o(.text) + le_ppm2sca 0x180043cd Thumb Code 32 utils.o(.text) + gapc_process_op_simple 0x18004405 Thumb Code 90 gapc_task.o(.text) + gapc_disconnect_cmd_send 0x180044bb Thumb Code 102 gapc_task.o(.text) + gapc_connection_cfg_send 0x18004521 Thumb Code 120 gapc_task.o(.text) + gapc_param_update_rsp 0x180046e1 Thumb Code 130 gapc_task.o(.text) + gapc_smp_pairing_tk_exch 0x18005719 Thumb Code 132 gapc_smp.o(.text) + gapc_smp_pairing_ltk_exch 0x1800579d Thumb Code 138 gapc_smp.o(.text) + gapc_smp_pairing_csrk_exch 0x18005827 Thumb Code 92 gapc_smp.o(.text) + gapc_smp_pairing_rsp 0x18005883 Thumb Code 372 gapc_smp.o(.text) + gapc_smp_encrypt_cfm 0x180059f7 Thumb Code 58 gapc_smp.o(.text) + gapc_smp_pdu_recv 0x18005a31 Thumb Code 82 gapc_smp.o(.text) + gapc_smp_cleanup 0x18005a83 Thumb Code 36 gapc_smp.o(.text) + gapc_smp_cmd_handler 0x18005aa7 Thumb Code 310 gapc_smp.o(.text) + gapc_key_press_notify 0x18005bdd Thumb Code 80 gapc_smp.o(.text) + gapc_smp_gapm_cmp_evt 0x18005c2d Thumb Code 84 gapc_smp.o(.text) + gapc_smp_timer_ind_handler 0x18005c81 Thumb Code 84 gapc_smp.o(.text) + le_ltk_req_evt 0x18005cd5 Thumb Code 86 gapc_smp.o(.text) + le_enc_chg_evt 0x18005d2b Thumb Code 30 gapc_smp.o(.text) + attmdb_svc_check_hdl 0x18005e29 Thumb Code 72 attm_db.o(.text) + attmdb_svc_create 0x18005f35 Thumb Code 370 attm_db.o(.text) + attm_con_create 0x180060a7 Thumb Code 36 attm_db.o(.text) + attm_con_cleanup 0x180060cb Thumb Code 40 attm_db.o(.text) + attmdb_destroy 0x180060f3 Thumb Code 48 attm_db.o(.text) + attmdb_get_service2 0x18006123 Thumb Code 72 attm_db.o(.text) + attmdb_svc_visibility_set 0x1800616b Thumb Code 62 attm_db.o(.text) + attmdb_chk_wr_len 0x180061a9 Thumb Code 74 attm_db.o(.text) + attm_get_svc_uuid 0x180061f3 Thumb Code 64 attm_db.o(.text) + attm_get_att_uuid 0x18006233 Thumb Code 52 attm_db.o(.text) + attm_get_hdl_uuid 0x18006267 Thumb Code 42 attm_db.o(.text) + attmdb_att_get_perm 0x18006291 Thumb Code 184 attm_db.o(.text) + gap_svc_set_dev_info 0x180063e1 Thumb Code 4 gap_svc.o(.text) + gap_svc_func 0x180063e5 Thumb Code 254 gap_svc.o(.text) + gap_svc_init 0x180064e3 Thumb Code 148 gap_svc.o(.text) + gatt_svc_func 0x1800658d Thumb Code 228 gatt_svc.o(.text) + gattc_svc_chg_ind_send 0x18006671 Thumb Code 64 gatt_svc.o(.text) + gatt_svc_init 0x180066b1 Thumb Code 44 gatt_svc.o(.text) + gattm_db_updated 0x180066dd Thumb Code 50 gatt_svc.o(.text) + ke_mem_init 0x1800672d Thumb Code 52 ke_mem.o(.text) + ke_task_create 0x18006777 Thumb Code 22 ke_task.o(.text) + ke_timer_active 0x18006813 Thumb Code 38 ke_timer.o(.text) + ke_event_callback_set 0x1800683d Thumb Code 14 ke_event.o(.text) + aes_alloc 0x18006851 Thumb Code 22 aes.o(.text) + aes_start 0x18006867 Thumb Code 42 aes.o(.text) + aes_encrypt 0x18006891 Thumb Code 98 aes.o(.text) + aes_rand 0x180068f3 Thumb Code 46 aes.o(.text) + aes_result_handler 0x18006921 Thumb Code 86 aes.o(.text) + aes_xor_128 0x18006977 Thumb Code 22 aes.o(.text) + aes_shift_left_128 0x1800698d Thumb Code 36 aes.o(.text) + aes_c1 0x180069f3 Thumb Code 70 aes_c1.o(.text) + gapm_update_state 0x18006a41 Thumb Code 42 gapm.o(.text) + gapm_send_cmp_evt 0x18006a93 Thumb Code 26 gapm.o(.text) + gapm_process_op_simple 0x18006aad Thumb Code 60 gapm.o(.text) + gapm_send_complete_evt 0x18006ae9 Thumb Code 60 gapm.o(.text) + gapm_con_create 0x18006b25 Thumb Code 86 gapm.o(.text) + gapm_con_cleanup 0x18006b7b Thumb Code 48 gapm.o(.text) + gapm_con_number 0x18006bab Thumb Code 28 gapm.o(.text) + gapc_update_state 0x18006c01 Thumb Code 48 gapc.o(.text) + gapc_send_cmp_evt 0x18006c31 Thumb Code 34 gapc.o(.text) + gapc_send_complete_evt 0x18006c53 Thumb Code 72 gapc.o(.text) + gapc_cleanup 0x18006c9b Thumb Code 112 gapc.o(.text) + gapc_con_create 0x18006d0b Thumb Code 264 gapc.o(.text) + gapc_get_conidx 0x18006e13 Thumb Code 38 gapc.o(.text) + gapc_get_conhdl 0x18006e39 Thumb Code 24 gapc.o(.text) + gapc_get_role 0x18006e51 Thumb Code 28 gapc.o(.text) + gapc_set_local_addr 0x18006e6d Thumb Code 28 gapc.o(.text) + gapc_get_bdaddr 0x18006e89 Thumb Code 32 gapc.o(.text) + gapc_get_chan_sel_algo 0x18006ea9 Thumb Code 20 gapc.o(.text) + gapc_is_sec_set 0x18006ebd Thumb Code 52 gapc.o(.text) + gapc_lk_sec_lvl_get 0x18006ef1 Thumb Code 28 gapc.o(.text) + gapc_enc_keysize_get 0x18006f0d Thumb Code 24 gapc.o(.text) + gapc_auth_set 0x18006f25 Thumb Code 88 gapc.o(.text) + gapc_param_update_sanity 0x18006f7d Thumb Code 42 gapc.o(.text) + gattc_create 0x18006ffb Thumb Code 62 gattc.o(.text) + gattc_send_cmp_evt 0x18007039 Thumb Code 90 gattc.o(.text) + gattc_send_complete_evt 0x18007093 Thumb Code 62 gattc.o(.text) + gattc_cleanup 0x180070d1 Thumb Code 154 gattc.o(.text) + gatt_get_mtu 0x1800716b Thumb Code 10 gattc.o(.text) + gatt_set_mtu 0x18007175 Thumb Code 82 gattc.o(.text) + l2cc_create 0x180071d9 Thumb Code 50 l2cc.o(.text) + l2cc_send_cmp_evt_status 0x1800720b Thumb Code 124 l2cc.o(.text) + l2cc_cleanup 0x18007287 Thumb Code 108 l2cc.o(.text) + l2cc_data_send 0x180072f3 Thumb Code 240 l2cc.o(.text) + l2cc_smp_pdu_alloc 0x180073e3 Thumb Code 36 l2cc.o(.text) + l2cc_att_pdu_alloc 0x18007407 Thumb Code 36 l2cc.o(.text) + l2cc_ind_pdu_alloc 0x1800742b Thumb Code 58 l2cc.o(.text) + l2cc_sig_send_cmd_reject 0x1800747d Thumb Code 60 l2cc_sig.o(.text) + l2cc_sig_send_param_resp 0x180074b9 Thumb Code 46 l2cc_sig.o(.text) + l2cc_sig_send_param_upd_req 0x180074e7 Thumb Code 60 l2cc_sig.o(.text) + l2cc_sig_pdu_recv_handler 0x18007523 Thumb Code 58 l2cc_sig.o(.text) + attm_is_bt_uuid 0x18007689 Thumb Code 50 attm.o(.text) + attm_uuid32_conv 0x180076bb Thumb Code 38 attm.o(.text) + attm_uuid_comp 0x180076e1 Thumb Code 72 attm.o(.text) + attm_uuid16_comp 0x18007729 Thumb Code 42 attm.o(.text) + attm_reserve_handle_range 0x18007753 Thumb Code 12 attm.o(.text) + attm_get_value 0x1800775f Thumb Code 238 attm.o(.text) + attm_att_set_value 0x1800784d Thumb Code 126 attm.o(.text) + attm_att_set_perm 0x180078cb Thumb Code 88 attm.o(.text) + attm_att_update_perm 0x18007923 Thumb Code 78 attm.o(.text) + atts_get_svc_func 0x1800798d Thumb Code 16 atts.o(.text) + atts_clear_read_cache 0x18007a31 Thumb Code 28 atts.o(.text) + atts_send_event 0x18007b5d Thumb Code 100 atts.o(.text) + atts_clear_prep_data 0x18007bc1 Thumb Code 28 atts.o(.text) + atts_clear_rsp_data 0x18007bdd Thumb Code 28 atts.o(.text) + atts_send_error 0x18007bf9 Thumb Code 30 atts.o(.text) + atts_write_rsp_send 0x18007c17 Thumb Code 34 atts.o(.text) + atts_process_pdu 0x1800879f Thumb Code 94 atts.o(.text) + atts_pdu_recv_handler 0x180087fd Thumb Code 136 atts.o(.text) + llm_is_dev_connected 0x180089cd Thumb Code 70 llm.o(.text) + llm_link_disc 0x18008a13 Thumb Code 20 llm.o(.text) + llm_activity_free_get 0x18008a27 Thumb Code 54 llm.o(.text) + llc_disconnect 0x18008a65 Thumb Code 40 llc_disconnect.o(.text) + llc_disconnect_proc_err 0x18008b0d Thumb Code 10 llc_disconnect.o(.text) + ll_terminate_ind_handler 0x18008b17 Thumb Code 52 llc_disconnect.o(.text) + lld_disc_ind_handler 0x18008b4b Thumb Code 98 llc_disconnect.o(.text) + llc_op_disconnect_ind_cb 0x18008bad Thumb Code 62 llc_disconnect.o(.text) + le_disconnect 0x18008beb Thumb Code 94 llc_disconnect.o(.text) + llc_init_term_proc 0x18008c49 Thumb Code 38 llc_disconnect.o(.text) + llc_ver_exch_proc_err 0x18008ce9 Thumb Code 10 llc_ver_exch.o(.text) + llc_op_ver_exch_ind_cb 0x18008cf3 Thumb Code 56 llc_ver_exch.o(.text) + ll_version_ind_handler 0x18008d2b Thumb Code 72 llc_ver_exch.o(.text) + le_rd_rem_ver_info 0x18008d73 Thumb Code 80 llc_ver_exch.o(.text) + llc_loc_encrypt_proc_err 0x18009377 Thumb Code 66 llc_encrypt.o(.text) + llc_rem_encrypt_proc_err 0x180093b9 Thumb Code 46 llc_encrypt.o(.text) + ll_pause_enc_req_handler 0x180093e7 Thumb Code 78 llc_encrypt.o(.text) + ll_pause_enc_rsp_handler 0x18009435 Thumb Code 66 llc_encrypt.o(.text) + ll_enc_req_handler 0x18009477 Thumb Code 170 llc_encrypt.o(.text) + ll_enc_rsp_handler 0x18009521 Thumb Code 102 llc_encrypt.o(.text) + ll_start_enc_req_handler 0x18009587 Thumb Code 68 llc_encrypt.o(.text) + ll_start_enc_rsp_handler 0x180095cb Thumb Code 68 llc_encrypt.o(.text) + le_start_enc 0x1800960f Thumb Code 170 llc_encrypt.o(.text) + le_ltk_req_reply 0x180096b9 Thumb Code 114 llc_encrypt.o(.text) + llc_op_encrypt_ind_cb 0x1800972b Thumb Code 50 llc_encrypt.o(.text) + llc_feats_exch_proc_err 0x18009811 Thumb Code 84 llc_feat_exch.o(.text) + ll_feature_req_handler 0x18009865 Thumb Code 74 llc_feat_exch.o(.text) + ll_slave_feature_req_handler 0x180098af Thumb Code 74 llc_feat_exch.o(.text) + ll_feature_rsp_handler 0x180098f9 Thumb Code 76 llc_feat_exch.o(.text) + le_rd_rem_feats 0x18009945 Thumb Code 120 llc_feat_exch.o(.text) + llc_op_feats_exch_ind_cb 0x180099bd Thumb Code 56 llc_feat_exch.o(.text) + llc_dle_proc_err 0x18009bdb Thumb Code 88 llc_dl_upd.o(.text) + ll_length_req_handler 0x18009c33 Thumb Code 108 llc_dl_upd.o(.text) + ll_length_rsp_handler 0x18009c9f Thumb Code 170 llc_dl_upd.o(.text) + le_set_data_len 0x18009d49 Thumb Code 146 llc_dl_upd.o(.text) + llc_op_dl_upd_ind_cb 0x18009ddb Thumb Code 66 llc_dl_upd.o(.text) + llc_loc_con_upd_proc_fsm 0x1800a07b Thumb Code 460 llc_con_upd.o(.text) + llc_loc_con_upd_proc_err 0x1800a247 Thumb Code 104 llc_con_upd.o(.text) + llc_rem_con_upd_proc_fsm 0x1800a2af Thumb Code 322 llc_con_upd.o(.text) + llc_rem_con_upd_proc_err 0x1800a3f1 Thumb Code 42 llc_con_upd.o(.text) + ll_con_update_ind_handler 0x1800a41b Thumb Code 224 llc_con_upd.o(.text) + ll_con_param_req_handler 0x1800a4fb Thumb Code 276 llc_con_upd.o(.text) + ll_con_param_rsp_handler 0x1800a60f Thumb Code 214 llc_con_upd.o(.text) + le_con_param_upd 0x1800a6e5 Thumb Code 208 llc_con_upd.o(.text) + le_rem_con_param_req_reply 0x1800a7b5 Thumb Code 94 llc_con_upd.o(.text) + llc_op_con_upd_ind_cb 0x1800a813 Thumb Code 92 llc_con_upd.o(.text) + lld_con_offset_ind_handler 0x1800a86f Thumb Code 80 llc_con_upd.o(.text) + llc_con_move_cbk 0x1800a8bf Thumb Code 182 llc_con_upd.o(.text) + llc_loc_phy_upd_proc_fsm 0x1800a97d Thumb Code 616 llc_phy_upd.o(.text) + llc_loc_phy_upd_proc_err 0x1800abe5 Thumb Code 84 llc_phy_upd.o(.text) + llc_rem_phy_upd_proc_fsm 0x1800ac39 Thumb Code 328 llc_phy_upd.o(.text) + llc_rem_phy_upd_proc_err 0x1800ad81 Thumb Code 10 llc_phy_upd.o(.text) + ll_phy_req_handler 0x1800ad8b Thumb Code 140 llc_phy_upd.o(.text) + ll_phy_rsp_handler 0x1800ae17 Thumb Code 98 llc_phy_upd.o(.text) + ll_phy_upd_ind_handler 0x1800ae79 Thumb Code 152 llc_phy_upd.o(.text) + le_rd_phy 0x1800af11 Thumb Code 38 llc_phy_upd.o(.text) + le_set_phy 0x1800af37 Thumb Code 144 llc_phy_upd.o(.text) + llc_op_phy_upd_ind_cb 0x1800afc7 Thumb Code 82 llc_phy_upd.o(.text) + lld_rxdesc_free 0x1800b021 Thumb Code 48 lld.o(.text) + lld_rxdesc_check 0x1800b051 Thumb Code 34 lld.o(.text) + lld_aa_gen 0x1800b073 Thumb Code 114 lld.o(.text) + lld_con_start 0x1800ba11 Thumb Code 742 lld_con.o(.text) + lld_con_stop 0x1800bcf7 Thumb Code 108 lld_con.o(.text) + lld_con_llcp_tx 0x1800bd63 Thumb Code 56 lld_con.o(.text) + lld_con_data_tx 0x1800bd9b Thumb Code 116 lld_con.o(.text) + lld_con_data_flow_set 0x1800be0f Thumb Code 70 lld_con.o(.text) + lld_con_param_update 0x1800be55 Thumb Code 76 lld_con.o(.text) + lld_con_ch_map_update 0x1800bea1 Thumb Code 54 lld_con.o(.text) + lld_con_data_len_update 0x1800bed7 Thumb Code 56 lld_con.o(.text) + lld_con_phys_update 0x1800bf0f Thumb Code 72 lld_con.o(.text) + lld_con_tx_rate_update 0x1800bf57 Thumb Code 58 lld_con.o(.text) + lld_con_event_counter_get 0x1800bf91 Thumb Code 30 lld_con.o(.text) + lld_con_actv_offset_compute 0x1800bfaf Thumb Code 102 lld_con.o(.text) + lld_con_tx_enc 0x1800c015 Thumb Code 48 lld_con.o(.text) + lld_con_rx_enc 0x1800c045 Thumb Code 48 lld_con.o(.text) + lld_con_enc_key_load 0x1800c075 Thumb Code 108 lld_con.o(.text) + lld_con_rssi_get 0x1800c0e1 Thumb Code 30 lld_con.o(.text) + lld_con_offset_get 0x1800c0ff Thumb Code 42 lld_con.o(.text) + plf_reset 0x1800c13d Thumb Code 18 plf.o(.text) + sch_arb_insert 0x1800c38f Thumb Code 498 sch_arb.o(.text) + sch_arb_remove 0x1800c581 Thumb Code 88 sch_arb.o(.text) + sch_prog_push0 0x1800c5dd Thumb Code 230 sch_prog.o(.text) + sch_plan_set 0x1800c94b Thumb Code 100 sch_plan.o(.text) + sch_plan_rem 0x1800c9af Thumb Code 12 sch_plan.o(.text) + sch_plan_req 0x1800c9bb Thumb Code 192 sch_plan.o(.text) + sch_plan_chk 0x1800ca7b Thumb Code 10 sch_plan.o(.text) + sch_slice_compute 0x1800ca8d Thumb Code 134 sch_slice.o(.text) + sch_slice_fg_add 0x1800cb13 Thumb Code 10 sch_slice.o(.text) + sch_slice_fg_remove 0x1800cb1d Thumb Code 30 sch_slice.o(.text) + sch_slice_per_add 0x1800cb3b Thumb Code 38 sch_slice.o(.text) + sch_slice_per_remove 0x1800cb61 Thumb Code 30 sch_slice.o(.text) + gattc_process_op_simple 0x1800cb95 Thumb Code 102 gattc_task.o(.text) + gapm_is_addr_type_valid 0x1800d0d9 Thumb Code 50 gapm_actv.o(.text) + gapm_is_con_actv_full 0x1800d10b Thumb Code 66 gapm_actv.o(.text) + gapm_actv_alloc 0x1800d14d Thumb Code 44 gapm_actv.o(.text) + gapm_actv_get_next 0x1800d179 Thumb Code 38 gapm_actv.o(.text) + gapm_actv_get_own_addr_type 0x1800d19f Thumb Code 20 gapm_actv.o(.text) + gapm_actv_created 0x1800d1b3 Thumb Code 106 gapm_actv.o(.text) + gapm_actv_started 0x1800d21d Thumb Code 32 gapm_actv.o(.text) + gapm_actv_stopped 0x1800d23d Thumb Code 98 gapm_actv.o(.text) + gapm_actv_deleted 0x1800d29f Thumb Code 62 gapm_actv.o(.text) + gapm_actv_cmd_handler 0x1800d2dd Thumb Code 314 gapm_actv.o(.text) + le_actv_cmp_send 0x1800d417 Thumb Code 26 gapm_actv.o(.text) + gapm_actv_cmp_evt_handler 0x1800d431 Thumb Code 88 gapm_actv.o(.text) + le_enh_con_cmp_evt 0x1800d489 Thumb Code 32 gapm_actv.o(.text) + le_disc_cmp_evt 0x1800d4cd Thumb Code 102 gapc_hci.o(.text) + le_rd_rem_ver_info_cmp_evt 0x1800d533 Thumb Code 124 gapc_hci.o(.text) + le_rd_rem_feats_cmp_evt 0x1800d5af Thumb Code 148 gapc_hci.o(.text) + le_con_estab_evt 0x1800d643 Thumb Code 54 gapc_hci.o(.text) + le_con_update_cmp_evt 0x1800d679 Thumb Code 144 gapc_hci.o(.text) + le_rem_con_param_req_evt 0x1800d709 Thumb Code 78 gapc_hci.o(.text) + le_data_len_chg_evt 0x1800d757 Thumb Code 64 gapc_hci.o(.text) + le_phy_upd_cmp_evt 0x1800d797 Thumb Code 94 gapc_hci.o(.text) + l2cm_tx_status 0x1800d801 Thumb Code 42 l2cm.o(.text) + l2cc_pdu_pack 0x1800d831 Thumb Code 152 l2cc_pdu.o(.text) + l2cc_pdu_unpack 0x1800d8c9 Thumb Code 142 l2cc_pdu.o(.text) + l2cc_pdu_rx_init 0x1800d957 Thumb Code 76 l2cc_pdu.o(.text) + l2cc_pdu_header_check 0x1800d9a3 Thumb Code 218 l2cc_pdu.o(.text) + llc_cleanup 0x1800dad3 Thumb Code 98 llc.o(.text) + llc_start 0x1800db35 Thumb Code 238 llc.o(.text) + llc_llcp_state_set 0x1800dc23 Thumb Code 78 llc.o(.text) + llc_proc_reg 0x1800dc71 Thumb Code 44 llc.o(.text) + llc_proc_timer_set 0x1800dc9d Thumb Code 84 llc.o(.text) + llc_proc_unreg 0x1800dcf1 Thumb Code 68 llc.o(.text) + llc_proc_err_ind 0x1800dd35 Thumb Code 154 llc.o(.text) + llc_proc_op_ind_handler 0x1800ddcf Thumb Code 130 llc.o(.text) + lld_proc_upd_cfm_handler 0x1800de51 Thumb Code 144 llc.o(.text) + llc_llcp_rsp_to_handler 0x1800dee1 Thumb Code 16 llc.o(.text) + llc_proc_timer_pause_set 0x1800def1 Thumb Code 82 llc.o(.text) + llc_proc_collision_check 0x1800df43 Thumb Code 42 llc.o(.text) + llc_llcp_tx_check 0x1800df71 Thumb Code 136 llc_llcp.o(.text) + llc_llcp_send 0x1800dff9 Thumb Code 80 llc_llcp.o(.text) + llc_ll_reject_ind_pdu_send 0x1800e099 Thumb Code 70 llc_llcp.o(.text) + lld_llcp_rx_ind 0x1800e0df Thumb Code 162 llc_llcp.o(.text) + lld_adv_restart 0x1800e31b Thumb Code 66 lld_adv.o(.text) + lld_adv_start 0x1800e35d Thumb Code 770 lld_adv.o(.text) + lld_adv_stop 0x1800e65f Thumb Code 90 lld_adv.o(.text) + lld_adv_data_update 0x1800e6b9 Thumb Code 40 lld_adv.o(.text) + lld_scan_restart 0x1800e915 Thumb Code 80 lld_scan.o(.text) + lld_scan_start 0x1800e965 Thumb Code 746 lld_scan.o(.text) + lld_scan_stop 0x1800ec4f Thumb Code 30 lld_scan.o(.text) + lld_scan_params_update 0x1800ec6d Thumb Code 74 lld_scan.o(.text) + lld_init_start 0x1800eeaf Thumb Code 890 lld_init.o(.text) + lld_init_stop 0x1800f229 Thumb Code 30 lld_init.o(.text) + sch_alarm_set 0x1800f2b7 Thumb Code 126 sch_alarm.o(.text) + sch_alarm_clear 0x1800f335 Thumb Code 58 sch_alarm.o(.text) + le_nb_cmp_pkts_evt 0x1800f3b3 Thumb Code 44 l2cc_task.o(.text) + gapm_config_cmd_handler 0x1800f4f9 Thumb Code 240 gapm_cfg.o(.text) + gapm_sec_enc_aes_cmd_handler 0x1800f729 Thumb Code 94 gapm_smp.o(.text) + gapm_adv_create 0x1800f86f Thumb Code 138 gapm_adv.o(.text) + gapm_set_adv_data_cmd_handler 0x1800f8f9 Thumb Code 50 gapm_adv.o(.text) + gapm_actv_adv_fsm 0x1800f92b Thumb Code 156 gapm_adv.o(.text) + le_scan_req_rcvd_evt 0x1800f9c7 Thumb Code 64 gapm_adv.o(.text) + le_adv_set_term_evt 0x1800fa07 Thumb Code 90 gapm_adv.o(.text) + gapm_scan_create 0x1800fbed Thumb Code 84 gapm_scan.o(.text) + gapm_actv_scan_fsm 0x1800fc41 Thumb Code 68 gapm_scan.o(.text) + le_ext_adv_report_evt 0x1800fc85 Thumb Code 274 gapm_scan.o(.text) + le_scan_timeout_evt 0x1800fd97 Thumb Code 32 gapm_scan.o(.text) + gapm_init_create 0x1800feb3 Thumb Code 86 gapm_init.o(.text) + gapm_init_connection_ind 0x1800ff09 Thumb Code 68 gapm_init.o(.text) + gapm_init_conn_to_handler 0x1800ff4d Thumb Code 54 gapm_init.o(.text) + gapm_actv_init_fsm 0x1800ff83 Thumb Code 76 gapm_init.o(.text) + attc_send_hdl_cfm 0x18010069 Thumb Code 18 attc.o(.text) + attc_send_att_req 0x1801007b Thumb Code 28 attc.o(.text) + attc_send_read_ind 0x18010097 Thumb Code 222 attc.o(.text) + attc_pdu_recv_handler 0x180109ad Thumb Code 86 attc.o(.text) + le_set_dft_phy 0x18010a19 Thumb Code 34 llm_hci.o(.text) + le_wr_suggted_dft_data_len 0x18010a3b Thumb Code 32 llm_hci.o(.text) + le_set_rand_addr 0x18010a5b Thumb Code 68 llm_hci.o(.text) + le_set_static_addr 0x18010a9f Thumb Code 28 llm_hci.o(.text) + llm_adv_hdl_to_id 0x18010ac9 Thumb Code 42 llm_adv.o(.text) + le_set_adv_set_rand_addr 0x18010af3 Thumb Code 86 llm_adv.o(.text) + le_set_ext_adv_param 0x18010b49 Thumb Code 130 llm_adv.o(.text) + le_set_ext_adv_data 0x18010bcb Thumb Code 198 llm_adv.o(.text) + le_set_ext_adv_en 0x18010c91 Thumb Code 210 llm_adv.o(.text) + le_rmv_adv_set 0x18010d63 Thumb Code 40 llm_adv.o(.text) + lld_adv_end_ind_handler 0x18010d8b Thumb Code 178 llm_adv.o(.text) + le_set_ext_scan_param 0x18010e85 Thumb Code 118 llm_scan.o(.text) + le_set_ext_scan_en 0x18010efb Thumb Code 198 llm_scan.o(.text) + llm_scan_period_to_handler 0x18010fc1 Thumb Code 40 llm_scan.o(.text) + lld_adv_rep_ind_handler 0x18010fe9 Thumb Code 560 llm_scan.o(.text) + lld_scan_end_ind_handler 0x18011219 Thumb Code 104 llm_scan.o(.text) + le_ext_create_con 0x18011281 Thumb Code 260 llm_init.o(.text) + le_create_con_cancel 0x18011385 Thumb Code 58 llm_init.o(.text) + lld_init_end_ind_handler 0x180113bf Thumb Code 146 llm_init.o(.text) + lld_con_rx_ind_handler 0x1801145d Thumb Code 86 llc_hci.o(.text) + lld_con_tx_cfm_handler 0x180114b3 Thumb Code 58 llc_hci.o(.text) + llc_rem_ch_map_proc_fsm 0x180114f1 Thumb Code 82 llc_chmap_upd.o(.text) + llc_ch_map_up_proc_err 0x18011543 Thumb Code 30 llc_chmap_upd.o(.text) + ll_channel_map_ind_handler 0x18011561 Thumb Code 110 llc_chmap_upd.o(.text) + le_rd_chnl_map 0x180115cf Thumb Code 28 llc_chmap_upd.o(.text) + __aeabi_uidiv 0x180115f9 Thumb Code 0 uidiv.o(.text) + __aeabi_uidivmod 0x180115f9 Thumb Code 44 uidiv.o(.text) + __aeabi_idiv 0x18011625 Thumb Code 0 idiv.o(.text) + __aeabi_idivmod 0x18011625 Thumb Code 40 idiv.o(.text) + __aeabi_uldivmod 0x1801164d Thumb Code 96 uldiv.o(.text) + __scatterload 0x180116ad Thumb Code 28 init.o(.text) + __scatterload_rt2 0x180116ad Thumb Code 0 init.o(.text) + __aeabi_llsl 0x180116d1 Thumb Code 32 llshl.o(.text) + _ll_shift_l 0x180116d1 Thumb Code 0 llshl.o(.text) + __aeabi_llsr 0x180116f1 Thumb Code 34 llushr.o(.text) + _ll_ushift_r 0x180116f1 Thumb Code 0 llushr.o(.text) + UART1_IRQHandler 0x18011715 Thumb Code 106 uart1rb.o(i.UART1_IRQHandler) + __0printf$8 0x18011789 Thumb Code 24 printf8.o(i.__0printf$8) + __1printf$8 0x18011789 Thumb Code 0 printf8.o(i.__0printf$8) + __2printf 0x18011789 Thumb Code 0 printf8.o(i.__0printf$8) + __ARM_common_switch8 0x180117a9 Thumb Code 26 app_actv.o(i.__ARM_common_switch8) + __scatterload_copy 0x180117c3 Thumb Code 14 handlers.o(i.__scatterload_copy) + __scatterload_null 0x180117d1 Thumb Code 2 handlers.o(i.__scatterload_null) + __scatterload_zeroinit 0x180117d3 Thumb Code 14 handlers.o(i.__scatterload_zeroinit) + app_actv_cmp_evt 0x18011c55 Thumb Code 20 app_actv.o(i.app_actv_cmp_evt) + app_actv_create 0x18011c69 Thumb Code 20 app_actv.o(i.app_actv_create) + app_actv_created_ind 0x18011c85 Thumb Code 10 app_actv.o(i.app_actv_created_ind) + app_actv_stopped_ind 0x18011c95 Thumb Code 36 app_actv.o(i.app_actv_stopped_ind) + app_adv_action 0x18011cbd Thumb Code 116 app_actv.o(i.app_adv_action) + app_adv_event 0x18011d61 Thumb Code 136 app_actv.o(i.app_adv_event) + app_conf_fsm 0x18011ded Thumb Code 44 app.o(i.app_conf_fsm) + app_conn_fsm 0x18011e25 Thumb Code 60 app.o(i.app_conn_fsm) + app_custom_handler 0x18011e65 Thumb Code 4 app_msg.o(i.app_custom_handler) + app_gapc_msg_handler 0x180123d9 Thumb Code 350 app_gapc.o(i.app_gapc_msg_handler) + app_gapm_msg_handler 0x18012709 Thumb Code 82 app_gapm.o(i.app_gapm_msg_handler) + app_init 0x1801275d Thumb Code 48 app.o(i.app_init) + app_ltk_find 0x18012799 Thumb Code 4 app.o(i.app_ltk_find) + app_ltk_gen 0x1801279d Thumb Code 2 app.o(i.app_ltk_gen) + app_ltk_save 0x1801279f Thumb Code 2 app.o(i.app_ltk_save) + app_name_get 0x180127a1 Thumb Code 44 app.o(i.app_name_get) + app_pairing_get 0x180127dd Thumb Code 24 app.o(i.app_pairing_get) + app_prf_create 0x180127f5 Thumb Code 26 app.o(i.app_prf_create) + app_state_set 0x18012811 Thumb Code 6 app.o(i.app_state_set) + core_vector 0x1801281d Thumb Code 34 core.o(i.core_vector) + diss_svc_init 0x1801292d Thumb Code 64 prf_diss.o(i.diss_svc_init) + diss_value_get 0x18012979 Thumb Code 66 prf_diss.o(i.diss_value_get) + fputc 0x180129e9 Thumb Code 16 debug.o(i.fputc) + gap_svc_get_dev_info 0x180129f9 Thumb Code 32 app.o(i.gap_svc_get_dev_info) + gapc_connect_rsp 0x18012a19 Thumb Code 34 gap_api.o(i.gapc_connect_rsp) + gapc_disconnect 0x18012a41 Thumb Code 12 gap_api.o(i.gapc_disconnect) + gapm_create_advertising 0x18012a4d Thumb Code 46 gap_api.o(i.gapm_create_advertising) + gapm_delete_activity 0x18012a81 Thumb Code 38 gap_api.o(i.gapm_delete_activity) + gapm_reset 0x18012aa9 Thumb Code 24 gap_api.o(i.gapm_reset) + gapm_set_adv_data 0x18012ac5 Thumb Code 50 gap_api.o(i.gapm_set_adv_data) + gapm_set_dev 0x18012b01 Thumb Code 100 gap_api.o(i.gapm_set_dev) + gapm_start_activity 0x18012b75 Thumb Code 48 gap_api.o(i.gapm_start_activity) + gapm_start_advertising 0x18012ba9 Thumb Code 18 gap_api.o(i.gapm_start_advertising) + gapm_stop_activity 0x18012bbb Thumb Code 30 gap_api.o(i.gapm_stop_activity) + gatt_info_cfm 0x18012bd9 Thumb Code 38 gatt_api.o(i.gatt_info_cfm) + gatt_ntf_send 0x18012c05 Thumb Code 62 gatt_api.o(i.gatt_ntf_send) + gatt_read_cfm 0x18012c49 Thumb Code 60 gatt_api.o(i.gatt_read_cfm) + gatt_write_cfm 0x18012c8d Thumb Code 34 gatt_api.o(i.gatt_write_cfm) + main 0x18012cb5 Thumb Code 78 main.o(i.main) + rcc_adc_en 0x18012d21 Thumb Code 32 rcc.o(i.rcc_adc_en) + rcc_ble_en 0x18012d41 Thumb Code 56 rcc.o(i.rcc_ble_en) + rcc_sysclk_get 0x18012d81 Thumb Code 54 rcc.o(i.rcc_sysclk_get) + sess_cb_rxd 0x18012db7 Thumb Code 10 proc.o(i.sess_cb_rxd) + sess_svc_init 0x18012e95 Thumb Code 24 prf_sess.o(i.sess_svc_init) + sess_txd_send 0x18012eb9 Thumb Code 60 prf_sess.o(i.sess_txd_send) + trim_load 0x18012ef9 Thumb Code 218 trim.o(i.trim_load) + uart1Rb_Init 0x18012ff9 Thumb Code 52 uart1rb.o(i.uart1Rb_Init) + uart1Rb_Read 0x18013035 Thumb Code 66 uart1rb.o(i.uart1Rb_Read) + uart_conf 0x1801307d Thumb Code 44 uart.o(i.uart_conf) + uart_fctl 0x180130ad Thumb Code 36 uart.o(i.uart_fctl) + uart_init 0x180130d9 Thumb Code 100 uart.o(i.uart_init) + uart_putc 0x18013149 Thumb Code 16 uart.o(i.uart_putc) + uart_send 0x1801315d Thumb Code 44 uart.o(i.uart_send) + user_procedure 0x1801318d Thumb Code 36 proc.o(i.user_procedure) + ble_buf_rx_alloc 0x180131b9 Thumb Code 44 ble_buf.o(ke_list_api_func) + ble_buf_rx_free 0x180131e5 Thumb Code 34 ble_buf.o(ke_list_api_func) + ble_buf_acl_tx_alloc 0x18013207 Thumb Code 52 ble_buf.o(ke_list_api_func) + ble_buf_acl_tx_free 0x1801323b Thumb Code 32 ble_buf.o(ke_list_api_func) + ble_buf_llcp_tx_alloc 0x1801325b Thumb Code 56 ble_buf.o(ke_list_api_func) + ble_buf_llcp_tx_free 0x18013293 Thumb Code 38 ble_buf.o(ke_list_api_func) + ble_buf_adv_tx_alloc 0x180132b9 Thumb Code 48 ble_buf.o(ke_list_api_func) + ble_buf_adv_tx_elt_get 0x180132e9 Thumb Code 10 ble_buf.o(ke_list_api_func) + ble_buf_adv_tx_free 0x180132f3 Thumb Code 30 ble_buf.o(ke_list_api_func) + list_size 0x18013319 Thumb Code 20 list.o(ke_list_api_func) + list_push_back 0x1801332d Thumb Code 22 list.o(ke_list_api_func) + list_push_back_sublist 0x18013343 Thumb Code 22 list.o(ke_list_api_func) + list_push_front 0x18013359 Thumb Code 14 list.o(ke_list_api_func) + list_pop_front 0x18013367 Thumb Code 20 list.o(ke_list_api_func) + list_extract 0x1801337b Thumb Code 54 list.o(ke_list_api_func) + list_extract_after 0x180133b1 Thumb Code 26 list.o(ke_list_api_func) + list_extract_sublist 0x180133cb Thumb Code 22 list.o(ke_list_api_func) + list_extract_given 0x180133e1 Thumb Code 62 list.o(ke_list_api_func) + list_insert_before 0x1801341f Thumb Code 42 list.o(ke_list_api_func) + list_insert_after 0x18013449 Thumb Code 46 list.o(ke_list_api_func) + list_insert_given 0x18013477 Thumb Code 48 list.o(ke_list_api_func) + popcnt8 0x180134a9 Thumb Code 30 utils.o(ke_util_api_func) + co_ctz 0x180134c7 Thumb Code 48 utils.o(ke_util_api_func) + co_clz 0x180134f7 Thumb Code 46 utils.o(ke_util_api_func) + bdaddr_is_null 0x18013525 Thumb Code 22 utils.o(ke_util_api_func) + bdaddr_is_same 0x1801353b Thumb Code 26 utils.o(ke_util_api_func) + rand 0x18013555 Thumb Code 18 utils.o(ke_util_api_func) + srand 0x18013567 Thumb Code 6 utils.o(ke_util_api_func) + ke_malloc 0x18013579 Thumb Code 180 ke_mem.o(ke_util_api_func) + ke_free 0x1801362d Thumb Code 182 ke_mem.o(ke_util_api_func) + ke_msg_alloc 0x180136f9 Thumb Code 50 ke_msg.o(ke_util_api_func) + ke_msg_send 0x1801372b Thumb Code 34 ke_msg.o(ke_util_api_func) + ke_msg_send_basic 0x1801374d Thumb Code 14 ke_msg.o(ke_util_api_func) + ke_msg_forward 0x1801375b Thumb Code 10 ke_msg.o(ke_util_api_func) + ke_state_set 0x18013771 Thumb Code 86 ke_task.o(ke_util_api_func) + ke_state_get 0x180137c7 Thumb Code 32 ke_task.o(ke_util_api_func) + ke_timer_set 0x180137f9 Thumb Code 166 ke_timer.o(ke_util_api_func) + ke_timer_clear 0x1801389f Thumb Code 100 ke_timer.o(ke_util_api_func) + ke_event_set 0x18013919 Thumb Code 26 ke_event.o(ke_util_api_func) + ke_event_clear 0x18013933 Thumb Code 26 ke_event.o(ke_util_api_func) + lld_exp_sync_pos 0x18013951 Thumb Code 26 lld.o(ke_util_api_func) + le_pkt_dur_in_us 0x1801396b Thumb Code 16 lld.o(ke_util_api_func) + ble_timer_hs_set 0x18013981 Thumb Code 34 ble_drv.o(le_drv_api_func) + ble_timer_hus_set 0x180139a3 Thumb Code 44 ble_drv.o(le_drv_api_func) + ble_timer_1ms_set 0x180139cf Thumb Code 54 ble_drv.o(le_drv_api_func) + ble_timer_winsize 0x18013a05 Thumb Code 178 ble_drv.o(le_drv_api_func) + ble_aes_encrypt 0x18013ab7 Thumb Code 124 ble_drv.o(le_drv_api_func) + slot_clock_get 0x18013b4d Thumb Code 22 ble_irq.o(le_drv_api_func) + slot_time_get 0x18013b63 Thumb Code 32 ble_irq.o(le_drv_api_func) + ble_schedule 0x18013b89 Thumb Code 46 ble_api.o(le_evt_hdl_func) + aes_crypt_evt_handler 0x18013bc1 Thumb Code 28 ble_drv.o(le_evt_hdl_func) + ke_task_schedule 0x18013be5 Thumb Code 140 ke_task.o(le_evt_hdl_func) + ke_timer_schedule 0x18013c81 Thumb Code 116 ke_timer.o(le_evt_hdl_func) + l2cm_pdu_tx_handler 0x18013cf9 Thumb Code 74 l2cm.o(le_evt_hdl_func) + lld_con_pkt_tx 0x18013d49 Thumb Code 250 lld_con.o(le_irq_frm_cbk) + lld_con_pkt_rx 0x18013e43 Thumb Code 508 lld_con.o(le_irq_frm_cbk) + lld_con_frm_cbk 0x1801403f Thumb Code 230 lld_con.o(le_irq_frm_cbk) + lld_adv_pkt_rx 0x1801413d Thumb Code 498 lld_adv.o(le_irq_frm_cbk) + lld_adv_frm_cbk 0x1801432f Thumb Code 456 lld_adv.o(le_irq_frm_cbk) + lld_scan_pkt_rx 0x1801451d Thumb Code 504 lld_scan.o(le_irq_frm_cbk) + lld_scan_frm_cbk 0x18014715 Thumb Code 228 lld_scan.o(le_irq_frm_cbk) + lld_init_pkt_rx 0x18014819 Thumb Code 228 lld_init.o(le_irq_frm_cbk) + lld_init_pkt_tx 0x180148fd Thumb Code 340 lld_init.o(le_irq_frm_cbk) + lld_init_frm_cbk 0x18014a51 Thumb Code 252 lld_init.o(le_irq_frm_cbk) + BLE_IRQHandler 0x18014b69 Thumb Code 344 ble_irq.o(le_irq_func) + sch_arb_evt_isr 0x18014cdd Thumb Code 132 sch_arb.o(le_irq_hdl_isr) + sch_arb_sw_isr 0x18014d61 Thumb Code 28 sch_arb.o(le_irq_hdl_isr) + sch_prog_fifo_isr 0x18014d81 Thumb Code 250 sch_prog.o(le_irq_hdl_isr) + sch_alarm_timer_isr 0x18014e89 Thumb Code 64 sch_alarm.o(le_irq_hdl_isr) + app_task_dispatch 0x18014ecd Thumb Code 22 app_msg.o(le_task_hdl_func) + gapc_task_dispatch 0x18014ef1 Thumb Code 80 gapc_task.o(le_task_hdl_func) + gapm_task_dispatch 0x18014f69 Thumb Code 74 gapm_task.o(le_task_hdl_func) + gatt_task_dispatch 0x18014fd5 Thumb Code 82 gattc_task.o(le_task_hdl_func) + llm_task_dispatch 0x18015049 Thumb Code 54 llm_task.o(le_task_hdl_func) + llc_task_dispatch 0x18015099 Thumb Code 90 llc_task.o(le_task_hdl_func) + l2cc_task_dispatch 0x18015115 Thumb Code 46 l2cc_task.o(le_task_hdl_func) + rf_init 0x18015159 Thumb Code 50 rf_mdm.o(ri_one_cal_func) + rfmdm_init 0x1801518b Thumb Code 66 rf_mdm.o(ri_one_cal_func) + ble_heap 0x180151fd Thumb Code 8 ble_api.o(ri_one_cal_func) + ble_init 0x18015205 Thumb Code 42 ble_api.o(ri_one_cal_func) + ble_app 0x1801522f Thumb Code 22 ble_api.o(ri_one_cal_func) + ble_drv_init 0x18015251 Thumb Code 108 ble_drv.o(ri_one_cal_func) + ble_drv_reset 0x180152bd Thumb Code 38 ble_drv.o(ri_one_cal_func) + ke_init 0x180152f9 Thumb Code 68 ke.o(ri_one_cal_func) + ke_flush 0x1801533d Thumb Code 60 ke.o(ri_one_cal_func) + aes_init 0x18015391 Thumb Code 38 aes.o(ri_one_cal_func) + gapm_init 0x180153c1 Thumb Code 118 gapm.o(ri_one_cal_func) + gattm_init 0x18015455 Thumb Code 76 gattm.o(ri_one_cal_func) + llm_init 0x180154b1 Thumb Code 118 llm.o(ri_one_cal_func) + lld_core_init 0x1801553d Thumb Code 166 lld.o(ri_one_cal_func) + lld_env_init 0x180155e3 Thumb Code 42 lld.o(ri_one_cal_func) + lld_init 0x1801560d Thumb Code 42 lld.o(ri_one_cal_func) + lld_con_init 0x18015665 Thumb Code 58 lld_con.o(ri_one_cal_func) + ble_buf_init 0x180156a5 Thumb Code 70 ble_buf.o(ri_one_cal_func) + sch_init 0x180156f9 Thumb Code 82 sch.o(ri_one_cal_func) + gapm_actv_reset 0x18015771 Thumb Code 48 gapm_actv.o(ri_one_cal_func) + l2cm_init 0x180157a9 Thumb Code 90 l2cm.o(ri_one_cal_func) + lld_adv_init 0x18015819 Thumb Code 48 lld_adv.o(ri_one_cal_func) + lld_scan_init 0x1801584d Thumb Code 36 lld_scan.o(ri_one_cal_func) + lld_init_init 0x18015875 Thumb Code 50 lld_init.o(ri_one_cal_func) + ble_dev_addr 0x180158ac Data 6 app.o(.constdata) + ble_dev_config 0x180158b2 Data 6 app.o(.constdata) + dis_atts 0x180158b8 Data 144 prf_diss.o(.constdata) + dis_svc_db 0x18015948 Data 12 prf_diss.o(.constdata) + ses_svc_uuid 0x18015954 Data 16 prf_sess.o(.constdata) + ses_char_txd_notify 0x18015964 Data 16 prf_sess.o(.constdata) + ses_char_rxd_write 0x18015974 Data 16 prf_sess.o(.constdata) + ses_atts 0x18015984 Data 40 prf_sess.o(.constdata) + ses_svc_db 0x180159ac Data 12 prf_sess.o(.constdata) + smp_pdu_func 0x180159b8 Data 44 gapc_smp.o(.constdata) + atts_pdu_func 0x18015a4c Data 48 atts.o(.constdata) + llcp_pdu_func 0x18015a7c Data 100 llc_llcp.o(.constdata) + llcp_pdu_info 0x18015ae0 Data 50 llc_llcp.o(.constdata) + attc_pdu_func 0x18015b14 Data 60 attc.o(.constdata) + Region$$Table$$Base 0x18015bb0 Number 0 anon$$obj.o(Region$$Table) + Region$$Table$$Limit 0x18015bd0 Number 0 anon$$obj.o(Region$$Table) + __stdout 0x20003098 Data 4 stdout.o(.data) + speed_test 0x2000309c Data 1 proc.o(.bss) + actv_env 0x2000325a Data 2 app_actv.o(.bss) + sess_env 0x2000325c Data 6 prf_sess.o(.bss) + app_env 0x20003262 Data 2 app.o(le_env_mem_area) + diss_env 0x20003264 Data 4 prf_diss.o(le_env_mem_area) + __initial_sp 0x20008000 Data 0 startup.o(STACK) + rf_cal_env 0x20008fd8 Data 16 rf_mdm.o(var_env_mem_area) + gap_svc_env 0x20008fe8 Data 4 gap_svc.o(var_env_mem_area) + gatt_svc_env 0x20008fec Data 2 gatt_svc.o(var_env_mem_area) + ble_env 0x20008ff0 Data 8 ble_drv.o(var_env_mem_area) + ke_env 0x20008ff8 Data 36 ke.o(var_env_mem_area) + ke_task_env 0x2000901c Data 32 ke_task.o(var_env_mem_area) + ke_event_env 0x2000903c Data 32 ke_event.o(var_env_mem_area) + aes_env 0x2000905c Data 8 aes.o(var_env_mem_area) + gapm_env 0x20009064 Data 40 gapm.o(var_env_mem_area) + gapc_env 0x2000908c Data 12 gapc.o(var_env_mem_area) + gattm_env 0x20009098 Data 28 gattm.o(var_env_mem_area) + gatt_env 0x200090b4 Data 12 gattc.o(var_env_mem_area) + l2cc_env 0x200090c0 Data 12 l2cc.o(var_env_mem_area) + llm_env 0x200090cc Data 132 llm.o(var_env_mem_area) + lld_env 0x20009150 Data 16 lld.o(var_env_mem_area) + lld_con_env 0x20009160 Data 16 lld_con.o(var_env_mem_area) + ble_buf_env 0x20009170 Data 72 ble_buf.o(var_env_mem_area) + sch_arb_env 0x200091b8 Data 20 sch_arb.o(var_env_mem_area) + sch_prog_env 0x200091cc Data 148 sch_prog.o(var_env_mem_area) + sch_plan_env 0x20009260 Data 12 sch_plan.o(var_env_mem_area) + sch_slice_env 0x2000926c Data 32 sch_slice.o(var_env_mem_area) + l2cm_env 0x2000928c Data 4 l2cm.o(var_env_mem_area) + llc_env 0x20009290 Data 16 llc.o(var_env_mem_area) + lld_adv_env 0x200092a0 Data 16 lld_adv.o(var_env_mem_area) + lld_scan_env 0x200092b0 Data 4 lld_scan.o(var_env_mem_area) + lld_init_env 0x200092b4 Data 4 lld_init.o(var_env_mem_area) + sch_alarm_env 0x200092b8 Data 8 sch_alarm.o(var_env_mem_area) + sch_slice_params 0x200092c0 Data 8 sch_slice.o(var_ext_mem_area) + rnd_seed 0x200092c8 Data 4 utils.o(var_rnd_mem_area) + gapc_state 0x200092cc Data 3 gapc_task.o(var_sta_mem_area) + aes_ongoing 0x200092cf Data 1 aes.o(var_sta_mem_area) + lld_sync_err_nb 0x200092d0 Data 1 lld.o(var_sta_mem_area) + gapm_state 0x200092d1 Data 1 gapm_task.o(var_sta_mem_area) + gatt_state 0x200092d2 Data 3 gattc_task.o(var_sta_mem_area) + llc_state 0x200092d5 Data 4 llc_task.o(var_sta_mem_area) + l2cc_state 0x200092d9 Data 3 l2cc_task.o(var_sta_mem_area) + + + +============================================================================== + +Memory Map of the image + + Image Entry point : 0x18004099 + + Load Region LR_IROM1 (Base: 0x18004000, Size: 0x00011bd4, Max: 0x0001c000, ABSOLUTE) + + Execution Region ER_IROM1 (Base: 0x18004000, Size: 0x00011bd0, Max: 0x0001c000, ABSOLUTE) + + Base Addr Size Type Attr Idx E Section Name Object + + 0x18004000 0x00000098 Data RO 6 RESET startup.o + 0x18004098 0x00000000 Code RO 1208 * .ARM.Collect$$$$00000000 mc_p.l(entry.o) + 0x18004098 0x00000004 Code RO 1476 .ARM.Collect$$$$00000001 mc_p.l(entry2.o) + 0x1800409c 0x00000004 Code RO 1479 .ARM.Collect$$$$00000004 mc_p.l(entry5.o) + 0x180040a0 0x00000000 Code RO 1481 .ARM.Collect$$$$00000008 mc_p.l(entry7b.o) + 0x180040a0 0x00000000 Code RO 1483 .ARM.Collect$$$$0000000A mc_p.l(entry8b.o) + 0x180040a0 0x00000008 Code RO 1484 .ARM.Collect$$$$0000000B mc_p.l(entry9a.o) + 0x180040a8 0x00000000 Code RO 1486 .ARM.Collect$$$$0000000D mc_p.l(entry10a.o) + 0x180040a8 0x00000000 Code RO 1488 .ARM.Collect$$$$0000000F mc_p.l(entry11a.o) + 0x180040a8 0x00000004 Code RO 1477 .ARM.Collect$$$$00002712 mc_p.l(entry2.o) + 0x180040ac 0x0000005c Code RO 7 .INT startup.o + 0x18004108 0x00000284 Code RO 852 .text ble6.lib(rf_mdm.o) + 0x1800438c 0x00000078 Code RO 963 .text ble6.lib(utils.o) + 0x18004404 0x0000043a Code RO 968 .text ble6.lib(gapc_task.o) + 0x1800483e 0x00000002 PAD + 0x18004840 0x000015e8 Code RO 973 .text ble6.lib(gapc_smp.o) + 0x18005e28 0x000005b8 Code RO 976 .text ble6.lib(attm_db.o) + 0x180063e0 0x000001ac Code RO 978 .text ble6.lib(gap_svc.o) + 0x1800658c 0x000001a0 Code RO 982 .text ble6.lib(gatt_svc.o) + 0x1800672c 0x0000003c Code RO 996 .text ble6.lib(ke_mem.o) + 0x18006768 0x00000028 Code RO 1002 .text ble6.lib(ke_task.o) + 0x18006790 0x000000ac Code RO 1009 .text ble6.lib(ke_timer.o) + 0x1800683c 0x00000014 Code RO 1015 .text ble6.lib(ke_event.o) + 0x18006850 0x0000016c Code RO 1020 .text ble6.lib(aes.o) + 0x180069bc 0x00000084 Code RO 1026 .text ble6.lib(aes_c1.o) + 0x18006a40 0x00000190 Code RO 1028 .text ble6.lib(gapm.o) + 0x18006bd0 0x000003ec Code RO 1033 .text ble6.lib(gapc.o) + 0x18006fbc 0x0000021c Code RO 1039 .text ble6.lib(gattc.o) + 0x180071d8 0x000002a4 Code RO 1042 .text ble6.lib(l2cc.o) + 0x1800747c 0x0000020c Code RO 1045 .text ble6.lib(l2cc_sig.o) + 0x18007688 0x00000304 Code RO 1047 .text ble6.lib(attm.o) + 0x1800798c 0x00001040 Code RO 1049 .text ble6.lib(atts.o) + 0x180089cc 0x00000098 Code RO 1052 .text ble6.lib(llm.o) + 0x18008a64 0x00000214 Code RO 1057 .text ble6.lib(llc_disconnect.o) + 0x18008c78 0x00000170 Code RO 1059 .text ble6.lib(llc_ver_exch.o) + 0x18008de8 0x0000097c Code RO 1061 .text ble6.lib(llc_encrypt.o) + 0x18009764 0x00000294 Code RO 1063 .text ble6.lib(llc_feat_exch.o) + 0x180099f8 0x00000424 Code RO 1065 .text ble6.lib(llc_dl_upd.o) + 0x18009e1c 0x00000b60 Code RO 1067 .text ble6.lib(llc_con_upd.o) + 0x1800a97c 0x000006a4 Code RO 1069 .text ble6.lib(llc_phy_upd.o) + 0x1800b020 0x000000cc Code RO 1071 .text ble6.lib(lld.o) + 0x1800b0ec 0x00001050 Code RO 1079 .text ble6.lib(lld_con.o) + 0x1800c13c 0x0000001c Code RO 1086 .text ble6.lib(plf.o) + 0x1800c158 0x00000484 Code RO 1101 .text ble6.lib(sch_arb.o) + 0x1800c5dc 0x00000100 Code RO 1106 .text ble6.lib(sch_prog.o) + 0x1800c6dc 0x000003b0 Code RO 1111 .text ble6.lib(sch_plan.o) + 0x1800ca8c 0x00000108 Code RO 1114 .text ble6.lib(sch_slice.o) + 0x1800cb94 0x00000544 Code RO 1121 .text ble6.lib(gattc_task.o) + 0x1800d0d8 0x000003f4 Code RO 1126 .text ble6.lib(gapm_actv.o) + 0x1800d4cc 0x00000334 Code RO 1130 .text ble6.lib(gapc_hci.o) + 0x1800d800 0x00000030 Code RO 1132 .text ble6.lib(l2cm.o) + 0x1800d830 0x0000025c Code RO 1139 .text ble6.lib(l2cc_pdu.o) + 0x1800da8c 0x000004e4 Code RO 1146 .text ble6.lib(llc.o) + 0x1800df70 0x00000220 Code RO 1149 .text ble6.lib(llc_llcp.o) + 0x1800e190 0x00000564 Code RO 1152 .text ble6.lib(lld_adv.o) + 0x1800e6f4 0x000005ec Code RO 1159 .text ble6.lib(lld_scan.o) + 0x1800ece0 0x00000588 Code RO 1166 .text ble6.lib(lld_init.o) + 0x1800f268 0x0000010c Code RO 1173 .text ble6.lib(sch_alarm.o) + 0x1800f374 0x00000184 Code RO 1178 .text ble6.lib(l2cc_task.o) + 0x1800f4f8 0x000000fc Code RO 1183 .text ble6.lib(gapm_cfg.o) + 0x1800f5f4 0x000001ac Code RO 1185 .text ble6.lib(gapm_smp.o) + 0x1800f7a0 0x000003c8 Code RO 1187 .text ble6.lib(gapm_adv.o) + 0x1800fb68 0x000002ec Code RO 1189 .text ble6.lib(gapm_scan.o) + 0x1800fe54 0x00000214 Code RO 1191 .text ble6.lib(gapm_init.o) + 0x18010068 0x000009b0 Code RO 1193 .text ble6.lib(attc.o) + 0x18010a18 0x000000b0 Code RO 1196 .text ble6.lib(llm_hci.o) + 0x18010ac8 0x000003bc Code RO 1198 .text ble6.lib(llm_adv.o) + 0x18010e84 0x000003fc Code RO 1200 .text ble6.lib(llm_scan.o) + 0x18011280 0x000001dc Code RO 1202 .text ble6.lib(llm_init.o) + 0x1801145c 0x00000094 Code RO 1204 .text ble6.lib(llc_hci.o) + 0x180114f0 0x00000108 Code RO 1206 .text ble6.lib(llc_chmap_upd.o) + 0x180115f8 0x0000002c Code RO 1211 .text mc_p.l(uidiv.o) + 0x18011624 0x00000028 Code RO 1213 .text mc_p.l(idiv.o) + 0x1801164c 0x00000060 Code RO 1491 .text mc_p.l(uldiv.o) + 0x180116ac 0x00000024 Code RO 1504 .text mc_p.l(init.o) + 0x180116d0 0x00000020 Code RO 1506 .text mc_p.l(llshl.o) + 0x180116f0 0x00000022 Code RO 1508 .text mc_p.l(llushr.o) + 0x18011712 0x00000002 PAD + 0x18011714 0x00000074 Code RO 363 i.UART1_IRQHandler uart1rb.o + 0x18011788 0x00000020 Code RO 1422 i.__0printf$8 mc_p.l(printf8.o) + 0x180117a8 0x0000001a Code RO 550 i.__ARM_common_switch8 app_actv.o + 0x180117c2 0x0000000e Code RO 1518 i.__scatterload_copy mc_p.l(handlers.o) + 0x180117d0 0x00000002 Code RO 1519 i.__scatterload_null mc_p.l(handlers.o) + 0x180117d2 0x0000000e Code RO 1520 i.__scatterload_zeroinit mc_p.l(handlers.o) + 0x180117e0 0x00000428 Code RO 1429 i._printf_core mc_p.l(printf8.o) + 0x18011c08 0x00000020 Code RO 1430 i._printf_post_padding mc_p.l(printf8.o) + 0x18011c28 0x0000002c Code RO 1431 i._printf_pre_padding mc_p.l(printf8.o) + 0x18011c54 0x00000014 Code RO 503 i.app_actv_cmp_evt app_actv.o + 0x18011c68 0x0000001c Code RO 504 i.app_actv_create app_actv.o + 0x18011c84 0x00000010 Code RO 505 i.app_actv_created_ind app_actv.o + 0x18011c94 0x00000028 Code RO 506 i.app_actv_stopped_ind app_actv.o + 0x18011cbc 0x00000078 Code RO 507 i.app_adv_action app_actv.o + 0x18011d34 0x0000002c Code RO 508 i.app_adv_create app_actv.o + 0x18011d60 0x0000008c Code RO 509 i.app_adv_event app_actv.o + 0x18011dec 0x00000038 Code RO 415 i.app_conf_fsm app.o + 0x18011e24 0x00000040 Code RO 416 i.app_conn_fsm app.o + 0x18011e64 0x00000004 Code RO 564 i.app_custom_handler app_msg.o + 0x18011e68 0x000001c0 Code RO 603 i.app_gapc_bond_ind_handler app_gapc.o + 0x18012028 0x00000244 Code RO 604 i.app_gapc_bond_req_ind_handler app_gapc.o + 0x1801226c 0x0000006c Code RO 605 i.app_gapc_connection_req_ind_handler app_gapc.o + 0x180122d8 0x00000100 Code RO 606 i.app_gapc_encrypt_req_ind_handler app_gapc.o + 0x180123d8 0x00000330 Code RO 607 i.app_gapc_msg_handler app_gapc.o + 0x18012708 0x00000052 Code RO 591 i.app_gapm_msg_handler app_gapm.o + 0x1801275a 0x00000002 PAD + 0x1801275c 0x0000003c Code RO 417 i.app_init app.o + 0x18012798 0x00000004 Code RO 418 i.app_ltk_find app.o + 0x1801279c 0x00000002 Code RO 419 i.app_ltk_gen app.o + 0x1801279e 0x00000002 Code RO 420 i.app_ltk_save app.o + 0x180127a0 0x0000003c Code RO 421 i.app_name_get app.o + 0x180127dc 0x00000018 Code RO 422 i.app_pairing_get app.o + 0x180127f4 0x0000001a Code RO 423 i.app_prf_create app.o + 0x1801280e 0x00000002 PAD + 0x18012810 0x0000000c Code RO 424 i.app_state_set app.o + 0x1801281c 0x0000002c Code RO 766 i.core_vector drvs.lib(core.o) + 0x18012848 0x00000084 Code RO 264 i.data_proc proc.o + 0x180128cc 0x00000060 Code RO 649 i.diss_svc_func prf_diss.o + 0x1801292c 0x0000004c Code RO 650 i.diss_svc_init prf_diss.o + 0x18012978 0x00000070 Code RO 651 i.diss_value_get prf_diss.o + 0x180129e8 0x00000010 Code RO 731 i.fputc debug.o + 0x180129f8 0x00000020 Code RO 425 i.gap_svc_get_dev_info app.o + 0x18012a18 0x00000028 Code RO 885 i.gapc_connect_rsp ble6.lib(gap_api.o) + 0x18012a40 0x0000000c Code RO 886 i.gapc_disconnect ble6.lib(gap_api.o) + 0x18012a4c 0x00000034 Code RO 895 i.gapm_create_advertising ble6.lib(gap_api.o) + 0x18012a80 0x00000026 Code RO 896 i.gapm_delete_activity ble6.lib(gap_api.o) + 0x18012aa6 0x00000002 PAD + 0x18012aa8 0x0000001c Code RO 898 i.gapm_reset ble6.lib(gap_api.o) + 0x18012ac4 0x0000003c Code RO 899 i.gapm_set_adv_data ble6.lib(gap_api.o) + 0x18012b00 0x00000074 Code RO 901 i.gapm_set_dev ble6.lib(gap_api.o) + 0x18012b74 0x00000034 Code RO 903 i.gapm_start_activity ble6.lib(gap_api.o) + 0x18012ba8 0x00000012 Code RO 904 i.gapm_start_advertising ble6.lib(gap_api.o) + 0x18012bba 0x0000001e Code RO 905 i.gapm_stop_activity ble6.lib(gap_api.o) + 0x18012bd8 0x0000002c Code RO 937 i.gatt_info_cfm ble6.lib(gatt_api.o) + 0x18012c04 0x00000044 Code RO 938 i.gatt_ntf_send ble6.lib(gatt_api.o) + 0x18012c48 0x00000044 Code RO 943 i.gatt_read_cfm ble6.lib(gatt_api.o) + 0x18012c8c 0x00000028 Code RO 946 i.gatt_write_cfm ble6.lib(gatt_api.o) + 0x18012cb4 0x0000006c Code RO 15 i.main main.o + 0x18012d20 0x00000020 Code RO 788 i.rcc_adc_en drvs.lib(rcc.o) + 0x18012d40 0x00000040 Code RO 789 i.rcc_ble_en drvs.lib(rcc.o) + 0x18012d80 0x00000036 Code RO 797 i.rcc_sysclk_get drvs.lib(rcc.o) + 0x18012db6 0x0000000a Code RO 265 i.sess_cb_rxd proc.o + 0x18012dc0 0x000000d4 Code RO 685 i.sess_svc_func prf_sess.o + 0x18012e94 0x00000024 Code RO 686 i.sess_svc_init prf_sess.o + 0x18012eb8 0x00000040 Code RO 687 i.sess_txd_send prf_sess.o + 0x18012ef8 0x00000100 Code RO 848 i.trim_load drvs.lib(trim.o) + 0x18012ff8 0x0000003c Code RO 364 i.uart1Rb_Init uart1rb.o + 0x18013034 0x00000048 Code RO 366 i.uart1Rb_Read uart1rb.o + 0x1801307c 0x00000030 Code RO 828 i.uart_conf drvs.lib(uart.o) + 0x180130ac 0x0000002c Code RO 829 i.uart_fctl drvs.lib(uart.o) + 0x180130d8 0x00000070 Code RO 832 i.uart_init drvs.lib(uart.o) + 0x18013148 0x00000014 Code RO 834 i.uart_putc drvs.lib(uart.o) + 0x1801315c 0x00000030 Code RO 835 i.uart_send drvs.lib(uart.o) + 0x1801318c 0x0000002c Code RO 266 i.user_procedure proc.o + 0x180131b8 0x00000160 Code RO 1092 ke_list_api_func ble6.lib(ble_buf.o) + 0x18013318 0x0000018e Code RO 1097 ke_list_api_func ble6.lib(list.o) + 0x180134a6 0x00000002 PAD + 0x180134a8 0x000000d0 Code RO 964 ke_util_api_func ble6.lib(utils.o) + 0x18013578 0x00000180 Code RO 997 ke_util_api_func ble6.lib(ke_mem.o) + 0x180136f8 0x00000078 Code RO 1000 ke_util_api_func ble6.lib(ke_msg.o) + 0x18013770 0x00000088 Code RO 1003 ke_util_api_func ble6.lib(ke_task.o) + 0x180137f8 0x00000120 Code RO 1010 ke_util_api_func ble6.lib(ke_timer.o) + 0x18013918 0x00000038 Code RO 1016 ke_util_api_func ble6.lib(ke_event.o) + 0x18013950 0x00000030 Code RO 1072 ke_util_api_func ble6.lib(lld.o) + 0x18013980 0x000001cc Code RO 986 le_drv_api_func ble6.lib(ble_drv.o) + 0x18013b4c 0x0000003c Code RO 1088 le_drv_api_func ble6.lib(ble_irq.o) + 0x18013b88 0x00000038 Code RO 869 le_evt_hdl_func ble6.lib(ble_api.o) + 0x18013bc0 0x00000024 Code RO 987 le_evt_hdl_func ble6.lib(ble_drv.o) + 0x18013be4 0x0000009c Code RO 1004 le_evt_hdl_func ble6.lib(ke_task.o) + 0x18013c80 0x00000078 Code RO 1011 le_evt_hdl_func ble6.lib(ke_timer.o) + 0x18013cf8 0x00000050 Code RO 1133 le_evt_hdl_func ble6.lib(l2cm.o) + 0x18013d48 0x000003f4 Code RO 1080 le_irq_frm_cbk ble6.lib(lld_con.o) + 0x1801413c 0x000003e0 Code RO 1153 le_irq_frm_cbk ble6.lib(lld_adv.o) + 0x1801451c 0x000002fc Code RO 1160 le_irq_frm_cbk ble6.lib(lld_scan.o) + 0x18014818 0x00000350 Code RO 1167 le_irq_frm_cbk ble6.lib(lld_init.o) + 0x18014b68 0x00000174 Code RO 1089 le_irq_func ble6.lib(ble_irq.o) + 0x18014cdc 0x000000a4 Code RO 1102 le_irq_hdl_isr ble6.lib(sch_arb.o) + 0x18014d80 0x00000108 Code RO 1107 le_irq_hdl_isr ble6.lib(sch_prog.o) + 0x18014e88 0x00000044 Code RO 1174 le_irq_hdl_isr ble6.lib(sch_alarm.o) + 0x18014ecc 0x00000024 Code RO 565 le_task_hdl_func app_msg.o + 0x18014ef0 0x00000078 Code RO 969 le_task_hdl_func ble6.lib(gapc_task.o) + 0x18014f68 0x0000006c Code RO 1118 le_task_hdl_func ble6.lib(gapm_task.o) + 0x18014fd4 0x00000074 Code RO 1122 le_task_hdl_func ble6.lib(gattc_task.o) + 0x18015048 0x00000050 Code RO 1141 le_task_hdl_func ble6.lib(llm_task.o) + 0x18015098 0x0000007c Code RO 1143 le_task_hdl_func ble6.lib(llc_task.o) + 0x18015114 0x00000044 Code RO 1179 le_task_hdl_func ble6.lib(l2cc_task.o) + 0x18015158 0x000000a4 Code RO 853 ri_one_cal_func ble6.lib(rf_mdm.o) + 0x180151fc 0x00000054 Code RO 870 ri_one_cal_func ble6.lib(ble_api.o) + 0x18015250 0x000000a8 Code RO 988 ri_one_cal_func ble6.lib(ble_drv.o) + 0x180152f8 0x00000098 Code RO 993 ri_one_cal_func ble6.lib(ke.o) + 0x18015390 0x00000030 Code RO 1021 ri_one_cal_func ble6.lib(aes.o) + 0x180153c0 0x00000094 Code RO 1029 ri_one_cal_func ble6.lib(gapm.o) + 0x18015454 0x0000005c Code RO 1036 ri_one_cal_func ble6.lib(gattm.o) + 0x180154b0 0x0000008c Code RO 1053 ri_one_cal_func ble6.lib(llm.o) + 0x1801553c 0x00000128 Code RO 1073 ri_one_cal_func ble6.lib(lld.o) + 0x18015664 0x00000040 Code RO 1081 ri_one_cal_func ble6.lib(lld_con.o) + 0x180156a4 0x00000054 Code RO 1093 ri_one_cal_func ble6.lib(ble_buf.o) + 0x180156f8 0x00000078 Code RO 1099 ri_one_cal_func ble6.lib(sch.o) + 0x18015770 0x00000038 Code RO 1127 ri_one_cal_func ble6.lib(gapm_actv.o) + 0x180157a8 0x00000070 Code RO 1134 ri_one_cal_func ble6.lib(l2cm.o) + 0x18015818 0x00000034 Code RO 1154 ri_one_cal_func ble6.lib(lld_adv.o) + 0x1801584c 0x00000028 Code RO 1161 ri_one_cal_func ble6.lib(lld_scan.o) + 0x18015874 0x00000038 Code RO 1168 ri_one_cal_func ble6.lib(lld_init.o) + 0x180158ac 0x0000000c Data RO 426 .constdata app.o + 0x180158b8 0x00000090 Data RO 652 .constdata prf_diss.o + 0x18015948 0x0000000c Data RO 653 .constdata prf_diss.o + 0x18015954 0x00000010 Data RO 689 .constdata prf_sess.o + 0x18015964 0x00000010 Data RO 690 .constdata prf_sess.o + 0x18015974 0x00000010 Data RO 691 .constdata prf_sess.o + 0x18015984 0x00000028 Data RO 693 .constdata prf_sess.o + 0x180159ac 0x0000000c Data RO 694 .constdata prf_sess.o + 0x180159b8 0x0000002c Data RO 974 .constdata ble6.lib(gapc_smp.o) + 0x180159e4 0x00000050 Data RO 979 .constdata ble6.lib(gap_svc.o) + 0x18015a34 0x00000018 Data RO 983 .constdata ble6.lib(gatt_svc.o) + 0x18015a4c 0x00000030 Data RO 1050 .constdata ble6.lib(atts.o) + 0x18015a7c 0x00000096 Data RO 1150 .constdata ble6.lib(llc_llcp.o) + 0x18015b12 0x00000002 PAD + 0x18015b14 0x0000003c Data RO 1194 .constdata ble6.lib(attc.o) + 0x18015b50 0x0000005d Data RO 608 .conststring app_gapc.o + 0x18015bad 0x00000003 PAD + 0x18015bb0 0x00000020 Data RO 1516 Region$$Table anon$$obj.o + + + Execution Region RW_IRAM_VECT (Base: 0x20003000, Size: 0x00000098, Max: 0x00000098, ABSOLUTE) + + Base Addr Size Type Attr Idx E Section Name Object + + 0x20003000 0x00000098 Zero RW 1 RW_IRAM_VECT.bss anon$$obj.o + + + Execution Region RW_IRAM_USER (Base: 0x20003098, Size: 0x000001d0, Max: 0xffffffff, ABSOLUTE) + + Base Addr Size Type Attr Idx E Section Name Object + + 0x20003098 0x00000004 Data RW 1490 .data mc_p.l(stdout.o) + 0x2000309c 0x000000ba Zero RW 267 .bss proc.o + 0x20003156 0x00000104 Zero RW 368 .bss uart1rb.o + 0x2000325a 0x00000002 Zero RW 510 .bss app_actv.o + 0x2000325c 0x00000006 Zero RW 688 .bss prf_sess.o + 0x20003262 0x00000002 Zero RW 427 le_env_mem_area app.o + 0x20003264 0x00000004 Zero RW 654 le_env_mem_area prf_diss.o + + + Execution Region RW_IRAM_HEAP (Base: 0x20004e00, Size: 0x00002c00, Max: 0x00002c00, ABSOLUTE) + + Base Addr Size Type Attr Idx E Section Name Object + + 0x20004e00 0x00002c00 Zero RW 3 RW_IRAM_HEAP.bss anon$$obj.o + + + Execution Region RW_IRAM_STACK (Base: 0x20007a00, Size: 0x00000600, Max: 0x00000600, ABSOLUTE, UNINIT) + + Base Addr Size Type Attr Idx E Section Name Object + + 0x20007a00 0x00000600 Zero RW 4 STACK startup.o + + + Execution Region RW_IRAM_EXCH (Base: 0x20008000, Size: 0x00000fd8, Max: 0x00000fd8, ABSOLUTE) + + Base Addr Size Type Attr Idx E Section Name Object + + 0x20008000 0x00000fd8 Zero RW 2 RW_IRAM_EXCH.bss anon$$obj.o + + + Execution Region RW_IRAM_RWZI (Base: 0x20008fd8, Size: 0x00000304, Max: 0x00001028, ABSOLUTE, UNINIT) + + Base Addr Size Type Attr Idx E Section Name Object + + 0x20008fd8 0x00000010 Zero RW 854 var_env_mem_area ble6.lib(rf_mdm.o) + 0x20008fe8 0x00000004 Zero RW 980 var_env_mem_area ble6.lib(gap_svc.o) + 0x20008fec 0x00000002 Zero RW 984 var_env_mem_area ble6.lib(gatt_svc.o) + 0x20008fee 0x00000002 PAD + 0x20008ff0 0x00000008 Zero RW 989 var_env_mem_area ble6.lib(ble_drv.o) + 0x20008ff8 0x00000024 Zero RW 994 var_env_mem_area ble6.lib(ke.o) + 0x2000901c 0x00000020 Zero RW 1005 var_env_mem_area ble6.lib(ke_task.o) + 0x2000903c 0x00000020 Zero RW 1017 var_env_mem_area ble6.lib(ke_event.o) + 0x2000905c 0x00000008 Zero RW 1022 var_env_mem_area ble6.lib(aes.o) + 0x20009064 0x00000028 Zero RW 1030 var_env_mem_area ble6.lib(gapm.o) + 0x2000908c 0x0000000c Zero RW 1034 var_env_mem_area ble6.lib(gapc.o) + 0x20009098 0x0000001c Zero RW 1037 var_env_mem_area ble6.lib(gattm.o) + 0x200090b4 0x0000000c Zero RW 1040 var_env_mem_area ble6.lib(gattc.o) + 0x200090c0 0x0000000c Zero RW 1043 var_env_mem_area ble6.lib(l2cc.o) + 0x200090cc 0x00000084 Zero RW 1054 var_env_mem_area ble6.lib(llm.o) + 0x20009150 0x00000010 Zero RW 1074 var_env_mem_area ble6.lib(lld.o) + 0x20009160 0x00000010 Zero RW 1082 var_env_mem_area ble6.lib(lld_con.o) + 0x20009170 0x00000048 Zero RW 1094 var_env_mem_area ble6.lib(ble_buf.o) + 0x200091b8 0x00000014 Zero RW 1103 var_env_mem_area ble6.lib(sch_arb.o) + 0x200091cc 0x00000094 Zero RW 1108 var_env_mem_area ble6.lib(sch_prog.o) + 0x20009260 0x0000000c Zero RW 1112 var_env_mem_area ble6.lib(sch_plan.o) + 0x2000926c 0x00000020 Zero RW 1115 var_env_mem_area ble6.lib(sch_slice.o) + 0x2000928c 0x00000004 Zero RW 1135 var_env_mem_area ble6.lib(l2cm.o) + 0x20009290 0x00000010 Zero RW 1147 var_env_mem_area ble6.lib(llc.o) + 0x200092a0 0x00000010 Zero RW 1155 var_env_mem_area ble6.lib(lld_adv.o) + 0x200092b0 0x00000004 Zero RW 1162 var_env_mem_area ble6.lib(lld_scan.o) + 0x200092b4 0x00000004 Zero RW 1169 var_env_mem_area ble6.lib(lld_init.o) + 0x200092b8 0x00000008 Zero RW 1175 var_env_mem_area ble6.lib(sch_alarm.o) + 0x200092c0 0x00000008 Zero RW 1116 var_ext_mem_area ble6.lib(sch_slice.o) + 0x200092c8 0x00000004 Zero RW 965 var_rnd_mem_area ble6.lib(utils.o) + 0x200092cc 0x00000003 Zero RW 970 var_sta_mem_area ble6.lib(gapc_task.o) + 0x200092cf 0x00000001 Zero RW 1023 var_sta_mem_area ble6.lib(aes.o) + 0x200092d0 0x00000001 Zero RW 1075 var_sta_mem_area ble6.lib(lld.o) + 0x200092d1 0x00000001 Zero RW 1119 var_sta_mem_area ble6.lib(gapm_task.o) + 0x200092d2 0x00000003 Zero RW 1123 var_sta_mem_area ble6.lib(gattc_task.o) + 0x200092d5 0x00000004 Zero RW 1144 var_sta_mem_area ble6.lib(llc_task.o) + 0x200092d9 0x00000003 Zero RW 1180 var_sta_mem_area ble6.lib(l2cc_task.o) + + +============================================================================== + +Image component sizes + + + Code (inc. data) RO Data RW Data ZI Data Debug Object Name + + 342 50 12 0 2 11748 app.o + 434 34 0 0 2 10029 app_actv.o + 2208 1156 93 0 0 9379 app_gapc.o + 82 0 0 0 0 1775 app_gapm.o + 40 14 0 0 0 1197 app_msg.o + 16 0 0 0 0 2368 debug.o + 108 30 0 0 0 54623 main.o + 284 74 156 0 4 4684 prf_diss.o + 312 22 100 0 6 7481 prf_sess.o + 186 16 0 0 186 4418 proc.o + 92 42 152 0 1536 688 startup.o + 248 24 0 0 260 10653 uart1rb.o + + ---------------------------------------------------------------------- + 4356 1462 548 0 17468 119043 Object Totals + 0 0 32 0 15472 0 (incl. Generated) + 4 0 3 0 0 0 (incl. Padding) + + ---------------------------------------------------------------------- + + Code (inc. data) RO Data RW Data ZI Data Debug Library Member Name + + 412 22 0 0 9 360 aes.o + 132 8 0 0 0 112 aes_c1.o + 2480 66 60 0 0 536 attc.o + 772 28 0 0 0 320 attm.o + 1464 24 0 0 0 488 attm_db.o + 4160 56 48 0 0 892 atts.o + 140 22 0 0 0 188 ble_api.o + 436 22 0 0 72 408 ble_buf.o + 664 56 0 0 8 384 ble_drv.o + 432 34 0 0 0 196 ble_irq.o + 446 46 0 0 0 716 gap_api.o + 428 22 80 0 4 132 gap_svc.o + 1004 22 0 0 12 536 gapc.o + 820 12 0 0 0 304 gapc_hci.o + 5608 142 44 0 0 1540 gapc_smp.o + 1202 56 0 0 3 388 gapc_task.o + 548 40 0 0 40 376 gapm.o + 1068 28 0 0 0 572 gapm_actv.o + 968 34 0 0 0 380 gapm_adv.o + 252 12 0 0 0 76 gapm_cfg.o + 532 30 0 0 0 252 gapm_init.o + 748 32 0 0 0 256 gapm_scan.o + 428 26 0 0 0 168 gapm_smp.o + 108 34 0 0 1 60 gapm_task.o + 220 26 0 0 0 296 gatt_api.o + 416 30 24 0 2 172 gatt_svc.o + 540 18 0 0 12 280 gattc.o + 1464 82 0 0 3 316 gattc_task.o + 92 16 0 0 28 72 gattm.o + 152 24 0 0 36 96 ke.o + 76 10 0 0 32 152 ke_event.o + 444 30 0 0 0 180 ke_mem.o + 120 12 0 0 0 140 ke_msg.o + 332 38 0 0 32 292 ke_task.o + 580 30 0 0 0 364 ke_timer.o + 676 24 0 0 12 260 l2cc.o + 604 16 0 0 0 188 l2cc_pdu.o + 524 12 0 0 0 240 l2cc_sig.o + 456 38 0 0 3 232 l2cc_task.o + 240 34 0 0 4 220 l2cm.o + 398 0 0 0 0 424 list.o + 1252 44 0 0 16 452 llc.o + 264 14 0 0 0 184 llc_chmap_upd.o + 2912 62 0 0 0 556 llc_con_upd.o + 532 10 0 0 0 292 llc_disconnect.o + 1060 12 0 0 0 288 llc_dl_upd.o + 2428 68 0 0 0 568 llc_encrypt.o + 660 4 0 0 0 284 llc_feat_exch.o + 148 4 0 0 0 100 llc_hci.o + 544 16 150 0 0 256 llc_llcp.o + 1700 20 0 0 0 368 llc_phy_upd.o + 124 34 0 0 4 60 llc_task.o + 368 8 0 0 0 200 llc_ver_exch.o + 548 60 0 0 17 364 lld.o + 2424 126 0 0 16 512 lld_adv.o + 5252 146 0 0 16 1104 lld_con.o + 2320 120 0 0 4 440 lld_init.o + 2320 154 0 0 4 468 lld_scan.o + 292 30 0 0 132 200 llm.o + 956 18 0 0 0 328 llm_adv.o + 176 14 0 0 0 220 llm_hci.o + 476 12 0 0 0 140 llm_init.o + 1020 12 0 0 0 192 llm_scan.o + 80 26 0 0 0 60 llm_task.o + 28 10 0 0 0 60 plf.o + 808 134 0 0 16 452 rf_mdm.o + 120 38 0 0 0 72 sch.o + 336 10 0 0 8 204 sch_alarm.o + 1320 18 0 0 20 320 sch_arb.o + 944 8 0 0 12 180 sch_plan.o + 520 40 0 0 148 156 sch_prog.o + 264 22 0 0 40 160 sch_slice.o + 328 36 0 0 4 404 utils.o + 44 10 0 0 0 68 core.o + 150 8 0 0 0 180 rcc.o + 256 38 0 0 0 80 trim.o + 272 32 0 0 0 328 uart.o + 0 0 0 0 0 0 entry.o + 0 0 0 0 0 0 entry10a.o + 0 0 0 0 0 0 entry11a.o + 8 4 0 0 0 0 entry2.o + 4 0 0 0 0 0 entry5.o + 0 0 0 0 0 0 entry7b.o + 0 0 0 0 0 0 entry8b.o + 8 4 0 0 0 0 entry9a.o + 30 0 0 0 0 0 handlers.o + 40 0 0 0 0 72 idiv.o + 36 8 0 0 0 68 init.o + 32 0 0 0 0 68 llshl.o + 34 0 0 0 0 68 llushr.o + 1172 52 0 0 0 324 printf8.o + 0 0 0 4 0 0 stdout.o + 44 0 0 0 0 72 uidiv.o + 96 0 0 0 0 84 uldiv.o + + ---------------------------------------------------------------------- + 67344 2800 408 4 772 24620 Library Totals + 8 0 2 0 2 0 (incl. Padding) + + ---------------------------------------------------------------------- + + Code (inc. data) RO Data RW Data ZI Data Debug Library Name + + 65110 2644 406 0 770 23208 ble6.lib + 722 88 0 0 0 656 drvs.lib + 1504 68 0 4 0 756 mc_p.l + + ---------------------------------------------------------------------- + 67344 2800 408 4 772 24620 Library Totals + + ---------------------------------------------------------------------- + +============================================================================== + + + Code (inc. data) RO Data RW Data ZI Data Debug + + 71700 4262 956 4 18240 134663 Grand Totals + 71700 4262 956 4 18240 134663 ELF Image Totals + 71700 4262 956 4 0 0 ROM Totals + +============================================================================== + + Total RO Size (Code + RO Data) 72656 ( 70.95kB) + Total RW Size (RW Data + ZI Data) 18244 ( 17.82kB) + Total ROM Size (Code + RO Data + RW Data) 72660 ( 70.96kB) + +============================================================================== + diff --git a/projects/bleUart/mdk/output/bleUart_bleUart.dep b/projects/bleUart/mdk/output/bleUart_bleUart.dep new file mode 100644 index 0000000..8450edb --- /dev/null +++ b/projects/bleUart/mdk/output/bleUart_bleUart.dep @@ -0,0 +1,482 @@ +Dependencies for Project 'bleUart', Target 'bleUart': (DO NOT MODIFY !) +F (..\..\..\core\mdk\startup.s)(0x66063421)(--cpu Cortex-M0 -g --16 --apcs=interwork --pd "__MICROLIB SETA 1" --thumb -I C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\projects\bleUart\mdk\RTE -I C:\Keil_v5\ARM\CMSIS\Include --pd "__UVISION_VERSION SETA 515" -o .\output\startup.o --depend .\output\startup.d) +F (..\src\cfg.h)(0x66063421)() +F (..\src\main.c)(0x66063421)(--c99 -c --cpu Cortex-M0 -D__MICROLIB -g -O2 --apcs=interwork --split_sections -I..\src -I..\..\..\core -I..\..\..\core\reg -I..\..\..\drivers\api -I..\..\..\modules\api -I..\..\..\ble\api -I..\..\..\ble\app -I..\..\..\ble\prf --c99 --thumb --gnu --bss_threshold=0 --preinclude=..\src\cfg.h -I C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\projects\bleUart\mdk\RTE -I C:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="515" -o .\output\main.o --omf_browse .\output\main.crf --depend .\output\main.d) +I (..\src\cfg.h)(0x66063421) +I (..\..\..\core\b6x.h)(0x66063421) +I (..\..\..\core\core_cm0plus.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdint.h)(0x54C245B8) +I (..\..\..\core\core_cmInstr.h)(0x66063421) +I (..\..\..\core\core_cmFunc.h)(0x66063421) +I (..\..\..\core\rom.h)(0x66063421) +I (..\..\..\ble\api\bledef.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdbool.h)(0x54C245B8) +I (..\..\..\ble\api\blelib.h)(0x66063421) +I (..\..\..\ble\api\ke_api.h)(0x66063421) +I (..\..\..\ble\api\task.h)(0x66063421) +I (..\..\..\ble\api\list.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stddef.h)(0x54C245B8) +I (..\..\..\ble\api\utils.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdlib.h)(0x54C245B8) +I (..\..\..\ble\api\gapm_api.h)(0x66063421) +I (..\..\..\ble\api\gapm.h)(0x66063421) +I (..\..\..\ble\api\le_err.h)(0x66063421) +I (..\..\..\ble\api\gap.h)(0x66063421) +I (..\..\..\ble\api\gapc_api.h)(0x66063421) +I (..\..\..\ble\api\gapc.h)(0x66063421) +I (..\..\..\ble\api\gatt_api.h)(0x66063421) +I (..\..\..\ble\api\gatt.h)(0x66063421) +I (..\..\..\ble\api\att.h)(0x661778AD) +I (..\..\..\ble\prf\prf_api.h)(0x66063421) +I (..\..\..\ble\prf\prf_diss.h)(0x66063421) +I (..\..\..\ble\prf\prf_bass.h)(0x66063421) +I (..\..\..\ble\prf\prf_hids.h)(0x66063421) +I (..\..\..\ble\prf\prf_sess.h)(0x66063421) +I (..\..\..\drivers\api\drvs.h)(0x66063421) +I (..\..\..\core\string.h)(0x66063421) +I (..\..\..\drivers\api\core.h)(0x66063421) +I (..\..\..\drivers\api\dma.h)(0x66063421) +I (..\..\..\core\reg\reg_dmachcfg.h)(0x66063421) +I (..\..\..\core\reg\reg_base.h)(0x66063421) +I (..\..\..\drivers\api\exti.h)(0x66063421) +I (..\..\..\core\reg\reg_exti.h)(0x66063421) +I (..\..\..\drivers\api\fshc.h)(0x66063421) +I (..\..\..\drivers\api\flash.h)(0x66063421) +I (..\..\..\drivers\api\gpio.h)(0x66063421) +I (..\..\..\drivers\api\iopad.h)(0x66063421) +I (..\..\..\core\reg\reg_csc.h)(0x66063421) +I (..\..\..\core\reg\reg_gpio.h)(0x66063421) +I (..\..\..\drivers\api\i2c.h)(0x66063421) +I (..\..\..\core\reg\reg_i2c.h)(0x66063421) +I (..\..\..\drivers\api\iwdt.h)(0x66063421) +I (..\..\..\drivers\api\pwm.h)(0x66063421) +I (..\..\..\drivers\api\rcc.h)(0x66063421) +I (..\..\..\core\reg\reg_rcc.h)(0x66063421) +I (..\..\..\drivers\api\rtc.h)(0x66063421) +I (..\..\..\core\reg\reg_apbmisc.h)(0x66063421) +I (..\..\..\drivers\api\rco.h)(0x66063421) +I (..\..\..\drivers\api\sadc.h)(0x66063421) +I (..\..\..\drivers\api\spi.h)(0x66063421) +I (..\..\..\drivers\api\timer.h)(0x66063421) +I (..\..\..\core\reg\reg_timer.h)(0x66063421) +I (..\..\..\drivers\api\trim.h)(0x66063421) +I (..\..\..\drivers\api\uart.h)(0x66063421) +I (..\..\..\core\reg\reg_uart.h)(0x66063421) +I (..\..\..\ble\app\app.h)(0x66063421) +I (..\..\..\ble\app\app_actv.h)(0x66063421) +I (..\..\..\modules\api\sftmr.h)(0x66063421) +I (..\..\..\modules\api\leds.h)(0x66063421) +I (..\..\..\modules\api\uartRb.h)(0x66177905) +I (..\..\..\modules\api\dbg.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdio.h)(0x54C245B8) +F (..\src\myapp.c)(0x66063421)(--c99 -c --cpu Cortex-M0 -D__MICROLIB -g -O2 --apcs=interwork --split_sections -I..\src -I..\..\..\core -I..\..\..\core\reg -I..\..\..\drivers\api -I..\..\..\modules\api -I..\..\..\ble\api -I..\..\..\ble\app -I..\..\..\ble\prf --c99 --thumb --gnu --bss_threshold=0 --preinclude=..\src\cfg.h -I C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\projects\bleUart\mdk\RTE -I C:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="515" -o .\output\myapp.o --omf_browse .\output\myapp.crf --depend .\output\myapp.d) +I (..\src\cfg.h)(0x66063421) +I (..\..\..\ble\app\app.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdint.h)(0x54C245B8) +I (..\..\..\core\string.h)(0x66063421) +I (..\..\..\ble\api\blelib.h)(0x66063421) +I (..\..\..\ble\api\ke_api.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdbool.h)(0x54C245B8) +I (..\..\..\ble\api\task.h)(0x66063421) +I (..\..\..\ble\api\list.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stddef.h)(0x54C245B8) +I (..\..\..\ble\api\utils.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdlib.h)(0x54C245B8) +I (..\..\..\ble\app\app_actv.h)(0x66063421) +I (..\..\..\ble\api\gapm.h)(0x66063421) +I (..\..\..\ble\api\le_err.h)(0x66063421) +I (..\..\..\ble\api\gap.h)(0x66063421) +I (..\..\..\ble\api\gapc.h)(0x66063421) +I (..\..\..\ble\api\bledef.h)(0x66063421) +I (..\..\..\ble\api\gapm_api.h)(0x66063421) +I (..\..\..\ble\api\gapc_api.h)(0x66063421) +I (..\..\..\ble\api\gatt_api.h)(0x66063421) +I (..\..\..\ble\api\gatt.h)(0x66063421) +I (..\..\..\ble\api\att.h)(0x661778AD) +I (..\..\..\ble\prf\prf_api.h)(0x66063421) +I (..\..\..\ble\prf\prf_diss.h)(0x66063421) +I (..\..\..\ble\prf\prf_bass.h)(0x66063421) +I (..\..\..\ble\prf\prf_hids.h)(0x66063421) +I (..\..\..\ble\prf\prf_sess.h)(0x66063421) +I (..\..\..\drivers\api\drvs.h)(0x66063421) +I (..\..\..\core\b6x.h)(0x66063421) +I (..\..\..\core\core_cm0plus.h)(0x66063421) +I (..\..\..\core\core_cmInstr.h)(0x66063421) +I (..\..\..\core\core_cmFunc.h)(0x66063421) +I (..\..\..\core\rom.h)(0x66063421) +I (..\..\..\drivers\api\core.h)(0x66063421) +I (..\..\..\drivers\api\dma.h)(0x66063421) +I (..\..\..\core\reg\reg_dmachcfg.h)(0x66063421) +I (..\..\..\core\reg\reg_base.h)(0x66063421) +I (..\..\..\drivers\api\exti.h)(0x66063421) +I (..\..\..\core\reg\reg_exti.h)(0x66063421) +I (..\..\..\drivers\api\fshc.h)(0x66063421) +I (..\..\..\drivers\api\flash.h)(0x66063421) +I (..\..\..\drivers\api\gpio.h)(0x66063421) +I (..\..\..\drivers\api\iopad.h)(0x66063421) +I (..\..\..\core\reg\reg_csc.h)(0x66063421) +I (..\..\..\core\reg\reg_gpio.h)(0x66063421) +I (..\..\..\drivers\api\i2c.h)(0x66063421) +I (..\..\..\core\reg\reg_i2c.h)(0x66063421) +I (..\..\..\drivers\api\iwdt.h)(0x66063421) +I (..\..\..\drivers\api\pwm.h)(0x66063421) +I (..\..\..\drivers\api\rcc.h)(0x66063421) +I (..\..\..\core\reg\reg_rcc.h)(0x66063421) +I (..\..\..\drivers\api\rtc.h)(0x66063421) +I (..\..\..\core\reg\reg_apbmisc.h)(0x66063421) +I (..\..\..\drivers\api\rco.h)(0x66063421) +I (..\..\..\drivers\api\sadc.h)(0x66063421) +I (..\..\..\drivers\api\spi.h)(0x66063421) +I (..\..\..\drivers\api\timer.h)(0x66063421) +I (..\..\..\core\reg\reg_timer.h)(0x66063421) +I (..\..\..\drivers\api\trim.h)(0x66063421) +I (..\..\..\drivers\api\uart.h)(0x66063421) +I (..\..\..\core\reg\reg_uart.h)(0x66063421) +I (..\..\..\modules\api\leds.h)(0x66063421) +F (..\src\proc.c)(0x66063421)(--c99 -c --cpu Cortex-M0 -D__MICROLIB -g -O2 --apcs=interwork --split_sections -I..\src -I..\..\..\core -I..\..\..\core\reg -I..\..\..\drivers\api -I..\..\..\modules\api -I..\..\..\ble\api -I..\..\..\ble\app -I..\..\..\ble\prf --c99 --thumb --gnu --bss_threshold=0 --preinclude=..\src\cfg.h -I C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\projects\bleUart\mdk\RTE -I C:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="515" -o .\output\proc.o --omf_browse .\output\proc.crf --depend .\output\proc.d) +I (..\src\cfg.h)(0x66063421) +I (..\..\..\core\b6x.h)(0x66063421) +I (..\..\..\core\core_cm0plus.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdint.h)(0x54C245B8) +I (..\..\..\core\core_cmInstr.h)(0x66063421) +I (..\..\..\core\core_cmFunc.h)(0x66063421) +I (..\..\..\core\rom.h)(0x66063421) +I (..\..\..\ble\api\bledef.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdbool.h)(0x54C245B8) +I (..\..\..\ble\api\blelib.h)(0x66063421) +I (..\..\..\ble\api\ke_api.h)(0x66063421) +I (..\..\..\ble\api\task.h)(0x66063421) +I (..\..\..\ble\api\list.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stddef.h)(0x54C245B8) +I (..\..\..\ble\api\utils.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdlib.h)(0x54C245B8) +I (..\..\..\ble\api\gapm_api.h)(0x66063421) +I (..\..\..\ble\api\gapm.h)(0x66063421) +I (..\..\..\ble\api\le_err.h)(0x66063421) +I (..\..\..\ble\api\gap.h)(0x66063421) +I (..\..\..\ble\api\gapc_api.h)(0x66063421) +I (..\..\..\ble\api\gapc.h)(0x66063421) +I (..\..\..\ble\api\gatt_api.h)(0x66063421) +I (..\..\..\ble\api\gatt.h)(0x66063421) +I (..\..\..\ble\api\att.h)(0x661778AD) +I (..\..\..\ble\prf\prf_api.h)(0x66063421) +I (..\..\..\ble\prf\prf_diss.h)(0x66063421) +I (..\..\..\ble\prf\prf_bass.h)(0x66063421) +I (..\..\..\ble\prf\prf_hids.h)(0x66063421) +I (..\..\..\ble\prf\prf_sess.h)(0x66063421) +I (..\..\..\drivers\api\drvs.h)(0x66063421) +I (..\..\..\core\string.h)(0x66063421) +I (..\..\..\drivers\api\core.h)(0x66063421) +I (..\..\..\drivers\api\dma.h)(0x66063421) +I (..\..\..\core\reg\reg_dmachcfg.h)(0x66063421) +I (..\..\..\core\reg\reg_base.h)(0x66063421) +I (..\..\..\drivers\api\exti.h)(0x66063421) +I (..\..\..\core\reg\reg_exti.h)(0x66063421) +I (..\..\..\drivers\api\fshc.h)(0x66063421) +I (..\..\..\drivers\api\flash.h)(0x66063421) +I (..\..\..\drivers\api\gpio.h)(0x66063421) +I (..\..\..\drivers\api\iopad.h)(0x66063421) +I (..\..\..\core\reg\reg_csc.h)(0x66063421) +I (..\..\..\core\reg\reg_gpio.h)(0x66063421) +I (..\..\..\drivers\api\i2c.h)(0x66063421) +I (..\..\..\core\reg\reg_i2c.h)(0x66063421) +I (..\..\..\drivers\api\iwdt.h)(0x66063421) +I (..\..\..\drivers\api\pwm.h)(0x66063421) +I (..\..\..\drivers\api\rcc.h)(0x66063421) +I (..\..\..\core\reg\reg_rcc.h)(0x66063421) +I (..\..\..\drivers\api\rtc.h)(0x66063421) +I (..\..\..\core\reg\reg_apbmisc.h)(0x66063421) +I (..\..\..\drivers\api\rco.h)(0x66063421) +I (..\..\..\drivers\api\sadc.h)(0x66063421) +I (..\..\..\drivers\api\spi.h)(0x66063421) +I (..\..\..\drivers\api\timer.h)(0x66063421) +I (..\..\..\core\reg\reg_timer.h)(0x66063421) +I (..\..\..\drivers\api\trim.h)(0x66063421) +I (..\..\..\drivers\api\uart.h)(0x66063421) +I (..\..\..\core\reg\reg_uart.h)(0x66063421) +I (..\..\..\ble\app\app.h)(0x66063421) +I (..\..\..\ble\app\app_actv.h)(0x66063421) +I (..\..\..\modules\api\uartRb.h)(0x66177905) +F (..\..\..\drivers\api\drvs.h)(0x66063421)() +F (..\..\..\drivers\lib\drvs.lib)(0x66063421)() +F (..\..\..\modules\src\leds.c)(0x66063421)(--c99 -c --cpu Cortex-M0 -D__MICROLIB -g -O2 --apcs=interwork --split_sections -I..\src -I..\..\..\core -I..\..\..\core\reg -I..\..\..\drivers\api -I..\..\..\modules\api -I..\..\..\ble\api -I..\..\..\ble\app -I..\..\..\ble\prf --c99 --thumb --gnu --bss_threshold=0 --preinclude=..\src\cfg.h -I C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\projects\bleUart\mdk\RTE -I C:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="515" -o .\output\leds.o --omf_browse .\output\leds.crf --depend .\output\leds.d) +I (..\src\cfg.h)(0x66063421) +F (..\..\..\modules\src\sftmr.c)(0x66063421)(--c99 -c --cpu Cortex-M0 -D__MICROLIB -g -O2 --apcs=interwork --split_sections -I..\src -I..\..\..\core -I..\..\..\core\reg -I..\..\..\drivers\api -I..\..\..\modules\api -I..\..\..\ble\api -I..\..\..\ble\app -I..\..\..\ble\prf --c99 --thumb --gnu --bss_threshold=0 --preinclude=..\src\cfg.h -I C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\projects\bleUart\mdk\RTE -I C:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="515" -o .\output\sftmr.o --omf_browse .\output\sftmr.crf --depend .\output\sftmr.d) +I (..\src\cfg.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdbool.h)(0x54C245B8) +I (..\..\..\core\string.h)(0x66063421) +I (..\..\..\core\b6x.h)(0x66063421) +I (..\..\..\core\core_cm0plus.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdint.h)(0x54C245B8) +I (..\..\..\core\core_cmInstr.h)(0x66063421) +I (..\..\..\core\core_cmFunc.h)(0x66063421) +I (..\..\..\core\rom.h)(0x66063421) +I (..\..\..\modules\api\sftmr.h)(0x66063421) +I (..\..\..\drivers\api\rtc.h)(0x66063421) +I (..\..\..\core\reg\reg_apbmisc.h)(0x66063421) +I (..\..\..\core\reg\reg_base.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stddef.h)(0x54C245B8) +F (..\..\..\modules\src\uart1Rb.c)(0x66063421)(--c99 -c --cpu Cortex-M0 -D__MICROLIB -g -O2 --apcs=interwork --split_sections -I..\src -I..\..\..\core -I..\..\..\core\reg -I..\..\..\drivers\api -I..\..\..\modules\api -I..\..\..\ble\api -I..\..\..\ble\app -I..\..\..\ble\prf --c99 --thumb --gnu --bss_threshold=0 --preinclude=..\src\cfg.h -I C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\projects\bleUart\mdk\RTE -I C:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="515" -o .\output\uart1rb.o --omf_browse .\output\uart1rb.crf --depend .\output\uart1rb.d) +I (..\src\cfg.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdint.h)(0x54C245B8) +I (..\..\..\core\b6x.h)(0x66063421) +I (..\..\..\core\core_cm0plus.h)(0x66063421) +I (..\..\..\core\core_cmInstr.h)(0x66063421) +I (..\..\..\core\core_cmFunc.h)(0x66063421) +I (..\..\..\core\rom.h)(0x66063421) +I (..\..\..\modules\api\uartRb.h)(0x66177905) +I (..\..\..\drivers\api\uart.h)(0x66063421) +I (..\..\..\drivers\api\rcc.h)(0x66063421) +I (..\..\..\core\reg\reg_rcc.h)(0x66063421) +I (..\..\..\core\reg\reg_base.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stddef.h)(0x54C245B8) +I (C:\Keil_v5\ARM\ARMCC\include\stdbool.h)(0x54C245B8) +I (..\..\..\core\reg\reg_uart.h)(0x66063421) +I (..\..\..\modules\api\rbuf.h)(0x66063421) +F (..\..\..\ble\app\app.c)(0x66063421)(--c99 -c --cpu Cortex-M0 -D__MICROLIB -g -O2 --apcs=interwork --split_sections -I..\src -I..\..\..\core -I..\..\..\core\reg -I..\..\..\drivers\api -I..\..\..\modules\api -I..\..\..\ble\api -I..\..\..\ble\app -I..\..\..\ble\prf --c99 --thumb --gnu --bss_threshold=0 --preinclude=..\src\cfg.h -I C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\projects\bleUart\mdk\RTE -I C:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="515" -o .\output\app.o --omf_browse .\output\app.crf --depend .\output\app.d) +I (..\src\cfg.h)(0x66063421) +I (..\..\..\ble\app\app.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdint.h)(0x54C245B8) +I (..\..\..\core\string.h)(0x66063421) +I (..\..\..\ble\api\blelib.h)(0x66063421) +I (..\..\..\ble\api\ke_api.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdbool.h)(0x54C245B8) +I (..\..\..\ble\api\task.h)(0x66063421) +I (..\..\..\ble\api\list.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stddef.h)(0x54C245B8) +I (..\..\..\ble\api\utils.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdlib.h)(0x54C245B8) +I (..\..\..\ble\app\app_actv.h)(0x66063421) +I (..\..\..\ble\api\gapm.h)(0x66063421) +I (..\..\..\ble\api\le_err.h)(0x66063421) +I (..\..\..\ble\api\gap.h)(0x66063421) +I (..\..\..\ble\api\gapc.h)(0x66063421) +I (..\..\..\ble\api\bledef.h)(0x66063421) +I (..\..\..\ble\api\gapm_api.h)(0x66063421) +I (..\..\..\ble\api\gapc_api.h)(0x66063421) +I (..\..\..\ble\api\gatt_api.h)(0x66063421) +I (..\..\..\ble\api\gatt.h)(0x66063421) +I (..\..\..\ble\api\att.h)(0x661778AD) +I (..\..\..\ble\prf\prf_api.h)(0x66063421) +I (..\..\..\ble\prf\prf_diss.h)(0x66063421) +I (..\..\..\ble\prf\prf_bass.h)(0x66063421) +I (..\..\..\ble\prf\prf_hids.h)(0x66063421) +I (..\..\..\ble\prf\prf_sess.h)(0x66063421) +I (..\..\..\drivers\api\drvs.h)(0x66063421) +I (..\..\..\core\b6x.h)(0x66063421) +I (..\..\..\core\core_cm0plus.h)(0x66063421) +I (..\..\..\core\core_cmInstr.h)(0x66063421) +I (..\..\..\core\core_cmFunc.h)(0x66063421) +I (..\..\..\core\rom.h)(0x66063421) +I (..\..\..\drivers\api\core.h)(0x66063421) +I (..\..\..\drivers\api\dma.h)(0x66063421) +I (..\..\..\core\reg\reg_dmachcfg.h)(0x66063421) +I (..\..\..\core\reg\reg_base.h)(0x66063421) +I (..\..\..\drivers\api\exti.h)(0x66063421) +I (..\..\..\core\reg\reg_exti.h)(0x66063421) +I (..\..\..\drivers\api\fshc.h)(0x66063421) +I (..\..\..\drivers\api\flash.h)(0x66063421) +I (..\..\..\drivers\api\gpio.h)(0x66063421) +I (..\..\..\drivers\api\iopad.h)(0x66063421) +I (..\..\..\core\reg\reg_csc.h)(0x66063421) +I (..\..\..\core\reg\reg_gpio.h)(0x66063421) +I (..\..\..\drivers\api\i2c.h)(0x66063421) +I (..\..\..\core\reg\reg_i2c.h)(0x66063421) +I (..\..\..\drivers\api\iwdt.h)(0x66063421) +I (..\..\..\drivers\api\pwm.h)(0x66063421) +I (..\..\..\drivers\api\rcc.h)(0x66063421) +I (..\..\..\core\reg\reg_rcc.h)(0x66063421) +I (..\..\..\drivers\api\rtc.h)(0x66063421) +I (..\..\..\core\reg\reg_apbmisc.h)(0x66063421) +I (..\..\..\drivers\api\rco.h)(0x66063421) +I (..\..\..\drivers\api\sadc.h)(0x66063421) +I (..\..\..\drivers\api\spi.h)(0x66063421) +I (..\..\..\drivers\api\timer.h)(0x66063421) +I (..\..\..\core\reg\reg_timer.h)(0x66063421) +I (..\..\..\drivers\api\trim.h)(0x66063421) +I (..\..\..\drivers\api\uart.h)(0x66063421) +I (..\..\..\core\reg\reg_uart.h)(0x66063421) +F (..\..\..\ble\app\app_actv.c)(0x66063421)(--c99 -c --cpu Cortex-M0 -D__MICROLIB -g -O2 --apcs=interwork --split_sections -I..\src -I..\..\..\core -I..\..\..\core\reg -I..\..\..\drivers\api -I..\..\..\modules\api -I..\..\..\ble\api -I..\..\..\ble\app -I..\..\..\ble\prf --c99 --thumb --gnu --bss_threshold=0 --preinclude=..\src\cfg.h -I C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\projects\bleUart\mdk\RTE -I C:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="515" -o .\output\app_actv.o --omf_browse .\output\app_actv.crf --depend .\output\app_actv.d) +I (..\src\cfg.h)(0x66063421) +I (..\..\..\ble\app\app.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdint.h)(0x54C245B8) +I (..\..\..\core\string.h)(0x66063421) +I (..\..\..\ble\api\blelib.h)(0x66063421) +I (..\..\..\ble\api\ke_api.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdbool.h)(0x54C245B8) +I (..\..\..\ble\api\task.h)(0x66063421) +I (..\..\..\ble\api\list.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stddef.h)(0x54C245B8) +I (..\..\..\ble\api\utils.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdlib.h)(0x54C245B8) +I (..\..\..\ble\app\app_actv.h)(0x66063421) +I (..\..\..\ble\api\gapm.h)(0x66063421) +I (..\..\..\ble\api\le_err.h)(0x66063421) +I (..\..\..\ble\api\gap.h)(0x66063421) +I (..\..\..\ble\api\gapc.h)(0x66063421) +I (..\..\..\ble\api\gapm_api.h)(0x66063421) +F (..\..\..\ble\app\app_msg.c)(0x66063421)(--c99 -c --cpu Cortex-M0 -D__MICROLIB -g -O2 --apcs=interwork --split_sections -I..\src -I..\..\..\core -I..\..\..\core\reg -I..\..\..\drivers\api -I..\..\..\modules\api -I..\..\..\ble\api -I..\..\..\ble\app -I..\..\..\ble\prf --c99 --thumb --gnu --bss_threshold=0 --preinclude=..\src\cfg.h -I C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\projects\bleUart\mdk\RTE -I C:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="515" -o .\output\app_msg.o --omf_browse .\output\app_msg.crf --depend .\output\app_msg.d) +I (..\src\cfg.h)(0x66063421) +I (..\..\..\ble\app\app.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdint.h)(0x54C245B8) +I (..\..\..\core\string.h)(0x66063421) +I (..\..\..\ble\api\blelib.h)(0x66063421) +I (..\..\..\ble\api\ke_api.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdbool.h)(0x54C245B8) +I (..\..\..\ble\api\task.h)(0x66063421) +I (..\..\..\ble\api\list.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stddef.h)(0x54C245B8) +I (..\..\..\ble\api\utils.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdlib.h)(0x54C245B8) +I (..\..\..\ble\app\app_actv.h)(0x66063421) +I (..\..\..\ble\api\gapm.h)(0x66063421) +I (..\..\..\ble\api\le_err.h)(0x66063421) +I (..\..\..\ble\api\gap.h)(0x66063421) +I (..\..\..\ble\api\gapc.h)(0x66063421) +I (..\..\..\drivers\api\drvs.h)(0x66063421) +I (..\..\..\core\b6x.h)(0x66063421) +I (..\..\..\core\core_cm0plus.h)(0x66063421) +I (..\..\..\core\core_cmInstr.h)(0x66063421) +I (..\..\..\core\core_cmFunc.h)(0x66063421) +I (..\..\..\core\rom.h)(0x66063421) +I (..\..\..\drivers\api\core.h)(0x66063421) +I (..\..\..\drivers\api\dma.h)(0x66063421) +I (..\..\..\core\reg\reg_dmachcfg.h)(0x66063421) +I (..\..\..\core\reg\reg_base.h)(0x66063421) +I (..\..\..\drivers\api\exti.h)(0x66063421) +I (..\..\..\core\reg\reg_exti.h)(0x66063421) +I (..\..\..\drivers\api\fshc.h)(0x66063421) +I (..\..\..\drivers\api\flash.h)(0x66063421) +I (..\..\..\drivers\api\gpio.h)(0x66063421) +I (..\..\..\drivers\api\iopad.h)(0x66063421) +I (..\..\..\core\reg\reg_csc.h)(0x66063421) +I (..\..\..\core\reg\reg_gpio.h)(0x66063421) +I (..\..\..\drivers\api\i2c.h)(0x66063421) +I (..\..\..\core\reg\reg_i2c.h)(0x66063421) +I (..\..\..\drivers\api\iwdt.h)(0x66063421) +I (..\..\..\drivers\api\pwm.h)(0x66063421) +I (..\..\..\drivers\api\rcc.h)(0x66063421) +I (..\..\..\core\reg\reg_rcc.h)(0x66063421) +I (..\..\..\drivers\api\rtc.h)(0x66063421) +I (..\..\..\core\reg\reg_apbmisc.h)(0x66063421) +I (..\..\..\drivers\api\rco.h)(0x66063421) +I (..\..\..\drivers\api\sadc.h)(0x66063421) +I (..\..\..\drivers\api\spi.h)(0x66063421) +I (..\..\..\drivers\api\timer.h)(0x66063421) +I (..\..\..\core\reg\reg_timer.h)(0x66063421) +I (..\..\..\drivers\api\trim.h)(0x66063421) +I (..\..\..\drivers\api\uart.h)(0x66063421) +I (..\..\..\core\reg\reg_uart.h)(0x66063421) +F (..\..\..\ble\app\app_gapm.c)(0x66063421)(--c99 -c --cpu Cortex-M0 -D__MICROLIB -g -O2 --apcs=interwork --split_sections -I..\src -I..\..\..\core -I..\..\..\core\reg -I..\..\..\drivers\api -I..\..\..\modules\api -I..\..\..\ble\api -I..\..\..\ble\app -I..\..\..\ble\prf --c99 --thumb --gnu --bss_threshold=0 --preinclude=..\src\cfg.h -I C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\projects\bleUart\mdk\RTE -I C:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="515" -o .\output\app_gapm.o --omf_browse .\output\app_gapm.crf --depend .\output\app_gapm.d) +I (..\src\cfg.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdint.h)(0x54C245B8) +I (..\..\..\ble\api\bledef.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdbool.h)(0x54C245B8) +I (..\..\..\ble\api\blelib.h)(0x66063421) +I (..\..\..\ble\api\ke_api.h)(0x66063421) +I (..\..\..\ble\api\task.h)(0x66063421) +I (..\..\..\ble\api\list.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stddef.h)(0x54C245B8) +I (..\..\..\ble\api\utils.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdlib.h)(0x54C245B8) +I (..\..\..\ble\api\gapm_api.h)(0x66063421) +I (..\..\..\ble\api\gapm.h)(0x66063421) +I (..\..\..\ble\api\le_err.h)(0x66063421) +I (..\..\..\ble\api\gap.h)(0x66063421) +I (..\..\..\ble\api\gapc_api.h)(0x66063421) +I (..\..\..\ble\api\gapc.h)(0x66063421) +I (..\..\..\ble\api\gatt_api.h)(0x66063421) +I (..\..\..\ble\api\gatt.h)(0x66063421) +I (..\..\..\ble\api\att.h)(0x661778AD) +I (..\..\..\ble\prf\prf_api.h)(0x66063421) +I (..\..\..\ble\prf\prf_diss.h)(0x66063421) +I (..\..\..\ble\prf\prf_bass.h)(0x66063421) +I (..\..\..\ble\prf\prf_hids.h)(0x66063421) +I (..\..\..\ble\prf\prf_sess.h)(0x66063421) +I (..\..\..\ble\app\app.h)(0x66063421) +I (..\..\..\core\string.h)(0x66063421) +I (..\..\..\ble\app\app_actv.h)(0x66063421) +F (..\..\..\ble\app\app_gapc.c)(0x66063421)(--c99 -c --cpu Cortex-M0 -D__MICROLIB -g -O2 --apcs=interwork --split_sections -I..\src -I..\..\..\core -I..\..\..\core\reg -I..\..\..\drivers\api -I..\..\..\modules\api -I..\..\..\ble\api -I..\..\..\ble\app -I..\..\..\ble\prf --c99 --thumb --gnu --bss_threshold=0 --preinclude=..\src\cfg.h -I C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\projects\bleUart\mdk\RTE -I C:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="515" -o .\output\app_gapc.o --omf_browse .\output\app_gapc.crf --depend .\output\app_gapc.d) +I (..\src\cfg.h)(0x66063421) +I (..\..\..\ble\api\bledef.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdint.h)(0x54C245B8) +I (C:\Keil_v5\ARM\ARMCC\include\stdbool.h)(0x54C245B8) +I (..\..\..\ble\api\blelib.h)(0x66063421) +I (..\..\..\ble\api\ke_api.h)(0x66063421) +I (..\..\..\ble\api\task.h)(0x66063421) +I (..\..\..\ble\api\list.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stddef.h)(0x54C245B8) +I (..\..\..\ble\api\utils.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdlib.h)(0x54C245B8) +I (..\..\..\ble\api\gapm_api.h)(0x66063421) +I (..\..\..\ble\api\gapm.h)(0x66063421) +I (..\..\..\ble\api\le_err.h)(0x66063421) +I (..\..\..\ble\api\gap.h)(0x66063421) +I (..\..\..\ble\api\gapc_api.h)(0x66063421) +I (..\..\..\ble\api\gapc.h)(0x66063421) +I (..\..\..\ble\api\gatt_api.h)(0x66063421) +I (..\..\..\ble\api\gatt.h)(0x66063421) +I (..\..\..\ble\api\att.h)(0x661778AD) +I (..\..\..\ble\prf\prf_api.h)(0x66063421) +I (..\..\..\ble\prf\prf_diss.h)(0x66063421) +I (..\..\..\ble\prf\prf_bass.h)(0x66063421) +I (..\..\..\ble\prf\prf_hids.h)(0x66063421) +I (..\..\..\ble\prf\prf_sess.h)(0x66063421) +I (..\..\..\ble\app\app.h)(0x66063421) +I (..\..\..\core\string.h)(0x66063421) +I (..\..\..\ble\app\app_actv.h)(0x66063421) +I (..\..\..\modules\api\dbg.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdio.h)(0x54C245B8) +F (..\..\..\ble\app\app_gatt.c)(0x66063421)(--c99 -c --cpu Cortex-M0 -D__MICROLIB -g -O2 --apcs=interwork --split_sections -I..\src -I..\..\..\core -I..\..\..\core\reg -I..\..\..\drivers\api -I..\..\..\modules\api -I..\..\..\ble\api -I..\..\..\ble\app -I..\..\..\ble\prf --c99 --thumb --gnu --bss_threshold=0 --preinclude=..\src\cfg.h -I C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\projects\bleUart\mdk\RTE -I C:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="515" -o .\output\app_gatt.o --omf_browse .\output\app_gatt.crf --depend .\output\app_gatt.d) +I (..\src\cfg.h)(0x66063421) +F (..\..\..\ble\prf\prf_diss.c)(0x661778C2)(--c99 -c --cpu Cortex-M0 -D__MICROLIB -g -O2 --apcs=interwork --split_sections -I..\src -I..\..\..\core -I..\..\..\core\reg -I..\..\..\drivers\api -I..\..\..\modules\api -I..\..\..\ble\api -I..\..\..\ble\app -I..\..\..\ble\prf --c99 --thumb --gnu --bss_threshold=0 --preinclude=..\src\cfg.h -I C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\projects\bleUart\mdk\RTE -I C:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="515" -o .\output\prf_diss.o --omf_browse .\output\prf_diss.crf --depend .\output\prf_diss.d) +I (..\src\cfg.h)(0x66063421) +I (..\..\..\ble\prf\prf.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdint.h)(0x54C245B8) +I (C:\Keil_v5\ARM\ARMCC\include\stdbool.h)(0x54C245B8) +I (..\..\..\core\string.h)(0x66063421) +I (..\..\..\ble\api\blelib.h)(0x66063421) +I (..\..\..\ble\api\le_err.h)(0x66063421) +I (..\..\..\ble\api\att.h)(0x661778AD) +I (..\..\..\ble\api\attm_api.h)(0x66063421) +I (..\..\..\ble\api\task.h)(0x66063421) +I (..\..\..\ble\api\list.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stddef.h)(0x54C245B8) +I (..\..\..\ble\api\utils.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdlib.h)(0x54C245B8) +I (..\..\..\ble\api\gatt_api.h)(0x66063421) +I (..\..\..\ble\api\gatt.h)(0x66063421) +I (..\..\..\ble\api\gap.h)(0x66063421) +I (..\..\..\ble\prf\prf_diss.h)(0x66063421) +F (..\..\..\ble\prf\prf_sess.c)(0x661778CC)(--c99 -c --cpu Cortex-M0 -D__MICROLIB -g -O2 --apcs=interwork --split_sections -I..\src -I..\..\..\core -I..\..\..\core\reg -I..\..\..\drivers\api -I..\..\..\modules\api -I..\..\..\ble\api -I..\..\..\ble\app -I..\..\..\ble\prf --c99 --thumb --gnu --bss_threshold=0 --preinclude=..\src\cfg.h -I C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\projects\bleUart\mdk\RTE -I C:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="515" -o .\output\prf_sess.o --omf_browse .\output\prf_sess.crf --depend .\output\prf_sess.d) +I (..\src\cfg.h)(0x66063421) +I (..\..\..\ble\prf\prf.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdint.h)(0x54C245B8) +I (C:\Keil_v5\ARM\ARMCC\include\stdbool.h)(0x54C245B8) +I (..\..\..\core\string.h)(0x66063421) +I (..\..\..\ble\api\blelib.h)(0x66063421) +I (..\..\..\ble\api\le_err.h)(0x66063421) +I (..\..\..\ble\api\att.h)(0x661778AD) +I (..\..\..\ble\api\attm_api.h)(0x66063421) +I (..\..\..\ble\api\task.h)(0x66063421) +I (..\..\..\ble\api\list.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stddef.h)(0x54C245B8) +I (..\..\..\ble\api\utils.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdlib.h)(0x54C245B8) +I (..\..\..\ble\api\gatt_api.h)(0x66063421) +I (..\..\..\ble\api\gatt.h)(0x66063421) +I (..\..\..\ble\api\gap.h)(0x66063421) +I (..\..\..\ble\prf\prf_sess.h)(0x66063421) +F (..\..\..\ble\lib\ble6.lib)(0x66063421)() +F (..\..\..\modules\src\debug.c)(0x66063421)(--c99 -c --cpu Cortex-M0 -D__MICROLIB -g -O2 --apcs=interwork --split_sections -I..\src -I..\..\..\core -I..\..\..\core\reg -I..\..\..\drivers\api -I..\..\..\modules\api -I..\..\..\ble\api -I..\..\..\ble\app -I..\..\..\ble\prf --c99 --thumb --gnu --bss_threshold=0 --preinclude=..\src\cfg.h -I C:\Users\Administrator\Desktop\Ŀ\пĿ\bleSDK6_v1.4.1\projects\bleUart\mdk\RTE -I C:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="515" -o .\output\debug.o --omf_browse .\output\debug.crf --depend .\output\debug.d) +I (..\src\cfg.h)(0x66063421) +I (..\..\..\modules\api\dbg.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stdint.h)(0x54C245B8) +I (C:\Keil_v5\ARM\ARMCC\include\stdio.h)(0x54C245B8) +I (..\..\..\drivers\api\uart.h)(0x66063421) +I (..\..\..\drivers\api\rcc.h)(0x66063421) +I (..\..\..\core\reg\reg_rcc.h)(0x66063421) +I (..\..\..\core\reg\reg_base.h)(0x66063421) +I (C:\Keil_v5\ARM\ARMCC\include\stddef.h)(0x54C245B8) +I (C:\Keil_v5\ARM\ARMCC\include\stdbool.h)(0x54C245B8) +I (..\..\..\core\reg\reg_uart.h)(0x66063421) diff --git a/projects/bleUart/mdk/output/debug.crf b/projects/bleUart/mdk/output/debug.crf new file mode 100644 index 0000000..5b44cbd Binary files /dev/null and b/projects/bleUart/mdk/output/debug.crf differ diff --git a/projects/bleUart/mdk/output/debug.d b/projects/bleUart/mdk/output/debug.d new file mode 100644 index 0000000..91d3c80 --- /dev/null +++ b/projects/bleUart/mdk/output/debug.d @@ -0,0 +1,12 @@ +.\output\debug.o: ..\..\..\modules\src\debug.c +.\output\debug.o: ..\src\cfg.h +.\output\debug.o: ..\..\..\modules\api\dbg.h +.\output\debug.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h +.\output\debug.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h +.\output\debug.o: ..\..\..\drivers\api\uart.h +.\output\debug.o: ..\..\..\drivers\api\rcc.h +.\output\debug.o: ..\..\..\core\reg\reg_rcc.h +.\output\debug.o: ..\..\..\core\reg\reg_base.h +.\output\debug.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stddef.h +.\output\debug.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h +.\output\debug.o: ..\..\..\core\reg\reg_uart.h diff --git a/projects/bleUart/mdk/output/debug.o b/projects/bleUart/mdk/output/debug.o new file mode 100644 index 0000000..75728d9 Binary files /dev/null and b/projects/bleUart/mdk/output/debug.o differ diff --git a/projects/bleUart/mdk/output/leds.crf b/projects/bleUart/mdk/output/leds.crf new file mode 100644 index 0000000..83a7d49 Binary files /dev/null and b/projects/bleUart/mdk/output/leds.crf differ diff --git a/projects/bleUart/mdk/output/leds.d b/projects/bleUart/mdk/output/leds.d new file mode 100644 index 0000000..33a5cf6 --- /dev/null +++ b/projects/bleUart/mdk/output/leds.d @@ -0,0 +1,2 @@ +.\output\leds.o: ..\..\..\modules\src\leds.c +.\output\leds.o: ..\src\cfg.h diff --git a/projects/bleUart/mdk/output/leds.o b/projects/bleUart/mdk/output/leds.o new file mode 100644 index 0000000..d022531 Binary files /dev/null and b/projects/bleUart/mdk/output/leds.o differ diff --git a/projects/bleUart/mdk/output/main.crf b/projects/bleUart/mdk/output/main.crf new file mode 100644 index 0000000..4eb7bf1 Binary files /dev/null and b/projects/bleUart/mdk/output/main.crf differ diff --git a/projects/bleUart/mdk/output/main.d b/projects/bleUart/mdk/output/main.d new file mode 100644 index 0000000..8265ba0 --- /dev/null +++ b/projects/bleUart/mdk/output/main.d @@ -0,0 +1,68 @@ +.\output\main.o: ..\src\main.c +.\output\main.o: ..\src\cfg.h +.\output\main.o: ..\..\..\core\b6x.h +.\output\main.o: ..\..\..\core\core_cm0plus.h +.\output\main.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h +.\output\main.o: ..\..\..\core\core_cmInstr.h +.\output\main.o: ..\..\..\core\core_cmFunc.h +.\output\main.o: ..\..\..\core\rom.h +.\output\main.o: ..\..\..\ble\api\bledef.h +.\output\main.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h +.\output\main.o: ..\..\..\ble\api\blelib.h +.\output\main.o: ..\..\..\ble\api\ke_api.h +.\output\main.o: ..\..\..\ble\api\task.h +.\output\main.o: ..\..\..\ble\api\list.h +.\output\main.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stddef.h +.\output\main.o: ..\..\..\ble\api\utils.h +.\output\main.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdlib.h +.\output\main.o: ..\..\..\ble\api\gapm_api.h +.\output\main.o: ..\..\..\ble\api\gapm.h +.\output\main.o: ..\..\..\ble\api\le_err.h +.\output\main.o: ..\..\..\ble\api\gap.h +.\output\main.o: ..\..\..\ble\api\gapc_api.h +.\output\main.o: ..\..\..\ble\api\gapc.h +.\output\main.o: ..\..\..\ble\api\gatt_api.h +.\output\main.o: ..\..\..\ble\api\gatt.h +.\output\main.o: ..\..\..\ble\api\att.h +.\output\main.o: ..\..\..\ble\prf\prf_api.h +.\output\main.o: ..\..\..\ble\prf\prf_diss.h +.\output\main.o: ..\..\..\ble\prf\prf_bass.h +.\output\main.o: ..\..\..\ble\prf\prf_hids.h +.\output\main.o: ..\..\..\ble\prf\prf_sess.h +.\output\main.o: ..\..\..\drivers\api\drvs.h +.\output\main.o: ..\..\..\core\string.h +.\output\main.o: ..\..\..\drivers\api\core.h +.\output\main.o: ..\..\..\drivers\api\dma.h +.\output\main.o: ..\..\..\core\reg\reg_dmachcfg.h +.\output\main.o: ..\..\..\core\reg\reg_base.h +.\output\main.o: ..\..\..\drivers\api\exti.h +.\output\main.o: ..\..\..\core\reg\reg_exti.h +.\output\main.o: ..\..\..\drivers\api\fshc.h +.\output\main.o: ..\..\..\drivers\api\flash.h +.\output\main.o: ..\..\..\drivers\api\gpio.h +.\output\main.o: ..\..\..\drivers\api\iopad.h +.\output\main.o: ..\..\..\core\reg\reg_csc.h +.\output\main.o: ..\..\..\core\reg\reg_gpio.h +.\output\main.o: ..\..\..\drivers\api\i2c.h +.\output\main.o: ..\..\..\core\reg\reg_i2c.h +.\output\main.o: ..\..\..\drivers\api\iwdt.h +.\output\main.o: ..\..\..\drivers\api\pwm.h +.\output\main.o: ..\..\..\drivers\api\rcc.h +.\output\main.o: ..\..\..\core\reg\reg_rcc.h +.\output\main.o: ..\..\..\drivers\api\rtc.h +.\output\main.o: ..\..\..\core\reg\reg_apbmisc.h +.\output\main.o: ..\..\..\drivers\api\rco.h +.\output\main.o: ..\..\..\drivers\api\sadc.h +.\output\main.o: ..\..\..\drivers\api\spi.h +.\output\main.o: ..\..\..\drivers\api\timer.h +.\output\main.o: ..\..\..\core\reg\reg_timer.h +.\output\main.o: ..\..\..\drivers\api\trim.h +.\output\main.o: ..\..\..\drivers\api\uart.h +.\output\main.o: ..\..\..\core\reg\reg_uart.h +.\output\main.o: ..\..\..\ble\app\app.h +.\output\main.o: ..\..\..\ble\app\app_actv.h +.\output\main.o: ..\..\..\modules\api\sftmr.h +.\output\main.o: ..\..\..\modules\api\leds.h +.\output\main.o: ..\..\..\modules\api\uartRb.h +.\output\main.o: ..\..\..\modules\api\dbg.h +.\output\main.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h diff --git a/projects/bleUart/mdk/output/main.o b/projects/bleUart/mdk/output/main.o new file mode 100644 index 0000000..4c3cceb Binary files /dev/null and b/projects/bleUart/mdk/output/main.o differ diff --git a/projects/bleUart/mdk/output/myapp.crf b/projects/bleUart/mdk/output/myapp.crf new file mode 100644 index 0000000..d02610a Binary files /dev/null and b/projects/bleUart/mdk/output/myapp.crf differ diff --git a/projects/bleUart/mdk/output/myapp.d b/projects/bleUart/mdk/output/myapp.d new file mode 100644 index 0000000..ce5f305 --- /dev/null +++ b/projects/bleUart/mdk/output/myapp.d @@ -0,0 +1,64 @@ +.\output\myapp.o: ..\src\myapp.c +.\output\myapp.o: ..\src\cfg.h +.\output\myapp.o: ..\..\..\ble\app\app.h +.\output\myapp.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h +.\output\myapp.o: ..\..\..\core\string.h +.\output\myapp.o: ..\..\..\ble\api\blelib.h +.\output\myapp.o: ..\..\..\ble\api\ke_api.h +.\output\myapp.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h +.\output\myapp.o: ..\..\..\ble\api\task.h +.\output\myapp.o: ..\..\..\ble\api\list.h +.\output\myapp.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stddef.h +.\output\myapp.o: ..\..\..\ble\api\utils.h +.\output\myapp.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdlib.h +.\output\myapp.o: ..\..\..\ble\app\app_actv.h +.\output\myapp.o: ..\..\..\ble\api\gapm.h +.\output\myapp.o: ..\..\..\ble\api\le_err.h +.\output\myapp.o: ..\..\..\ble\api\gap.h +.\output\myapp.o: ..\..\..\ble\api\gapc.h +.\output\myapp.o: ..\..\..\ble\api\bledef.h +.\output\myapp.o: ..\..\..\ble\api\gapm_api.h +.\output\myapp.o: ..\..\..\ble\api\gapc_api.h +.\output\myapp.o: ..\..\..\ble\api\gatt_api.h +.\output\myapp.o: ..\..\..\ble\api\gatt.h +.\output\myapp.o: ..\..\..\ble\api\att.h +.\output\myapp.o: ..\..\..\ble\prf\prf_api.h +.\output\myapp.o: ..\..\..\ble\prf\prf_diss.h +.\output\myapp.o: ..\..\..\ble\prf\prf_bass.h +.\output\myapp.o: ..\..\..\ble\prf\prf_hids.h +.\output\myapp.o: ..\..\..\ble\prf\prf_sess.h +.\output\myapp.o: ..\..\..\drivers\api\drvs.h +.\output\myapp.o: ..\..\..\core\b6x.h +.\output\myapp.o: ..\..\..\core\core_cm0plus.h +.\output\myapp.o: ..\..\..\core\core_cmInstr.h +.\output\myapp.o: ..\..\..\core\core_cmFunc.h +.\output\myapp.o: ..\..\..\core\rom.h +.\output\myapp.o: ..\..\..\drivers\api\core.h +.\output\myapp.o: ..\..\..\drivers\api\dma.h +.\output\myapp.o: ..\..\..\core\reg\reg_dmachcfg.h +.\output\myapp.o: ..\..\..\core\reg\reg_base.h +.\output\myapp.o: ..\..\..\drivers\api\exti.h +.\output\myapp.o: ..\..\..\core\reg\reg_exti.h +.\output\myapp.o: ..\..\..\drivers\api\fshc.h +.\output\myapp.o: ..\..\..\drivers\api\flash.h +.\output\myapp.o: ..\..\..\drivers\api\gpio.h +.\output\myapp.o: ..\..\..\drivers\api\iopad.h +.\output\myapp.o: ..\..\..\core\reg\reg_csc.h +.\output\myapp.o: ..\..\..\core\reg\reg_gpio.h +.\output\myapp.o: ..\..\..\drivers\api\i2c.h +.\output\myapp.o: ..\..\..\core\reg\reg_i2c.h +.\output\myapp.o: ..\..\..\drivers\api\iwdt.h +.\output\myapp.o: ..\..\..\drivers\api\pwm.h +.\output\myapp.o: ..\..\..\drivers\api\rcc.h +.\output\myapp.o: ..\..\..\core\reg\reg_rcc.h +.\output\myapp.o: ..\..\..\drivers\api\rtc.h +.\output\myapp.o: ..\..\..\core\reg\reg_apbmisc.h +.\output\myapp.o: ..\..\..\drivers\api\rco.h +.\output\myapp.o: ..\..\..\drivers\api\sadc.h +.\output\myapp.o: ..\..\..\drivers\api\spi.h +.\output\myapp.o: ..\..\..\drivers\api\timer.h +.\output\myapp.o: ..\..\..\core\reg\reg_timer.h +.\output\myapp.o: ..\..\..\drivers\api\trim.h +.\output\myapp.o: ..\..\..\drivers\api\uart.h +.\output\myapp.o: ..\..\..\core\reg\reg_uart.h +.\output\myapp.o: ..\..\..\modules\api\leds.h diff --git a/projects/bleUart/mdk/output/myapp.o b/projects/bleUart/mdk/output/myapp.o new file mode 100644 index 0000000..7971091 Binary files /dev/null and b/projects/bleUart/mdk/output/myapp.o differ diff --git a/projects/bleUart/mdk/output/prf_diss.crf b/projects/bleUart/mdk/output/prf_diss.crf new file mode 100644 index 0000000..af0c3e9 Binary files /dev/null and b/projects/bleUart/mdk/output/prf_diss.crf differ diff --git a/projects/bleUart/mdk/output/prf_diss.d b/projects/bleUart/mdk/output/prf_diss.d new file mode 100644 index 0000000..39bd08d --- /dev/null +++ b/projects/bleUart/mdk/output/prf_diss.d @@ -0,0 +1,19 @@ +.\output\prf_diss.o: ..\..\..\ble\prf\prf_diss.c +.\output\prf_diss.o: ..\src\cfg.h +.\output\prf_diss.o: ..\..\..\ble\prf\prf.h +.\output\prf_diss.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h +.\output\prf_diss.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h +.\output\prf_diss.o: ..\..\..\core\string.h +.\output\prf_diss.o: ..\..\..\ble\api\blelib.h +.\output\prf_diss.o: ..\..\..\ble\api\le_err.h +.\output\prf_diss.o: ..\..\..\ble\api\att.h +.\output\prf_diss.o: ..\..\..\ble\api\attm_api.h +.\output\prf_diss.o: ..\..\..\ble\api\task.h +.\output\prf_diss.o: ..\..\..\ble\api\list.h +.\output\prf_diss.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stddef.h +.\output\prf_diss.o: ..\..\..\ble\api\utils.h +.\output\prf_diss.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdlib.h +.\output\prf_diss.o: ..\..\..\ble\api\gatt_api.h +.\output\prf_diss.o: ..\..\..\ble\api\gatt.h +.\output\prf_diss.o: ..\..\..\ble\api\gap.h +.\output\prf_diss.o: ..\..\..\ble\prf\prf_diss.h diff --git a/projects/bleUart/mdk/output/prf_diss.o b/projects/bleUart/mdk/output/prf_diss.o new file mode 100644 index 0000000..a0d81fb Binary files /dev/null and b/projects/bleUart/mdk/output/prf_diss.o differ diff --git a/projects/bleUart/mdk/output/prf_sess.crf b/projects/bleUart/mdk/output/prf_sess.crf new file mode 100644 index 0000000..e985c5e Binary files /dev/null and b/projects/bleUart/mdk/output/prf_sess.crf differ diff --git a/projects/bleUart/mdk/output/prf_sess.d b/projects/bleUart/mdk/output/prf_sess.d new file mode 100644 index 0000000..799d3cb --- /dev/null +++ b/projects/bleUart/mdk/output/prf_sess.d @@ -0,0 +1,19 @@ +.\output\prf_sess.o: ..\..\..\ble\prf\prf_sess.c +.\output\prf_sess.o: ..\src\cfg.h +.\output\prf_sess.o: ..\..\..\ble\prf\prf.h +.\output\prf_sess.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h +.\output\prf_sess.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h +.\output\prf_sess.o: ..\..\..\core\string.h +.\output\prf_sess.o: ..\..\..\ble\api\blelib.h +.\output\prf_sess.o: ..\..\..\ble\api\le_err.h +.\output\prf_sess.o: ..\..\..\ble\api\att.h +.\output\prf_sess.o: ..\..\..\ble\api\attm_api.h +.\output\prf_sess.o: ..\..\..\ble\api\task.h +.\output\prf_sess.o: ..\..\..\ble\api\list.h +.\output\prf_sess.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stddef.h +.\output\prf_sess.o: ..\..\..\ble\api\utils.h +.\output\prf_sess.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdlib.h +.\output\prf_sess.o: ..\..\..\ble\api\gatt_api.h +.\output\prf_sess.o: ..\..\..\ble\api\gatt.h +.\output\prf_sess.o: ..\..\..\ble\api\gap.h +.\output\prf_sess.o: ..\..\..\ble\prf\prf_sess.h diff --git a/projects/bleUart/mdk/output/prf_sess.o b/projects/bleUart/mdk/output/prf_sess.o new file mode 100644 index 0000000..81a108d Binary files /dev/null and b/projects/bleUart/mdk/output/prf_sess.o differ diff --git a/projects/bleUart/mdk/output/proc.crf b/projects/bleUart/mdk/output/proc.crf new file mode 100644 index 0000000..d4087a8 Binary files /dev/null and b/projects/bleUart/mdk/output/proc.crf differ diff --git a/projects/bleUart/mdk/output/proc.d b/projects/bleUart/mdk/output/proc.d new file mode 100644 index 0000000..d8633fb --- /dev/null +++ b/projects/bleUart/mdk/output/proc.d @@ -0,0 +1,64 @@ +.\output\proc.o: ..\src\proc.c +.\output\proc.o: ..\src\cfg.h +.\output\proc.o: ..\..\..\core\b6x.h +.\output\proc.o: ..\..\..\core\core_cm0plus.h +.\output\proc.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h +.\output\proc.o: ..\..\..\core\core_cmInstr.h +.\output\proc.o: ..\..\..\core\core_cmFunc.h +.\output\proc.o: ..\..\..\core\rom.h +.\output\proc.o: ..\..\..\ble\api\bledef.h +.\output\proc.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h +.\output\proc.o: ..\..\..\ble\api\blelib.h +.\output\proc.o: ..\..\..\ble\api\ke_api.h +.\output\proc.o: ..\..\..\ble\api\task.h +.\output\proc.o: ..\..\..\ble\api\list.h +.\output\proc.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stddef.h +.\output\proc.o: ..\..\..\ble\api\utils.h +.\output\proc.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdlib.h +.\output\proc.o: ..\..\..\ble\api\gapm_api.h +.\output\proc.o: ..\..\..\ble\api\gapm.h +.\output\proc.o: ..\..\..\ble\api\le_err.h +.\output\proc.o: ..\..\..\ble\api\gap.h +.\output\proc.o: ..\..\..\ble\api\gapc_api.h +.\output\proc.o: ..\..\..\ble\api\gapc.h +.\output\proc.o: ..\..\..\ble\api\gatt_api.h +.\output\proc.o: ..\..\..\ble\api\gatt.h +.\output\proc.o: ..\..\..\ble\api\att.h +.\output\proc.o: ..\..\..\ble\prf\prf_api.h +.\output\proc.o: ..\..\..\ble\prf\prf_diss.h +.\output\proc.o: ..\..\..\ble\prf\prf_bass.h +.\output\proc.o: ..\..\..\ble\prf\prf_hids.h +.\output\proc.o: ..\..\..\ble\prf\prf_sess.h +.\output\proc.o: ..\..\..\drivers\api\drvs.h +.\output\proc.o: ..\..\..\core\string.h +.\output\proc.o: ..\..\..\drivers\api\core.h +.\output\proc.o: ..\..\..\drivers\api\dma.h +.\output\proc.o: ..\..\..\core\reg\reg_dmachcfg.h +.\output\proc.o: ..\..\..\core\reg\reg_base.h +.\output\proc.o: ..\..\..\drivers\api\exti.h +.\output\proc.o: ..\..\..\core\reg\reg_exti.h +.\output\proc.o: ..\..\..\drivers\api\fshc.h +.\output\proc.o: ..\..\..\drivers\api\flash.h +.\output\proc.o: ..\..\..\drivers\api\gpio.h +.\output\proc.o: ..\..\..\drivers\api\iopad.h +.\output\proc.o: ..\..\..\core\reg\reg_csc.h +.\output\proc.o: ..\..\..\core\reg\reg_gpio.h +.\output\proc.o: ..\..\..\drivers\api\i2c.h +.\output\proc.o: ..\..\..\core\reg\reg_i2c.h +.\output\proc.o: ..\..\..\drivers\api\iwdt.h +.\output\proc.o: ..\..\..\drivers\api\pwm.h +.\output\proc.o: ..\..\..\drivers\api\rcc.h +.\output\proc.o: ..\..\..\core\reg\reg_rcc.h +.\output\proc.o: ..\..\..\drivers\api\rtc.h +.\output\proc.o: ..\..\..\core\reg\reg_apbmisc.h +.\output\proc.o: ..\..\..\drivers\api\rco.h +.\output\proc.o: ..\..\..\drivers\api\sadc.h +.\output\proc.o: ..\..\..\drivers\api\spi.h +.\output\proc.o: ..\..\..\drivers\api\timer.h +.\output\proc.o: ..\..\..\core\reg\reg_timer.h +.\output\proc.o: ..\..\..\drivers\api\trim.h +.\output\proc.o: ..\..\..\drivers\api\uart.h +.\output\proc.o: ..\..\..\core\reg\reg_uart.h +.\output\proc.o: ..\..\..\ble\app\app.h +.\output\proc.o: ..\..\..\ble\app\app_actv.h +.\output\proc.o: ..\..\..\modules\api\uartRb.h diff --git a/projects/bleUart/mdk/output/proc.o b/projects/bleUart/mdk/output/proc.o new file mode 100644 index 0000000..0839a36 Binary files /dev/null and b/projects/bleUart/mdk/output/proc.o differ diff --git a/projects/bleUart/mdk/output/sftmr.crf b/projects/bleUart/mdk/output/sftmr.crf new file mode 100644 index 0000000..6aa015e Binary files /dev/null and b/projects/bleUart/mdk/output/sftmr.crf differ diff --git a/projects/bleUart/mdk/output/sftmr.d b/projects/bleUart/mdk/output/sftmr.d new file mode 100644 index 0000000..9a4227e --- /dev/null +++ b/projects/bleUart/mdk/output/sftmr.d @@ -0,0 +1,15 @@ +.\output\sftmr.o: ..\..\..\modules\src\sftmr.c +.\output\sftmr.o: ..\src\cfg.h +.\output\sftmr.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h +.\output\sftmr.o: ..\..\..\core\string.h +.\output\sftmr.o: ..\..\..\core\b6x.h +.\output\sftmr.o: ..\..\..\core\core_cm0plus.h +.\output\sftmr.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h +.\output\sftmr.o: ..\..\..\core\core_cmInstr.h +.\output\sftmr.o: ..\..\..\core\core_cmFunc.h +.\output\sftmr.o: ..\..\..\core\rom.h +.\output\sftmr.o: ..\..\..\modules\api\sftmr.h +.\output\sftmr.o: ..\..\..\drivers\api\rtc.h +.\output\sftmr.o: ..\..\..\core\reg\reg_apbmisc.h +.\output\sftmr.o: ..\..\..\core\reg\reg_base.h +.\output\sftmr.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stddef.h diff --git a/projects/bleUart/mdk/output/sftmr.o b/projects/bleUart/mdk/output/sftmr.o new file mode 100644 index 0000000..3707fb1 Binary files /dev/null and b/projects/bleUart/mdk/output/sftmr.o differ diff --git a/projects/bleUart/mdk/output/startup.d b/projects/bleUart/mdk/output/startup.d new file mode 100644 index 0000000..2a861ea --- /dev/null +++ b/projects/bleUart/mdk/output/startup.d @@ -0,0 +1 @@ +.\output\startup.o: ..\..\..\core\mdk\startup.s diff --git a/projects/bleUart/mdk/output/startup.o b/projects/bleUart/mdk/output/startup.o new file mode 100644 index 0000000..89dc8b4 Binary files /dev/null and b/projects/bleUart/mdk/output/startup.o differ diff --git a/projects/bleUart/mdk/output/uart1rb.crf b/projects/bleUart/mdk/output/uart1rb.crf new file mode 100644 index 0000000..f80a264 Binary files /dev/null and b/projects/bleUart/mdk/output/uart1rb.crf differ diff --git a/projects/bleUart/mdk/output/uart1rb.d b/projects/bleUart/mdk/output/uart1rb.d new file mode 100644 index 0000000..1880f4f --- /dev/null +++ b/projects/bleUart/mdk/output/uart1rb.d @@ -0,0 +1,17 @@ +.\output\uart1rb.o: ..\..\..\modules\src\uart1Rb.c +.\output\uart1rb.o: ..\src\cfg.h +.\output\uart1rb.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h +.\output\uart1rb.o: ..\..\..\core\b6x.h +.\output\uart1rb.o: ..\..\..\core\core_cm0plus.h +.\output\uart1rb.o: ..\..\..\core\core_cmInstr.h +.\output\uart1rb.o: ..\..\..\core\core_cmFunc.h +.\output\uart1rb.o: ..\..\..\core\rom.h +.\output\uart1rb.o: ..\..\..\modules\api\uartRb.h +.\output\uart1rb.o: ..\..\..\drivers\api\uart.h +.\output\uart1rb.o: ..\..\..\drivers\api\rcc.h +.\output\uart1rb.o: ..\..\..\core\reg\reg_rcc.h +.\output\uart1rb.o: ..\..\..\core\reg\reg_base.h +.\output\uart1rb.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stddef.h +.\output\uart1rb.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h +.\output\uart1rb.o: ..\..\..\core\reg\reg_uart.h +.\output\uart1rb.o: ..\..\..\modules\api\rbuf.h diff --git a/projects/bleUart/mdk/output/uart1rb.o b/projects/bleUart/mdk/output/uart1rb.o new file mode 100644 index 0000000..09bfe31 Binary files /dev/null and b/projects/bleUart/mdk/output/uart1rb.o differ diff --git a/projects/bleUart/src/cfg.h b/projects/bleUart/src/cfg.h new file mode 100644 index 0000000..9afc352 --- /dev/null +++ b/projects/bleUart/src/cfg.h @@ -0,0 +1,57 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// System Clock(0=16MHz, 1=32MHz, 2=48MHz, 3=64MHz) +#define SYS_CLK (0) + +/// Debug Mode(0=Disable, 1=via UART, 2=via RTT) +#define DBG_MODE (1) + +/// BLE Configure (Single or Multi-Connections) +#define BLE_NB_SLAVE (1) +#define BLE_NB_MASTER (0) + +#define BLE_ADDR {0x26, 0x08, 0x33, 0xA1, 0x01, 0xD2} +#define BLE_DEV_NAME "myBle-Uart" +#define BLE_DEV_ICON 0x0000 + +#define BLE_MTU (185) +#define SES_RXD_MAX_LEN (0x200) + +#define APP_ADV_INT_MIN (32) // unit in 0.625ms +#define APP_ADV_INT_MAX (32) // unit in 0.625ms + +/// Profile Configure +#define PRF_DISS (1) +#define PRF_SESS (1) + +/// Serial Service @see prf_sess.h +#define SES_UUID_128 (1) +#define SES_READ_SUP (0) + +/// Debug Configure +#if (DBG_MODE) + #define DBG_APP (0) + #define DBG_PROC (0) + #define DBG_ACTV (0) + #define DBG_GAPM (0) + #define DBG_GAPC (1) + #define DBG_DISS (0) + #define DBG_SESS (0) +#endif + +/// Misc Options +#define LED_PLAY (0) +#define CFG_SLEEP (0) + +#endif //_APP_CFG_H_ diff --git a/projects/bleUart/src/main.c b/projects/bleUart/src/main.c new file mode 100644 index 0000000..5476a30 --- /dev/null +++ b/projects/bleUart/src/main.c @@ -0,0 +1,84 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" +#include "app.h" +#include "sftmr.h" +#include "leds.h" +#include "uartRb.h" +#include "dbg.h" + +/* + * DEFINES + **************************************************************************************** + */ + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +extern void user_procedure(void); + +static void sysInit(void) +{ + iwdt_disable(); + + rcc_ble_en(); + rcc_adc_en(); + + rcc_fshclk_set(FSH_CLK_DPSC42); + APBMISC->XOSC16M_CTRL.XOSC16M_CAP_TR = 0x22; +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + uart1Rb_Init(); //dbgInit(); + debug("Start(rsn:%X)...\r\n", rsn); + + // Init BLE App + app_init(rsn); + + rf_pa_set(0x0C); + #if (LED_PLAY) + sftmr_init(); + leds_init(); + leds_play(LED_FAST_BL); + #endif //(LED_PLAY) +} + +int main(void) +{ + sysInit(); + devInit(); + + // Global Interrupt Enable + GLOBAL_INT_START(); + + // main loop + while (1) + { + // Schedule Messages & Events + ble_schedule(); + + #if (LED_PLAY) + // SoftTimer Polling + sftmr_schedule(); + #endif //(LED_PLAY) + + // User's Procedure + user_procedure(); + } +} diff --git a/projects/bleUart/src/myapp.c b/projects/bleUart/src/myapp.c new file mode 100644 index 0000000..20ad799 --- /dev/null +++ b/projects/bleUart/src/myapp.c @@ -0,0 +1,72 @@ +/** + **************************************************************************************** + * + * @file myapp.c + * + * @brief User Application - Override func + * + **************************************************************************************** + */ + +#include "app.h" +#include "bledef.h" +#include "drvs.h" +#include "leds.h" + +#if (DBG_APP) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * VARIABLES DEFINITIONS + **************************************************************************************** + */ + + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +#if (LED_PLAY) +/** + **************************************************************************************** + * @brief API to Set State of Application, add leds Indication + * + * @param[in] state new state + **************************************************************************************** + */ +void app_state_set(uint8_t state) +{ + DEBUG("State(old:%d,new:%d)", app_state_get(), state); + + app_env.state = state; + + // Indication, User add more... + if (state == APP_IDLE) + { + leds_play(LED_SLOW_BL); + } + else if (state == APP_READY) + { + leds_play(LED_FAST_BL); + } + else if (state == APP_CONNECTED) + { + leds_play(LED_CONT_ON); + } +} +#endif //(LED_PLAY) + diff --git a/projects/bleUart/src/proc.c b/projects/bleUart/src/proc.c new file mode 100644 index 0000000..b165aa2 --- /dev/null +++ b/projects/bleUart/src/proc.c @@ -0,0 +1,145 @@ +/** + **************************************************************************************** + * + * @file proc.c + * + * @brief user procedure. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" + +#include "app.h" +#include "prf_sess.h" +#include "uartRb.h" + +#if (DBG_PROC) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +#define BLE_MAX_LEN (BLE_MTU - 3) +#define NULL_CNT 20 + +static uint8_t buff[BLE_MAX_LEN]; +static uint16_t buff_len = 0; + +bool speed_test = 0; + +/* + * FUNCTIONS + **************************************************************************************** + */ + +#if !(DBG_SESS) +/// Override - Callback on received data from peer device +void sess_cb_rxd(uint8_t conidx, uint16_t len, const uint8_t *data) +{ + uart_send(UART1_PORT, len, data); +} +#endif //!(DBG_SESS) + +/// Uart Data procedure +static void data_proc(void) +{ + // Todo Loop-Proc + static uint8_t null_cnt = 0; + uint16_t len; + + len = uart1Rb_Read(&buff[buff_len], BLE_MAX_LEN - buff_len); + if (len > 0) + { + buff_len += len; + if (buff_len < BLE_MAX_LEN) + { + return; // wait full + } + } + else + { + if ((buff_len > 0) && (null_cnt++ > NULL_CNT)) + { + //finish = true; + null_cnt = 0; + } + else + { + return; // wait again + } + } + + if (app_state_get() == APP_CONNECTED) + { + if (buff[0] == 0xAA) + { + speed_test = false; + DEBUG("GAP Disc!\r\n"); + gapc_disconnect(app_env.curidx); + buff_len = 0; + } + else if (buff[0] == 'S') + { + speed_test = true; + buff_len = 0; + } + else if (sess_txd_send(app_env.curidx, buff_len, buff) == LE_SUCCESS) + { + debugHex(buff, buff_len); + buff_len = 0; + } + } + else + { + // goto reset + if (buff[0] == 0xAA) + { + DEBUG("GAP Reset!\r\n"); + gapm_reset(); + } + + buff_len = 0; + } +} + +#if (CFG_SLEEP) +static void sleep_proc(void) +{ + uint8_t lpsta = ble_sleep(BLE_SLP_TWOSC, BLE_SLP_DURMAX); + + if (lpsta == BLE_IN_SLEEP) + { + uint16_t lpret = core_sleep(CFG_WKUP_BLE_EN); + //DEBUG("ble sta:%d, wksrc:%X", lpsta, lpret); + } + else + { + //DEBUG("ble sta:%d", lpsta); + } +} +#endif //(CFG_SLEEP) + +void user_procedure(void) +{ + #if (CFG_SLEEP) + sleep_proc(); + #endif //(CFG_SLEEP) + + data_proc(); + + if ((app_state_get() == APP_CONNECTED) && (speed_test)) + { + sess_txd_send(app_env.curidx, BLE_MAX_LEN, buff); + } +} diff --git a/projects/bleUart2USB/mdk/JLinkSettings.ini b/projects/bleUart2USB/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/projects/bleUart2USB/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/projects/bleUart2USB/mdk/bleUart2USB.uvoptx b/projects/bleUart2USB/mdk/bleUart2USB.uvoptx new file mode 100644 index 0000000..ac6ce84 --- /dev/null +++ b/projects/bleUart2USB/mdk/bleUart2USB.uvoptx @@ -0,0 +1,540 @@ + + + + 1.0 + +
    ### uVision Project, (C) Keil Software
    + + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + ble_uart2usb + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20003000 -FC1000 -FN1 -FF0B6x_256kB_PY_D -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM)) + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC1000 -FN1 -FF0B6x_256kB_PY_D -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\src\myapp.c + myapp.c + 0 + 0 + + + 2 + 5 + 1 + 0 + 0 + 0 + ..\src\proc.c + proc.c + 0 + 0 + + + 2 + 6 + 1 + 0 + 0 + 0 + ..\src\cdc_uart.c + cdc_uart.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 7 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 8 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + modules + 1 + 0 + 0 + 0 + + 4 + 9 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\leds.c + leds.c + 0 + 0 + + + 4 + 10 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\sftmr.c + sftmr.c + 0 + 0 + + + 4 + 11 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\uart1Rb.c + uart1Rb.c + 0 + 0 + + + + + ble\app + 1 + 0 + 0 + 0 + + 5 + 12 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app.c + app.c + 0 + 0 + + + 5 + 13 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_actv.c + app_actv.c + 0 + 0 + + + 5 + 14 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_msg.c + app_msg.c + 0 + 0 + + + 5 + 15 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gapm.c + app_gapm.c + 0 + 0 + + + 5 + 16 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gapc.c + app_gapc.c + 0 + 0 + + + + + ble\prf + 1 + 0 + 0 + 0 + + 6 + 17 + 1 + 0 + 0 + 0 + ..\..\..\ble\prf\prf_diss.c + prf_diss.c + 0 + 0 + + + 6 + 18 + 1 + 0 + 0 + 0 + ..\..\..\ble\prf\prf_sess.c + prf_sess.c + 0 + 0 + + + + + ble\lib + 1 + 0 + 0 + 0 + + 7 + 19 + 4 + 0 + 0 + 0 + ..\..\..\ble\lib\ble6.lib + ble6.lib + 0 + 0 + + + + + usbd + 1 + 0 + 0 + 0 + + 8 + 20 + 4 + 0 + 0 + 0 + ..\..\..\usb\lib\usbd.lib + usbd.lib + 0 + 0 + + + 8 + 21 + 5 + 0 + 0 + 0 + ..\..\..\usb\api\usbd.h + usbd.h + 0 + 0 + + + 8 + 22 + 1 + 0 + 0 + 0 + ..\..\..\usb\class\cdc\usbd_cdc.c + usbd_cdc.c + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 9 + 23 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
    diff --git a/projects/bleUart2USB/mdk/bleUart2USB.uvprojx b/projects/bleUart2USB/mdk/bleUart2USB.uvprojx new file mode 100644 index 0000000..5f29e6b --- /dev/null +++ b/projects/bleUart2USB/mdk/bleUart2USB.uvprojx @@ -0,0 +1,550 @@ + + + + 2.1 + +
    ### uVision Project, (C) Keil Software
    + + + + ble_uart2usb + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + ble_uart2usb + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --thumb --gnu --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf;..\..\..\usb\api;..\..\..\usb\class\cdc + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip_ble.sct + + + --diag_suppress=L6312,L6314,L6329,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + myapp.c + 1 + ..\src\myapp.c + + + proc.c + 1 + ..\src\proc.c + + + cdc_uart.c + 1 + ..\src\cdc_uart.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + modules + + + leds.c + 1 + ..\..\..\modules\src\leds.c + + + sftmr.c + 1 + ..\..\..\modules\src\sftmr.c + + + uart1Rb.c + 1 + ..\..\..\modules\src\uart1Rb.c + + + + + ble\app + + + app.c + 1 + ..\..\..\ble\app\app.c + + + app_actv.c + 1 + ..\..\..\ble\app\app_actv.c + + + app_msg.c + 1 + ..\..\..\ble\app\app_msg.c + + + app_gapm.c + 1 + ..\..\..\ble\app\app_gapm.c + + + app_gapc.c + 1 + ..\..\..\ble\app\app_gapc.c + + + + + ble\prf + + + prf_diss.c + 1 + ..\..\..\ble\prf\prf_diss.c + + + prf_sess.c + 1 + ..\..\..\ble\prf\prf_sess.c + + + + + ble\lib + + + ble6.lib + 4 + ..\..\..\ble\lib\ble6.lib + + + + + usbd + + + usbd.lib + 4 + ..\..\..\usb\lib\usbd.lib + + + usbd.h + 5 + ..\..\..\usb\api\usbd.h + + + usbd_cdc.c + 1 + ..\..\..\usb\class\cdc\usbd_cdc.c + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
    diff --git a/projects/bleUart2USB/mdk/clean.bat b/projects/bleUart2USB/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/projects/bleUart2USB/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/projects/bleUart2USB/src/cdc_uart.c b/projects/bleUart2USB/src/cdc_uart.c new file mode 100644 index 0000000..9f4afe9 --- /dev/null +++ b/projects/bleUart2USB/src/cdc_uart.c @@ -0,0 +1,239 @@ +#include "usbd.h" +#include "usbd_cdc.h" +#include "uart.h" +#include "app.h" +#include "prf_sess.h" + +#define USBD_BCD USB_2_0 // Version +#define USBD_VID 0xFFFF // Vendor ID +#define USBD_PID 0xFFFF // Product ID +#define USBD_MAX_POWER 100 // unit in mA +#define USBD_LANGID_STRING 0x0409 // English(US) + + +#define ENB_CDC_CNT 1 + +#if (ENB_CDC_CNT == 0 || ENB_CDC_CNT > 3) +#error "The count of USB-Serial be 1 ~ 3." +#endif + + +/* + * Descriptor + **************************************************************************** + */ + +#define CDC0_IN_EP 0x81 +#define CDC0_OUT_EP 0x01 +#define CDC0_INT_EP 0x81+ENB_CDC_CNT +#define CDC0_INTF_NUM 0 + +#if (ENB_CDC_CNT > 1) +#define CDC1_IN_EP 0x82 +#define CDC1_OUT_EP 0x02 +#define CDC1_INT_EP 0x82+ENB_CDC_CNT +#define CDC1_INTF_NUM 2 +#endif + +#if (ENB_CDC_CNT > 2) +#define CDC2_IN_EP 0x83 +#define CDC2_OUT_EP 0x03 +#define CDC2_INT_EP 0x83+ENB_CDC_CNT +#define CDC2_INTF_NUM 4 +#endif + +#define USB_CDC_INTF_CNT (2 * ENB_CDC_CNT) // Cmd Intf + Data Intf +#define USB_CDC_INTF_END (USB_CDC_INTF_CNT - 1) +#define USB_CDC_CONFIG_SIZE (9 + CDC_ACM_DESCRIPTOR_LEN * ENB_CDC_CNT) + +/*!< cdc device descriptor */ +static const uint8_t cdc_descriptor[] = { + /* Descriptor - Device (Size:18) */ + USB_DEVICE_DESCRIPTOR_INIT(USBD_BCD, 0xEF, 0x02, 0x01, USBD_VID, USBD_PID, 0x0100, 0x01), + + /* Descriptor - Configuration (Total Size:9+Intf_Size) */ + USB_CONFIG_DESCRIPTOR_INIT(USB_CDC_CONFIG_SIZE, USB_CDC_INTF_CNT, 0x01, USB_CONFIG_BUS_POWERED, USBD_MAX_POWER), + + /* Descriptor - CDC Interface (Size:66) */ + CDC_ACM_DESCRIPTOR_INIT(0x00, CDC0_INT_EP, CDC0_OUT_EP, CDC0_IN_EP, 0x02), + #if (ENB_CDC_CNT > 1) + CDC_ACM_DESCRIPTOR_INIT(0x02, CDC1_INT_EP, CDC1_OUT_EP, CDC1_IN_EP, 0x02), + #endif + #if (ENB_CDC_CNT > 2) + CDC_ACM_DESCRIPTOR_INIT(0x04, CDC2_INT_EP, CDC2_OUT_EP, CDC2_IN_EP, 0x02), + #endif + + /* Descriptor - String */ + // String0 - Language ID (Size:4) + USB_LANGID_INIT(USBD_LANGID_STRING), + + // String1 - iManufacturer + 0x02, /* bLength */ + USB_DESC_TYPE_STRING, /* bDescriptorType */ + + // String2 - iProduct + 0x16, /* bLength */ + USB_DESC_TYPE_STRING, /* bDescriptorType */ + WCHAR('U'), + WCHAR('S'), + WCHAR('B'), + WCHAR('-'), + WCHAR('S'), + WCHAR('e'), + WCHAR('r'), + WCHAR('i'), + WCHAR('a'), + WCHAR('l'), + + // String3 - iSerialNumber + 0x10, /* bLength */ + USB_DESC_TYPE_STRING, /* bDescriptorType */ + WCHAR('6'), + WCHAR('.'), + WCHAR('2'), + WCHAR('2'), + WCHAR('.'), + WCHAR('0'), + WCHAR('7'), + + /* Descriptor - Device Qualifier (Size:10) */ + #if (USBD_BCD == USB_2_0) + USB_QUALIFIER_INIT(0x01), + #endif + + /* Descriptor - EOF */ + 0x00 +}; + + +/* + * Configuration + **************************************************************************** + */ + +static const usbd_ep_t endpoint_tab[] = { + USBD_EP_T(CDC0_INT_EP, USB_EP_TYPE_INTERRUPT, CDC_INT_EP_MPS, NULL), + USBD_EP_T(CDC0_OUT_EP, USB_EP_TYPE_BULK, CDC_BULK_EP_MPS, &usbd_cdc_bulk_out_handler), + USBD_EP_T(CDC0_IN_EP, USB_EP_TYPE_BULK, CDC_BULK_EP_MPS, &usbd_cdc_bulk_in_handler), + #if (ENB_CDC_CNT > 1) + USBD_EP_T(CDC1_INT_EP, USB_EP_TYPE_INTERRUPT, CDC_INT_EP_MPS, NULL), + USBD_EP_T(CDC1_OUT_EP, USB_EP_TYPE_BULK, CDC_BULK_EP_MPS, &usbd_cdc_bulk_out_handler), + USBD_EP_T(CDC1_IN_EP, USB_EP_TYPE_BULK, CDC_BULK_EP_MPS, &usbd_cdc_bulk_in_handler), + #endif + #if (ENB_CDC_CNT > 2) + USBD_EP_T(CDC2_INT_EP, USB_EP_TYPE_INTERRUPT, CDC_INT_EP_MPS, NULL), + USBD_EP_T(CDC2_OUT_EP, USB_EP_TYPE_BULK, CDC_BULK_EP_MPS, &usbd_cdc_bulk_out_handler), + USBD_EP_T(CDC2_IN_EP, USB_EP_TYPE_BULK, CDC_BULK_EP_MPS, &usbd_cdc_bulk_in_handler), + #endif +}; + +static const usbd_class_t class_tab[] = { + USBD_CLASS_T(0, USB_CDC_INTF_END, &usbd_cdc_class_handler), +}; + +static const usbd_config_t cdc_configuration[] = { + USBD_CONFIG_T(1, USB_CDC_INTF_CNT, class_tab, endpoint_tab) +}; + + +/* + * Handlers + **************************************************************************** + */ + +volatile uint8_t dtr_enable = 0; + +void usbd_cdc_updated(usbd_cdc_t *cdc, uint8_t type) +{ + if (type == CDC_LINE_STATE) { + USB_LOG_RAW("CDC Update(ep:0x%02X,)\r\n", cdc->ep_in, (cdc->line_state & 0x01), (cdc->line_state & 0x02)); + + dtr_enable = cdc->line_state; + } else { + USB_LOG_RAW("CDC Update(ep:0x%02X,)\r\n", cdc->ep_in, + cdc->line_coding.dwDTERate, cdc->line_coding.bDataBits, + cdc->line_coding.bParityType, cdc->line_coding.bCharFormat); + } +} + +void usbd_cdc_bulk_out_handler(uint8_t ep) +{ + uint16_t read_byte; + uint8_t data[CDC_BULK_EP_MPS]; + + read_byte = usbd_ep_read(ep, CDC_BULK_EP_MPS, data); + USB_LOG_RAW("CDC Bulk Out(ep:%d,len:%d)\r\n", ep, read_byte); + + /*!< here you can output data to hardware */ + //for (uint8_t i = 0; i < read_byte; i++) { + // uart_putc(0, data[i]); + //} + if (app_state_get() > APP_READY) + { + sess_txd_send(app_env.curidx, read_byte, data); + } + else + { + uart_send(UART1_PORT, read_byte, data); + } +} + +__USBIRQ void usbd_notify_handler(uint8_t event, void *arg) +{ + switch (event) { + case USBD_EVENT_RESET: + usbd_cdc_reset(); + break; + + default: + break; + } +} + + +/* + * Test Functions + **************************************************************************** + */ + +#define CDC_BULK_TX_SIZE (CDC_BULK_EP_MPS-1) + +uint8_t cdc_bulk_buff[CDC_BULK_TX_SIZE]; + +void usbdInit(void) +{ + usbd_init(); + usbd_register(cdc_descriptor, cdc_configuration); + + usbd_cdc_init(0, CDC0_INTF_NUM, CDC0_IN_EP); + #if (ENB_CDC_CNT > 1) + usbd_cdc_init(1, CDC1_INTF_NUM, CDC1_IN_EP); + #endif + #if (ENB_CDC_CNT > 2) + usbd_cdc_init(2, CDC2_INTF_NUM, CDC2_IN_EP); + #endif + + for (uint8_t i = 0; i < CDC_BULK_TX_SIZE; i++) { + cdc_bulk_buff[i] = '0' + i; + } +} + +void usbdTest(void) +{ + if (!usbd_is_configured()) + return; + + if (dtr_enable) + { + uint8_t status = usbd_cdc_ep_send(CDC0_IN_EP, CDC_BULK_TX_SIZE, cdc_bulk_buff); + USB_LOG_RAW("CDC0 Send(sta:%d,len:%d)\r\n", status, CDC_BULK_TX_SIZE); + #if (ENB_CDC_CNT > 1) + status = usbd_cdc_ep_send(CDC1_IN_EP, CDC_BULK_TX_SIZE, cdc_bulk_buff); + USB_LOG_RAW("CDC1 Send(sta:%d,len:%d)\r\n", status, CDC_BULK_TX_SIZE); + #endif + #if (ENB_CDC_CNT > 2) + status = usbd_cdc_ep_send(CDC2_IN_EP, CDC_BULK_TX_SIZE, cdc_bulk_buff); + USB_LOG_RAW("CDC2 Send(sta:%d,len:%d)\r\n", status, CDC_BULK_TX_SIZE); + #endif + } +} diff --git a/projects/bleUart2USB/src/cfg.h b/projects/bleUart2USB/src/cfg.h new file mode 100644 index 0000000..28ca175 --- /dev/null +++ b/projects/bleUart2USB/src/cfg.h @@ -0,0 +1,60 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// System Clock(0=16MHz, 1=32MHz, 2=48MHz, 3=64MHz) +#define SYS_CLK (2) + +/// Debug Mode(0=Disable, 1=via UART, 2=via RTT) +#define DBG_MODE (1) +#define DBG_UART_TXD (11) +#define DBG_UART_RXD (12) +#define DBG_UART_BAUD (BRR_DIV(115200, 48M)) +#define PA_UART1_TX (DBG_UART_TXD) +#define PA_UART1_RX (DBG_UART_RXD) +#define UART1_CONF_BAUD (DBG_UART_BAUD) + +/// BLE Configure (Single or Multi-Connections) +#define BLE_NB_SLAVE (1) +#define BLE_NB_MASTER (0) + +#define BLE_ADDR {0x13, 0x08, 0x33, 0xA1, 0x01, 0xD2} +#define BLE_DEV_NAME "myBle-Uart2USB_" +#define BLE_DEV_ICON 0x0000 + +#define APP_ADV_INT_MIN (32) // unit in 0.625ms +#define APP_ADV_INT_MAX (32) // unit in 0.625ms + +/// Profile Configure +#define PRF_DISS (1) +#define PRF_SESS (1) + +/// Serial Service @see prf_sess.h +#define SES_UUID_128 (1) +#define SES_READ_SUP (0) + +/// Debug Configure +#if (DBG_MODE) + #define DBG_APP (0) + #define DBG_PROC (0) + #define DBG_ACTV (0) + #define DBG_GAPM (1) + #define DBG_GAPC (1) + #define DBG_DISS (0) + #define DBG_SESS (1) +#endif + +/// Misc Options +#define LED_PLAY (0) +#define CFG_SLEEP (0) + +#endif //_APP_CFG_H_ diff --git a/projects/bleUart2USB/src/main.c b/projects/bleUart2USB/src/main.c new file mode 100644 index 0000000..0252ffb --- /dev/null +++ b/projects/bleUart2USB/src/main.c @@ -0,0 +1,92 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "bledef.h" +#include "app.h" +#include "sftmr.h" +#include "leds.h" +#include "uartRb.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +extern void usbdInit(void); +extern void user_procedure(void); + +static void sysInit(void) +{ + iwdt_disable(); + + // switch syclk to 48M for USB + rcc_sysclk_set(SYS_CLK_48M); + + rcc_ble_en(); + rcc_adc_en(); + + rcc_fshclk_set(FSH_CLK_DPSC42); +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + uart1Rb_Init(); //dbgInit(); + debug("Start(rsn:%X)...\r\n", rsn); + + #if (LED_PLAY) + sftmr_init(); + leds_init(); + leds_play(LED_FAST_BL); + #endif //(LED_PLAY) + + // enable USB clk and iopad + rcc_usb_en(); + usbdInit(); + NVIC_EnableIRQ(USB_IRQn); + + // Init BLE App + app_init(rsn); +} + +int main(void) +{ + sysInit(); + devInit(); + + // Global Interrupt Enable + GLOBAL_INT_START(); + + // main loop + while (1) + { + // Schedule Messages & Events + ble_schedule(); + + #if (LED_PLAY) + // SoftTimer Polling + sftmr_schedule(); + #endif //(LED_PLAY) + + // User's Procedure + user_procedure(); + } +} diff --git a/projects/bleUart2USB/src/myapp.c b/projects/bleUart2USB/src/myapp.c new file mode 100644 index 0000000..20ad799 --- /dev/null +++ b/projects/bleUart2USB/src/myapp.c @@ -0,0 +1,72 @@ +/** + **************************************************************************************** + * + * @file myapp.c + * + * @brief User Application - Override func + * + **************************************************************************************** + */ + +#include "app.h" +#include "bledef.h" +#include "drvs.h" +#include "leds.h" + +#if (DBG_APP) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * VARIABLES DEFINITIONS + **************************************************************************************** + */ + + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +#if (LED_PLAY) +/** + **************************************************************************************** + * @brief API to Set State of Application, add leds Indication + * + * @param[in] state new state + **************************************************************************************** + */ +void app_state_set(uint8_t state) +{ + DEBUG("State(old:%d,new:%d)", app_state_get(), state); + + app_env.state = state; + + // Indication, User add more... + if (state == APP_IDLE) + { + leds_play(LED_SLOW_BL); + } + else if (state == APP_READY) + { + leds_play(LED_FAST_BL); + } + else if (state == APP_CONNECTED) + { + leds_play(LED_CONT_ON); + } +} +#endif //(LED_PLAY) + diff --git a/projects/bleUart2USB/src/proc.c b/projects/bleUart2USB/src/proc.c new file mode 100644 index 0000000..8f01faf --- /dev/null +++ b/projects/bleUart2USB/src/proc.c @@ -0,0 +1,117 @@ +/** + **************************************************************************************** + * + * @file proc.c + * + * @brief user procedure. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" + +#include "app.h" +#include "prf_sess.h" +#include "uartRb.h" +#include "usbd_cdc.h" + +#if (DBG_PROC) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +enum uart_cmd +{ + CMD_USBD = 0xA0, + CMD_BLE_SESS = 0xB0, +}; + +#define CDC0_IN_EP 0x81 +#define BLE_MAX_LEN 20 +#define NULL_CNT 20 + +static uint8_t buff[BLE_MAX_LEN]; +static uint16_t buff_len = 0; + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +/// Override - Callback on received data from peer device +void sess_cb_rxd(uint8_t conidx, uint16_t len, const uint8_t *data) +{ + uart_send(UART1_PORT, len, data); + usbd_cdc_ep_send(CDC0_IN_EP, len, data); +} + +/// Uart Data procedure +void user_procedure(void) +{ + // Todo Loop-Proc + static uint8_t null_cnt = 0; + uint16_t len; + + len = uart1Rb_Read(&buff[buff_len], BLE_MAX_LEN - buff_len); + if (len > 0) + { + buff_len += len; + if (buff_len < BLE_MAX_LEN) + { + return; // wait full + } + } + else + { + if ((buff_len > 0) && (null_cnt++ > NULL_CNT)) + { + //finish = true; + null_cnt = 0; + } + else + { + return; // wait again + } + } + + switch (buff[0]) + { + case CMD_USBD: + { + uint8_t state = usbd_cdc_ep_send(CDC0_IN_EP, buff_len, buff); + + DEBUG("USBD(sta:%x)", state); + debugHex(buff, buff_len); + } break; + + case CMD_BLE_SESS: + { + if (app_state_get() > APP_READY) + { + uint8_t state = sess_txd_send(app_env.curidx, buff_len, buff); + + DEBUG("BLE_SESS(le_sta:%x, app_sta:%x)", state, app_state_get()); + debugHex(buff, buff_len); + } + + } break; + + default: + { + } break; + } + + buff_len = 0; +} diff --git a/projects/bleUartAT/AT指令说明.docx b/projects/bleUartAT/AT指令说明.docx new file mode 100644 index 0000000..865291d Binary files /dev/null and b/projects/bleUartAT/AT指令说明.docx differ diff --git a/projects/bleUartAT/mdk/JLinkSettings.ini b/projects/bleUartAT/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/projects/bleUartAT/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/projects/bleUartAT/mdk/bleUartAT.uvoptx b/projects/bleUartAT/mdk/bleUartAT.uvoptx new file mode 100644 index 0000000..a6da65e --- /dev/null +++ b/projects/bleUartAT/mdk/bleUartAT.uvoptx @@ -0,0 +1,508 @@ + + + + 1.0 + +
    ### uVision Project, (C) Keil Software
    + + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + bleUartAT + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC1000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + DLGUARM + + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + src + 1 + 0 + 0 + 0 + + 1 + 1 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 1 + 2 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 1 + 3 + 1 + 0 + 0 + 0 + ..\src\myapp.c + myapp.c + 0 + 0 + + + 1 + 4 + 1 + 0 + 0 + 0 + ..\src\proc.c + proc.c + 0 + 0 + + + 1 + 5 + 1 + 0 + 0 + 0 + ..\src\atcmd.c + atcmd.c + 0 + 0 + + + + + core + 1 + 0 + 0 + 0 + + 2 + 6 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 7 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 8 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + modules + 1 + 0 + 0 + 0 + + 4 + 9 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\uart1Rb.c + uart1Rb.c + 0 + 0 + + + 4 + 10 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\leds.c + leds.c + 0 + 0 + + + 4 + 11 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\sftmr.c + sftmr.c + 0 + 0 + + + + + ble\app + 1 + 0 + 0 + 0 + + 5 + 12 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app.c + app.c + 0 + 0 + + + 5 + 13 + 1 + 0 + 0 + 0 + ..\src\app_actv.c + app_actv.c + 0 + 0 + + + 5 + 14 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_msg.c + app_msg.c + 0 + 0 + + + 5 + 15 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gapm.c + app_gapm.c + 0 + 0 + + + 5 + 16 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gapc.c + app_gapc.c + 0 + 0 + + + 5 + 17 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gatt.c + app_gatt.c + 0 + 0 + + + + + ble\prf + 1 + 0 + 0 + 0 + + 6 + 18 + 1 + 0 + 0 + 0 + ..\..\..\ble\prf\prf_diss.c + prf_diss.c + 0 + 0 + + + 6 + 19 + 1 + 0 + 0 + 0 + ..\src\prf_sess.c + prf_sess.c + 0 + 0 + + + + + ble\lib + 1 + 0 + 0 + 0 + + 7 + 20 + 4 + 0 + 0 + 0 + ..\..\..\ble\lib\ble6.lib + ble6.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 8 + 21 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
    diff --git a/projects/bleUartAT/mdk/bleUartAT.uvprojx b/projects/bleUartAT/mdk/bleUartAT.uvprojx new file mode 100644 index 0000000..35f7a2d --- /dev/null +++ b/projects/bleUartAT/mdk/bleUartAT.uvprojx @@ -0,0 +1,535 @@ + + + + 2.1 + +
    ### uVision Project, (C) Keil Software
    + + + + bleUartAT + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + bleUartAT + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip_ble.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + myapp.c + 1 + ..\src\myapp.c + + + proc.c + 1 + ..\src\proc.c + + + atcmd.c + 1 + ..\src\atcmd.c + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + modules + + + uart1Rb.c + 1 + ..\..\..\modules\src\uart1Rb.c + + + leds.c + 1 + ..\..\..\modules\src\leds.c + + + sftmr.c + 1 + ..\..\..\modules\src\sftmr.c + + + + + ble\app + + + app.c + 1 + ..\..\..\ble\app\app.c + + + app_actv.c + 1 + ..\src\app_actv.c + + + app_msg.c + 1 + ..\..\..\ble\app\app_msg.c + + + app_gapm.c + 1 + ..\..\..\ble\app\app_gapm.c + + + app_gapc.c + 1 + ..\..\..\ble\app\app_gapc.c + + + app_gatt.c + 1 + ..\..\..\ble\app\app_gatt.c + + + + + ble\prf + + + prf_diss.c + 1 + ..\..\..\ble\prf\prf_diss.c + + + prf_sess.c + 1 + ..\src\prf_sess.c + + + + + ble\lib + + + ble6.lib + 4 + ..\..\..\ble\lib\ble6.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + + + + + + + +
    diff --git a/projects/bleUartAT/mdk/clean.bat b/projects/bleUartAT/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/projects/bleUartAT/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/projects/bleUartAT/src/app_actv.c b/projects/bleUartAT/src/app_actv.c new file mode 100644 index 0000000..4707005 --- /dev/null +++ b/projects/bleUartAT/src/app_actv.c @@ -0,0 +1,874 @@ +/** + **************************************************************************************** + * + * @file app_actv.c + * + * @brief Application Activity(Advertising, Scanning and Initiating) - Example + * + * < If want to modify it, recommend to copy the file to 'user porject'/src > + **************************************************************************************** + */ + +#include "app.h" +#include "gapm_api.h" +#include "atcmd.h" + +#if (DBG_ACTV) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Index & State of activities - User Customize +struct actv_env_tag +{ + #if (BLE_EN_ADV) + /// Advertising index and state + uint8_t advidx; + uint8_t advsta; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + /// Scanning index and state + uint8_t scanidx; + uint8_t scansta; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + /// Initiating index and state + uint8_t initidx; + uint8_t initsta; + #endif //(BLE_EN_INIT) +}; + +/// Activities environment +struct actv_env_tag actv_env; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @section Advertising Activity - Example for User Customize + * enable via pre-define @see BLE_EN_ADV + **************************************************************************************** + */ +#if (BLE_EN_ADV) + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// Advertising duration - 0 mean Always ON (in multiple of 10ms) +#if !defined(APP_ADV_DURATION) + #define APP_ADV_DURATION (0) +#endif + +/// Advertising channel map - 37, 38, 39 +#if !defined(APP_ADV_CHMAP) + #define APP_ADV_CHMAP (0x07) +#endif + +/// Advertising minimum interval - (n)*0.625ms +#if !defined(APP_ADV_INT_MIN) + #define APP_ADV_INT_MIN (64) +#endif + +/// Advertising maximum interval - (n)*0.625ms +#if !defined(APP_ADV_INT_MAX) + #define APP_ADV_INT_MAX (160) +#endif + +#if (APP_ADV_INT_MIN > APP_ADV_INT_MAX) + #error "ADV_INT_MIN must not exceed ADV_INT_MAX" +#endif + +/// Fast advertising interval +#define APP_ADV_FAST_INT (32) + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +static void app_adv_create(void) +{ + struct gapm_adv_create_param adv_param; + + // Advertising type (@see enum gapm_adv_type) + adv_param.type = GAPM_ADV_TYPE_LEGACY; + // Discovery mode (@see enum gapm_adv_disc_mode) + adv_param.disc_mode = GAPM_ADV_MODE_GEN_DISC; + // Advertising properties (@see enum gapm_adv_prop) + adv_param.prop = GAPM_ADV_PROP_UNDIR_CONN_MASK; + + // Filtering policy (@see enum gapm_adv_filter_policy) + adv_param.filter_pol = GAPM_ADV_ALLOW_SCAN_ANY_CON_ANY; + // Config primary advertising (@see gapm_adv_prim_cfg) + adv_param.prim_cfg.phy = GAP_PHY_LE_1MBPS; + adv_param.prim_cfg.chnl_map = APP_ADV_CHMAP; + adv_param.prim_cfg.adv_intv_min = sys_config.adv_intv_time;//APP_ADV_INT_MIN; + adv_param.prim_cfg.adv_intv_max = sys_config.adv_intv_time;//APP_ADV_INT_MAX; + + DEBUG("create(disc:%d,prop:%d)\r\n", adv_param.disc_mode, adv_param.prop); + + gapm_create_advertising(GAPM_STATIC_ADDR, &adv_param); +} + +static void app_adv_set_adv_data(void) +{ +#if (0) + // Reserve 3Bytes for AD_TYPE_FLAGS + uint8_t adv_data[GAP_ADV_DATA_LEN]; + uint8_t length = 11; + + // Set flags: 3B + adv_data[0] = 0x02; + adv_data[1] = GAP_AD_TYPE_FLAGS; // 0x01 0xFF;// + adv_data[2] = 0x06; + + // Set list of UUIDs: 4B + adv_data[3] = 0x03; + adv_data[4] = GAP_AD_TYPE_COMPLETE_LIST_16_BIT_UUID; // 0x03 + #if (PRF_HIDS) + write16p(&adv_data[5], 0x1812); // HID Service + #else + write16p(&adv_data[5], 0xFF00); // Serial Service + #endif + + // Set appearance: 4B + uint16_t icon = app_icon_get(); + adv_data[7] = 0x03; + adv_data[8] = GAP_AD_TYPE_APPEARANCE; // 0x19 + write16p(&adv_data[9], icon); +#endif + gapm_set_adv_data(actv_env.advidx, GAPM_SET_ADV_DATA, sys_config.adv_data_len, sys_config.adv_data); +} + +static void app_adv_set_scan_rsp(void) +{ + uint8_t length; + uint8_t rsp_data[DEV_NAME_MAX_LEN+2]; + + // Set device name + length = app_name_get(DEV_NAME_MAX_LEN, &rsp_data[2]); + rsp_data[0] = length + 1; + rsp_data[1] = GAP_AD_TYPE_COMPLETE_NAME; // 0x09 + + gapm_set_adv_data(actv_env.advidx, GAPM_SET_SCAN_RSP_DATA, length + 2, rsp_data); +} + +/** + **************************************************************************************** + * @brief Action/Command of Advertising + * + * @param[in] actv_op Operation of activity + **************************************************************************************** + */ +void app_adv_action(uint8_t actv_op) +{ + switch (actv_op) + { + case ACTV_CREATE: + { + if (actv_env.advsta == ACTV_STATE_OFF) + { + //DEBUG("Creating"); + app_adv_create(); + actv_env.advsta = ACTV_STATE_CREATE; + } + } break; + + case ACTV_START: + { + if (actv_env.advsta == ACTV_STATE_READY) + { + DEBUG("Starting"); + gapm_start_advertising(actv_env.advidx, APP_ADV_DURATION); + actv_env.advsta = ACTV_STATE_START; + } + } break; + + case ACTV_STOP: + { + if (actv_env.advsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_STOP; + } + } break; + + case ACTV_DELETE: + { + if ((actv_env.advsta != ACTV_STATE_OFF) && (actv_env.advsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_OFF; + } + } break; + + case ACTV_RELOAD: + { + if (actv_env.advsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_STOP; + } + + if ((actv_env.advsta != ACTV_STATE_OFF) && (actv_env.advsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_OFF; + } + + app_adv_create(); + actv_env.advsta = ACTV_STATE_CREATE; + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Event Procedure of Advertising + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_adv_event(uint8_t gapm_op, uint8_t status) +{ + DEBUG("Evt(op:0x%X,sta:0x%X)", gapm_op, status); + + switch (gapm_op) + { + case (GAPM_CREATE_ADV_ACTIVITY): + { + app_adv_set_adv_data(); + } break; + + case (GAPM_SET_ADV_DATA): + { + app_adv_set_scan_rsp(); + } break; + + case (GAPM_SET_SCAN_RSP_DATA): + { + actv_env.advsta = ACTV_STATE_READY; + + app_adv_action(ACTV_START); + app_state_set(APP_READY); + } break; + + case (GAPM_STOP_ACTIVITY): + { + if ((actv_env.advsta == ACTV_STATE_START) || (actv_env.advsta == ACTV_STATE_STOP)) + { + actv_env.advsta = ACTV_STATE_READY; + } + } break; + + default: + break; + } +} + +#endif //(BLE_EN_ADV) + + +/** + **************************************************************************************** + * @section Scanning Activity - Example for User Customize + * enable via pre-define @see BLE_EN_SCAN + **************************************************************************************** + */ +#if (BLE_EN_SCAN) + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +#define SCAN_NUM_MAX (5) + +uint8_t scan_cnt = 0; +struct gap_bdaddr scan_addr_list[SCAN_NUM_MAX]; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +static void app_start_scanning(void) +{ + struct gapm_scan_param scan_param; + + /// Type of scanning to be started (@see enum gapm_scan_type) + scan_param.type = GAPM_SCAN_TYPE_CONN_DISC; + /// Properties for the scan procedure (@see enum gapm_scan_prop) + scan_param.prop = GAPM_SCAN_PROP_PHY_1M_BIT | GAPM_SCAN_PROP_ACTIVE_1M_BIT | GAPM_SCAN_PROP_FILT_TRUNC_BIT; + /// Duplicate packet filtering policy (@see enum gapm_dup_filter_pol) + scan_param.dup_filt_pol = GAPM_DUP_FILT_EN; + /// Scan window opening parameters for LE 1M PHY (in unit of 625us) + scan_param.scan_param_1m.scan_intv = GAP_SCAN_FAST_INTV; + scan_param.scan_param_1m.scan_wd = GAP_SCAN_FAST_WIND; + /// Scan window opening parameters for LE Coded PHY + //scan_param.scan_param_coded.scan_intv = GAP_SCAN_SLOW_INTV1; + //scan_param.scan_param_coded.scan_wd = GAP_SCAN_SLOW_WIND1; + /// Scan duration (in unit of 10ms). 0 means that the controller will scan continuously until + /// reception of a stop command from the application + scan_param.duration = 500;//GAP_TMR_GEN_DISC_SCAN; + /// Scan period (in unit of 1.28s). Time interval betweem two consequent starts of a scan duration + /// by the controller. 0 means that the scan procedure is not periodic + scan_param.period = 0; + + gapm_start_activity(actv_env.scanidx, sizeof(struct gapm_scan_param), &scan_param); +} + +/** + **************************************************************************************** + * @brief Action/Command of Scanning + * + * @param[in] actv_op Operation of activity + **************************************************************************************** + */ +void app_scan_action(uint8_t actv_op) +{ + switch (actv_op) + { + case ACTV_CREATE: + { + if (actv_env.scansta == ACTV_STATE_OFF) + { + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_SCAN, GAPM_STATIC_ADDR); + actv_env.scansta = ACTV_STATE_CREATE; + } + } break; + + case ACTV_START: + { + scan_cnt = 0; + + if (actv_env.scansta == ACTV_STATE_READY) + { + DEBUG("Starting"); + app_start_scanning(); + actv_env.scansta = ACTV_STATE_START; + } + } break; + + case ACTV_STOP: + { + if (actv_env.scansta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_STOP; + } + } break; + + case ACTV_DELETE: + { + if ((actv_env.scansta != ACTV_STATE_OFF) && (actv_env.scansta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_OFF; + } + } break; + + case ACTV_RELOAD: + { + if (actv_env.scansta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_STOP; + } + + if ((actv_env.scansta != ACTV_STATE_OFF) && (actv_env.scansta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_OFF; + } + + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_SCAN, GAPM_STATIC_ADDR); + actv_env.scansta = ACTV_STATE_CREATE; + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Event Procedure of Scanning + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_scan_event(uint8_t gapm_op, uint8_t status) +{ + DEBUG("Evt(op:0x%X,sta:0x%X)", gapm_op, status); + + switch (gapm_op) + { + case GAPM_CREATE_SCAN_ACTIVITY: + { + actv_env.scansta = ACTV_STATE_READY; + } break; + + case GAPM_STOP_ACTIVITY: + { + if ((actv_env.scansta == ACTV_STATE_START) || (actv_env.scansta == ACTV_STATE_STOP)) + { + actv_env.scansta = ACTV_STATE_READY; + } + + DEBUG("-->Filter DevAddr"); + for (uint8_t idx = 0; idx < scan_cnt; idx++) + { + DEBUG("Scan List[%d]-->", idx); + debugHex((uint8_t *)(&scan_addr_list[idx]), sizeof(struct gap_bdaddr)); + } + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Store result of Scanning when filter by app_actv_report_ind + * + * @param[in] paddr gap_bdaddr of peer device + **************************************************************************************** + */ +void app_scan_result(const struct gap_bdaddr* paddr) +{ + for (uint8_t i = 0; i < scan_cnt; i++) + { + if (!memcmp(&scan_addr_list[i], paddr,sizeof(struct gap_bdaddr)))//save addr but diffrent + { + return; + } + } + + if (scan_cnt < SCAN_NUM_MAX) //get null array + { + memcpy(&scan_addr_list[scan_cnt], paddr,sizeof(struct gap_bdaddr)); + scan_cnt++; + } +} + +/** + **************************************************************************************** + * @brief Handles activity report. (@see GAPM_EXT_ADV_REPORT_IND) + * + * @param[in] report Report of Advertising data be scanned + **************************************************************************************** + */ +void app_actv_report_ind(struct gapm_ext_adv_report_ind const* report) +{ + // filter report + if ((report->info & GAPM_REPORT_INFO_REPORT_TYPE_MASK) == GAPM_REPORT_TYPE_ADV_LEG) + { + const uint8_t *p_cursor = report->data; + const uint8_t *p_end_cusor = report->data + report->length; + + while (p_cursor < p_end_cusor) + { + // Extract AD type + uint8_t ad_type = *(p_cursor + 1); + + if (ad_type == GAP_AD_TYPE_APPEARANCE) + { + uint16_t icon = read16p(p_cursor+2); + + // Filter special appearance device + if ((icon == 0x03C1) || (icon == 0x03C5)) // HID Gamepad + { + app_scan_result(&report->trans_addr); + break; + } + } + else if ((ad_type == GAP_AD_TYPE_COMPLETE_LIST_16_BIT_UUID) || (ad_type == GAP_AD_TYPE_MORE_16_BIT_UUID)) + { + uint16_t uuid = read16p(p_cursor+2); + + // Filter special uuid device + if (((uuid == 0x18F0) || (uuid == 0xFF00)))// && (param->trans_addr.addr.addr[0] == 0x04)) + { + app_scan_result(&report->trans_addr); + break; + } + } + else + { + // Filter Rule more... + } + + /* Go to next advertising info */ + p_cursor += (*p_cursor + 1); + } + } +} +#endif //(BLE_EN_SCAN) + + +/** + **************************************************************************************** + * @section Initiating Activity - Example for User Customize + * enable via pre-define @see BLE_EN_INIT + **************************************************************************************** + */ +#if (BLE_EN_INIT) + +#if !defined(APP_INIT_TIMEOUT) +#define APP_INIT_TIMEOUT 100 // timeout unit in 10ms +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +const struct gap_bdaddr dflt_peer = +{ + .addr = {{0x11, 0x22, 0x33, 0xa1, 0x01, 0xd3}}, + .addr_type = ADDR_RAND, +}; + +const struct gapm_conn_param dflt_conn_param = +{ + /// Minimum value for the connection interval (in unit of 1.25ms). Allowed range is 7.5ms to 4s. + .conn_intv_min = 10, + /// Maximum value for the connection interval (in unit of 1.25ms). Allowed range is 7.5ms to 4s. + .conn_intv_max = 10, + /// Slave latency. Number of events that can be missed by a connected slave device + .conn_latency = 0, + /// Link supervision timeout (in unit of 10ms). Allowed range is 100ms to 32s + .supervision_to = 300, + /// Recommended minimum duration of connection events (in unit of 625us) + .ce_len_min = 2, + /// Recommended maximum duration of connection events (in unit of 625us) + .ce_len_max = 4, +}; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Start initiating to peer device + * + * @param[in] paddr gap_bdaddr of peer device + **************************************************************************************** + */ +void app_start_initiating(const struct gap_bdaddr* paddr) +{ + if ((actv_env.initsta == ACTV_STATE_READY) || (actv_env.initsta == ACTV_STATE_STOP)) + { + struct gapm_init_param init_param; + + if (paddr == NULL) + { + paddr = &dflt_peer; + } + + init_param.type = GAPM_INIT_TYPE_DIRECT_CONN_EST; + init_param.prop = GAPM_INIT_PROP_1M_BIT; + init_param.conn_to = APP_INIT_TIMEOUT; // timeout unit in 10ms, update from v1.3 + init_param.scan_param_1m.scan_intv = GAP_SCAN_FAST_INTV; + init_param.scan_param_1m.scan_wd = GAP_SCAN_FAST_WIND; + + memcpy(&init_param.conn_param_1m, &dflt_conn_param, sizeof(struct gapm_conn_param)); + memcpy(&init_param.peer_addr, paddr, sizeof(struct gap_bdaddr)); + + gapm_start_activity(actv_env.initidx, sizeof(struct gapm_init_param), &init_param); + + DEBUG("Starting"); + actv_env.initsta = ACTV_STATE_START; + } +} + +/** + **************************************************************************************** + * @brief Action/Command of Initiating + * + * @param[in] actv_op Operation of activity + **************************************************************************************** + */ +void app_init_action(uint8_t actv_op) +{ + switch (actv_op) + { + case ACTV_CREATE: + { + if (actv_env.initsta == ACTV_STATE_OFF) + { + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_INIT, GAPM_STATIC_ADDR); + actv_env.initsta = ACTV_STATE_CREATE; + } + } break; + + case ACTV_START: + { + app_start_initiating(NULL); + } break; + + case ACTV_STOP: + { + if (actv_env.initsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_STOP; + } + } break; + + case ACTV_DELETE: + { + if ((actv_env.initsta != ACTV_STATE_OFF) && (actv_env.initsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_OFF; + } + } break; + + case ACTV_RELOAD: + { + if (actv_env.initsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_STOP; + } + + if ((actv_env.initsta != ACTV_STATE_OFF) && (actv_env.initsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_OFF; + } + + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_INIT, GAPM_STATIC_ADDR); + actv_env.initsta = ACTV_STATE_CREATE; + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Event Procedure of Initiating + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_init_event(uint8_t gapm_op, uint8_t status) +{ + DEBUG("Evt(op:0x%X,sta:0x%X)", gapm_op, status); + + switch (gapm_op) + { + case GAPM_CREATE_INIT_ACTIVITY: + { + actv_env.initsta = ACTV_STATE_READY; + } break; + + case GAPM_STOP_ACTIVITY: + { + if ((actv_env.initsta == ACTV_STATE_START) || (actv_env.initsta == ACTV_STATE_STOP)) + { + actv_env.initsta = ACTV_STATE_READY; + } + } break; + + default: + break; + } +} + +#endif //(BLE_EN_INIT) + + +/** + **************************************************************************************** + * @brief Create activities when Initialization complete. + **************************************************************************************** + */ +void app_actv_create(void) +{ + memset(&actv_env, 0, sizeof(actv_env)); + #if (BLE_EN_ADV) + app_adv_action(ACTV_CREATE); + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + app_scan_action(ACTV_CREATE); + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + app_init_action(ACTV_CREATE); + #endif //(BLE_EN_INIT) +} + +/** + **************************************************************************************** + * @brief Handles activity command complete event. + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_actv_cmp_evt(uint8_t operation, uint8_t status) +{ + switch (operation) + { + #if (BLE_EN_ADV) + case (GAPM_CREATE_ADV_ACTIVITY): + case (GAPM_SET_ADV_DATA): + case (GAPM_SET_SCAN_RSP_DATA): + { + app_adv_event(operation, status); + } break; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + case GAPM_CREATE_SCAN_ACTIVITY: + { + app_scan_event(operation, status); + } break; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + case GAPM_CREATE_INIT_ACTIVITY: + { + app_init_event(operation, status); + } break; + #endif //(BLE_EN_INIT) + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Handles activity created. (@see GAPM_ACTIVITY_CREATED_IND) + * + * @param[in] actv_type Type of activities(@see enum gapm_actv_type) + * @param[in] actv_idx Index of activities created + **************************************************************************************** + */ +void app_actv_created_ind(uint8_t actv_type, uint8_t actv_idx) +{ + switch (actv_type) + { + #if (BLE_EN_ADV) + case GAPM_ACTV_TYPE_ADV: + { + actv_env.advidx = actv_idx; + } break; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + case GAPM_ACTV_TYPE_SCAN: + { + actv_env.scanidx = actv_idx; + } break; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + case GAPM_ACTV_TYPE_INIT: + { + actv_env.initidx = actv_idx; + } break; + #endif //(BLE_EN_INIT) + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Handles activity stopped. (@see GAPM_ACTIVITY_STOPPED_IND) + * + * @param[in] actv_type Type of activity(@see enum gapm_actv_type) + * @param[in] reason Reason of stopped + **************************************************************************************** + */ +void app_actv_stopped_ind(uint8_t actv_type, uint8_t actv_idx, uint8_t reason) +{ + switch (actv_type) + { + #if (BLE_EN_ADV) + case GAPM_ACTV_TYPE_ADV: + { + // Advertising Stopped by slave connection or duration timeout + app_adv_event(GAPM_STOP_ACTIVITY, reason); + + // Duration timeout, go IDLE - update from v1.3 + if ((reason == GAP_ERR_TIMEOUT) && (app_state_get() == APP_READY)) + { + app_state_set(APP_IDLE); + } + } break; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + case GAPM_ACTV_TYPE_SCAN: + { + app_scan_event(GAPM_STOP_ACTIVITY, reason); + } break; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + case GAPM_ACTV_TYPE_INIT: + { + app_init_event(GAPM_STOP_ACTIVITY, reason); + } break; + #endif //(BLE_EN_INIT) + + default: + break; + } +} diff --git a/projects/bleUartAT/src/atcmd.c b/projects/bleUartAT/src/atcmd.c new file mode 100644 index 0000000..243cfb9 --- /dev/null +++ b/projects/bleUartAT/src/atcmd.c @@ -0,0 +1,724 @@ +#include "gap.h" +#include "atcmd.h" +#include "string.h" +#include "drvs.h" +#include +#include "app.h" +#include "app_actv.h" +#include "gapc_api.h" +#include "gapm_api.h" +#include "att.h" +#include "uartRb.h" +#include "prf_sess.h" +#include "gatt.h" +#include "sftmr.h" +#include "regs.h" + +#if (DBG_ATCMD) +#include "dbg.h" +//#define DEBUG(format, ...) debug("<%s,%d>" format , __MODULE__, __LINE__, ##__VA_ARGS__) +#define DEBUG(format, ...) debug(format, ##__VA_ARGS__) +#else +#define debug(format, ...) +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + +#define BLE_DEV_VERSION "1.0.1" + +#define SYS_CONFIG_ALIGNED4_WLEN ((sizeof(SYS_CONFIG) + 3) / 4) + +extern uint8_t scan_cnt; +extern struct gap_bdaddr scan_addr_list[]; + +uint8_t BLE_ADDR_DEFAULT[GAP_BD_ADDR_LEN] = BLE_ADDR; +struct connected_result connected_list[BLE_NB_SLAVE + BLE_NB_MASTER]; + +bool scan_time_out = false; +bool disconnect_all = false; + +volatile uint8_t g_cfg_change; + +enum cfg_chng_bits +{ + CFG_CHNG_BLE = 0x01, + CFG_CHNG_SYS = 0x02, + CFG_CHNG_RST = 0x04, +}; + +AT_CMD_FORMAT_T at_cmd_head_list[CMD_CODE_MAX] = +{ + [CMD_ECHO] = {5, 5, "AT+\r\n" }, + [CMD_ALL] = {8, 8, "AT+ALL\r\n" }, + [CMD_MAC_R] = {9, 9, "AT+MAC?\r\n" }, + [CMD_VER_R] = {9, 9, "AT+VER?\r\n" }, + [CMD_NAME_R] = {14, 14, "AT+DEV_NAME?\r\n" }, + [CMD_NAME_S] = {12, 34, "AT+DEV_NAME=" }, + [CMD_BAUD_R] = {10, 10, "AT+BAUD?\r\n" }, + [CMD_BAUD_S] = {8, 16, "AT+BAUD=" }, + [CMD_DISCON_S] = {13, 13, "AT+DISCON=1\r\n" }, + [CMD_SCAN_S] = {15, 15, "AT+SCAN_BLE=1\r\n"}, + [CMD_CON_MAC_R] = {13, 13, "AT+CON_MAC?\r\n" }, + [CMD_CON_MAC_S] = {11, 30, "AT+CON_MAC=" }, + [CMD_UUIDS_R] = {11, 11, "AT+UUIDS?\r\n" }, + [CMD_UUIDS_S] = {9, 43, "AT+UUIDS=" }, + [CMD_UUIDN_R] = {11, 11, "AT+UUIDN?\r\n" }, + [CMD_UUIDN_S] = {9, 43, "AT+UUIDN=" }, + [CMD_UUIDW_R] = {11, 11, "AT+UUIDW?\r\n" }, + [CMD_UUIDW_S] = {9, 43, "AT+UUIDW=" }, + [CMD_AINTVL_R] = {12, 12, "AT+AINTVL?\r\n" }, + [CMD_AINTVL_S] = {10, 16, "AT+AINTVL=" }, + [CMD_AMDATA_R] = {12, 12, "AT+AMDATA?\r\n" }, + [CMD_AMDATA_S] = {10, 38, "AT+AMDATA=" }, + [CMD_RENEW_S] = {10, 10, "AT+RENEW\r\n" }, + [CMD_RESET_S] = {10, 10, "AT+RESET\r\n" }, + [CMD_HELP] = {9, 9, "AT+HELP\r\n" }, +}; + +/* + * LOCAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +void at_uart_baud_cfg(uint8_t port, uint32_t uart_baud) +{ + UART_TypeDef* uart = ((UART_TypeDef *)(UART1_BASE + (port) * 0x1000)); + + uint16_t uart_baud_div = (uint16_t)((rcc_sysclk_freq() + ((uart_baud) >> 1)) / (uart_baud)); + + // update BaudRate + uart->LCR.BRWEN = 1; + uart->BRR = uart_baud_div; + uart->LCR.BRWEN = 0; +} + +void atConfigFlashWrite(uint32_t offset, uint8_t len, const uint32_t *data) +{ + flash_page_erase(offset); + flash_write(offset, (uint32_t *)data, len); +} + +void atConfigFlashRead(void) +{ + uint32_t config_data[SYS_CONFIG_ALIGNED4_WLEN]; + flash_read(SYS_CONFIG_OFFSET, config_data, SYS_CONFIG_ALIGNED4_WLEN); + + g_cfg_change = 0; + + for (uint8_t i = 0; i < SYS_CONFIG_ALIGNED4_WLEN; i++) + { + if (config_data[i] != 0xFFFFFFFF) + { + memcpy((uint8_t *)&sys_config, (uint8_t *)&config_data, sizeof(SYS_CONFIG)); + + break; + } + } + + at_uart_baud_cfg(UART1_PORT, sys_config.baudrate); +} + +SYS_CONFIG sys_config = +{ + .baudrate = AT_DFT_UART_BAUD, + .mac_addr = BLE_ADDR, + .uuid_len = ATT_UUID16_LEN, + .uuids = {0xF0, 0xFF}, + .uuidn = {0xF1, 0xFF}, + .uuidw = {0xF2, 0xFF}, + .name_len = sizeof(BLE_DEV_NAME) - 1, + .name = BLE_DEV_NAME, + + .adv_data_len = AT_DFT_ADV_DATA_LEN, + .adv_data = + { + 0x02, 0x01, 0x06, + 0x03, 0x03, 0xF0, 0xFF, + 0x03, 0x19, 0x00, 0x00 + }, + .adv_intv_time= AT_DFT_ADV_INTV, + .rssi = AT_DFT_RSSI, +}; + +// flag: All_FACTORY_REST: ȫָ +// flag: PAIR_FACTORY_RESET: Ϣ +void atSetBleDefault(PARA_SET_FACTORY flag) +{ +// uint8_t uuid16_idx = 12; + + if (flag == All_FACTORY_REST) + { + // sys_config; + memset(sys_config.adv_data, 0, sizeof(sys_config.adv_data)); + for (uint8_t idx = 0; idx < sys_config.adv_data_len; idx++) + { + sys_config.adv_data[idx] = idx; + } + +// sys_config.rssi = 0; // RSSI źֵ + +// sys_config.adv_intv_time = 20; //min + +// sys_config.uuid_len = ATT_UUID16_LEN; + +// if (sys_config.uuid_len == ATT_UUID128_LEN) uuid16_idx = 0; + +// memcpy(sys_config.uuids, &ses_uuid_s[uuid16_idx], sys_config.uuid_len); +// memcpy(sys_config.uuidn, &ses_uuid_n[uuid16_idx], sys_config.uuid_len); +// memcpy(sys_config.uuidw, &ses_uuid_w[uuid16_idx], sys_config.uuid_len); + } +// else if(flag == PAIR_FACTORY_RESET) +// { +// //sprintf((char*)sys_config.pass, "000000"); // +//// memset(sys_config.mac_addr, 0, sizeof(sys_config.mac_addr)); +//// memcpy(sys_config.mac_addr, BLE_ADDR_DEFAULT, GAP_BD_ADDR_LEN); +// sys_config.ever_connect_peripheral_mac_addr_conut = 0; +// sys_config.ever_connect_peripheral_mac_addr_index = 0; +// } + +// GAPBondMgr_SetParameter( GAPBOND_ERASE_ALLBONDS, 0, NULL ); //Ϣ + + atConfigFlashWrite(SYS_CONFIG_OFFSET, sizeof(SYS_CONFIG), (uint32_t *)&sys_config); +} + +#if (0) +// ַԱ +static uint8_t strCmp(const uint8_t *p1, char *p2, uint8_t len) +{ + uint8_t i = 0; + while (i < len) + { + if (p1[i] != p2[i]) + { + return 0; + } + i++; + } + return 1; +} +#endif + +// ַת +uint32_t str2Num(const uint8_t *numStr, uint8_t iLength) +{ + uint32_t rtnInt = 0; + + #if (__MICROLIB) + rtnInt = strtoul((const char *)numStr, NULL, 10); + #else + /* + Ϊ򵥣ȷֵַ + £˴δ飬Ҫ + numStr[i] - '0'Ƿ[0, 9] + */ + + for (uint8_t i = 0; (i < iLength) && (numStr[i] != '\0'); i++) + { + rtnInt = rtnInt * 10 + (numStr[i] - '0'); + } + #endif + + return rtnInt; +} + +__INLINE__ uint8_t co_hexstr2hex(uint8_t hex_str) +{ + return (hex_str <= '9') ? (hex_str - '0') : + ((hex_str <= 'F') ? (hex_str - 'A' + 10) : (hex_str - 'a' + 10)); +} + +void str2mac(const uint8_t *date) +{ + uint8_t *buff = (uint8_t *)date; + uint8_t j = (GAP_BD_ADDR_LEN - 1); + + for (uint8_t i = 0; i < 17; i++) + { + buff[i] = co_hexstr2hex(buff[i]); + + if ((i % 3) == 1) + { + sys_config.connect_mac_addr[j--] = (buff[i - 1] << 4) + buff[i]; + i++; //: + } + } +} + +void hexstr2hex(uint8_t str_len, const uint8_t *hex_str, uint8_t *hex) +{ + uint8_t *buff = (uint8_t *)hex_str; + + for (uint8_t i = 0; i < str_len; i++) + { + buff[i] = co_hexstr2hex(buff[i]); + + // ַƴһhex + if (i & 0x01) + { + hex[i / 2] = (buff[i - 1] << 4) | buff[i]; + } + } +} +void str2uuid(uint8_t str_len, const uint8_t *date, uint8_t *uuid) +{ + uint8_t *buff = (uint8_t *)date; + + for (uint8_t i = 0; i < str_len; i++) + { + buff[i] = co_hexstr2hex(buff[i]); + + // ַƴһhex + if (i & 0x01) + { + uuid[(str_len - i) / 2] = (buff[i - 1] << 4) + buff[i]; + } + } +} + +#define debugHexB(dat, len) \ + do \ + { \ + for (int i = 1; i <= len; i++) \ + { \ + DEBUG("%02X", *((dat + len) - i));\ + } \ + DEBUG("\r\n"); \ + } while (0) + +void debugMAC(uint8_t *addr) +{ + for (uint8_t idx = GAP_BD_ADDR_LEN; idx > 0; idx--) + { + DEBUG("%02X", addr[idx - 1]); + DEBUG("%s", idx > 1 ? ":" : "\r\n"); + } +} + +// ӡд洢ݣԴ +void printAllConfigData(void) +{ + DEBUG("Name = %s\r\n", sys_config.name); + + DEBUG("Version = %s\r\n", BLE_DEV_VERSION); + + DEBUG("Mac_Addr = %02X:%02X:%02X:%02X:%02X:%02X\r\n", sys_config.mac_addr[5], sys_config.mac_addr[4], + sys_config.mac_addr[3], sys_config.mac_addr[2], sys_config.mac_addr[1], sys_config.mac_addr[0]); + + DEBUG("[DA]+AMDATA= 0x"); + debugHexB(sys_config.adv_data, sys_config.adv_data_len); + + DEBUG("UUIDS = 0x"); + debugHexB(sys_config.uuids, sys_config.uuid_len); + + DEBUG("UUIDN = 0x"); + debugHexB(sys_config.uuidn, sys_config.uuid_len); + + DEBUG("UUIDW = 0x"); + debugHexB(sys_config.uuidw, sys_config.uuid_len); + + DEBUG("Rssi = %d\r\n", sys_config.rssi); + + DEBUG("Adv_Intv = %d\r\n", (sys_config.adv_intv_time * 5)/8); + + DEBUG("Baudrate = %d\r\n", sys_config.baudrate); + + DEBUG("Connected = %d\r\n\r\n", co_ones(app_env.conbits)); +} + +void printATHelp(void) +{ + for (uint8_t idx = CMD_ECHO; idx < CMD_CODE_MAX; idx++) + { +// sprintf((char *)&str_help, "\r\n"); + + DEBUG("%d:%s", idx,at_cmd_head_list[idx].str); + + if (at_cmd_head_list[idx].str_len_min != at_cmd_head_list[idx].str_len_max) + { + DEBUG("\r\n"); + } + } +} + +tmr_tk_t printScanMac(uint8_t id) +{ + for (uint8_t idx = 0; idx < scan_cnt; idx++) + { + DEBUG("[%d]", idx); + debugMAC((uint8_t *)&scan_addr_list[idx++].addr.addr); + } + DEBUG("[AT]Scan end\r\n"); + + return 0; +} + +void atBleTx(const uint8_t *buff, uint8_t buff_len) +{ + if (app_env.conrole & (0x01 << app_env.curidx)) // Slaver send to Master + { + sess_txd_send(app_env.curidx, buff_len, buff); + } + else // Master write to Slaver + { + // sesc_rxd_write(app_env.curidx, GATT_WRITE_NO_RESPONSE, buff_len, (uint8_t *)&buff); + } +} + +bool atProc(const uint8_t *buff, uint8_t buff_len) +{ + uint8_t code_idx = CMD_NULL; +// debug("buff_len[%d]\r\n", buff_len); + + if (memcmp(buff, "AT+", 3) != 0) + { + return 0; + } + + for (uint8_t idx = CMD_NULL; idx < CMD_CODE_MAX; idx++) + { + if ((at_cmd_head_list[idx].str_len_min <= buff_len) && (buff_len <= at_cmd_head_list[idx].str_len_max)) + { + if (memcmp(buff, at_cmd_head_list[idx].str, at_cmd_head_list[idx].str_len_min) == 0) + { + if (at_cmd_head_list[idx].str_len_min != at_cmd_head_list[idx].str_len_max) + { + if ((memcmp(&buff[buff_len - 2], "\r\n", 2) == 0) || (idx == CMD_AMDATA_S)) + { + code_idx = idx; + } + } + else + { + code_idx = idx; + } + } + } + } + + switch (code_idx) + { + case CMD_NULL: + { + DEBUG("[AT]ERR[%d]\r\n", ERR_PROTOCOL); + } break; + + case CMD_ECHO: + { + DEBUG("[AT]OK\r\n"); + } break; + + case CMD_ALL: + { + printAllConfigData(); + } break; + + case CMD_MAC_R: + { + DEBUG("[AT]OK\r\n"); + DEBUG("[DA]+MAC="); + debugMAC(sys_config.mac_addr); + } break; + + case CMD_VER_R: + { + DEBUG("[AT]OK\r\n"); + DEBUG("[DA]%s\r\n", BLE_DEV_VERSION); + } break; + + case CMD_NAME_R: + { + DEBUG("[AT]OK\r\n"); + DEBUG("[DA]+DEV_NAME=%s\r\n", sys_config.name); + } break; + + case CMD_NAME_S: + { + memset(sys_config.name, 0, sizeof(sys_config.name)); + sys_config.name_len = buff_len - 14; + memcpy(sys_config.name, &buff[12], sys_config.name_len); // "\r\n" + DEBUG("[AT]OK %s\r\n", sys_config.name); + + g_cfg_change = (CFG_CHNG_SYS | CFG_CHNG_BLE); + } break; + + case CMD_BAUD_R: + { + DEBUG("[AT]OK\r\n"); + DEBUG("[DA]+Baudrate=%d\r\n", sys_config.baudrate); + } break; + + case CMD_BAUD_S: + { + uint32_t baud = str2Num(&buff[8], buff_len - 10); + + if ((4800 <= baud) && (baud <= 921600)) + { + if (sys_config.baudrate != baud) + { + sys_config.baudrate = baud; + } + DEBUG("[AT]OK %d\r\n", sys_config.baudrate); + + g_cfg_change = (CFG_CHNG_SYS | CFG_CHNG_RST); + } + else + { + DEBUG("[AT]ERR[%d]\r\n", ERR_INVALID); + } + } break; + + case CMD_DISCON_S: + { + if (app_state_get() == APP_CONNECTED) + { + DEBUG("[AT]OK\r\n"); + disconnect_all = true; + gapc_disconnect(app_env.curidx); + } + else + { + DEBUG("[AT]ERR[%d]\r\n", ERR_OPERATION); + } + } break; + + case CMD_SCAN_S: + // ʼɨ + if (app_state_get() >= APP_IDLE) + { + DEBUG("[AT]OK\r\n"); + DEBUG("[AT]Scanning\r\n"); + + app_scan_action(ACTV_START); + + #if ((LED_PLAY) || (CFG_SFT_TMR)) + sftmr_start(500, printScanMac); + #endif + } + else + { + DEBUG("[AT]ERR[%d]\r\n", ERR_OPERATION); + } break; + + case CMD_CON_MAC_R: + { + DEBUG("[AT]OK\r\n"); + + uint8_t con_num_bit = app_env.conbits; + if (con_num_bit == 0) + { + DEBUG("No Connected\r\n"); + break; + } + + uint8_t con_num = 0; + + while (con_num_bit) + { + DEBUG("[DA]Connected="); + + if (con_num_bit & 0x01) + { + debugMAC(connected_list[con_num].paddr.addr.addr); + } + + con_num++; + con_num_bit >>= 1; + } + } break; + + case CMD_CON_MAC_S: + { + app_init_action(ACTV_STOP); // 20211101 + str2mac(&buff[11]); + + struct gap_bdaddr peer; + + memcpy(peer.addr.addr, sys_config.connect_mac_addr, GAP_BD_ADDR_LEN); + + peer.addr_type = (peer.addr.addr[GAP_BD_ADDR_LEN-1] < 0xC0 ? 0 : 1); + + DEBUG("[AT]OK\r\n"); + DEBUG("[DA]Connecting\r\n"); + DEBUG("[DA]Connected="); + + debugMAC(sys_config.connect_mac_addr); + + app_start_initiating(&peer); + } break; + + case CMD_UUIDS_R: + { + DEBUG("[AT]OK\r\n"); + DEBUG("[DA]+UUIDS=0x"); + debugHexB(sys_config.uuids, sys_config.uuid_len); + } break; + + case CMD_UUIDS_S: + { + uint8_t id_len = (buff_len - 11) / 2; + + if ((id_len == ATT_UUID16_LEN) || (id_len == ATT_UUID128_LEN)) + { + sys_config.uuid_len = id_len; + str2uuid(2 * id_len, &buff[9], sys_config.uuids); + + DEBUG("[AT]OK\r\n"); + g_cfg_change = (CFG_CHNG_SYS | CFG_CHNG_BLE); + } + else + { + DEBUG("[AT]ERR[%d]\r\n", ERR_INVALID); + } + } break; + + case CMD_UUIDN_R: + { + DEBUG("[AT]OK\r\n"); + DEBUG("[DA]+UUIDN=0x"); + debugHexB(sys_config.uuidn, sys_config.uuid_len); + } break; + + case CMD_UUIDN_S: + { + uint8_t id_len = (buff_len - 11) / 2; + + if (id_len == sys_config.uuid_len) + { + str2uuid(2 * id_len, &buff[9], sys_config.uuidn); + DEBUG("[AT]OK\r\n"); + + g_cfg_change = (CFG_CHNG_SYS | CFG_CHNG_BLE); + } + else + { + DEBUG("[AT]ERR[%d]\r\n", ERR_INVALID); + } + } break; + + case CMD_UUIDW_R: + { + DEBUG("[AT]OK\r\n"); + DEBUG("[DA]+UUIDW=0x"); + debugHexB(sys_config.uuidw, sys_config.uuid_len); + } break; + + case CMD_UUIDW_S: + { + uint8_t id_len = (buff_len - 11) / 2; + + if (id_len == sys_config.uuid_len) + { + str2uuid(2 * id_len, &buff[9], sys_config.uuidw); + DEBUG("[AT]OK\r\n"); + + g_cfg_change = (CFG_CHNG_SYS | CFG_CHNG_BLE); + } + else + { + DEBUG("[AT]ERR[%d]\r\n", ERR_INVALID); + } + } break; + + case CMD_AINTVL_R: + { + // adv intv unit 0.625 + uint16_t adv_intv_val = (uint16_t)(sys_config.adv_intv_time * 5)/8; + DEBUG("[AT]OK\r\n"); + DEBUG("[DA]+AINTVL=%d\r\n", adv_intv_val); + } break; + + case CMD_AINTVL_S: + { + uint16_t value = str2Num(&buff[10], buff_len - 12); + DEBUG("value:%d\r\n", value); + // adv intv unit 0.625 + value = (value * 8 / 5); + if ((0x20 <= value) && (value <= 5000)) + { + sys_config.adv_intv_time = value; + DEBUG("[AT]OK\r\n"); + + g_cfg_change = (CFG_CHNG_SYS | CFG_CHNG_BLE); + } + else + { + DEBUG("[AT]ERR[%d]\r\n", ERR_INVALID); + } + } break; + + case CMD_AMDATA_R: + { + DEBUG("[DA]+AMDATA="); + debugHex(sys_config.adv_data, sys_config.adv_data_len); + } break; + + case CMD_AMDATA_S: + { + uint8_t len = buff_len - 12; + + if (len <= 30) + { + #if (1) + if (len & 0x01) + { + DEBUG("[AT]ERR[%d]\r\n", ERR_INVALID); + break; + } + sys_config.adv_data_len = len/2; + hexstr2hex(len, (buff + 10), sys_config.adv_data); + + #else + memcpy(sys_config.adv_data, &buff[10], sys_config.adv_data_len); + #endif + DEBUG("[AT]OK\r\n"); + + g_cfg_change = (CFG_CHNG_SYS | CFG_CHNG_BLE); + } + else + { + DEBUG("[AT]ERR[%d]\r\n", ERR_INVALID); + } + } break; + + case CMD_RENEW_S: + { +// atSetBleDefault(All_FACTORY_REST); + flash_page_erase(SYS_CONFIG_OFFSET); + };// break; // no break, used CMD_RESET_S break + + case CMD_RESET_S: + { + DEBUG("[AT]OK\r\n"); + g_cfg_change = CFG_CHNG_RST;// ֱ + } break; + + case CMD_HELP: + printATHelp(); + break; + + default: + DEBUG("[AT]ERR[%d]\r\n", ERR_PROTOCOL); + break; + } + +// DEBUG("cfg:%X\r\n", g_cfg_change); + + if (g_cfg_change & CFG_CHNG_BLE) + { + gapm_reset(); + } + + if (g_cfg_change & CFG_CHNG_SYS) + { + atConfigFlashWrite(SYS_CONFIG_OFFSET, SYS_CONFIG_ALIGNED4_WLEN, (uint32_t *)&sys_config); + } + + if (g_cfg_change & CFG_CHNG_RST) + { + #if ((LED_PLAY) || (CFG_SFT_TMR)) + sftmr_wait(6); // òʵʱ,Աһη͵ͳȥ + #endif + NVIC_SystemReset(); + } + + return (code_idx ? 1 : 0); +} diff --git a/projects/bleUartAT/src/atcmd.h b/projects/bleUartAT/src/atcmd.h new file mode 100644 index 0000000..a738e53 --- /dev/null +++ b/projects/bleUartAT/src/atcmd.h @@ -0,0 +1,125 @@ +#ifndef _ATCMD_H_ +#define _ATCMD_H_ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" +#include "gap.h" +#include "app.h" +/* + * DEFINES + **************************************************************************************** + */ +#define MAX_UUID_LEN 0x10// +#define MAX_ADV_DATA_LEN 0x20// +#define SYS_CONFIG_OFFSET 0x1000 + +// AT Default Congif +#define AT_DFT_UART_BAUD (115200) +#define AT_DFT_ADV_DATA_LEN (11) +#define AT_DFT_ADV_INTV (0x20) +#define AT_DFT_RSSI (0) + +// ûϢӻϢ +typedef enum +{ + All_FACTORY_REST = 0, //ȫָ + PAIR_FACTORY_RESET = 1, //Ϣָ-൱ϢӻϢ +}PARA_SET_FACTORY; + +// AT ָ +enum err_code +{ + ERR_HARD_WARE, // 豸Ӳ + ERR_NO_CONNECT, // û + ERR_OPERATION, // + ERR_INVALID, // Ч + ERR_TIMEOUT, // ʱ + ERR_MEMORY, // ڴʧ + ERR_PROTOCOL, // Эʧ +}; + +// AT ַָ +enum cmd_str +{ + CMD_NULL, // + CMD_ECHO, // + CMD_ALL, // + CMD_MAC_R, // + CMD_VER_R, // + CMD_NAME_R, // + CMD_NAME_S, // + CMD_BAUD_R, + CMD_BAUD_S, + CMD_DISCON_S, + CMD_SCAN_S, + CMD_CON_MAC_R, + CMD_CON_MAC_S, + CMD_UUIDS_R, + CMD_UUIDS_S, + CMD_UUIDN_R, + CMD_UUIDN_S, + CMD_UUIDW_R, + CMD_UUIDW_S, + CMD_AINTVL_R, + CMD_AINTVL_S, + CMD_AMDATA_R, + CMD_AMDATA_S, + CMD_RENEW_S, + CMD_RESET_S, + CMD_HELP, + + CMD_CODE_MAX, +}; + +typedef struct at_cmd_format +{ + uint8_t str_len_min; + uint8_t str_len_max; + const char *str; +}AT_CMD_FORMAT_T; + +///Information about Connected device +struct connected_result +{ + struct gap_bdaddr paddr; +}; + +typedef struct +{ + uint8_t name_len; // 豸ƣ 11 λֻĸлߺ»ߣַ + uint8_t rssi; // RSSI źֵ + + uint16_t adv_intv_time; // 㲥 + + uint32_t baudrate; // + + uint8_t uuids[MAX_UUID_LEN]; + uint8_t uuidn[MAX_UUID_LEN]; + uint8_t uuidw[MAX_UUID_LEN]; + + uint8_t uuid_len; + uint8_t name[DEV_NAME_MAX_LEN]; + + uint8_t adv_data_len; + uint8_t adv_data[MAX_ADV_DATA_LEN]; + + uint8_t mac_addr[GAP_BD_ADDR_LEN]; //macַ 12λ ַʾ + + uint8_t connect_mac_addr[GAP_BD_ADDR_LEN]; //Զmacַ + +}SYS_CONFIG __attribute__((aligned(4))); + +extern SYS_CONFIG sys_config; +extern bool scan_time_out; +extern bool disconnect_all; +extern struct connected_result connected_list[]; + +void atConfigFlashRead(void); +void atSetBleDefault(PARA_SET_FACTORY flag); +bool atCmdHandle(const uint8_t *buff, uint8_t buff_len); +bool atProc(const uint8_t *buff, uint8_t buff_len); +void atBleTx(const uint8_t *buff, uint8_t buff_len); + +#endif + diff --git a/projects/bleUartAT/src/cfg.h b/projects/bleUartAT/src/cfg.h new file mode 100644 index 0000000..5350cce --- /dev/null +++ b/projects/bleUartAT/src/cfg.h @@ -0,0 +1,56 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// System Clock(0=16MHz, 1=32MHz, 2=48MHz, 3=64MHz) +#define SYS_CLK (0) +#define AT_UART_PORT (0) + +/// Debug Mode(0=Disable, 1=via UART, 2=via RTT) +#define DBG_MODE (1) + +/// BLE Configure +#define BLE_NB_SLAVE (1) +#define BLE_NB_MASTER (1) +#define BLE_EN_SMP (0) + +#define BLE_ADDR {0x55, 0x08, 0x33, 0xA1, 0x01, 0xD2} +#define BLE_DEV_NAME "myBle-AT" +#define BLE_DEV_ICON 0x0000 // 03C0-Generic HID,03C1-Keyboard,03C2-Mouse,03C4-Gamepad + +/// Profile Configure +#define PRF_DISS (0) +#define PRF_SESS (1) +#define PRF_SESC (0) +#define PRF_PTSS (0) +#define PRF_OTAS (0) +#define GATT_CLI (0) +#define SES_UUID_128 (0) + +/// Debug Configure +#if (DBG_MODE) + #define DBG_APP (0) + #define DBG_PROC (0) + #define DBG_ACTV (0) + #define DBG_GAPM (0) + #define DBG_GAPC (1) + #define DBG_GATT (0) + #define DBG_DISS (0) + #define DBG_SESS (0) + #define DBG_ATCMD (1) +#endif + +/// Misc Options +#define LED_PLAY (1) +#define CFG_SFT_TMR (1) + +#endif //_APP_CFG_H_ diff --git a/projects/bleUartAT/src/main.c b/projects/bleUartAT/src/main.c new file mode 100644 index 0000000..2b6b715 --- /dev/null +++ b/projects/bleUartAT/src/main.c @@ -0,0 +1,92 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "drvs.h" +#include "bledef.h" +#include "app.h" +#include "sftmr.h" +#include "leds.h" +#include "uartRb.h" +#include "atcmd.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +extern void user_procedure(void); + +static void sysInit(void) +{ + rcc_sysclk_set(SYS_CLK); + + iwdt_disable(); + + rcc_ble_en(); + rcc_adc_en(); + + rcc_fshclk_set(FSH_CLK_DPSC42); +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + uart1Rb_Init(); + debug("Start(rsn:%X, clk:%d)...\r\n", rsn, rcc_sysclk_freq()); + + atConfigFlashRead(); + + #if ((LED_PLAY) || (CFG_SFT_TMR)) + sftmr_init(); + + #if (LED_PLAY) + leds_init(); + leds_play(LED_FAST_BL); + #endif //(LED_PLAY) + + #endif + + // Init BLE App + app_init(rsn); +} + +int main(void) +{ + sysInit(); + devInit(); + + // Global Interrupt Enable + GLOBAL_INT_START(); + + // main loop + while (1) + { + // Schedule Messages & Events + ble_schedule(); + + #if ((LED_PLAY) || (CFG_SFT_TMR)) + // SoftTimer Polling + sftmr_schedule(); + #endif //(LED_PLAY) + + // User's Procedure + user_procedure(); + } +} diff --git a/projects/bleUartAT/src/myapp.c b/projects/bleUartAT/src/myapp.c new file mode 100644 index 0000000..081c265 --- /dev/null +++ b/projects/bleUartAT/src/myapp.c @@ -0,0 +1,92 @@ +/** + **************************************************************************************** + * + * @file myapp.c + * + * @brief User Application - Override func + * + **************************************************************************************** + */ + +#include "app.h" +#include "bledef.h" +#include "drvs.h" +#include "leds.h" +#include "atcmd.h" + +#if (DBG_APP) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * VARIABLES DEFINITIONS + **************************************************************************************** + */ + + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +#if (LED_PLAY) +/** + **************************************************************************************** + * @brief API to Set State of Application, add leds Indication + * + * @param[in] state new state + **************************************************************************************** + */ +void app_state_set(uint8_t state) +{ + DEBUG("State(old:%d,new:%d)", app_state_get(), state); + + app_env.state = state; + + // Indication, User add more... + if (state == APP_IDLE) + { + leds_play(LED_SLOW_BL); + } + else if (state == APP_READY) + { + leds_play(LED_FAST_BL); + } + else if (state == APP_CONNECTED) + { + leds_play(LED_CONT_ON); + } +} +#endif //(LED_PLAY) + +/** + **************************************************************************************** + * @brief API to Get Device Name, User Override! + * + * @param[in] size Length of name Buffer + * @param[out] name Pointer of name buffer + * + * @return Length of device name + **************************************************************************************** + */ +uint8_t app_name_get(uint8_t size, uint8_t *name) +{ + uint8_t len = sys_config.name_len; + + if (len > size) len = size; + + memcpy(name, sys_config.name, len); + return len; +} diff --git a/projects/bleUartAT/src/prf_sess.c b/projects/bleUartAT/src/prf_sess.c new file mode 100644 index 0000000..ef7d82a --- /dev/null +++ b/projects/bleUartAT/src/prf_sess.c @@ -0,0 +1,505 @@ +/** + **************************************************************************************** + * + * @file prf_sess.c + * + * @brief Serial Service - Server Role Implementation. + * + * < If want to modify it, recommend to copy the file to 'user porject'/src > + **************************************************************************************** + */ + +#if (PRF_SESS) + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "prf.h" +#include "prf_sess.h" +#include "atcmd.h" + +#if (DBG_SESS) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// Max length of received once +#if !defined(SES_RXD_MAX_LEN) + #define SES_RXD_MAX_LEN (0x200) +#endif + +/// Max number of notify/indicate pkt +#if !defined(SES_NB_PKT_MAX) + #define SES_NB_PKT_MAX (5) +#endif + +/// Version String for SES_IDX_READ_VAL Read +#define SES_VERS_STR ("Ver:1.25") +#define SES_VERS_STR_LEN (sizeof(SES_VERS_STR) - 1) + +/// Macro for Client Config value operation +#define SES_NTF_CFG_GET(conidx) \ + ((sess_env.ntf_bits >> (conidx*2)) & (PRF_CLI_START_NTF | PRF_CLI_START_IND)) + +#define SES_NTF_CFG_CLR(conidx) \ + sess_env.ntf_bits &= ~((PRF_CLI_START_NTF | PRF_CLI_START_IND) << (conidx*2)) + +#define SES_NTF_CFG_SET(conidx, conf) \ + sess_env.ntf_bits = (sess_env.ntf_bits & ~((PRF_CLI_START_NTF | PRF_CLI_START_IND) << (conidx*2))) | ((conf) << (conidx*2)) + + +/** + **************************************************************************************** + * @section ENVIRONMENT DEFINITION + **************************************************************************************** + */ + +/// Server Environment Variable +typedef struct sess_env_tag +{ + // Service Start Handle + uint16_t start_hdl; + // Client Config of peer devices - each 2Bits(NTF & IND), so max_peer=8. + uint16_t ntf_bits; + // Number of notify pkt + uint8_t nb_pkt; +} sess_env_t; + +/// Global Variable Declarations +sess_env_t sess_env; + + +/** + **************************************************************************************** + * @section ATTRIBUTES DEFINITION + **************************************************************************************** + */ + +/// Attributes Index +enum ses_att_idx +{ + // Service Declaration, *MUST* Start at 0 + SES_IDX_SVC, + + // Serial TXD Char. + SES_IDX_TXD_CHAR, + SES_IDX_TXD_VAL, + SES_IDX_TXD_NTF_CFG, + + // Serial RXD Char. + SES_IDX_RXD_CHAR, + SES_IDX_RXD_VAL, //5 + + #if (SES_READ_SUP) + // Serial READ Char. + SES_IDX_READ_CHAR, + SES_IDX_READ_VAL, + #endif + + // Max Index, *NOTE* Minus 1(Svc Decl) is .nb_att + SES_IDX_NB, +}; + +#if (SES_UUID_128) +/// Characteristic Base UUID128 (User Customize) +#define SES_ATT_UUID128(uuid) { 0x16, 0x0A, 0x10, 0x40, 0xD1, 0x9F, 0x4C, 0x6C, \ + 0xB4, 0x55, 0xE3, 0xF7, (uuid) & 0xFF, (uuid >> 8) & 0xFF, 0x00, 0x00 } + +/// Serial Service UUID128 +const uint8_t ses_svc_uuid[] = SES_ATT_UUID128(0xFF00); +/// Serial Notify UUID128 +const uint8_t ses_char_txd_notify[] = SES_ATT_UUID128(0xFF01); +/// Serial Write Command UUID128 +const uint8_t ses_char_rxd_write[] = SES_ATT_UUID128(0xFF02); +/// Serial Read Command UUID128 +const uint8_t ses_char_val_read[] = SES_ATT_UUID128(0xFF03); + +/// Attributes Description +const att_decl_t ses_atts[] = +{ + // Serial Notify Char. Declaration and Value and Client Char. Configuration Descriptor + ATT_ELMT_DECL_CHAR( SES_IDX_TXD_CHAR ), + ATT_ELMT128( SES_IDX_TXD_VAL, ses_char_txd_notify, PROP_NTF | PROP_IND, 0 ), + ATT_ELMT_DESC_CLI_CHAR_CFG( SES_IDX_TXD_NTF_CFG ), + + // Serial Write Command Char. Declaration and Value + ATT_ELMT_DECL_CHAR( SES_IDX_RXD_CHAR ), + ATT_ELMT128( SES_IDX_RXD_VAL, ses_char_rxd_write, PROP_WC | PROP_WR, SES_RXD_MAX_LEN ), + + #if (SES_READ_SUP) + // Serial Read Command Char. Declaration and Value + ATT_ELMT_DECL_CHAR( SES_IDX_READ_CHAR ), + ATT_ELMT128( SES_IDX_READ_VAL, ses_char_val_read, PROP_RD, 0 ), + #endif //(SES_READ_SUP) +}; + +/// Service Description +const struct svc_decl ses_svc_db = +{ + .uuid128 = ses_svc_uuid, + .info = SVC_UUID(128), + .atts = ses_atts, + .nb_att = SES_IDX_NB - 1, +}; + +#else //(SESS_UUID16) + +/// Serial Service UUID +#define SES_SVC_UUID ATT_UUID16(0xFF00) +/// Serial Notify UUID +#define SES_CHAR_TXD_NOTIFY ATT_UUID16(0xFF01) +/// Serial Write Command UUID +#define SES_CHAR_RXD_WRITE ATT_UUID16(0xFF02) +/// Serial Read Command UUID +#define SES_CHAR_VAL_READ ATT_UUID16(0xFF03) + +/// Attributes Description +att_decl_t ses_atts[] = +{ + // Serial Notify Char. Declaration and Value and CCC Descriptor + ATT_ELMT_DECL_CHAR( SES_IDX_TXD_CHAR ), + ATT_ELMT( SES_IDX_TXD_VAL, SES_CHAR_TXD_NOTIFY, PROP_NTF | PROP_IND, 0 ), + ATT_ELMT_DESC_CLI_CHAR_CFG( SES_IDX_TXD_NTF_CFG ), + + // Serial Write Command Char. Declaration and Value + ATT_ELMT_DECL_CHAR( SES_IDX_RXD_CHAR ), + ATT_ELMT( SES_IDX_RXD_VAL, SES_CHAR_RXD_WRITE, PROP_WC | PROP_WR, SES_RXD_MAX_LEN ), + + #if (SES_READ_SUP) + // Serial Read Command Char. Declaration and Value + ATT_ELMT_DECL_CHAR( SES_IDX_READ_CHAR ), + ATT_ELMT( SES_IDX_READ_VAL, SES_CHAR_VAL_READ, PROP_RD, 0 ), + #endif //(SES_READ_SUP) +}; + +/// Service Description +struct svc_decl ses_svc_db = +{ + .uuid = SES_SVC_UUID, + .info = SVC_UUID(16), + .atts = ses_atts, + .nb_att = SES_IDX_NB - 1, +}; +#endif + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @section SVC FUNCTIONS + **************************************************************************************** + */ + +/// Retrieve attribute handle from index (@see ses_att_idx) +static uint16_t sess_get_att_handle(uint8_t att_idx) +{ + ASSERT_ERR(att_idx < SES_IDX_NB); + + return att_idx + sess_env.start_hdl; +} + +/// Retrieve attribute index form handle +static uint8_t sess_get_att_idx(uint16_t handle) +{ + ASSERT_ERR((handle >= sess_env.start_hdl) && (handle < sess_env.start_hdl + SES_IDX_NB)); + + return handle - sess_env.start_hdl; +} + +/// Handles reception of the atts request from peer device +static void sess_svc_func(uint8_t conidx, uint8_t opcode, uint16_t handle, const void *param) +{ + uint8_t att_idx = sess_get_att_idx(handle); + + DEBUG("svc_func(cid:%d,op:0x%x,hdl:0x%x,att:%d)", conidx, opcode, handle, att_idx); + + switch (opcode) + { + case ATTS_READ_REQ: + { + if (att_idx == SES_IDX_TXD_NTF_CFG) + { + // retrieve notification config + uint16_t cli_cfg = SES_NTF_CFG_GET(conidx); + + DEBUG(" read_cfm(txd_ntf:%d)", cli_cfg); + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint16_t), (uint8_t *)&cli_cfg); + break; + } + + #if (SES_READ_SUP) + if (att_idx == SES_IDX_READ_VAL) + { + sess_cb_rdv(conidx, att_idx, handle); + break; + } + #endif //(SES_READ_SUP) + + // Send error response + gatt_read_cfm(conidx, PRF_ERR_APP_ERROR, handle, 0, NULL); + } break; + + case ATTS_WRITE_REQ: + { + const struct atts_write_ind *ind = param; + + DEBUG(" write_req(hdl:0x%x,att:%d,wr:0x%x,len:%d)", handle, att_idx, ind->wrcode, ind->length); + + if (att_idx == SES_IDX_RXD_VAL) + { + // Send write conform first! + if (!ind->more) gatt_write_cfm(conidx, LE_SUCCESS, handle); + + // Next to process data received + sess_cb_rxd(conidx, ind->length, ind->value); + break; + } + + if (att_idx == SES_IDX_TXD_NTF_CFG) + { + if ((!ind->more) && (ind->length == sizeof(uint16_t))) + { + uint16_t cli_cfg = read16p(ind->value); + + // update configuration if value for stop or NTF/IND start + if (cli_cfg <= PRF_CLI_START_IND) + { + DEBUG(" set txd_ntf(cid:%d,cfg:%d)", conidx, cli_cfg); + + SES_NTF_CFG_SET(conidx, cli_cfg); + // Send write conform quickly! + gatt_write_cfm(conidx, LE_SUCCESS, handle); + + #if (SES_CLI_CFG) + // Next to process cli_cfg changed + sess_cb_ccc(conidx, cli_cfg); + #endif //(SES_CLI_CFG) + break; + } + } + } + + // Send write conform with error! + gatt_write_cfm(conidx, PRF_ERR_APP_ERROR, handle); + } break; + + case ATTS_INFO_REQ: + { + uint8_t status = LE_SUCCESS; + uint16_t length = 0; + + if (att_idx == SES_IDX_RXD_VAL) + { + length = SES_RXD_MAX_LEN; // accepted length + } + else if (att_idx == SES_IDX_TXD_NTF_CFG) + { + length = sizeof(uint16_t); // CCC attribute + } + else + { + status = ATT_ERR_WRITE_NOT_PERMITTED; + } + + // Send length-info confirm for prepWR judging. + DEBUG(" info_cfm(hdl:0x%x,att:%d,sta:0x%X,len:%d)", handle, att_idx, status, length); + gatt_info_cfm(conidx, status, handle, length); + } break; + + case ATTS_CMP_EVT: + { + const struct atts_cmp_evt *evt = param; + + sess_env.nb_pkt++; // release + + DEBUG(" cmp_evt(op:0x%x,sta:0x%x,nb:%d)", evt->operation, evt->status, sess_env.nb_pkt); + // add 'if' to avoid warning #117-D: "evt" never referenced + if (evt->operation == GATT_NOTIFY) + { + // Notify result + } + } break; + + default: + { + // nothing to do + } break; + } +} + + +/** + **************************************************************************************** + * @section API FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Add Serial Service Profile in the DB. + * Customize via pre-define @see SES_START_HDL + * + * @return Result status, LE_SUCCESS or Error Reason + **************************************************************************************** + */ +uint8_t sess_svc_init(void) +{ + uint8_t status = LE_SUCCESS; + + // Init Environment + sess_env.start_hdl = SES_START_HDL; + sess_env.nb_pkt = SES_NB_PKT_MAX; + sess_env.ntf_bits = 0; + + if (sys_config.uuid_len == ATT_UUID128_LEN) + { + ses_svc_db.info = SVC_UUID(128); + + ses_svc_db.uuid128 = (uint8_t *)&sys_config.uuids; + + ses_atts[SES_IDX_TXD_VAL-1].uuid128 = (uint8_t *)&sys_config.uuidn; + ses_atts[SES_IDX_RXD_VAL-1].uuid128 = (uint8_t *)&sys_config.uuidw; + + ses_atts[SES_IDX_TXD_VAL-1].info |= ATT_UUID(128); + ses_atts[SES_IDX_RXD_VAL-1].info |= ATT_UUID(128); + } + else + { + memcpy((uint8_t *)&ses_svc_db.uuid, (uint8_t *)&sys_config.uuids, sys_config.uuid_len); + memcpy((uint8_t *)&ses_atts[SES_IDX_TXD_VAL-1].uuid, (uint8_t *)&sys_config.uuidn, sys_config.uuid_len); + memcpy((uint8_t *)&ses_atts[SES_IDX_RXD_VAL-1].uuid, (uint8_t *)&sys_config.uuidw, sys_config.uuid_len); + } + + // Create Service in database + status = attmdb_svc_create(&sess_env.start_hdl, NULL, &ses_svc_db, sess_svc_func); + + DEBUG("svc_init(sta:0x%X,shdl:%d,nb_pkt:%d,ntf_bits:0x%X)", + status, sess_env.start_hdl, sess_env.nb_pkt, sess_env.ntf_bits); + + return status; +} + +/** + **************************************************************************************** + * @brief Enable setting client configuration characteristics + * + * @param[in] conidx Connection index + * @param[in] cli_cfg Client configuration @see prf_cli_conf + **************************************************************************************** + */ +void sess_set_ccc(uint8_t conidx, uint8_t cli_cfg) +{ + //if (gapc_get_conhdl(conidx) != GAP_INVALID_CONHDL) + { + // update configuration + SES_NTF_CFG_SET(conidx, cli_cfg); + } +} + +/** + **************************************************************************************** + * @brief Transmit data to peer device via NTF or IND + * + * @param[in] conidx peer device connection index + * @param[in] len Length of data + * @param[in] data pointer of buffer + * + * @return Status of the operation @see prf_err + **************************************************************************************** + */ +uint8_t sess_txd_send(uint8_t conidx, uint16_t len, const uint8_t* data) +{ + uint8_t status = PRF_ERR_REQ_DISALLOWED; + + if ((len > 0) && (sess_env.nb_pkt > 0)) + { + uint8_t ntf_cfg = SES_NTF_CFG_GET(conidx); + + if (ntf_cfg != PRF_CLI_STOP_NTFIND) + { + status = LE_SUCCESS; + gatt_ntf_send(conidx, sess_get_att_handle(SES_IDX_TXD_VAL), len, data); + + sess_env.nb_pkt--; // allocate + DEBUG("txd_send(len:%d,nb:%d)", len, sess_env.nb_pkt); + } + else + { + status = PRF_ERR_NTF_DISABLED; + } + } + + return status; +} + +/** + **************************************************************************************** + * @brief Callback on received data from peer device via WC or WQ (__weak func) + * + * @param[in] conidx peer device connection index + * @param[in] len Length of data + * @param[in] data pointer of buffer + **************************************************************************************** + */ +__weak void sess_cb_rxd(uint8_t conidx, uint16_t len, const uint8_t *data) +{ + debugHex(data, len); + + // Loopback to txd, just test. + //sess_txd_send(conidx, len, data); +} + +#if (SES_READ_SUP) +/** + **************************************************************************************** + * @brief Callback to response 'READ' from peer device (__weak func) + * + * @param[in] conidx peer device connection index + * @param[in] attidx SESS attribute index, converted with 'handle' + * @param[in] handle SESS attribute handle to send read cfm + * + * @return Length of value been READ + **************************************************************************************** + */ +__weak void sess_cb_rdv(uint8_t conidx, uint8_t attidx, uint16_t handle) +{ + uint16_t length = SES_VERS_STR_LEN; + const uint8_t *p_data = (const uint8_t *)SES_VERS_STR; + + DEBUG(" read_cfm(att:%d, len:%d)", attidx, length); + gatt_read_cfm(conidx, LE_SUCCESS, handle, length, p_data); +} +#endif //(SES_READ_SUP) + +#if (SES_CLI_CFG) +/** + **************************************************************************************** + * @brief Callback on enabled client config from peer device via WQ (__weak func) + * + * @param[in] conidx Connection index + * @param[in] cli_cfg Client configuration @see prf_cli_conf + **************************************************************************************** + */ +__weak void sess_cb_ccc(uint8_t conidx, uint8_t cli_cfg) +{ + // user override +} +#endif //(SES_CLI_CFG) + + +#endif //PRF_SESS diff --git a/projects/bleUartAT/src/proc.c b/projects/bleUartAT/src/proc.c new file mode 100644 index 0000000..d0ebbc4 --- /dev/null +++ b/projects/bleUartAT/src/proc.c @@ -0,0 +1,97 @@ +/** + **************************************************************************************** + * + * @file proc.c + * + * @brief user procedure. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" + +#include "app.h" +#include "prf_sess.h" +#include "uartRb.h" +#include "atcmd.h" + +#if (DBG_PROC) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +#define CMD_MAX_LEN 64 +#define NULL_CNT 2000 + +static uint8_t buff[CMD_MAX_LEN]; +static uint16_t buff_len = 0; + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +/// Override - Callback on received data from peer device +void sess_cb_rxd(uint8_t conidx, uint16_t len, const uint8_t *data) +{ + uart_send(UART1_PORT, len, data); +} + +/// Uart Data procedure +void user_procedure(void) +{ + static uint16_t null_cnt = 0; + uint16_t len; + bool finish = true; + + len = uart1Rb_Read(&buff[buff_len], CMD_MAX_LEN - buff_len); + if (len > 0) + { + buff_len += len; + + if (buff_len < CMD_MAX_LEN) + { + null_cnt = 0; + return; // wait full + } + } + else + { + if ((buff_len > 0) && (null_cnt++ > NULL_CNT)) + { + finish = true; + null_cnt = 0; + } + else + { + return; // wait again + } + } + + if (app_state_get() == APP_CONNECTED) + { + atBleTx(buff, buff_len); + } + else + { + atProc(buff, buff_len); + } + + + if (finish) + { + buff_len = 0; + } +} diff --git a/projects/bleUartCMD/mdk/JLinkSettings.ini b/projects/bleUartCMD/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/projects/bleUartCMD/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/projects/bleUartCMD/mdk/bleCMD.uvoptx b/projects/bleUartCMD/mdk/bleCMD.uvoptx new file mode 100644 index 0000000..b4ec481 --- /dev/null +++ b/projects/bleUartCMD/mdk/bleCMD.uvoptx @@ -0,0 +1,576 @@ + + + + 1.0 + +
    ### uVision Project, (C) Keil Software
    + + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + bleCMD + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20003000 -FC1000 -FN1 -FF0B6x_256kB_PY_D -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM)) + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC1000 -FN1 -FF0B6x_256kB_PY_D -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 2 + 1 + 0x20003000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\src\myapp.c + myapp.c + 0 + 0 + + + 2 + 5 + 1 + 0 + 0 + 0 + ..\src\proc.c + proc.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 6 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 7 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + modules + 1 + 0 + 0 + 0 + + 4 + 8 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\leds.c + leds.c + 0 + 0 + + + 4 + 9 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\sftmr.c + sftmr.c + 0 + 0 + + + 4 + 10 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\uart1Rb.c + uart1Rb.c + 0 + 0 + + + + + ble\app + 1 + 0 + 0 + 0 + + 5 + 11 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app.c + app.c + 0 + 0 + + + 5 + 12 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_msg.c + app_msg.c + 0 + 0 + + + 5 + 13 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gapm.c + app_gapm.c + 0 + 0 + + + 5 + 14 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gapc.c + app_gapc.c + 0 + 0 + + + 5 + 15 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gatt.c + app_gatt.c + 0 + 0 + + + 5 + 16 + 1 + 0 + 0 + 0 + ..\src\custom\app_actv.c + app_actv.c + 0 + 0 + + + + + ble\prf + 1 + 0 + 0 + 0 + + 6 + 17 + 1 + 0 + 0 + 0 + ..\..\..\ble\prf\prf_diss.c + prf_diss.c + 0 + 0 + + + 6 + 18 + 1 + 0 + 0 + 0 + ..\src\custom\prf_sess.c + prf_sess.c + 0 + 0 + + + + + ble\lib + 1 + 0 + 0 + 0 + + 7 + 19 + 4 + 0 + 0 + 0 + ..\..\..\ble\lib\ble6.lib + ble6.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 8 + 20 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + + + protocol + 1 + 0 + 0 + 0 + + 9 + 21 + 1 + 0 + 0 + 0 + ..\src\protocol\proto.c + proto.c + 0 + 0 + + + 9 + 22 + 1 + 0 + 0 + 0 + ..\src\protocol\proto_rsp.c + proto_rsp.c + 0 + 0 + + + 9 + 23 + 1 + 0 + 0 + 0 + ..\src\protocol\pt_pkt.c + pt_pkt.c + 0 + 0 + + + 9 + 24 + 1 + 0 + 0 + 0 + ..\src\protocol\pt_sch.c + pt_sch.c + 0 + 0 + + + +
    diff --git a/projects/bleUartCMD/mdk/bleCMD.uvprojx b/projects/bleUartCMD/mdk/bleCMD.uvprojx new file mode 100644 index 0000000..92175f5 --- /dev/null +++ b/projects/bleUartCMD/mdk/bleCMD.uvprojx @@ -0,0 +1,555 @@ + + + + 2.1 + +
    ### uVision Project, (C) Keil Software
    + + + + bleCMD + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + bleCMD + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --thumb --gnu --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\src\custom;..\src\protocol;..\..\..\core;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip_ble.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + myapp.c + 1 + ..\src\myapp.c + + + proc.c + 1 + ..\src\proc.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + modules + + + leds.c + 1 + ..\..\..\modules\src\leds.c + + + sftmr.c + 1 + ..\..\..\modules\src\sftmr.c + + + uart1Rb.c + 1 + ..\..\..\modules\src\uart1Rb.c + + + + + ble\app + + + app.c + 1 + ..\..\..\ble\app\app.c + + + app_msg.c + 1 + ..\..\..\ble\app\app_msg.c + + + app_gapm.c + 1 + ..\..\..\ble\app\app_gapm.c + + + app_gapc.c + 1 + ..\..\..\ble\app\app_gapc.c + + + app_gatt.c + 1 + ..\..\..\ble\app\app_gatt.c + + + app_actv.c + 1 + ..\src\custom\app_actv.c + + + + + ble\prf + + + prf_diss.c + 1 + ..\..\..\ble\prf\prf_diss.c + + + prf_sess.c + 1 + ..\src\custom\prf_sess.c + + + + + ble\lib + + + ble6.lib + 4 + ..\..\..\ble\lib\ble6.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + protocol + + + proto.c + 1 + ..\src\protocol\proto.c + + + proto_rsp.c + 1 + ..\src\protocol\proto_rsp.c + + + pt_pkt.c + 1 + ..\src\protocol\pt_pkt.c + + + pt_sch.c + 1 + ..\src\protocol\pt_sch.c + + + + + + + + + + + + + +
    diff --git a/projects/bleUartCMD/mdk/clean.bat b/projects/bleUartCMD/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/projects/bleUartCMD/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/projects/bleUartCMD/src/cfg.h b/projects/bleUartCMD/src/cfg.h new file mode 100644 index 0000000..7869f90 --- /dev/null +++ b/projects/bleUartCMD/src/cfg.h @@ -0,0 +1,67 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// System Clock(0=16MHz, 1=32MHz, 2=48MHz, 3=64MHz) +#define SYS_CLK (0) + +/// Debug Mode(0=Disable, 1=via UART, 2=via RTT) +#define DBG_MODE (1) +#define SFTMR_NUM (8) + +#define PA_UART1_RTS (4) //PA04 +#define PA_UART1_CTS (5) //PA05 +#define PA_UART1_TX (6) //PA06 +#define PA_UART1_RX (7) //PA07 + +#define PA_POWER_ADC (11) //PA11 + +/// BLE Configure (Single or Multi-Connections) +#define BLE_NB_SLAVE (1) +#define BLE_MTU (0xFF) + +#define BLE_ADDR {0x00, 0x09, 0x08, 0x23, 0x20, 0xD2} +#define BLE_DEV_NAME "ble-CMD" +#define BLE_DEV_ICON 0x0000 + +#define APP_ADV_INT_MIN (32) // unit in 0.625ms +#define APP_ADV_INT_MAX (32) // unit in 0.625ms + +/// Profile Configure +#define PRF_DISS (1) +#define PRF_SESS (1) + +/// Serial Service @see prf_sess.h +#define SES_UUID_128 (1) +#define SES_READ_SUP (1) + +/// Debug Configure +#if (DBG_MODE) + #define DBG_APP (0) + #define DBG_PROC (0) + #define DBG_ACTV (0) + #define DBG_GAPM (0) + #define DBG_GAPC (0) + #define DBG_DISS (0) + #define DBG_SESS (0) +#endif + +/// Misc Options +#define LED_PLAY (1) +#define CFG_SLEEP (0) + +#define MDK_HOUR ((__TIME__[0]-'0')*10 + __TIME__[1]-'0') +#define MDK_MIN ((__TIME__[3]-'0')*10 + __TIME__[4]-'0') +//#define FIRM_VERTION ((MDK_HOUR << 8) | MDK_MIN) +#define FIRM_VERTION (0x3816) + +#endif //_APP_CFG_H_ diff --git a/projects/bleUartCMD/src/cmd.h b/projects/bleUartCMD/src/cmd.h new file mode 100644 index 0000000..bf1c7ce --- /dev/null +++ b/projects/bleUartCMD/src/cmd.h @@ -0,0 +1,132 @@ +#ifndef _AT_H_ +#define _AT_H_ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" +#include "gap.h" +#include "app.h" +#include "proto.h" + + + +#define MAX_UUID_LEN 0x10// + +#define ADDR_OFFSET_CFG 0x1000// + +typedef enum +{ + All_FACTORY_REST = 0, //ȫָ + PAIR_FACTORY_RESET = 1, //Ϣָ-൱ϢӻϢ +}PARA_SET_FACTORY; + + +typedef struct +{ + uint8_t dev_pair_mode; + uint8_t auth; + uint8_t pair_len; + uint8_t pair_data[6]; +}pair_info_t; + +typedef struct +{ + uint8_t len; + uint8_t name[24]; +}name_info_t; + +typedef struct +{ + uint8_t lenADV; + uint8_t lenSCAN; + uint8_t adv[31]; + uint8_t scan[31]; +}adv_info_t; + +typedef struct +{ + uint16_t intervalMIN; + uint16_t intervalMAX; + uint16_t latency; + uint16_t timeout; +}conn_info_t; + +typedef struct +{ + uint8_t level; + uint8_t iox; +}gpio_info_t; + +typedef struct +{ + uint8_t iox; + uint8_t level; + uint32_t delay_us; +}wake_info_t; + +enum adv_data_idx +{ + adv_type_idx = 0, + adv_ID_idx = 1, + adv_char_idx = 3, + adv_PIN_idx = 5, + adv_name_idx = 22, +}; + +enum b_tx_power +{ + TX_4DB_P, // 4dBm + TX_0DB_P, // 0dBm + TX_4DB_M, // -4dBm + TX_8DB_M, // -8dBm + TX_20DB_M, // -20dBm +}; + +enum adv_enble +{ + ADV_DISENBLE, // ر(Ĭ) + ADV_ENBLE, // +}; + +typedef union +{ + struct + { + uint8_t BT_DIS : 1; // bit0 3.0 ɷ + uint8_t BT_CONE : 1; // bit1 3.0 + uint8_t BLE_DIS : 1; // bit2 4.0 ɷ + uint8_t RSV_N : 1; // bit3 + uint8_t BT_COND : 1; // bit4 BT3.0 + uint8_t BLE_COND : 1; // bit5 BLE + }; + uint8_t value; +}BLE_STAUTS_TYPEDEF; + +typedef struct +{ + BLE_STAUTS_TYPEDEF stauts; + name_info_t name_info; + adv_info_t adv_info; + + uint8_t tx_power; + + uint32_t baudrate; // + uint16_t vertion; //̼汾 + uint8_t uuid_len; + uint8_t uuids[MAX_UUID_LEN]; + uint8_t uuidn[MAX_UUID_LEN]; + uint8_t uuidw[MAX_UUID_LEN]; + + bd_addr_t addrL; + wake_info_t wake_info; + pair_info_t pair_info; + conn_info_t conn_info; + uint16_t advr; +}SYS_CONFIG; + +extern SYS_CONFIG sysCfg; + +void syscfgInit(void); + +#endif + diff --git a/projects/bleUartCMD/src/custom/app_actv.c b/projects/bleUartCMD/src/custom/app_actv.c new file mode 100644 index 0000000..5995ddd --- /dev/null +++ b/projects/bleUartCMD/src/custom/app_actv.c @@ -0,0 +1,974 @@ +/** + **************************************************************************************** + * + * @file app_actv.c + * + * @brief Application Activity(Advertising, Scanning and Initiating) - Example + * + **************************************************************************************** + */ + +#include "app.h" +#include "gapm_api.h" + +#if (DBG_ACTV) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Index & State of activities - User Customize +struct actv_env_tag +{ + #if (BLE_EN_ADV) + /// Advertising index and state + uint8_t advidx; + uint8_t advsta; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + /// Scanning index and state + uint8_t scanidx; + uint8_t scansta; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + /// Initiating index and state + uint8_t initidx; + uint8_t initsta; + #endif //(BLE_EN_INIT) +}; + +/// Activities environment +struct actv_env_tag actv_env; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @section Advertising Activity - Example for User Customize + * enable via pre-define @see BLE_EN_ADV + **************************************************************************************** + */ +#if (BLE_EN_ADV) + +#undef DEBUG +#if (DBG_ACTV) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// Advertising duration - 0 mean Always ON (in multiple of 10ms) +#if !defined(APP_ADV_DURATION) + #define APP_ADV_DURATION (0) +#endif + +/// Advertising channel map - 37, 38, 39 +#if !defined(APP_ADV_CHMAP) + #define APP_ADV_CHMAP (0x07) +#endif + +/// Advertising minimum interval - (n)*0.625ms +#if !defined(APP_ADV_INT_MIN) + #define APP_ADV_INT_MIN (64) +#endif + +/// Advertising maximum interval - (n)*0.625ms +#if !defined(APP_ADV_INT_MAX) + #define APP_ADV_INT_MAX (160) +#endif + +#if (APP_ADV_INT_MIN > APP_ADV_INT_MAX) + #error "ADV_INT_MIN must not exceed ADV_INT_MAX" +#endif + +/// Fast advertising interval +#define APP_ADV_FAST_INT (32) + +/// Flag of Fixed data +//#define APP_ADV_FIXED_DATA (0) + +#if (APP_ADV_FIXED_DATA) +/** + * ADV Unit: 1B(Len=1+n) 1B(Type) nB(Data), @see gap_ad_type + * -------------------------------------------------------------------------------------- + * x03 - Length + * x03 - Service 16-bit UUIDs List type + * x00\xFF - Custom Serial Profile:0xFF00 + * x03 - Length + * x19 - Appearance type + * x00\x00 - Unknow Device + * x09 - Length + * x09 - Complete Name type + * Ble5.2 - Device Name + * -------------------------------------------------------------------------------------- + */ +#define APP_ADV_DATA "\x03\x03\x00\xFF\x03\x19\x00\x00\x09\x09Ble5.2" +#define APP_ADV_DATA_LEN (sizeof(APP_ADV_DATA)-1) + +/** + * Scan response data (ADV Unit), @see gap_ad_type + * -------------------------------------------------------------------------------------- + * x09 - Length + * xFF - Vendor specific advertising type + * xC5\x09\x48\x59\x2D\x42\x4C\x45 - CompId(0x09C5) + Serial(HY-BLE) + * x09 - Length + * x09 - Complete Name type + * Ble5.2 - Device Name + * -------------------------------------------------------------------------------------- + */ +#define APP_SCNRSP_DATA "\x09\xFF\xC5\x09\x48\x59\x2D\x42\x4C\x45" +#define APP_SCNRSP_DATA_LEN (sizeof(APP_SCNRSP_DATA)-1) +#endif // (APP_ADV_FIXED_DATA) + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +static void app_adv_create(void) +{ + struct gapm_adv_create_param adv_param; + + // Advertising type (@see enum gapm_adv_type) + adv_param.type = GAPM_ADV_TYPE_LEGACY; + // Discovery mode (@see enum gapm_adv_disc_mode) + adv_param.disc_mode = GAPM_ADV_MODE_GEN_DISC; + // Advertising properties (@see enum gapm_adv_prop) + #if (DBG_GAPM) + adv_param.prop = GAPM_ADV_PROP_UNDIR_CONN_MASK | GAPM_ADV_PROP_SCAN_REQ_NTF_EN_BIT; + #else + adv_param.prop = GAPM_ADV_PROP_UNDIR_CONN_MASK; + #endif + // Filtering policy (@see enum gapm_adv_filter_policy) + adv_param.filter_pol = GAPM_ADV_ALLOW_SCAN_ANY_CON_ANY; + // Config primary advertising (@see gapm_adv_prim_cfg) + adv_param.prim_cfg.phy = GAP_PHY_LE_1MBPS; + adv_param.prim_cfg.chnl_map = APP_ADV_CHMAP; + adv_param.prim_cfg.adv_intv_min = APP_ADV_INT_MIN; + adv_param.prim_cfg.adv_intv_max = APP_ADV_INT_MAX; + + DEBUG("create(disc:%d,prop:%d)\r\n", adv_param.disc_mode, adv_param.prop); + + gapm_create_advertising(GAPM_STATIC_ADDR, &adv_param); +} + +#include "cmd.h" + +extern SYS_CONFIG sysCfg; +static void app_adv_set_adv_data(void) +{ +#if (APP_ADV_FIXED_DATA) + gapm_set_adv_data(actv_env.advidx, GAPM_SET_ADV_DATA, + APP_ADV_DATA_LEN, (const uint8_t *)APP_ADV_DATA); +#else + // Reserve 3Bytes for AD_TYPE_FLAGS + uint8_t adv_data[GAP_ADV_DATA_LEN]; + uint8_t length = 11; + + if (sysCfg.adv_info.lenADV == 0) + { + // Set flags: 3B + adv_data[0] = 0x02; + adv_data[1] = GAP_AD_TYPE_FLAGS; // 0x01 0xFF;// + adv_data[2] = 0x06; + + // Set list of UUIDs: 4B + adv_data[3] = 0x03; + adv_data[4] = GAP_AD_TYPE_COMPLETE_LIST_16_BIT_UUID; // 0x03 + #if (PRF_HIDS) + write16p(&adv_data[5], 0x1812); // HID Service + #else + write16p(&adv_data[5], 0xFF00); // Serial Service + #endif + + // Set appearance: 4B + uint16_t icon = app_icon_get(); + adv_data[7] = 0x03; + adv_data[8] = GAP_AD_TYPE_APPEARANCE; // 0x19 + write16p(&adv_data[9], icon); + } + else + { + length = sysCfg.adv_info.lenADV; + + memcpy(adv_data, sysCfg.adv_info.adv,length); + } + + gapm_set_adv_data(actv_env.advidx, GAPM_SET_ADV_DATA, length, adv_data); +#endif +} + +static void app_adv_set_scan_rsp(void) +{ +#if (APP_ADV_FIXED_DATA) + gapm_set_adv_data(actv_env.advidx, GAPM_SET_SCAN_RSP_DATA, + APP_SCNRSP_DATA_LEN, (const uint8_t *)APP_SCNRSP_DATA); +#else + uint8_t length; + uint8_t rsp_data[DEV_NAME_MAX_LEN+2]; + + if (sysCfg.adv_info.lenSCAN == 0) + { + // Set device name + length = app_name_get(DEV_NAME_MAX_LEN, &rsp_data[2]); + rsp_data[0] = length + 1; + rsp_data[1] = GAP_AD_TYPE_COMPLETE_NAME; // 0x09 + + length += 2; + } + else + { + length = sysCfg.adv_info.lenSCAN; + + memcpy(rsp_data, sysCfg.adv_info.scan,length); + } + + gapm_set_adv_data(actv_env.advidx, GAPM_SET_SCAN_RSP_DATA, length, rsp_data); +#endif +} + +/** + **************************************************************************************** + * @brief Action/Command of Advertising + * + * @param[in] actv_op Operation of activity + **************************************************************************************** + */ +void app_adv_action(uint8_t actv_op) +{ + switch (actv_op) + { + case ACTV_CREATE: + { + if (actv_env.advsta == ACTV_STATE_OFF) + { + //DEBUG("Creating"); + app_adv_create(); + actv_env.advsta = ACTV_STATE_CREATE; + } + } break; + + case ACTV_START: + { + if (actv_env.advsta == ACTV_STATE_READY) + { + DEBUG("Starting"); + gapm_start_advertising(actv_env.advidx, APP_ADV_DURATION); + actv_env.advsta = ACTV_STATE_START; + } + } break; + + case ACTV_STOP: + { + if (actv_env.advsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_STOP; + } + } break; + + case ACTV_DELETE: + { + if ((actv_env.advsta != ACTV_STATE_OFF) && (actv_env.advsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_OFF; + } + } break; + + case ACTV_RELOAD: + { + if (actv_env.advsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_STOP; + } + + if ((actv_env.advsta != ACTV_STATE_OFF) && (actv_env.advsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_OFF; + } + + app_adv_create(); + actv_env.advsta = ACTV_STATE_CREATE; + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Event Procedure of Advertising + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_adv_event(uint8_t gapm_op, uint8_t status) +{ + DEBUG("Evt(op:0x%X,sta:0x%X)", gapm_op, status); + + switch (gapm_op) + { + case (GAPM_CREATE_ADV_ACTIVITY): + { + app_adv_set_adv_data(); + } break; + + case (GAPM_SET_ADV_DATA): + { + app_adv_set_scan_rsp(); + } break; + + case (GAPM_SET_SCAN_RSP_DATA): + { + actv_env.advsta = ACTV_STATE_READY; + + app_adv_action(ACTV_START); + app_state_set(APP_READY); + } break; + + case (GAPM_STOP_ACTIVITY): + { + if ((actv_env.advsta == ACTV_STATE_START) || (actv_env.advsta == ACTV_STATE_STOP)) + { + actv_env.advsta = ACTV_STATE_READY; + } + } break; + + default: + break; + } +} + +#endif //(BLE_EN_ADV) + + +/** + **************************************************************************************** + * @section Scanning Activity - Example for User Customize + * enable via pre-define @see BLE_EN_SCAN + **************************************************************************************** + */ +#if (BLE_EN_SCAN) + +#undef DEBUG +#if (DBG_ACTV) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +#define SCAN_NUM_MAX (5) + +uint8_t scan_cnt = 0; +struct gap_bdaddr scan_addr_list[SCAN_NUM_MAX]; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +static void app_start_scanning(void) +{ + struct gapm_scan_param scan_param; + + /// Type of scanning to be started (@see enum gapm_scan_type) + scan_param.type = GAPM_SCAN_TYPE_CONN_DISC; + /// Properties for the scan procedure (@see enum gapm_scan_prop) + scan_param.prop = GAPM_SCAN_PROP_PHY_1M_BIT | GAPM_SCAN_PROP_ACTIVE_1M_BIT | GAPM_SCAN_PROP_FILT_TRUNC_BIT; + /// Duplicate packet filtering policy (@see enum gapm_dup_filter_pol) + scan_param.dup_filt_pol = GAPM_DUP_FILT_EN; + /// Scan window opening parameters for LE 1M PHY (in unit of 625us) + scan_param.scan_param_1m.scan_intv = GAP_SCAN_FAST_INTV; + scan_param.scan_param_1m.scan_wd = GAP_SCAN_FAST_WIND; + /// Scan window opening parameters for LE Coded PHY + //scan_param.scan_param_coded.scan_intv = GAP_SCAN_SLOW_INTV1; + //scan_param.scan_param_coded.scan_wd = GAP_SCAN_SLOW_WIND1; + /// Scan duration (in unit of 10ms). 0 means that the controller will scan continuously until + /// reception of a stop command from the application + scan_param.duration = 500;//GAP_TMR_GEN_DISC_SCAN; + /// Scan period (in unit of 1.28s). Time interval betweem two consequent starts of a scan duration + /// by the controller. 0 means that the scan procedure is not periodic + scan_param.period = 0; + + gapm_start_activity(actv_env.scanidx, sizeof(struct gapm_scan_param), &scan_param); +} + +/** + **************************************************************************************** + * @brief Action/Command of Scanning + * + * @param[in] actv_op Operation of activity + **************************************************************************************** + */ +void app_scan_action(uint8_t actv_op) +{ + switch (actv_op) + { + case ACTV_CREATE: + { + if (actv_env.scansta == ACTV_STATE_OFF) + { + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_SCAN, GAPM_STATIC_ADDR); + actv_env.scansta = ACTV_STATE_CREATE; + } + } break; + + case ACTV_START: + { + scan_cnt = 0; + + if (actv_env.scansta == ACTV_STATE_READY) + { + DEBUG("Starting"); + app_start_scanning(); + actv_env.scansta = ACTV_STATE_START; + } + } break; + + case ACTV_STOP: + { + if (actv_env.scansta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_STOP; + } + } break; + + case ACTV_DELETE: + { + if ((actv_env.scansta != ACTV_STATE_OFF) && (actv_env.scansta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_OFF; + } + } break; + + case ACTV_RELOAD: + { + if (actv_env.scansta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_STOP; + } + + if ((actv_env.scansta != ACTV_STATE_OFF) && (actv_env.scansta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_OFF; + } + + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_SCAN, GAPM_STATIC_ADDR); + actv_env.scansta = ACTV_STATE_CREATE; + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Event Procedure of Scanning + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_scan_event(uint8_t gapm_op, uint8_t status) +{ + DEBUG("Evt(op:0x%X,sta:0x%X)", gapm_op, status); + + switch (gapm_op) + { + case GAPM_CREATE_SCAN_ACTIVITY: + { + actv_env.scansta = ACTV_STATE_READY; + } break; + + case GAPM_STOP_ACTIVITY: + { + if ((actv_env.scansta == ACTV_STATE_START) || (actv_env.scansta == ACTV_STATE_STOP)) + { + actv_env.scansta = ACTV_STATE_READY; + } + + DEBUG("-->Filter DevAddr"); + for (uint8_t idx = 0; idx < scan_cnt; idx++) + { + DEBUG("Scan List[%d]-->", idx); + debugHex((uint8_t *)(&scan_addr_list[idx]), sizeof(struct gap_bdaddr)); + } + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Store result of Scanning when filter by app_actv_report_ind + * + * @param[in] paddr gap_bdaddr of peer device + **************************************************************************************** + */ +void app_scan_result(const struct gap_bdaddr* paddr) +{ + for (uint8_t i = 0; i < scan_cnt; i++) + { + if (!memcmp(&scan_addr_list[i], paddr,sizeof(struct gap_bdaddr)))//save addr but diffrent + { + return; + } + } + + if (scan_cnt < SCAN_NUM_MAX) //get null array + { + memcpy(&scan_addr_list[scan_cnt], paddr,sizeof(struct gap_bdaddr)); + scan_cnt++; + } +} + +/** + **************************************************************************************** + * @brief Handles activity report. (@see GAPM_EXT_ADV_REPORT_IND) + * + * @param[in] report Report of Advertising data be scanned + **************************************************************************************** + */ +void app_actv_report_ind(struct gapm_ext_adv_report_ind const* report) +{ + // filter report + if ((report->info & GAPM_REPORT_INFO_REPORT_TYPE_MASK) == GAPM_REPORT_TYPE_ADV_LEG) + { + const uint8_t *p_cursor = report->data; + const uint8_t *p_end_cusor = report->data + report->length; + + while (p_cursor < p_end_cusor) + { + // Extract AD type + uint8_t ad_type = *(p_cursor + 1); + + if (ad_type == GAP_AD_TYPE_APPEARANCE) + { + uint16_t icon = read16p(p_cursor+2); + + // Filter special appearance device + if ((icon == 0x03C1) || (icon == 0x03C5)) // HID Gamepad + { + app_scan_result(&report->trans_addr); + break; + } + } + else if ((ad_type == GAP_AD_TYPE_COMPLETE_LIST_16_BIT_UUID) || (ad_type == GAP_AD_TYPE_MORE_16_BIT_UUID)) + { + uint16_t uuid = read16p(p_cursor+2); + + // Filter special uuid device + if (((uuid == 0x18F0) || (uuid == 0xFF00)))// && (param->trans_addr.addr.addr[0] == 0x04)) + { + app_scan_result(&report->trans_addr); + break; + } + } + else + { + // Filter Rule more... + } + + /* Go to next advertising info */ + p_cursor += (*p_cursor + 1); + } + } +} +#endif //(BLE_EN_SCAN) + + +/** + **************************************************************************************** + * @section Initiating Activity - Example for User Customize + * enable via pre-define @see BLE_EN_INIT + **************************************************************************************** + */ +#if (BLE_EN_INIT) + +#undef DEBUG +#if (DBG_ACTV) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +const struct gap_bdaddr dflt_peer = +{ + .addr = {{0x11, 0x22, 0x33, 0xa1, 0x01, 0xd3}}, + .addr_type = ADDR_RAND, +}; + +const struct gapm_conn_param dflt_conn_param = +{ + /// Minimum value for the connection interval (in unit of 1.25ms). Allowed range is 7.5ms to 4s. + .conn_intv_min = 10, + /// Maximum value for the connection interval (in unit of 1.25ms). Allowed range is 7.5ms to 4s. + .conn_intv_max = 10, + /// Slave latency. Number of events that can be missed by a connected slave device + .conn_latency = 0, + /// Link supervision timeout (in unit of 10ms). Allowed range is 100ms to 32s + .supervision_to = 300, + /// Recommended minimum duration of connection events (in unit of 625us) + .ce_len_min = 2, + /// Recommended maximum duration of connection events (in unit of 625us) + .ce_len_max = 4, +}; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Start initiating to peer device + * + * @param[in] paddr gap_bdaddr of peer device + **************************************************************************************** + */ +void app_start_initiating(const struct gap_bdaddr* paddr) +{ + if ((actv_env.initsta == ACTV_STATE_READY) || (actv_env.initsta == ACTV_STATE_STOP)) + { + struct gapm_init_param init_param; + + if (paddr == NULL) + { + paddr = &dflt_peer; + } + + init_param.type = GAPM_INIT_TYPE_DIRECT_CONN_EST; + init_param.prop = GAPM_INIT_PROP_1M_BIT; + init_param.scan_param_1m.scan_intv = GAP_SCAN_FAST_INTV; + init_param.scan_param_1m.scan_wd = GAP_SCAN_FAST_WIND; + + init_param.conn_param_1m = dflt_conn_param; + init_param.peer_addr = *paddr; + + gapm_start_activity(actv_env.initidx, sizeof(struct gapm_init_param), &init_param); + + DEBUG("Starting"); + actv_env.initsta = ACTV_STATE_START; + } +} + +/** + **************************************************************************************** + * @brief Action/Command of Initiating + * + * @param[in] actv_op Operation of activity + **************************************************************************************** + */ +void app_init_action(uint8_t actv_op) +{ + switch (actv_op) + { + case ACTV_CREATE: + { + if (actv_env.initsta == ACTV_STATE_OFF) + { + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_INIT, GAPM_STATIC_ADDR); + actv_env.initsta = ACTV_STATE_CREATE; + } + } break; + + case ACTV_START: + { + app_start_initiating(NULL); + } break; + + case ACTV_STOP: + { + if (actv_env.initsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_STOP; + } + } break; + + case ACTV_DELETE: + { + if ((actv_env.initsta != ACTV_STATE_OFF) && (actv_env.initsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_OFF; + } + } break; + + case ACTV_RELOAD: + { + if (actv_env.initsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_STOP; + } + + if ((actv_env.initsta != ACTV_STATE_OFF) && (actv_env.initsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_OFF; + } + + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_INIT, GAPM_STATIC_ADDR); + actv_env.initsta = ACTV_STATE_CREATE; + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Event Procedure of Initiating + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_init_event(uint8_t gapm_op, uint8_t status) +{ + DEBUG("Evt(op:0x%X,sta:0x%X)", gapm_op, status); + + switch (gapm_op) + { + case GAPM_CREATE_INIT_ACTIVITY: + { + actv_env.initsta = ACTV_STATE_READY; + } break; + + case GAPM_STOP_ACTIVITY: + { + if ((actv_env.initsta == ACTV_STATE_START) || (actv_env.initsta == ACTV_STATE_STOP)) + { + actv_env.initsta = ACTV_STATE_READY; + } + } break; + + default: + break; + } +} + +#endif //(BLE_EN_INIT) + + +/** + **************************************************************************************** + * @brief Create activities when Initialization complete. + **************************************************************************************** + */ +void app_actv_create(void) +{ + memset(&actv_env, 0, sizeof(actv_env)); + #if (BLE_EN_ADV) + app_adv_action(ACTV_CREATE); + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + app_scan_action(ACTV_CREATE); + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + app_init_action(ACTV_CREATE); + #endif //(BLE_EN_INIT) +} + +/** + **************************************************************************************** + * @brief Handles activity command complete event. + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_actv_cmp_evt(uint8_t operation, uint8_t status) +{ + switch (operation) + { + #if (BLE_EN_ADV) + case (GAPM_CREATE_ADV_ACTIVITY): + case (GAPM_SET_ADV_DATA): + case (GAPM_SET_SCAN_RSP_DATA): + { + app_adv_event(operation, status); + } break; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + case GAPM_CREATE_SCAN_ACTIVITY: + { + app_scan_event(operation, status); + } break; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + case GAPM_CREATE_INIT_ACTIVITY: + { + app_init_event(operation, status); + } break; + #endif //(BLE_EN_INIT) + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Handles activity created. (@see GAPM_ACTIVITY_CREATED_IND) + * + * @param[in] actv_type Type of activities(@see enum gapm_actv_type) + * @param[in] actv_idx Index of activities created + **************************************************************************************** + */ +void app_actv_created_ind(uint8_t actv_type, uint8_t actv_idx) +{ + switch (actv_type) + { + #if (BLE_EN_ADV) + case GAPM_ACTV_TYPE_ADV: + { + actv_env.advidx = actv_idx; + } break; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + case GAPM_ACTV_TYPE_SCAN: + { + actv_env.scanidx = actv_idx; + } break; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + case GAPM_ACTV_TYPE_INIT: + { + actv_env.initidx = actv_idx; + } break; + #endif //(BLE_EN_INIT) + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Handles activity stopped. (@see GAPM_ACTIVITY_STOPPED_IND) + * + * @param[in] actv_type Type of activity(@see enum gapm_actv_type) + * @param[in] reason Reason of stopped + **************************************************************************************** + */ +void app_actv_stopped_ind(uint8_t actv_type, uint8_t actv_idx, uint8_t reason) +{ + switch (actv_type) + { + #if (BLE_EN_ADV) + case GAPM_ACTV_TYPE_ADV: + { + // Advertising Stopped by slave connection or duration timeout + app_adv_event(GAPM_STOP_ACTIVITY, reason); + + if (app_state_get() == APP_READY) + { + // Duration timeout, go IDLE + app_state_set(APP_IDLE); + } + #if (BLE_MULTI_CONN) + else if (app_state_get() == APP_CONNECTED) + { + if (ONE_BITS(app_env.conrole) < BLE_NB_SLAVE) + { + // Restart Advertising for more connections + app_adv_action(ACTV_START); + } + } + #endif //(BLE_MULTI_CONN) + } break; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + case GAPM_ACTV_TYPE_SCAN: + { + app_scan_event(GAPM_STOP_ACTIVITY, reason); + } break; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + case GAPM_ACTV_TYPE_INIT: + { + app_init_event(GAPM_STOP_ACTIVITY, reason); + } break; + #endif //(BLE_EN_INIT) + + default: + break; + } +} diff --git a/projects/bleUartCMD/src/custom/prf_sess.c b/projects/bleUartCMD/src/custom/prf_sess.c new file mode 100644 index 0000000..d615c5d --- /dev/null +++ b/projects/bleUartCMD/src/custom/prf_sess.c @@ -0,0 +1,662 @@ +/** + **************************************************************************************** + * + * @file prf_sess.c + * + * @brief Serial Service - Server Role Implementation. + * + * < If want to modify it, recommend to copy the file to 'user porject'/src > + **************************************************************************************** + */ + +#if (PRF_SESS) + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "prf.h" +#include "prf_sess.h" + +#if (DBG_SESS) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// Max length of received once +#if !defined(SES_RXD_MAX_LEN) + #define SES_RXD_MAX_LEN (0x40) +#endif + +/// Max number of notify/indicate pkt +#if !defined(SES_NB_PKT_MAX) + #define SES_NB_PKT_MAX (5) +#endif + + +/// Version String for SES_IDX_READ_VAL Read +#define SES_VERS_STR ("Ver:1.25") +#define SES_VERS_STR_LEN (sizeof(SES_VERS_STR) - 1) + +/// Macro for Client Config value operation +#define SES_NTF_CFG_GET(ssidx,conidx) \ + ((sess_env[ssidx].ntf_bits >> (conidx*2)) & (PRF_CLI_START_NTF | PRF_CLI_START_IND)) + +#define SES_NTF_CFG_CLR(ssidx,conidx) \ + sess_env[ssidx].ntf_bits &= ~((PRF_CLI_START_NTF | PRF_CLI_START_IND) << (conidx*2)) + +#define SES_NTF_CFG_SET(ssidx,conidx, conf) \ + sess_env[ssidx].ntf_bits = (sess_env[ssidx].ntf_bits & ~((PRF_CLI_START_NTF | PRF_CLI_START_IND) << (conidx*2))) | ((conf) << (conidx*2)) + +#define SESS_ENV_MAX (4) +#define SES_ATT_IDX_MAX (SESS_ENV_MAX*16) + +uint8_t SES_ATT_IDX[SES_ATT_IDX_MAX] = +{ + SES_IDX_SVC, + + SES_IDX_TXD_CHAR, + SES_IDX_TXD_VAL, + SES_IDX_TXD_NTF_CFG, + + SES_IDX_RXD_CHAR, + SES_IDX_RXD_VAL, + + SES_IDX_READ_CHAR, + SES_IDX_READ_VAL, +}; + + +READ_INFO_T ses_read_info[SESS_ENV_MAX*2] = +{ + { + .length = SES_VERS_STR_LEN, + .data = SES_VERS_STR, + }, + +}; +/** + **************************************************************************************** + * @section ENVIRONMENT DEFINITION + **************************************************************************************** + */ + +/// Global Variable Declarations +sess_env_t sess_env[SESS_ENV_MAX+1]; + + +/** + **************************************************************************************** + * @section ATTRIBUTES DEFINITION + **************************************************************************************** + */ + +#if (SES_UUID_128) +/// Characteristic Base UUID128 (User Customize) +#define SES_ATT_UUID128(uuid) { 0x16, 0x0A, 0x10, 0x40, 0xD1, 0x9F, 0x4C, 0x6C, \ + 0xB4, 0x55, 0xE3, 0xF7, (uuid) & 0xFF, (uuid >> 8) & 0xFF, 0x00, 0x00 } + + +UUID_INFO_T sess_uuid[SESS_ENV_MAX*4] = +{ + SES_ATT_UUID128(0xFF00),// Serial Service UUID128 + SES_ATT_UUID128(0xFF01),// Serial Notify UUID128 + SES_ATT_UUID128(0xFF02),// Serial Write Command UUID128 + SES_ATT_UUID128(0xFF03),// Serial Read Command UUID128 + + SES_ATT_UUID128(0x0000), + SES_ATT_UUID128(0x0000), + SES_ATT_UUID128(0x0000), + SES_ATT_UUID128(0x0000), + SES_ATT_UUID128(0x0000), + SES_ATT_UUID128(0x0000), + SES_ATT_UUID128(0x0000), + SES_ATT_UUID128(0x0000), + SES_ATT_UUID128(0x0000), + SES_ATT_UUID128(0x0000), + SES_ATT_UUID128(0x0000), + SES_ATT_UUID128(0x0000), +}; + + +/// Attributes Description +att_decl_t ses_atts[SES_ATT_IDX_MAX] = +{ +// // Serial Notify Char. Declaration and Value and Client Char. Configuration Descriptor +// ATT_ELMT_DECL_CHAR( SES_IDX_TXD_CHAR ), +// ATT_ELMT128( SES_IDX_TXD_VAL, ses_char_txd_notify, PROP_NTF | PROP_IND, 0 ), +// ATT_ELMT_DESC_CLI_CHAR_CFG( SES_IDX_TXD_NTF_CFG ), + +// // Serial Write Command Char. Declaration and Value +// ATT_ELMT_DECL_CHAR( SES_IDX_RXD_CHAR ), +// ATT_ELMT128( SES_IDX_RXD_VAL, ses_char_rxd_write, PROP_WC | PROP_WR, SES_RXD_MAX_LEN ), +// +// #if (SES_READ_SUP) +// // Serial Read Command Char. Declaration and Value +// ATT_ELMT_DECL_CHAR( SES_IDX_READ_CHAR ), +// ATT_ELMT128( SES_IDX_READ_VAL, ses_char_val_read, PROP_RD, 0 ), +// #endif //(SES_READ_SUP) +}; + +uint16_t ses_atts_perm[SESS_ENV_MAX*4] = +{ + (PROP_NTF | PROP_IND), + (PROP_WC | PROP_WR), + (PROP_RD), + +}; + +/// Service Description +struct svc_decl ses_svc_db[SESS_ENV_MAX] = +{ + { + .uuid128 = sess_uuid[0].uuid, + .info = SVC_UUID(128), + .atts = ses_atts, + .nb_att = 0, + } + +}; + +#else //(SESS_UUID16) + +/// Serial Service UUID +#define SES_SVC_UUID ATT_UUID16(0xFF00) +/// Serial Notify UUID +#define SES_CHAR_TXD_NOTIFY ATT_UUID16(0xFF01) +/// Serial Write Command UUID +#define SES_CHAR_RXD_WRITE ATT_UUID16(0xFF02) +/// Serial Read Command UUID +#define SES_CHAR_VAL_READ ATT_UUID16(0xFF03) + +/// Attributes Description +const att_decl_t ses_atts[] = +{ + // Serial Notify Char. Declaration and Value and CCC Descriptor + ATT_ELMT_DECL_CHAR( SES_IDX_TXD_CHAR ), + ATT_ELMT( SES_IDX_TXD_VAL, SES_CHAR_TXD_NOTIFY, PROP_NTF | PROP_IND, 0 ), + ATT_ELMT_DESC_CLI_CHAR_CFG( SES_IDX_TXD_NTF_CFG ), + + // Serial Write Command Char. Declaration and Value + ATT_ELMT_DECL_CHAR( SES_IDX_RXD_CHAR ), + ATT_ELMT( SES_IDX_RXD_VAL, SES_CHAR_RXD_WRITE, PROP_WC | PROP_WR, SES_RXD_MAX_LEN ), + + #if (SES_READ_SUP) + // Serial Read Command Char. Declaration and Value + ATT_ELMT_DECL_CHAR( SES_IDX_READ_CHAR ), + ATT_ELMT( SES_IDX_READ_VAL, SES_CHAR_VAL_READ, PROP_RD, 0 ), + #endif //(SES_READ_SUP) +}; + +/// Service Description +const struct svc_decl ses_svc_db = +{ + .uuid = SES_SVC_UUID, + .info = SVC_UUID(16), + .atts = ses_atts, + .nb_att = SES_IDX_NB - 1, +}; +#endif + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @section SVC FUNCTIONS + **************************************************************************************** + */ + +/// Retrieve attribute handle from index (@see ses_att_idx) +static uint16_t sess_get_att_handle(uint8_t att_idx) +{ + ASSERT_ERR(att_idx < sess_inx_nmb); + + uint8_t nb_att = 0; + + for (uint8_t ssidx = 0; ssidx < SESS_ENV_MAX; ssidx++) + { + nb_att += ses_svc_db[ssidx].nb_att + 1; + + if (att_idx < nb_att) + return att_idx + sess_env[ssidx].start_hdl; + } + + return 0; +} + +/// Retrieve attribute index form handle +static uint16_t sess_get_att_idx(uint16_t handle) +{ + ASSERT_ERR((handle >= sess_env[0].start_hdl) && (handle < sess_env[SESS_ENV_MAX+1].start_hdl)); + + for (uint8_t ssidx = 0; ssidx < SESS_ENV_MAX; ssidx++) + { + if (handle < (sess_env[ssidx].start_hdl + ses_svc_db[ssidx].nb_att + 1)) + return ((handle - sess_env[0].start_hdl) | (ssidx << 8)); + } + + return 0; +} + +extern void sess_cb_rxd1(uint16_t handle, uint16_t len, const uint8_t *data); + +/// Handles reception of the atts request from peer device +static void sess_svc_func(uint8_t conidx, uint8_t opcode, uint16_t handle, const void *param) +{ + uint16_t val_idx = sess_get_att_idx(handle); + uint8_t att_idx = val_idx & 0xFF; + uint8_t ssidx = (val_idx >> 8); + + DEBUG("svc_func(cid:%d,op:0x%x,hdl:0x%x,att:%d,ssidx:%d)", conidx, opcode, handle, att_idx, ssidx); + + switch (opcode) + { + case ATTS_READ_REQ: + { + if (SES_ATT_IDX[att_idx] == SES_IDX_TXD_NTF_CFG) + { + // retrieve notification config + uint16_t cli_cfg = SES_NTF_CFG_GET(ssidx, conidx); + + DEBUG(" read_cfm(txd_ntf:%d)", cli_cfg); + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint16_t), (uint8_t *)&cli_cfg); + break; + } + + #if (SES_READ_SUP) + if (SES_ATT_IDX[att_idx] == SES_IDX_READ_VAL) + { + sess_cb_rdv(conidx, att_idx, handle); + break; + } + #endif //(SES_READ_SUP) + + // Send error response + gatt_read_cfm(conidx, PRF_ERR_APP_ERROR, handle, 0, NULL); + } break; + + case ATTS_WRITE_REQ: + { + const struct atts_write_ind *ind = param; + + DEBUG(" write_req(hdl:0x%x,att:%d,wr:0x%x,len:%d)", handle, att_idx, ind->wrcode, ind->length); + + if (SES_ATT_IDX[att_idx] == SES_IDX_RXD_VAL) + { + // Send write conform first! + if (!ind->more) gatt_write_cfm(conidx, LE_SUCCESS, handle); + + // Next to process data received + sess_cb_rxd1(handle, ind->length, ind->value); + break; + } + + if (SES_ATT_IDX[att_idx] == SES_IDX_TXD_NTF_CFG) + { + if ((!ind->more) && (ind->length == sizeof(uint16_t))) + { + uint16_t cli_cfg = read16p(ind->value); + + // update configuration if value for stop or NTF/IND start + if (cli_cfg <= PRF_CLI_START_IND) + { + DEBUG(" set txd_ntf(cid:%d,cfg:%d)", conidx, cli_cfg); + + SES_NTF_CFG_SET(ssidx, conidx, cli_cfg); + // Send write conform quickly! + gatt_write_cfm(conidx, LE_SUCCESS, handle); + + #if (SES_CLI_CFG) + // Next to process cli_cfg changed + sess_cb_ccc(conidx, cli_cfg); + #endif //(SES_CLI_CFG) + break; + } + } + } + + // Send write conform with error! + gatt_write_cfm(conidx, PRF_ERR_APP_ERROR, handle); + } break; + + case ATTS_INFO_REQ: + { + uint8_t status = LE_SUCCESS; + uint16_t length = 0; + + if (SES_ATT_IDX[att_idx] == SES_IDX_RXD_VAL) + { + length = SES_RXD_MAX_LEN; // accepted length + } + else if (SES_ATT_IDX[att_idx] == SES_IDX_TXD_NTF_CFG) + { + length = sizeof(uint16_t); // CCC attribute + } + else + { + status = ATT_ERR_WRITE_NOT_PERMITTED; + } + + // Send length-info confirm for prepWR judging. + DEBUG(" info_cfm(hdl:0x%x,att:%d,sta:0x%X,len:%d)", handle, att_idx, status, length); + gatt_info_cfm(conidx, status, handle, length); + } break; + + case ATTS_CMP_EVT: + { + const struct atts_cmp_evt *evt = param; + + sess_env[ssidx].nb_pkt++; // release + + DEBUG(" cmp_evt(op:0x%x,sta:0x%x,nb:%d)", evt->operation, evt->status, sess_env[ssidx].nb_pkt); + // add 'if' to avoid warning #117-D: "evt" never referenced + if (evt->operation == GATT_NOTIFY) + { + // Notify result + } + } break; + + default: + { + // nothing to do + } break; + } +} + + +/** + **************************************************************************************** + * @section API FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Add Serial Service Profile in the DB. + * Customize via pre-define @see SES_START_HDL + * + * @return Result status, LE_SUCCESS or Error Reason + **************************************************************************************** + */ +#include "proto.h" + +static bool upHandle = true; + +uint8_t sess_inx_nmb = 8; +uint8_t sess_uuid_nmb = 4; +uint8_t sess_read_nmb = 1; +uint8_t ses_perm_nmb = 3; + +uint8_t sess_svc_init(void) +{ + uint8_t status = LE_SUCCESS; + uint8_t ss_cnt = 0; + uint8_t at_cnt = 0; + uint8_t id_cnt = 0; + uint8_t as_cnt = 0; + uint8_t pm_cnt = 0; + + if (upHandle) + { + memset(&SES_ATT_IDX[sess_inx_nmb], 0xFF, sizeof(SES_ATT_IDX) - sess_inx_nmb); + } + + for (uint8_t atidx = 0; atidx < sess_inx_nmb; atidx++) + { + if (SES_ATT_IDX[atidx] == SES_IDX_SVC) + { + if (ss_cnt) + as_cnt += ses_svc_db[ss_cnt - 1].nb_att; + + ses_svc_db[ss_cnt].uuid128 = sess_uuid[id_cnt++].uuid; + ses_svc_db[ss_cnt].info = SVC_UUID(128), + ses_svc_db[ss_cnt].atts = &ses_atts[as_cnt], + ses_svc_db[ss_cnt].nb_att = 0; + + ss_cnt++; + } + else if (SES_ATT_IDX[atidx] == SES_IDX_TXD_CHAR) + { + ses_atts[at_cnt].uuid = ATT_DECL_CHARACTERISTIC; + ses_atts[at_cnt].perm = PROP_RD; + ses_atts[at_cnt++].info = 0; + + ses_atts[at_cnt].uuid128 = sess_uuid[id_cnt++].uuid; + ses_atts[at_cnt].perm = ses_atts_perm[pm_cnt++]; + ses_atts[at_cnt++].info = (ATT_UUID(128) | (0)); + + ses_atts[at_cnt].uuid = ATT_DESC_CLIENT_CHAR_CFG; + ses_atts[at_cnt].perm = (PROP_RD | PROP_WR); + ses_atts[at_cnt++].info = sizeof(uint16_t); + + ses_svc_db[ss_cnt - 1].nb_att += 3; + } + else if (SES_ATT_IDX[atidx] == SES_IDX_RXD_CHAR) + { + ses_atts[at_cnt].uuid = ATT_DECL_CHARACTERISTIC; + ses_atts[at_cnt].perm = PROP_RD; + ses_atts[at_cnt++].info = 0; + + ses_atts[at_cnt].uuid128 = sess_uuid[id_cnt++].uuid; + ses_atts[at_cnt].perm = ses_atts_perm[pm_cnt++]; + ses_atts[at_cnt++].info = (ATT_UUID(128) | (SES_RXD_MAX_LEN)); + + ses_svc_db[ss_cnt - 1].nb_att += 2; + } + else if (SES_ATT_IDX[atidx] == SES_IDX_READ_CHAR) + { + ses_atts[at_cnt].uuid = ATT_DECL_CHARACTERISTIC; + ses_atts[at_cnt].perm = PROP_RD; + ses_atts[at_cnt++].info = 0; + + ses_atts[at_cnt].uuid128 = sess_uuid[id_cnt++].uuid; + ses_atts[at_cnt].perm = ses_atts_perm[pm_cnt++]; + ses_atts[at_cnt++].info = (ATT_UUID(128) | (0)); + + ses_svc_db[ss_cnt - 1].nb_att += 2; + } + + } + + // Init Environment + for (uint8_t ssidx = 0; ssidx < ss_cnt; ssidx++) + { + sess_env[ssidx].start_hdl = SES_START_HDL; + sess_env[ssidx].nb_pkt = SES_NB_PKT_MAX; + sess_env[ssidx].ntf_bits = 0; + + // Create Service in database + status = attmdb_svc_create(&sess_env[ssidx].start_hdl, NULL, &ses_svc_db[ssidx], sess_svc_func); + + DEBUG("svc_init(sta:0x%X,shdl:%d,nb_pkt:%d,ntf_bits:0x%X,ssidx:%d)", + status, sess_env[ssidx].start_hdl, sess_env[ssidx].nb_pkt, sess_env[ssidx].ntf_bits, ssidx); + } + + if (upHandle) + { + upHandle = false; + pt_rsp_uuid_handle(sess_get_att_handle(SES_IDX_TXD_VAL)); + pt_rsp_uuid_handle(sess_get_att_handle(SES_IDX_RXD_VAL)); + } + + + return status; +} + +/** + **************************************************************************************** + * @brief Enable setting client configuration characteristics + * + * @param[in] conidx Connection index + * @param[in] cli_cfg Client configuration @see prf_cli_conf + **************************************************************************************** + */ +//void sess_set_ccc(uint8_t conidx, uint8_t cli_cfg) +//{ +// //if (gapc_get_conhdl(conidx) != GAP_INVALID_CONHDL) +// { +// // update configuration +// SES_NTF_CFG_SET(conidx, cli_cfg); +// } +//} + +/** + **************************************************************************************** + * @brief Transmit data to peer device via NTF or IND + * + * @param[in] conidx peer device connection index + * @param[in] len Length of data + * @param[in] data pointer of buffer + * + * @return Status of the operation @see prf_err + **************************************************************************************** + */ +//uint8_t sess_txd_send(uint8_t conidx, uint16_t len, const uint8_t* data) +//{ +// uint8_t status = PRF_ERR_REQ_DISALLOWED; +// +// if ((len > 0) && (sess_env.nb_pkt > 0)) +// { +// uint8_t ntf_cfg = SES_NTF_CFG_GET(conidx); + +// if (ntf_cfg != PRF_CLI_STOP_NTFIND) +// { +// status = LE_SUCCESS; +// gatt_ntf_send(conidx, sess_get_att_handle(SES_IDX_TXD_VAL), len, data); + +// sess_env.nb_pkt--; // allocate +// DEBUG("txd_send(len:%d,nb:%d)", len, sess_env.nb_pkt); +// } +// else +// { +// status = PRF_ERR_NTF_DISABLED; +// } +// } +// +// return status; +//} + +uint8_t sess_txd_send1(uint16_t handle, uint16_t len, const uint8_t* data) +{ + uint8_t status = PRF_ERR_REQ_DISALLOWED; + uint8_t ssidx; + + for (uint8_t idx = 0; idx < SESS_ENV_MAX; idx++) + { + if (handle < (sess_env[idx].start_hdl + ses_svc_db[idx].nb_att + 1)) + { + ssidx = idx; + break; + } + } + + DEBUG("txd_send(len:%d,nb:%d,ssidx:%d)", len, sess_env[ssidx].nb_pkt,ssidx); + + if ((len > 0) && (sess_env[ssidx].nb_pkt > 0)) + { + uint8_t ntf_cfg = SES_NTF_CFG_GET(ssidx, 0 /*conidx*/); + + if (ntf_cfg != PRF_CLI_STOP_NTFIND) + { + status = LE_SUCCESS; + + if (ntf_cfg & PRF_CLI_START_NTF) + gatt_ntf_send(0 /*conidx*/, handle, len, data); + else + gatt_ind_send(0 /*conidx*/, handle, len, data); + + sess_env[ssidx].nb_pkt--; // allocate + } + else + { + status = PRF_ERR_NTF_DISABLED; + } + } + + return status; +} + +/** + **************************************************************************************** + * @brief Callback on received data from peer device via WC or WQ (__weak func) + * + * @param[in] conidx peer device connection index + * @param[in] len Length of data + * @param[in] data pointer of buffer + **************************************************************************************** + */ +__weak void sess_cb_rxd(uint8_t conidx, uint16_t len, const uint8_t *data) +{ + debugHex(data, len); + + // Loopback to txd, just test. + //sess_txd_send(conidx, len, data); +} + +#if (SES_READ_SUP) +/** + **************************************************************************************** + * @brief Callback to response 'READ' from peer device (__weak func) + * + * @param[in] conidx peer device connection index + * @param[in] attidx SESS attribute index, converted with 'handle' + * @param[in] handle SESS attribute handle to send read cfm + * + * @return Length of value been READ + **************************************************************************************** + */ +__weak void sess_cb_rdv(uint8_t conidx, uint8_t attidx, uint16_t handle) +{ +// uint16_t length = SES_VERS_STR_LEN; +// const uint8_t *p_data = (const uint8_t *)SES_VERS_STR; + + uint8_t rdidx = 0; + + for (uint8_t atidx = 0; atidx < sess_inx_nmb; atidx++) + { + if (SES_ATT_IDX[atidx] == SES_IDX_READ_VAL) + { + if (atidx == attidx) + { + DEBUG(" read_cfm(att:%d, len:%d, rdidx:%d)", attidx, ses_read_info[rdidx].length, rdidx); + gatt_read_cfm(conidx, LE_SUCCESS, handle, ses_read_info[rdidx].length, ses_read_info[rdidx].data); + + break; + } + rdidx++; + } + } +} +#endif //(SES_READ_SUP) + +#if (SES_CLI_CFG) +/** + **************************************************************************************** + * @brief Callback on enabled client config from peer device via WQ (__weak func) + * + * @param[in] conidx Connection index + * @param[in] cli_cfg Client configuration @see prf_cli_conf + **************************************************************************************** + */ +__weak void sess_cb_ccc(uint8_t conidx, uint8_t cli_cfg) +{ + // user override +} +#endif //(SES_CLI_CFG) + + +#endif //PRF_SESS diff --git a/projects/bleUartCMD/src/custom/prf_sess.h b/projects/bleUartCMD/src/custom/prf_sess.h new file mode 100644 index 0000000..c13b00d --- /dev/null +++ b/projects/bleUartCMD/src/custom/prf_sess.h @@ -0,0 +1,181 @@ +/** + **************************************************************************************** + * + * @file prf_sess.h + * + * @brief Header file - Serial Service Profile (Server Role). + * + **************************************************************************************** + */ + +#ifndef PRF_SESS_H_ +#define PRF_SESS_H_ + +#include + +#include "att.h" +/* + * DEFINES + **************************************************************************************** + */ + +/// Service Start Handle(0 = dynamically allocated) +#if !defined(SES_START_HDL) + #define SES_START_HDL (0) +#endif + +/// Use UUID 128bit or 16bit +#if !defined(SES_UUID_128) + #define SES_UUID_128 (0) +#endif + +/// Support READ Characteristic +#if !defined(SES_READ_SUP) + #define SES_READ_SUP (1) +#endif + +/// Callback of Client Config enable +#if !defined(SES_CLI_CFG) + #define SES_CLI_CFG (0) +#endif + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ +extern uint8_t sess_inx_nmb; +extern uint8_t SES_ATT_IDX[]; + +extern uint8_t ses_perm_nmb; +extern uint16_t ses_atts_perm[]; + +typedef struct +{ + uint8_t length; + uint8_t data[31]; +}READ_INFO_T; + +extern uint8_t sess_read_nmb; +extern READ_INFO_T ses_read_info[]; + + +typedef struct +{ + uint8_t uuid[16]; +}UUID_INFO_T; +extern uint8_t sess_uuid_nmb; +extern UUID_INFO_T sess_uuid[]; + +/// Server Environment Variable +typedef struct sess_env_tag +{ + // Service Start Handle + uint16_t start_hdl; + // Client Config of peer devices - each 2Bits(NTF & IND), so max_peer=8. + uint16_t ntf_bits; + // Number of notify pkt + uint8_t nb_pkt; +} sess_env_t; + +extern sess_env_t sess_env[]; + +/// Attributes Index +enum ses_att_idx +{ + // Service Declaration, *MUST* Start at 0 + SES_IDX_SVC, + + // Serial TXD Char. + SES_IDX_TXD_CHAR, + SES_IDX_TXD_VAL, + SES_IDX_TXD_NTF_CFG, + + // Serial RXD Char. + SES_IDX_RXD_CHAR, + SES_IDX_RXD_VAL, //5 + + #if (SES_READ_SUP) + // Serial READ Char. + SES_IDX_READ_CHAR, + SES_IDX_READ_VAL, + #endif + + // Max Index, *NOTE* Minus 1(Svc Decl) is .nb_att + SES_IDX_NB, +}; + +/** + **************************************************************************************** + * @brief Add Serial Service Profile in the DB. + * Customize via pre-define @see SES_START_HDL + * + * @return Result status, LE_SUCCESS or Error Reason + **************************************************************************************** + */ +uint8_t sess_svc_init(void); + +/** + **************************************************************************************** + * @brief Enable setting client configuration characteristics + * + * @param[in] conidx Connection index + * @param[in] cli_cfg Client configuration @see prf_cli_conf + **************************************************************************************** + */ +void sess_set_ccc(uint8_t conidx, uint8_t cli_cfg); + +/** + **************************************************************************************** + * @brief Transmit data to peer device via NTF or IND + * + * @param[in] conidx peer device connection index + * @param[in] len Length of data + * @param[in] data pointer of buffer + * + * @return Status of the operation @see prf_err + **************************************************************************************** + */ +uint8_t sess_txd_send(uint8_t conidx, uint16_t len, const uint8_t *data); + +uint8_t sess_txd_send1(uint16_t handle, uint16_t len, const uint8_t *data); + +/** + **************************************************************************************** + * @brief Callback on received data from peer device via WC or WQ (__weak func) + * + * @param[in] conidx peer device connection index + * @param[in] len Length of data + * @param[in] data pointer of buffer + **************************************************************************************** + */ +void sess_cb_rxd(uint8_t conidx, uint16_t len, const uint8_t *data); + +#if (SES_READ_SUP) +/** + **************************************************************************************** + * @brief Callback to response 'READ' from peer device (__weak func) + * + * @param[in] conidx peer device connection index + * @param[in] attidx SESS attribute index, converted with 'handle' + * @param[in] handle SESS attribute handle to send read cfm + * + * @return Length of value been READ + **************************************************************************************** + */ +void sess_cb_rdv(uint8_t conidx, uint8_t attidx, uint16_t handle); +#endif + +#if (SES_CLI_CFG) +/** + **************************************************************************************** + * @brief Callback on enabled client config from peer device via WQ (__weak func) + * + * @param[in] conidx Connection index + * @param[in] cli_cfg Client configuration @see prf_cli_conf + **************************************************************************************** + */ +void sess_cb_ccc(uint8_t conidx, uint8_t cli_cfg); +#endif + +#endif /* PRF_SESS_H_ */ diff --git a/projects/bleUartCMD/src/main.c b/projects/bleUartCMD/src/main.c new file mode 100644 index 0000000..6ae2511 --- /dev/null +++ b/projects/bleUartCMD/src/main.c @@ -0,0 +1,86 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" +#include "app.h" +#include "sftmr.h" +#include "leds.h" +#include "uartRb.h" +#include "dbg.h" + +#include "proto.h" +#include "cmd.h" +/* + * DEFINES + **************************************************************************************** + */ + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +extern void user_procedure(void); + +static void sysInit(void) +{ + iwdt_disable(); + + rcc_ble_en(); + rcc_adc_en(); + + rcc_fshclk_set(FSH_CLK_DPSC42); +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + syscfgInit(); + + // init protocol parser + proto_init(uart_proc); + + #if (LED_PLAY) + sftmr_init(); + leds_init(); + leds_play(LED_FAST_BL); + #endif //(LED_PLAY) + + // Init BLE App + app_init(rsn); +} + +int main(void) +{ + sysInit(); + devInit(); + + // Global Interrupt Enable + GLOBAL_INT_START(); + + // main loop + while (1) + { + // Schedule Messages & Events + ble_schedule(); + + #if (LED_PLAY) + // SoftTimer Polling + sftmr_schedule(); + #endif //(LED_PLAY) + + // User's Procedure + user_procedure(); + } +} diff --git a/projects/bleUartCMD/src/myapp.c b/projects/bleUartCMD/src/myapp.c new file mode 100644 index 0000000..20ad799 --- /dev/null +++ b/projects/bleUartCMD/src/myapp.c @@ -0,0 +1,72 @@ +/** + **************************************************************************************** + * + * @file myapp.c + * + * @brief User Application - Override func + * + **************************************************************************************** + */ + +#include "app.h" +#include "bledef.h" +#include "drvs.h" +#include "leds.h" + +#if (DBG_APP) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + + + +/* + * VARIABLES DEFINITIONS + **************************************************************************************** + */ + + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +#if (LED_PLAY) +/** + **************************************************************************************** + * @brief API to Set State of Application, add leds Indication + * + * @param[in] state new state + **************************************************************************************** + */ +void app_state_set(uint8_t state) +{ + DEBUG("State(old:%d,new:%d)", app_state_get(), state); + + app_env.state = state; + + // Indication, User add more... + if (state == APP_IDLE) + { + leds_play(LED_SLOW_BL); + } + else if (state == APP_READY) + { + leds_play(LED_FAST_BL); + } + else if (state == APP_CONNECTED) + { + leds_play(LED_CONT_ON); + } +} +#endif //(LED_PLAY) + diff --git a/projects/bleUartCMD/src/proc.c b/projects/bleUartCMD/src/proc.c new file mode 100644 index 0000000..137befd --- /dev/null +++ b/projects/bleUartCMD/src/proc.c @@ -0,0 +1,632 @@ +/** + **************************************************************************************** + * + * @file proc.c + * + * @brief user procedure. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "prf_sess.h" +#include "bledef.h" +#include "drvs.h" + +#include "app.h" +#include "uartRb.h" + +#include "proto.h" +#include "cmd.h" +#include "regs.h" + +#if (DBG_PROC) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ +/// Characteristic Base UUID128 (User Customize) +#define SES_ATT_UUID128(uuid) { 0x16, 0x0A, 0x10, 0x40, 0xD1, 0x9F, 0x4C, 0x6C, \ + 0xB4, 0x55, 0xE3, 0xF7, (uuid) & 0xFF, (uuid >> 8) & 0xFF, 0x00, 0x00 } + +#define SADC_ANA_DFLT_V33 (SADC_CALCAP_PRECISION | SADC_IBSEL_BUF(3) | SADC_IBSEL_VREF(3) \ + | SADC_IBSEL_VCM(3) | SADC_IBSEL_CMP(3) | SADC_EN_BIT) // 136DC + +__attribute__((aligned (4))) +SYS_CONFIG sysCfg = +{ + .baudrate = 115200, + .tx_power = TX_0DB_P, + .stauts.BLE_DIS = ADV_ENBLE, + .name_info.len = sizeof(BLE_DEV_NAME), + .name_info.name = BLE_DEV_NAME, + .addrL = BLE_ADDR, + .uuid_len = ATT_UUID128_LEN, + .uuids = SES_ATT_UUID128(0x0001), + .uuidw = SES_ATT_UUID128(0x0002), + .uuidn = SES_ATT_UUID128(0x0003), + .vertion = FIRM_VERTION, + .wake_info.iox = PA10, +}; + + +/* + * FUNCTIONS + **************************************************************************************** + */ +/// Override - Callback on received data from peer device +void sess_cb_rxd1(uint16_t handle, uint16_t len, const uint8_t *data) +{ + pt_rsp_le_data_rep(handle, len, data); +} + + +void syscfgInit(void) +{ + uint32_t trim_data[64]; + flash_read(ADDR_OFFSET_CFG, trim_data, 64); + + if (trim_data[0] != 0xFFFFFFFF) + { + memcpy((uint8_t *)&sysCfg, (uint8_t *)trim_data, sizeof(sysCfg)); + } +} + +/// Uart Data procedure +void uart_proc(struct pt_pkt *pkt, uint8_t status) +{ + // Todo Loop-Proc + bool bleReset = true; + bool cfgSave = true; + + if (status != PT_OK) + { + //pt_send_rsp(pkt); // debug + pt_rsp_cmd_res(pkt->code, status, pkt->len, pkt->payl); + + return; + } + + switch (pkt->code) + { + case PT_CMD_SET_BLE_ADDR: + { + memcpy(sysCfg.addrL.addr, pkt->payl, PLEN_CMD_SET_BLE_ADDR); + + pt_rsp_ok(pkt->code); + } break; + + case PT_CMD_SET_VISIBILITY: + { + sysCfg.stauts.value = pkt->payl[0] & 0x07; + pt_rsp_ok(pkt->code); + } break; + case PT_CMD_SET_BLE_NAME: + { + sysCfg.name_info.len = pkt->len; + memcpy(sysCfg.name_info.name, pkt->payl, pkt->len); + pt_rsp_ok(pkt->code); + } break; + case PT_CMD_SEND_BLE_DATA: + { + bleReset = false; + cfgSave = false; + + if (app_state_get() == APP_CONNECTED) + { + uint16_t handle = pkt->payl[0] | ((uint16_t)pkt->payl[1] << 8); + +// if (sess_txd_send(app_env.curidx, (pkt->len - 2), &pkt->payl[2]) == LE_SUCCESS) + if (sess_txd_send1(handle, (pkt->len - 2), &pkt->payl[2]) == LE_SUCCESS) + pt_rsp_ok(pkt->code); + } + } break; + + case PT_CMD_STATUS_REQUEST: + { + bleReset = false; + cfgSave = false; + + pt_rsp_status_res(sysCfg.stauts.value); + } break; + + case PT_CMD_SET_UART_FLOW: + { + bleReset = false; + + if (pkt->payl[0]) // UART + uart_hwfc(UART1_PORT, PA_UART1_RTS, PA_UART1_CTS); + else // ر UART bit[3:2] (.AFCEN=1, .RTSCTRL=1) + UART1->MCR.Word &= ~(0x0000000C); + + pt_rsp_ok(pkt->code); + } break; + + case PT_CMD_SET_UART_BAUD: + { + bleReset = false; + + sysCfg.baudrate = atoi((char *)&pkt->payl); + // update BaudRate + UART1->LCR.BRWEN = 1; + UART1->BRR = BRR_DIV(sysCfg.baudrate, 16M); // (rcc_sysclk_get() + (baud >> 1)) / baud + UART1->LCR.BRWEN = 0; + + pt_rsp_ok(pkt->code); + } break; + + case PT_CMD_VERSION_REQUEST: + { + bleReset = false; + cfgSave = false; + + pt_rsp_cmd_res(pkt->code, PT_OK, PLEN_RSP_VERTION, (uint8_t *)&sysCfg.vertion); + } break; + case PT_CMD_BLE_DISCONNECT: + { + bleReset = false; + cfgSave = false; + + gapc_disconnect(app_env.curidx); + pt_rsp_ok(pkt->code); + } break; + case PT_CMD_CONFIRM_GKEY: + { + bleReset = false; + cfgSave = false; + + if (pkt->payl[0]) // Կƥ + {} + else // Կƥ + {} + pt_rsp_ok(pkt->code); + } break; + + case PT_CMD_SET_ADV_DATA: + { + uint8_t lenA = (31 < pkt->len) ? 31 : pkt->len; + uint8_t lenS = pkt->len - lenA; + + sysCfg.adv_info.lenADV = lenA; + memcpy(sysCfg.adv_info.adv, pkt->payl, lenA); + + if (lenS) + { + sysCfg.adv_info.lenSCAN = lenS; + memcpy(sysCfg.adv_info.scan, &pkt->payl[lenA], lenS); + } + + pt_rsp_ok(pkt->code); + } break; + + case PT_CMD_POWER_REQ: + { + bleReset = false; + cfgSave = false; + + if (SADC->SADC_ANA_CTRL.SADC_EN) + { + uint32_t value; + uint8_t adc_data[2]; + value = (3300UL*sadc_read(SADC_CH_AIN0, 0))/0x3FF; + + adc_data[0] = value/1000; + adc_data[1] = value%1000/10; + pt_rsp_cmd_res(pkt->code, PT_OK, PLEN_RSP_VERTION, adc_data); + } + else + { + pt_rsp_cmd_res(pkt->code, PT_ERROR, 0, NULL); + } + + } break; + + case PT_CMD_POWER_SET: + { + bleReset = false; + if (pkt->payl[0]) // ѹ + { + // Analog Enable + GPIO_DIR_CLR(1UL << PA_POWER_ADC); + // ADC + iom_ctrl(PA_POWER_ADC, IOM_ANALOG); + // sadc init + sadc_init(SADC_ANA_DFLT_V33); + + sadc_conf(SADC_CR_DFLT); + } + else // رյѹ + { + SADC->SADC_ANA_CTRL.SADC_EN = 0; + } + + pt_rsp_ok(pkt->code); + } break; + + case PT_CMD_PASSKEY_ENTRY: + { + bleReset = false; + cfgSave = false; + } break; + + case PT_CMD_SET_GPIO: + { + bleReset = false; + + uint8_t IO_MODE = pkt->payl[0]; + uint8_t IO_x = pkt->payl[1]; + uint8_t IO_LHUD = pkt->payl[2]; + + if (IO_x < 2) + { + //PA00 PA01 + iospc_swdpin(); + } + else if (IO_x == 19) + { + //PA19 + iospc_rstpin(true); + } + + if (IO_MODE) // + { + IO_LHUD == 0 ? GPIO_DAT_CLR(BIT(IO_x)) : GPIO_DAT_SET(BIT(IO_x)); + GPIO_DIR_SET(BIT(IO_x)); + } + else // + { + GPIO_DIR_CLR(BIT(IO_x)); + IO_LHUD == 0 ? (IO_LHUD = IOM_PULLUP) : (IO_LHUD = IOM_PULLDOWN); + iom_ctrl(IO_x, IOM_INPUT | IO_LHUD); + } + + pt_rsp_ok(pkt->code); + } break; + + case PT_CMD_READ_GPIO: + { + bleReset = false; + cfgSave = false; + + gpio_info_t io_info; + io_info.iox = 0; //pkt->payl[0]; //GPIOx + + if (BIT(pkt->payl[0]) & GPIO_PIN_GET()) + io_info.level = OE_HIGH; + else + io_info.level = OE_LOW; + + pt_rsp_cmd_res(pkt->code, PT_OK, PLEN_RSP_GPIO, (uint8_t *)&io_info); + } break; + + case PT_CMD_LE_SET_PAIRING: + { + bleReset = false; + + // enum gap_auth + sysCfg.pair_info.auth = pkt->payl[0]; + + pt_rsp_ok(pkt->code); + } break; + + case PT_CMD_LE_SET_ADV_DATA: + { + sysCfg.adv_info.lenADV = pkt->len; + memcpy(sysCfg.adv_info.adv, pkt->payl, pkt->len); + + pt_rsp_ok(pkt->code); + } break; + + case PT_CMD_LE_SET_SCAN_DATA: + { + sysCfg.adv_info.lenSCAN = pkt->len; + memcpy(sysCfg.adv_info.scan, pkt->payl, pkt->len); + + pt_rsp_ok(pkt->code); + } break; + + case PT_CMD_LE_SEND_CONN_UPDATE_REQ: + { + bleReset = false; + cfgSave = false; + + sysCfg.conn_info.intervalMIN = (pkt->payl[0] | (pkt->payl[1] << 8)); + sysCfg.conn_info.intervalMAX = (pkt->payl[2] | (pkt->payl[3] << 8)); + sysCfg.conn_info.latency = (pkt->payl[4] | (pkt->payl[5] << 8)); + sysCfg.conn_info.timeout = (pkt->payl[6] | (pkt->payl[7] << 8)); + + pt_rsp_ok(pkt->code); + } break; + + case PT_CMD_LE_SET_ADV_PARM: + { + sysCfg.advr = (pkt->payl[0] | (pkt->payl[1] << 8)); + pt_rsp_ok(pkt->code); + } break; + + case PT_CMD_LE_START_PAIRING: + { + cfgSave = false; + pt_rsp_ok(pkt->code); + } break; + + case PT_CMD_SET_WAKE_GPIO: + { + bleReset = false; + sysCfg.wake_info.iox = pkt->payl[0] & 0x1F; + sysCfg.wake_info.level = pkt->payl[0] & 0x80; + sysCfg.wake_info.delay_us = RD_32(&pkt->payl[1]); + + // + GPIO_DIR_SET(1UL << sysCfg.wake_info.iox); + + if (sysCfg.wake_info.level) + { + GPIO_DAT_SET(1UL << sysCfg.wake_info.iox); + } + else + { + GPIO_DAT_CLR(1UL << sysCfg.wake_info.iox); + } + // system 16M + btmr_delay(16, sysCfg.wake_info.delay_us); + + pt_rsp_ok(pkt->code); + } break; + + case PT_CMD_SET_TX_POWER: + { + sysCfg.tx_power = pkt->payl[0]; + pt_rsp_ok(pkt->code); + } break; + + case PT_CMD_LE_CONFIRM_GKEY: + { + bleReset = false; + cfgSave = false; + + if (pkt->payl[0]) // Կƥ + { + + } + else // Կƥ + { + + } + pt_rsp_ok(pkt->code); + } break; + + case PT_CMD_REJECT_JUSTWORK: + { + cfgSave = false; + + if (pkt->payl[0]) // 򿪾ܾ justwork + { + + } + else // رվܾ justwork + { + + } + pt_rsp_ok(pkt->code); + } break; + + case PT_CMD_RESET_CHIP_REQ: + { + bleReset = false; + cfgSave = false; + + NVIC_SystemReset(); + } break; + + case PT_CMD_LE_SET_FIXED_PASSKEY: + { + + } break; + + case PT_CMD_DELETE_CUSTOMIZE_SERVICE: + { + cfgSave = false; + sess_inx_nmb = 8; + sess_uuid_nmb = 4; + sess_read_nmb = 1; + ses_perm_nmb = 3; + + pt_rsp_ok(pkt->code); + } break; + + case PT_CMD_ADD_SERVICE_UUID: + { + cfgSave = false; + + sess_uuid[sess_uuid_nmb].uuid[12] = pkt->payl[0]; + sess_uuid[sess_uuid_nmb++].uuid[13] = pkt->payl[1]; + + SES_ATT_IDX[sess_inx_nmb++] = SES_IDX_SVC; + + pt_rsp_ok(pkt->code); + } break; + + case PT_CMD_ADD_CHARACTERISTIC_UUID: + { + cfgSave = false; + uint8_t att_val = pkt->payl[0]; + sess_uuid[sess_uuid_nmb].uuid[12] = pkt->payl[1]; + sess_uuid[sess_uuid_nmb++].uuid[13] = pkt->payl[2]; + + pt_rsp_uuid_handle(sess_env[0].start_hdl + sess_inx_nmb + 1); + + ses_atts_perm[ses_perm_nmb++] = ((uint16_t)att_val << 8); + + if (att_val & 0x03) + { + // Broadcast & Read + SES_ATT_IDX[sess_inx_nmb++] = SES_IDX_READ_CHAR; + SES_ATT_IDX[sess_inx_nmb++] = SES_IDX_READ_VAL; + + ses_read_info[sess_read_nmb].length = pkt->payl[3]; + memcpy(ses_read_info[sess_read_nmb++].data, &pkt->payl[4], pkt->payl[3]); + } + else if (att_val & 0x0C) + { + // WriteWithoutResponse & Write + SES_ATT_IDX[sess_inx_nmb++] = SES_IDX_RXD_CHAR; + SES_ATT_IDX[sess_inx_nmb++] = SES_IDX_RXD_VAL; + } + else if (att_val & 0x30) + { + // Notify & Indicate + SES_ATT_IDX[sess_inx_nmb++] = SES_IDX_TXD_CHAR; + SES_ATT_IDX[sess_inx_nmb++] = SES_IDX_TXD_VAL; + SES_ATT_IDX[sess_inx_nmb++] = SES_IDX_TXD_NTF_CFG; + } + else if (att_val & 0xC0) + { + // AuthenticatedSignedWrites & ExtendedProperties + + } + + } break; + + case PT_TEST_CMD_CLOSE_LPM: + { + cfgSave = false; + } break; + + default : + { + cfgSave = false; + } break; + } + + if (bleReset) + gapm_reset(); + + if (cfgSave) + { + flash_page_erase(ADDR_OFFSET_CFG); + flash_write(ADDR_OFFSET_CFG, (uint32_t *)&sysCfg, 64); + } +} + +#if (CFG_SLEEP) +static void sleep_proc(void) +{ + uint8_t lpsta = ble_sleep(BLE_SLP_TWOSC, BLE_SLP_DURMAX); + + if (lpsta == BLE_IN_SLEEP) + { + uint16_t lpret = core_sleep(CFG_WKUP_BLE_EN); + //DEBUG("ble sta:%d, wksrc:%X", lpsta, lpret); + } + else + { + //DEBUG("ble sta:%d", lpsta); + } +} +#endif //(CFG_SLEEP) + +uint8_t app_name_get(uint8_t size, uint8_t *name) +{ + uint8_t len = sysCfg.name_info.len; + + memcpy(name, sysCfg.name_info.name, len); + + return len; +} + +void app_conf_fsm(uint8_t evt) +{ + if (evt == BLE_RESET) + { + memset(&app_env, 0, sizeof(app_env)); + + // Set device config + gapm_set_dev(&ble_dev_config, &sysCfg.addrL, NULL); + } + else /*if (evt == BLE_CONFIGURED)*/ + { + #if (CFG_SLEEP) + // Set Sleep duration + + #if (RC32K_CALIB_PERIOD) + ke_timer_set(APP_TIMER_RC32K_CORR, TASK_APP, RC32K_CALIB_PERIOD); + #endif //(RC32K_CALIB_PERIOD) + #endif //(CFG_SLEEP) + + app_state_set(APP_IDLE); + + // Create Profiles + app_prf_create(); + + // Create Activities + if (sysCfg.stauts.BLE_DIS) + { + app_actv_create(); + } + + } +} + +void app_conn_fsm(uint8_t evt, uint8_t conidx, const void* param) +{ + switch (evt) + { + case BLE_CONNECTED: + { + // Connected state, record Index + app_env.curidx = conidx; + app_state_set(APP_CONNECTED); + + sysCfg.stauts.BLE_COND = 1; + pt_rsp_le_conn_rep(); + + gapc_connect_rsp(conidx, GAP_AUTH_REQ_NO_MITM_NO_BOND); + + // Enable profiles by role + } break; + + case BLE_DISCONNECTED: + { + app_state_set(APP_READY); + + sysCfg.stauts.BLE_COND = 0; + pt_rsp_le_dis_rep(); + + #if (BLE_EN_ADV) + // Slave role, Restart Advertising + app_adv_action(ACTV_START); + #endif //(BLE_EN_ADV) + } break; + + case BLE_BONDED: + { + // todo, eg. save the generated slave's LTK to flash + } break; + + case BLE_ENCRYPTED: + { + // todo + } break; + + default: + break; + } +} + +void user_procedure(void) +{ + #if (CFG_SLEEP) + sleep_proc(); + #endif //(CFG_SLEEP) + + proto_schedule(); +} diff --git a/projects/bleUartCMD/src/protocol/proto.c b/projects/bleUartCMD/src/protocol/proto.c new file mode 100644 index 0000000..ac8f77d --- /dev/null +++ b/projects/bleUartCMD/src/protocol/proto.c @@ -0,0 +1,26 @@ +#include +#include "proto.h" +#include "pt_env.h" +#include "uartRb.h" + +/// Protocol API +extern void pt_sch_init(proto_t *pt, uint8_t *buf, read_fnct read, parse_fnct parse); +extern void pt_sch_proc(proto_t *pt); + +/// Proto: Host <--> Local -- UART1 + +static proto_t gPT2Host; +static uint8_t gHostBuf[PKT_MAX_SIZE]; + +void proto_init(parse_fnct parse) +{ + uart1Rb_Init(); //dbgInit(); + pt_sch_init(&gPT2Host, gHostBuf, uart1Rb_Read, parse); + + pt_rsp_standby_rep(); +} + +void proto_schedule(void) +{ + pt_sch_proc(&gPT2Host); +} diff --git a/projects/bleUartCMD/src/protocol/proto.h b/projects/bleUartCMD/src/protocol/proto.h new file mode 100644 index 0000000..711d288 --- /dev/null +++ b/projects/bleUartCMD/src/protocol/proto.h @@ -0,0 +1,272 @@ +#ifndef _PROTO_H_ +#define _PROTO_H_ + +#include +#include + + +/*************************************************************************** + * Proto Macro API + ***************************************************************************/ + +/// Protocol Defines + +enum PT_TYPE +{ + PT_TYPE_CMD = 0x01, + PT_TYPE_RSP = 0x02, +}; + +enum PT_ERR_CODE +{ + PT_OK = 0x00, + + // proto sch error A0~A4 + PT_ERROR = 0xA0, + PT_ERR_CRC = 0xA0, + PT_ERR_LEN = 0xA1, + PT_ERR_CODE = 0xA2, + PT_ERR_HEAD = 0xA3, + PT_ERR_TIMEOUT = 0xA4, + // proto app error A6~AF + PT_ERR_VERIFY = 0xA6, + PT_ERR_STATUS = 0xA7, +}; + +/// Packet Defines @see pt_pkt +#define PKT_HDR_POS 0 +#define PKT_HDR_SIZE 3 +#define HDR_SYNC_POS (PKT_HDR_POS) +#define HDR_SYNC_SIZE (0x01) +#define HDR_CMD_POS (PKT_HDR_POS + HDR_SYNC_SIZE) +#define HDR_CMD_SIZE (0x01) +#define HDR_LEN_POS (PKT_HDR_POS + HDR_SYNC_SIZE + HDR_CMD_SIZE) +#define HDR_LEN_SIZE (0x01) + +#define PKT_PAYL_POS 3 +#define PAYL_DAT_MAX_SIZE (0xFF) +#define PKT_PAYL_MAX_SIZE (PAYL_DAT_MAX_SIZE) + +#define PKT_MAX_SIZE (((PKT_HDR_SIZE + PKT_PAYL_MAX_SIZE)+3)/4)*4 + +enum PKT_FMT +{ + PKT_FIXLEN = 0, + PKT_VARLEN = 1, + + PKT_LEN_MSK = 0x01, +}; + +/// Protocol Packet +typedef struct pt_pkt +{ + /* head(4B): 1-sync; 1-cmd; 1-len */ + uint8_t type; + uint8_t code; + uint8_t len; + + /* payl(nB): A set of variable value */ + uint8_t payl[]; +} pkt_t; + +typedef void(*parse_fnct)(struct pt_pkt *pkt, uint8_t status); + +/// PT Interface +void proto_init(parse_fnct parse); + +void proto_schedule(void); + + +/*************************************************************************** + * Proto Command & Response Macros + ***************************************************************************/ + +enum PT_CMD_CODE +{ + PT_CMD_SET_BLE_ADDR = 0x01, // BLE ַ + PT_CMD_SET_VISIBILITY = 0x02, // ÿɷֺ͹㲥 + PT_CMD_SET_BLE_NAME = 0x04, // BLE + PT_CMD_SEND_BLE_DATA = 0x09, // BLE + + PT_CMD_STATUS_REQUEST = 0x0B, // ״̬ + PT_CMD_SET_UART_FLOW = 0x0E, // UART + PT_CMD_SET_UART_BAUD = 0x0F, // UART + PT_CMD_VERSION_REQUEST = 0x10, // ѯģ̼汾 + PT_CMD_BLE_DISCONNECT = 0x12, // Ͽ BLE + + PT_CMD_SET_NVRAM = 0x26, // · NV + PT_CMD_CONFIRM_GKEY = 0x28, // Numeric Comparison ԷʽжԿıȽ + PT_CMD_SET_CREDIT_GIVEN = 0x29, // Spp + PT_CMD_SET_ADV_DATA = 0x2A, // ADV + PT_CMD_POWER_REQ = 0x2B, // ѯģԴѹ + PT_CMD_POWER_SET = 0x2C, // ȡԴѹܿ + + PT_CMD_PASSKEY_ENTRY = 0x30, // Passkey + PT_CMD_SET_GPIO = 0x31, // ʼ gpio + PT_CMD_READ_GPIO = 0x32, // ȡ gpio ״̬ + PT_CMD_LE_SET_PAIRING = 0x33, // ģʽ + PT_CMD_LE_SET_ADV_DATA = 0x34, // adv + PT_CMD_LE_SET_SCAN_DATA = 0x35, // scan + PT_CMD_LE_SEND_CONN_UPDATE_REQ = 0x36, // Ӳ + PT_CMD_LE_SET_ADV_PARM = 0x37, // ù㲥 + PT_CMD_LE_START_PAIRING = 0x38, // ʼ + + PT_CMD_SET_WAKE_GPIO = 0x40, // û IO + PT_CMD_SET_TX_POWER = 0x42, // ÷书 + PT_CMD_LE_CONFIRM_GKEY = 0x48, // Ble Numeric Comparison ԷʽжԿıȽ + PT_CMD_REJECT_JUSTWORK = 0x49, // ܾ justwork Էʽ(pci ֤ʱʹ) + + PT_CMD_RESET_CHIP_REQ = 0x51, // λоƬ + + PT_CMD_LE_SET_FIXED_PASSKEY = 0x61, // ù̶ passkey + + PT_CMD_DELETE_CUSTOMIZE_SERVICE = 0x76, // ɾ BLE ϵͳ + PT_CMD_ADD_SERVICE_UUID = 0x77, // BLE Զ + PT_CMD_ADD_CHARACTERISTIC_UUID = 0x78, // BLE Զ + + PT_TEST_CMD_CLOSE_LPM = 0xFF, // ر LPM +}; + + +//EVENT RSP +enum PT_RSP_CODE +{ + PT_RSP_SPP_CONN_REP = 0x00, // BT3.0 ӽ + PT_RSP_LE_CONN_REP = 0x02, // BLE ӽ + PT_RSP_SPP_DIS_REP = 0x03, // BT3.0 ӶϿ + PT_RSP_LE_DIS_REP = 0x05, // BLE ӶϿ + + PT_RSP_CMD_RES = 0x06, // + PT_RSP_SPP_DATA_REP = 0x07, // յ BT3.0 ݣSPP + PT_RSP_LE_DATA_REP = 0x08, // յ BLE + PT_RSP_STANDBY_REP = 0x09, // ģ׼ + PT_RSP_STATUS_RES = 0x0A, // ״̬ظ + + PT_RSP_NVRAM_REP = 0x0D, // ϴ NVRAM +// PT_RSP_INVALID_PACKET = 0x0F, // HCI ʽ + PT_RSP_GKEY = 0x0E, // Numeric Comparison ԷʽвԿ + PT_RSP_INVALID_PACKET = 0x0F, // ֪ͨ MCU İʽ + + PT_RSP_GET_PASSKEY = 0x10, // passkey ֵ MCU + PT_RSP_LE_TK = 0x11, // BLE PASSKEY Էʽ֪ͨMCU Կ + PT_RSP_LE_PAIRING_STATE = 0x14, // ֪ͨ MCU Ble ״̬ + PT_RSP_LE_ENCRYPTION_STATE = 0x15, // ֪ͨ MCU ǰ״̬ + + PT_RSP_LE_GKEY = 0x1d, // Numeric Comparison ԷʽвԿ + + PT_RSP_UUID_HANDLE = 0x29, // ֪ͨ MCU õ uuid Ӧhandle +}; + + +enum PAYL_LEN +{ + PLEN_CMD_SET_BLE_ADDR = 0x06, // PKT_FIXLEN + PLEN_CMD_SET_VISIBILITY = 0x01, // PKT_FIXLEN + PLEN_CMD_SET_BLE_NAME = 0x18, // PKT_VARLEN + PLEN_CMD_STATUS_REQUEST = 0x00, // PKT_FIXLEN + + PLEN_RSP_OK = 0x00, // 0 + PLEN_RSP_CODE = 0x00, // 0 + PLEN_RSP_VERTION = 0x02, // 0 + PLEN_RSP_GPIO = 0x02, // 0 + + PLEN_RSP_STATUS = 0x01, // 1status + + PLEN_RSP_CMD_RES = 0xFF, + + PLEN_RSP_LE_DATA_REP = 0xFF, //2handle+data + + PLEN_RSP_NVRAM_REP = 0xAA, //34*5 + + PLEN_RSP_GKEY = 0x04, //5 + PLEN_RSP_LE_TK = 0x04, //5 + PLEN_RSP_LE_GKEY = 0x04, //5 + PLEN_RSP_GET_PASSKEY = 0x06, //5 + PLEN_RSP_LE_PAIRING_STATE = 0x02, //5 + PLEN_RSP_LE_ENCRYPTION_STATE = 0x01, //5 + PLEN_RSP_UUID_HANDLE = 0x02, //5 + + PLEN_CMD_DFT = 0xFF, //0x103, // 1Lbidx+2Pkgidx+(1~PAYL_DAT_MAX_SIZE)data + PLEN_RSP_DFT = 0x01, // 1status +}; + +/*************************************************************************** + * Proto Command & Response Structs + ***************************************************************************/ + + + + +// HCI EVENT RSP +struct pt_rsp_status +{ + uint8_t status; +}; + +struct pt_rsp_cmd_res +{ + uint8_t opcode; + uint8_t status; + uint8_t data[]; +}; + +struct pt_rsp_le_data_rep +{ + uint8_t handle[2]; + uint8_t data[]; +}; + +struct pt_rsp_le_pairing_state +{ + uint8_t state[2]; +}; + +struct pt_rsp_le_encryption_state +{ + uint8_t state; +}; + +struct pt_rsp_uuid_handle +{ + uint8_t handle[2]; +}; + +/*************************************************************************** + * Proto Command & Response Function + ***************************************************************************/ + +#define PKT_ALLOC(payl_len) uint8_t buff[PKT_HDR_SIZE + payl_len]; pkt_t *pkt = (pkt_t *)buff +#define PKT_PARAM(p_struct) p_struct *param = (p_struct *)pkt->payl + +/// Command Send via UART2 +extern uint8_t pt_code; +extern uint32_t pt_time; +void pt_send_cmd(pkt_t *pkt); + +/// Response Send via UART1 +void pt_rsp_code(uint8_t rsp); + +#define pt_rsp_spp_conn_rep() pt_rsp_code(PT_RSP_SPP_CONN_REP) +#define pt_rsp_le_conn_rep() pt_rsp_code(PT_RSP_LE_CONN_REP) +#define pt_rsp_spp_dis_rep() pt_rsp_code(PT_RSP_SPP_DIS_REP) +#define pt_rsp_le_dis_rep() pt_rsp_code(PT_RSP_LE_DIS_REP) +#define pt_rsp_standby_rep() pt_rsp_code(PT_RSP_STANDBY_REP) +#define pt_rsp_invalid_packet() pt_rsp_code(PT_RSP_INVALID_PACKET) + +#define pt_rsp_gkey(payl) pt_rsp_key(PT_RSP_GKEY, PLEN_RSP_GKEY, payl) +#define pt_rsp_le_tk(payl) pt_rsp_key(PT_RSP_LE_TK, PLEN_RSP_LE_TK, payl) +#define pt_rsp_le_gkey(payl) pt_rsp_key(PT_RSP_LE_GKEY, PLEN_RSP_LE_GKEY, payl) +#define pt_rsp_get_passkey(payl) pt_rsp_key(PT_RSP_LE_GKEY, PLEN_RSP_GET_PASSKEY, payl) + +void pt_rsp_cmd_res(uint8_t opcode, uint8_t status, uint8_t len, const void *payl); +void pt_rsp_le_data_rep(uint16_t handle, uint8_t len, const void *payl); +void pt_rsp_status_res(uint8_t status); +void pt_rsp_nvram_rep(const void *payl); +void pt_rsp_le_pairing_state(uint16_t state); +void pt_rsp_le_encryption_state(uint8_t state); +void pt_rsp_uuid_handle(uint16_t handle); + +#define pt_rsp_ok(code) pt_rsp_cmd_res(code, PT_OK, PLEN_RSP_OK, NULL); + +void uart_proc(struct pt_pkt *pkt, uint8_t status); +#endif // _PROTO_H_ diff --git a/projects/bleUartCMD/src/protocol/proto_rsp.c b/projects/bleUartCMD/src/protocol/proto_rsp.c new file mode 100644 index 0000000..ba2a2b4 --- /dev/null +++ b/projects/bleUartCMD/src/protocol/proto_rsp.c @@ -0,0 +1,119 @@ +#include +#include +#include "proto.h" +#include "uartRb.h" + +static __inline void pt_fill_rsp(pkt_t *pkt, uint8_t rsp, uint8_t len) +{ + pkt->type = PT_TYPE_RSP; + pkt->code = rsp; + pkt->len = len; +} + +/*static __inline*/ void pt_send_rsp(pkt_t *pkt) +{ + uart_send(UART1_PORT, pkt->len + PKT_HDR_SIZE, (uint8_t *)pkt); +} + +/* Common: Status */ +void pt_rsp_code(uint8_t rsp) +{ + PKT_ALLOC(PLEN_RSP_CODE); + pt_fill_rsp(pkt, rsp, PLEN_RSP_CODE); + + pt_send_rsp(pkt); +} + +void pt_rsp_cmd_res(uint8_t opcode, uint8_t status, uint8_t len, const void *payl) +{ + PKT_ALLOC(PLEN_RSP_CMD_RES); + pt_fill_rsp(pkt, PT_RSP_CMD_RES, len + 2); + + PKT_PARAM(struct pt_rsp_cmd_res); + param->opcode = opcode; + param->status = status; + + memcpy(param->data, payl, len); + + pt_send_rsp(pkt); +} + +void pt_rsp_le_data_rep(uint16_t handle, uint8_t len, const void *payl) +{ + PKT_ALLOC(PLEN_RSP_LE_DATA_REP); + pt_fill_rsp(pkt, PT_RSP_LE_DATA_REP, len + 2); + + PKT_PARAM(struct pt_rsp_le_data_rep); + param->handle[0] = handle; + param->handle[1] = handle >> 8; + + memcpy(param->data, payl, len); +// memcpy(&pkt->payl[2], payl, len); + pt_send_rsp(pkt); +} + +void pt_rsp_status_res(uint8_t status) +{ + PKT_ALLOC(PLEN_RSP_STATUS); + pt_fill_rsp(pkt, PT_RSP_STATUS_RES, PLEN_RSP_STATUS); + + PKT_PARAM(struct pt_rsp_status); + param->status = status; + + pt_send_rsp(pkt); +} + +void pt_rsp_nvram_rep(const void *payl) +{ + PKT_ALLOC(PLEN_RSP_NVRAM_REP); + pt_fill_rsp(pkt, PT_RSP_NVRAM_REP, PLEN_RSP_NVRAM_REP); + + memcpy(pkt->payl, payl, PLEN_RSP_NVRAM_REP); + + pt_send_rsp(pkt); +} + +void pt_rsp_key(uint8_t opcode, uint8_t len, const void *payl) +{ + PKT_ALLOC(PLEN_RSP_GKEY); + pt_fill_rsp(pkt, opcode, len); + + memcpy(pkt->payl, payl, len); + + pt_send_rsp(pkt); +} + +void pt_rsp_le_pairing_state(uint16_t state) +{ + PKT_ALLOC(PLEN_RSP_LE_PAIRING_STATE); + pt_fill_rsp(pkt, PT_RSP_LE_PAIRING_STATE, PLEN_RSP_LE_PAIRING_STATE); + + PKT_PARAM(struct pt_rsp_le_pairing_state); + param->state[0] = state; + param->state[1] = state >> 8; + + pt_send_rsp(pkt); +} + +void pt_rsp_le_encryption_state(uint8_t state) +{ + PKT_ALLOC(PLEN_RSP_LE_ENCRYPTION_STATE); + pt_fill_rsp(pkt, PT_RSP_LE_ENCRYPTION_STATE, PLEN_RSP_LE_ENCRYPTION_STATE); + + PKT_PARAM(struct pt_rsp_le_encryption_state); + param->state = state; + + pt_send_rsp(pkt); +} + +void pt_rsp_uuid_handle(uint16_t handle) +{ + PKT_ALLOC(PLEN_RSP_UUID_HANDLE); + pt_fill_rsp(pkt, PT_RSP_UUID_HANDLE, PLEN_RSP_UUID_HANDLE); + + PKT_PARAM(struct pt_rsp_uuid_handle); + param->handle[0] = handle; + param->handle[1] = handle >> 8; + + pt_send_rsp(pkt); +} diff --git a/projects/bleUartCMD/src/protocol/pt_env.h b/projects/bleUartCMD/src/protocol/pt_env.h new file mode 100644 index 0000000..52766b5 --- /dev/null +++ b/projects/bleUartCMD/src/protocol/pt_env.h @@ -0,0 +1,48 @@ +#ifndef _PT_ENV_H_ +#define _PT_ENV_H_ + +#include + +struct pt_pkt; // defined in proto.h + +/// Timeout(unit in currTickCnt) between PKT received, 0 means keep waiting +#define PT_TOUT_CNT (5) + +enum PT_STATE +{ + PT_STATE_SYNC, + PT_STATE_HDR, + PT_STATE_PAYL, + PT_STATE_OUT_OF_SYNC +}; + +typedef uint16_t (*read_fnct)(uint8_t *buf, uint16_t len); +typedef uint16_t (*send_fnct)(uint8_t *buf, uint16_t len); +typedef void(*parse_fnct)(struct pt_pkt *pkt, uint8_t status); + +typedef struct proto_env_tag +{ + // interface + read_fnct read; + parse_fnct parse; + // buffer + uint8_t *pkt; + // rx channel + uint8_t *rx_ptr; + uint16_t rx_size; + uint8_t rx_state; + uint8_t rx_pfmt; +#if (PT_TOUT_CNT) + uint16_t rx_tick; +#endif +} proto_t; + +/// pt_pkt API +extern uint8_t pkt_crc8(uint8_t *buff, uint16_t len); +extern uint8_t pkt_hdr_valid(struct pt_pkt *p_hdr); + +/// pt_sch API +extern void pt_sch_proc(proto_t *pt); +extern void pt_sch_init(proto_t *pt, uint8_t *buf, read_fnct read, parse_fnct parse); + +#endif // _PT_ENV_H_ diff --git a/projects/bleUartCMD/src/protocol/pt_pkt.c b/projects/bleUartCMD/src/protocol/pt_pkt.c new file mode 100644 index 0000000..3f61a40 --- /dev/null +++ b/projects/bleUartCMD/src/protocol/pt_pkt.c @@ -0,0 +1,121 @@ +#include +#include +#include "proto.h" + +typedef struct pkt_desc +{ + uint8_t code; // pkt code + uint8_t pfmt; // pkt format + uint16_t plen; // payl length +} pkt_desc_t; + +#define PKT_CRC_SEED (0xFF) +#define PKT_CMD_CNT (sizeof(pt_cmd_desc)/sizeof(struct pkt_desc)) +#define PKT_RSP_CNT (sizeof(pt_rsp_desc)/sizeof(struct pkt_desc)) + +const struct pkt_desc pt_cmd_desc[] = +{ + { PT_CMD_SET_BLE_ADDR, PKT_FIXLEN , PLEN_CMD_SET_BLE_ADDR}, + { PT_CMD_SET_VISIBILITY, PKT_FIXLEN , PLEN_CMD_SET_VISIBILITY}, + { PT_CMD_SET_BLE_NAME, PKT_VARLEN , PLEN_CMD_DFT}, + + { PT_CMD_SEND_BLE_DATA, PKT_VARLEN , PLEN_CMD_DFT}, + + { PT_CMD_STATUS_REQUEST, PKT_FIXLEN , PLEN_CMD_STATUS_REQUEST}, + { PT_CMD_SET_UART_FLOW, PKT_VARLEN , PLEN_CMD_DFT}, + { PT_CMD_SET_UART_BAUD, PKT_VARLEN , PLEN_CMD_DFT}, + { PT_CMD_VERSION_REQUEST, PKT_VARLEN , PLEN_CMD_DFT}, + { PT_CMD_BLE_DISCONNECT, PKT_VARLEN , PLEN_CMD_DFT}, + + { PT_CMD_CONFIRM_GKEY, PKT_VARLEN , PLEN_CMD_DFT}, + { PT_CMD_SET_CREDIT_GIVEN, PKT_VARLEN , PLEN_CMD_DFT}, + { PT_CMD_SET_ADV_DATA, PKT_VARLEN , PLEN_CMD_DFT}, + { PT_CMD_POWER_REQ, PKT_FIXLEN , 0}, + { PT_CMD_POWER_SET, PKT_VARLEN , PLEN_CMD_DFT}, + + { PT_CMD_PASSKEY_ENTRY, PKT_VARLEN , PLEN_CMD_DFT}, + { PT_CMD_SET_GPIO, PKT_VARLEN , PLEN_CMD_DFT}, + { PT_CMD_READ_GPIO, PKT_VARLEN , PLEN_CMD_DFT}, + { PT_CMD_LE_SET_PAIRING, PKT_VARLEN , PLEN_CMD_DFT}, + { PT_CMD_LE_SET_ADV_DATA, PKT_VARLEN , PLEN_CMD_DFT}, + { PT_CMD_LE_SET_SCAN_DATA, PKT_VARLEN , PLEN_CMD_DFT}, + { PT_CMD_LE_SEND_CONN_UPDATE_REQ, PKT_VARLEN , PLEN_CMD_DFT}, + { PT_CMD_LE_SET_ADV_PARM, PKT_VARLEN , PLEN_CMD_DFT}, + { PT_CMD_LE_START_PAIRING, PKT_VARLEN , PLEN_CMD_DFT}, + + { PT_CMD_SET_WAKE_GPIO, PKT_VARLEN , PLEN_CMD_DFT}, + { PT_CMD_SET_TX_POWER, PKT_VARLEN , PLEN_CMD_DFT}, + { PT_CMD_LE_CONFIRM_GKEY, PKT_VARLEN , PLEN_CMD_DFT}, + { PT_CMD_REJECT_JUSTWORK, PKT_VARLEN , PLEN_CMD_DFT}, + + { PT_CMD_RESET_CHIP_REQ, PKT_VARLEN , PLEN_CMD_DFT}, + + { PT_CMD_LE_SET_FIXED_PASSKEY, PKT_VARLEN , PLEN_CMD_DFT}, + + { PT_CMD_DELETE_CUSTOMIZE_SERVICE, PKT_VARLEN , PLEN_CMD_DFT}, + { PT_CMD_ADD_SERVICE_UUID, PKT_VARLEN , PLEN_CMD_DFT}, + { PT_CMD_ADD_CHARACTERISTIC_UUID, PKT_VARLEN , PLEN_CMD_DFT}, + +}; + +static uint8_t pkt_find(struct pt_pkt *hdr, const struct pkt_desc *desc, uint8_t desc_size) +{ + uint8_t idx; + bool find = false; + + for (idx = 0; idx < desc_size; idx++) + { + if (hdr->code > desc[idx].code) + { + continue; + } + else + { + if (hdr->code == desc[idx].code) + { + find = true; + } + break; + } + } + + if (!find) + return PT_ERR_CODE; + + if ((desc[idx].pfmt & PKT_LEN_MSK) == PKT_VARLEN) + { + if (hdr->len > desc[idx].plen) + return PT_ERR_LEN; + } + else // PKT_FIXLEN + { + if (hdr->len != desc[idx].plen) + return PT_ERR_LEN; + } + + return desc[idx].pfmt; //PT_OK; +} + +uint8_t pkt_hdr_valid(struct pt_pkt *p_hdr) +{ + uint8_t status = PT_ERR_HEAD; + + if (p_hdr->type == PT_TYPE_CMD) + { + return pkt_find(p_hdr, pt_cmd_desc, PKT_CMD_CNT); + } + + return status; +} + +uint8_t pkt_crc8(uint8_t *buff, uint16_t len) +{ + uint16_t i; + uint8_t crc = PKT_CRC_SEED; + + for (i = 0; i < len; i++) + { + crc ^= buff[i]; + } + return crc; +} diff --git a/projects/bleUartCMD/src/protocol/pt_sch.c b/projects/bleUartCMD/src/protocol/pt_sch.c new file mode 100644 index 0000000..6cfff4d --- /dev/null +++ b/projects/bleUartCMD/src/protocol/pt_sch.c @@ -0,0 +1,148 @@ +#include +#include +#include +#include "proto.h" +#include "pt_env.h" +#include "sftmr.h" + +/// Protocol Parse +static void proto_read_sync(proto_t *pt) +{ + pt->rx_state = PT_STATE_SYNC; + pt->rx_size = HDR_SYNC_SIZE; + pt->rx_ptr = pt->pkt + HDR_SYNC_POS; +} + +static void proto_read_hdr(proto_t *pt) +{ + pt->rx_state = PT_STATE_HDR; + pt->rx_size = HDR_CMD_SIZE + HDR_LEN_SIZE; + pt->rx_ptr = pt->pkt + HDR_CMD_POS; +} + +static void proto_read_payl(proto_t *pt) +{ + pt->rx_state = PT_STATE_PAYL; + pt->rx_size = pt->pkt[2]; + pt->rx_ptr = pt->pkt + PKT_PAYL_POS; +} + +static void proto_received(proto_t *pt) +{ + bool finish = false; + struct pt_pkt *pkt = (struct pt_pkt *)(pt->pkt); + + switch (pt->rx_state) + { + case PT_STATE_SYNC: + { + if (pkt->type == PT_TYPE_CMD) + { + proto_read_hdr(pt); + } + else + { + proto_read_sync(pt); + } + } break; + + case PT_STATE_HDR: + { + pt->rx_pfmt = pkt_hdr_valid(pkt); + + if ((pt->rx_pfmt >= PT_ERROR) || (pkt->len == 0)) + { + // Hdr error or Short code + finish = true; + } + else + { + proto_read_payl(pt); // more data + } + } break; + + case PT_STATE_PAYL: + { + finish = true; + + } break; + + default: + break; + } + + if (finish) + { + uint8_t status = (pt->rx_pfmt >= PT_ERROR) ? pt->rx_pfmt : PT_OK; + + pt->parse(pkt, status); + + proto_read_sync(pt); + } +} + +#if (PT_TOUT_CNT) + +static void proto_timeout(proto_t *pt) +{ + if (pt->rx_state == PT_STATE_SYNC) + return; + + // calc timeout + if ((tmr_tk_t)(sftmr_tick() - pt->rx_tick) > PT_TOUT_CNT) + { + + if (pt->rx_state == PT_STATE_PAYL) + { + struct pt_pkt *pkt = (struct pt_pkt *)(pt->pkt); + + pt->parse(pkt, PT_ERR_TIMEOUT); + } + + proto_read_sync(pt); + + } + +} +#endif + +/// Protocol API +void pt_sch_proc(proto_t *pt) +{ + if (pt->rx_size > 0) + { + uint16_t len = pt->read(pt->rx_ptr, pt->rx_size); + + if (len > 0) + { + pt->rx_size -= len; + pt->rx_ptr += len; + + if (pt->rx_size == 0) + { + proto_received(pt); + } +#if (PT_TOUT_CNT) + pt->rx_tick = sftmr_tick(); + } + else + { + proto_timeout(pt); + } +#else + } +#endif + } +} + +void pt_sch_init(proto_t *pt, uint8_t *buf, read_fnct read, parse_fnct parse) +{ + memset(pt, 0, sizeof(proto_t)); + + pt->read = read; + pt->parse = parse; + pt->pkt = buf; + + proto_read_sync(pt); +} + diff --git a/projects/bleUartCMD/src/ptdefs.h b/projects/bleUartCMD/src/ptdefs.h new file mode 100644 index 0000000..d0db014 --- /dev/null +++ b/projects/bleUartCMD/src/ptdefs.h @@ -0,0 +1,291 @@ +#ifndef _PTDEFS_H_ +#define _PTDEFS_H_ + +#include + +#ifndef BIT +#define BIT(pos) (0x01UL << (pos)) +#endif + +#ifndef RD_32 +#define RD_32(addr) (*(volatile uint32_t *)(addr)) +#define WR_32(addr,value) (*(volatile uint32_t *)(addr)) = (value) +#endif + +/// Version +#define VER_CHIPSET 0x0106 +#define VER_BURNER 0x0106 //1.06 +#define VER_BATCH 0x0106 //1.06 + + +#define ADC_TO_CURR(adc, r) ((((adc + 1) * 3300) >> 12) / r) // mA = mV/R, R=10 +#define KHZ_TO_XTAL(val) ((val * 1000) / 150) // KHz -> XtalOffset, 150=2400/16MHz + +#define IS_NONE(value) (((value)== 0xFFFFFFFF) || ((value) == 0x00)) +#define IS_HIBE(value, msb) ((((value) >> 24) & 0xFF) == (msb)) + +//#define MACC_START_GETSET(cidx) ((gBchFirm.macCFG.nstart) + (IS_NONE(gChnFirm.macConfig) ? 0 : (((((gChnFirm.macConfig) >> 8) & 0xFFFFFF) * ((gChnFirm.macConfig) & 0xFF)) * (cidx)))) + + +/// PageSize +#define RAM_PAGE_SIZE (0x100) +#define FSH_PAGE_SIZE (0x100) +#define ADDR2PAGE(addr) ((uint16_t)(((addr) >> 8) & 0xFFFF)) +#define ADDR2PAGE_H(addr) ((uint16_t)((((addr) + 255) >> 8) & 0xFFFF)) + +/// Address +#define CHIP_SDRV_ADDR 0x08000000 + +#define FSH_ADDR_CODE_INFO 0x18000000 +#define FSH_ADDR_SDRV_INFO 0x18000010 // burner +#define FSH_ADDR_CODE_BASE 0x18001000 +#define FSH_ADDR_SDRV_BASE 0x18005000 + +#define FSH_ADDR_FIRM_INFO 0x18008000 +#define FSH_ADDR_MAC_INFO 0x18008100 +#define FSH_ADDR_FIRM_BASE 0x18008200 + + +/// Operations of ptTest +enum pt_opcode +{ + OP_NULL, + + // burner op + OP_LOAD_SDRV, + OP_ONLINE_MD, + + OP_BURN_CHIP, + OP_TEST_CHIP, + + // batch op + OP_SYNC_INFO, + + OP_BURN_CHAN, /* Update */ + OP_BURN_FIRM, /* Download */ + + OP_RUN_START, + OP_RUN_STATE, +}; + +/// States of ptTest +enum pt_state +{ + PSTA_NULL = 0x00, // Initization + + PSTA_BUSY = BIT(0), // 0:IDLE, 1:BUSY + PSTA_OK = BIT(1), // Result OK + PSTA_FAIL = BIT(2), // Result Fail + PSTA_ERROR = BIT(3), // Result Error + + PSTA_ONLINE = BIT(4), // 0:OFF line, 1:ON line(PC/Batch) + PSTA_MANUAL = BIT(5), // 0:Auto Op, 1:Manual Op + PSTA_SYNCED = BIT(6), // 0:not, 1:sdrv synced +}; + +/// Errors of ptTest +enum pt_error +{ + PERR_NO_ERROR = 0x00, // sucess + PERR_XX_STATE = 0x01, // invalid + + PERR_CHAN_SET, + PERR_FIRM_CFG, + + PERR_BURN_FAIL, //= 0x01, +// PERR_NO_CODE , //= 0x02, + PERR_RSP , //= 0x03, + PERR_TIME_OUT, //= 0x04, +// PERR_BOOT , //= 0x05, + PERR_MAC_END , //= 0x06, + + PERR_RUN_FAIL, + + PERR_TEST_FAIL, //= 0x07, + PERR_TEST_PWR , //= 0x07, + PERR_TEST_XTAL, //= 0x08, + PERR_TEST_GPIO, //= 0x09, + PERR_TEST_RF , //= 0x0A, + + PERR_UNKNOWN , //= 0x0B, +}; + +/// Test-step in order +enum test_step +{ + TEST_PWR, + TEST_GPIO, + TEST_XTAL, + TEST_RF, + + TEST_MAX, +}; + +enum chns_mode +{ + CHNS_DOWNLOAD, + CHNS_UPDATE +}; + +enum chns_state +{ + CHAN_FOUND = 0x00, + + CHAN_START = 0x01, + CHAN_SUCCESS = 0x02, + + CHAN_ERR_SYNC = 0x03, + CHAN_ERR0_CODECRC = 0x04, + CHAN_ERR1_MAC = 0x05, + CHAN_ERR2_MAC_START = 0x06, + CHAN_ERR3_MAC_CONFIG = 0x07, + CHAN_ERR4_UNKNOWN = 0x08, +}; + +/// Structure +typedef struct +{ + uint32_t sdrvLen; + uint32_t sdrvAddr; +} sdrvInfo_t; + +//typedef struct +//{ +// // Base Info @see BOOT +// uint32_t magicCode; +// uint32_t codeLen; +// uint32_t codeAddr; +// uint32_t sramAddr; +// +// // Extend Info +// uint32_t dataLen; +// uint32_t dataAddr; +// uint32_t macOffset; // dataAddr @see firmInfo_t +// uint32_t macStart; +// uint32_t macConfig; //1byte:increment 3bytecount +// uint32_t chipBaud; // chipSet uart2 baud +// uint32_t firmCRC; +// +// uint32_t testCfg; //bit0:curr +// uint32_t gpioMsk; +// uint8_t workCurr; +// uint8_t xtalVal; +// uint8_t xtalPio; +// uint8_t rfChan; +//} firmInfo_t; + +enum fw_bconf +{ + FW_BURN_OTP_POS = 0, + FW_BURN_CODE_POS = 1, + FW_BURN_DATA_POS = 2, + FW_BURN_MAC_POS = 3, + + FW_BURN_BAUD_POS = 4, + + FW_RESET_RUN_POS = 6, + FW_ERASE_ALL_POS = 7, +}; + +enum fw_tconf +{ + FW_TEST_PWR_POS = 0, + FW_TEST_GPIO_POS = 1, + FW_TEST_XTAL_POS = 2, + FW_TEST_RF_POS = 3, + + FW_TEST_CFG_MSK = 0x0F, +}; + +#define FWCFG_EN(cfg) (1 << FW_##cfg##_POS) + +/// Firmware Configure, align32 +typedef union +{ + struct + { + uint8_t bConf; // burn cfgBits + uint8_t tConf; // test cfgBits @see test_step + uint8_t uRate; // uart Rate*115200 + uint8_t bChns; // batch Channls + }; + uint32_t Word; +} fwconf_t; + +/// MAC Configure, align32 +typedef struct +{ + uint32_t offset; + uint32_t nstart; + uint16_t ncount; + uint16_t ndelta; +} maccfg_t; + +/// Test Configure, align32 +typedef struct +{ + uint32_t gpioMsk; + uint8_t pwrCurr; + uint8_t xtalVal; + uint8_t xtalPio; + uint8_t rfChanl; +} tstcfg_t; + +typedef struct +{ + // Base Info @see BOOT + uint32_t magicCode; + uint32_t codeLen; + uint32_t codeAddr; + uint32_t sramAddr; + + // Extend Info + uint32_t dataLen; + uint32_t dataAddr; + + uint32_t firmCRC; + fwconf_t firmCFG; + + tstcfg_t testCFG; + maccfg_t macCFG; +} firmInfo_t; + +typedef struct +{ + uint16_t pwrVadc; + uint16_t xtalCnt; + uint8_t xtalCap; + uint8_t gpioRes; + uint8_t rfRxRec; + uint8_t rfTxRec; +} testInfo_t; + +typedef struct +{ + uint32_t cntCurr; + uint32_t macCurr; +} macInfo_t; + +typedef struct +{ + uint8_t state; + uint8_t error; + uint8_t opCode; + uint8_t opStep; +} burner_t; + +typedef struct +{ + uint8_t state; + uint8_t error; + uint8_t opCode; + uint8_t opStep; + + uint8_t gChans; + uint8_t chsSet; + uint8_t chsErr; + uint8_t chsIdx; +} batch_t; + + +#endif // _PTDEFS_H_ diff --git a/projects/bleUartCMD/蓝牙串口透传协议说明书.docx b/projects/bleUartCMD/蓝牙串口透传协议说明书.docx new file mode 100644 index 0000000..bb85e82 Binary files /dev/null and b/projects/bleUartCMD/蓝牙串口透传协议说明书.docx differ diff --git a/projects/bleWeChat/bleWX.bin b/projects/bleWeChat/bleWX.bin new file mode 100644 index 0000000..db0df5d Binary files /dev/null and b/projects/bleWeChat/bleWX.bin differ diff --git a/projects/bleWeChat/mdk/JLinkSettings.ini b/projects/bleWeChat/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/projects/bleWeChat/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/projects/bleWeChat/mdk/bleWeChat.uvoptx b/projects/bleWeChat/mdk/bleWeChat.uvoptx new file mode 100644 index 0000000..2bf8c22 --- /dev/null +++ b/projects/bleWeChat/mdk/bleWeChat.uvoptx @@ -0,0 +1,614 @@ + + + + 1.0 + +
    ### uVision Project, (C) Keil Software
    + + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + bleUart + 0x4 + ARM-ADS + + 12000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + JL2CM3 + -U59701300 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC1000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + DLGUARM + + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + 0 + 0 + 515 + 1 +
    402743126
    + 0 + 0 + 0 + 0 + 0 + 1 + ..\src\custom\prf_sess_weChat.c + + \\bleWX\../src/custom/prf_sess_weChat.c\515 +
    + + 1 + 0 + 529 + 1 +
    0
    + 0 + 0 + 0 + 0 + 0 + 0 + ..\src\custom\prf_sess_weChat.c + + +
    +
    + + + 0 + 1 + pkt_t + + + 1 + 1 + pkt + + + 2 + 1 + uart1_rxd + + + 3 + 1 + uart1_rxd + + + + + 0 + 2 + pkt + + + + + 1 + 2 + 0x20007F00 + 0 + + + + + 2 + 1 + 0x18004000 + 0 + + + + + 3 + 10 + 0x200059D6 + 0 + + + + + 4 + 10 + 0x20004314 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + +
    +
    + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\src\myapp.c + myapp.c + 0 + 0 + + + 2 + 5 + 1 + 0 + 0 + 0 + ..\src\proc.c + proc.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 6 + 5 + 0 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 7 + 4 + 0 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + modules + 1 + 0 + 0 + 0 + + 4 + 8 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\leds.c + leds.c + 0 + 0 + + + 4 + 9 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\sftmr.c + sftmr.c + 0 + 0 + + + 4 + 10 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\uart1Rb.c + uart1Rb.c + 0 + 0 + + + + + ble\app + 1 + 0 + 0 + 0 + + 5 + 11 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app.c + app.c + 0 + 0 + + + 5 + 12 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_msg.c + app_msg.c + 0 + 0 + + + 5 + 13 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gapm.c + app_gapm.c + 0 + 0 + + + 5 + 14 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gapc.c + app_gapc.c + 0 + 0 + + + 5 + 15 + 1 + 0 + 0 + 0 + ..\..\..\ble\app\app_gatt.c + app_gatt.c + 0 + 0 + + + 5 + 16 + 1 + 0 + 0 + 0 + ..\src\custom\app_actv_weChat.c + app_actv_weChat.c + 0 + 0 + + + + + ble\prf + 1 + 0 + 0 + 0 + + 6 + 17 + 1 + 0 + 0 + 0 + ..\..\..\ble\prf\prf_diss.c + prf_diss.c + 0 + 0 + + + 6 + 18 + 1 + 0 + 0 + 0 + ..\src\custom\prf_sess_weChat.c + prf_sess_weChat.c + 0 + 0 + + + + + ble\lib + 1 + 0 + 0 + 0 + + 7 + 19 + 4 + 0 + 0 + 0 + ..\..\..\ble\lib\ble6.lib + ble6.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 8 + 20 + 1 + 0 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + + + wechat + 0 + 0 + 0 + 0 + + + + wechatProducts + 0 + 0 + 0 + 0 + + + + wechatCommon + 0 + 0 + 0 + 0 + + +
    diff --git a/projects/bleWeChat/mdk/bleWeChat.uvprojx b/projects/bleWeChat/mdk/bleWeChat.uvprojx new file mode 100644 index 0000000..4069be0 --- /dev/null +++ b/projects/bleWeChat/mdk/bleWeChat.uvprojx @@ -0,0 +1,539 @@ + + + + 2.1 + +
    ### uVision Project, (C) Keil Software
    + + + + bleUart + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(12000000) ELITTLE + + + + 0 + + + + + + + + + + + + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + bleWX + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --c99 --thumb --gnu --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf;..\src\custom + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip_ble.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + myapp.c + 1 + ..\src\myapp.c + + + proc.c + 1 + ..\src\proc.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + modules + + + leds.c + 1 + ..\..\..\modules\src\leds.c + + + sftmr.c + 1 + ..\..\..\modules\src\sftmr.c + + + uart1Rb.c + 1 + ..\..\..\modules\src\uart1Rb.c + + + + + ble\app + + + app.c + 1 + ..\..\..\ble\app\app.c + + + app_msg.c + 1 + ..\..\..\ble\app\app_msg.c + + + app_gapm.c + 1 + ..\..\..\ble\app\app_gapm.c + + + app_gapc.c + 1 + ..\..\..\ble\app\app_gapc.c + + + app_gatt.c + 1 + ..\..\..\ble\app\app_gatt.c + + + app_actv_weChat.c + 1 + ..\src\custom\app_actv_weChat.c + + + + + ble\prf + + + prf_diss.c + 1 + ..\..\..\ble\prf\prf_diss.c + + + prf_sess_weChat.c + 1 + ..\src\custom\prf_sess_weChat.c + + + + + ble\lib + + + ble6.lib + 4 + ..\..\..\ble\lib\ble6.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + wechat + + + wechatProducts + + + wechatCommon + + + + + + + + + + + +
    diff --git a/projects/bleWeChat/mdk/clean.bat b/projects/bleWeChat/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/projects/bleWeChat/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/projects/bleWeChat/src/cfg.h b/projects/bleWeChat/src/cfg.h new file mode 100644 index 0000000..68ad9a3 --- /dev/null +++ b/projects/bleWeChat/src/cfg.h @@ -0,0 +1,64 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// System Clock(0=16MHz, 1=32MHz, 2=48MHz, 3=64MHz) +#define SYS_CLK (0) + +/// Debug Mode(0=Disable, 1=via UART, 2=via RTT) +#define DBG_MODE (1) + +#define BLE_HEAP_BASE (0x20003A00) +#define BLE_HEAP_ENV_SIZE (0xC00) +#define BLE_HEAP_MSG_SIZE (0x2000) +#define BLE_HEAP_SIZE (BLE_HEAP_ENV_SIZE + BLE_HEAP_MSG_SIZE) + +/// BLE Configure (Single or Multi-Connections) +#define BLE_NB_SLAVE (1) +#define BLE_NB_MASTER (0) + +#define BLE_ADDR {0x66, 0x08, 0x32, 0xA1, 0x01, 0xD2} +#define BLE_ADDR_B {0xD2, 0x01, 0xA1, 0x32, 0x08, 0x66} + +#define BLE_DEV_NAME "WX-AirSync" +#define BLE_DEV_ICON 0x0000 + +#define APP_ADV_INT_MIN (32) // unit in 0.625ms +#define APP_ADV_INT_MAX (32) // unit in 0.625ms + +/// Profile Configure +#define PRF_DISS (1) +#define PRF_SESS (1) + +/// Serial Service @see prf_sess.h +#define SES_UUID_128 (0) +#define SES_READ_SUP (1) + +/// Debug Configure +#if (DBG_MODE) + #define DBG_APP (0) + #define DBG_PROC (1) + #define DBG_ACTV (1) + #define DBG_GAPM (0) + #define DBG_GAPC (1) + + #define DBG_DISS (0) + #define DBG_SESS (1) + +#endif + +/// Misc Options +#define LED_PLAY (1) +#define CFG_SLEEP (0) + + +#endif //_APP_CFG_H_ diff --git a/projects/bleWeChat/src/custom/app_actv_weChat.c b/projects/bleWeChat/src/custom/app_actv_weChat.c new file mode 100644 index 0000000..0d470f9 --- /dev/null +++ b/projects/bleWeChat/src/custom/app_actv_weChat.c @@ -0,0 +1,973 @@ +/** + **************************************************************************************** + * + * @file app_actv.c + * + * @brief Application Activity(Advertising, Scanning and Initiating) - Example + * + **************************************************************************************** + */ + +#include "app.h" +#include "gapm_api.h" + +#if (DBG_ACTV) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Index & State of activities - User Customize +struct actv_env_tag +{ + #if (BLE_EN_ADV) + /// Advertising index and state + uint8_t advidx; + uint8_t advsta; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + /// Scanning index and state + uint8_t scanidx; + uint8_t scansta; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + /// Initiating index and state + uint8_t initidx; + uint8_t initsta; + #endif //(BLE_EN_INIT) +}; + +/// Activities environment +struct actv_env_tag actv_env; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @section Advertising Activity - Example for User Customize + * enable via pre-define @see BLE_EN_ADV + **************************************************************************************** + */ +#if (BLE_EN_ADV) + +#undef DEBUG +#if (DBG_ACTV) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// Advertising duration - 0 mean Always ON (in multiple of 10ms) +#if !defined(APP_ADV_DURATION) + #define APP_ADV_DURATION (0) +#endif + +/// Advertising channel map - 37, 38, 39 +#if !defined(APP_ADV_CHMAP) + #define APP_ADV_CHMAP (0x07) +#endif + +/// Advertising minimum interval - (n)*0.625ms +#if !defined(APP_ADV_INT_MIN) + #define APP_ADV_INT_MIN (64) +#endif + +/// Advertising maximum interval - (n)*0.625ms +#if !defined(APP_ADV_INT_MAX) + #define APP_ADV_INT_MAX (160) +#endif + +#if (APP_ADV_INT_MIN > APP_ADV_INT_MAX) + #error "ADV_INT_MIN must not exceed ADV_INT_MAX" +#endif + +/// Fast advertising interval +#define APP_ADV_FAST_INT (32) + +/// Flag of Fixed data +//#define APP_ADV_FIXED_DATA (0) + +#if (APP_ADV_FIXED_DATA) +/** + * ADV Unit: 1B(Len=1+n) 1B(Type) nB(Data), @see gap_ad_type + * -------------------------------------------------------------------------------------- + * x03 - Length + * x03 - Service 16-bit UUIDs List type + * x00\xFF - Custom Serial Profile:0xFF00 + * x03 - Length + * x19 - Appearance type + * x00\x00 - Unknow Device + * x09 - Length + * x09 - Complete Name type + * Ble5.2 - Device Name + * -------------------------------------------------------------------------------------- + */ +#define APP_ADV_DATA "\x03\x03\x00\xFF\x03\x19\x00\x00\x09\x09Ble5.2" +#define APP_ADV_DATA_LEN (sizeof(APP_ADV_DATA)-1) + +/** + * Scan response data (ADV Unit), @see gap_ad_type + * -------------------------------------------------------------------------------------- + * x09 - Length + * xFF - Vendor specific advertising type + * xC5\x09\x48\x59\x2D\x42\x4C\x45 - CompId(0x09C5) + Serial(HY-BLE) + * x09 - Length + * x09 - Complete Name type + * Ble5.2 - Device Name + * -------------------------------------------------------------------------------------- + */ +#define APP_SCNRSP_DATA "\x09\xFF\xC5\x09\x48\x59\x2D\x42\x4C\x45" +#define APP_SCNRSP_DATA_LEN (sizeof(APP_SCNRSP_DATA)-1) +#endif // (APP_ADV_FIXED_DATA) + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +static void app_adv_create(void) +{ + struct gapm_adv_create_param adv_param; + + // Advertising type (@see enum gapm_adv_type) + adv_param.type = GAPM_ADV_TYPE_LEGACY; + // Discovery mode (@see enum gapm_adv_disc_mode) + adv_param.disc_mode = GAPM_ADV_MODE_GEN_DISC; + // Advertising properties (@see enum gapm_adv_prop) + #if (DBG_GAPM) + adv_param.prop = GAPM_ADV_PROP_UNDIR_CONN_MASK | GAPM_ADV_PROP_SCAN_REQ_NTF_EN_BIT; + #else + adv_param.prop = GAPM_ADV_PROP_UNDIR_CONN_MASK; + #endif + // Filtering policy (@see enum gapm_adv_filter_policy) + adv_param.filter_pol = GAPM_ADV_ALLOW_SCAN_ANY_CON_ANY; + // Config primary advertising (@see gapm_adv_prim_cfg) + adv_param.prim_cfg.phy = GAP_PHY_LE_1MBPS; + adv_param.prim_cfg.chnl_map = APP_ADV_CHMAP; + adv_param.prim_cfg.adv_intv_min = APP_ADV_INT_MIN; + adv_param.prim_cfg.adv_intv_max = APP_ADV_INT_MAX; + + DEBUG("create(disc:%d,prop:%d)\r\n", adv_param.disc_mode, adv_param.prop); + + gapm_create_advertising(GAPM_STATIC_ADDR, &adv_param); +} + +#include "weChat.h" + +static void app_adv_set_adv_data(void) +{ +#if (APP_ADV_FIXED_DATA) + gapm_set_adv_data(actv_env.advidx, GAPM_SET_ADV_DATA, + APP_ADV_DATA_LEN, (const uint8_t *)APP_ADV_DATA); +#else + // Reserve 3Bytes for AD_TYPE_FLAGS + uint8_t adv_data[GAP_ADV_DATA_LEN]; + uint8_t length = 17; + + // Set flags: 3B + adv_data[0] = 0x02; + adv_data[1] = GAP_AD_TYPE_FLAGS; // 0x01 0xFF;// + adv_data[2] = 0x06; + + // Set list of UUIDs: 4B + adv_data[3] = 0x03; + adv_data[4] = GAP_AD_TYPE_COMPLETE_LIST_16_BIT_UUID; // 0x02 + #if (PRF_HIDS) + write16p(&adv_data[5], 0x1812); // HID Service + #else + write16p(&adv_data[5], 0xFEE7); // Serial Service + #endif + + // Set Manufacturer: 10B + adv_data[7] = 0x09; + adv_data[8] = GAP_AD_TYPE_MANU_SPECIFIC_DATA; // 0xFF + write16p(&adv_data[9], 0x050E); // CHIP ID 2B + + for(uint8_t idx = 0; idx < GAP_BD_ADDR_LEN; idx++) + { + //BIG MAC 6B + adv_data[11+idx] = ble_dev_addr.addr[GAP_BD_ADDR_LEN - 1 - idx]; + } + + gapm_set_adv_data(actv_env.advidx, GAPM_SET_ADV_DATA, length, adv_data); +#endif +} + +static void app_adv_set_scan_rsp(void) +{ +#if (APP_ADV_FIXED_DATA) + gapm_set_adv_data(actv_env.advidx, GAPM_SET_SCAN_RSP_DATA, + APP_SCNRSP_DATA_LEN, (const uint8_t *)APP_SCNRSP_DATA); +#else + uint8_t length; + uint8_t rsp_data[DEV_NAME_MAX_LEN+2]; + + // Set device name + length = app_name_get(DEV_NAME_MAX_LEN, &rsp_data[2]); + rsp_data[0] = length + 1; + rsp_data[1] = GAP_AD_TYPE_COMPLETE_NAME; // 0x09 + length += 2; + + // Set Manufacturer: 11B + rsp_data[length++] = 10; + rsp_data[length++] = GAP_AD_TYPE_MANU_SPECIFIC_DATA; // 0xFF + rsp_data[length++] = 0xFE; + rsp_data[length++] = 0x01; + rsp_data[length++] = 0x01; + + for(uint8_t idx = 0; idx < GAP_BD_ADDR_LEN; idx++) + { + //BIG MAC 6B + rsp_data[length+idx] = ble_dev_addr.addr[GAP_BD_ADDR_LEN - 1 - idx]; + } + length += GAP_BD_ADDR_LEN; + + gapm_set_adv_data(actv_env.advidx, GAPM_SET_SCAN_RSP_DATA, length, rsp_data); +#endif +} + +/** + **************************************************************************************** + * @brief Action/Command of Advertising + * + * @param[in] actv_op Operation of activity + **************************************************************************************** + */ +void app_adv_action(uint8_t actv_op) +{ + switch (actv_op) + { + case ACTV_CREATE: + { + if (actv_env.advsta == ACTV_STATE_OFF) + { + //DEBUG("Creating"); + app_adv_create(); + actv_env.advsta = ACTV_STATE_CREATE; + } + } break; + + case ACTV_START: + { + if (actv_env.advsta == ACTV_STATE_READY) + { + DEBUG("Starting"); + gapm_start_advertising(actv_env.advidx, APP_ADV_DURATION); + actv_env.advsta = ACTV_STATE_START; + } + } break; + + case ACTV_STOP: + { + if (actv_env.advsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_STOP; + } + } break; + + case ACTV_DELETE: + { + if ((actv_env.advsta != ACTV_STATE_OFF) && (actv_env.advsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_OFF; + } + } break; + + case ACTV_RELOAD: + { + if (actv_env.advsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_STOP; + } + + if ((actv_env.advsta != ACTV_STATE_OFF) && (actv_env.advsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.advidx); + actv_env.advsta = ACTV_STATE_OFF; + } + + app_adv_create(); + actv_env.advsta = ACTV_STATE_CREATE; + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Event Procedure of Advertising + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_adv_event(uint8_t gapm_op, uint8_t status) +{ + DEBUG("Evt(op:0x%X,sta:0x%X)", gapm_op, status); + + switch (gapm_op) + { + case (GAPM_CREATE_ADV_ACTIVITY): + { + app_adv_set_adv_data(); + } break; + + case (GAPM_SET_ADV_DATA): + { + app_adv_set_scan_rsp(); + } break; + + case (GAPM_SET_SCAN_RSP_DATA): + { + actv_env.advsta = ACTV_STATE_READY; + + app_adv_action(ACTV_START); + app_state_set(APP_READY); + } break; + + case (GAPM_STOP_ACTIVITY): + { + if ((actv_env.advsta == ACTV_STATE_START) || (actv_env.advsta == ACTV_STATE_STOP)) + { + actv_env.advsta = ACTV_STATE_READY; + } + } break; + + default: + break; + } +} + +#endif //(BLE_EN_ADV) + + +/** + **************************************************************************************** + * @section Scanning Activity - Example for User Customize + * enable via pre-define @see BLE_EN_SCAN + **************************************************************************************** + */ +#if (BLE_EN_SCAN) + +#undef DEBUG +#if (DBG_ACTV) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +#define SCAN_NUM_MAX (5) + +uint8_t scan_cnt = 0; +struct gap_bdaddr scan_addr_list[SCAN_NUM_MAX]; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +static void app_start_scanning(void) +{ + struct gapm_scan_param scan_param; + + /// Type of scanning to be started (@see enum gapm_scan_type) + scan_param.type = GAPM_SCAN_TYPE_CONN_DISC; + /// Properties for the scan procedure (@see enum gapm_scan_prop) + scan_param.prop = GAPM_SCAN_PROP_PHY_1M_BIT | GAPM_SCAN_PROP_ACTIVE_1M_BIT | GAPM_SCAN_PROP_FILT_TRUNC_BIT; + /// Duplicate packet filtering policy (@see enum gapm_dup_filter_pol) + scan_param.dup_filt_pol = GAPM_DUP_FILT_EN; + /// Scan window opening parameters for LE 1M PHY (in unit of 625us) + scan_param.scan_param_1m.scan_intv = GAP_SCAN_FAST_INTV; + scan_param.scan_param_1m.scan_wd = GAP_SCAN_FAST_WIND; + /// Scan window opening parameters for LE Coded PHY + //scan_param.scan_param_coded.scan_intv = GAP_SCAN_SLOW_INTV1; + //scan_param.scan_param_coded.scan_wd = GAP_SCAN_SLOW_WIND1; + /// Scan duration (in unit of 10ms). 0 means that the controller will scan continuously until + /// reception of a stop command from the application + scan_param.duration = 500;//GAP_TMR_GEN_DISC_SCAN; + /// Scan period (in unit of 1.28s). Time interval betweem two consequent starts of a scan duration + /// by the controller. 0 means that the scan procedure is not periodic + scan_param.period = 0; + + gapm_start_activity(actv_env.scanidx, sizeof(struct gapm_scan_param), &scan_param); +} + +/** + **************************************************************************************** + * @brief Action/Command of Scanning + * + * @param[in] actv_op Operation of activity + **************************************************************************************** + */ +void app_scan_action(uint8_t actv_op) +{ + switch (actv_op) + { + case ACTV_CREATE: + { + if (actv_env.scansta == ACTV_STATE_OFF) + { + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_SCAN, GAPM_STATIC_ADDR); + actv_env.scansta = ACTV_STATE_CREATE; + } + } break; + + case ACTV_START: + { + scan_cnt = 0; + + if (actv_env.scansta == ACTV_STATE_READY) + { + DEBUG("Starting"); + app_start_scanning(); + actv_env.scansta = ACTV_STATE_START; + } + } break; + + case ACTV_STOP: + { + if (actv_env.scansta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_STOP; + } + } break; + + case ACTV_DELETE: + { + if ((actv_env.scansta != ACTV_STATE_OFF) && (actv_env.scansta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_OFF; + } + } break; + + case ACTV_RELOAD: + { + if (actv_env.scansta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_STOP; + } + + if ((actv_env.scansta != ACTV_STATE_OFF) && (actv_env.scansta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.scanidx); + actv_env.scansta = ACTV_STATE_OFF; + } + + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_SCAN, GAPM_STATIC_ADDR); + actv_env.scansta = ACTV_STATE_CREATE; + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Event Procedure of Scanning + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_scan_event(uint8_t gapm_op, uint8_t status) +{ + DEBUG("Evt(op:0x%X,sta:0x%X)", gapm_op, status); + + switch (gapm_op) + { + case GAPM_CREATE_SCAN_ACTIVITY: + { + actv_env.scansta = ACTV_STATE_READY; + } break; + + case GAPM_STOP_ACTIVITY: + { + if ((actv_env.scansta == ACTV_STATE_START) || (actv_env.scansta == ACTV_STATE_STOP)) + { + actv_env.scansta = ACTV_STATE_READY; + } + + DEBUG("-->Filter DevAddr"); + for (uint8_t idx = 0; idx < scan_cnt; idx++) + { + DEBUG("Scan List[%d]-->", idx); + debugHex((uint8_t *)(&scan_addr_list[idx]), sizeof(struct gap_bdaddr)); + } + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Store result of Scanning when filter by app_actv_report_ind + * + * @param[in] paddr gap_bdaddr of peer device + **************************************************************************************** + */ +void app_scan_result(const struct gap_bdaddr* paddr) +{ + for (uint8_t i = 0; i < scan_cnt; i++) + { + if (!memcmp(&scan_addr_list[i], paddr,sizeof(struct gap_bdaddr)))//save addr but diffrent + { + return; + } + } + + if (scan_cnt < SCAN_NUM_MAX) //get null array + { + memcpy(&scan_addr_list[scan_cnt], paddr,sizeof(struct gap_bdaddr)); + scan_cnt++; + } +} + +/** + **************************************************************************************** + * @brief Handles activity report. (@see GAPM_EXT_ADV_REPORT_IND) + * + * @param[in] report Report of Advertising data be scanned + **************************************************************************************** + */ +void app_actv_report_ind(struct gapm_ext_adv_report_ind const* report) +{ + // filter report + if ((report->info & GAPM_REPORT_INFO_REPORT_TYPE_MASK) == GAPM_REPORT_TYPE_ADV_LEG) + { + const uint8_t *p_cursor = report->data; + const uint8_t *p_end_cusor = report->data + report->length; + + while (p_cursor < p_end_cusor) + { + // Extract AD type + uint8_t ad_type = *(p_cursor + 1); + + if (ad_type == GAP_AD_TYPE_APPEARANCE) + { + uint16_t icon = read16p(p_cursor+2); + + // Filter special appearance device + if ((icon == 0x03C1) || (icon == 0x03C5)) // HID Gamepad + { + app_scan_result(&report->trans_addr); + break; + } + } + else if ((ad_type == GAP_AD_TYPE_COMPLETE_LIST_16_BIT_UUID) || (ad_type == GAP_AD_TYPE_MORE_16_BIT_UUID)) + { + uint16_t uuid = read16p(p_cursor+2); + + // Filter special uuid device + if (((uuid == 0x18F0) || (uuid == 0xFF00)))// && (param->trans_addr.addr.addr[0] == 0x04)) + { + app_scan_result(&report->trans_addr); + break; + } + } + else + { + // Filter Rule more... + } + + /* Go to next advertising info */ + p_cursor += (*p_cursor + 1); + } + } +} +#endif //(BLE_EN_SCAN) + + +/** + **************************************************************************************** + * @section Initiating Activity - Example for User Customize + * enable via pre-define @see BLE_EN_INIT + **************************************************************************************** + */ +#if (BLE_EN_INIT) + +#undef DEBUG +#if (DBG_ACTV) +#include "dbg.h" +#define DEBUG(format, ...) debug("" format "\r\n", ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +const struct gap_bdaddr dflt_peer = +{ + .addr = {{0x11, 0x22, 0x33, 0xa1, 0x01, 0xd3}}, + .addr_type = ADDR_RAND, +}; + +const struct gapm_conn_param dflt_conn_param = +{ + /// Minimum value for the connection interval (in unit of 1.25ms). Allowed range is 7.5ms to 4s. + .conn_intv_min = 10, + /// Maximum value for the connection interval (in unit of 1.25ms). Allowed range is 7.5ms to 4s. + .conn_intv_max = 10, + /// Slave latency. Number of events that can be missed by a connected slave device + .conn_latency = 0, + /// Link supervision timeout (in unit of 10ms). Allowed range is 100ms to 32s + .supervision_to = 300, + /// Recommended minimum duration of connection events (in unit of 625us) + .ce_len_min = 2, + /// Recommended maximum duration of connection events (in unit of 625us) + .ce_len_max = 4, +}; + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Start initiating to peer device + * + * @param[in] paddr gap_bdaddr of peer device + **************************************************************************************** + */ +void app_start_initiating(const struct gap_bdaddr* paddr) +{ + if ((actv_env.initsta == ACTV_STATE_READY) || (actv_env.initsta == ACTV_STATE_STOP)) + { + struct gapm_init_param init_param; + + if (paddr == NULL) + { + paddr = &dflt_peer; + } + + init_param.type = GAPM_INIT_TYPE_DIRECT_CONN_EST; + init_param.prop = GAPM_INIT_PROP_1M_BIT; + init_param.scan_param_1m.scan_intv = GAP_SCAN_FAST_INTV; + init_param.scan_param_1m.scan_wd = GAP_SCAN_FAST_WIND; + + init_param.conn_param_1m = dflt_conn_param; + init_param.peer_addr = *paddr; + + gapm_start_activity(actv_env.initidx, sizeof(struct gapm_init_param), &init_param); + + DEBUG("Starting"); + actv_env.initsta = ACTV_STATE_START; + } +} + +/** + **************************************************************************************** + * @brief Action/Command of Initiating + * + * @param[in] actv_op Operation of activity + **************************************************************************************** + */ +void app_init_action(uint8_t actv_op) +{ + switch (actv_op) + { + case ACTV_CREATE: + { + if (actv_env.initsta == ACTV_STATE_OFF) + { + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_INIT, GAPM_STATIC_ADDR); + actv_env.initsta = ACTV_STATE_CREATE; + } + } break; + + case ACTV_START: + { + app_start_initiating(NULL); + } break; + + case ACTV_STOP: + { + if (actv_env.initsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_STOP; + } + } break; + + case ACTV_DELETE: + { + if ((actv_env.initsta != ACTV_STATE_OFF) && (actv_env.initsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_OFF; + } + } break; + + case ACTV_RELOAD: + { + if (actv_env.initsta == ACTV_STATE_START) + { + DEBUG("Stopping"); + gapm_stop_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_STOP; + } + + if ((actv_env.initsta != ACTV_STATE_OFF) && (actv_env.initsta != ACTV_STATE_START)) + { + DEBUG("Deleting"); + gapm_delete_activity(actv_env.initidx); + actv_env.initsta = ACTV_STATE_OFF; + } + + DEBUG("Creating"); + gapm_create_activity(GAPM_ACTV_TYPE_INIT, GAPM_STATIC_ADDR); + actv_env.initsta = ACTV_STATE_CREATE; + } break; + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Event Procedure of Initiating + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_init_event(uint8_t gapm_op, uint8_t status) +{ + DEBUG("Evt(op:0x%X,sta:0x%X)", gapm_op, status); + + switch (gapm_op) + { + case GAPM_CREATE_INIT_ACTIVITY: + { + actv_env.initsta = ACTV_STATE_READY; + } break; + + case GAPM_STOP_ACTIVITY: + { + if ((actv_env.initsta == ACTV_STATE_START) || (actv_env.initsta == ACTV_STATE_STOP)) + { + actv_env.initsta = ACTV_STATE_READY; + } + } break; + + default: + break; + } +} + +#endif //(BLE_EN_INIT) + + +/** + **************************************************************************************** + * @brief Create activities when Initialization complete. + **************************************************************************************** + */ +void app_actv_create(void) +{ + memset(&actv_env, 0, sizeof(actv_env)); + #if (BLE_EN_ADV) + app_adv_action(ACTV_CREATE); + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + app_scan_action(ACTV_CREATE); + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + app_init_action(ACTV_CREATE); + #endif //(BLE_EN_INIT) +} + +/** + **************************************************************************************** + * @brief Handles activity command complete event. + * + * @param[in] gapm_op Operation of gapm + * @param[in] status Status of event + **************************************************************************************** + */ +void app_actv_cmp_evt(uint8_t operation, uint8_t status) +{ + switch (operation) + { + #if (BLE_EN_ADV) + case (GAPM_CREATE_ADV_ACTIVITY): + case (GAPM_SET_ADV_DATA): + case (GAPM_SET_SCAN_RSP_DATA): + { + app_adv_event(operation, status); + } break; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + case GAPM_CREATE_SCAN_ACTIVITY: + { + app_scan_event(operation, status); + } break; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + case GAPM_CREATE_INIT_ACTIVITY: + { + app_init_event(operation, status); + } break; + #endif //(BLE_EN_INIT) + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Handles activity created. (@see GAPM_ACTIVITY_CREATED_IND) + * + * @param[in] actv_type Type of activities(@see enum gapm_actv_type) + * @param[in] actv_idx Index of activities created + **************************************************************************************** + */ +void app_actv_created_ind(uint8_t actv_type, uint8_t actv_idx) +{ + switch (actv_type) + { + #if (BLE_EN_ADV) + case GAPM_ACTV_TYPE_ADV: + { + actv_env.advidx = actv_idx; + } break; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + case GAPM_ACTV_TYPE_SCAN: + { + actv_env.scanidx = actv_idx; + } break; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + case GAPM_ACTV_TYPE_INIT: + { + actv_env.initidx = actv_idx; + } break; + #endif //(BLE_EN_INIT) + + default: + break; + } +} + +/** + **************************************************************************************** + * @brief Handles activity stopped. (@see GAPM_ACTIVITY_STOPPED_IND) + * + * @param[in] actv_type Type of activity(@see enum gapm_actv_type) + * @param[in] reason Reason of stopped + **************************************************************************************** + */ +void app_actv_stopped_ind(uint8_t actv_type, uint8_t actv_idx, uint8_t reason) +{ + switch (actv_type) + { + #if (BLE_EN_ADV) + case GAPM_ACTV_TYPE_ADV: + { + // Advertising Stopped by slave connection or duration timeout + app_adv_event(GAPM_STOP_ACTIVITY, reason); + + if (app_state_get() == APP_READY) + { + // Duration timeout, go IDLE + app_state_set(APP_IDLE); + } + #if (BLE_MULTI_CONN) + else if (app_state_get() == APP_CONNECTED) + { + if (ONE_BITS(app_env.conrole) < BLE_NB_SLAVE) + { + // Restart Advertising for more connections + app_adv_action(ACTV_START); + } + } + #endif //(BLE_MULTI_CONN) + } break; + #endif //(BLE_EN_ADV) + + #if (BLE_EN_SCAN) + case GAPM_ACTV_TYPE_SCAN: + { + app_scan_event(GAPM_STOP_ACTIVITY, reason); + } break; + #endif //(BLE_EN_SCAN) + + #if (BLE_EN_INIT) + case GAPM_ACTV_TYPE_INIT: + { + app_init_event(GAPM_STOP_ACTIVITY, reason); + } break; + #endif //(BLE_EN_INIT) + + default: + break; + } +} diff --git a/projects/bleWeChat/src/custom/prf_sess_weChat.c b/projects/bleWeChat/src/custom/prf_sess_weChat.c new file mode 100644 index 0000000..eb10f41 --- /dev/null +++ b/projects/bleWeChat/src/custom/prf_sess_weChat.c @@ -0,0 +1,549 @@ +/** + **************************************************************************************** + * + * @file prf_sess.c + * + * @brief Serial Service - Server Role Implementation. + * + * < If want to modify it, recommend to copy the file to 'user porject'/src > + **************************************************************************************** + */ + +#if (PRF_SESS) + +/* + * INCLUDE FILES + **************************************************************************************** + */ + +#include "prf.h" +#include "prf_sess_weChat.h" +#include "app.h" +#include "weChat.h" + +#if (DBG_SESS) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + + +/* + * DEFINITIONS + **************************************************************************************** + */ + +/// Max length of received once +#if !defined(SES_RXD_MAX_LEN) + #define SES_RXD_MAX_LEN (0x40) +#endif + +/// Max number of notify/indicate pkt +#if !defined(SES_NB_PKT_MAX) + #define SES_NB_PKT_MAX (5) +#endif + +/// Version String for SES_IDX_READ_VAL Read +#define SES_VERS_STR ("Ver:1.25") +#define SES_VERS_STR_LEN (sizeof(SES_VERS_STR) - 1) + +/// Macro for Client Config value operation +#define SES_NTF_CFG_GET(conidx) \ + ((sess_env.ntf_bits >> (conidx*2)) & (PRF_CLI_START_NTF | PRF_CLI_START_IND)) + +#define SES_NTF_CFG_CLR(conidx) \ + sess_env.ntf_bits &= ~((PRF_CLI_START_NTF | PRF_CLI_START_IND) << (conidx*2)) + +#define SES_NTF_CFG_SET(conidx, conf) \ + sess_env.ntf_bits = (sess_env.ntf_bits & ~((PRF_CLI_START_NTF | PRF_CLI_START_IND) << (conidx*2))) | ((conf) << (conidx*2)) + + +/** + **************************************************************************************** + * @section ENVIRONMENT DEFINITION + **************************************************************************************** + */ + +/// Server Environment Variable +typedef struct sess_env_tag +{ + // Service Start Handle + uint16_t start_hdl; + // Client Config of peer devices - each 2Bits(NTF & IND), so max_peer=8. + uint16_t ntf_bits; + // Number of notify pkt + uint8_t nb_pkt; +} sess_env_t; + +/// Global Variable Declarations +sess_env_t sess_env; + + +/** + **************************************************************************************** + * @section ATTRIBUTES DEFINITION + **************************************************************************************** + */ + +/// Attributes Index +enum ses_att_idx +{ + // Service Declaration, *MUST* Start at 0 + SES_IDX_SVC, + + // Serial RXD Char. + SES_IDX_RXD_CHAR, + SES_IDX_RXD_VAL, //5 + + // Serial TXD Char. + SES_IDX_TXD_CHAR, + SES_IDX_TXD_VAL, + SES_IDX_TXD_NTF_CFG, + + #if (SES_READ_SUP) + // Serial READ Char. + SES_IDX_READ_CHAR, + SES_IDX_READ_VAL, + #endif + + // Max Index, *NOTE* Minus 1(Svc Decl) is .nb_att + SES_IDX_NB, +}; + +#if (SES_UUID_128) +/// Characteristic Base UUID128 (User Customize) +#define SES_ATT_UUID128(uuid) { 0x16, 0x0A, 0x10, 0x40, 0xD1, 0x9F, 0x4C, 0x6C, \ + 0xB4, 0x55, 0xE3, 0xF7, (uuid) & 0xFF, (uuid >> 8) & 0xFF, 0x00, 0x00 } + +/// Serial Service UUID128 +const uint8_t ses_svc_uuid[] = SES_ATT_UUID128(0xFEE7); +/// Serial Write Command UUID128 +const uint8_t ses_char_rxd_write[] = SES_ATT_UUID128(0xFEC7); +/// Serial Notify UUID128 +const uint8_t ses_char_txd_notify[] = SES_ATT_UUID128(0xFEC8); +/// Serial Read Command UUID128 +const uint8_t ses_char_val_read[] = SES_ATT_UUID128(0xFEC9); + +/// Attributes Description +const att_decl_t ses_atts[] = +{ + // Serial Notify Char. Declaration and Value and Client Char. Configuration Descriptor + ATT_ELMT_DECL_CHAR( SES_IDX_TXD_CHAR ), + ATT_ELMT128( SES_IDX_TXD_VAL, ses_char_txd_notify, PROP_NTF | PROP_IND, 0 ), + ATT_ELMT_DESC_CLI_CHAR_CFG( SES_IDX_TXD_NTF_CFG ), + + // Serial Write Command Char. Declaration and Value + ATT_ELMT_DECL_CHAR( SES_IDX_RXD_CHAR ), + ATT_ELMT128( SES_IDX_RXD_VAL, ses_char_rxd_write, PROP_WC | PROP_WR, SES_RXD_MAX_LEN ), + + #if (SES_READ_SUP) + // Serial Read Command Char. Declaration and Value + ATT_ELMT_DECL_CHAR( SES_IDX_READ_CHAR ), + ATT_ELMT128( SES_IDX_READ_VAL, ses_char_val_read, PROP_RD, 0 ), + #endif //(SES_READ_SUP) +}; + +/// Service Description +const struct svc_decl ses_svc_db = +{ + .uuid128 = ses_svc_uuid, + .info = SVC_UUID(128), + .atts = ses_atts, + .nb_att = SES_IDX_NB - 1, +}; + +#else //(SESS_UUID16) + +/// Serial Service UUID +#define SES_SVC_UUID ATT_UUID16(0xFEE7) +/// Serial Write Command UUID +#define SES_CHAR_RXD_WRITE ATT_UUID16(0xFEC7) +/// Serial Notify UUID +#define SES_CHAR_TXD_NOTIFY ATT_UUID16(0xFEC8) +/// Serial Read Command UUID +#define SES_CHAR_VAL_READ ATT_UUID16(0xFEC9) + +/// Attributes Description +const att_decl_t ses_atts[] = +{ + // Serial Write Command Char. Declaration and Value + ATT_ELMT_DECL_CHAR( SES_IDX_RXD_CHAR ), + ATT_ELMT( SES_IDX_RXD_VAL, SES_CHAR_RXD_WRITE, PROP_WC | PROP_WR, SES_RXD_MAX_LEN ), + + // Serial Notify Char. Declaration and Value and CCC Descriptor + ATT_ELMT_DECL_CHAR( SES_IDX_TXD_CHAR ), + ATT_ELMT( SES_IDX_TXD_VAL, SES_CHAR_TXD_NOTIFY, /*PROP_NTF | */PROP_IND, 0 ), + ATT_ELMT_DESC_CLI_CHAR_CFG( SES_IDX_TXD_NTF_CFG ), + + #if (SES_READ_SUP) + // Serial Read Command Char. Declaration and Value + ATT_ELMT_DECL_CHAR( SES_IDX_READ_CHAR ), + ATT_ELMT( SES_IDX_READ_VAL, SES_CHAR_VAL_READ, PROP_RD, 0 ), + #endif //(SES_READ_SUP) +}; + +/// Service Description +const struct svc_decl ses_svc_db = +{ + .uuid = SES_SVC_UUID, + .info = SVC_UUID(16), + .atts = ses_atts, + .nb_att = SES_IDX_NB - 1, +}; +#endif + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @section SVC FUNCTIONS + **************************************************************************************** + */ + +/// Retrieve attribute handle from index (@see ses_att_idx) +static uint16_t sess_get_att_handle(uint8_t att_idx) +{ + ASSERT_ERR(att_idx < SES_IDX_NB); + + return att_idx + sess_env.start_hdl; +} + +/// Retrieve attribute index form handle +static uint8_t sess_get_att_idx(uint16_t handle) +{ + ASSERT_ERR((handle >= sess_env.start_hdl) && (handle < sess_env.start_hdl + SES_IDX_NB)); + + return handle - sess_env.start_hdl; +} + + +/// Handles reception of the atts request from peer device +static void sess_svc_func(uint8_t conidx, uint8_t opcode, uint16_t handle, const void *param) +{ + uint8_t att_idx = sess_get_att_idx(handle); + + DEBUG("svc_func(cid:%d,op:0x%x,hdl:0x%x,att:%d)", conidx, opcode, handle, att_idx); + + switch (opcode) + { + case ATTS_READ_REQ: + { + if (att_idx == SES_IDX_TXD_NTF_CFG) + { + // retrieve notification config + uint16_t cli_cfg = SES_NTF_CFG_GET(conidx); + + DEBUG(" read_cfm(txd_ntf:%d)", cli_cfg); + gatt_read_cfm(conidx, LE_SUCCESS, handle, sizeof(uint16_t), (uint8_t *)&cli_cfg); + break; + } + + #if (SES_READ_SUP) + if (att_idx == SES_IDX_READ_VAL) + { + sess_cb_rdv(conidx, att_idx, handle); + break; + } + #endif //(SES_READ_SUP) + + // Send error response + gatt_read_cfm(conidx, PRF_ERR_APP_ERROR, handle, 0, NULL); + } break; + + case ATTS_WRITE_REQ: + { + const struct atts_write_ind *ind = param; + + DEBUG(" write_req(hdl:0x%x,att:%d,wr:0x%x,len:%d)", handle, att_idx, ind->wrcode, ind->length); + + if (att_idx == SES_IDX_RXD_VAL) + { + // Send write conform first! + if (!ind->more) gatt_write_cfm(conidx, LE_SUCCESS, handle); + + // Next to process data received + sess_cb_rxd(handle, ind->length, ind->value); + break; + } + + if (att_idx == SES_IDX_TXD_NTF_CFG) + { + if ((!ind->more) && (ind->length == sizeof(uint16_t))) + { + uint16_t cli_cfg = read16p(ind->value); + + DEBUG(" set txd_ntf(cid:%d,cfg:%d)", conidx, cli_cfg); + + // update configuration if value for stop or NTF/IND start + if (cli_cfg <= 3 /*PRF_CLI_START_IND*/) + { +// DEBUG(" set txd_ntf(cid:%d,cfg:%d)", conidx, cli_cfg); + + SES_NTF_CFG_SET(conidx, cli_cfg); + // Send write conform quickly! + gatt_write_cfm(conidx, LE_SUCCESS, handle); + + #if (SES_CLI_CFG) + // Next to process cli_cfg changed + sess_cb_ccc(conidx, cli_cfg); + #endif //(SES_CLI_CFG) + + if(cli_cfg) + { + //͵¼ ECI_REQ_AUTH UUID:0xFEC8 + ble_req_auth(); + } + + break; + } + } + } + + // Send write conform with error! + gatt_write_cfm(conidx, PRF_ERR_APP_ERROR, handle); + } break; + + case ATTS_INFO_REQ: + { + uint8_t status = LE_SUCCESS; + uint16_t length = 0; + + if (att_idx == SES_IDX_RXD_VAL) + { + length = SES_RXD_MAX_LEN; // accepted length + } + else if (att_idx == SES_IDX_TXD_NTF_CFG) + { + length = sizeof(uint16_t); // CCC attribute + } + else + { + status = ATT_ERR_WRITE_NOT_PERMITTED; + } + + // Send length-info confirm for prepWR judging. + DEBUG(" info_cfm(hdl:0x%x,att:%d,sta:0x%X,len:%d)", handle, att_idx, status, length); + gatt_info_cfm(conidx, status, handle, length); + } break; + + case ATTS_CMP_EVT: + { + const struct atts_cmp_evt *evt = param; + + sess_env.nb_pkt++; // release + + DEBUG(" cmp_evt(op:0x%x,sta:0x%x,nb:%d)", evt->operation, evt->status, sess_env.nb_pkt); + // add 'if' to avoid warning #117-D: "evt" never referenced + if (evt->operation == GATT_NOTIFY) + { + // Notify result + } + } break; + + default: + { + // nothing to do + } break; + } +} + + +/** + **************************************************************************************** + * @section API FUNCTIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Add Serial Service Profile in the DB. + * Customize via pre-define @see SES_START_HDL + * + * @return Result status, LE_SUCCESS or Error Reason + **************************************************************************************** + */ + + +uint8_t sess_svc_init(void) +{ + uint8_t status = LE_SUCCESS; + + // Init Environment + sess_env.start_hdl = SES_START_HDL; + sess_env.nb_pkt = SES_NB_PKT_MAX; + sess_env.ntf_bits = 0; + + // Create Service in database + status = attmdb_svc_create(&sess_env.start_hdl, NULL, &ses_svc_db, sess_svc_func); + + DEBUG("svc_init(sta:0x%X,shdl:%d,nb_pkt:%d,ntf_bits:0x%X)", + status, sess_env.start_hdl, sess_env.nb_pkt, sess_env.ntf_bits); + + return status; +} + +/** + **************************************************************************************** + * @brief Enable setting client configuration characteristics + * + * @param[in] conidx Connection index + * @param[in] cli_cfg Client configuration @see prf_cli_conf + **************************************************************************************** + */ +void sess_set_ccc(uint8_t conidx, uint8_t cli_cfg) +{ + //if (gapc_get_conhdl(conidx) != GAP_INVALID_CONHDL) + { + // update configuration + SES_NTF_CFG_SET(conidx, cli_cfg); + } +} + +/** + **************************************************************************************** + * @brief Transmit data to peer device via NTF or IND + * + * @param[in] conidx peer device connection index + * @param[in] len Length of data + * @param[in] data pointer of buffer + * + * @return Status of the operation @see prf_err + **************************************************************************************** + */ +uint8_t sess_txd_send(uint8_t conidx, uint16_t len, const uint8_t* data) +{ + uint8_t status = PRF_ERR_REQ_DISALLOWED; + + if ((len > 0) && (sess_env.nb_pkt > 0)) + { + uint8_t ntf_cfg = SES_NTF_CFG_GET(conidx); + + if (ntf_cfg != PRF_CLI_STOP_NTFIND) + { + status = LE_SUCCESS; + gatt_ntf_send(conidx, sess_get_att_handle(SES_IDX_TXD_VAL), len, data); + + sess_env.nb_pkt--; // allocate + DEBUG("txd_send(len:%d,nb:%d)", len, sess_env.nb_pkt); + } + else + { + status = PRF_ERR_NTF_DISABLED; + } + } + + return status; +} + +uint8_t sess_ind_send(uint8_t conidx, uint16_t len, const uint8_t* data) +{ + uint8_t status = PRF_ERR_REQ_DISALLOWED; + + if ((len > 0) && (sess_env.nb_pkt > 0)) + { + uint8_t ntf_cfg = SES_NTF_CFG_GET(conidx); + + if (ntf_cfg != PRF_CLI_STOP_NTFIND) + { + status = LE_SUCCESS; + gatt_ind_send(conidx, sess_get_att_handle(SES_IDX_TXD_VAL), len, data); + + sess_env.nb_pkt--; // allocate + DEBUG("txd_send(len:%d,nb:%d)", len, sess_env.nb_pkt); + } + else + { + status = PRF_ERR_NTF_DISABLED; + } + } + + return status; +} + +/** + **************************************************************************************** + * @brief Callback on received data from peer device via WC or WQ (__weak func) + * + * @param[in] conidx peer device connection index + * @param[in] len Length of data + * @param[in] data pointer of buffer + **************************************************************************************** + */ +__weak void sess_cb_rxd(uint8_t conidx, uint16_t len, const uint8_t *data) +{ +// debugHex(data, len); + + if (uart1_rxd.head + len <= RXD_BUFF_SIZE) + { + memcpy(&uart1_rxd.data[uart1_rxd.head], data, len); + } + else + { + uint16_t lenEnd = RXD_BUFF_SIZE - uart1_rxd.head; + memcpy(&uart1_rxd.data[uart1_rxd.head], data, lenEnd); + memcpy(&uart1_rxd.data[0], &data[lenEnd], len - lenEnd); + } + + uart1_rxd.head = (uart1_rxd.head +len) % RXD_BUFF_SIZE; +// pkt_t *pkt = (struct pt_pkt *)data; +// uint16_t length = pkt->head.nLength; + + +// ble_parser_rsp(pkt, status); +} + +#if (SES_READ_SUP) +/** + **************************************************************************************** + * @brief Callback to response 'READ' from peer device (__weak func) + * + * @param[in] conidx peer device connection index + * @param[in] attidx SESS attribute index, converted with 'handle' + * @param[in] handle SESS attribute handle to send read cfm + * + * @return Length of value been READ + **************************************************************************************** + */ + + +__weak void sess_cb_rdv(uint8_t conidx, uint8_t attidx, uint16_t handle) +{ + uint16_t length = 12;//SES_VERS_STR_LEN; +// const uint8_t *p_data = (const uint8_t *)SES_VERS_STR; + + uint8_t p_data[12] = {0x13, 0x00, 0x02, 0xC9, 0xFE, 0x06}; + + for(uint8_t idx = 0; idx < GAP_BD_ADDR_LEN; idx++) + { + //BIG MAC 6B + p_data[6+idx] = ble_dev_addr.addr[GAP_BD_ADDR_LEN - 1 - idx]; + } + + DEBUG(" read_cfm(att:%d, len:%d)", attidx, length); + gatt_read_cfm(conidx, LE_SUCCESS, handle, length, p_data); +} +#endif //(SES_READ_SUP) + +#if (SES_CLI_CFG) +/** + **************************************************************************************** + * @brief Callback on enabled client config from peer device via WQ (__weak func) + * + * @param[in] conidx Connection index + * @param[in] cli_cfg Client configuration @see prf_cli_conf + **************************************************************************************** + */ +__weak void sess_cb_ccc(uint8_t conidx, uint8_t cli_cfg) +{ + // user override +} +#endif //(SES_CLI_CFG) + + +#endif //PRF_SESS diff --git a/projects/bleWeChat/src/custom/prf_sess_weChat.h b/projects/bleWeChat/src/custom/prf_sess_weChat.h new file mode 100644 index 0000000..6fbae92 --- /dev/null +++ b/projects/bleWeChat/src/custom/prf_sess_weChat.h @@ -0,0 +1,120 @@ +/** + **************************************************************************************** + * + * @file prf_sess.h + * + * @brief Header file - Serial Service Profile (Server Role). + * + **************************************************************************************** + */ + +#ifndef PRF_SESS_AIRSYNC_H_ +#define PRF_SESS_AIRSYNC_H_ + +#include + + +/* + * DEFINES + **************************************************************************************** + */ + +/// Service Start Handle(0 = dynamically allocated) +#if !defined(SES_START_HDL) + #define SES_START_HDL (0) +#endif + +/// Use UUID 128bit or 16bit +#if !defined(SES_UUID_128) + #define SES_UUID_128 (0) +#endif + +/// Support READ Characteristic +#if !defined(SES_READ_SUP) + #define SES_READ_SUP (0) +#endif + +/// Callback of Client Config enable +#if !defined(SES_CLI_CFG) + #define SES_CLI_CFG (0) +#endif + + +/* + * FUNCTION DECLARATIONS + **************************************************************************************** + */ + +/** + **************************************************************************************** + * @brief Add Serial Service Profile in the DB. + * Customize via pre-define @see SES_START_HDL + * + * @return Result status, LE_SUCCESS or Error Reason + **************************************************************************************** + */ +uint8_t sess_svc_init(void); + +/** + **************************************************************************************** + * @brief Enable setting client configuration characteristics + * + * @param[in] conidx Connection index + * @param[in] cli_cfg Client configuration @see prf_cli_conf + **************************************************************************************** + */ +void sess_set_ccc(uint8_t conidx, uint8_t cli_cfg); + +/** + **************************************************************************************** + * @brief Transmit data to peer device via NTF or IND + * + * @param[in] conidx peer device connection index + * @param[in] len Length of data + * @param[in] data pointer of buffer + * + * @return Status of the operation @see prf_err + **************************************************************************************** + */ +uint8_t sess_txd_send(uint8_t conidx, uint16_t len, const uint8_t *data); + +uint8_t sess_ind_send(uint8_t conidx, uint16_t len, const uint8_t* data); +/** + **************************************************************************************** + * @brief Callback on received data from peer device via WC or WQ (__weak func) + * + * @param[in] conidx peer device connection index + * @param[in] len Length of data + * @param[in] data pointer of buffer + **************************************************************************************** + */ +void sess_cb_rxd(uint8_t conidx, uint16_t len, const uint8_t *data); + +#if (SES_READ_SUP) +/** + **************************************************************************************** + * @brief Callback to response 'READ' from peer device (__weak func) + * + * @param[in] conidx peer device connection index + * @param[in] attidx SESS attribute index, converted with 'handle' + * @param[in] handle SESS attribute handle to send read cfm + * + * @return Length of value been READ + **************************************************************************************** + */ +void sess_cb_rdv(uint8_t conidx, uint8_t attidx, uint16_t handle); +#endif + +#if (SES_CLI_CFG) +/** + **************************************************************************************** + * @brief Callback on enabled client config from peer device via WQ (__weak func) + * + * @param[in] conidx Connection index + * @param[in] cli_cfg Client configuration @see prf_cli_conf + **************************************************************************************** + */ +void sess_cb_ccc(uint8_t conidx, uint8_t cli_cfg); +#endif + +#endif /* PRF_SESS_H_ */ diff --git a/projects/bleWeChat/src/main.c b/projects/bleWeChat/src/main.c new file mode 100644 index 0000000..c4cab3c --- /dev/null +++ b/projects/bleWeChat/src/main.c @@ -0,0 +1,84 @@ +/** + **************************************************************************************** + * + * @file main.c + * + * @brief Main Entry of the application. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" +#include "app.h" +#include "sftmr.h" +#include "leds.h" +#include "uartRb.h" +#include "dbg.h" + + +/* + * DEFINES + **************************************************************************************** + */ + + +/* + * FUNCTIONS + **************************************************************************************** + */ + +extern void user_procedure(void); + +static void sysInit(void) +{ + iwdt_disable(); + + rcc_ble_en(); + rcc_adc_en(); + + rcc_fshclk_set(FSH_CLK_DPSC42); +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + uart1Rb_Init(); //dbgInit(); + debug("Start(rsn:%X)...\r\n", rsn); + + #if (LED_PLAY) + sftmr_init(); + leds_init(); + leds_play(LED_FAST_BL); + #endif //(LED_PLAY) + + // Init BLE App + app_init(rsn); + +} + +int main(void) +{ + sysInit(); + devInit(); + + // Global Interrupt Enable + GLOBAL_INT_START(); + + // main loop + while (1) + { + // Schedule Messages & Events + ble_schedule(); + + #if (LED_PLAY) + // SoftTimer Polling + sftmr_schedule(); + #endif //(LED_PLAY) + + // User's Procedure + user_procedure(); + } +} diff --git a/projects/bleWeChat/src/myapp.c b/projects/bleWeChat/src/myapp.c new file mode 100644 index 0000000..5bd0a1a --- /dev/null +++ b/projects/bleWeChat/src/myapp.c @@ -0,0 +1,73 @@ +/** + **************************************************************************************** + * + * @file myapp.c + * + * @brief User Application - Override func + * + **************************************************************************************** + */ + +#include "app.h" +#include "bledef.h" +#include "drvs.h" +#include "leds.h" + +#if (DBG_APP) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#endif + + +/* + * DEFINES + **************************************************************************************** + */ + +const bd_addr_t ble_dev_addr_B = { BLE_ADDR_B }; + + +/* + * VARIABLES DEFINITIONS + **************************************************************************************** + */ + + + +/* + * FUNCTION DEFINITIONS + **************************************************************************************** + */ + +#if (LED_PLAY) +/** + **************************************************************************************** + * @brief API to Set State of Application, add leds Indication + * + * @param[in] state new state + **************************************************************************************** + */ +void app_state_set(uint8_t state) +{ + DEBUG("State(old:%d,new:%d)", app_state_get(), state); + + app_env.state = state; + + // Indication, User add more... + if (state == APP_IDLE) + { + leds_play(LED_SLOW_BL); + } + else if (state == APP_READY) + { + leds_play(LED_FAST_BL); + } + else if (state == APP_CONNECTED) + { + leds_play(LED_CONT_ON); + } +} +#endif //(LED_PLAY) + diff --git a/projects/bleWeChat/src/proc.c b/projects/bleWeChat/src/proc.c new file mode 100644 index 0000000..512e4e6 --- /dev/null +++ b/projects/bleWeChat/src/proc.c @@ -0,0 +1,357 @@ +/** + **************************************************************************************** + * + * @file proc.c + * + * @brief user procedure. + * + **************************************************************************************** + */ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" + +#include "app.h" +#include "prf_sess.h" +#include "uartRb.h" +#include "weChat.h" + +#include "prf_sess_weChat.h" + +#if (DBG_PROC) +#include "dbg.h" +#define DEBUG(format, ...) debug("<%s,%d>" format "\r\n", __MODULE__, __LINE__, ##__VA_ARGS__) +#else +#define DEBUG(format, ...) +#define debugHex(dat, len) +#endif + +struct rxd_buffer uart1_rxd; + +uint16_t uart1_size(void) +{ + return ((uart1_rxd.head + RXD_BUFF_SIZE - uart1_rxd.tail) % RXD_BUFF_SIZE); +} + +uint16_t uart1_read(uint8_t *buff, uint16_t max) +{ + uint16_t head = uart1_rxd.head; + uint16_t tail = uart1_rxd.tail; + uint16_t tlen, len = (head + RXD_BUFF_SIZE - tail) % RXD_BUFF_SIZE; + if (len == 0 || max == 0) + { + return 0; // empty + } + + if (len > max) + len = max; + + if ((head > tail) || (tail + len <= RXD_BUFF_SIZE)) + { + memcpy(&buff[0], (const void *)&uart1_rxd.data[tail], len); + } + else + { + tlen = RXD_BUFF_SIZE - tail; + + memcpy(&buff[0], (const void *)&uart1_rxd.data[tail], tlen); // tail_len + memcpy(&buff[tlen], (const void *)&uart1_rxd.data[0], len - tlen); // head_len + } + uart1_rxd.tail = (tail + len) % RXD_BUFF_SIZE; + + return len; // count +} + +/* + * DEFINES + **************************************************************************************** + */ + +#define BLE_MAX_LEN 20 +#define NULL_CNT 20 + +static uint8_t buff[BLE_MAX_LEN]; +static uint16_t buff_len = 0; + +extern const bd_addr_t ble_dev_addr_B; + +uint16_t ble_head_nSeq = 1; +/* + * FUNCTIONS + **************************************************************************************** + */ + +#if !(DBG_SESS) +/// Override - Callback on received data from peer device +void sess_cb_rxd(uint8_t conidx, uint16_t len, const uint8_t *data) +{ + uart_send(UART1_PORT, len, data); +} +#endif //!(DBG_SESS) + +/// Uart Data procedure +static void data_proc(void) +{ + // Todo Loop-Proc + static uint8_t null_cnt = 0; + uint16_t len; + + len = uart1Rb_Read(&buff[buff_len], BLE_MAX_LEN - buff_len); + if (len > 0) + { + buff_len += len; + if (buff_len < BLE_MAX_LEN) + { + return; // wait full + } + } + else + { + if ((buff_len > 0) && (null_cnt++ > NULL_CNT)) + { + //finish = true; + null_cnt = 0; + } + else + { + return; // wait again + } + } + + if (app_state_get() == APP_CONNECTED) + { + if (buff[0] == 0xAA) + { + DEBUG("GAP Disc!\r\n"); + gapc_disconnect(app_env.curidx); + buff_len = 0; + } + else if (sess_txd_send(app_env.curidx, buff_len, buff) == LE_SUCCESS) + { + debugHex(buff, buff_len); + buff_len = 0; + } + } + else + { + // goto reset + if (buff[0] == 0xAA) + { + DEBUG("GAP Reset!\r\n"); + gapm_reset(); + } + + buff_len = 0; + } +} + +#if (CFG_SLEEP) +static void sleep_proc(void) +{ + uint8_t lpsta = ble_sleep(BLE_SLP_TWOSC, BLE_SLP_DURMAX); + + if (lpsta == BLE_IN_SLEEP) + { + uint16_t lpret = core_sleep(CFG_WKUP_BLE_EN); + //DEBUG("ble sta:%d, wksrc:%X", lpsta, lpret); + } + else + { + //DEBUG("ble sta:%d", lpsta); + } +} +#endif //(CFG_SLEEP) + + +void app_conn_fsm(uint8_t evt, uint8_t conidx, const void* param) +{ + switch (evt) + { + case BLE_CONNECTED: + { + // Connected state, record Index + app_env.curidx = conidx; + app_state_set(APP_CONNECTED); + + gatt_exmtu(app_env.curidx, 256); + + gapc_connect_rsp(conidx, GAP_AUTH_REQ_NO_MITM_NO_BOND); + + // Enable profiles by role + } break; + + case BLE_DISCONNECTED: + { + ble_head_nSeq = 1; + + app_state_set(APP_READY); + + #if (BLE_EN_ADV) + // Slave role, Restart Advertising + app_adv_action(ACTV_START); + #endif //(BLE_EN_ADV) + + } break; + + case BLE_BONDED: + { + // todo, eg. save the generated slave's LTK to flash + } break; + + case BLE_ENCRYPTED: + { + // todo + } break; + + default: + break; + } +} + + +void ble_req_auth(void) +{ + uint8_t buff[BLE_REQ_AUTH_LEN] = {0xFE, 0x01, 0x00, 0x1A,0x27, 0x11, 0x00, 0x01, 0x0A, 0x00, 0x18, 0x84, 0x80, 0x04, 0x20, 0x01, 0x28, 0x02, 0x3A, 0x06}; + pkt_t *pkt = (pkt_t *)buff; + + pkt->head.bMagicNumber = FIX_HEAD_MAGIC; + pkt->head.bVer = FIX_HEAD_VER; + pkt->head.nLength[0] = __SWP16_H(BLE_REQ_AUTH_LEN); + pkt->head.nLength[1] = __SWP16_L(BLE_REQ_AUTH_LEN); + + pkt->head.nCmdId[0] = __SWP16_H(ECI_req_auth); + pkt->head.nCmdId[1] = __SWP16_L(ECI_req_auth); + + pkt->head.nSeq[0] = __SWP16_H(ble_head_nSeq); + pkt->head.nSeq[1] = __SWP16_L(ble_head_nSeq); + + ble_head_nSeq++; + + memcpy(&pkt->payl[12], ble_dev_addr_B.addr ,GAP_BD_ADDR_LEN); + + sess_ind_send(app_env.curidx, BLE_REQ_AUTH_LEN, buff); +} + +void ble_req_init(void) +{ + uint8_t buff[BLE_REQ_INIT_LEN] = {0xFE, 0x01, 0x00, 0x0A,0x27, 0x13, 0x00, 0x02, 0x0A, 0x00}; + pkt_t *pkt = (pkt_t *)buff; + + pkt->head.bMagicNumber = FIX_HEAD_MAGIC; + pkt->head.bVer = FIX_HEAD_VER; + pkt->head.nLength[0] = __SWP16_H(BLE_REQ_INIT_LEN); + pkt->head.nLength[1] = __SWP16_L(BLE_REQ_INIT_LEN); + pkt->head.nCmdId[0] = __SWP16_H(ECI_req_init); + pkt->head.nCmdId[1] = __SWP16_L(ECI_req_init); + pkt->head.nSeq[0] = __SWP16_H(ble_head_nSeq); + pkt->head.nSeq[1] = __SWP16_L(ble_head_nSeq); + ble_head_nSeq++; + + sess_ind_send(app_env.curidx, BLE_REQ_INIT_LEN, buff); +} + +void ble_req_data(void) +{ + uint8_t buff[BLE_REQ_DATA_LEN] = {0xFE, 0x01, 0x00, 0x0F,0x27, 0x12, 0x00, 0x03, 0x0A, 0x00, 0x12, 0x01, 0x56, 0x18,0x00}; + pkt_t *pkt = (pkt_t *)buff; + + pkt->head.bMagicNumber = FIX_HEAD_MAGIC; + pkt->head.bVer = FIX_HEAD_VER; + pkt->head.nLength[0] = __SWP16_H(BLE_REQ_DATA_LEN); + pkt->head.nLength[1] = __SWP16_L(BLE_REQ_DATA_LEN); + pkt->head.nCmdId[0] = __SWP16_H(ECI_req_sendData); + pkt->head.nCmdId[1] = __SWP16_L(ECI_req_sendData); + pkt->head.nSeq[0] = __SWP16_H(ble_head_nSeq); + pkt->head.nSeq[1] = __SWP16_L(ble_head_nSeq); + ble_head_nSeq++; + + sess_ind_send(app_env.curidx, BLE_REQ_DATA_LEN, buff); +} + +uint8_t buffR[BLE_DATA_LEN_MAX]; + +void ble_parser_sch(void) +{ + if (uart1_rxd.head != uart1_rxd.tail) + { + if (uart1_rxd.data[uart1_rxd.tail] == FIX_HEAD_MAGIC) + { + uint16_t length = uart1_size(); + uint16_t pkt_len = (((uint16_t)uart1_rxd.data[(uart1_rxd.tail+2)%RXD_BUFF_SIZE] << 8) | uart1_rxd.data[(uart1_rxd.tail+3)%RXD_BUFF_SIZE]); + + if (length >= pkt_len) + { + uart1_read(buffR, pkt_len); + + ble_parser_rsp((struct pt_pkt *)buffR, ECI_none); + } + //Timeout + } + else + { + uart1_rxd.tail++; + } + } +} + +void ble_parser_rsp(struct pt_pkt *pkt, uint16_t status) +{ + uint16_t pkt_len = (((uint16_t)pkt->head.nLength[0] << 8) | pkt->head.nLength[1]); + uint16_t pkt_cmd = (((uint16_t)pkt->head.nCmdId[0] << 8) | pkt->head.nCmdId[1]); + + if (status == ECI_err_decode) + { + debugHex((uint8_t *)pkt, pkt_len); + return; + } + + switch (pkt_cmd) + { + case ECI_resp_auth: + { + ble_req_init(); + } break; + + case ECI_resp_sendData: + { + // Sync Echo Data + + } break; + + case ECI_resp_init: + { + ble_req_data(); + } break; + + case ECI_push_recvData: + { + } + + case ECI_push_switchView: + { + } + + case ECI_push_switchBackgroud: + { + debugHex((uint8_t *)pkt, pkt_len); + } break; + + default: + { + + } break; + } +} + +void user_procedure(void) +{ + #if (CFG_SLEEP) + sleep_proc(); + #endif //(CFG_SLEEP) + + data_proc(); + + ble_parser_sch(); +} + diff --git a/projects/bleWeChat/src/weChat.h b/projects/bleWeChat/src/weChat.h new file mode 100644 index 0000000..fc450bc --- /dev/null +++ b/projects/bleWeChat/src/weChat.h @@ -0,0 +1,115 @@ +// proto version: 1.0.4 + +#ifndef _WECHAT_H_ +#define _WECHAT_H_ + +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" +#include "gap.h" +#include "app.h" + +//ǰ +#define __SWP16_L(A) ((uint16_t)(A) & 0x00FF) +#define __SWP16_H(A) (((uint16_t)(A) >> 8) & 0x00FF) + +#define FIX_HEAD_MAGIC 0xFE +#define FIX_HEAD_VER 0x01 + + +#define BLE_REQ_AUTH_LEN 0x1A +#define BLE_REQ_INIT_LEN 0x0A +#define BLE_REQ_DATA_LEN 0x0F +#define BLE_DATA_LEN_MAX 0xFF + +enum EmCmdId +{ + ECI_none = 0, + + // req 豸 -> ΢/̷ + ECI_req_auth = 0x2711/*10001*/, // ¼ + ECI_req_sendData = 0x2712/*10002*/, // 豸ݸ΢Ż + ECI_req_init = 0x2713/*10003*/, // ʼ + + // resp΢/̷ -> 豸 + ECI_resp_auth = 0x4E21/*20001*/, + ECI_resp_sendData = 0x4E22/*20001*/, + ECI_resp_init = 0x4E23/*20001*/, + + // push΢/̷ -> 豸 + ECI_push_recvData = 0x7531/*30001*/, // ΢Ż̷ݸ豸 + ECI_push_switchView = 0x7532/*30001*/, // /˳ + ECI_push_switchBackgroud = 0x7533/*30001*/, // л̨ + + ECI_err_decode = 0x752F/*29999*/, // ʧܵĴ롣ע⣺ⲻ cmdidΪʡ̶ͷСĴڰͷ cmdid ֶΡ +}; + +enum EmErrorCode +{ + EEC_system = -1, // ͨõĴ + EEC_needAuth = -2, // 豸δ¼ + EEC_sessionTimeout = -3, // session ʱҪµ¼ + EEC_decode = -4, // proto ʧ + EEC_deviceIsBlock = -5, // 豸쳣±΢ʱԽֹ¼ + EEC_serviceUnAvalibleInBackground = -6, // ios ں̨ģʽ޷ + EEC_deviceProtoVersionNeedUpdate = -7, // 豸 proto 汾ϣҪ + EEC_phoneProtoVersionNeedUpdate = -8, // ΢ſͻ˵ proto 汾ϣҪ + EEC_maxReqInQueue = -9, // 豸˶󣬲ûյذ΢ſͻӵ + EEC_userExitWxAccount = -10, // û˳΢ʺš +}; + +// req, resp ======================================== +enum EmAuthMethod +{ + EAM_md5 = 1, // 豸ͨ Md5DeviceTypeAndDeviceIdͨ΢ app ֤1. aes ܣע AesSign ֵ 2. ûмܣע AesSign Ϊջ߳Ϊ㡣 + EAM_macNoEncrypt = 2, // 豸ͨ mac ֶַΣûмܣͨ΢ app ֤ +}; + +// 豸ݸ΢Ż ---------------------------- +// 豸 +enum EmDeviceDataType { + EDDT_manufatureSvr = 0, // Զ + EDDT_wxWristBand = 1, // ΢Źƽֻ̨ + EDDT_wxDeviceHtmlChatView = 10001, // ΢ſͻ豸 html5 Ự +}; + +// ΢AirSyncЭ̶ͷ +typedef struct +{ + uint8_t bMagicNumber; + uint8_t bVer; + uint8_t nLength[2]; //ǰ + uint8_t nCmdId[2]; //ǰ + uint8_t nSeq[2]; //ǰ +}BpFixHead; + +extern uint16_t ble_head_nSeq; + +/// Protocol Packet +typedef struct pt_pkt +{ + /* head(4B): 1-sync; 1-cmd; 2-len */ + BpFixHead head; + + /* payl(nB): A set of variable value */ + uint8_t payl[]; +} pkt_t; + +void ble_parser_rsp(struct pt_pkt *pkt, uint16_t status); +void ble_req_auth(void); + + +//BLE UART BUFF +/// Structures +#define RXD_BUFF_SIZE (0x100) + +struct rxd_buffer +{ + volatile uint16_t head; + volatile uint16_t tail; + uint8_t data[RXD_BUFF_SIZE] __attribute__((aligned(4))); +}; +extern struct rxd_buffer uart1_rxd; + +#endif + diff --git a/projects/bleWeChat/src/wechat/AES.c b/projects/bleWeChat/src/wechat/AES.c new file mode 100644 index 0000000..b9594d0 --- /dev/null +++ b/projects/bleWeChat/src/wechat/AES.c @@ -0,0 +1,446 @@ +/////////////////////////////////////////////////////////////////////////////// +// AES.c +// AES㷨 +// ˣLiangbofu +// ڣ2009-07-17 +/////////////////////////////////////////////////////////////////////////////// +#include "aes.h" +//#include "malloc.h" +#include +#include +#include +#include + +// ΪC51ŻʹARMPCȻ +// ڷC51ûж__C51__ҪC51ضĹؼֶΪ +#ifndef __C51__ + #define code + #define data + #define idata + #define xdata + #define pdata + typedef unsigned char BOOL; +#else + typedef bit BOOL; +#endif + + +#define Nk (AES_KEY_LENGTH / 32) // ԡ֡4ֽڣΪλԿ +#define Nb 4 // ԡ֡4ֽڣΪλļӽݿС̶Ϊ4 + +// Nrܵ +#if AES_KEY_LENGTH == 128 + #define Nr 10 +#elif AES_KEY_LENGTH == 192 + #define Nr 12 +#elif AES_KEY_LENGTH == 256 + #define Nr 14 +#else + #error AES_KEY_LENGTH must be 128, 192 or 256 BOOLs! +#endif + +// GF(28) ʽ +#define BPOLY 0x1B // Lower 8 BOOLs of (x^8 + x^4 + x^3 + x + 1), ie. (x^4 + x^3 + x + 1). + +// AESԿԿΪ128λʱռ176ֽڿռ +static xdata unsigned char g_roundKeyTable[4*Nb*(Nr+1)]; + +// õSBox +static code const unsigned char SBox[256] = +{ + 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, + 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, + 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, + 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, + 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, + 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, + 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, + 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, + 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, + 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, + 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, + 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, + 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, + 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, + 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, + 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 +}; + +// õSBox +static code const unsigned char InvSBox[256] = +{ + 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, + 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, + 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, + 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, + 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, + 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, + 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, + 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, + 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, + 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, + 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, + 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, + 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, + 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, + 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, + 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d +}; + + +/////////////////////////////////////////////////////////////////////////////// +// RotationWord +// һ֡ݽѭơ +// pWord -- ҪƵ4ֽݡ +// pWord -- ƺ4ֽݡ +// ֵ ޡ +/////////////////////////////////////////////////////////////////////////////// +static void RotationWord(unsigned char *pWord) +{ + unsigned char temp = pWord[0]; + pWord[0] = pWord[1]; + pWord[1] = pWord[2]; + pWord[2] = pWord[3]; + pWord[3] = temp; +} + +/////////////////////////////////////////////////////////////////////////////// +// XorBytes +// ݡ +// pData1 -- Ҫĵһݡ +// pData1 -- Ҫĵڶݡ +// nCount -- Ҫݳȡ +// pData1 -- Ľ +// ֵ ޡ +/////////////////////////////////////////////////////////////////////////////// +static void XorBytes(unsigned char *pData1, const unsigned char *pData2, unsigned char nCount) +{ + unsigned char i; + + for (i = 0; i < nCount; i++) + { + pData1[i] ^= pData2[i]; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// AddRoundKey +// м״̬ ϣԿݳΪ16ֽڡ +// pState -- ״̬ݡ +// pRoundKey -- Կݡ +// pState -- Կ״̬ݡ +// ֵ ޡ +/////////////////////////////////////////////////////////////////////////////// +// static void AddRoundKey(unsigned char *pState, const unsigned char *pRoundKey) +// { +// XorBytes(pState, pRoundKey, 4*Nb); +// } + +// AddRoundKeyĺʽȺʽԽʡ4ֽڵdata +#define AddRoundKey(pState, pRoundKey) \ + XorBytes((pState), (pRoundKey), 4*Nb) + + +/////////////////////////////////////////////////////////////////////////////// +// SubBytes +// ͨSû״̬ݡ +// pState -- ״̬ݡ +// nCount -- ״̬ݳȡ +// bInvert -- Ƿʹ÷Sӣʱʹã +// pState -- û״̬ݡ +// ֵ ޡ +/////////////////////////////////////////////////////////////////////////////// +static void SubBytes(unsigned char *pState, unsigned char nCount, BOOL bInvert) +{ + unsigned char i; + const unsigned char code *pSBox = bInvert ? InvSBox : SBox; + + for (i = 0; i < nCount; i++) + { + pState[i] = pSBox[pState[i]]; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// ShiftRows +// ״̬С +// pState -- ״̬ݡ +// bInvert -- ǷУʱʹã +// pState -- к״̬ݡ +// ֵ ޡ +/////////////////////////////////////////////////////////////////////////////// +static void ShiftRows(unsigned char *pState, BOOL bInvert) +{ + // ע⣺״̬ʽţ + + unsigned char r; // row + unsigned char c; // column + unsigned char temp; + unsigned char rowData[4]; + + for (r = 1; r < 4; r++) + { + // һ + for (c = 0; c < 4; c++) + { + rowData[c] = pState[r + 4*c]; + } + + temp = bInvert ? (4 - r) : r; + for (c = 0; c < 4; c++) + { + pState[r + 4*c] = rowData[(c + temp) % 4]; + } + } +} + +/////////////////////////////////////////////////////////////////////////////// +// GfMultBy02 +// GF(28) 2 㡣 +// num -- +// ޡ +// ֵ num2Ľ +/////////////////////////////////////////////////////////////////////////////// +static unsigned char GfMultBy02(unsigned char num) +{ + if ((num & 0x80) == 0) + { + num = num << 1; + } + else + { + num = (num << 1) ^ BPOLY; + } + + return num; +} + +/////////////////////////////////////////////////////////////////////////////// +// MixColumns +// ״̬ݡ +// pState -- ״̬ݡ +// bInvert -- Ƿϣʱʹã +// pState -- к״̬ݡ +// ֵ ޡ +/////////////////////////////////////////////////////////////////////////////// +static void MixColumns(unsigned char *pState, BOOL bInvert) +{ + unsigned char i; + unsigned char temp; + unsigned char a0Pa2_M4; // 4(a0 + a2) + unsigned char a1Pa3_M4; // 4(a1 + a3) + unsigned char result[4]; + + for (i = 0; i < 4; i++, pState += 4) + { + // b0 = 2a0 + 3a1 + a2 + a3 + // = (a0 + a1 + a2 + a3) + 2(a0 + a1) + a0 + + temp = pState[0] ^ pState[1] ^ pState[2] ^ pState[3]; + result[0] = temp ^ pState[0] ^ GfMultBy02((unsigned char) (pState[0] ^ pState[1])); + result[1] = temp ^ pState[1] ^ GfMultBy02((unsigned char) (pState[1] ^ pState[2])); + result[2] = temp ^ pState[2] ^ GfMultBy02((unsigned char) (pState[2] ^ pState[3])); + result[3] = temp ^ pState[3] ^ GfMultBy02((unsigned char) (pState[3] ^ pState[0])); + + if (bInvert) + { + // b0' = 14a0 + 11a1 + 13a2 + 9a3 + // = (a0 + a1 + a2 + a3) + 2(a0 + a1) + a0 ⲿΪb0 + // + 2(4(a0 + a2) + 4(a1 + a3)) + // + 4(a0 + a2) + + a0Pa2_M4 = GfMultBy02(GfMultBy02((unsigned char) (pState[0] ^ pState[2]))); + a1Pa3_M4 = GfMultBy02(GfMultBy02((unsigned char) (pState[1] ^ pState[3]))); + temp = GfMultBy02((unsigned char) (a0Pa2_M4 ^ a1Pa3_M4)); + result[0] ^= temp ^ a0Pa2_M4; + result[1] ^= temp ^ a1Pa3_M4; + result[2] ^= temp ^ a0Pa2_M4; + result[3] ^= temp ^ a1Pa3_M4; + } + + memcpy(pState, result, 4); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// BlockEncrypt +// Եݼܡ +// pState -- ״̬ݡ +// pState -- ܺ״̬ݡ +// ֵ ޡ +/////////////////////////////////////////////////////////////////////////////// +static void BlockEncrypt(unsigned char *pState) +{ + unsigned char i; + + AddRoundKey(pState, g_roundKeyTable); + + for (i = 1; i <= Nr; i++) // i = [1, Nr] + { + SubBytes(pState, 4*Nb, 0); + ShiftRows(pState, 0); + + if (i != Nr) + { + MixColumns(pState, 0); + } + + AddRoundKey(pState, &g_roundKeyTable[4*Nb*i]); + } + +// Ϊ˽ʡ룬ϲѭִ +// SubBytes(pState, 4*Nb); +// ShiftRows(pState, 0); +// AddRoundKey(pState, &g_roundKeyTable[4*Nb*Nr]); +} + +/////////////////////////////////////////////////////////////////////////////// +// BlockDecrypt +// Եݽܡ +// pState -- ״̬ݡ +// pState -- ܺ״̬ݡ +// ֵ ޡ +/////////////////////////////////////////////////////////////////////////////// +static void BlockDecrypt(unsigned char *pState) +{ + unsigned char i; + + AddRoundKey(pState, &g_roundKeyTable[4*Nb*Nr]); + + for (i = Nr; i > 0; i--) // i = [Nr, 1] + { + ShiftRows(pState, 1); + SubBytes(pState, 4*Nb, 1); + AddRoundKey(pState, &g_roundKeyTable[4*Nb*(i-1)]); + + if (i != 1) + { + MixColumns(pState, 1); + } + } +} + + +/////////////////////////////////////////////////////////////////////////////// +// AES_Init +// ʼڴִչԿ +// pKey -- ԭʼԿ䳤ȱΪ AES_KEY_LENGTH/8 ֽڡ +// ޡ +// ֵ ޡ +/////////////////////////////////////////////////////////////////////////////// +void AES_Init(const void *pKey) +{ + // չԿ + unsigned char i; + unsigned char *pRoundKey; + unsigned char Rcon[4] = {0x01, 0x00, 0x00, 0x00}; + + memcpy(g_roundKeyTable, pKey, 4*Nk); + + pRoundKey = &g_roundKeyTable[4*Nk]; + + for (i = Nk; i < Nb*(Nr+1); pRoundKey += 4, i++) + { + memcpy(pRoundKey, pRoundKey - 4, 4); + + if (i % Nk == 0) + { + RotationWord(pRoundKey); + SubBytes(pRoundKey, 4, 0); + XorBytes(pRoundKey, Rcon, 4); + + Rcon[0] = GfMultBy02(Rcon[0]); + } + else if (Nk > 6 && i % Nk == Nb) + { + SubBytes(pRoundKey, 4, 0); + } + + XorBytes(pRoundKey, pRoundKey - 4*Nk, 4); + } +} + +unsigned int AES_get_length(unsigned int length) +{ + return ((length>>4) + 1)<<4; +} +////////////////////////////////////////////////////////////////////////// +// AES_Encrypt +// +// pPlainText -- ģܵݣ䳤ΪnDataLenֽڡ +// nDataLen -- ݳȣֽΪλ +// pIV -- ʼʹECBģʽΪNULL +// pCipherText -- ģļܺݣpPlainTextͬ +// ֵ ޡ +////////////////////////////////////////////////////////////////////////// +unsigned int AES_Encrypt_PKCS7(const unsigned char *pPlainText, unsigned char *pCipherText, + unsigned int nDataLen, const unsigned char *pIV) +{ + unsigned int i; + //ȵ + unsigned int length = nDataLen; + nDataLen = ((nDataLen>>4) + 1)<<4; + uint8_t p=(Nb<<2)-(length%(Nb<<2)); + if (pPlainText != pCipherText){memcpy(pCipherText,pPlainText,length);} + // + unsigned char temp[16]; + memset(temp,p,16); + if(length 0 ; i--, pCipherText += 4*Nb) + { + #if AES_MODE == AES_MODE_CBC + XorBytes(pCipherText, pIV, 4*Nb); + #endif + BlockEncrypt(pCipherText); + pIV = pCipherText; + } + return(nDataLen); +} +////////////////////////////////////////////////////////////////////////// +// AES_Decrypt +// +// pCipherText -- ģܵݣ䳤ΪnDataLenֽڡ +// nDataLen -- ݳȣֽΪλΪAES_KEY_LENGTH/8 +// pIV -- ʼʹECBģʽΪNULL +// pPlainText -- ģĽܺݣpCipherTextͬ +// ֵ ޡ +////////////////////////////////////////////////////////////////////////// +void AES_Decrypt(unsigned char *pPlainText, const unsigned char *pCipherText, + unsigned int nDataLen, const unsigned char *pIV) +{ + unsigned int i; + + if (pPlainText != pCipherText) + { + memcpy(pPlainText, pCipherText, nDataLen); + } + + // һݿʼܣÿٿռIV + pPlainText += nDataLen - 4*Nb; + for (i = nDataLen/(4*Nb); i > 0 ; i--, pPlainText -= 4*Nb) + { + BlockDecrypt(pPlainText); + + #if AES_MODE == AES_MODE_CBC + if (i == 1) + {// һ + XorBytes(pPlainText, pIV, 4*Nb); + } + else + { + XorBytes(pPlainText, pPlainText - 4*Nb, 4*Nb); + } + #endif + } +} + + + diff --git a/projects/bleWeChat/src/wechat/AES.h b/projects/bleWeChat/src/wechat/AES.h new file mode 100644 index 0000000..09bdb3a --- /dev/null +++ b/projects/bleWeChat/src/wechat/AES.h @@ -0,0 +1,68 @@ +/////////////////////////////////////////////////////////////////////////////// +// AES.h +// AES㷨 +// ˣLiangbofu +// ڣ2009-07-17 +/////////////////////////////////////////////////////////////////////////////// +#ifndef __AES_H +#define __AES_H + +#ifdef __cplusplus + extern "C" { +#endif + +// bitΪλԿȣֻΪ 128192 256 +#define AES_KEY_LENGTH 128 + +// ӽģʽ +#define AES_MODE_ECB 0 // 뱾ģʽһģʽ +#define AES_MODE_CBC 1 // ģʽ +#define AES_MODE AES_MODE_CBC + + +/////////////////////////////////////////////////////////////////////////////// +// AES_Init +// ʼڴִչԿ +// pKey -- ԭʼԿ䳤ȱΪ AES_KEY_LENGTH/8 ֽڡ +// ޡ +// ֵ ޡ +/////////////////////////////////////////////////////////////////////////////// +void AES_Init(const void *pKey); + +////////////////////////////////////////////////////////////////////////// +// AES_Encrypt +// +// pPlainText -- ģܵݣ䳤ΪnDataLenֽڡ +// nDataLen -- ݳȣֽΪλΪAES_KEY_LENGTH/8 +// pIV -- ʼʹECBģʽΪNULL +// pCipherText -- ģļܺݣpPlainTextͬ +// ֵ ޡ +////////////////////////////////////////////////////////////////////////// +void AES_Encrypt(const unsigned char *pPlainText, unsigned char *pCipherText, + unsigned int nDataLen, const unsigned char *pIV); + +////////////////////////////////////////////////////////////////////////// +// AES_Decrypt +// +// pCipherText -- ģܵݣ䳤ΪnDataLenֽڡ +// nDataLen -- ݳȣֽΪλΪAES_KEY_LENGTH/8 +// pIV -- ʼʹECBģʽΪNULL +// pPlainText -- ģĽܺݣpCipherTextͬ +// ֵ ޡ +////////////////////////////////////////////////////////////////////////// +void AES_Decrypt(unsigned char *pPlainText, const unsigned char *pCipherText, + unsigned int nDataLen, const unsigned char *pIV); + +//ݽнܲɹ1ʧܷ0 +unsigned char app_data_encode_aes(char *input, char *output, unsigned short *slen); +unsigned char app_data_decode_aes(unsigned char *input, char *output, unsigned short *slen); +unsigned int AES_Encrypt_PKCS7(const unsigned char *pPlainText, unsigned char *pCipherText, + unsigned int nDataLen, const unsigned char *pIV); +unsigned int AES_get_length(unsigned int length); +void AES_free(unsigned char* p); +#ifdef __cplusplus + } +#endif + + +#endif // __AES_H diff --git a/projects/bleWeChat/src/wechat/ble_wechat_service.c b/projects/bleWeChat/src/wechat/ble_wechat_service.c new file mode 100644 index 0000000..48da699 --- /dev/null +++ b/projects/bleWeChat/src/wechat/ble_wechat_service.c @@ -0,0 +1,388 @@ +/* +* modified by anqiren 2014/12/02 V1.0bat +* +**/ + +#include "ble_wechat_service.h" +#include "nrf_gpio.h" +#include "ble_conn_params.h" +#include "ble_stack_handler.h" +#include "ble_types.h" +#include "mpbledemo2.h" +#include "ble_wechat_util.h" + +static uint8_t m_addl_adv_manuf_data [BLE_GAP_ADDR_LEN]; + + +#define USING_PRODUCT PRODUCT_TYPE_MPBLEDEMO2 + +/***************************************************************************** +* data handle +*****************************************************************************/ + data_info g_send_data = {NULL, 0, 0}; + data_info g_rcv_data = {NULL, 0, 0}; + +static int ble_wechat_indicate_data_chunk(ble_wechat_t *p_wcs, data_handler *p_data_handler) +{ + ble_gatts_hvx_params_t hvx_params; + uint16_t chunk_len = 0; + + chunk_len = g_send_data.len-g_send_data.offset; + chunk_len = chunk_len > BLE_WECHAT_MAX_DATA_LEN?BLE_WECHAT_MAX_DATA_LEN:chunk_len; + + if (chunk_len == 0) { + p_data_handler->m_data_free_func(g_send_data.data, g_send_data.len); + g_send_data.data = NULL; + g_send_data.len = 0; + g_send_data.offset = 0; + return 0; + } + memset(&hvx_params, 0, sizeof(hvx_params)); + hvx_params.handle = p_wcs->indicate_handles.value_handle; + hvx_params.p_data = g_send_data.data+g_send_data.offset; + hvx_params.p_len = &chunk_len; + hvx_params.type = BLE_GATT_HVX_INDICATION; + + g_send_data.offset += chunk_len; + return sd_ble_gatts_hvx(p_wcs->conn_handle, &hvx_params); +} + +//úһ֡¼ǰoffsetɹһ֮֡ble stackһȷ¼p_ble_evt->header.evt_id = BLE_GATTS_EVT_HVC +//յ¼Ժ on_indicate_comfirm Էʣֱݷ +void on_indicate_comfirm(ble_wechat_t *p_wcs, ble_evt_t * p_ble_evt, data_handler *p_data_handler) +{ + ble_wechat_indicate_data_chunk(p_wcs,p_data_handler); +} + +/**@brief Function for error handling, which is called when an error has occurred. + * @warning This handler is an example only and does not fit a final product. You need to analyze + * how your product is supposed to react in case of error. + * + * @param[in] error_code Error code supplied to the handler. + * @param[in] p_data_handler where Error come from + */ +//ӡϢõǰ豸Ĵ +void wechat_error_chack(ble_wechat_t *p_wcs, data_handler *p_data_handler, int error_code) +{ + switch(error_code) + { + case EEC_system: + { + #ifdef CATCH_LOG + printf("\r\n! error: system error"); + #endif + } + break ; + case EEC_needAuth: + #ifdef CATCH_LOG + printf("\r\n! error: needAuth"); + #endif + break ; + case EEC_sessionTimeout: + #ifdef CATCH_LOG + printf("\r\n! error: sessionTimeout"); + #endif + break ; + case EEC_decode: + #ifdef CATCH_LOG + printf("\r\n! error: decode"); + #endif + break ; + case EEC_deviceIsBlock: + #ifdef CATCH_LOG + printf("\r\n! error: deviceIsBlock"); + #endif + break ; + case EEC_serviceUnAvalibleInBackground: + #ifdef CATCH_LOG + printf("\r\n! error: serviceUnAvalibleInBackground"); + #endif + break ; + case EEC_deviceProtoVersionNeedUpdate: + #ifdef CATCH_LOG + printf("\r\n! error: deviceProtoVersionNeedUpdate"); + #endif + break ; + case EEC_phoneProtoVersionNeedUpdate: + #ifdef CATCH_LOG + printf("\r\n! error: phoneProtoVersionNeedUpdate"); + #endif + break ; + case EEC_maxReqInQueue: + #ifdef CATCH_LOG + printf("\r\n! error: maxReqInQueue"); + #endif + break ; + case EEC_userExitWxAccount: + #ifdef CATCH_LOG + printf("\r\n! error: userExitWxAccount"); + #endif + break ; + default: + break ; + } + p_data_handler->m_data_error_func(error_code);//ú豸ж +} + +/**@brief Function for handling the @ref BLE_GATTS_EVT_WRITE event from the S110 SoftDevice. + * + * @param[in] p_ble_evt Pointer to the event received from BLE stack. + */ +//΢ſͻ˷д¼Ĵpushݡ֮ +//豸 p_data_handler->m_data_consume_func(g_rcv_data.data, g_rcv_data.len) +//ú豸ж +static void on_write(ble_wechat_t *p_wcs, ble_evt_t * p_ble_evt, data_handler *p_data_handler) +{ + int error_code; + ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write; + int chunk_size = 0; + if (p_evt_write->handle == p_wcs->write_handles.value_handle && + p_evt_write->len <= BLE_WECHAT_MAX_DATA_LEN) + { + if (g_rcv_data.len == 0) + { + BpFixHead *fix_head = (BpFixHead *) p_evt_write->data; + g_rcv_data.len = ntohs(fix_head->nLength); + g_rcv_data.offset = 0; + g_rcv_data.data = (uint8_t *)malloc(g_rcv_data.len); + } + chunk_size = g_rcv_data.len - g_rcv_data.offset; + chunk_size = chunk_size < p_evt_write->len ? chunk_size : p_evt_write->len; + memcpy(g_rcv_data.data+g_rcv_data.offset, p_evt_write->data, chunk_size); + g_rcv_data.offset += chunk_size; + if (g_rcv_data.len <= g_rcv_data.offset) + { + error_code = p_data_handler->m_data_consume_func(g_rcv_data.data, g_rcv_data.len); + p_data_handler->m_data_free_func(g_rcv_data.data,g_rcv_data.len); + wechat_error_chack(p_wcs, p_data_handler, error_code); + g_rcv_data.len = 0; + g_rcv_data.offset = 0; + + } + } +} + +//΢ŷ¼ +void ble_wechat_on_ble_evt(ble_wechat_t *p_wcs,ble_evt_t * p_ble_evt, data_handler *p_data_handler) { + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED://ȡǰ + p_wcs->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; + break; + case BLE_GATTS_EVT_WRITE:// + on_write(p_wcs,p_ble_evt,p_data_handler); + break; + case BLE_GATTS_EVT_HVC://ȷ + on_indicate_comfirm(p_wcs,p_ble_evt,p_data_handler); + break; + case BLE_GAP_EVT_DISCONNECTED://Ͽ + p_wcs->conn_handle = BLE_CONN_HANDLE_INVALID; + break; + default: + break; + } +} + +//GATTS service΢ŷ +//Add WeChat Service to GATTS sercvice +uint32_t ble_wechat_add_service(ble_wechat_t *p_wechat) +{ + uint32_t err_code; + ble_uuid_t ble_wechat_uuid; + BLE_UUID_BLE_ASSIGN(ble_wechat_uuid, BLE_UUID_WECHAT_SERVICE); + err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_wechat_uuid, &p_wechat->service_handle); + return err_code; +} + +static void get_mac_addr(uint8_t *p_mac_addr) +{ + uint32_t error_code; + ble_gap_addr_t *p_mac_addr_t = (ble_gap_addr_t*)malloc(sizeof(ble_gap_addr_t)); + error_code = sd_ble_gap_address_get(p_mac_addr_t); + APP_ERROR_CHECK(error_code); + uint8_t *d = p_mac_addr_t->addr; + for ( uint8_t i = 6; i >0;) + { + i--; + p_mac_addr[5-i]= d[i]; + } + free(p_mac_addr_t); + p_mac_addr_t = NULL; +} + +//΢ŷҪindicate_char,write_char,read_char +//Ϊ֧ͬһֻһAPP豸΢Żӵ豸 +//豸Ҫ΢ŵservice汩¶һ read charcater,Ϊ6ֽڵMACַ +//IOSϵAPPӻǸ豸ʱ豸ٹ㲥΢ŻȡֵȷǷҪӸ豸 +//Add the indicate characteristic +uint32_t ble_wechat_add_indicate_char(ble_wechat_t *p_wechat) +{ + ble_gatts_char_md_t char_md; + ble_gatts_attr_md_t cccd_md; + ble_gatts_attr_t attr_char_value; + ble_uuid_t char_uuid; + ble_gatts_attr_md_t attr_md; + char *data = "indicate char"; + memset(&cccd_md, 0, sizeof(cccd_md)); + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm); + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.write_perm); + cccd_md.vloc = BLE_GATTS_VLOC_STACK; + + memset(&char_md, 0, sizeof(char_md)); + char_md.char_props.indicate = 1; + char_md.p_char_user_desc = NULL; + char_md.p_char_pf = NULL; + char_md.p_user_desc_md = NULL; + char_md.p_cccd_md = NULL;//&cccd_md; + char_md.p_sccd_md = NULL; + + BLE_UUID_BLE_ASSIGN(char_uuid, BLE_UUID_WECHAT_INDICATE_CHARACTERISTICS); + memset(&attr_md, 0, sizeof(attr_md)); + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm); + BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.write_perm); + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.rd_auth = 0; + attr_md.wr_auth = 0; + attr_md.vlen = 1; + + memset(&attr_char_value, 0, sizeof(attr_char_value)); + + attr_char_value.p_uuid = &char_uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.init_len = strlen(data); + attr_char_value.init_offs = 0; + attr_char_value.max_len = BLE_WECHAT_MAX_DATA_LEN; + attr_char_value.p_value = (uint8_t *)data; + + return sd_ble_gatts_characteristic_add(p_wechat->service_handle, + &char_md, + &attr_char_value, + &p_wechat->indicate_handles); +} +//write_char +//Add the write characteristic +static uint32_t ble_wechat_add_write_char(ble_wechat_t *p_wechat) +{ + ble_gatts_char_md_t char_md; + ble_gatts_attr_t attr_char_value; + ble_uuid_t char_uuid; + ble_gatts_attr_md_t attr_md; + char *data = "write char"; + + memset(&char_md, 0, sizeof(char_md)); + char_md.char_props.write = 1; + char_md.p_char_user_desc = NULL; + char_md.p_char_pf = NULL; + char_md.p_user_desc_md = NULL; + char_md.p_cccd_md = NULL; + char_md.p_sccd_md = NULL; + + BLE_UUID_BLE_ASSIGN(char_uuid, BLE_UUID_WECHAT_WRITE_CHARACTERISTICS); + + memset(&attr_md, 0, sizeof(attr_md)); + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm); + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.write_perm); + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.rd_auth = 0; + attr_md.wr_auth = 0; + attr_md.vlen = 1; + + memset(&attr_char_value, 0, sizeof(attr_char_value)); + + attr_char_value.p_uuid = &char_uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.init_len = strlen(data); + attr_char_value.init_offs = 0; + attr_char_value.max_len = BLE_WECHAT_MAX_DATA_LEN; + attr_char_value.p_value = (uint8_t *)data; + + return sd_ble_gatts_characteristic_add(p_wechat->service_handle, + &char_md, + &attr_char_value, + &p_wechat->write_handles); +} +//read_charҪȡǰ豸MACַʼ +//Add the read characteristic +static uint32_t ble_wechat_add_read_char(ble_wechat_t *p_wechat) +{ + //m_addl_adv_manuf_data. + get_mac_addr(m_addl_adv_manuf_data); + ble_gatts_char_md_t char_md; + ble_gatts_attr_t attr_char_value; + ble_uuid_t char_uuid; + ble_gatts_attr_md_t attr_md; + + memset(&char_md, 0, sizeof(char_md)); + char_md.char_props.read = 1; + char_md.p_char_user_desc = NULL; + char_md.p_char_pf = NULL; + char_md.p_user_desc_md = NULL; + char_md.p_cccd_md = NULL; + char_md.p_sccd_md = NULL; + + BLE_UUID_BLE_ASSIGN(char_uuid, BLE_UUID_WECHAT_READ_CHARACTERISTICS); + + memset(&attr_md, 0, sizeof(attr_md)); + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm); + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.write_perm); + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.rd_auth = 0; + attr_md.wr_auth = 0; + attr_md.vlen = 1; + + memset(&attr_char_value, 0, sizeof(attr_char_value)); + + attr_char_value.p_uuid = &char_uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.init_len = sizeof(m_addl_adv_manuf_data); + attr_char_value.init_offs = 0; + attr_char_value.max_len = BLE_WECHAT_MAX_DATA_LEN; + attr_char_value.p_value = m_addl_adv_manuf_data; + + return sd_ble_gatts_characteristic_add(p_wechat->service_handle, + &char_md, + &attr_char_value, + &p_wechat->read_handles); +} +//Add the WeChat characteristic include indicate write and read characteristic +uint32_t ble_wechat_add_characteristics(ble_wechat_t *p_wechat) +{ + uint32_t err_code; + err_code = ble_wechat_add_indicate_char(p_wechat); + APP_ERROR_CHECK(err_code); + err_code = ble_wechat_add_write_char(p_wechat); + APP_ERROR_CHECK(err_code); + err_code = ble_wechat_add_read_char(p_wechat); + APP_ERROR_CHECK(err_code); + return err_code; +} + +//device sent data on the indicate characteristic +//΢ŷݷͺ +int ble_wechat_indicate_data(ble_wechat_t *p_wcs,data_handler *p_data_handler, uint8_t *data, int len) +{ + + if (data == NULL || len == 0) { + return 0; + } + if (g_send_data.len != 0 && g_send_data.offset != g_send_data.len) { + printf("\r\n offset:%d %d",g_send_data.offset,g_send_data.len); +// g_send_data.len = 0; +// g_send_data.offset = 0; + + return 0; + } +// nrf_gpio_pin_clear(19); + g_send_data.data = data; + g_send_data.len = len; + g_send_data.offset = 0; + return (ble_wechat_indicate_data_chunk(p_wcs,p_data_handler)); +} + + + + + + + + diff --git a/projects/bleWeChat/src/wechat/ble_wechat_service.h b/projects/bleWeChat/src/wechat/ble_wechat_service.h new file mode 100644 index 0000000..9f70f35 --- /dev/null +++ b/projects/bleWeChat/src/wechat/ble_wechat_service.h @@ -0,0 +1,47 @@ + +#ifndef BLE_WECHAT_SERVICE +#define BLE_WECHAT_SERVICE + +#include +#include +#include "ble.h" +//#include "nrf_gpio.h" +#include "ble_conn_params.h" +#include "ble_stack_handler.h" +#include "ble_types.h" +#include "ble_wechat_util.h" + +//΢ŷʹUUID +#define BLE_UUID_WECHAT_SERVICE 0xFEE7 +#define BLE_UUID_WECHAT_WRITE_CHARACTERISTICS 0xFEC7 +#define BLE_UUID_WECHAT_INDICATE_CHARACTERISTICS 0xFEC8 +#define BLE_UUID_WECHAT_READ_CHARACTERISTICS 0xFEC9 +#define APP_ADV_INTERVAL 40 /**< The advertising interval (in units of 0.625 ms. This value corresponds to 25 ms). */ +#define APP_ADV_TIMEOUT_IN_SECONDS 0 /**< The advertising timeout in units of seconds. */ +#define BLE_WECHAT_MAX_DATA_LEN (GATT_MTU_SIZE_DEFAULT - 3) /**next != NULL) { + handler = handler->next; + if (handler->m_product_type == type) { + return handler; + } + } + return NULL; +} +#define BigLittleSwap16(A) ((((uint16_t)(A) & 0xff00) >> 8) | \ + (((uint16_t)(A) & 0x00ff) << 8)) + + +#define BigLittleSwap32(A) ((((uint32_t)(A) & 0xff000000) >> 24) | \ + (((uint32_t)(A) & 0x00ff0000) >> 8) | \ + (((uint32_t)(A) & 0x0000ff00) << 8) | \ + (((uint32_t)(A) & 0x000000ff) << 24)) + +int checkCPUendian() +{ + union{ + unsigned long i; + uint8_t s[4]; + }c; + + c.i = 0x12345678; + return (0x12 == c.s[0]); +} + +unsigned long t_htonl(unsigned long h) +{ + return checkCPUendian() ? h : BigLittleSwap32(h); +} + +unsigned long t_ntohl(unsigned long n) +{ + + return checkCPUendian() ? n : BigLittleSwap32(n); +} + +unsigned short htons(unsigned short h) +{ + return checkCPUendian() ? h : BigLittleSwap16(h); +} + +unsigned short ntohs(unsigned short n) +{ + return checkCPUendian() ? n : BigLittleSwap16(n); +} + +/*turn an unsigned short value to big-endian value */ +/*for example 0x1234 in the memory of X86 is 0x34 and 0x12 */ +/*then turn it to Network Byte Order is 0x12 and 0x34 */ + diff --git a/projects/bleWeChat/src/wechat/ble_wechat_util.h b/projects/bleWeChat/src/wechat/ble_wechat_util.h new file mode 100644 index 0000000..96f336c --- /dev/null +++ b/projects/bleWeChat/src/wechat/ble_wechat_util.h @@ -0,0 +1,67 @@ + +#ifndef BLE_WECHAT_UTIL +#define BLE_WECHAT_UTIL + +#include +#include + + +#define PRODUCT_TYPE_UNKNOWN 0 +#define PRODUCT_TYPE_MPBLEDEMO2 1 + +typedef void (*data_produce_func)(void *args, uint8_t **r_data, uint32_t *r_len); +typedef void (*data_free_func)(uint8_t *data, uint32_t len); +typedef int (*data_consume_func)(uint8_t *data, uint32_t len); +typedef void (*data_error_func)(int error_code); + +typedef int32_t (*data_button_handler_func)(void *p_wcs, uint8_t pin_no); +typedef void (*data_main_process_func)(void *p_wcs); +typedef int32_t (*data_init_func)(void); +typedef void (*data_on_ble_evt_func)(void *p_wcs, void * p_ble_evt); + +typedef struct data_handler{ + int m_product_type; + data_produce_func m_data_produce_func; + data_free_func m_data_free_func; + data_consume_func m_data_consume_func; + data_error_func m_data_error_func; + + data_on_ble_evt_func m_data_on_ble_evt_func; + data_init_func m_data_init_func; + data_main_process_func m_data_main_process_func; + data_button_handler_func m_data_button_handler_func; + void *m_data_produce_args; + struct data_handler *next; +} data_handler; + +extern data_handler first_handler; + +#define REGISTER(NAME) \ + do { \ + data_handler *tmp = &NAME##_data_handler; \ + tmp->next = first_handler.next; \ + first_handler.next = tmp; \ + } while(0) + +#define ARGS_ITEM_SET(ARGS_TYPE, ARGS_POINTER, ITEM_NAME, ITEM_VALUE) \ + do { \ + ARGS_TYPE *tmp = (ARGS_TYPE *)ARGS_POINTER; \ + tmp->ITEM_NAME = ITEM_VALUE; \ + } while(0) + + +typedef struct +{ + unsigned char bMagicNumber; + unsigned char bVer; + unsigned short nLength; + unsigned short nCmdId; + unsigned short nSeq; +} BpFixHead; + +data_handler* get_handler_by_type(int type); +unsigned short htons(unsigned short val); +unsigned short ntohs(unsigned short val); +unsigned long t_htonl(unsigned long h); +unsigned long t_ntohl(unsigned long n); +#endif diff --git a/projects/bleWeChat/src/wechat/crc32.c b/projects/bleWeChat/src/wechat/crc32.c new file mode 100644 index 0000000..cb0bbbb --- /dev/null +++ b/projects/bleWeChat/src/wechat/crc32.c @@ -0,0 +1,43 @@ +// crc32.c +// WeChat Embedded +// +// Created by harlliu on 14-03-03. +// Copyright 2014 Tencent. All rights reserved. +// + +#include +#include "crc32.h" + +#define DO1(buf) crc = crc_table(((int)crc ^ (*buf++)) & 0xff) ^ (crc >> 8); +#define DO2(buf) DO1(buf); DO1(buf); +#define DO4(buf) DO2(buf); DO2(buf); +#define DO8(buf) DO4(buf); DO4(buf); + + +static uint32_t crc_table(uint32_t index) +{ + uint32_t c = index; + uint32_t poly = 0xedb88320L; + int k; + + for (k = 0; k < 8; k++) + c = c & 1 ? poly ^ (c >> 1) : c >> 1; + + return c; +} + +uint32_t crc32(uint32_t crc, const uint8_t *buf, int len) +{ + if (buf == NULL) return 0L; + + crc = crc ^ 0xffffffffL; + while (len >= 8) + { + DO8(buf); + len -= 8; + } + if (len) do { + DO1(buf); + } while (--len); + return crc ^ 0xffffffffL; +} diff --git a/projects/bleWeChat/src/wechat/crc32.h b/projects/bleWeChat/src/wechat/crc32.h new file mode 100644 index 0000000..ed25ee8 --- /dev/null +++ b/projects/bleWeChat/src/wechat/crc32.h @@ -0,0 +1,24 @@ +// crc32.h +// WeChat Embedded +// +// Created by harlliu on 14-03-03. +// Copyright 2014 Tencent. All rights reserved. +// + +#ifndef __CRC32_H__ +#define __CRC32_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + uint32_t crc32(uint32_t crc, const uint8_t *buf, int len); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/projects/bleWeChat/src/wechat/epb.c b/projects/bleWeChat/src/wechat/epb.c new file mode 100644 index 0000000..edbe1fc --- /dev/null +++ b/projects/bleWeChat/src/wechat/epb.c @@ -0,0 +1,407 @@ +// epb.c +// WeChat Embedded Proto Buffer +// +// Created by harlliu@tencent.com on 14-02-15. +// Copyright 2014 Tencent. All rights reserved. +// + +// Version : 1.0.2 + +#include +#include "epb.h" + + +#define __LITTLE_ENDIAN__ 1 //Need Test + +typedef enum { + WIRETYPE_VARINT = 0, + WIRETYPE_FIXED64 = 1, + WIRETYPE_LENGTH_DELIMITED = 2, + WIRETYPE_FIXED32 = 5 +} WireType; + +#define CONTINUOUS_MASK 0x80 +#define WIRETYPE_MASK 0x07 + +static int epb_get_varint32_bits(const uint8_t *data, int len, uint32_t *value); + +inline static int sizeof_tag(uint16_t tag) +{ + return ((tag&0xff00) == 0) ? 1 : 2; //TODO:Tag more then two bytes +} + +static uint16_t epb_get_wire_type(uint16_t tag) { + uint16_t wire_type = tag & WIRETYPE_MASK; + if ((tag>>8) != 0) + wire_type = (tag>>8) & WIRETYPE_MASK; + + return wire_type; +} + +static int epb_get_value_length(const uint8_t *data, int len, uint32_t wire_type) +{ + int offset = 0; + switch(wire_type) { + case WIRETYPE_VARINT: + while ((data[offset++]&CONTINUOUS_MASK)!=0 && offset= len) + return -1; + + if (offset >= 5) + break; + + p_value |= ((uint32_t)data[offset]&0x7F) << (offset*7); + ++offset; + } + *value = p_value; + return offset; +} + +static uint32_t epb_get_fixed32_bits(const uint8_t *data, int len) +{ + if(len < 4) + return 0; + + uint32_t value = 0; +#ifdef __LITTLE_ENDIAN__ + memcpy(&value, data, sizeof(uint32_t)); +#else + value = (data[3]<<24)|(data[2]<<16)|(data[1]<<8)|data[0]; +#endif + return value; +} + +void epb_unpack_init(Epb *e, const uint8_t *buf, int len) +{ + e->unpack_buf = buf; + e->buf_len = len; +} + +bool epb_has_tag(Epb *e, uint16_t tag) +{ + int offset = epb_get_tag_value_offset(e->unpack_buf, e->buf_len, tag); + if (offset < 0) + return false; + else + return true; +} + +uint32_t epb_get_uint32(Epb *e, uint16_t tag) +{ + int offset = epb_get_tag_value_offset(e->unpack_buf, e->buf_len, tag); + if (offset < 0) + return 0; + + uint32_t value = 0; + epb_get_varint32_bits(e->unpack_buf+offset, e->buf_len-offset, &value); + return value; +} + +int32_t epb_get_int32(Epb *e, uint16_t tag) +{ + return epb_get_uint32(e, tag); +} + +int32_t epb_get_sint32(Epb *e, uint16_t tag) +{ + uint32_t value = epb_get_uint32(e, tag); + if (value&1) + return -(value>>1) - 1; + else + return value>>1; +} + +bool epb_get_bool(Epb *e, uint16_t tag) +{ + return epb_get_uint32(e, tag); +} + +int epb_get_enum(Epb *e, uint16_t tag) +{ + return epb_get_uint32(e, tag); +} + +const uint8_t *epb_get_bytes(Epb *e, uint16_t tag, int *len) +{ + int offset = epb_get_tag_value_offset(e->unpack_buf, e->buf_len, tag); + if (offset < 0) + return NULL; + + uint32_t l; + offset += epb_get_varint32_bits(e->unpack_buf+offset, e->buf_len-offset, &l); + *len = (int)l; + + return e->unpack_buf+offset; +} + +const char *epb_get_string(Epb *e, uint16_t tag, int *len) +{ + return (char *)epb_get_bytes(e, tag, len); +} + +const Message *epb_get_message(Epb *e, uint16_t tag, int *len) +{ + return (Message *)epb_get_bytes(e, tag, len); +} + +uint32_t epb_get_fixed32(Epb *e, uint16_t tag) +{ + int offset = epb_get_tag_value_offset(e->unpack_buf, e->buf_len, tag); + if (offset < 0) + return 0; + + return epb_get_fixed32_bits(e->unpack_buf+offset, e->buf_len-offset); +} + +int32_t epb_get_sfixed32(Epb *e, uint16_t tag) +{ + return epb_get_fixed32(e, tag); +} + +float epb_get_float(Epb *e, uint16_t tag) +{ + uint32_t bits = epb_get_fixed32(e, tag); + return *(float *)&bits; +} + +/* + epb pack functions +*/ + +inline static int epb_pack_buf_remain(Epb *e) +{ + return e->buf_len - e->buf_offset; +} + +static int epb_pack_tag(Epb *e, uint16_t tag) +{ + int tag_len = sizeof_tag(tag); + if (epb_pack_buf_remain(e) >= tag_len) { + uint8_t *buf = e->pack_buf + e->buf_offset; + if (tag_len == 2) //TODO + *(buf++) = 0xff&(tag>>8); + *buf = 0xff&tag; + e->buf_offset += tag_len; + return tag_len; + } + return -1; +} + +static int epb_pack_varint32_bits(Epb *e, uint32_t value) +{ + uint8_t buf[5] = {0}; + int i = 0; + do { + buf[i] = value&0x7f; + if (i-1 >= 0) + buf[i-1] |= 0x80; + value = value >> 7; + ++i; + } while (value!=0 && i<5); + if (epb_pack_buf_remain(e) >= i) { + memcpy(e->pack_buf+e->buf_offset, buf, i); + e->buf_offset += i; + return i; + } + return -1; +} + +void epb_pack_init(Epb *e, uint8_t *buf, int len) +{ + e->pack_buf = buf; + e->buf_len = len; + e->buf_offset = 0; +} + +int epb_get_packed_size(Epb *e) +{ + return e->buf_offset; +} + +int epb_set_uint32(Epb *e, uint16_t tag, uint32_t value) +{ + int len = 0; + int ret = epb_pack_tag(e, tag); + if (ret < 0) return ret; + len += ret; + + ret = epb_pack_varint32_bits(e, value); + if (ret < 0) return ret; + len += ret; + + return len; +} + +int epb_set_int32(Epb *e, uint16_t tag, int32_t value) +{ + return epb_set_uint32(e, tag, value); +} + +int epb_set_sint32(Epb *e, uint16_t tag, int32_t value) +{ + uint32_t v = (value << 1) ^ (value >> 31); + return epb_set_uint32(e, tag, v); +} + +int epb_set_bool(Epb *e, uint16_t tag, bool value) +{ + return epb_set_uint32(e, tag, value); +} + +int epb_set_enum(Epb *e, uint16_t tag, int value) +{ + return epb_set_uint32(e, tag, value); +} + +static int epb_set_fixed32_bits(Epb *e, uint32_t value) +{ + if (epb_pack_buf_remain(e) >= 4) { +#ifdef __LITTLE_ENDIAN__ + memcpy(e->pack_buf+e->buf_offset, &value, 4); +#else + uint8_t *data = (uint8_t *)&value; + for (int i=0; i<4; i++) { + *(e->pack_buf+e->buf_offset+i) = data[4-i]; + } +#endif + e->buf_offset += 4; + return 4; + } + return -1; +} + +static int epb_pack_length_delimited(Epb *e, const uint8_t *data, int len) +{ + if (epb_pack_buf_remain(e) >= len) { + memcpy(e->pack_buf + e->buf_offset, data, len); + e->buf_offset += len; + return len; + } + return -1; +} + +int epb_set_bytes(Epb *e, uint16_t tag, const uint8_t *data, int length) +{ + int len = 0; + int ret = epb_pack_tag(e, tag); + if (ret < 0) return ret; + len += ret; + + ret = epb_pack_varint32_bits(e, length); + if (ret < 0) return ret; + len += ret; + + ret = epb_pack_length_delimited(e, data, length); + if (ret < 0) return ret; + len += ret; + + return len; +} + +int epb_set_string(Epb *e, uint16_t tag, const char *data, int len) +{ + return epb_set_bytes(e, tag, (const uint8_t *)data, len); +} + +int epb_set_message(Epb *e, uint16_t tag, const Message *data, int len) +{ + return epb_set_bytes(e, tag, data, len); +} + +int epb_set_fixed32(Epb *e, uint16_t tag, uint32_t value) +{ + int len = 0; + int ret = epb_pack_tag(e, tag); + if (ret < 0) return ret; + len += ret; + + ret = epb_set_fixed32_bits(e, value); + if (ret < 0) return ret; + len += ret; + + return len; +} + +int epb_set_sfixed32(Epb *e, uint16_t tag, int32_t value) +{ + return epb_set_fixed32(e, tag, value); +} + +int epb_set_float(Epb *e, uint16_t tag, float value) +{ + uint32_t v = *(uint32_t *)&value; + return epb_set_fixed32(e, tag, v); +} + +int epb_varint32_pack_size(uint16_t tag, uint32_t value, bool is_signed) +{ + if (is_signed) + value = (value << 1) ^ (value >> 31); + + int i = 0; + do { + value = value >> 7; + ++i; + } while (value!=0 && i<5); + + return sizeof_tag(tag) + i; +} + +int epb_fixed32_pack_size(uint16_t tag) +{ + return sizeof_tag(tag) + 4; +} + +int epb_length_delimited_pack_size(uint16_t tag, int len) +{ + return epb_varint32_pack_size(tag, len, false) + len; +} diff --git a/projects/bleWeChat/src/wechat/epb.h b/projects/bleWeChat/src/wechat/epb.h new file mode 100644 index 0000000..117d43a --- /dev/null +++ b/projects/bleWeChat/src/wechat/epb.h @@ -0,0 +1,109 @@ +// epb.h +// MicroMessenger +// +// Created by harlliu@tencent.com on 14-02-15. +// Copyright 2014 Tencent. All rights reserved. +// + +// Version : 1.0.2 + +#ifndef __EPB_H__ +#define __EPB_H__ + +#include +#include + +typedef struct +{ + uint8_t *data; + int len; +} Bytes; + +typedef struct +{ + const uint8_t *data; + int len; +} CBytes; + +typedef struct +{ + char *str; + int len; +} String; + +typedef struct +{ + const char *str; + int len; +} CString; + +typedef uint8_t Message; + +typedef struct +{ + const uint8_t *unpack_buf; + uint8_t *pack_buf; + int buf_len; + int buf_offset; +} Epb; + +/* + * embeded protobuf unpack functions + */ + +void epb_unpack_init(Epb *e, const uint8_t *buf, int len); +bool epb_has_tag(Epb *e, uint16_t tag); + +//Varint +int32_t epb_get_int32(Epb *e, uint16_t tag); +uint32_t epb_get_uint32(Epb *e, uint16_t tag); +int32_t epb_get_sint32(Epb *e, uint16_t tag); +bool epb_get_bool(Epb *e, uint16_t tag); +int epb_get_enum(Epb *e, uint16_t tag); + +//Length Delimited +const char *epb_get_string(Epb *e, uint16_t tag, int *len); +const uint8_t *epb_get_bytes(Epb *e, uint16_t tag, int *len); +const Message *epb_get_message(Epb *e, uint16_t tag, int *len); + +//Length Delimited Packed Repeadted Field +//TODO + +//Fixed32 +uint32_t epb_get_fixed32(Epb *e, uint16_t tag); +int32_t epb_get_sfixed32(Epb *e, uint16_t tag); +float epb_get_float(Epb *e, uint16_t tag); + +/* + * embeded protobuf pack functions + */ + +void epb_pack_init(Epb *e, uint8_t *buf, int len); +int epb_get_packed_size(Epb *e); + +//Varint +int epb_set_int32(Epb *e, uint16_t tag, int32_t value); +int epb_set_uint32(Epb *e, uint16_t tag, uint32_t value); +int epb_set_sint32(Epb *e, uint16_t tag, int32_t value); +int epb_set_bool(Epb *e, uint16_t tag, bool value); +int epb_set_enum(Epb *e, uint16_t tag, int value); + +//Length Delimited +int epb_set_string(Epb *e, uint16_t tag, const char *data, int len); +int epb_set_bytes(Epb *e, uint16_t tag, const uint8_t *data, int len); +int epb_set_message(Epb *e, uint16_t tag, const Message *data, int len); + +//Length Delimited Packed Repeadted Field +//TODO + +//Fixed32 +int epb_set_fixed32(Epb *e, uint16_t tag, uint32_t value); +int epb_set_sfixed32(Epb *e, uint16_t tag, int32_t value); +int epb_set_float(Epb *e, uint16_t tag, float value); + +//Pack size +int epb_varint32_pack_size(uint16_t tag, uint32_t value, bool is_signed); +int epb_fixed32_pack_size(uint16_t tag); +int epb_length_delimited_pack_size(uint16_t tag, int len); + +#endif diff --git a/projects/bleWeChat/src/wechat/epb_MmBp.c b/projects/bleWeChat/src/wechat/epb_MmBp.c new file mode 100644 index 0000000..711fc0b --- /dev/null +++ b/projects/bleWeChat/src/wechat/epb_MmBp.c @@ -0,0 +1,556 @@ +// epb_MmBp.c +// WeChat Embedded Proto Buffer +// +// Generated by harlliu@tencent.com on 14-11-26. +// Copyright 2014 Tencent. All rights reserved. +// + +// Version : 1.0.4 + +#include +#include +#include +#include "epb_MmBp.h" + +#define TAG_BaseResponse_ErrCode 0x08 +#define TAG_BaseResponse_ErrMsg 0x12 + +#define TAG_AuthRequest_BaseRequest 0x0a +#define TAG_AuthRequest_Md5DeviceTypeAndDeviceId 0x12 +#define TAG_AuthRequest_ProtoVersion 0x18 +#define TAG_AuthRequest_AuthProto 0x20 +#define TAG_AuthRequest_AuthMethod 0x28 +#define TAG_AuthRequest_AesSign 0x32 +#define TAG_AuthRequest_MacAddress 0x3a +#define TAG_AuthRequest_TimeZone 0x52 +#define TAG_AuthRequest_Language 0x5a +#define TAG_AuthRequest_DeviceName 0x62 + +#define TAG_AuthResponse_BaseResponse 0x0a +#define TAG_AuthResponse_AesSessionKey 0x12 + +#define TAG_InitRequest_BaseRequest 0x0a +#define TAG_InitRequest_RespFieldFilter 0x12 +#define TAG_InitRequest_Challenge 0x1a + +#define TAG_InitResponse_BaseResponse 0x0a +#define TAG_InitResponse_UserIdHigh 0x10 +#define TAG_InitResponse_UserIdLow 0x18 +#define TAG_InitResponse_ChalleangeAnswer 0x20 +#define TAG_InitResponse_InitScence 0x28 +#define TAG_InitResponse_AutoSyncMaxDurationSecond 0x30 +#define TAG_InitResponse_UserNickName 0x5a +#define TAG_InitResponse_PlatformType 0x60 +#define TAG_InitResponse_Model 0x6a +#define TAG_InitResponse_Os 0x72 +#define TAG_InitResponse_Time 0x78 +#define TAG_InitResponse_TimeZone 0x8001 +#define TAG_InitResponse_TimeString 0x8a01 + +#define TAG_SendDataRequest_BaseRequest 0x0a +#define TAG_SendDataRequest_Data 0x12 +#define TAG_SendDataRequest_Type 0x18 + +#define TAG_SendDataResponse_BaseResponse 0x0a +#define TAG_SendDataResponse_Data 0x12 + +#define TAG_RecvDataPush_BasePush 0x0a +#define TAG_RecvDataPush_Data 0x12 +#define TAG_RecvDataPush_Type 0x18 + +#define TAG_SwitchViewPush_BasePush 0x0a +#define TAG_SwitchViewPush_SwitchViewOp 0x10 +#define TAG_SwitchViewPush_ViewId 0x18 + +#define TAG_SwitchBackgroudPush_BasePush 0x0a +#define TAG_SwitchBackgroudPush_SwitchBackgroundOp 0x10 + + +int epb_base_request_pack_size(BaseRequest *request) +{ + int pack_size = 0; + + return pack_size; +} + +int epb_pack_base_request(BaseRequest *request, uint8_t *buf, int buf_len) +{ + Epb epb; + epb_pack_init(&epb, buf, buf_len); + + return epb_get_packed_size(&epb); +} + +BaseResponse *epb_unpack_base_response(const uint8_t *buf, int buf_len) +{ + Epb epb; + epb_unpack_init(&epb, buf, buf_len); + + if (!epb_has_tag(&epb, TAG_BaseResponse_ErrCode)) { + return NULL; + } + + BaseResponse *response = (BaseResponse *)malloc(sizeof(BaseResponse)); + memset(response, 0, sizeof(BaseResponse)); + response->err_code = epb_get_int32(&epb, TAG_BaseResponse_ErrCode); + if (epb_has_tag(&epb, TAG_BaseResponse_ErrMsg)) { + response->err_msg.str = epb_get_string(&epb, TAG_BaseResponse_ErrMsg, &response->err_msg.len); + response->has_err_msg = true; + } + + return response; +} + +void epb_unpack_base_response_free(BaseResponse *response) +{ + free(response); +} + +BasePush *epb_unpack_base_push(const uint8_t *buf, int buf_len) +{ + Epb epb; + epb_unpack_init(&epb, buf, buf_len); + + BasePush *push = (BasePush *)malloc(sizeof(BasePush)); + memset(push, 0, sizeof(BasePush)); + + return push; +} + +void epb_unpack_base_push_free(BasePush *push) +{ + free(push); +} + +int epb_auth_request_pack_size(AuthRequest *request) +{ + int pack_size = 0; + int len = 0; + + len = epb_base_request_pack_size(request->base_request); + pack_size += epb_length_delimited_pack_size(TAG_AuthRequest_BaseRequest, len); + if (request->has_md5_device_type_and_device_id) { + pack_size += epb_length_delimited_pack_size(TAG_AuthRequest_Md5DeviceTypeAndDeviceId, request->md5_device_type_and_device_id.len); + } + pack_size += epb_varint32_pack_size(TAG_AuthRequest_ProtoVersion, request->proto_version, false); + pack_size += epb_varint32_pack_size(TAG_AuthRequest_AuthProto, request->auth_proto, false); + pack_size += epb_varint32_pack_size(TAG_AuthRequest_AuthMethod, request->auth_method, false); + if (request->has_aes_sign) { + pack_size += epb_length_delimited_pack_size(TAG_AuthRequest_AesSign, request->aes_sign.len); + } + if (request->has_mac_address) { + pack_size += epb_length_delimited_pack_size(TAG_AuthRequest_MacAddress, request->mac_address.len); + } + if (request->has_time_zone) { + pack_size += epb_length_delimited_pack_size(TAG_AuthRequest_TimeZone, request->time_zone.len); + } + if (request->has_language) { + pack_size += epb_length_delimited_pack_size(TAG_AuthRequest_Language, request->language.len); + } + if (request->has_device_name) { + pack_size += epb_length_delimited_pack_size(TAG_AuthRequest_DeviceName, request->device_name.len); + } + + return pack_size; +} + +int epb_pack_auth_request(AuthRequest *request, uint8_t *buf, int buf_len) +{ + Epb epb; + epb_pack_init(&epb, buf, buf_len); + + int ret; + int tmp_len; + uint8_t *tmp; + + tmp_len = epb_base_request_pack_size(request->base_request); + tmp = (uint8_t *)malloc(tmp_len); + ret = epb_pack_base_request(request->base_request, tmp, tmp_len); + if (ret < 0) { + free(tmp); + return ret; + } + ret = epb_set_message(&epb, TAG_AuthRequest_BaseRequest, tmp, tmp_len); + free(tmp); + if (ret < 0) return ret; + if (request->has_md5_device_type_and_device_id) { + ret = epb_set_bytes(&epb, TAG_AuthRequest_Md5DeviceTypeAndDeviceId, request->md5_device_type_and_device_id.data, request->md5_device_type_and_device_id.len); + if (ret < 0) return ret; + } + ret = epb_set_int32(&epb, TAG_AuthRequest_ProtoVersion, request->proto_version); + if (ret < 0) return ret; + ret = epb_set_int32(&epb, TAG_AuthRequest_AuthProto, request->auth_proto); + if (ret < 0) return ret; + ret = epb_set_enum(&epb, TAG_AuthRequest_AuthMethod, request->auth_method); + if (ret < 0) return ret; + if (request->has_aes_sign) { + ret = epb_set_bytes(&epb, TAG_AuthRequest_AesSign, request->aes_sign.data, request->aes_sign.len); + if (ret < 0) return ret; + } + if (request->has_mac_address) { + ret = epb_set_bytes(&epb, TAG_AuthRequest_MacAddress, request->mac_address.data, request->mac_address.len); + if (ret < 0) return ret; + } + if (request->has_time_zone) { + ret = epb_set_string(&epb, TAG_AuthRequest_TimeZone, request->time_zone.str, request->time_zone.len); + if (ret < 0) return ret; + } + if (request->has_language) { + ret = epb_set_string(&epb, TAG_AuthRequest_Language, request->language.str, request->language.len); + if (ret < 0) return ret; + } + if (request->has_device_name) { + ret = epb_set_string(&epb, TAG_AuthRequest_DeviceName, request->device_name.str, request->device_name.len); + if (ret < 0) return ret; + } + + return epb_get_packed_size(&epb); +} + +AuthResponse *epb_unpack_auth_response(const uint8_t *buf, int buf_len) +{ + Epb epb; + epb_unpack_init(&epb, buf, buf_len); + + const uint8_t *tmp; + int tmp_len; + + if (!epb_has_tag(&epb, TAG_AuthResponse_BaseResponse)) { + return NULL; + } + if (!epb_has_tag(&epb, TAG_AuthResponse_AesSessionKey)) { + return NULL; + } + + AuthResponse *response = (AuthResponse *)malloc(sizeof(AuthResponse)); + memset(response, 0, sizeof(AuthResponse)); + tmp = epb_get_message(&epb, TAG_AuthResponse_BaseResponse, &tmp_len); + response->base_response = epb_unpack_base_response(tmp, tmp_len); + if (response->base_response == NULL) { + free(response); + return NULL; + } + response->aes_session_key.data = epb_get_bytes(&epb, TAG_AuthResponse_AesSessionKey, &response->aes_session_key.len); + + return response; +} + +void epb_unpack_auth_response_free(AuthResponse *response) +{ + epb_unpack_base_response_free(response->base_response); + free(response); +} + +int epb_init_request_pack_size(InitRequest *request) +{ + int pack_size = 0; + int len = 0; + + len = epb_base_request_pack_size(request->base_request); + pack_size += epb_length_delimited_pack_size(TAG_InitRequest_BaseRequest, len); + if (request->has_resp_field_filter) { + pack_size += epb_length_delimited_pack_size(TAG_InitRequest_RespFieldFilter, request->resp_field_filter.len); + } + if (request->has_challenge) { + pack_size += epb_length_delimited_pack_size(TAG_InitRequest_Challenge, request->challenge.len); + } + + return pack_size; +} + +int epb_pack_init_request(InitRequest *request, uint8_t *buf, int buf_len) +{ + Epb epb; + epb_pack_init(&epb, buf, buf_len); + + int ret; + int tmp_len; + uint8_t *tmp; + + tmp_len = epb_base_request_pack_size(request->base_request); + tmp = (uint8_t *)malloc(tmp_len); + ret = epb_pack_base_request(request->base_request, tmp, tmp_len); + if (ret < 0) { + free(tmp); + return ret; + } + ret = epb_set_message(&epb, TAG_InitRequest_BaseRequest, tmp, tmp_len); + free(tmp); + if (ret < 0) return ret; + if (request->has_resp_field_filter) { + ret = epb_set_bytes(&epb, TAG_InitRequest_RespFieldFilter, request->resp_field_filter.data, request->resp_field_filter.len); + if (ret < 0) return ret; + } + if (request->has_challenge) { + ret = epb_set_bytes(&epb, TAG_InitRequest_Challenge, request->challenge.data, request->challenge.len); + if (ret < 0) return ret; + } + + return epb_get_packed_size(&epb); +} + +InitResponse *epb_unpack_init_response(const uint8_t *buf, int buf_len) +{ + Epb epb; + epb_unpack_init(&epb, buf, buf_len); + + const uint8_t *tmp; + int tmp_len; + + if (!epb_has_tag(&epb, TAG_InitResponse_BaseResponse)) { + return NULL; + } + if (!epb_has_tag(&epb, TAG_InitResponse_UserIdHigh)) { + return NULL; + } + if (!epb_has_tag(&epb, TAG_InitResponse_UserIdLow)) { + return NULL; + } + + InitResponse *response = (InitResponse *)malloc(sizeof(InitResponse)); + memset(response, 0, sizeof(InitResponse)); + tmp = epb_get_message(&epb, TAG_InitResponse_BaseResponse, &tmp_len); + response->base_response = epb_unpack_base_response(tmp, tmp_len); + if (response->base_response == NULL) { + free(response); + return NULL; + } + response->user_id_high = epb_get_uint32(&epb, TAG_InitResponse_UserIdHigh); + response->user_id_low = epb_get_uint32(&epb, TAG_InitResponse_UserIdLow); + if (epb_has_tag(&epb, TAG_InitResponse_ChalleangeAnswer)) { + response->challeange_answer = epb_get_uint32(&epb, TAG_InitResponse_ChalleangeAnswer); + response->has_challeange_answer = true; + } + if (epb_has_tag(&epb, TAG_InitResponse_InitScence)) { + response->init_scence = (EmInitScence)epb_get_enum(&epb, TAG_InitResponse_InitScence); + response->has_init_scence = true; + } + if (epb_has_tag(&epb, TAG_InitResponse_AutoSyncMaxDurationSecond)) { + response->auto_sync_max_duration_second = epb_get_uint32(&epb, TAG_InitResponse_AutoSyncMaxDurationSecond); + response->has_auto_sync_max_duration_second = true; + } + if (epb_has_tag(&epb, TAG_InitResponse_UserNickName)) { + response->user_nick_name.str = epb_get_string(&epb, TAG_InitResponse_UserNickName, &response->user_nick_name.len); + response->has_user_nick_name = true; + } + if (epb_has_tag(&epb, TAG_InitResponse_PlatformType)) { + response->platform_type = (EmPlatformType)epb_get_enum(&epb, TAG_InitResponse_PlatformType); + response->has_platform_type = true; + } + if (epb_has_tag(&epb, TAG_InitResponse_Model)) { + response->model.str = epb_get_string(&epb, TAG_InitResponse_Model, &response->model.len); + response->has_model = true; + } + if (epb_has_tag(&epb, TAG_InitResponse_Os)) { + response->os.str = epb_get_string(&epb, TAG_InitResponse_Os, &response->os.len); + response->has_os = true; + } + if (epb_has_tag(&epb, TAG_InitResponse_Time)) { + response->time = epb_get_int32(&epb, TAG_InitResponse_Time); + response->has_time = true; + } + if (epb_has_tag(&epb, TAG_InitResponse_TimeZone)) { + response->time_zone = epb_get_int32(&epb, TAG_InitResponse_TimeZone); + response->has_time_zone = true; + } + if (epb_has_tag(&epb, TAG_InitResponse_TimeString)) { + response->time_string.str = epb_get_string(&epb, TAG_InitResponse_TimeString, &response->time_string.len); + response->has_time_string = true; + } + + return response; +} + +void epb_unpack_init_response_free(InitResponse *response) +{ + epb_unpack_base_response_free(response->base_response); + free(response); +} + +int epb_send_data_request_pack_size(SendDataRequest *request) +{ + int pack_size = 0; + int len = 0; + + len = epb_base_request_pack_size(request->base_request); + pack_size += epb_length_delimited_pack_size(TAG_SendDataRequest_BaseRequest, len); + pack_size += epb_length_delimited_pack_size(TAG_SendDataRequest_Data, request->data.len); + if (request->has_type) { + pack_size += epb_varint32_pack_size(TAG_SendDataRequest_Type, request->type, false); + } + + return pack_size; +} + +int epb_pack_send_data_request(SendDataRequest *request, uint8_t *buf, int buf_len) +{ + Epb epb; + epb_pack_init(&epb, buf, buf_len); + + int ret; + int tmp_len; + uint8_t *tmp; + + tmp_len = epb_base_request_pack_size(request->base_request); + tmp = (uint8_t *)malloc(tmp_len); + ret = epb_pack_base_request(request->base_request, tmp, tmp_len); + if (ret < 0) { + free(tmp); + return ret; + } + ret = epb_set_message(&epb, TAG_SendDataRequest_BaseRequest, tmp, tmp_len); + free(tmp); + if (ret < 0) return ret; + ret = epb_set_bytes(&epb, TAG_SendDataRequest_Data, request->data.data, request->data.len); + if (ret < 0) return ret; + if (request->has_type) { + ret = epb_set_enum(&epb, TAG_SendDataRequest_Type, request->type); + if (ret < 0) return ret; + } + + return epb_get_packed_size(&epb); +} + +SendDataResponse *epb_unpack_send_data_response(const uint8_t *buf, int buf_len) +{ + Epb epb; + epb_unpack_init(&epb, buf, buf_len); + + const uint8_t *tmp; + int tmp_len; + + if (!epb_has_tag(&epb, TAG_SendDataResponse_BaseResponse)) { + return NULL; + } + + SendDataResponse *response = (SendDataResponse *)malloc(sizeof(SendDataResponse)); + memset(response, 0, sizeof(SendDataResponse)); + tmp = epb_get_message(&epb, TAG_SendDataResponse_BaseResponse, &tmp_len); + response->base_response = epb_unpack_base_response(tmp, tmp_len); + if (response->base_response == NULL) { + free(response); + return NULL; + } + if (epb_has_tag(&epb, TAG_SendDataResponse_Data)) { + response->data.data = epb_get_bytes(&epb, TAG_SendDataResponse_Data, &response->data.len); + response->has_data = true; + } + + return response; +} + +void epb_unpack_send_data_response_free(SendDataResponse *response) +{ + epb_unpack_base_response_free(response->base_response); + free(response); +} + +RecvDataPush *epb_unpack_recv_data_push(const uint8_t *buf, int buf_len) +{ + Epb epb; + epb_unpack_init(&epb, buf, buf_len); + + const uint8_t *tmp; + int tmp_len; + + if (!epb_has_tag(&epb, TAG_RecvDataPush_BasePush)) { + return NULL; + } + if (!epb_has_tag(&epb, TAG_RecvDataPush_Data)) { + return NULL; + } + + RecvDataPush *push = (RecvDataPush *)malloc(sizeof(RecvDataPush)); + memset(push, 0, sizeof(RecvDataPush)); + tmp = epb_get_message(&epb, TAG_RecvDataPush_BasePush, &tmp_len); + push->base_push = epb_unpack_base_push(tmp, tmp_len); + if (push->base_push == NULL) { + free(push); + return NULL; + } + push->data.data = epb_get_bytes(&epb, TAG_RecvDataPush_Data, &push->data.len); + if (epb_has_tag(&epb, TAG_RecvDataPush_Type)) { + push->type = (EmDeviceDataType)epb_get_enum(&epb, TAG_RecvDataPush_Type); + push->has_type = true; + } + + return push; +} + +void epb_unpack_recv_data_push_free(RecvDataPush *push) +{ + epb_unpack_base_push_free(push->base_push); + free(push); +} + +SwitchViewPush *epb_unpack_switch_view_push(const uint8_t *buf, int buf_len) +{ + Epb epb; + epb_unpack_init(&epb, buf, buf_len); + + const uint8_t *tmp; + int tmp_len; + + if (!epb_has_tag(&epb, TAG_SwitchViewPush_BasePush)) { + return NULL; + } + if (!epb_has_tag(&epb, TAG_SwitchViewPush_SwitchViewOp)) { + return NULL; + } + if (!epb_has_tag(&epb, TAG_SwitchViewPush_ViewId)) { + return NULL; + } + + SwitchViewPush *push = (SwitchViewPush *)malloc(sizeof(SwitchViewPush)); + memset(push, 0, sizeof(SwitchViewPush)); + tmp = epb_get_message(&epb, TAG_SwitchViewPush_BasePush, &tmp_len); + push->base_push = epb_unpack_base_push(tmp, tmp_len); + if (push->base_push == NULL) { + free(push); + return NULL; + } + push->switch_view_op = (EmSwitchViewOp)epb_get_enum(&epb, TAG_SwitchViewPush_SwitchViewOp); + push->view_id = (EmViewId)epb_get_enum(&epb, TAG_SwitchViewPush_ViewId); + + return push; +} + +void epb_unpack_switch_view_push_free(SwitchViewPush *push) +{ + epb_unpack_base_push_free(push->base_push); + free(push); +} + +SwitchBackgroudPush *epb_unpack_switch_backgroud_push(const uint8_t *buf, int buf_len) +{ + Epb epb; + epb_unpack_init(&epb, buf, buf_len); + + const uint8_t *tmp; + int tmp_len; + + if (!epb_has_tag(&epb, TAG_SwitchBackgroudPush_BasePush)) { + return NULL; + } + if (!epb_has_tag(&epb, TAG_SwitchBackgroudPush_SwitchBackgroundOp)) { + return NULL; + } + + SwitchBackgroudPush *push = (SwitchBackgroudPush *)malloc(sizeof(SwitchBackgroudPush)); + memset(push, 0, sizeof(SwitchBackgroudPush)); + tmp = epb_get_message(&epb, TAG_SwitchBackgroudPush_BasePush, &tmp_len); + push->base_push = epb_unpack_base_push(tmp, tmp_len); + if (push->base_push == NULL) { + free(push); + return NULL; + } + push->switch_background_op = (EmSwitchBackgroundOp)epb_get_enum(&epb, TAG_SwitchBackgroudPush_SwitchBackgroundOp); + + return push; +} + +void epb_unpack_switch_backgroud_push_free(SwitchBackgroudPush *push) +{ + epb_unpack_base_push_free(push->base_push); + free(push); +} diff --git a/projects/bleWeChat/src/wechat/epb_MmBp.h b/projects/bleWeChat/src/wechat/epb_MmBp.h new file mode 100644 index 0000000..79aa2bb --- /dev/null +++ b/projects/bleWeChat/src/wechat/epb_MmBp.h @@ -0,0 +1,242 @@ +// epb_MmBp.h +// WeChat Embedded Proto Buffer +// +// Generated by harlliu@tencent.com on 14-11-26. +// Copyright 2014 Tencent. All rights reserved. +// + +// Version : 1.0.4 + +#ifndef __EPB_MMBP_H__ +#define __EPB_MMBP_H__ + +#include +#include +#include "epb.h" + +typedef enum +{ + ECI_none = 0, + ECI_req_auth = 10001, + ECI_req_sendData = 10002, + ECI_req_init = 10003, + ECI_resp_auth = 20001, + ECI_resp_sendData = 20002, + ECI_resp_init = 20003, + ECI_push_recvData = 30001, + ECI_push_switchView = 30002, + ECI_push_switchBackgroud = 30003, + ECI_err_decode = 29999 +} EmCmdId; + +typedef enum +{ + EEC_system = -1, + EEC_needAuth = -2, + EEC_sessionTimeout = -3, + EEC_decode = -4, + EEC_deviceIsBlock = -5, + EEC_serviceUnAvalibleInBackground = -6, + EEC_deviceProtoVersionNeedUpdate = -7, + EEC_phoneProtoVersionNeedUpdate = -8, + EEC_maxReqInQueue = -9, + EEC_userExitWxAccount = -10 +} EmErrorCode; + +typedef enum +{ + EAM_md5 = 1, + EAM_macNoEncrypt = 2 +} EmAuthMethod; + +typedef enum +{ + EIRFF_userNickName = 0x1, + EIRFF_platformType = 0x2, + EIRFF_model = 0x4, + EIRFF_os = 0x8, + EIRFF_time = 0x10, + EIRFF_timeZone = 0x20, + EIRFF_timeString = 0x40 +} EmInitRespFieldFilter; + +typedef enum +{ + EIS_deviceChat = 1, + EIS_autoSync = 2 +} EmInitScence; + +typedef enum +{ + EPT_ios = 1, + EPT_andriod = 2, + EPT_wp = 3, + EPT_s60v3 = 4, + EPT_s60v5 = 5, + EPT_s40 = 6, + EPT_bb = 7 +} EmPlatformType; + +typedef enum +{ + EDDT_manufatureSvr = 0, + EDDT_wxWristBand = 1, + EDDT_wxDeviceHtmlChatView = 10001 +} EmDeviceDataType; + +typedef enum +{ + ESVO_enter = 1, + ESVO_exit = 2 +} EmSwitchViewOp; + +typedef enum +{ + EVI_deviceChatView = 1, + EVI_deviceChatHtmlView = 2 +} EmViewId; + +typedef enum +{ + ESBO_enterBackground = 1, + ESBO_enterForground = 2, + ESBO_sleep = 3 +} EmSwitchBackgroundOp; + +typedef struct +{ + void *none; +} BaseRequest; + +typedef struct +{ + int32_t err_code; + bool has_err_msg; + CString err_msg; +} BaseResponse; + +typedef struct +{ + void *none; +} BasePush; + +typedef struct +{ + BaseRequest *base_request; + bool has_md5_device_type_and_device_id; + Bytes md5_device_type_and_device_id; + int32_t proto_version; + int32_t auth_proto; + EmAuthMethod auth_method; + bool has_aes_sign; + Bytes aes_sign; + bool has_mac_address; + Bytes mac_address; + bool has_time_zone; + String time_zone; + bool has_language; + String language; + bool has_device_name; + String device_name; +} AuthRequest; + +typedef struct +{ + BaseResponse *base_response; + CBytes aes_session_key; +} AuthResponse; + +typedef struct +{ + BaseRequest *base_request; + bool has_resp_field_filter; + Bytes resp_field_filter; + bool has_challenge; + Bytes challenge; +} InitRequest; + +typedef struct +{ + BaseResponse *base_response; + uint32_t user_id_high; + uint32_t user_id_low; + bool has_challeange_answer; + uint32_t challeange_answer; + bool has_init_scence; + EmInitScence init_scence; + bool has_auto_sync_max_duration_second; + uint32_t auto_sync_max_duration_second; + bool has_user_nick_name; + CString user_nick_name; + bool has_platform_type; + EmPlatformType platform_type; + bool has_model; + CString model; + bool has_os; + CString os; + bool has_time; + int32_t time; + bool has_time_zone; + int32_t time_zone; + bool has_time_string; + CString time_string; +} InitResponse; + +typedef struct +{ + BaseRequest *base_request; + Bytes data; + bool has_type; + EmDeviceDataType type; +} SendDataRequest; + +typedef struct +{ + BaseResponse *base_response; + bool has_data; + CBytes data; +} SendDataResponse; + +typedef struct +{ + BasePush *base_push; + CBytes data; + bool has_type; + EmDeviceDataType type; +} RecvDataPush; + +typedef struct +{ + BasePush *base_push; + EmSwitchViewOp switch_view_op; + EmViewId view_id; +} SwitchViewPush; + +typedef struct +{ + BasePush *base_push; + EmSwitchBackgroundOp switch_background_op; +} SwitchBackgroudPush; + +BaseResponse *epb_unpack_base_response(const uint8_t *buf, int buf_len); +void epb_unpack_base_response_free(BaseResponse *response); +int epb_auth_request_pack_size(AuthRequest *request); +int epb_pack_auth_request(AuthRequest *request, uint8_t *buf, int buf_len); +AuthResponse *epb_unpack_auth_response(const uint8_t *buf, int buf_len); +void epb_unpack_auth_response_free(AuthResponse *response); +int epb_init_request_pack_size(InitRequest *request); +int epb_pack_init_request(InitRequest *request, uint8_t *buf, int buf_len); +InitResponse *epb_unpack_init_response(const uint8_t *buf, int buf_len); +void epb_unpack_init_response_free(InitResponse *response); +int epb_send_data_request_pack_size(SendDataRequest *request); +int epb_pack_send_data_request(SendDataRequest *request, uint8_t *buf, int buf_len); +SendDataResponse *epb_unpack_send_data_response(const uint8_t *buf, int buf_len); +void epb_unpack_send_data_response_free(SendDataResponse *response); +RecvDataPush *epb_unpack_recv_data_push(const uint8_t *buf, int buf_len); +void epb_unpack_recv_data_push_free(RecvDataPush *push); +SwitchViewPush *epb_unpack_switch_view_push(const uint8_t *buf, int buf_len); +void epb_unpack_switch_view_push_free(SwitchViewPush *push); +SwitchBackgroudPush *epb_unpack_switch_backgroud_push(const uint8_t *buf, int buf_len); +void epb_unpack_switch_backgroud_push_free(SwitchBackgroudPush *push); + +#endif diff --git a/projects/bleWeChat/src/wechat/md5.c b/projects/bleWeChat/src/wechat/md5.c new file mode 100644 index 0000000..054c1a4 --- /dev/null +++ b/projects/bleWeChat/src/wechat/md5.c @@ -0,0 +1,107 @@ +/* + * modified by anqiren 2014/12/10 V1.0bat + */ +#include +#include +#include +#include "md5.h" +const uint32_t X[4][2] = {{0, 1}, {1, 5}, {5, 3}, {0, 7}}; +const uint32_t S[4][4] = {{ 7, 12, 17, 22 },{ 5, 9 , 14, 20 },{ 4, 11, 16, 23 },{ 6, 10, 15, 21 }}; +uint32_t F( uint32_t X, uint32_t Y, uint32_t Z ) +{ + return ( X & Y ) | ( ~X & Z ); +} +uint32_t G( uint32_t X, uint32_t Y, uint32_t Z ) + { + return ( X & Z ) | ( Y & ~Z ); + } +uint32_t H( uint32_t X, uint32_t Y, uint32_t Z ) +{ + return X ^ Y ^ Z; +} +uint32_t I( uint32_t X, uint32_t Y, uint32_t Z ) +{ + return Y ^ ( X | ~Z ); +} + // rotates x left s bits. +uint32_t rotate_left( uint32_t x, uint32_t s ) +{ + return ( x << s ) | ( x >> ( 32 - s ) ); +} + // Pre-processin +uint32_t count_padding_bits ( uint32_t length ) +{ +// uint32_t div = length * BITS / BLOCK_SIZE; + uint32_t mod = length * BITS % BLOCK_SIZE; + uint32_t c_bits; + if ( mod == 0 ) + { + c_bits = MOD_SIZE; + } + else + { + c_bits = ( MOD_SIZE + BLOCK_SIZE - mod ) % BLOCK_SIZE; + } + return c_bits / BITS; +} +MD5String append_padding_bits ( char * argv ) +{ + uint32_t msg_length = strlen ( argv ); + uint32_t bit_length = count_padding_bits ( msg_length ); + uint64_t app_length = msg_length * BITS; + MD5String string; + string.str = (char *)malloc(msg_length + bit_length + APP_SIZE / BITS); + strncpy ( string.str, argv, msg_length ); + memset ( string.str + msg_length, 0, bit_length ); + string.str [ msg_length ] = SINGLE_ONE_BIT; + memmove ( string.str + msg_length + bit_length, (char *)&app_length, sizeof( uint64_t ) ); + string.len = msg_length + bit_length + sizeof( uint64_t ); + return string; +} +int32_t md5 (char *argv, uint8_t *md5_32) +{ + MD5String string; + uint32_t w[16]; + uint32_t chain[4]; + uint32_t state[4]; +// uint8_t r[16]; + uint32_t ( *auxi[ 4 ])( uint32_t, uint32_t, uint32_t ) = { F, G, H, I }; + int sIdx; + int wIdx; + string = append_padding_bits ( argv ); + chain[0] = A; + chain[1] = B; + chain[2] = C; + chain[3] = D; + for (uint32_t j = 0; j < string.len; j += BLOCK_SIZE / BITS) + { + memmove ( (char *)w, string.str + j, BLOCK_SIZE / BITS ); + memmove ( state, chain, sizeof(chain) ); + for ( uint8_t roundIdx = 0; roundIdx < 4; roundIdx++ ) + { + wIdx = X[ roundIdx ][ 0 ]; + sIdx = 0; + for (uint8_t i = 0; i < 16; i++ ) + { + state[sIdx] = state [(sIdx + 1)%4] + rotate_left( state[sIdx] +(*auxi[ roundIdx])( state[(sIdx+1) % 4], + state[(sIdx+2) % 4], + state[(sIdx+3) % 4]) + w[ wIdx ] + (uint32_t)floor((1ULL << 32) * fabs(sin( roundIdx * 16 + i + 1 )) ), + S[ roundIdx ][ i % 4 ]); + sIdx = ( sIdx + 3 ) % 4; + wIdx = ( wIdx + X[ roundIdx ][ 1 ] ) & 0xF; + } + } + chain[ 0 ] += state[ 0 ]; + chain[ 1 ] += state[ 1 ]; + chain[ 2 ] += state[ 2 ]; + chain[ 3 ] += state[ 3 ]; + } + memmove ( md5_32 + 0, (char *)&chain[0], sizeof(uint32_t) ); + memmove ( md5_32 + 4, (char *)&chain[1], sizeof(uint32_t) ); + memmove ( md5_32 + 8, (char *)&chain[2], sizeof(uint32_t) ); + memmove ( md5_32 + 12, (char *)&chain[3], sizeof(uint32_t) ); + free(string.str); + string.str = NULL; + return EXIT_SUCCESS; +} + diff --git a/projects/bleWeChat/src/wechat/md5.h b/projects/bleWeChat/src/wechat/md5.h new file mode 100644 index 0000000..45a68db --- /dev/null +++ b/projects/bleWeChat/src/wechat/md5.h @@ -0,0 +1,25 @@ +#ifndef __MD5_H__ +#define __MD5_H__ +#include +#include +#include +#include +#include "stdint.h" +#define SINGLE_ONE_BIT 0x80 +#define BLOCK_SIZE 512 +#define MOD_SIZE 448 +#define APP_SIZE 64 +#define BITS 8 + // MD5 Chaining Variable +#define A 0x67452301UL +#define B 0xEFCDAB89UL +#define C 0x98BADCFEUL +#define D 0x10325476UL + +typedef struct +{ + char *str; + uint32_t len; +}MD5String; +int32_t md5 ( char *argv, uint8_t *md5_32); +#endif diff --git a/projects/bleWeChat/src/wechat/mpbledemo2.c b/projects/bleWeChat/src/wechat/mpbledemo2.c new file mode 100644 index 0000000..23a842a --- /dev/null +++ b/projects/bleWeChat/src/wechat/mpbledemo2.c @@ -0,0 +1,775 @@ +/* +* WeChat mpbledemo2 +* +* author by anqiren 2014/12/02 V1.0bat +* +**/ +#include +#include +#include +#include + + +#include "nrf_gpio.h" +#include "epb_MmBp.h" +#include "ble_wechat_util.h" +#include "ble_wechat_service.h" +#include "app_error.h" +#include "md5.h" +#include "crc32.h" +#include "AES.h" +#include "mpbledemo2.h" +#include "comsource.h" + +mpbledemo2_info m_info = {CMD_NULL, {NULL, 0}}; + +#if defined EAM_md5AndNoEnrypt || EAM_md5AndAesEnrypt + uint8_t md5_type_and_id[16]; +#endif + +uint8_t challeange[CHALLENAGE_LENGTH] = {0x11,0x22,0x33,0x44}; //Ϊ˷һȷ飬ʹù + +mpbledemo2_state mpbledemo2Sta = {false, false, false, false, false, false,0,0,0}; +const uint8_t key[16] = DEVICE_KEY +uint8_t session_key[16] = {0}; +data_handler *m_mpbledemo2_handler = NULL; + + +/**@brief Function for the light initialization. + * + * @details Initializes all lights used by this application. + */ + +int32_t mpbledemo2_get_md5(void) +{ + int32_t error_code = 0; + #if defined EAM_md5AndNoEnrypt || EAM_md5AndAesEnrypt + char device_type[] = DEVICE_TYPE; + char device_id[] = DEVICE_ID; + char argv[sizeof(DEVICE_TYPE) + sizeof(DEVICE_ID) - 1]; + memcpy(argv,device_type,sizeof(DEVICE_TYPE)); +/*when add the DEVICE_ID to DEVICE_TYPE, the offset shuld -1 to overwrite '\0' at the end of DEVICE_TYPE */ + memcpy(argv + sizeof(DEVICE_TYPE)-1,device_id,sizeof(DEVICE_ID)); +#ifdef CATCH_LOG + printf ( "\r\nDEVICE_TYPE and DEVICE_ID:%s\r\n",argv); +#endif + error_code = md5(argv, md5_type_and_id); +#ifdef CATCH_LOG + printf ( "\r\nMD5:"); + for ( uint8_t i = 0; i < 16; i++ ) + printf ( " %02x", md5_type_and_id[i] ); + putchar ( '\n' ); +#endif +#endif + return error_code; +} + + +void light_init(void) +{ + nrf_gpio_cfg_output(MPBLEDEMO2_LIGHT); +} +void mpbledemo2_reset() +{ + mpbledemo2Sta.auth_send = false; + mpbledemo2Sta.auth_state = false; + mpbledemo2Sta.indication_state = false; + mpbledemo2Sta.init_send = false; + mpbledemo2Sta.init_state = false; + mpbledemo2Sta.send_data_seq = 0; + mpbledemo2Sta.push_data_seq = 0; + mpbledemo2Sta.seq = 0; +} +int32_t mpbledemo2_init(void) +{ + light_init(); + mpbledemo2_reset(); + return (mpbledemo2_get_md5()); +} + +void light_on(uint8_t light) +{ + nrf_gpio_pin_set(light); +} + +void light_off(uint8_t light) +{ + nrf_gpio_pin_clear(light); +} + +/**@brief Function for handling button pull events. + * + * @param[in] pin_no The pin number of the button pressed. + */ +int32_t mpbledemo2_button_handler(void *p_wcs, uint8_t pin_no) +{ + ble_wechat_t *p_wcs_t = (ble_wechat_t*)p_wcs; + if (m_mpbledemo2_handler == NULL) { + m_mpbledemo2_handler = get_handler_by_type(PRODUCT_TYPE_MPBLEDEMO2); + } + uint8_t *data = NULL; + uint32_t len = 0; + switch (pin_no) + { + case MPBLEDEMO2_BUTTON_1: + { + #ifdef CATCH_LOG + printf("\r\n button 1"); + #endif + ARGS_ITEM_SET(mpbledemo2_info, m_mpbledemo2_handler->m_data_produce_args, cmd, CMD_SENDDAT); + ARGS_ITEM_SET(mpbledemo2_info, m_mpbledemo2_handler->m_data_produce_args, send_msg.len, sizeof(SEND_HELLO_WECHAT)); + ARGS_ITEM_SET(mpbledemo2_info, m_mpbledemo2_handler->m_data_produce_args, send_msg.str, SEND_HELLO_WECHAT); + } + break; + default: + break; + } + m_mpbledemo2_handler->m_data_produce_func(m_mpbledemo2_handler->m_data_produce_args, &data, &len); + if(data == NULL) + { + return errorCodeProduce; + } + ble_wechat_indicate_data(p_wcs_t,m_mpbledemo2_handler, data, len); + m_mpbledemo2_handler->m_data_free_func(data,len); + return 0; +} + +int32_t device_auth(ble_wechat_t *p_wcs) +{ + if (m_mpbledemo2_handler == NULL) { + m_mpbledemo2_handler = get_handler_by_type(PRODUCT_TYPE_MPBLEDEMO2); + } + uint8_t *data = NULL; + uint32_t len = 0; + + ARGS_ITEM_SET(mpbledemo2_info, m_mpbledemo2_handler->m_data_produce_args, cmd, CMD_AUTH); + m_mpbledemo2_handler->m_data_produce_func(m_mpbledemo2_handler->m_data_produce_args, &data, &len); + if(data == NULL) + { + return errorCodeProduce; + } + //sent data + + #ifdef CATCH_LOG + printf("\r\n auth send! "); + #endif + #ifdef CATCH_LOG + printf("\r\n##send data: "); + uint8_t *d = data; + for(uint8_t i=0;inCmdId)); + printf("\r\n len: %d", ntohs(fix_head->nLength )); + printf("\r\n Seq: %d", ntohs(fix_head->nSeq)); + #endif + ble_wechat_indicate_data(p_wcs, m_mpbledemo2_handler, data, len); + m_mpbledemo2_handler->m_data_free_func(data,len); + return 0; + } + + +int32_t device_init(ble_wechat_t *p_wcs) + { + uint8_t *data = NULL; + uint32_t len = 0; + ARGS_ITEM_SET(mpbledemo2_info, m_mpbledemo2_handler->m_data_produce_args, cmd, CMD_INIT); + m_mpbledemo2_handler->m_data_produce_func(m_mpbledemo2_handler->m_data_produce_args, &data, &len); + if(data == NULL) + { + return errorCodeProduce; + } + //sent data + + ble_wechat_indicate_data(p_wcs, m_mpbledemo2_handler, data, len); + m_mpbledemo2_handler->m_data_free_func(data,len); + #ifdef CATCH_LOG + printf("\r\n init send! "); + #endif + #ifdef CATCH_LOG + printf("\r\n##send data: "); + uint8_t *d = data; + for(uint8_t i=0;inCmdId)); + printf("\r\n len: %d", ntohs(fix_head->nLength )); + printf("\r\n Seq: %d", ntohs(fix_head->nSeq)); + #endif + return 0; +} + + +static void mpbledemo2_on_write(ble_wechat_t *p_wcs, ble_evt_t * p_ble_evt) +{ + ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write; + if (p_evt_write->handle == p_wcs->indicate_handles.cccd_handle&& p_evt_write->len == 2) + { + if (ble_srv_is_indication_enabled(p_evt_write->data)) + { + mpbledemo2Sta.indication_state = true; + #ifdef CATCH_LOG + printf("\r\n indication_enabled!"); + #endif + } + else + { + mpbledemo2Sta.indication_state = false; + } + } +} + +static void mpbledemo2_on_disconnect(ble_wechat_t *p_wcs, ble_evt_t * p_ble_evt) +{ + mpbledemo2_reset(); +} +void ble_mpbledemo2_on_ble_evt(void *p_wcs, void *p_ble_evt) +{ + ble_wechat_t *p_wcs_t = (ble_wechat_t*)p_wcs; + ble_evt_t* p_ble_evt_t = (ble_evt_t*)p_ble_evt; + switch (p_ble_evt_t->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + break; + case BLE_GAP_EVT_DISCONNECTED: + mpbledemo2_on_disconnect(p_wcs_t, p_ble_evt); + break; + case BLE_GATTS_EVT_WRITE: + mpbledemo2_on_write(p_wcs_t, p_ble_evt); + break; + default: + break; + } +} + + +void mpbledemo2_main_process(void *p_wcs) +{ + ble_wechat_t *p_wcs_t = (ble_wechat_t*)p_wcs; + int error_code; + if((mpbledemo2Sta.indication_state) && (!mpbledemo2Sta.auth_state) && (!mpbledemo2Sta.auth_send) ) + { + error_code = device_auth(p_wcs_t); + APP_ERROR_CHECK(error_code); + mpbledemo2Sta.auth_send = true; + } + if((mpbledemo2Sta.auth_state) && (!mpbledemo2Sta.init_state) && (!mpbledemo2Sta.init_send)) + { + error_code = device_init(p_wcs_t); + APP_ERROR_CHECK(error_code); + mpbledemo2Sta.init_send = true; + } + return ; +} + +void mpbledemo2_data_free_func(uint8_t *data, uint32_t len) +{ + if(data) + free(data); + data = NULL; +} + + +void mpbledemo2_data_produce_func(void *args, uint8_t **r_data, uint32_t *r_len) +{ + + static uint16_t bleDemoHeadLen = sizeof(BlueDemoHead); + mpbledemo2_info *info = (mpbledemo2_info *)args; + BaseRequest basReq = {NULL}; + static uint8_t fix_head_len = sizeof(BpFixHead); + BpFixHead fix_head = {0xFE, 1, 0, htons(ECI_req_auth), 0}; + mpbledemo2Sta.seq++; + switch (info->cmd) + { + case CMD_AUTH: + { + #if defined EAM_md5AndAesEnrypt + uint8_t deviceid[] = DEVICE_ID; + static uint32_t seq = 0x00000001;// + uint32_t ran = 0x11223344;//Ϊ˷һ̶ֵΪʹʱ + ran = t_htonl(ran); + seq = t_htonl(seq); + uint8_t id_len = strlen(DEVICE_ID); + uint8_t* data = malloc(id_len+8); + if(!data){printf("\r\nNot enough memory!");return;} + memcpy(data,deviceid,id_len); + memcpy(data+id_len,(uint8_t*)&ran,4); + memcpy(data+id_len+4,(uint8_t*)&seq,4); + uint32_t crc = crc32(0, data, id_len+8); + crc = t_htonl(crc); + memset(data,0x00,id_len+8); + memcpy(data,(uint8_t*)&ran,4); + memcpy(data+4,(uint8_t*)&seq,4); + memcpy(data+8,(uint8_t*)&crc,4); + uint8_t CipherText[16]; + AES_Init(key); + AES_Encrypt_PKCS7 (data, CipherText, 12, key); + if(data){free(data);data = NULL;} + AuthRequest authReq = {&basReq, true,{md5_type_and_id, MD5_TYPE_AND_ID_LENGTH}, PROTO_VERSION, AUTH_PROTO, (EmAuthMethod)AUTH_METHOD, true ,{CipherText, CIPHER_TEXT_LENGTH}, false, {NULL, 0}, false, {NULL, 0}, false, {NULL, 0},true,{DEVICE_ID,sizeof(DEVICE_ID)}}; + seq++; + #endif + + #if defined EAM_macNoEncrypt + static uint8_t mac_address[MAC_ADDRESS_LENGTH]; + get_mac_addr(mac_address); + AuthRequest authReq = {&basReq, false,{NULL, 0}, PROTO_VERSION, AUTH_PROTO, (EmAuthMethod)AUTH_METHOD, false,{NULL, 0}, true, {mac_address, MAC_ADDRESS_LENGTH}, false, {NULL, 0}, false, {NULL, 0},true,{DEVICE_ID,sizeof(DEVICE_ID)}}; + #endif + + #if defined EAM_md5AndNoEnrypt + AuthRequest authReq = {&basReq, true,{md5_type_and_id, MD5_TYPE_AND_ID_LENGTH}, PROTO_VERSION, (EmAuthMethod)AUTH_PROTO, (EmAuthMethod)AUTH_METHOD, false ,{NULL, 0}, false, {NULL, 0}, false, {NULL, 0}, false, {NULL, 0},true,{DEVICE_ID,sizeof(DEVICE_ID)}}; + #endif + *r_len = epb_auth_request_pack_size(&authReq) + fix_head_len; + *r_data = (uint8_t *)malloc(*r_len); + if(!(*r_data)){printf("\r\nNot enough memory!");return;} + if(epb_pack_auth_request(&authReq, *r_data+fix_head_len, *r_len-fix_head_len)<0) + { + *r_data = NULL; + return; + } + fix_head.nCmdId = htons(ECI_req_auth); + fix_head.nLength = htons(*r_len); + fix_head.nSeq = htons(mpbledemo2Sta.seq); + memcpy(*r_data, &fix_head, fix_head_len); + return ; + } + case CMD_INIT: + { + //has challeange + InitRequest initReq = {&basReq,false, {NULL, 0},true, {challeange, CHALLENAGE_LENGTH}}; + *r_len = epb_init_request_pack_size(&initReq) + fix_head_len; + #if defined EAM_md5AndAesEnrypt + uint8_t length = *r_len; + uint8_t *p = malloc(AES_get_length( *r_len-fix_head_len)); + if(!p){printf("\r\nNot enough memory!");return;} + *r_len = AES_get_length( *r_len-fix_head_len)+fix_head_len; + #endif + //pack data + *r_data = (uint8_t *)malloc(*r_len); + if(!(*r_data)) + { + printf("\r\nNot enough memory!"); + return; + } + if(epb_pack_init_request(&initReq, *r_data+fix_head_len, *r_len-fix_head_len)<0) + {*r_data = NULL;return;} + //encrypt body + #if defined EAM_md5AndAesEnrypt + AES_Init(session_key); + AES_Encrypt_PKCS7(*r_data+fix_head_len,p,length-fix_head_len,session_key);//ԭʼݳ + memcpy(*r_data + fix_head_len, p, *r_len-fix_head_len); + if(p)free(p); + #endif + fix_head.nCmdId = htons(ECI_req_init); + fix_head.nLength = htons(*r_len); + fix_head.nSeq = htons(mpbledemo2Sta.seq); + memcpy(*r_data, &fix_head, fix_head_len); + return ; + } + case CMD_SENDDAT: + { + #ifdef CATCH_LOG + printf("\r\n msg to send : %s",(uint8_t*)info->send_msg.str); + #endif + BlueDemoHead *bleDemoHead = (BlueDemoHead*)malloc(bleDemoHeadLen+info->send_msg.len); + if(!bleDemoHead){printf("\r\nNot enough memory!");return;} + bleDemoHead->m_magicCode[0] = MPBLEDEMO2_MAGICCODE_H; + bleDemoHead->m_magicCode[1] = MPBLEDEMO2_MAGICCODE_L; + bleDemoHead->m_version = htons( MPBLEDEMO2_VERSION); + bleDemoHead->m_totalLength = htons(bleDemoHeadLen + info->send_msg.len); + bleDemoHead->m_cmdid = htons(sendTextReq); + bleDemoHead->m_seq = htons(mpbledemo2Sta.seq); + bleDemoHead->m_errorCode = 0; + /*connect body and head.*/ + /*turn to uint8_t* befort offset.*/ + memcpy((uint8_t*)bleDemoHead+bleDemoHeadLen, info->send_msg.str, info->send_msg.len); + SendDataRequest sendDatReq = {&basReq, {(uint8_t*) bleDemoHead, (bleDemoHeadLen + info->send_msg.len)}, false, (EmDeviceDataType)NULL}; + *r_len = epb_send_data_request_pack_size(&sendDatReq) + fix_head_len; + #if defined EAM_md5AndAesEnrypt + uint16_t length = *r_len; + uint8_t *p = malloc(AES_get_length( *r_len-fix_head_len)); + if(!p){printf("\r\nNot enough memory!");return;} + *r_len = AES_get_length( *r_len-fix_head_len)+fix_head_len; + #endif + *r_data = (uint8_t *)malloc(*r_len); + if(!(*r_data)){printf("\r\nNot enough memory!");return;} + if(epb_pack_send_data_request(&sendDatReq, *r_data+fix_head_len, *r_len-fix_head_len)<0) + { + *r_data = NULL; + #if defined EAM_md5AndAesEnrypt + if(p){free(p); + p = NULL;} + #endif + printf("\r\nepb_pack_send_data_request error!"); + return; + } + #if defined EAM_md5AndAesEnrypt + //encrypt body + AES_Init(session_key); + AES_Encrypt_PKCS7(*r_data+fix_head_len,p,length-fix_head_len,session_key);//ԭʼݳ + memcpy(*r_data + fix_head_len, p, *r_len-fix_head_len); + if(p){free(p); p = NULL;} + #endif + fix_head.nCmdId = htons(ECI_req_sendData); + fix_head.nLength = htons(*r_len); + fix_head.nSeq = htons(mpbledemo2Sta.seq); + memcpy(*r_data, &fix_head, fix_head_len); + if(bleDemoHead){free(bleDemoHead);bleDemoHead = NULL;} + #ifdef CATCH_LOG + printf("\r\n##send data: "); + uint8_t *d = *r_data; + for(uint8_t i=0;i<*r_len;++i){ + printf(" %x",d[i]);} + BpFixHead *fix_head = (BpFixHead *)*r_data; + printf("\r\n CMDID: %d",ntohs(fix_head->nCmdId)); + printf("\r\n len: %d", ntohs(fix_head->nLength )); + printf("\r\n Seq: %d", ntohs(fix_head->nSeq)); + #endif + mpbledemo2Sta.send_data_seq++; + + return ; + } + } +} + +int mpbledemo2_data_consume_func(uint8_t *data, uint32_t len) +{ + + BpFixHead *fix_head = (BpFixHead *)data; + uint8_t fix_head_len = sizeof(BpFixHead); + #ifdef CATCH_LOG + printf("\r\n##Received data: "); + uint8_t *d = data; + for(uint8_t i=0;inCmdId)); + printf("\r\n len: %d", ntohs(fix_head->nLength)); + printf("\r\n Seq: %d",ntohs(fix_head->nSeq)); + #endif + switch(ntohs(fix_head->nCmdId)) + { + case ECI_none: + { + } + break; + case ECI_resp_auth: + { + AuthResponse* authResp; + authResp = epb_unpack_auth_response(data+fix_head_len,len-fix_head_len); + #ifdef CATCH_LOG + printf("\r\n@@Received 'authResp'\r\n"); + #endif + if(!authResp){return errorCodeUnpackAuthResp;} + #ifdef CATCH_LOG + printf("\r\n unpack 'authResp' success!\r\n"); + #endif + if(authResp->base_response) + { + if(authResp->base_response->err_code == 0) + { + mpbledemo2Sta.auth_state = true; + + } + else + { + #ifdef CATCH_LOG + printf("\r\n error code:%d",authResp->base_response->err_code); + #endif + #ifdef CATCH_LOG + if(authResp->base_response->has_err_msg) + { + printf("\r\n base_response error msg:%s",authResp->base_response->err_msg.str); + } + #endif + epb_unpack_auth_response_free(authResp); + return authResp->base_response->err_code; + } + } + #if defined EAM_md5AndAesEnrypt// get sessionkey + if(authResp->aes_session_key.len) + { + #ifdef CATCH_LOG + printf("\r\nsession_key:"); + #endif + AES_Init(key); + AES_Decrypt(session_key,authResp->aes_session_key.data,authResp->aes_session_key.len,key); + #ifdef CATCH_LOG + for(uint8_t i = 0;i<16;i++) + { + printf(" 0x%02x",session_key[i]); + } + #endif + } + #endif + epb_unpack_auth_response_free(authResp); + } + break; + case ECI_resp_sendData: + { + + #ifdef CATCH_LOG + printf("\r\n@@Received 'sendDataResp'\r\n"); + #endif + #if defined EAM_md5AndAesEnrypt + uint32_t length = len- fix_head_len;//ܺݳ + uint8_t *p = malloc (length); + if(!p){printf("\r\nNot enough memory!"); if(data)free(data);data = NULL; return 0;} + AES_Init(session_key); + // + AES_Decrypt(p,data+fix_head_len,len- fix_head_len,session_key); + + uint8_t temp; + temp = p[length - 1];//䳤 + len = len - temp;//ȡǰܳ + memcpy(data + fix_head_len, p ,length -temp);//ķŻ + if(p){free(p);p = NULL;} + #endif + SendDataResponse *sendDataResp; + sendDataResp = epb_unpack_send_data_response(data+fix_head_len,len-fix_head_len); + if(!sendDataResp) + { + return errorCodeUnpackSendDataResp; + } + #ifdef CATCH_LOG + BlueDemoHead *bledemohead = (BlueDemoHead*)sendDataResp->data.data; + if(ntohs(bledemohead->m_cmdid) == sendTextResp) + { + printf("\r\n received msg: %s\r\n",sendDataResp->data.data+sizeof(BlueDemoHead)); + } + #endif + if(sendDataResp->base_response->err_code) + { + epb_unpack_send_data_response_free(sendDataResp); + return sendDataResp->base_response->err_code; + } + epb_unpack_send_data_response_free(sendDataResp); + } + break; + case ECI_resp_init: + { + #ifdef CATCH_LOG + printf("\r\n@@Received 'initResp'\r\n"); + #endif + #if defined EAM_md5AndAesEnrypt + uint32_t length = len- fix_head_len;//ܺݳ + uint8_t *p = malloc (length); + if(!p){printf("\r\nNot enough memory!");if(data)free(data);data = NULL; return 0;} + AES_Init(session_key); + // + AES_Decrypt(p,data+fix_head_len,len- fix_head_len,session_key); + + uint8_t temp; + temp = p[length - 1];//䳤 + len = len - temp;//ȡǰܳ + memcpy(data + fix_head_len, p ,length -temp);//ķŻ + if(p){free(p);p = NULL;} + #endif + InitResponse *initResp = epb_unpack_init_response(data+fix_head_len, len-fix_head_len); + if(!initResp) + { + return errorCodeUnpackInitResp; + } + #ifdef CATCH_LOG + printf("\r\n unpack 'initResp' success!"); + #endif + if(initResp->base_response) + { + if(initResp->base_response->err_code == 0) + { + if(initResp->has_challeange_answer) + { + if(crc32(0,challeange,CHALLENAGE_LENGTH) == initResp->challeange_answer) + { + mpbledemo2Sta.init_state = true; + } + } + else mpbledemo2Sta.init_state = true; + mpbledemo2Sta.wechats_switch_state = true; + } + else + { + #ifdef CATCH_LOG + printf("\r\n error code:%d",initResp->base_response->err_code); + #endif + if(initResp->base_response->has_err_msg) + { + #ifdef CATCH_LOG + printf("\r\n base_response error msg:%s",initResp->base_response->err_msg.str); + #endif + } + epb_unpack_init_response_free(initResp); + return initResp->base_response->err_code; + } + } + epb_unpack_init_response_free(initResp); + } + break; + case ECI_push_recvData: + { + #if defined EAM_md5AndAesEnrypt + uint32_t length = len- fix_head_len;//ܺݳ + uint8_t *p = malloc (length); + if(!p){printf("\r\nNot enough memory!");if(data)free(data); data =NULL; return 0;} + AES_Init(session_key); + // + AES_Decrypt(p,data+fix_head_len,len- fix_head_len,session_key); + + uint8_t temp; + temp = p[length - 1];//䳤 + len = len - temp;//ȡǰܳ + memcpy(data + fix_head_len, p ,length -temp);//ķŻ + if(p){free(p);p = NULL;} + #endif + RecvDataPush *recvDatPush; + recvDatPush = epb_unpack_recv_data_push(data+fix_head_len, len-fix_head_len); + #ifdef CATCH_LOG + printf("\r\n@@Received 'recvDataPush'\r\n"); + #endif + if(!recvDatPush) + { + return errorCodeUnpackRecvDataPush; + } + #ifdef CATCH_LOG + printf("\r\n unpack the 'recvDataPush' successfully! \r\n"); + if(recvDatPush->base_push == NULL) + { + printf("\r\n recvDatPush->base_push is NULL! \r\n"); + } + else + { + printf("\r\n recvDatPush->base_push is not NULL! \r\n"); + } + printf("\r\n recvDatPush->data.len: %x \r\n",recvDatPush->data.len); + printf("\r\n recvDatPush->data.data: \r\n"); + const uint8_t *d = recvDatPush->data.data; + for(uint8_t i=0;idata.len;++i){ + printf(" %x",d[i]);} + if(recvDatPush->has_type) + { + printf("\r\n recvDatPush has type! \r\n"); + printf("\r\n type: %d\r\n",recvDatPush->type); + } + #endif + BlueDemoHead *bledemohead = (BlueDemoHead*)recvDatPush->data.data; + #ifdef CATCH_LOG + printf("\r\n magicCode: %x",bledemohead->m_magicCode[0]); + printf(" %x",bledemohead->m_magicCode[1]); + printf("\r\n version: %x",ntohs(bledemohead->m_version)); + printf("\r\n totalLength: %x",ntohs(bledemohead->m_totalLength)); + printf("\r\n cmdid: %x",ntohs(bledemohead->m_cmdid )); + printf("\r\n errorCode: %x",ntohs(bledemohead->m_errorCode)); + #endif + if(ntohs(bledemohead->m_cmdid ) == openLightPush) + { + #ifdef CATCH_LOG + printf("\r\n light on!! "); + #endif + + light_on(MPBLEDEMO2_LIGHT); + + + } + else if(ntohs(bledemohead->m_cmdid ) == closeLightPush) + { + #ifdef CATCH_LOG + printf("\r\n light off!! "); + #endif + + light_off(MPBLEDEMO2_LIGHT); + + } + epb_unpack_recv_data_push_free(recvDatPush); + mpbledemo2Sta.push_data_seq++; + } + break; + case ECI_push_switchView: + { + + mpbledemo2Sta.wechats_switch_state = !mpbledemo2Sta.wechats_switch_state; + #ifdef CATCH_LOG + printf("\r\n@@Received 'switchViewPush'\r\n"); + #endif + #if defined EAM_md5AndAesEnrypt + uint32_t length = len- fix_head_len;//ܺݳ + uint8_t *p = malloc (length); + if(!p){printf("\r\nNot enough memory!");if(data)free(data);data = NULL; return 0;} + AES_Init(session_key); + // + AES_Decrypt(p,data+fix_head_len,len- fix_head_len,session_key); + + uint8_t temp; + temp = p[length - 1];//䳤 + len = len - temp;//ȡǰܳ + memcpy(data + fix_head_len, p ,length -temp);//ķŻ + if(p){free(p);p = NULL;} + #endif + SwitchViewPush *swichViewPush; + swichViewPush = epb_unpack_switch_view_push(data+fix_head_len,len-fix_head_len); + if(!swichViewPush) + { + return errorCodeUnpackSwitchViewPush; + } + epb_unpack_switch_view_push_free(swichViewPush); + } + break; + case ECI_push_switchBackgroud: + { + #ifdef CATCH_LOG + printf("\r\n@@Received 'switchBackgroudPush'\r\n"); + #endif + #if defined EAM_md5AndAesEnrypt + uint32_t length = len- fix_head_len;//ܺݳ + uint8_t *p = malloc (length); + if(!p){printf("\r\nNot enough memory!");if(data)free(data);data = NULL; return 0;} + AES_Init(session_key); + // + AES_Decrypt(p,data+fix_head_len,len- fix_head_len,session_key); + uint8_t temp; + temp = p[length - 1];//䳤 + len = len - temp;//ȡǰܳ + memcpy(data + fix_head_len, p ,length -temp);//ķŻ + if(data){free(p);p = NULL;} + #endif + SwitchBackgroudPush *switchBackgroundPush = epb_unpack_switch_backgroud_push(data+fix_head_len,len-fix_head_len); + if(! switchBackgroundPush) + { + return errorCodeUnpackSwitchBackgroundPush; + } + epb_unpack_switch_backgroud_push_free(switchBackgroundPush); + } + break; + case ECI_err_decode: + break; + default: + { + #ifdef CATCH_LOG + printf("\r\n !!ERROR CMDID:%d",ntohs(fix_head->nCmdId)); + #endif + } + break; + } + return 0; +} +void mpbledemo2_data_error_func(int error_code) +{ + if(error_code) + { + #ifdef CATCH_LOG + printf("\r\n! error: mpbledemo2 reseted"); + #endif + NVIC_SystemReset(); + } +} +data_handler mpbledemo2_data_handler = { + .m_product_type = PRODUCT_TYPE_MPBLEDEMO2, + .m_data_produce_func = &mpbledemo2_data_produce_func, + .m_data_free_func = &mpbledemo2_data_free_func, + .m_data_consume_func = &mpbledemo2_data_consume_func, + .m_data_error_func = &mpbledemo2_data_error_func, + + .m_data_on_ble_evt_func = &ble_mpbledemo2_on_ble_evt, + .m_data_init_func = &mpbledemo2_init, + .m_data_main_process_func = &mpbledemo2_main_process, + .m_data_button_handler_func = &mpbledemo2_button_handler, + .m_data_produce_args = &m_info, + .next = NULL +}; diff --git a/projects/bleWeChat/src/wechat/mpbledemo2.h b/projects/bleWeChat/src/wechat/mpbledemo2.h new file mode 100644 index 0000000..450333a --- /dev/null +++ b/projects/bleWeChat/src/wechat/mpbledemo2.h @@ -0,0 +1,129 @@ + +#ifndef MPBLEDEMO2 +#define MPBLEDEMO2 + +#include +#include +#include +#include +#include "nrf_gpio.h" +#include "epb_MmBp.h" +#include "ble_wechat_util.h" +#include "ble_wechat_service.h" +#include "app_error.h" + + +#define CMD_NULL 0 +#define CMD_AUTH 1 +#define CMD_INIT 2 +#define CMD_SENDDAT 3 + +#define DEVICE_TYPE "gh_1bafe245c2cb" +#define DEVICE_ID "WeChatBluetoothDevice" + + +#define PROTO_VERSION 0x010004 +#define AUTH_PROTO 1 + +#define MAC_ADDRESS_LENGTH 6 + +//#define EAM_md5AndNoEnrypt 1 //֤ʽֻܶеһ +//#define EAM_md5AndAesEnrypt 1 +#define EAM_macNoEncrypt 2 + + +#define DEVICE_KEY {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f}; + +#ifdef EAM_macNoEncrypt + #define AUTH_METHOD EAM_macNoEncrypt + #define MD5_TYPE_AND_ID_LENGTH 0 + #define CIPHER_TEXT_LENGTH 0 +#endif + +#ifdef EAM_md5AndAesEnrypt + #define AUTH_METHOD EAM_md5AndAesEnrypt + #define MD5_TYPE_AND_ID_LENGTH 16 + #define CIPHER_TEXT_LENGTH 16 +#endif +#ifdef EAM_md5AndNoEnrypt + #define AUTH_METHOD EAM_md5AndNoEnrypt + #define MD5_TYPE_AND_ID_LENGTH 16 + #define CIPHER_TEXT_LENGTH 0 +#endif + +#define CHALLENAGE_LENGTH 4 + +#define MPBLEDEMO2_MAGICCODE_H 0xfe +#define MPBLEDEMO2_MAGICCODE_L 0xcf +#define MPBLEDEMO2_VERSION 0x01 +//#define SEND_HELLO_WECHAT "Hello, WeChat!" +#define SEND_HELLO_WECHAT "Hello, WeChat!" + +/* Hardware Resources define */ +#define MPBLEDEMO2_LIGHT 19 +#define MPBLEDEMO2_BUTTON_1 17 + +//룬ֵԸԶ +typedef enum +{ + errorCodeUnpackAuthResp = 0x9990, + errorCodeUnpackInitResp = 0x9991, + errorCodeUnpackSendDataResp = 0x9992, + errorCodeUnpackCtlCmdResp = 0x9993, + errorCodeUnpackRecvDataPush = 0x9994, + errorCodeUnpackSwitchViewPush = 0x9995, + errorCodeUnpackSwitchBackgroundPush = 0x9996, + errorCodeUnpackErrorDecode = 0x9997, +}mpbledemo2UnpackErrorCode; + +//룬ֵԸԶ +typedef enum +{ + errorCodeProduce = 0x9980, +}mpbledemo2PackErrorCode; + +//Mpbledemo2 +typedef enum +{ + sendTextReq = 0x01, //ַ + sendTextResp = 0x1001, //յַ + openLightPush = 0x2001, // + closeLightPush = 0x2002, //ص +}BleDemo2CmdID; + +//Mpbledemo2ͷʽ +typedef struct +{ + uint8_t m_magicCode[2];//ħ + uint16_t m_version;//汾 + uint16_t m_totalLength;//ܳ + uint16_t m_cmdid;// + uint16_t m_seq;// + uint16_t m_errorCode;// +}BlueDemoHead; + +//Mpbledemo2ݽṹ +//ṹҪڱض豸ĿƣҪ豸ijʱȳʼ˽ṹ壬 +//Ȼṹ嵱һݹȥ +//mpbledemo2_data_produce_funcʹ +typedef struct +{ + int cmd; + CString send_msg; +} mpbledemo2_info; + +//Mpbledemo2 ״̬ṹ + typedef struct +{ + bool wechats_switch_state; //˺лǰ̨״̬ + bool indication_state;//indication charǷ񱻶ģtrueʾģfalseʾδ + bool auth_state;//auth״̬trueʾauthɹfalseʾΪauthɹδauth + bool init_state;//int״̬trueʾinitɹfalseʾΪinitɹδinit + bool auth_send;//auth״̬trueʾѾauthfalseʾδauth + bool init_send;//init״̬trueʾѾinitfalseʾδinit + unsigned short send_data_seq;//¼ݵкţDZ + unsigned short push_data_seq;//¼ݵкţDZ + unsigned short seq;//ǰк +}mpbledemo2_state; +extern data_handler mpbledemo2_data_handler; +#endif diff --git a/projects/blezongkong/mdk/JLinkSettings.ini b/projects/blezongkong/mdk/JLinkSettings.ini new file mode 100644 index 0000000..120f45c --- /dev/null +++ b/projects/blezongkong/mdk/JLinkSettings.ini @@ -0,0 +1,39 @@ +[BREAKPOINTS] +ForceImpTypeAny = 0 +ShowInfoWin = 1 +EnableFlashBP = 2 +BPDuringExecution = 0 +[CFI] +CFISize = 0x00 +CFIAddr = 0x00 +[CPU] +MonModeVTableAddr = 0xFFFFFFFF +MonModeDebug = 0 +MaxNumAPs = 0 +LowPowerHandlingMode = 0 +OverrideMemMap = 0 +AllowSimulation = 1 +ScriptFile="" +[FLASH] +CacheExcludeSize = 0x00 +CacheExcludeAddr = 0x00 +MinNumBytesFlashDL = 0 +SkipProgOnCRCMatch = 1 +VerifyDownload = 1 +AllowCaching = 1 +EnableFlashDL = 2 +Override = 1 +Device="Cortex-M0" +[GENERAL] +WorkRAMSize = 0x00 +WorkRAMAddr = 0x00 +RAMUsageLimit = 0x00 +[SWO] +SWOLogFile="" +[MEM] +RdOverrideOrMask = 0x00 +RdOverrideAndMask = 0xFFFFFFFF +RdOverrideAddr = 0xFFFFFFFF +WrOverrideOrMask = 0x00 +WrOverrideAndMask = 0xFFFFFFFF +WrOverrideAddr = 0xFFFFFFFF diff --git a/projects/blezongkong/mdk/clean.bat b/projects/blezongkong/mdk/clean.bat new file mode 100644 index 0000000..0d66c92 --- /dev/null +++ b/projects/blezongkong/mdk/clean.bat @@ -0,0 +1,17 @@ +@echo off +SET KPATH=%~dp0 +echo __________________________________________________ +echo ^>^>^> %~0 +echo %KPATH% +del /Q /S "%KPATH%\*.lst" 2>nul +del /Q /S "%KPATH%\*.map" 2>nul +del /Q /S "%KPATH%\*.uvgui.*" 2>nul +del /Q /S "%KPATH%\*.uvguix.*" 2>nul +del /Q /S "%KPATH%\JLinkLog.txt" 2>nul +del /Q /S "%KPATH%\*.scvd" 2>nul +del /Q /S "%KPATH%\*.i" 2>nul +rd /Q /S "%KPATH%\output" 2>nul + +echo. +choice /T 1 /C ync /CS /D y /n +::TIMEOUT /T 1 diff --git a/projects/blezongkong/mdk/zhongkong.uvoptx b/projects/blezongkong/mdk/zhongkong.uvoptx new file mode 100644 index 0000000..4bdd0e3 --- /dev/null +++ b/projects/blezongkong/mdk/zhongkong.uvoptx @@ -0,0 +1,377 @@ + + + + 1.0 + +
    ### uVision Project, (C) Keil Software
    + + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + uartTest + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\output\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 6 + + + + + + + + + + + Segger\JL2CM3.dll + + + + 0 + DLGUARM + + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000) + + + 0 + JL2CM3 + -U59410384 -O78 -S1 -ZTIFSpeedSel10000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO11 -FD20003000 -FC5000 -FN1 -FF0B6x_256kB_PY_D.FLM -FS018000000 -FL040000 -FP0($$Device:B6x$.\Flash\B6x_256kB_PY_D.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + + + + 0 + 1 + gBleSleep + + + 1 + 1 + DMA_RX_BUFF + + + + 0 + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + + + System Viewer\UART1 + 35905 + + + + + + + core + 1 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 1 + 0 + 0 + ..\..\..\core\mdk\startup.s + startup.s + 0 + 0 + + + + + src + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 1 + 0 + 0 + ..\src\cfg.h + cfg.h + 0 + 0 + + + 2 + 3 + 1 + 0 + 1 + 0 + 0 + ..\src\main.c + main.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + 0 + ..\src\app_uart.c + app_uart.c + 0 + 0 + + + 2 + 5 + 1 + 0 + 0 + 0 + 0 + ..\src\app_speed_governor.c + app_speed_governor.c + 0 + 0 + + + 2 + 6 + 1 + 0 + 0 + 0 + 0 + ..\..\..\modules\src\sftmr.c + sftmr.c + 0 + 0 + + + 2 + 7 + 1 + 0 + 0 + 0 + 0 + ..\src\app_control_out.c + app_control_out.c + 0 + 0 + + + 2 + 8 + 1 + 0 + 0 + 0 + 0 + ..\src\app_ws2812.c + app_ws2812.c + 0 + 0 + + + + + drivers + 1 + 0 + 0 + 0 + + 3 + 9 + 5 + 0 + 1 + 0 + 0 + ..\..\..\drivers\api\drvs.h + drvs.h + 0 + 0 + + + 3 + 10 + 4 + 0 + 1 + 0 + 0 + ..\..\..\drivers\lib\drvs.lib + drvs.lib + 0 + 0 + + + + + debug + 1 + 0 + 0 + 0 + + 4 + 11 + 1 + 0 + 1 + 0 + 0 + ..\..\..\modules\src\debug.c + debug.c + 0 + 0 + + + +
    diff --git a/projects/blezongkong/mdk/zhongkong.uvprojx b/projects/blezongkong/mdk/zhongkong.uvprojx new file mode 100644 index 0000000..d5734ab --- /dev/null +++ b/projects/blezongkong/mdk/zhongkong.uvprojx @@ -0,0 +1,490 @@ + + + + 2.1 + +
    ### uVision Project, (C) Keil Software
    + + + + uartTest + 0x4 + ARM-ADS + + + B6x + Generic + Generic.B6x.1.0.0 + CPUTYPE("Cortex-M0") CLOCK(16000000) ELITTLE + + + + 0 + + + + + + + + + + + ..\..\..\core\B6x.SFR + 1 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\output\ + uartTest + 1 + 0 + 1 + 1 + 1 + .\output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf.exe --bin -o "$L@L.bin" "#L" + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + + + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + + 0 + 6 + + + + + + + + + + + + + + Segger\JL2CM3.dll + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 0 + 1 + 1 + + --c99 --gnu --thumb --bss_threshold=0 --preinclude=..\src\cfg.h + + + ..\src;..\..\..\core;..\..\..\core\mdk;..\..\..\core\reg;..\..\..\drivers\api;..\..\..\modules\api;..\..\..\ble\api;..\..\..\ble\app;..\..\..\ble\prf + + + + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + + --thumb + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + ..\..\..\core\mdk\link_xip.sct + + + --diag_suppress=L6312,L6314,L6329 + + + + + + + + core + + + startup.s + 2 + ..\..\..\core\mdk\startup.s + + + + + src + + + cfg.h + 5 + ..\src\cfg.h + + + main.c + 1 + ..\src\main.c + + + app_uart.c + 1 + ..\src\app_uart.c + + + app_speed_governor.c + 1 + ..\src\app_speed_governor.c + + + sftmr.c + 1 + ..\..\..\modules\src\sftmr.c + + + app_control_out.c + 1 + ..\src\app_control_out.c + + + app_ws2812.c + 1 + ..\src\app_ws2812.c + + + + + drivers + + + drvs.h + 5 + ..\..\..\drivers\api\drvs.h + + + drvs.lib + 4 + ..\..\..\drivers\lib\drvs.lib + + + + + debug + + + debug.c + 1 + ..\..\..\modules\src\debug.c + + + + + + + +
    diff --git a/projects/blezongkong/readme.txt b/projects/blezongkong/readme.txt new file mode 100644 index 0000000..1102c58 --- /dev/null +++ b/projects/blezongkong/readme.txt @@ -0,0 +1,2 @@ + + PA5 ->speed (转把) timer ch4 diff --git a/projects/blezongkong/src/app_ble_uart_proc.c b/projects/blezongkong/src/app_ble_uart_proc.c new file mode 100644 index 0000000..8e57124 --- /dev/null +++ b/projects/blezongkong/src/app_ble_uart_proc.c @@ -0,0 +1,147 @@ +#include "b6x.h" +#include "bledef.h" +#include "drvs.h" + +#include "app.h" +#include "prf_sess.h" +#include "app_uart.h" +#include "app_speed_governor.h" +#include "app_control_out.h" +#include "app_ws2812.h" + +extern BLE_GRB_Data_t BLE_WS2812_GRBs; +extern radar_daraframe_t radar_daraframe; + +#define BLE_MAX_LEN (BLE_MTU - 3) +#define NULL_CNT 20 + +static uint8_t buff[BLE_MAX_LEN]; + + +bool speed_test = 0; + + +// 透传接收回调 +void sess_cb_rxd(uint8_t conidx, uint16_t len, const uint8_t *data) +{ + uart_send(UART1_PORT, len, data); + if(len == 9 && 0xa5 ==data[0] && 0x5a ==data[len-1]){ + + app_set_speed(*(int8_t *)(&data[2])); + + Set_Status(OUT_High_brake,(0x01 & (data[1] >> 0))); + Set_Status(OUT_Low_brake,(0x01 & (data[1] >> 1))); + Set_Status(OUT_Push_key,(0x01 & (data[1] >> 2))); + Set_Status(OUT_High_speed,(0x01 & (data[1] >> 3))); + Set_Status(OUT_Low_speed,(0x01 & (data[1] >> 4))); + Set_Status(OUT_Door_lock,(0x01 & (data[1] >> 5))); + Set_Status(OUT_Switch_gear,(0x01 & (data[1] >> 6))); + + BLE_WS2812_GRBs.len = data[3]; + BLE_WS2812_GRBs.GRBs = ((uint32_t)data[4]<<17)|((uint32_t)data[5]<<9)|((uint32_t)data[6]<<1); + buff[0]=0xa5; + buff[1]=data[1]; + buff[2]=(*(int8_t *)(&data[2]))<0?-data[2]:data[2]; + buff[3]=radar_daraframe.Left_data+1; + buff[4]=radar_daraframe.Right_data+2; + buff[5]=buff[1]+buff[2]+buff[3]+buff[4]; + buff[6]=0x5a; + sess_txd_send(app_env.curidx, 7, buff); + + + } + +} + +/// Uart Data procedure +static void data_proc(void) +{ +// // Todo Loop-Proc +// static uint8_t null_cnt = 0; +// uint16_t len; + +// len = uart1Rb_Read(&buff[buff_len], BLE_MAX_LEN - buff_len); +// if (len > 0) +// { +// buff_len += len; +// if (buff_len < BLE_MAX_LEN) +// { +// return; // wait full +// } +// } +// else +// { +// if ((buff_len > 0) && (null_cnt++ > NULL_CNT)) +// { +// //finish = true; +// null_cnt = 0; +// } +// else +// { +// return; // wait again +// } +// } + +// if (app_state_get() == APP_CONNECTED) +// { +// if (buff[0] == 0xAA) +// { +// speed_test = false; +// DEBUG("GAP Disc!\r\n"); +// gapc_disconnect(app_env.curidx); +// buff_len = 0; +// } +// else if (buff[0] == 'S') +// { +// speed_test = true; +// buff_len = 0; +// } +// else if (sess_txd_send(app_env.curidx, buff_len, buff) == LE_SUCCESS) +// { +// debugHex(buff, buff_len); +// buff_len = 0; +// } +// } +// else +// { +// // goto reset +// if (buff[0] == 0xAA) +// { +// DEBUG("GAP Reset!\r\n"); +// gapm_reset(); +// } + +// buff_len = 0; +// } +} + +#if (CFG_SLEEP) +static void sleep_proc(void) +{ + uint8_t lpsta = ble_sleep(BLE_SLP_TWOSC, BLE_SLP_DURMAX); + + if (lpsta == BLE_IN_SLEEP) + { + uint16_t lpret = core_sleep(CFG_WKUP_BLE_EN); + //DEBUG("ble sta:%d, wksrc:%X", lpsta, lpret); + } + else + { + //DEBUG("ble sta:%d", lpsta); + } +} +#endif //(CFG_SLEEP) + +void app_ble_procedure(void) +{ + #if (CFG_SLEEP) + sleep_proc(); + #endif //(CFG_SLEEP) + + data_proc(); + + if ((app_state_get() == APP_CONNECTED) && (speed_test)) + { + sess_txd_send(app_env.curidx, BLE_MAX_LEN, buff); + } +} diff --git a/projects/blezongkong/src/app_control_out.c b/projects/blezongkong/src/app_control_out.c new file mode 100644 index 0000000..76f14bb --- /dev/null +++ b/projects/blezongkong/src/app_control_out.c @@ -0,0 +1,207 @@ +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" +#include "sftmr.h" + +#include "app_uart.h" +#include "app_speed_governor.h" +#include "app_control_out.h" + +// 使能电平 +bool app_control_en[PA_MAX]={ + [OUT_Door_lock] =OE_HIGH, // 开锁 /H:开锁(同) + [OUT_Push_key] =OE_HIGH, // 开启推车 /L:开启推车(反) + [OUT_Switch_gear] =OE_LOW, // 限速/H:限速(反) + [OUT_High_speed] =OE_HIGH, // 使能高速档位 /L:低使能(反) + [OUT_Low_speed] =OE_HIGH, // 使能低速档位 /L:低使能(反) + [OUT_Back_car] =OE_HIGH, // 使能倒车 /L:低使能倒车(反) + [OUT_Low_brake] =OE_HIGH, // 使能低制动 /L:低使能(反) + [OUT_High_brake] =OE_LOW // 使能高制动 /H:高使能(反) +}; + + +//中控控制IO初始化 +void app_control_init(void){ + // out + gpio_dir_output(OUT_Door_lock,OE_LOW);// 默认锁车 + gpio_dir_output(OUT_Push_key,OE_LOW);// 默认关闭推车模式 + gpio_dir_output(OUT_Switch_gear,OE_LOW);// 默认转把调速模式 + gpio_dir_output(OUT_High_speed,OE_LOW);// 高速档位,默认失能 + gpio_dir_output(OUT_Low_speed,OE_LOW);// 低速档位,默认失能 + gpio_dir_output(OUT_Back_car,OE_LOW);// 默认前进模式 + gpio_dir_output(OUT_Low_brake,OE_LOW);// 默认关低制动 + gpio_dir_output(OUT_High_brake,OE_HIGH);// 默认关高制动 + //in + gpio_dir_input(OUT_Door_lock,IE_DOWN);// 默认锁车 + gpio_dir_input(OUT_Push_key,IE_DOWN);// 默认关闭推车模式 + gpio_dir_input(OUT_Switch_gear,IE_DOWN);// 默认转把调速模式 + gpio_dir_input(OUT_High_speed,IE_DOWN);// 高速档位,默认失能 + gpio_dir_input(OUT_Low_speed,IE_DOWN);// 低速档位,默认失能 + gpio_dir_input(OUT_Back_car,IE_DOWN);// 默认前进模式 + gpio_dir_input(OUT_Low_brake,IE_DOWN);// 默认关低制动 + gpio_dir_input(OUT_High_brake,IE_UP);// 默认关高制动 + + //默认都失能 + Set_Status(OUT_Door_lock,0); + Set_Status(OUT_Push_key,0); + Set_Status(OUT_Switch_gear,0); + Set_Status(OUT_High_speed,0); + Set_Status(OUT_Low_speed,0); + Set_Status(OUT_Back_car,0); //失能倒车 + Set_Status(OUT_Low_brake,0); + Set_Status(OUT_High_brake,0); + + // app_set_Door_lock_status(0);// 默认锁车 + // app_set_Push_status(0);// 默认关闭推车模式 + // app_set_gears_status(0);// 默认转把调速模式 + // app_set_brake_status(0);// 默认关制动 + // app_set_Back_car_status(0);// 默认前进模式 + + // in + gpio_dir_input(IN_EXTI0_Custom0, IE_UP); // Input enable, pull-up + gpio_dir_input(IN_EXTI1_Custom1, IE_UP); + gpio_dir_input(IN_GPS, IE_UP); + + // EXTI config + exti_init(EXTI_DBC(15, 4)); + exti_set(EXTI_FTS, EXTI_SRC(IN_EXTI0_Custom0) | EXTI_SRC(IN_EXTI1_Custom1)); // falling + exti_set(EXTI_DBE, EXTI_SRC(IN_EXTI0_Custom0) | EXTI_SRC(IN_EXTI1_Custom1)); + exti_set(EXTI_IER, EXTI_SRC(IN_EXTI0_Custom0) | EXTI_SRC(IN_EXTI1_Custom1)); + + // IRQ enable + NVIC_EnableIRQ(EXTI_IRQn); + __enable_irq(); +} + +//获取档位状态/0:管理员模式速度无限制/1:游客模式油门限速/2:低速档/3:高速档 +uint8_t app_get_gears_status(void){ + uint8_t ret=0; + + if(0 ==Get_Status(OUT_Switch_gear) && 0 ==Get_Status(OUT_High_speed) && 0 ==Get_Status(OUT_Low_speed)){ + ret =0; + }else if(1 ==Get_Status(OUT_Switch_gear) && 0 ==Get_Status(OUT_High_speed) && 0 ==Get_Status(OUT_Low_speed)){ + ret =1; + }else if(0 ==Get_Status(OUT_Switch_gear) && 0 ==Get_Status(OUT_High_speed) && 1 ==Get_Status(OUT_Low_speed)){ + ret =2; + }else if(0 ==Get_Status(OUT_Switch_gear) && 1 ==Get_Status(OUT_High_speed) && 0 ==Get_Status(OUT_Low_speed)){ + ret =3; + } + + return ret; +} +//设置档位状态/0:管理员模式速度无限制/1:游客模式油门限速/2:低速档/3:高速档 +uint8_t app_set_gears_status(uint8_t val){ + if(0 ==val){ //管理员模式速度无限制 + Set_Status(OUT_Switch_gear,0); + Set_Status(OUT_High_speed,0); + Set_Status(OUT_Low_speed,0); + }else if(1 ==val){//游客模式油门限速 + Set_Status(OUT_Switch_gear,1); + Set_Status(OUT_High_speed,0); + Set_Status(OUT_Low_speed,0); + }else if(2 ==val){//低速模式 + Set_Status(OUT_Switch_gear,0); + Set_Status(OUT_High_speed,0); + Set_Status(OUT_Low_speed,1); + }else if(3 ==val){//高速模式 + Set_Status(OUT_Switch_gear,0); + Set_Status(OUT_High_speed,1); + Set_Status(OUT_Low_speed,0); + } + + return app_get_gears_status(); +} + +//获取刹车状态/0:取消刹车/1:低刹/2:高刹 +uint8_t app_get_brake_status(void){ + uint8_t ret=0; + + if(0 ==Get_Status(OUT_Low_brake) && 0 ==Get_Status(OUT_High_brake)){ + ret =0; + }else if(1 ==Get_Status(OUT_Low_brake) && 0 ==Get_Status(OUT_High_brake)){ + ret =1; + }else if(0 ==Get_Status(OUT_Low_brake) && 1 ==Get_Status(OUT_High_brake)){ + ret =2; + } + + return ret; +} +//设置刹车状态/0:取消刹车/1:低刹/2:高刹 +uint8_t app_set_brake_status(uint8_t val){ + if(1 ==val){//低刹 + Set_Status(OUT_Low_brake,1); + Set_Status(OUT_High_brake,0); + }else if(2 ==val){//高刹 + Set_Status(OUT_Low_brake,0); + Set_Status(OUT_High_brake,1); + }else{ //无刹 + Set_Status(OUT_Low_brake,0); + Set_Status(OUT_High_brake,0); + } + + return app_get_brake_status(); +} + +//获取电门锁状态设置/0:锁车状态/1:开锁状态 +uint8_t app_get_Door_lock_status(void){ + + return Get_Status(OUT_Door_lock); +} + +//电门锁状态设置/0:锁车/1:开锁 +uint8_t app_set_Door_lock_status(bool val){ + Set_Status(OUT_Door_lock,val); + + return Get_Status(OUT_Door_lock); +} + +//推车模式设置/0:退出推车状态/1:推车状态 +uint8_t app_set_Push_status(bool val){ + + Set_Status(OUT_Push_key,val); + + return Get_Status(OUT_Push_key); +} + +//设置行驶方向/0:前进;1:倒车 +uint8_t app_set_Back_car_status(bool val){ + Set_Status(OUT_Back_car,val); + + return Get_Status(OUT_Back_car); +} + + +// GPIO外部中端处理 +void EXTI_IRQHandler(void) +{ + uint32_t irq_sta = EXTI->RIF.Word; + + if (irq_sta & EXTI_SRC(IN_GPS))// + { + EXTI->ICR.Word = EXTI_SRC(IN_GPS); + + /* + custom code... + */ + } + + if (irq_sta & EXTI_SRC(IN_EXTI0_Custom0)) + { + EXTI->ICR.Word = EXTI_SRC(IN_EXTI0_Custom0); + + /* + custom code... + */ + } + + if (irq_sta & EXTI_SRC(IN_EXTI1_Custom1)) + { + EXTI->ICR.Word = EXTI_SRC(IN_EXTI1_Custom1); + + /* + custom code... + */ + } +} + + diff --git a/projects/blezongkong/src/app_control_out.h b/projects/blezongkong/src/app_control_out.h new file mode 100644 index 0000000..dc619e7 --- /dev/null +++ b/projects/blezongkong/src/app_control_out.h @@ -0,0 +1,77 @@ +#ifndef _APP_CONTROL_OUT_H_ +#define _APP_CONTROL_OUT_H_ +#include "b6x.h" +#include "drvs.h" + +// // GPIO的输出需反向 +// enum app_control{ +// IN_GPS =PA08, // GPS输入/0:锁车 +// IN_EXTI0_Custom0 =PA08, // 自定义输入0 +// IN_EXTI1_Custom1 =PA09, // 自定义输入1 /防盗检测/下降沿触发防盗 +// OUT_Door_lock =PA18, // 电门锁 /H:开锁 +// OUT_Push_key =PA14, // 推车键 /L:开启推车 +// OUT_Switch_gear =PA13, // 调速模式选择/H:限速模式/L:不限速 +// OUT_High_speed =PA11, // 高速档位 /L:低使能 +// OUT_Low_speed =PA12, // 低速档位 /L:低使能 +// OUT_Back_car =PA15, // 前进后退 /H:前进/L:后退 +// OUT_Low_brake =PA16, // 低制动 /L:低使能 +// OUT_High_brake =PA17 // 高制动 /H:低使能 +// }; + + +enum app_control{ + IN_GPS =PA08, // GPS输入/0:锁车 + IN_EXTI0_Custom0 =PA08, // 自定义输入0 + IN_EXTI1_Custom1 =PA09, // 自定义输入1 /防盗检测/下降沿触发防盗 + + OUT_Door_lock =PA13, // 电门锁 /1:开锁 + OUT_Push_key =PA12, // 推车键 /1:开启推车 + OUT_Switch_gear =PA11, // 调速模式选择/1:限速模式/0:不限速 + OUT_High_speed =PA14, // 高速档位 /1:使能 + OUT_Low_speed =PA15, // 低速档位 /1:使能 + OUT_Back_car =PA16, // 前进后退 /0:前进/1:后退 + OUT_Low_brake =PA17, // 低制动 /1:使能 + OUT_High_brake =PA18 // 高制动 /1:使能 +}; + +extern bool app_control_en[PA_MAX]; + +//写1使能,写0失能 +#define Set_Status(pad,activity) (gpio_put(pad, ((0 == activity) ? !app_control_en[pad] : app_control_en[pad]))) +#define Get_Status(pad) ((app_control_en[pad] == gpio_get(pad)) ? 1 : 0) + + + + +//中控控制IO初始化 +void app_control_init(void); + +// 设置控制状态 +bool app_set_control_status(uint8_t pad, uint8_t val); + +//获取档位状态/0:管理员模式速度无限制/1:游客模式油门限速/2:低速档/3:高速档 +uint8_t app_get_gears_status(void); + +//获取刹车状态/0:取消刹车/1:低刹/2:高刹 +uint8_t app_get_brake_status(void); + + +//设置档位状态/0:管理员模式速度无限制/1:游客模式油门限速/2:低速档/3:高速档 +uint8_t app_set_gears_status(uint8_t val); + +//设置刹车状态/0:取消刹车/1:低刹/2:高刹 +uint8_t app_set_brake_status(uint8_t val); + +//获取电门锁状态 +uint8_t app_get_Door_lock_status(void); +//电门锁状态设置/0:锁车状态/1:开锁状态 +uint8_t app_set_Door_lock_status(bool val); + +//推车模式设置/0:退出推车状态/1:推车状态 +uint8_t app_set_Push_status(bool val); + +//设置行驶方向/0:前进;1:倒车 +uint8_t app_set_Back_car_status(bool val); + +#endif + diff --git a/projects/blezongkong/src/app_speed_governor.c b/projects/blezongkong/src/app_speed_governor.c new file mode 100644 index 0000000..8cb9e3d --- /dev/null +++ b/projects/blezongkong/src/app_speed_governor.c @@ -0,0 +1,88 @@ +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" +#include "app_speed_governor.h" +#include "sftmr.h" +#include "app_control_out.h" +#include "app_uart.h" + +#define speed_timeout 500 +#define radar_timeout 500 + +extern radar_daraframe_t radar_daraframe; + + +tmr_id_t speed_tmr_id; // softTimer ID +tmr_id_t radar_tmr_id; + +static tmr_tk_t speed_timer_handler(tmr_id_t id); +static tmr_tk_t radar_timer_handler(tmr_id_t id); + +//转把速度调节初始化/PWM4/PA05 +void app_speed_governing_init(int8_t c8_speed){ + + if(c8_speed >= 0){ + app_set_Back_car_status(0);//前进 + }else{ + app_set_Back_car_status(1);//后退 + c8_speed = -c8_speed; + } + + iom_ctrl(PA05, IOM_SEL_TIMER); + + // CTMR + pwm_init(PWM_CTMR, 15, 999);//fo =16MHz /((15+1)*(999+1)) + + pwm_chnl_cfg_t chnl_conf; + chnl_conf.duty = SPEED(c8_speed); + chnl_conf.ccer = PWM_CCER_SIPH; + chnl_conf.ccmr = PWM_CCMR_MODE1; + pwm_chnl_set(PWM_CTMR_CH4, &chnl_conf); + + pwm_start(PWM_CTMR); + + sftmr_init(); + speed_tmr_id = sftmr_start(10, speed_timer_handler); + radar_tmr_id = sftmr_start(10, radar_timer_handler); +} + +static tmr_tk_t speed_timer_handler(tmr_id_t id){ + + (void)(id); + + // app_set_Back_car_status(0);//前进 + pwm_duty_upd(PWM_CTMR_CH4 , 0);//速度清零 + uart_putc(UART1_PORT,'S'); + return 0;//单次 +} + +static tmr_tk_t radar_timer_handler(tmr_id_t id){ + + (void)(id); + + radar_daraframe.Left_data =0; + radar_daraframe.Right_data =0; + uart_putc(UART2_PORT,'R'); + return 0;//单次 +} + + +//设置速度 0~100 +void app_set_speed(int8_t c8_speed){ + if(c8_speed >= 0){ + app_set_Back_car_status(0);//前进 + }else{ + app_set_Back_car_status(1);//后退 + c8_speed = -c8_speed; + } + sftmr_Refresh(speed_tmr_id,_MS(speed_timeout)); + pwm_duty_upd(PWM_CTMR_CH4 , SPEED(c8_speed)); +} + +//刷新雷达数据 +void app_updata_radar(void){ + sftmr_Refresh(radar_tmr_id,_MS(radar_timeout)); + + +} + diff --git a/projects/blezongkong/src/app_speed_governor.h b/projects/blezongkong/src/app_speed_governor.h new file mode 100644 index 0000000..6845877 --- /dev/null +++ b/projects/blezongkong/src/app_speed_governor.h @@ -0,0 +1,20 @@ +#ifndef _SPEED_GOVERNOR_H_ +#define _SPEED_GOVERNOR_H_ +#include "sftmr.h" + +#define PWM_MIN 136 +#define PWM_MAX 580 + +#define SPEED(s) (PWM_MIN + ((PWM_MAX-PWM_MIN)*(s))/100) + + +//转把速度调节初始化/PWM4/PA05 +void app_speed_governing_init(int8_t c8_speed); + +//设置速度 +void app_set_speed(int8_t c8_speed); + +//刷新雷达数据 +void app_updata_radar(void); + +#endif diff --git a/projects/blezongkong/src/app_uart.c b/projects/blezongkong/src/app_uart.c new file mode 100644 index 0000000..72922c5 --- /dev/null +++ b/projects/blezongkong/src/app_uart.c @@ -0,0 +1,290 @@ +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" +#include "rbuf.h" +#include "app_uart.h" +#include "app_speed_governor.h" +#include "app_control_out.h" +#include "app_ws2812.h" + +void app_uart_Init(uint8_t port, uint32_t baudrate, uint8_t io_tx, uint8_t io_rx) +{ + uart_init(port, io_tx, io_rx); + uart_conf(port, BRR_DIV(baudrate, 16M), LCR_BITS(8, 1, none)); + // 使能FIFO 接收8字节时触发、使能超过20字节触发超时中断 + uart_fctl(port, FCR_FIFOEN_BIT | FCR_RXTL_1BYTE, 0, UART_IR_RXRD_BIT); + + NVIC_EnableIRQ(port==UART1_PORT?UART1_IRQn:UART2_IRQn); +} + + +//CRC-8/MAXIM:x8+X5+X4+1 +uint8_t crc8_checkout(uint8_t *buff, uint8_t length) +{ + uint8_t i; + uint8_t crc = 0; //initial value + + while (length--) { + crc ^= *buff++; //crc ^= *buff; buff++; + for(i = 0; i < 8; i++) { + if(crc & 1) + crc = (crc >> 1) ^ 0x8C; //0x8C = reverse 0x31 + else + crc >>= 1; + } + } + return crc; +} + +radar_daraframe_t radar_daraframe; +uart_daraframe_t uart1_daraframe; +volatile uint8_t uart1_state =0; +volatile uint8_t uart1_data_cnt =0; + +extern GRB_Data_t WS2812_GRBs; +bool uart2_Back_car=0; + +static void app_uart1_hande(void){ + uint8_t ret_data[MAX_LEN]={0,0}; + uint8_t length; + + switch(uart1_daraframe.cmd_id){ + case 0x01://电门锁 + if(1 ==uart1_daraframe.length){//电门锁状态设置/0:锁车状态/1:开锁状态 + ret_data[0] =app_set_Door_lock_status(uart1_daraframe.data[0]); + length = 1; + app_uart_Sendcmd(UART1_PORT, uart1_daraframe.cmd_id, uart1_daraframe.reg_addr, ret_data, length); + } + break; + case 0x02://油门控制 + if(3 ==uart1_daraframe.length){ + if(app_get_Door_lock_status()){//开锁时 + if(0 > *(int8_t *)(&uart1_daraframe.data[0])){//倒车 + if(1 == uart2_Back_car){ + // NVIC_EnableIRQ(UART2_IRQn); + // app_uart_Init(UART2_PORT,9600,PA10,PA04);//倒车雷达 + } + uart2_Back_car =0; + + }else {//前进 + if(0 == uart2_Back_car){ + // NVIC_DisableIRQ(UART2_IRQn); + // app_uart_Init(UART2_PORT,9600,PA10,PA09);//磁刹控制器 + } + uart2_Back_car =1; + + } + + app_set_speed(*(int8_t *)(&uart1_daraframe.data[0])); + ret_data[0] = uart1_daraframe.data[0];//当前油门状态 倒车:-100~0 / 前进:0~100 + ret_data[1] = app_set_brake_status(uart1_daraframe.data[1]);//当前刹车状态 + ret_data[2] = app_set_gears_status(uart1_daraframe.data[2]);//当前速度档位 + ret_data[3] = radar_daraframe.Left_data; + ret_data[4] = radar_daraframe.Right_data; + length = 5; + app_uart_Sendcmd(UART1_PORT, uart1_daraframe.cmd_id, uart1_daraframe.reg_addr, ret_data, length); + }else{ + + ret_data[0] = app_get_Door_lock_status(); + length = 1; + app_uart_Sendcmd(UART1_PORT, uart1_daraframe.cmd_id, uart1_daraframe.reg_addr, ret_data, length); + } + } + break; + case 0x03://推车模式 + if(1 ==uart1_daraframe.length){//推车模式设置/0:退出推车状态/1:推车状态 + ret_data[0] =app_set_Push_status(uart1_daraframe.data[0]); + length = 1; + app_uart_Sendcmd(UART1_PORT, uart1_daraframe.cmd_id, uart1_daraframe.reg_addr, ret_data, length); + } + break; + case 0x04://GRB + WS2812_GRBs.len =uart1_daraframe.length; + + for(length=0;length < WS2812_GRBs.len;length++){//G3,R3,B2 + WS2812_GRBs.GRBs[length] = ((uint32_t)(uart1_daraframe.data[length] & 0xE0)<<16) | ((uint32_t)(uart1_daraframe.data[length] & 0x1C)<<11) | ((uint32_t)(uart1_daraframe.data[length] & 0x03)<<6); + } + + // WS2812_GRBs.len =uart1_daraframe.length / 3; + // for(length=0;length < WS2812_GRBs.len;length++){ + // WS2812_GRBs.GRBs[length] = ((uint32_t)uart1_daraframe.data[3*length + 0]<<16) | ((uint32_t)uart1_daraframe.data[3*length +1]<<8) | ((uint32_t)uart1_daraframe.data[3*length +2]); + // } + // app_uart_Sendcmd(UART2_PORT, uart1_daraframe.cmd_id, uart1_daraframe.reg_addr, uart1_daraframe.data, length); + // app_uart_Sendcmd(UART1_PORT, uart1_daraframe.cmd_id, uart1_daraframe.reg_addr, uart1_daraframe.data, length); + break; + + default : + + break; + /* + 其他功能.... + */ + } + uart1_state =0;//数据处理完要清零,准备接收下一帧数据 +} + +static void uart1_Receive(uint8_t data) +{ + uint8_t *frame = (uint8_t *)&uart1_daraframe; + + switch(uart1_state){ + case 0://header + if ((data == (uint8_t)(FRAME_HEADER >> 8)) && (uart1_daraframe.header == 0x0)) { + uart1_daraframe.header = (FRAME_HEADER >> 8); + } else if ((data == (uint8_t)(FRAME_HEADER & 0x00FF)) && (uart1_daraframe.header == (uint8_t)(FRAME_HEADER >> 8))) { + uart1_daraframe.header = ((uint16_t)((FRAME_HEADER << 8)|(FRAME_HEADER >> 8)));//0xA100; + uart1_daraframe.length = 0; + uart1_state = 1;//to cmd id + //debug("header"); + } + break; + case 1://cmd_id + //debug("rxcmd:%x", data); + uart1_daraframe.cmd_id = data; + uart1_state = 2;//to device addr + break; + case 2://reg addr + //debug("reg_addr"); + uart1_daraframe.reg_addr = data; + uart1_state = 3;//to data length + break; + case 3://data length + //debug("length"); + uart1_daraframe.length = (data < MAX_LEN) ? data : MAX_LEN; + if (uart1_daraframe.length == 0) { + uart1_state = 5;//to crc + } else { + uart1_state = 4;//to data + uart1_data_cnt = 0; + } + break; + case 4://data + //debug("data"); + if (uart1_data_cnt < uart1_daraframe.length) { + uart1_daraframe.data[uart1_data_cnt++] = data; + } + if (uart1_data_cnt == uart1_daraframe.length) { + uart1_data_cnt = 0; + uart1_state = 5;//to crc + } + break; + case 5://CRC8 + uart1_daraframe.crc = crc8_checkout(frame, 5 + uart1_daraframe.length); +#if DISABLE_CRC8 + uart1_daraframe.crc = data; +#endif + //计算并验证crc8 + if (uart1_daraframe.crc == data) { + uart1_state = 6;//to ack + //debug("crc correct cmd:%x", uart1_daraframe.cmd_id); + } else { + uart1_state = 0;//to haeder + uart1_daraframe.header = 0; + //debug("crc error cmd:%x-%x", uart1_daraframe.cmd_id, uart1_daraframe.crc); + } + break; + } + // uart_putc(UART1_PORT,data);//debug + // uart_putc(UART1_PORT,'0'+uart1_state); + if(uart1_state == 6){ + uart1_daraframe.header = 0; + uart1_state = 7;//数据处理完,需要将状态位归零,才会接收下一帧数据,即:uart1_state =0时。 + app_uart1_hande(); + uart1_state =0; + /* + rx handler codes.... + */ + } +} + +void UART1_IRQHandler(void) +{ + uint32_t state = UART1->IFM.Word; // UART1->RIF.Word; + + if (state & 0x01) //(BIT_RXRD) + { + UART1->IDR.RXRD = 1; // Disable RXRD Interrupt + + uart1_Receive(UART1->RBR); + UART1->ICR.RXRD = 1; // Clear RXRD Interrupt Flag + UART1->IER.RXRD = 1; // Enable RXRD Interrupt + } + +} + +/* +***************************************UART2***************************************************** +*/ + +uint8_t uart2_state =0; + +static void uart2_Receive(uint8_t data) +{ + switch(uart2_state){ + case 0://header + if (data == 0x0C || data == 0x0D) { + radar_daraframe.header = data; + uart2_state = 1;//to data + //debug("header"); + } + break; + case 1://data + //debug("data:%x", data); + if(0x0c == radar_daraframe.header){ + radar_daraframe.Left_data = data; + }else if(0x0d == radar_daraframe.header){ + radar_daraframe.Right_data = data; + } + uart2_state = 2; + break; + } + + uart_putc(UART2_PORT,data); + uart_putc(UART2_PORT,'0'+uart2_state); + if(uart2_state == 2){ + radar_daraframe.header = 0; + app_updata_radar(); + uart2_state = 0; + /* + rx handler codes.... + */ + } +} + +void UART2_IRQHandler(void) +{ + uint32_t state = UART2->IFM.Word; // UART2->RIF.Word; + + if (state & 0x01) //(BIT_RXRD) + { + UART2->IDR.RXRD = 1; // Disable RXRD Interrupt + + uart2_Receive(UART2->RBR); + UART2->ICR.RXRD = 1; // Clear RXRD Interrupt Flag + UART2->IER.RXRD = 1; // Enable RXRD Interrupt + } + +} +//发送命令 +void app_uart_Sendcmd(uint8_t port, volatile uint8_t cmd_id ,volatile uint8_t reg_addr ,volatile uint8_t *data, volatile uint8_t length) +{ + uart_daraframe_t frame; + uint8_t *cmd_data =(uint8_t *)&frame; + uint8_t i; + + frame.header = ((uint16_t)((FRAME_HEADER << 8)|(FRAME_HEADER >> 8)));//0xA100 + frame.cmd_id = cmd_id; + frame.reg_addr = reg_addr; + frame.length = length < MAX_LEN ? length:MAX_LEN; + + for(i = 0;i < frame.length ;i ++){ + frame.data[i] = * data++; + } + length =5 + frame.length; + frame.crc = crc8_checkout(cmd_data, length); + while(length--) + uart_putc(port, (uint32_t)(*cmd_data ++)); + uart_putc(port, (uint32_t)(frame.crc)); +} + + diff --git a/projects/blezongkong/src/app_uart.h b/projects/blezongkong/src/app_uart.h new file mode 100644 index 0000000..e947691 --- /dev/null +++ b/projects/blezongkong/src/app_uart.h @@ -0,0 +1,40 @@ +#ifndef _APP_UART_H_ +#define _APP_UART_H_ + +#include +#include "uart.h" + +//数据帧头 +#define FRAME_HEADER 0xA100 + +#define MAX_LEN 127 + +//失能数据校验 +#define DISABLE_CRC8 1 + +typedef struct uart_daraframe +{ + volatile uint16_t header;//0xA100 + volatile uint8_t cmd_id; + volatile uint8_t reg_addr; + volatile uint8_t length; + volatile uint8_t data[MAX_LEN]; + volatile uint8_t crc; +} uart_daraframe_t; + +typedef struct radar_daraframe +{ + uint8_t header; + uint8_t Left_data; + uint8_t Right_data; +} radar_daraframe_t; + + +//初始化 +void app_uart_Init(uint8_t port, uint32_t baudrate, uint8_t io_tx, uint8_t io_rx); +//发送命令 +void app_uart_Sendcmd(uint8_t port, volatile uint8_t cmd_id ,volatile uint8_t reg_addr ,volatile uint8_t *data, volatile uint8_t length); + +uint8_t crc8_checkout(uint8_t *buff, uint8_t length); + +#endif diff --git a/projects/blezongkong/src/app_ws2812.c b/projects/blezongkong/src/app_ws2812.c new file mode 100644 index 0000000..1d83b4d --- /dev/null +++ b/projects/blezongkong/src/app_ws2812.c @@ -0,0 +1,61 @@ +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" +#include "app_ws2812.h" + + +#define OUT_GRB_WS2812_DIN PA02 + +uint32_t ___WS2812_DIN___ =1<< OUT_GRB_WS2812_DIN; +//0x02 = 1<>=1){ + WS2812_DIN_H; + if(GRB888 & i ){ + WS2812_DIN_H;WS2812_DIN_H;//880 + WS2812_DIN_H;WS2812_DIN_H; + } + else{ + WS2812_DIN_L;WS2812_DIN_L;//880 + WS2812_DIN_L;WS2812_DIN_L; + } + WS2812_DIN_L; + } + +} + +void GRB_WS2812_Write_GRBs(uint8_t len, uint32_t *GRB888) +{ + + while(len--)GRB_WS2812_Write_24Bits(*GRB888++); + GRB_WS2812_Reset(); +} + +void GRB_WS2812_Write_color(uint8_t len, uint32_t GRB888) +{__disable_irq(); + GRB_WS2812_Reset(); + while(len--)GRB_WS2812_Write_24Bits(GRB888); + __enable_irq(); +} + + diff --git a/projects/blezongkong/src/app_ws2812.h b/projects/blezongkong/src/app_ws2812.h new file mode 100644 index 0000000..69f9a15 --- /dev/null +++ b/projects/blezongkong/src/app_ws2812.h @@ -0,0 +1,28 @@ +#ifndef _APP_WS2812_H_ +#define _APP_WS2812_H_ + +#include + + +typedef struct GRB_Data{ + uint8_t len; + + uint32_t GRBs[127]; +} GRB_Data_t; + +typedef struct BLE_GRB_Data{ + uint8_t len; + uint32_t GRBs; +} BLE_GRB_Data_t; + +void GRB_WS2812_Init(void); + +void GRB_WS2812_Write_24Bits(uint32_t GRB888); + +void GRB_WS2812_Reset(void); + +void GRB_WS2812_Write_color(uint8_t len, uint32_t GRB888); +void GRB_WS2812_Write_GRBs(uint8_t len, uint32_t *GRB888); + + +#endif diff --git a/projects/blezongkong/src/cfg.h b/projects/blezongkong/src/cfg.h new file mode 100644 index 0000000..2f5332d --- /dev/null +++ b/projects/blezongkong/src/cfg.h @@ -0,0 +1,45 @@ +/** + **************************************************************************************** + * + * @file cfg.h + * + * @brief App Configure MACRO, --preinclude + * + **************************************************************************************** + */ + +#ifndef _APP_CFG_H_ +#define _APP_CFG_H_ + +/// System Clock(0=16MHz, 1=32MHz, 2=48MHz, 3=64MHz) +#define SYS_CLK (0) +/// Debug Mode(0=Disable, 1=via UART, 2=via RTT) +#define DBG_MODE (0) + +#define UART_IRQ_MODE (0) +#define UART_RTS_CTRL (1) + +/// BLE Configure (Single or Multi-Connections) +#define BLE_NB_SLAVE (1) +#define BLE_NB_MASTER (0) + +#define BLE_ADDR {0x26, 0x08, 0x33, 0xA1, 0x01, 0xD2} +#define BLE_DEV_NAME "myBle-Uart" +#define BLE_DEV_ICON 0x0000 + +#define BLE_MTU (185) +#define SES_RXD_MAX_LEN (0x200) + +#define APP_ADV_INT_MIN (32) // unit in 0.625ms +#define APP_ADV_INT_MAX (32) // unit in 0.625ms + +/// Profile Configure +#define PRF_DISS (1) +#define PRF_SESS (1) + +/// Serial Service @see prf_sess.h +#define SES_UUID_128 (1) +#define SES_READ_SUP (0) +/// Misc Options +#define CFG_SLEEP (0) +#endif //_APP_CFG_H_ diff --git a/projects/blezongkong/src/main.c b/projects/blezongkong/src/main.c new file mode 100644 index 0000000..1a24677 --- /dev/null +++ b/projects/blezongkong/src/main.c @@ -0,0 +1,103 @@ +#include "b6x.h" +#include "drvs.h" +#include "dbg.h" +#include "app_uart.h" +#include "sftmr.h" +#include "app_speed_governor.h" +#include "app_control_out.h" +#include "app_ws2812.h" + +#include "bledef.h" +#include "app.h" + + +GRB_Data_t WS2812_GRBs; +BLE_GRB_Data_t BLE_WS2812_GRBs; + +extern void app_ble_procedure(void); + +static void sysInit(void) +{ + // Todo config, if need + iwdt_disable(); + + rcc_ble_en(); + rcc_adc_en(); + + rcc_fshclk_set(FSH_CLK_DPSC42); + APBMISC->XOSC16M_CTRL.XOSC16M_CAP_TR = 0x22; +} + +static void devInit(void) +{ + uint16_t rsn = rstrsn(); + + // dbgInit(); + // debug("Start(rsn:0x%X)...\r\n", rsn); + + // Init BLE App + app_init(rsn); + + rf_pa_set(0x0C); + +} + + +static tmr_tk_t test_timer_handler(tmr_id_t id){ + + (void)(id); + + // GRB_WS2812_Write_GRBs(WS2812_GRBs.len ,WS2812_GRBs.GRBs); + GRB_WS2812_Write_color(BLE_WS2812_GRBs.len,BLE_WS2812_GRBs.GRBs); + return 100; +} + +int main(void) +{ + + sysInit(); + devInit(); + + // Global Interrupt Enable + GLOBAL_INT_START(); + + app_control_init(); + app_speed_governing_init(0); + // app_uart_Init(UART1_PORT,115200,PA06,PA07);//上位机 + // app_uart_Init(UART2_PORT,9600,PA03,PA04);//倒车雷达 + + app_uart_Init(UART1_PORT,115200,PA03,PA04);//上位机 + app_uart_Init(UART2_PORT,9600,PA06,PA07);//倒车雷达 + + bootDelayMs(1000); + GRB_WS2812_Init(); + sftmr_start(20, test_timer_handler); + while(1){ + // SoftTimer Polling + sftmr_schedule(); + // Schedule Messages & Events + ble_schedule(); + + + // User's Procedure + app_ble_procedure(); + } +} + + + + + + + + + + + + + + + + + + diff --git a/projects/clrAll.bat b/projects/clrAll.bat new file mode 100644 index 0000000..233e9fb --- /dev/null +++ b/projects/clrAll.bat @@ -0,0 +1,7 @@ +@echo off +echo @ Clean All Project's target... +echo. +for /f "delims=" %%i in ('dir /a-d/b /s "clean.bat"') do (call "%%i") +echo @ Cleaned. +echo. +#pause \ No newline at end of file diff --git a/projects/loadFW.bat b/projects/loadFW.bat new file mode 100644 index 0000000..39da1e0 --- /dev/null +++ b/projects/loadFW.bat @@ -0,0 +1,62 @@ +@echo off & setlocal EnableDelayedExpansion + +SET JLink_exe="C:\Program Files (x86)\SEGGER\JLink\JLink.exe" + +if not exist %JLink_exe% ( + echo error: %JLink_exe% not exist, please modify path! + goto ERROR +) + +::SET KPATH=%~dp0 +::SET FW_Dir=%KPATH%..\ble\lib\ +SET Fw_Hex=..\ble\lib\ble6_fw.hex +SET FW_Cmd=fw_cmd.txt + +echo ************Load B6x File************ +echo. +echo Please input firmware file(*.hex), default "%Fw_Hex%" +SET /p Fw_File=^>^>^> + +if "%Fw_File%"=="" ( + SET Fw_File=%Fw_Hex% +) +echo. + +if not exist "!Fw_File!" ( + echo error: "!Fw_File!" not exist, please choose file! + goto ERROR +) + +REM Add -commandfile to temp file +( +echo device B6x +echo si 1 +echo speed 4000 +echo r +echo h +echo exec SetCompareMode=0 +echo exec SetVerifyDownload=0 +echo exec EnableEraseAllFlashBanks +echo loadfile "!Fw_File!" +echo qc +) > %FW_Cmd% + +ECHO JLink.exe [%JLink_exe%] +ECHO Load Program file [%FW_Dir%%Fw_Hex%] + +::%JLink_exe% -log jlink.log -autoconnect 1 -device B6x -if SWD -speed 4000 -commandfile "%FW_Cmd%" +%JLink_exe% "%FW_Cmd%" +DEL /q %FW_Cmd% + +IF ERRORLEVEL 1 ( + ECHO J-Flash Program : Error! + goto ERROR +) + +ECHO J-Flash Program : OK! +goto END + +:ERROR +pause + +:END diff --git a/release.md b/release.md new file mode 100644 index 0000000..75eb677 --- /dev/null +++ b/release.md @@ -0,0 +1,20 @@ +2024-03-11 V1.4 + 1. Add 'mesh': Mesh module + 2. Add 'projects\bleMesh': Mesh Demo + +2023-12-12 V1.3 + 1. Update RF params + 2. Fixed USB Bug + 3. Add GAPC_CONNECTION_IND message + +2023-08-09 V1.2 + 1. Update 'drivers': Standard APIs of Peripheral. + 2. Update 'examples': Test Demo of Peripheral's Usage. + 3. Update 'projects': Application of sub-system, eg. ble/usb. + +2023-03-06 V1.0 + 1. Update 'drivers': Standard APIs of Peripheral. + 2. Rename 'modules': Common utils source files. + 3. Update 'examples': Test Demo of Peripheral's Usage. + 4. Update 'projects': Application of sub-system, eg. ble/usb. + 5. Add 'usb' sub-system driver and class. diff --git a/tools/HidVoc/adpcm2wav.exe b/tools/HidVoc/adpcm2wav.exe new file mode 100644 index 0000000..9d5fceb Binary files /dev/null and b/tools/HidVoc/adpcm2wav.exe differ diff --git a/tools/HidVoc/hidVoc.exe b/tools/HidVoc/hidVoc.exe new file mode 100644 index 0000000..a8353d7 Binary files /dev/null and b/tools/HidVoc/hidVoc.exe differ diff --git a/tools/HidVoc/projects/hidvoc.rar b/tools/HidVoc/projects/hidvoc.rar new file mode 100644 index 0000000..2dc0beb Binary files /dev/null and b/tools/HidVoc/projects/hidvoc.rar differ diff --git a/tools/HidVoc/接收语音样例.wav b/tools/HidVoc/接收语音样例.wav new file mode 100644 index 0000000..7054a00 Binary files /dev/null and b/tools/HidVoc/接收语音样例.wav differ diff --git a/tools/HidVoc/文件说明.png b/tools/HidVoc/文件说明.png new file mode 100644 index 0000000..f18e91b Binary files /dev/null and b/tools/HidVoc/文件说明.png differ diff --git a/tools/KeilPack/B6x/B6x.jlinkscript b/tools/KeilPack/B6x/B6x.jlinkscript new file mode 100644 index 0000000..b3a5d1c --- /dev/null +++ b/tools/KeilPack/B6x/B6x.jlinkscript @@ -0,0 +1,4 @@ +int ConfigTargetSettings(void) { + JLINK_ExecCommand("SetRTTSearchRanges 0x0 0x4000"); + return 0; +} diff --git a/tools/KeilPack/B6x/B6x_256kB_PY_D.FLM b/tools/KeilPack/B6x/B6x_256kB_PY_D.FLM new file mode 100644 index 0000000..8e0ce9c Binary files /dev/null and b/tools/KeilPack/B6x/B6x_256kB_PY_D.FLM differ diff --git a/tools/KeilPack/B6x/JLinkDevices.xml b/tools/KeilPack/B6x/JLinkDevices.xml new file mode 100644 index 0000000..9b42598 --- /dev/null +++ b/tools/KeilPack/B6x/JLinkDevices.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/tools/KeilPack/FLM/B6x_256kB_PY_D.FLM b/tools/KeilPack/FLM/B6x_256kB_PY_D.FLM new file mode 100644 index 0000000..8e0ce9c Binary files /dev/null and b/tools/KeilPack/FLM/B6x_256kB_PY_D.FLM differ diff --git a/tools/KeilPack/FLM/copy_flm_to_keil_dir.cmd b/tools/KeilPack/FLM/copy_flm_to_keil_dir.cmd new file mode 100644 index 0000000..e2d5908 --- /dev/null +++ b/tools/KeilPack/FLM/copy_flm_to_keil_dir.cmd @@ -0,0 +1 @@ +cmd.exe /C copy *.flm C:\Keil_v5\ARM\Flash \ No newline at end of file diff --git a/tools/KeilPack/Generic.B6x.1.0.0.pack b/tools/KeilPack/Generic.B6x.1.0.0.pack new file mode 100644 index 0000000..f52a6b6 Binary files /dev/null and b/tools/KeilPack/Generic.B6x.1.0.0.pack differ diff --git a/tools/addr2line.exe b/tools/addr2line.exe new file mode 100644 index 0000000..f16afdd Binary files /dev/null and b/tools/addr2line.exe differ diff --git a/tools/srec_cat.exe b/tools/srec_cat.exe new file mode 100644 index 0000000..31d4d0c Binary files /dev/null and b/tools/srec_cat.exe differ diff --git a/usb/api/usb_def.h b/usb/api/usb_def.h new file mode 100644 index 0000000..3ee90f8 --- /dev/null +++ b/usb/api/usb_def.h @@ -0,0 +1,916 @@ +/** + **************************************************************************************** + * + * @file usb_def.h + * + * @brief Header file of USB Definitions(types and macros and structs) + * + **************************************************************************************** + */ + +#ifndef _USB_DEF_H +#define _USB_DEF_H + +#include + + +/******************************************************************************* + * CMSIS Util definitions + ******************************************************************************/ + +#if defined(__CC_ARM) +#ifndef __USED + #define __USED __attribute__((used)) +#endif +#ifndef __WEAK + #define __WEAK __attribute__((weak)) +#endif +#ifndef __PACKED + #define __PACKED __attribute__((packed)) +#endif +#ifndef __PACKED_STRUCT + #define __PACKED_STRUCT __packed struct +#endif +#ifndef __PACKED_UNION + #define __PACKED_UNION __packed union +#endif +#ifndef __ALIGNED + #define __ALIGNED(x) __attribute__((aligned(x))) +#endif +#elif defined(__GNUC__) +#ifndef __USED + #define __USED __attribute__((used)) +#endif +#ifndef __WEAK + #define __WEAK __attribute__((weak)) +#endif +#ifndef __PACKED + #define __PACKED __attribute__((packed, aligned(1))) +#endif +#ifndef __PACKED_STRUCT + #define __PACKED_STRUCT struct __attribute__((packed, aligned(1))) +#endif +#ifndef __PACKED_UNION + #define __PACKED_UNION union __attribute__((packed, aligned(1))) +#endif +#ifndef __ALIGNED + #define __ALIGNED(x) __attribute__((aligned(x))) +#endif +#elif defined(__ICCARM__) +#ifndef __USED +#if __ICCARM_V8 + #define __USED __attribute__((used)) +#else + #define __USED _Pragma("__root") +#endif +#endif + +#ifndef __WEAK +#if __ICCARM_V8 + #define __WEAK __attribute__((weak)) +#else + #define __WEAK _Pragma("__weak") +#endif +#endif + +#ifndef __PACKED +#if __ICCARM_V8 + #define __PACKED __attribute__((packed, aligned(1))) +#else + #define __PACKED __packed /* Needs IAR language extensions */ +#endif +#endif + +#ifndef __PACKED_STRUCT +#if __ICCARM_V8 + #define __PACKED_STRUCT struct __attribute__((packed, aligned(1))) +#else + #define __PACKED_STRUCT __packed struct /* Needs IAR language extensions */ +#endif +#endif + +#ifndef __PACKED_UNION +#if __ICCARM_V8 + #define __PACKED_UNION union __attribute__((packed, aligned(1))) +#else + #define __PACKED_UNION __packed union /* Needs IAR language extensions */ +#endif +#endif + +#ifndef __ALIGNED +#if __ICCARM_V8 + #define __ALIGNED(x) __attribute__((aligned(x))) +#elif (__VER__ >= 7080000) + #define __ALIGNED(x) __attribute__((aligned(x))) /* Needs IAR language extensions */ +#else + #warning No compiler specific solution for __ALIGNED.__ALIGNED is ignored. + #define __ALIGNED(x) +#endif +#endif + +#endif + +#ifndef __ALIGN_BEGIN + #define __ALIGN_BEGIN +#endif +#ifndef __ALIGN_END + #define __ALIGN_END __attribute__((aligned(4))) +#endif + +#define __USBIRQ __attribute__((section("usb_irq"))) +#define __USBDESC __attribute__((section("usb_desc"))) __USED __ALIGNED(1) + +// The unused argument @p x. +#ifndef ARG_UNUSED +#define ARG_UNUSED(x) (void)(x) +#endif +// The low byte of 16bits @p x. +#ifndef LO_BYTE +#define LO_BYTE(x) ((uint8_t)(x & 0x00FF)) +#endif +// The high byte of 16bits @p x. +#ifndef HI_BYTE +#define HI_BYTE(x) ((uint8_t)((x & 0xFF00) >> 8)) +#endif +// The larger value between @p a and @p b. +#ifndef MAX +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#endif +// The smaller value between @p a and @p b. +#ifndef MIN +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#endif +// The Binary-Coded Decimal @p x. +#ifndef BCD +#define BCD(x) ((((x) / 10) << 4) | ((x) % 10)) +#endif +// The bit of left-shift @p n. +#ifndef BIT +#define BIT(n) (1UL << (n)) +#endif +// The elements count in @p array. +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(array) ((sizeof(array) / sizeof((array)[0]))) +#endif +// Bytes swap @p u16. +#ifndef BSWAP16 +#define BSWAP16(u16) (__builtin_bswap16(u16)) +#endif +// Bytes swap @p u32. +#ifndef BSWAP32 +#define BSWAP32(u32) (__builtin_bswap32(u32)) +#endif + +// Get or Set BigEndian value +#define GET_BE16(field) \ + (((uint16_t)(field)[0] << 8) | ((uint16_t)(field)[1])) + +#define GET_BE32(field) \ + (((uint32_t)(field)[0] << 24) | ((uint32_t)(field)[1] << 16) | ((uint32_t)(field)[2] << 8) | ((uint32_t)(field)[3] << 0)) + +#define SET_BE16(field, value) \ + do { \ + (field)[0] = (uint8_t)((value) >> 8); \ + (field)[1] = (uint8_t)((value) >> 0); \ + } while (0) + +#define SET_BE24(field, value) \ + do { \ + (field)[0] = (uint8_t)((value) >> 16); \ + (field)[1] = (uint8_t)((value) >> 8); \ + (field)[2] = (uint8_t)((value) >> 0); \ + } while (0) + +#define SET_BE32(field, value) \ + do { \ + (field)[0] = (uint8_t)((value) >> 24); \ + (field)[1] = (uint8_t)((value) >> 16); \ + (field)[2] = (uint8_t)((value) >> 8); \ + (field)[3] = (uint8_t)((value) >> 0); \ + } while (0) + +// Convert value to byte elements. +#define WCHAR(c) (c & 0xFF), ((c >> 8) & 0xFF) +#define WBVAL(x) (x & 0xFF), ((x >> 8) & 0xFF) +#define DBVAL(x) (x & 0xFF), ((x >> 8) & 0xFF), ((x >> 16) & 0xFF), ((x >> 24) & 0xFF) + +// Type and index of the descriptor +#define GET_DESC_TYPE(x) (((x) >> 8) & 0xFF) +#define GET_DESC_INDEX(x) ((x) & 0xFF) + +// The Number of arguments, max 63. +#define PP_NARG(...) \ + PP_NARG_(__VA_ARGS__, PP_RSEQ_N()) +#define PP_NARG_(...) \ + PP_ARG_N(__VA_ARGS__) +#define PP_ARG_N( \ + _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \ + _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, \ + _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, \ + _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, \ + _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, \ + _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, \ + _61, _62, _63, N, ...) N +#define PP_RSEQ_N() \ + 63, 62, 61, 60, \ + 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, \ + 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, \ + 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, \ + 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, \ + 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, \ + 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 + + +/******************************************************************************* + * USB Core definitions + ******************************************************************************/ + +/**< maximum packet size (MPS) for EP 0~NUM */ +#ifndef USB_EP0_MPS + #define USB_EP0_MPS 64 +#endif + +#ifndef USB_EP_MPS + #define USB_EP_MPS 64 +#endif + +/* Version define */ +#define USB_1_1 0x0110 +#define USB_2_0 0x0200 +#define USB_2_1 0x0210 + +/* Device speeds */ +#define USB_SPEED_UNKNOWN 0 /* Transfer rate not yet set */ +#define USB_SPEED_LOW 1 /* USB 1.1 */ +#define USB_SPEED_FULL 2 /* USB 1.1 */ +#define USB_SPEED_HIGH 3 /* USB 2.0 */ +#define USB_SPEED_VARIABLE 4 /* Wireless USB 2.5 */ + +// USB PID Types +#define USB_PID_OUT (0x01) /* Tokens */ +#define USB_PID_IN (0x09) +#define USB_PID_SOF (0x05) +#define USB_PID_SETUP (0x0d) + +#define USB_PID_DATA0 (0x03) /* Data */ +#define USB_PID_DATA1 (0x0b) +#define USB_PID_DATA2 (0x07) +#define USB_PID_MDATA (0x0f) + +#define USB_PID_ACK (0x02) /* Handshake */ +#define USB_PID_NAK (0x0a) +#define USB_PID_STALL (0x0e) +#define USB_PID_NYET (0x06) + +#define USB_PID_PRE (0x0c) /* Special */ +#define USB_PID_ERR (0x0c) +#define USB_PID_SPLIT (0x08) +#define USB_PID_PING (0x04) +#define USB_PID_RESERVED (0x00) + +#define USB_REQUEST_DIR_LSB 7U /* Bits 7: Request dir */ +#define USB_REQUEST_DIR_OUT (0U << USB_REQUEST_DIR_LSB) /* Bit 7=0: Host-to-device */ +#define USB_REQUEST_DIR_IN (1U << USB_REQUEST_DIR_LSB) /* Bit 7=1: Device-to-host */ +#define USB_REQUEST_DIR_MASK (1U << USB_REQUEST_DIR_LSB) /* Bit 7=1: Direction bit */ + +#define USB_REQUEST_TYPE_LSB 5U /* Bits 5:6: Request type */ +#define USB_REQUEST_STANDARD (0U << USB_REQUEST_TYPE_LSB) +#define USB_REQUEST_CLASS (1U << USB_REQUEST_TYPE_LSB) +#define USB_REQUEST_VENDOR (2U << USB_REQUEST_TYPE_LSB) +#define USB_REQUEST_RESERVED (3U << USB_REQUEST_TYPE_LSB) +#define USB_REQUEST_TYPE_MASK (3U << USB_REQUEST_TYPE_LSB) + +#define USB_REQUEST_RECIP_LSB 0U /* Bits 0:4: Recipient */ +#define USB_REQUEST_RECIP_DEVICE (0U << USB_REQUEST_RECIP_LSB) +#define USB_REQUEST_RECIP_INTERFACE (1U << USB_REQUEST_RECIP_LSB) +#define USB_REQUEST_RECIP_ENDPOINT (2U << USB_REQUEST_RECIP_LSB) +#define USB_REQUEST_RECIP_OTHER (3U << USB_REQUEST_RECIP_LSB) +#define USB_REQUEST_RECIP_MASK (3U << USB_REQUEST_RECIP_LSB) + +/* USB Standard Request Codes */ +#define USB_REQUEST_GET_STATUS 0x00 +#define USB_REQUEST_CLEAR_FEATURE 0x01 +#define USB_REQUEST_SET_FEATURE 0x03 +#define USB_REQUEST_SET_ADDRESS 0x05 +#define USB_REQUEST_GET_DESCRIPTOR 0x06 +#define USB_REQUEST_SET_DESCRIPTOR 0x07 +#define USB_REQUEST_GET_CONFIGURATION 0x08 +#define USB_REQUEST_SET_CONFIGURATION 0x09 +#define USB_REQUEST_GET_INTERFACE 0x0A +#define USB_REQUEST_SET_INTERFACE 0x0B +#define USB_REQUEST_SYNCH_FRAME 0x0C +#define USB_REQUEST_SET_ENCRYPTION 0x0D +#define USB_REQUEST_GET_ENCRYPTION 0x0E +#define USB_REQUEST_RPIPE_ABORT 0x0E +#define USB_REQUEST_SET_HANDSHAKE 0x0F +#define USB_REQUEST_RPIPE_RESET 0x0F +#define USB_REQUEST_GET_HANDSHAKE 0x10 +#define USB_REQUEST_SET_CONNECTION 0x11 +#define USB_REQUEST_SET_SECURITY_DATA 0x12 +#define USB_REQUEST_GET_SECURITY_DATA 0x13 +#define USB_REQUEST_SET_WUSB_DATA 0x14 +#define USB_REQUEST_LOOPBACK_DATA_WRITE 0x15 +#define USB_REQUEST_LOOPBACK_DATA_READ 0x16 +#define USB_REQUEST_SET_INTERFACE_DS 0x17 + +/* USB Standard Feature selectors */ +#define USB_FEATURE_ENDPOINT_HALT 0 +#define USB_FEATURE_SELF_POWERED 0 +#define USB_FEATURE_REMOTE_WAKEUP 1 +#define USB_FEATURE_TEST_MODE 2 +#define USB_FEATURE_BATTERY 2 +#define USB_FEATURE_BHNPENABLE 3 +#define USB_FEATURE_WUSBDEVICE 3 +#define USB_FEATURE_AHNPSUPPORT 4 +#define USB_FEATURE_AALTHNPSUPPORT 5 +#define USB_FEATURE_DEBUGMODE 6 + +/* USB GET_STATUS Bit Values */ +#define USB_GETSTATUS_ENDPOINT_HALT 0x01 +#define USB_GETSTATUS_SELF_POWERED 0x01 +#define USB_GETSTATUS_REMOTE_WAKEUP 0x02 + +/* USB Descriptor Types */ +#define USB_DESC_TYPE_DEVICE 0x01U +#define USB_DESC_TYPE_CONFIGURATION 0x02U +#define USB_DESC_TYPE_STRING 0x03U +#define USB_DESC_TYPE_INTERFACE 0x04U +#define USB_DESC_TYPE_ENDPOINT 0x05U +#define USB_DESC_TYPE_DEVICE_QUALIFIER 0x06U +#define USB_DESC_TYPE_OTHER_SPEED 0x07U +#define USB_DESC_TYPE_INTERFACE_POWER 0x08U +#define USB_DESC_TYPE_OTG 0x09U +#define USB_DESC_TYPE_DEBUG 0x0AU +#define USB_DESC_TYPE_INTERFACE_ASSOCIATION 0x0BU +#define USB_DESC_TYPE_BINARY_OBJECT_STORE 0x0FU +#define USB_DESC_TYPE_DEVICE_CAPABILITY 0x10U +#define USB_DESC_TYPE_WIRELESS_ENDPOINTCOMP 0x11U + +/* Class Specific Descriptor */ +#define USB_CLASS_DESC_TYPE_DEVICE 0x21U +#define USB_CLASS_DESC_TYPE_CONFIGURATION 0x22U +#define USB_CLASS_DESC_TYPE_STRING 0x23U +#define USB_CLASS_DESC_TYPE_INTERFACE 0x24U +#define USB_CLASS_DESC_TYPE_ENDPOINT 0x25U + +#define USB_DESC_TYPE_SUPERSPEED_ENDPOINT_COMPANION 0x30U +#define USB_DESC_TYPE_SUPERSPEED_ISO_ENDPOINT_COMPANION 0x31U + +/* USB Device Classes */ +#define USB_DEVICE_CLASS_RESERVED 0x00 +#define USB_DEVICE_CLASS_AUDIO 0x01 +#define USB_DEVICE_CLASS_CDC 0x02 +#define USB_DEVICE_CLASS_HID 0x03 +#define USB_DEVICE_CLASS_MONITOR 0x04 +#define USB_DEVICE_CLASS_PHYSICAL 0x05 +#define USB_DEVICE_CLASS_IMAGE 0x06 +#define USB_DEVICE_CLASS_PRINTER 0x07 +#define USB_DEVICE_CLASS_MASS_STORAGE 0x08 +#define USB_DEVICE_CLASS_HUB 0x09 +#define USB_DEVICE_CLASS_CDC_DATA 0x0a +#define USB_DEVICE_CLASS_SMART_CARD 0x0b +#define USB_DEVICE_CLASS_SECURITY 0x0d +#define USB_DEVICE_CLASS_VIDEO 0x0e +#define USB_DEVICE_CLASS_HEALTHCARE 0x0f +#define USB_DEVICE_CLASS_DIAG_DEVICE 0xdc +#define USB_DEVICE_CLASS_WIRELESS 0xe0 +#define USB_DEVICE_CLASS_MISC 0xef +#define USB_DEVICE_CLASS_APP_SPECIFIC 0xfe +#define USB_DEVICE_CLASS_VEND_SPECIFIC 0xff + +/* usb string index define */ +#define USB_STRING_LANGID_INDEX 0x00 +#define USB_STRING_MFC_INDEX 0x01 +#define USB_STRING_PRODUCT_INDEX 0x02 +#define USB_STRING_SERIAL_INDEX 0x03 +#define USB_STRING_CONFIG_INDEX 0x04 +#define USB_STRING_INTERFACE_INDEX 0x05 +#define USB_STRING_OS_INDEX 0x06 +#define USB_STRING_MAX USB_STRING_OS_INDEX +/* + * Devices supporting Microsoft OS Descriptors store special string + * descriptor at fixed index (0xEE). It is read when a new device is + * attached to a computer for the first time. + */ +#define USB_OSDESC_STRING_DESC_INDEX 0xEE + +/* bmAttributes in Configuration Descriptor */ +#define USB_CONFIG_REMOTE_WAKEUP 0x20 +#define USB_CONFIG_POWERED_MASK 0x40 +#define USB_CONFIG_BUS_POWERED 0x80 +#define USB_CONFIG_SELF_POWERED 0xC0 + +/* bMaxPower in Configuration Descriptor */ +#define USB_CONFIG_POWER_MA(mA) ((mA) / 2) + +/* bEndpointAddress in Endpoint Descriptor */ +#define USB_EP_DIR_MASK 0x80 +#define USB_EP_DIR_IN 0x80 +#define USB_EP_DIR_OUT 0x00 +#define USB_EP_OUT(idx) ((idx) | USB_EP_DIR_OUT) +#define USB_EP_IN(idx) ((idx) | USB_EP_DIR_IN) + +/** + * USB endpoint direction and number. + */ +/** Get endpoint index (number) from endpoint address */ +#define USB_EP_GET_IDX(ep) ((ep) & ~USB_EP_DIR_MASK) +/** Get direction from endpoint address */ +#define USB_EP_GET_DIR(ep) ((ep) & USB_EP_DIR_MASK) +/** Get endpoint address from endpoint index and direction */ +#define USB_EP_GET_ADDR(idx, dir) ((idx) | ((dir) & USB_EP_DIR_MASK)) +/** True if the endpoint is an IN endpoint */ +#define USB_EP_DIR_IS_IN(ep) (USB_EP_GET_DIR(ep) == USB_EP_DIR_IN) +/** True if the endpoint is an OUT endpoint */ +#define USB_EP_DIR_IS_OUT(ep) (USB_EP_GET_DIR(ep) == USB_EP_DIR_OUT) + +/* bmAttributes in Endpoint Descriptor */ +#define USB_EP_TYPE_LSB 0 +#define USB_EP_TYPE_CONTROL (0 << USB_EP_TYPE_LSB) +#define USB_EP_TYPE_ISOCHRONOUS (1 << USB_EP_TYPE_LSB) +#define USB_EP_TYPE_BULK (2 << USB_EP_TYPE_LSB) +#define USB_EP_TYPE_INTERRUPT (3 << USB_EP_TYPE_LSB) +#define USB_EP_TYPE_MASK (3 << USB_EP_TYPE_LSB) + +#define USB_EP_SYNC_LSB 2 +#define USB_EP_SYNC_NO_SYNCHRONIZATION (0 << USB_EP_SYNC_LSB) +#define USB_EP_SYNC_ASYNCHRONOUS (1 << USB_EP_SYNC_LSB) +#define USB_EP_SYNC_ADAPTIVE (2 << USB_EP_SYNC_LSB) +#define USB_EP_SYNC_SYNCHRONOUS (3 << USB_EP_SYNC_LSB) +#define USB_EP_SYNC_MASK (3 << USB_EP_SYNC_LSB) + +#define USB_EP_USAGE_LSB 4 +#define USB_EP_USAGE_DATA (0 << USB_EP_USAGE_LSB) +#define USB_EP_USAGE_FEEDBACK (1 << USB_EP_USAGE_LSB) +#define USB_EP_USAGE_IMPLICIT_FEEDBACK (2 << USB_EP_USAGE_LSB) +#define USB_EP_USAGE_MASK (3 << USB_EP_USAGE_LSB) + +#define USB_EP_MAX_ADJUSTABLE (1 << 7) + +/* wMaxPacketSize in Endpoint Descriptor */ +#define USB_MAXPACKETSIZE_LSB 0 +#define USB_MAXPACKETSIZE_MASK (0x7ff << USB_MAXPACKETSIZE_LSB) +#define USB_MAXPACKETSIZE_EXTRA_TRANSCATION_LSB 11 +#define USB_MAXPACKETSIZE_EXTRA_TRANSCATION_NONE (0 << USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_LSB) +#define USB_MAXPACKETSIZE_EXTRA_TRANSCATION_ONE (1 << USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_LSB) +#define USB_MAXPACKETSIZE_EXTRA_TRANSCATION_TWO (2 << USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_LSB) +#define USB_MAXPACKETSIZE_EXTRA_TRANSCATION_MASK (3 << USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_LSB) + +/* bDevCapabilityType in Device Capability Descriptor */ +#define USB_DEVICE_CAP_WIRELESS_USB 1 +#define USB_DEVICE_CAP_USB_2_0_EXTENSION 2 +#define USB_DEVICE_CAP_SUPERSPEED_USB 3 +#define USB_DEVICE_CAP_CONTAINER_ID 4 +#define USB_DEVICE_CAP_PLATFORM 5 +#define USB_DEVICE_CAP_POWER_DELIVERY_CAPABILITY 6 +#define USB_DEVICE_CAP_BATTERY_INFO_CAPABILITY 7 +#define USB_DEVICE_CAP_PD_CONSUMER_PORT_CAPABILITY 8 +#define USB_DEVICE_CAP_PD_PROVIDER_PORT_CAPABILITY 9 +#define USB_DEVICE_CAP_SUPERSPEED_PLUS 10 +#define USB_DEVICE_CAP_PRECISION_TIME_MEASUREMENT 11 +#define USB_DEVICE_CAP_WIRELESS_USB_EXT 12 + +#define USB_BOS_CAP_EXTENSION 0x02 +#define USB_BOS_CAP_PLATFORM 0x05 + +/* OTG SET FEATURE Constants */ +#define USB_OTG_FEATURE_B_HNP_ENABLE 3 /* Enable B device to perform HNP */ +#define USB_OTG_FEATURE_A_HNP_SUPPORT 4 /* A device supports HNP */ +#define USB_OTG_FEATURE_A_ALT_HNP_SUPPORT 5 /* Another port on the A device supports HNP */ + +/* WinUSB Microsoft OS 2.0 descriptor request codes */ +#define WINUSB_REQUEST_GET_DESCRIPTOR_SET 0x07 +#define WINUSB_REQUEST_SET_ALT_ENUM 0x08 + +/* WinUSB Microsoft OS 2.0 descriptor sizes */ +#define WINUSB_DESCRIPTOR_SET_HEADER_SIZE 10 +#define WINUSB_FUNCTION_SUBSET_HEADER_SIZE 8 +#define WINUSB_FEATURE_COMPATIBLE_ID_SIZE 20 + +/* WinUSB Microsoft OS 2.0 Descriptor Types */ +#define WINUSB_SET_HEADER_DESCRIPTOR_TYPE 0x00 +#define WINUSB_SUBSET_HEADER_CONFIGURATION_TYPE 0x01 +#define WINUSB_SUBSET_HEADER_FUNCTION_TYPE 0x02 +#define WINUSB_FEATURE_COMPATIBLE_ID_TYPE 0x03 +#define WINUSB_FEATURE_REG_PROPERTY_TYPE 0x04 +#define WINUSB_FEATURE_MIN_RESUME_TIME_TYPE 0x05 +#define WINUSB_FEATURE_MODEL_ID_TYPE 0x06 +#define WINUSB_FEATURE_CCGP_DEVICE_TYPE 0x07 + +#define WINUSB_PROP_DATA_TYPE_REG_SZ 0x01 +#define WINUSB_PROP_DATA_TYPE_REG_MULTI_SZ 0x07 + +/* WebUSB Descriptor Types */ +#define WEBUSB_DESCRIPTOR_SET_HEADER_TYPE 0x00 +#define WEBUSB_CONFIGURATION_SUBSET_HEADER_TYPE 0x01 +#define WEBUSB_FUNCTION_SUBSET_HEADER_TYPE 0x02 +#define WEBUSB_URL_TYPE 0x03 + +/* WebUSB Request Codes */ +#define WEBUSB_REQUEST_GET_URL 0x02 + +/* bScheme in URL descriptor */ +#define WEBUSB_URL_SCHEME_HTTP 0x00 +#define WEBUSB_URL_SCHEME_HTTPS 0x01 + +/* WebUSB Descriptor sizes */ +#define WEBUSB_DESCRIPTOR_SET_HEADER_SIZE 5 +#define WEBUSB_CONFIGURATION_SUBSET_HEADER_SIZE 4 +#define WEBUSB_FUNCTION_SUBSET_HEADER_SIZE 3 + + +/* Setup packet definition used to read raw data from USB line */ +struct usb_setup_packet { + /** Request type. Bits 0:4 determine recipient, see + * \ref usb_request_recipient. Bits 5:6 determine type, see + * \ref usb_request_type. Bit 7 determines data transfer direction, see + * \ref usb_endpoint_direction. + */ + uint8_t bmRequestType; + + /** Request. If the type bits of bmRequestType are equal to + * \ref usb_request_type::LIBUSB_REQUEST_TYPE_STANDARD + * "USB_REQUEST_TYPE_STANDARD" then this field refers to + * \ref usb_standard_request. For other cases, use of this field is + * application-specific. */ + uint8_t bRequest; + + /** Value. Varies according to request */ + uint16_t wValue; + + /** Index. Varies according to request, typically used to pass an index + * or offset */ + uint16_t wIndex; + + /** Number of bytes to transfer */ + uint16_t wLength; +} __PACKED; + +#define USB_SETUP_PACKET_SIZE 8 + +/** USB descriptor header */ +struct usb_desc_header { + uint8_t bLength; /* descriptor length */ + uint8_t bDescriptorType; /* descriptor type */ +}; + +/** Standard Device Descriptor */ +struct usb_device_descriptor { + uint8_t bLength; /* Descriptor size in bytes = 18 */ + uint8_t bDescriptorType; /* DEVICE descriptor type = 1 */ + uint16_t bcdUSB; /* USB spec in BCD, e.g. 0x0200 */ + uint8_t bDeviceClass; /* Class code, if 0 see interface */ + uint8_t bDeviceSubClass; /* Sub-Class code, 0 if class = 0 */ + uint8_t bDeviceProtocol; /* Protocol, if 0 see interface */ + uint8_t bMaxPacketSize0; /* Endpoint 0 max. size */ + uint16_t idVendor; /* Vendor ID per USB-IF */ + uint16_t idProduct; /* Product ID per manufacturer */ + uint16_t bcdDevice; /* Device release # in BCD */ + uint8_t iManufacturer; /* Index to manufacturer string */ + uint8_t iProduct; /* Index to product string */ + uint8_t iSerialNumber; /* Index to serial number string */ + uint8_t bNumConfigurations; /* Number of possible configurations */ +} __PACKED; + +#define USB_DEVICE_DESC_SIZE 18 + +/** Standard Configuration Descriptor */ +struct usb_configuration_descriptor { + uint8_t bLength; /* Descriptor size in bytes = 9 */ + uint8_t bDescriptorType; /* CONFIGURATION type = 2 or 7 */ + uint16_t wTotalLength; /* Length of concatenated descriptors */ + uint8_t bNumInterfaces; /* Number of interfaces, this config. */ + uint8_t bConfigurationValue; /* Value to set this config. */ + uint8_t iConfiguration; /* Index to configuration string */ + uint8_t bmAttributes; /* Config. characteristics */ + uint8_t bMaxPower; /* Max.power from bus, 2mA units */ +} __PACKED; + +#define USB_CONFIG_DESC_SIZE 9 + +/** Standard Interface Descriptor */ +struct usb_interface_descriptor { + uint8_t bLength; /* Descriptor size in bytes = 9 */ + uint8_t bDescriptorType; /* INTERFACE descriptor type = 4 */ + uint8_t bInterfaceNumber; /* Interface no.*/ + uint8_t bAlternateSetting; /* Value to select this IF */ + uint8_t bNumEndpoints; /* Number of endpoints excluding 0 */ + uint8_t bInterfaceClass; /* Class code, 0xFF = vendor */ + uint8_t bInterfaceSubClass; /* Sub-Class code, 0 if class = 0 */ + uint8_t bInterfaceProtocol; /* Protocol, 0xFF = vendor */ + uint8_t iInterface; /* Index to interface string */ +} __PACKED; + +#define USB_INTERFACE_DESC_SIZE 9 + +/** Standard Endpoint Descriptor */ +struct usb_endpoint_descriptor { + uint8_t bLength; /* Descriptor size in bytes = 7 */ + uint8_t bDescriptorType; /* ENDPOINT descriptor type = 5 */ + uint8_t bEndpointAddress; /* Endpoint # 0 - 15 | IN/OUT */ + uint8_t bmAttributes; /* Transfer type */ + uint16_t wMaxPacketSize; /* Bits 10:0 = max. packet size */ + uint8_t bInterval; /* Polling interval in (micro) frames */ +} __PACKED; + +#define USB_ENDPOINT_DESC_SIZE 7 + +/** Unicode (UTF16LE) String Descriptor */ +struct usb_string_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint16_t bString; +} __PACKED; + +#define USB_STRING_LANGID_DESC_SIZE 4 + +/* USB Interface Association Descriptor */ +struct usb_interface_association_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bFirstInterface; + uint8_t bInterfaceCount; + uint8_t bFunctionClass; + uint8_t bFunctionSubClass; + uint8_t bFunctionProtocol; + uint8_t iFunction; +} __PACKED; + +#define USB_IAD_DESC_SIZE 8 + +/** USB device_qualifier descriptor */ +struct usb_device_qualifier_descriptor { + uint8_t bLength; /* Descriptor size in bytes = 10 */ + uint8_t bDescriptorType; /* DEVICE QUALIFIER type = 6 */ + uint16_t bcdUSB; /* USB spec in BCD, e.g. 0x0200 */ + uint8_t bDeviceClass; /* Class code, if 0 see interface */ + uint8_t bDeviceSubClass; /* Sub-Class code, 0 if class = 0 */ + uint8_t bDeviceProtocol; /* Protocol, if 0 see interface */ + uint8_t bMaxPacketSize; /* Endpoint 0 max. size */ + uint8_t bNumConfigurations; /* Number of possible configurations */ + uint8_t bReserved; /* Reserved = 0 */ +} __PACKED; + +#define USB_DEVICE_QUALIFIER_DESC_SIZE 10 + +/* Microsoft OS function descriptor. + * This can be used to request a specific driver (such as WINUSB) to be + * loaded on Windows. Unlike other descriptors, it is requested by a special + * request USB_REQ_GETMSFTOSDESCRIPTOR. + * More details: + * https://msdn.microsoft.com/en-us/windows/hardware/gg463179 + * + * The device will have exactly one "Extended Compat ID Feature Descriptor", + * which may contain multiple "Function Descriptors" associated with + * different interfaces. + */ + +/* MS OS 1.0 string descriptor */ +struct usb_msosv1_string_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bString[14]; + uint8_t bMS_VendorCode; /* Vendor Code, used for a control request */ + uint8_t bPad; /* Padding byte for VendorCode look as UTF16 */ +} __PACKED; + +/* MS OS 1.0 Header descriptor */ +struct usb_msosv1_compat_id_header_descriptor { + uint32_t dwLength; + uint16_t bcdVersion; + uint16_t wIndex; + uint8_t bCount; + uint8_t reserved[7]; +} __PACKED; + +/* MS OS 1.0 Function descriptor */ +struct usb_msosv1_comp_id_function_descriptor { + uint8_t bFirstInterfaceNumber; + uint8_t reserved1; + uint8_t compatibleID[8]; + uint8_t subCompatibleID[8]; + uint8_t reserved2[6]; +} __PACKED; + +#define usb_msosv1_comp_id_create(x) \ + struct usb_msosv1_comp_id { \ + struct usb_msosv1_compat_id_header_descriptor compat_id_header; \ + struct usb_msosv1_comp_id_function_descriptor compat_id_function[x]; \ + }; + +struct usb_msosv1_descriptor { + uint8_t *string; + uint8_t string_len; + uint8_t vendor_code; + uint8_t *compat_id; + uint16_t compat_id_len; + uint8_t *comp_id_property; + uint16_t comp_id_property_len; +}; + +/* MS OS 2.0 Header descriptor */ +struct usb_msosv2_header_descriptor { + uint32_t dwLength; + uint16_t bcdVersion; + uint16_t wIndex; + uint8_t bCount; +} __PACKED; + +/*Microsoft OS 2.0 set header descriptor*/ +struct usb_msosv2_set_header_descriptor { + uint16_t wLength; + uint16_t wDescriptorType; + uint32_t dwWindowsVersion; + uint16_t wDescriptorSetTotalLength; +} __PACKED; + +/* Microsoft OS 2.0 compatibleID descriptor*/ +struct usb_msosv2_comp_id_descriptor { + uint16_t wLength; + uint16_t wDescriptorType; + uint8_t compatibleID[8]; + uint8_t subCompatibleID[8]; +} __PACKED; + +/* MS OS 2.0 property descriptor */ +struct usb_msosv2_property_descriptor { + uint16_t wLength; + uint16_t wDescriptorType; + uint32_t dwPropertyDataType; + uint16_t wPropertyNameLength; + const char *bPropertyName; + uint32_t dwPropertyDataLength; + const char *bPropertyData; +}; + +/* Microsoft OS 2.0 subset function descriptor */ +struct usb_msosv2_subset_function_descriptor { + uint16_t wLength; + uint16_t wDescriptorType; + uint8_t bFirstInterface; + uint8_t bReserved; + uint16_t wSubsetLength; +} __PACKED; + +struct usb_msosv2_descriptor { + uint8_t *compat_id; + uint16_t compat_id_len; + uint8_t vendor_code; +}; + +/* BOS header Descriptor */ +struct usb_bos_header_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint16_t wTotalLength; + uint8_t bNumDeviceCaps; +} __PACKED; + +/* BOS Capability platform Descriptor */ +struct usb_bos_capability_platform_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bDevCapabilityType; + uint8_t bReserved; + uint8_t PlatformCapabilityUUID[16]; +} __PACKED; + +/* BOS Capability MS OS Descriptors version 2 */ +struct usb_bos_capability_msosv2_descriptor { + uint32_t dwWindowsVersion; + uint16_t wMSOSDescriptorSetTotalLength; + uint8_t bVendorCode; + uint8_t bAltEnumCode; +} __PACKED; + +/* BOS Capability webusb */ +struct usb_bos_capability_webusb_descriptor { + uint16_t bcdVersion; + uint8_t bVendorCode; + uint8_t iLandingPage; +} __PACKED; + +/* BOS Capability extension Descriptor*/ +struct usb_bos_capability_extension_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bDevCapabilityType; + uint32_t bmAttributes; +} __PACKED; + +/* Microsoft OS 2.0 Platform Capability Descriptor */ +struct usb_bos_capability_platform_msosv2_descriptor { + struct usb_bos_capability_platform_descriptor platform_msos; + struct usb_bos_capability_msosv2_descriptor data_msosv2; +} __PACKED; + +/* WebUSB Platform Capability Descriptor */ +struct usb_bos_capability_platform_webusb_descriptor { + struct usb_bos_capability_platform_descriptor platform_webusb; + struct usb_bos_capability_webusb_descriptor data_webusb; +} __PACKED; + +struct usb_webusb_url_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bScheme; + char URL[]; +} __PACKED; + +struct usb_bos_descriptor { + uint8_t *string; + uint16_t string_len; +}; + +/* USB Device Capability Descriptor */ +struct usb_device_capability_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bDevCapabilityType; +} __PACKED; + + +/* Macro for USB Device Descriptor */ +/* same iSerial problem. + * https://blog.csdn.net/asmxpl/article/details/21243913 + */ +#define USB_DEVICE_DESCRIPTOR_INIT(bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, idVendor, idProduct, bcdDevice, bNumConfigurations) \ + 0x12, /* bLength */ \ + USB_DESC_TYPE_DEVICE, /* bDescriptorType */ \ + WBVAL(bcdUSB), /* bcdUSB */ \ + bDeviceClass, /* bDeviceClass */ \ + bDeviceSubClass, /* bDeviceSubClass */ \ + bDeviceProtocol, /* bDeviceProtocol */ \ + USB_EP0_MPS, /* bMaxPacketSize */ \ + WBVAL(idVendor), /* idVendor */ \ + WBVAL(idProduct), /* idProduct */ \ + WBVAL(bcdDevice), /* bcdDevice */ \ + USB_STRING_MFC_INDEX, /* iManufacturer */ \ + USB_STRING_PRODUCT_INDEX, /* iProduct */ \ + 0/*USB_STRING_SERIAL_INDEX*/, /* iSerial */ \ + bNumConfigurations /* bNumConfigurations */ + +/* Macro for USB Configuration Descriptor */ +#define USB_CONFIG_DESCRIPTOR_INIT(wTotalLength, bNumInterfaces, bConfigurationValue, bmAttributes, bMaxPower) \ + 0x09, /* bLength */ \ + USB_DESC_TYPE_CONFIGURATION, /* bDescriptorType */ \ + WBVAL(wTotalLength), /* wTotalLength */ \ + bNumInterfaces, /* bNumInterfaces */ \ + bConfigurationValue, /* bConfigurationValue */ \ + 0x00, /* iConfiguration */ \ + bmAttributes, /* bmAttributes */ \ + USB_CONFIG_POWER_MA(bMaxPower) /* bMaxPower */ + +/* Macro for USB Interface Descriptor */ +#define USB_INTERFACE_DESCRIPTOR_INIT(bInterfaceNumber, bAlternateSetting, bNumEndpoints, \ + bInterfaceClass, bInterfaceSubClass, bInterfaceProtocol, iInterface) \ + 0x09, /* bLength */ \ + USB_DESC_TYPE_INTERFACE, /* bDescriptorType */ \ + bInterfaceNumber, /* bInterfaceNumber */ \ + bAlternateSetting, /* bAlternateSetting */ \ + bNumEndpoints, /* bNumEndpoints */ \ + bInterfaceClass, /* bInterfaceClass */ \ + bInterfaceSubClass, /* bInterfaceSubClass */ \ + bInterfaceProtocol, /* bInterfaceProtocol */ \ + iInterface /* iInterface */ + +/* Macro for USB Endpoint Descriptor */ +#define USB_EP_DESCRIPTOR_INIT(bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval) \ + 0x07, /* bLength */ \ + USB_DESC_TYPE_ENDPOINT, /* bDescriptorType */ \ + bEndpointAddress, /* bEndpointAddress */ \ + bmAttributes, /* bmAttributes */ \ + WBVAL(wMaxPacketSize), /* wMaxPacketSize */ \ + bInterval /* bInterval */ + +/* Macro for USB Interface Association Descriptor */ +#define USB_IAD_INIT(bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass, bFunctionProtocol) \ + 0x08, /* bLength */ \ + USB_DESC_TYPE_INTERFACE_ASSOCIATION, /* bDescriptorType */ \ + bFirstInterface, /* bFirstInterface */ \ + bInterfaceCount, /* bInterfaceCount */ \ + bFunctionClass, /* bFunctionClass */ \ + bFunctionSubClass, /* bFunctionSubClass */ \ + bFunctionProtocol, /* bFunctionProtocol */ \ + 0x00 /* iFunction */ + +/* Macro for USB LangID Descriptor */ +#define USB_LANGID_INIT(id) \ + 0x04, /* bLength */ \ + USB_DESC_TYPE_STRING, /* bDescriptorType */ \ + WBVAL(id) /* wLangID0 */ + +/* Macro for USB Device Qualifier Descriptor(usb2.0) */ +#define USB_QUALIFIER_INIT(bNumConfigurations) \ + 0x0A, /* bLength */ \ + USB_DESC_TYPE_DEVICE_QUALIFIER, /* bDescriptorType */ \ + 0x00, 0x02, /* bcdUSB */ \ + 0x00, /* bDeviceClass */ \ + 0x00, /* bDeviceSubClass */ \ + 0x00, /* bDeviceProtocol */ \ + USB_EP0_MPS, /* bMaxPacketSize */ \ + bNumConfigurations, /* bNumConfigurations */ \ + 0 /* bReserved */ + + +#endif // _USB_DEF_H diff --git a/usb/api/usb_log.h b/usb/api/usb_log.h new file mode 100644 index 0000000..1b6591e --- /dev/null +++ b/usb/api/usb_log.h @@ -0,0 +1,109 @@ +/** + **************************************************************************************** + * + * @file usb_log.h + * + * @brief Header file of USB debug/log print. + * + **************************************************************************************** + */ + +#ifndef _USB_LOG_H +#define _USB_LOG_H + +#include + +/* Debug level */ +#define USB_DBG_DISABLE 0 +#define USB_DBG_ERROR 1 +#define USB_DBG_WARNING 2 +#define USB_DBG_INFO 3 +#define USB_DBG_LOG 4 + +#ifndef USB_DBG_LEVEL +#define USB_DBG_LEVEL USB_DBG_DISABLE //USB_DBG_ERROR +#endif + +#ifndef USB_PRINTF +#define USB_PRINTF printf +#endif + +/* + * The color for terminal (foreground) + * 30 - BLACK 31 - RED + * 32 - GREEN 33 - YELLOW + * 34 - BLUE 35 - PURPLE + * 36 - CYAN 37 - WHITE + */ +#ifndef COLOR_TERMINAL +#define COLOR_TERMINAL (0) +#endif + +#if (COLOR_TERMINAL) +#define usb_log_print(lvl_name, color_n, fmt, ...) \ + do { \ + USB_PRINTF("\033[" #color_n "m"); \ + USB_PRINTF("[" lvl_name "/USB] " fmt, ##__VA_ARGS__); \ + USB_PRINTF("\033[0m"); \ + } while (0) +#else +#define usb_log_print(lvl_name, color_n, fmt, ...) \ + do { \ + USB_PRINTF("[" lvl_name "/USB] " fmt, ##__VA_ARGS__); \ + } while (0) +#endif + + +#if (USB_DBG_LEVEL >= USB_DBG_LOG) +#define USB_LOG_DBG(fmt, ...) usb_log_print("D", 0, fmt, ##__VA_ARGS__) +#else +#define USB_LOG_DBG(...) +#endif + +#if (USB_DBG_LEVEL >= USB_DBG_INFO) +#define USB_LOG_INFO(fmt, ...) usb_log_print("I", 32, fmt, ##__VA_ARGS__) +#else +#define USB_LOG_INFO(...) +#endif + +#if (USB_DBG_LEVEL >= USB_DBG_WARNING) +#define USB_LOG_WRN(fmt, ...) usb_log_print("W", 33, fmt, ##__VA_ARGS__) +#else +#define USB_LOG_WRN(...) +#endif + +#if (USB_DBG_LEVEL >= USB_DBG_ERROR) +#define USB_LOG_ERR(fmt, ...) usb_log_print("E", 31, fmt, ##__VA_ARGS__) +#else +#define USB_LOG_ERR(...) +#endif + +#if (USB_DBG_LEVEL != USB_DBG_DISABLE) +#define USB_LOG_RAW(fmt, ...) USB_PRINTF(fmt, ##__VA_ARGS__) +#else +#define USB_LOG_RAW(...) +#endif + + +/** + * @brief print the contents of usb setup packet(pointer) + */ +#define USB_PRINT_SETUP(setup) \ + USB_LOG_INFO("Setup: bmRequestType 0x%02x, bRequest 0x%02x, " \ + "wValue 0x%04x, wIndex 0x%04x, wLength 0x%04x\r\n", \ + setup->bmRequestType, setup->bRequest, \ + setup->wValue, setup->wIndex, setup->wLength); + +/** + * @brief assert the position of file and line + */ +void usb_assert(const char *filename, int linenum); + +#define USB_ASSERT(f) \ + do { \ + if (!(f)) \ + usb_assert(__FILE__, __LINE__); \ + } while (0) + + +#endif diff --git a/usb/api/usbd.h b/usb/api/usbd.h new file mode 100644 index 0000000..8df5c4e --- /dev/null +++ b/usb/api/usbd.h @@ -0,0 +1,221 @@ +/** + * @file usbd.h + * + * @brief Header file of USB Device Descriptors & Interface + * + */ + +#ifndef _USBD_H_ +#define _USBD_H_ + +#include +#include +#include "string.h" + +#include "usb_def.h" +#include "usb_log.h" + + +/* + * DEFINES + **************************************************************************************** + */ + +enum usbd_event_type { + /** USB error reported by the controller */ + USBD_EVENT_ERROR, + /** USB reset */ + USBD_EVENT_RESET, + /** Start of Frame received */ + USBD_EVENT_SOF, + /** USB enumeration completed */ + USBD_EVENT_CONNECTED, + /** USB configuration done */ + USBD_EVENT_CONFIGURED, + /** USB suspended by the HOST */ + USBD_EVENT_SUSPEND, + /** USB connection lost */ + USBD_EVENT_DISCONNECTED, + /** USB resumed by the HOST */ + USBD_EVENT_RESUME, + + /** USB interface selected */ + USBD_EVENT_SET_INTERFACE, + /** Set Feature REMOTE_WAKEUP received */ + USBD_EVENT_SET_REMOTE_WAKEUP, + /** Clear Feature REMOTE_WAKEUP received */ + USBD_EVENT_CLR_REMOTE_WAKEUP, + /** Set Feature ENDPOINT_HALT received */ + USBD_EVENT_SET_ENDPOINT_HALT, + /** Clear Feature ENDPOINT_HALT received */ + USBD_EVENT_CLR_ENDPOINT_HALT, + + /** Initial USB connection status */ + USBD_EVENT_UNKNOWN +}; + +enum usbd_status_type { + USBD_OK, + USBD_BUSY, + USBD_FAIL, + USBD_ERR_INVAILD, + USBD_ERR_STATE, + USBD_ERR_UNDRN, + USBD_ERR_OVER, + USBD_ERR_TIMEOUT, +}; + +/* Callback function for the USB Endpoint status */ +typedef void (*usbd_endpoint_handler)(uint8_t ep); + +/* Callback function for specific setup requests */ +typedef uint8_t (*usbd_request_handler)(struct usb_setup_packet *setup, + uint8_t **data, uint16_t *dlen); + +/** + * @brief USB Endpoint Structure. + * + * Structure containing the USB endpoint. + */ +typedef struct usbd_ep_tag { + /** Endpoint Address: IN = 0x80|, OUT = 0x00| */ + uint8_t ep_addr; + /** Endpoint Transfer Type: Bulk, Interrupt, Control or Isochronous */ + uint8_t ep_type; + /** Endpoint max packet size <= USB_EP_MPS */ + uint16_t ep_mps; + /** Endpoint status callback function */ + usbd_endpoint_handler ep_cb; +} usbd_ep_t; + +#define USBD_EP_T(addr, type, mps, func) \ + { .ep_addr=addr, .ep_type=type, .ep_mps=mps, .ep_cb=func } + + +/** + * @brief USB Class Structure. + * + * Structure containing the USB class. + */ +typedef struct usbd_class_tag { + /** Interface start number */ + uint8_t intf_start; + /** Interface end number */ + uint8_t intf_end; + /** Handler for USB Class specific commands */ + usbd_request_handler class_handler; +} usbd_class_t; + +#define USBD_CLASS_T(istart, iend, ihandler) \ + { .intf_start=istart, .intf_end=iend, .class_handler=ihandler } + + +/** + * @brief USB Configuration Structure. + * + * Structure containing the USB configuration. + */ +typedef struct usbd_config_tag { + uint8_t conf_val; + uint8_t intf_cnt; + uint8_t class_cnt; + uint8_t ep_cnt; + const usbd_class_t *class_tab; + const usbd_ep_t *ep_tab; +} usbd_config_t; + +#define USBD_CONFIG_T(_conf_val, _intf_cnt, classes, endpoints) \ + { .conf_val=_conf_val, .intf_cnt=_intf_cnt, \ + .class_tab=classes, .class_cnt=ARRAY_SIZE(classes), \ + .ep_tab=endpoints, .ep_cnt=ARRAY_SIZE(endpoints) } + + +/* + * FUNCTION DECLARATION + **************************************************************************************** + */ + +/** + * @brief Init device controller. + * @return N/A. + */ +void usbd_init(void); + +/** + * @brief Deinit device controller. + * @return N/A. + */ +void usbd_deinit(void); + +bool usbd_resume(bool en); +/** + * @brief Register Device Description and Configuration. + * + * @param[in] desc Pointer of description array + * @param[in] conf Pointer of configuration struct + * + * @return N/A. + */ +void usbd_register(const uint8_t *desc, const usbd_config_t *conf); + +/** + * @brief Device be configured or not. + * @return 0 on not, other on conf_num + */ +uint8_t usbd_is_configured(void); + +/** + * @brief Write data to the specified endpoint with poll mode. + * + * This function is called to write data to the specified endpoint. The + * supplied usbd_endpoint_handler function will be called when data is transmitted + * out. + * + * @param[in] ep Endpoint address corresponding to the one + * listed in the device configuration table + * @param[in] data Pointer to data to write + * @param[in] data_len Length of the data requested to write. This may + * be zero for a zero length status packet. + * @param[out] wr_bytes Bytes scheduled for transmission. This value + * may be NULL if the application expects all + * bytes to be written + * + * @return 0 on success, errno code on fail. + */ +uint8_t usbd_ep_write(uint8_t ep, uint16_t data_len, const uint8_t *data, uint16_t *wr_bytes); + +/** + * @brief Read data from the specified endpoint + * + * This function is called by the endpoint handler function, after an OUT + * interrupt has been received for that EP. The application must only call this + * function through the supplied usbd_ep_callback function. This function clears + * the ENDPOINT NAK when max_data_len is 0, if all data in the endpoint FIFO has been read, + * so as to accept more data from host. + * + * @param[in] ep Endpoint address corresponding to the one + * listed in the device configuration table + * @param[in] buff Pointer to data buffer to write to + * @param[in] max_len Max length of data to read + * + * @return Number of bytes read. + */ +uint16_t usbd_ep_read(uint8_t ep, uint16_t max_len, uint8_t *buff); + +/** + * @brief USB interrupt handler. + * @return N/A. + */ +__USBIRQ void USB_IRQHandler(void); + +/** Handler for Application to notify events */ +/* + * USB Event Notify Handler + **************************************************************************** + */ +__USBIRQ void usbd_notify_handler(uint8_t event, void *arg); + +/** Handler for USB Vendor specific commands */ +__USBIRQ uint8_t usbd_vendor_handler(struct usb_setup_packet *setup, uint8_t **data, uint16_t *dlen); + +#endif // _USBD_H_ diff --git a/usb/class/cdc/usb_cdc.h b/usb/class/cdc/usb_cdc.h new file mode 100644 index 0000000..06f82d9 --- /dev/null +++ b/usb/class/cdc/usb_cdc.h @@ -0,0 +1,332 @@ +/** + **************************************************************************************** + * + * @file usb_cdc.h + * + * @brief USB Communications Device Class (CDC) public header + * + * Header follows the Class Definitions for + * Communications Devices Specification (CDC120-20101103-track.pdf), + * PSTN Devices Specification (PSTN120.pdf) and + * Ethernet Control Model Devices Specification (ECM120.pdf). + * Header is limited to ACM and ECM Subclasses. + **************************************************************************************** + */ + +#ifndef _USB_CDC_H_ +#define _USB_CDC_H_ + +#include "usb_def.h" + +/*------------------------------------------------------------------------------ + * Definitions based on usbcdc11.pdf (www.usb.org) + *----------------------------------------------------------------------------*/ +/* Communication device class specification version 1.10 */ +#define CDC_V1_10 0x0110U +// Communication device class specification version 1.2 +#define CDC_V1_2_0 0x0120U + +/* Communication interface class code */ +/* (usbcdc11.pdf, 4.2, Table 15) */ +#define CDC_COMMUNICATION_INTERFACE_CLASS 0x02U + +/* Communication interface class subclass codes */ +/* (usbcdc11.pdf, 4.3, Table 16) */ +#define CDC_SUBCLASS_NONE 0x00 /* Reserved */ +#define CDC_SUBCLASS_DLC 0x01 /* Direct Line Control Model */ +#define CDC_SUBCLASS_ACM 0x02 /* Abstract Control Model */ +#define CDC_SUBCLASS_TCM 0x03 /* Telephone Control Model */ +#define CDC_SUBCLASS_MCM 0x04 /* Multi-Channel Control Model */ +#define CDC_SUBCLASS_CAPI 0x05 /* CAPI Control Model */ +#define CDC_SUBCLASS_ECM 0x06 /* Ethernet Networking Control Model */ +#define CDC_SUBCLASS_ATM 0x07 /* ATM Networking Control Model */ + /* 0x08-0x0d Reserved (future use) */ +#define CDC_SUBCLASS_MBIM 0x0e /* MBIM Control Model */ + /* 0x0f-0x7f Reserved (future use) */ + /* 0x80-0xfe Reserved (vendor specific) */ + +#define CDC_DIRECT_LINE_CONTROL_MODEL 0x01U +#define CDC_ABSTRACT_CONTROL_MODEL 0x02U +#define CDC_TELEPHONE_CONTROL_MODEL 0x03U +#define CDC_MULTI_CHANNEL_CONTROL_MODEL 0x04U +#define CDC_CAPI_CONTROL_MODEL 0x05U +#define CDC_ETHERNET_NETWORKING_CONTROL_MODEL 0x06U +#define CDC_ATM_NETWORKING_CONTROL_MODEL 0x07U +#define CDC_WIRELESS_HANDSET_CONTROL_MODEL 0x08U +#define CDC_DEVICE_MANAGEMENT 0x09U +#define CDC_MOBILE_DIRECT_LINE_MODEL 0x0AU +#define CDC_OBEX 0x0BU +#define CDC_ETHERNET_EMULATION_MODEL 0x0CU +#define CDC_NETWORK_CONTROL_MODEL 0x0DU + +/* Communication interface class control protocol codes */ +/* (usbcdc11.pdf, 4.4, Table 17) */ +#define CDC_COMMON_PROTOCOL_NONE 0x00U +#define CDC_COMMON_PROTOCOL_ATCMD 0x01U +#define CDC_COMMON_PROTOCOL_ATCMD_PCCA_101 0x02U +#define CDC_COMMON_PROTOCOL_ATCMD_PCCA_101_AND_ANNEXO 0x03U +#define CDC_COMMON_PROTOCOL_ATCMD_GSM_707 0x04U +#define CDC_COMMON_PROTOCOL_ATCMD_3GPP_27007 0x05U +#define CDC_COMMON_PROTOCOL_ATCMD_CDMA 0x06U +#define CDC_COMMON_PROTOCOL_ETHERNET_EMULATION_MODEL 0x07U +// NCM Communication Interface Protocol Codes +// (usbncm10.pdf, 4.2, Table 4-2) +#define CDC_NCM_PROTOCOL_NONE 0x00U +#define CDC_NCM_PROTOCOL_OEM 0xFEU + +/* Data interface class code */ +/* (usbcdc11.pdf, 4.5, Table 18) */ +#define CDC_DATA_INTERFACE_CLASS 0x0A + +/* Data Interface Sub-Class Codes ********************************************/ +#define CDC_DATA_SUBCLASS_NONE 0x00 + +/* Data interface class protocol codes */ +/* (usbcdc11.pdf, 4.7, Table 19) */ +#define CDC_DATA_PROTOCOL_ISDN_BRI 0x30 +#define CDC_DATA_PROTOCOL_HDLC 0x31 +#define CDC_DATA_PROTOCOL_TRANSPARENT 0x32 +#define CDC_DATA_PROTOCOL_Q921_MANAGEMENT 0x50 +#define CDC_DATA_PROTOCOL_Q921_DATA_LINK 0x51 +#define CDC_DATA_PROTOCOL_Q921_MULTIPLEXOR 0x52 +#define CDC_DATA_PROTOCOL_V42 0x90 +#define CDC_DATA_PROTOCOL_EURO_ISDN 0x91 +#define CDC_DATA_PROTOCOL_V24_RATE_ADAPTATION 0x92 +#define CDC_DATA_PROTOCOL_CAPI 0x93 +#define CDC_DATA_PROTOCOL_HOST_BASED_DRIVER 0xFD +#define CDC_DATA_PROTOCOL_DESCRIBED_IN_PUFD 0xFE + +/* Type values for bDescriptorType field of functional descriptors */ +/* (usbcdc11.pdf, 5.2.3, Table 24) */ +#define CDC_CS_INTERFACE 0x24 +#define CDC_CS_ENDPOINT 0x25 + +/* Type values for bDescriptorSubtype field of functional descriptors */ +/* (usbcdc11.pdf, 5.2.3, Table 25) */ +#define CDC_FUNC_DESC_HEADER 0x00 +#define CDC_FUNC_DESC_CALL_MANAGEMENT 0x01 +#define CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT 0x02 +#define CDC_FUNC_DESC_DIRECT_LINE_MANAGEMENT 0x03 +#define CDC_FUNC_DESC_TELEPHONE_RINGER 0x04 +#define CDC_FUNC_DESC_REPORTING_CAPABILITIES 0x05 +#define CDC_FUNC_DESC_UNION 0x06 +#define CDC_FUNC_DESC_COUNTRY_SELECTION 0x07 +#define CDC_FUNC_DESC_TELEPHONE_OPERATIONAL_MODES 0x08 +#define CDC_FUNC_DESC_USB_TERMINAL 0x09 +#define CDC_FUNC_DESC_NETWORK_CHANNEL 0x0A +#define CDC_FUNC_DESC_PROTOCOL_UNIT 0x0B +#define CDC_FUNC_DESC_EXTENSION_UNIT 0x0C +#define CDC_FUNC_DESC_MULTI_CHANNEL_MANAGEMENT 0x0D +#define CDC_FUNC_DESC_CAPI_CONTROL_MANAGEMENT 0x0E +#define CDC_FUNC_DESC_ETHERNET_NETWORKING 0x0F +#define CDC_FUNC_DESC_ATM_NETWORKING 0x10 +#define CDC_FUNC_DESC_WIRELESS_HANDSET_CONTROL_MODEL 0x11 +#define CDC_FUNC_DESC_MOBILE_DIRECT_LINE_MODEL 0x12 +#define CDC_FUNC_DESC_MOBILE_DIRECT_LINE_MODEL_DETAIL 0x13 +#define CDC_FUNC_DESC_DEVICE_MANAGEMENT_MODEL 0x14 +#define CDC_FUNC_DESC_OBEX 0x15 +#define CDC_FUNC_DESC_COMMAND_SET 0x16 +#define CDC_FUNC_DESC_COMMAND_SET_DETAIL 0x17 +#define CDC_FUNC_DESC_TELEPHONE_CONTROL_MODEL 0x18 +#define CDC_FUNC_DESC_OBEX_SERVICE_IDENTIFIER 0x19 + +/* CDC class-specific request codes */ +/* (usbcdc11.pdf, 6.2, Table 46) */ +/* see Table 45 for info about the specific requests. */ +#define CDC_REQUEST_SEND_ENCAPSULATED_COMMAND 0x00 +#define CDC_REQUEST_GET_ENCAPSULATED_RESPONSE 0x01 +#define CDC_REQUEST_SET_COMM_FEATURE 0x02 +#define CDC_REQUEST_GET_COMM_FEATURE 0x03 +#define CDC_REQUEST_CLEAR_COMM_FEATURE 0x04 +#define CDC_REQUEST_SET_AUX_LINE_STATE 0x10 +#define CDC_REQUEST_SET_HOOK_STATE 0x11 +#define CDC_REQUEST_PULSE_SETUP 0x12 +#define CDC_REQUEST_SEND_PULSE 0x13 +#define CDC_REQUEST_SET_PULSE_TIME 0x14 +#define CDC_REQUEST_RING_AUX_JACK 0x15 +#define CDC_REQUEST_SET_LINE_CODING 0x20 +#define CDC_REQUEST_GET_LINE_CODING 0x21 +#define CDC_REQUEST_SET_CONTROL_LINE_STATE 0x22 +#define CDC_REQUEST_SEND_BREAK 0x23 +#define CDC_REQUEST_SET_RINGER_PARMS 0x30 +#define CDC_REQUEST_GET_RINGER_PARMS 0x31 +#define CDC_REQUEST_SET_OPERATION_PARMS 0x32 +#define CDC_REQUEST_GET_OPERATION_PARMS 0x33 +#define CDC_REQUEST_SET_LINE_PARMS 0x34 +#define CDC_REQUEST_GET_LINE_PARMS 0x35 +#define CDC_REQUEST_DIAL_DIGITS 0x36 +#define CDC_REQUEST_SET_UNIT_PARAMETER 0x37 +#define CDC_REQUEST_GET_UNIT_PARAMETER 0x38 +#define CDC_REQUEST_CLEAR_UNIT_PARAMETER 0x39 +#define CDC_REQUEST_GET_PROFILE 0x3A +#define CDC_REQUEST_SET_ETHERNET_MULTICAST_FILTERS 0x40 +#define CDC_REQUEST_SET_ETHERNET_PMP_FILTER 0x41 +#define CDC_REQUEST_GET_ETHERNET_PMP_FILTER 0x42 +#define CDC_REQUEST_SET_ETHERNET_PACKET_FILTER 0x43 +#define CDC_REQUEST_GET_ETHERNET_STATISTIC 0x44 +#define CDC_REQUEST_SET_ATM_DATA_FORMAT 0x50 +#define CDC_REQUEST_GET_ATM_DEVICE_STATISTICS 0x51 +#define CDC_REQUEST_SET_ATM_DEFAULT_VC 0x52 +#define CDC_REQUEST_GET_ATM_VC_STATISTICS 0x53 + +/* Communication feature selector codes */ +/* (usbcdc11.pdf, 6.2.2..6.2.4, Table 47) */ +#define CDC_ABSTRACT_STATE 0x01 +#define CDC_COUNTRY_SETTING 0x02 + +/** Control Signal Bitmap Values for SetControlLineState */ +#define SET_CONTROL_LINE_STATE_RTS 0x02 +#define SET_CONTROL_LINE_STATE_DTR 0x01 + +/* Feature Status returned for ABSTRACT_STATE Selector */ +/* (usbcdc11.pdf, 6.2.3, Table 48) */ +#define CDC_IDLE_SETTING (1 << 0) +#define CDC_DATA_MULTPLEXED_STATE (1 << 1) + +/* Control signal bitmap values for the SetControlLineState request */ +/* (usbcdc11.pdf, 6.2.14, Table 51) */ +#define CDC_DTE_PRESENT (1 << 0) +#define CDC_ACTIVATE_CARRIER (1 << 1) + +/* CDC class-specific notification codes */ +/* (usbcdc11.pdf, 6.3, Table 68) */ +/* see Table 67 for Info about class-specific notifications */ +#define CDC_NOTIFICATION_NETWORK_CONNECTION 0x00 +#define CDC_RESPONSE_AVAILABLE 0x01 +#define CDC_AUX_JACK_HOOK_STATE 0x08 +#define CDC_RING_DETECT 0x09 +#define CDC_NOTIFICATION_SERIAL_STATE 0x20 +#define CDC_CALL_STATE_CHANGE 0x28 +#define CDC_LINE_STATE_CHANGE 0x29 +#define CDC_CONNECTION_SPEED_CHANGE 0x2A + +/* UART state bitmap values (Serial state notification). */ +/* (usbcdc11.pdf, 6.3.5, Table 69) */ +#define CDC_SERIAL_STATE_OVERRUN (1 << 6) /* receive data overrun error has occurred */ +#define CDC_SERIAL_STATE_OVERRUN_Pos (6) +#define CDC_SERIAL_STATE_OVERRUN_Msk (1 << CDC_SERIAL_STATE_OVERRUN_Pos) +#define CDC_SERIAL_STATE_PARITY (1 << 5) /* parity error has occurred */ +#define CDC_SERIAL_STATE_PARITY_Pos (5) +#define CDC_SERIAL_STATE_PARITY_Msk (1 << CDC_SERIAL_STATE_PARITY_Pos) +#define CDC_SERIAL_STATE_FRAMING (1 << 4) /* framing error has occurred */ +#define CDC_SERIAL_STATE_FRAMING_Pos (4) +#define CDC_SERIAL_STATE_FRAMING_Msk (1 << CDC_SERIAL_STATE_FRAMING_Pos) +#define CDC_SERIAL_STATE_RING (1 << 3) /* state of ring signal detection */ +#define CDC_SERIAL_STATE_RING_Pos (3) +#define CDC_SERIAL_STATE_RING_Msk (1 << CDC_SERIAL_STATE_RING_Pos) +#define CDC_SERIAL_STATE_BREAK (1 << 2) /* state of break detection */ +#define CDC_SERIAL_STATE_BREAK_Pos (2) +#define CDC_SERIAL_STATE_BREAK_Msk (1 << CDC_SERIAL_STATE_BREAK_Pos) +#define CDC_SERIAL_STATE_TX_CARRIER (1 << 1) /* state of transmission carrier */ +#define CDC_SERIAL_STATE_TX_CARRIER_Pos (1) +#define CDC_SERIAL_STATE_TX_CARRIER_Msk (1 << CDC_SERIAL_STATE_TX_CARRIER_Pos) +#define CDC_SERIAL_STATE_RX_CARRIER (1 << 0) /* state of receiver carrier */ +#define CDC_SERIAL_STATE_RX_CARRIER_Pos (0) +#define CDC_SERIAL_STATE_RX_CARRIER_Msk (1 << CDC_SERIAL_STATE_RX_CARRIER_Pos) + +/*------------------------------------------------------------------------------ + * Structures based on usbcdc11.pdf (www.usb.org) + *----------------------------------------------------------------------------*/ + +/* Header functional descriptor */ +/* (usbcdc11.pdf, 5.2.3.1) */ +/* This header must precede any list of class-specific descriptors. */ +struct cdc_header_descriptor { + uint8_t bFunctionLength; /* size of this descriptor in bytes */ + uint8_t bDescriptorType; /* CS_INTERFACE descriptor type */ + uint8_t bDescriptorSubtype; /* Header functional descriptor subtype */ + uint16_t bcdCDC; /* USB CDC specification release version */ +} __PACKED; + +/* Call management functional descriptor */ +/* (usbcdc11.pdf, 5.2.3.2) */ +/* Describes the processing of calls for the communication class interface. */ +struct cdc_call_management_descriptor { + uint8_t bFunctionLength; /* size of this descriptor in bytes */ + uint8_t bDescriptorType; /* CS_INTERFACE descriptor type */ + uint8_t bDescriptorSubtype; /* call management functional descriptor subtype */ + uint8_t bmCapabilities; /* capabilities that this configuration supports */ + uint8_t bDataInterface; /* interface number of the data class interface used for call management (optional) */ +} __PACKED; + +/* Abstract control management functional descriptor */ +/* (usbcdc11.pdf, 5.2.3.3) */ +/* Describes the command supported by the communication interface class with the Abstract Control Model subclass code. */ +struct cdc_abstract_control_management_descriptor { + uint8_t bFunctionLength; /* size of this descriptor in bytes */ + uint8_t bDescriptorType; /* CS_INTERFACE descriptor type */ + uint8_t bDescriptorSubtype; /* abstract control management functional descriptor subtype */ + uint8_t bmCapabilities; /* capabilities supported by this configuration */ +} __PACKED; + +/* Union functional descriptors */ +/* (usbcdc11.pdf, 5.2.3.8) */ +/* Describes the relationship between a group of interfaces that can be considered to form a functional unit. */ +struct cdc_union_descriptor { + uint8_t bFunctionLength; /* size of this descriptor in bytes */ + uint8_t bDescriptorType; /* CS_INTERFACE descriptor type */ + uint8_t bDescriptorSubtype; /* union functional descriptor subtype */ + uint8_t bMasterInterface; /* interface number designated as master */ +} __PACKED; + +/* Union functional descriptors with one slave interface */ +/* (usbcdc11.pdf, 5.2.3.8) */ +struct cdc_union_1slave_descriptor { + uint8_t bFunctionLength; + uint8_t bDescriptorType; + uint8_t bDescriptorSubtype; + uint8_t bControlInterface; + uint8_t bSubordinateInterface0; +} __PACKED; + +/* Line coding structure for GET_LINE_CODING / SET_LINE_CODING class requests*/ +/* Format of the data returned when a GetLineCoding request is received */ +/* (usbcdc11.pdf, 6.2.13) */ +/*******************************************************************************/ +/* Line Coding Structure */ +/*-----------------------------------------------------------------------------*/ +/* Offset | Field | Size | Value | Description */ +/* 0 | dwDTERate | 4 | Number |Data terminal rate, in bits per second*/ +/* 4 | bCharFormat | 1 | Number | Stop bits */ +/* 0 - 1 Stop bit */ +/* 1 - 1.5 Stop bits */ +/* 2 - 2 Stop bits */ +/* 5 | bParityType | 1 | Number | Parity */ +/* 0 - None */ +/* 1 - Odd */ +/* 2 - Even */ +/* 3 - Mark */ +/* 4 - Space */ +/* 6 | bDataBits | 1 | Number Data bits (5, 6, 7, 8 or 16). */ +/*******************************************************************************/ +struct cdc_line_coding { + uint32_t dwDTERate; /* Data terminal rate in bits per second */ + uint8_t bCharFormat; /* Number of stop bits */ + uint8_t bParityType; /* Parity bit type */ + uint8_t bDataBits; /* Number of data bits */ +} __PACKED; + +/** Data structure for the notification about SerialState */ +struct cdc_acm_notification { + uint8_t bmRequestType; + uint8_t bNotificationType; + uint16_t wValue; + uint16_t wIndex; + uint16_t wLength; + uint16_t data; +} __PACKED; + +/** Ethernet Networking Functional Descriptor */ +struct cdc_ecm_descriptor { + uint8_t bFunctionLength; + uint8_t bDescriptorType; + uint8_t bDescriptorSubtype; + uint8_t iMACAddress; + uint32_t bmEthernetStatistics; + uint16_t wMaxSegmentSize; + uint16_t wNumberMCFilters; + uint8_t bNumberPowerFilters; +} __PACKED; + + +#endif // _USB_CDC_H_ diff --git a/usb/class/cdc/usbd_cdc.c b/usb/class/cdc/usbd_cdc.c new file mode 100644 index 0000000..d43ba3b --- /dev/null +++ b/usb/class/cdc/usbd_cdc.c @@ -0,0 +1,235 @@ +/** + **************************************************************************************** + * + * @file usbd_cdc.c + * + * @brief Function of USB Communications Device Class (CDC) + * + **************************************************************************************** + */ + +#include "usbd.h" +#include "usbd_cdc.h" + + +/// CDC global environment +static usbd_cdc_t usbd_cdcs[CDC_INST_CNT]; + + +/// Interface number convert to cdc instance +static usbd_cdc_t *find_cdc_by_intf(uint8_t intf_num) +{ + for (uint8_t i = 0; i < CDC_INST_CNT; i++) { + if (usbd_cdcs[i].intf_num == intf_num) { + return &usbd_cdcs[i]; + } + } + + USB_LOG_ERR("Not Find CDC(intf:%d)\r\n", intf_num); + return NULL; +} + +/// Endpoint address convert to cdc instance +static usbd_cdc_t *find_cdc_by_ep(uint8_t ep_addr) +{ + for (uint8_t i = 0; i < CDC_INST_CNT; i++) { + if (usbd_cdcs[i].ep_in == ep_addr) { + return &usbd_cdcs[i]; + } + } + + USB_LOG_ERR("Not Find CDC(ep:%d)\r\n", ep_addr); + return NULL; +} + +static void dflt_cdc_param(usbd_cdc_t *cdc) +{ + cdc->cdc_state = CDC_STATE_IDLE; + cdc->txdata_len = 0; + cdc->txdata_res = 0; + + cdc->line_state = 0; + cdc->line_coding.dwDTERate = 115200; + cdc->line_coding.bDataBits = 8; + cdc->line_coding.bParityType = 0; + cdc->line_coding.bCharFormat = 0; +} + +void usbd_cdc_init(uint8_t idx, uint8_t intf_num, uint8_t ep_in) +{ + //usbd_cdc_t *cdc; + if (idx < CDC_INST_CNT) { + dflt_cdc_param(&usbd_cdcs[idx]); + usbd_cdcs[idx].intf_num = intf_num; + usbd_cdcs[idx].ep_in = ep_in; + } +} + +void usbd_cdc_reset(void) +{ + for (uint8_t i = 0; i < CDC_INST_CNT; i++) { + dflt_cdc_param(&usbd_cdcs[i]); + } +} + +__WEAK void usbd_cdc_updated(usbd_cdc_t *cdc, uint8_t type) +{ + /*!< here you can update params to hardware */ + +} + +static uint8_t usbd_cdc_send(usbd_cdc_t *cdc, uint16_t len, const uint8_t *data) +{ + uint8_t status = USBD_FAIL; + + if (cdc && (cdc->cdc_state == CDC_STATE_IDLE)) { + cdc->txdata_ptr = data; + cdc->txdata_len = len; + //cdc->txdata_res = 0; + cdc->cdc_state = CDC_STATE_BUSY; // Update before isr occure + + status = usbd_ep_write(cdc->ep_in, cdc->txdata_len, cdc->txdata_ptr, &cdc->txdata_res); + if (status != USBD_OK) { + cdc->cdc_state = CDC_STATE_IDLE; // fail to recover + } else { + // continue send in bulk_in_handler + } + } + + return status; +} + +uint8_t usbd_cdc_ep_send(uint8_t ep, uint16_t len, const uint8_t *data) +{ + uint8_t status = USBD_FAIL; + + if (usbd_is_configured()) { + usbd_cdc_t *curr_cdc = find_cdc_by_ep(ep); + + status = usbd_cdc_send(curr_cdc, len, data); + } + + return status; +} + +uint8_t usbd_cdc_id_send(uint8_t id, uint16_t len, const uint8_t *data) +{ + uint8_t status = USBD_FAIL; + + if ((id < CDC_INST_CNT) && usbd_is_configured()) { + usbd_cdc_t *curr_cdc = &usbd_cdcs[id]; + + status = usbd_cdc_send(curr_cdc, len, data); + } + + return status; +} + +void usbd_cdc_bulk_in_handler(uint8_t ep) +{ + usbd_cdc_t *curr_cdc = find_cdc_by_ep(ep); + + if (curr_cdc && (curr_cdc->cdc_state == CDC_STATE_BUSY)) { + uint16_t chunk = curr_cdc->txdata_res; + + if (chunk != curr_cdc->txdata_len) { + // More bulk, continue send + curr_cdc->txdata_len -= chunk; + curr_cdc->txdata_ptr += chunk; + + if (usbd_ep_write(ep, curr_cdc->txdata_len, curr_cdc->txdata_ptr, &curr_cdc->txdata_res) != USBD_OK) { + curr_cdc->cdc_state = CDC_STATE_IDLE; // fail to recover + } + } else { + // Last bulk, send ZLP if times of CDC_BULK_EP_MPS + if (chunk == CDC_BULK_EP_MPS) { + curr_cdc->txdata_len = 0; + curr_cdc->txdata_res = 0; + usbd_ep_write(ep, 0, NULL, NULL); // send ZLP + } else { + curr_cdc->cdc_state = CDC_STATE_IDLE; // finish + } + } + } +} + +__WEAK void usbd_cdc_bulk_out_handler(uint8_t ep) +{ + uint8_t data[CDC_BULK_EP_MPS]; + uint16_t read_byte = usbd_ep_read(ep, CDC_BULK_EP_MPS, data); + USB_LOG_DBG("CDC Bulk Out(ep:%d,len:%d)\r\n", ep, read_byte); + + /*!< here you can output data to hardware */ +} + +/** + * @brief Handler called for Class requests. + * + * @param setup Information about the request to execute. + * @param data Buffer containing the request result. + * @param len Size of the buffer. + * + * @return 0 on success, errno code on fail. + */ +uint8_t usbd_cdc_class_handler(struct usb_setup_packet *setup, uint8_t **data, uint16_t *len) +{ + usbd_cdc_t *curr_cdc; + uint8_t intf_num; + + if ((setup->bmRequestType & USB_REQUEST_TYPE_MASK) != USB_REQUEST_CLASS) { + return USBD_FAIL; + } + + intf_num = (uint8_t)setup->wIndex; + curr_cdc = find_cdc_by_intf(intf_num); + + if (!curr_cdc) { + return USBD_FAIL; + } + + USB_LOG_DBG("CDC Class request:0x%02x,intf:%d\r\n", setup->bRequest, intf_num); + + switch (setup->bRequest) { + case CDC_REQUEST_SET_LINE_CODING: + { + if (memcmp(&(curr_cdc->line_coding), *data, sizeof(struct cdc_line_coding)) != 0) { + // param update, save it + memcpy(&(curr_cdc->line_coding), *data, sizeof(struct cdc_line_coding)); + USB_LOG_DBG("CDC_SET_LINE_CODING \r\n", + curr_cdc->line_coding.dwDTERate, curr_cdc->line_coding.bDataBits, + curr_cdc->line_coding.bParityType, curr_cdc->line_coding.bCharFormat); + + usbd_cdc_updated(curr_cdc, CDC_LINE_CODING); + } + } break; + + case CDC_REQUEST_SET_CONTROL_LINE_STATE: + { + uint8_t line_state = (uint8_t)setup->wValue; + + if (curr_cdc->line_state != line_state) { + // param update, save it + curr_cdc->line_state = line_state; + USB_LOG_DBG("CDC_SET_LINE_STATE \r\n", (line_state & 0x01), (line_state & 0x02)); + + usbd_cdc_updated(curr_cdc, CDC_LINE_STATE); + } + } break; + + case CDC_REQUEST_GET_LINE_CODING: + { + *data = (uint8_t *)&(curr_cdc->line_coding); + *len = sizeof(struct cdc_line_coding); + + USB_LOG_DBG("CDC_GET_LINE_CODING \r\n", + curr_cdc->line_coding.dwDTERate, curr_cdc->line_coding.bDataBits, + curr_cdc->line_coding.bParityType, curr_cdc->line_coding.bCharFormat); + } break; + + default: + USB_LOG_WRN("Unhandled CDC Class bRequest 0x%02x\r\n", setup->bRequest); + return USBD_FAIL; + } + + return USBD_OK; +} diff --git a/usb/class/cdc/usbd_cdc.h b/usb/class/cdc/usbd_cdc.h new file mode 100644 index 0000000..b28a86e --- /dev/null +++ b/usb/class/cdc/usbd_cdc.h @@ -0,0 +1,147 @@ +/** + **************************************************************************************** + * + * @file usbd_cdc.h + * + * @brief Header file of USB CDC function + * + **************************************************************************************** + */ + +#ifndef _USBD_CDC_H_ +#define _USBD_CDC_H_ + +#include +#include "usb_cdc.h" + + +#if !defined(CDC_INST_CNT) +// MAX Count of CDC Instances +#define CDC_INST_CNT (3) +#endif + +/* Max packet size */ +#define CDC_INT_EP_MPS (0x0040) +#define CDC_BULK_EP_MPS (0x0040) + +/* Length of CDC descriptor: 66 bytes */ +#define CDC_ACM_DESCRIPTOR_LEN (8 + 9 + 5 + 5 + 4 + 5 + 7 + 9 + 7 + 7) + +/* Macro for template descriptor */ +#define CDC_ACM_DESCRIPTOR_INIT(bFirstInterface, int_ep, out_ep, in_ep, str_idx) \ + /* Interface Associate */ \ + 0x08, /* bLength */ \ + USB_DESC_TYPE_INTERFACE_ASSOCIATION, /* bDescriptorType */ \ + bFirstInterface, /* bFirstInterface */ \ + 0x02, /* bInterfaceCount */ \ + USB_DEVICE_CLASS_CDC, /* bFunctionClass */ \ + CDC_ABSTRACT_CONTROL_MODEL, /* bFunctionSubClass */ \ + CDC_COMMON_PROTOCOL_ATCMD, /* bFunctionProtocol */ \ + 0x00, /* iFunction */ \ + /* Interface CDC_CMD */ \ + 0x09, /* bLength */ \ + USB_DESC_TYPE_INTERFACE, /* bDescriptorType */ \ + bFirstInterface, /* bInterfaceNumber */ \ + 0x00, /* bAlternateSetting */ \ + 0x01, /* bNumEndpoints */ \ + USB_DEVICE_CLASS_CDC, /* bInterfaceClass */ \ + CDC_ABSTRACT_CONTROL_MODEL, /* bInterfaceSubClass */ \ + CDC_COMMON_PROTOCOL_ATCMD, /* bInterfaceProtocol */ \ + str_idx, /* iInterface */ \ + /* Header Functional Descriptor */ \ + 0x05, /* bLength */ \ + CDC_CS_INTERFACE, /* bDescriptorType */ \ + CDC_FUNC_DESC_HEADER, /* bDescriptorSubtype */ \ + WBVAL(CDC_V1_10), /* bcdCDC */ \ + /* Call Management Functional */ \ + 0x05, /* bLength */ \ + CDC_CS_INTERFACE, /* bDescriptorType */ \ + CDC_FUNC_DESC_CALL_MANAGEMENT, /* bDescriptorSubtype */ \ + 0x00, /* bmCapabilities */ \ + (uint8_t)(bFirstInterface + 1), /* bDataInterface */ \ + /* ACM Functional Descriptor */ \ + 0x04, /* bLength */ \ + CDC_CS_INTERFACE, /* bDescriptorType */ \ + CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT, /* bDescriptorSubtype */ \ + 0x02, /* bmCapabilities */ \ + /* Union Functional Descriptor */ \ + 0x05, /* bLength */ \ + CDC_CS_INTERFACE, /* bDescriptorType */ \ + CDC_FUNC_DESC_UNION, /* bDescriptorSubtype */ \ + bFirstInterface, /* bMasterInterface */ \ + (uint8_t)(bFirstInterface + 1), /* bSlaveInterface0 */ \ + 0x07, /* bLength */ \ + USB_DESC_TYPE_ENDPOINT, /* bDescriptorType */ \ + int_ep, /* bEndpointAddress */ \ + 0x03, /* bmAttributes */ \ + WBVAL(CDC_INT_EP_MPS), /* wMaxPacketSize */ \ + 0x00, /* bInterval */ \ + /* Interface CDC_DATA */ \ + 0x09, /* bLength */ \ + USB_DESC_TYPE_INTERFACE, /* bDescriptorType */ \ + (uint8_t)(bFirstInterface + 1), /* bInterfaceNumber */ \ + 0x00, /* bAlternateSetting */ \ + 0x02, /* bNumEndpoints */ \ + CDC_DATA_INTERFACE_CLASS, /* bInterfaceClass */ \ + 0x00, /* bInterfaceSubClass */ \ + 0x00, /* bInterfaceProtocol */ \ + 0x00, /* iInterface */ \ + 0x07, /* bLength */ \ + USB_DESC_TYPE_ENDPOINT, /* bDescriptorType */ \ + out_ep, /* bEndpointAddress */ \ + 0x02, /* bmAttributes */ \ + WBVAL(CDC_BULK_EP_MPS), /* wMaxPacketSize */ \ + 0x00, /* bInterval */ \ + 0x07, /* bLength */ \ + USB_DESC_TYPE_ENDPOINT, /* bDescriptorType */ \ + in_ep, /* bEndpointAddress */ \ + 0x02, /* bmAttributes */ \ + WBVAL(CDC_BULK_EP_MPS), /* wMaxPacketSize */ \ + 0x00 /* bInterval */ + + +enum cdc_param_type { + CDC_LINE_CODING, + CDC_LINE_STATE, +}; + +enum cdc_state_type { + CDC_STATE_IDLE, + CDC_STATE_BUSY, +}; + +typedef struct usbd_cdc_tag { + /* CDC ACM interface */ + uint8_t intf_num; + uint8_t ep_in; + /* CDC ACM state */ + uint8_t cdc_state; + /* CDC ACM line state bitmap, DTE side */ + uint8_t line_state; + /* CDC ACM line coding properties */ + struct cdc_line_coding line_coding; + /* CDC ACM tx data */ + const uint8_t *txdata_ptr; + uint16_t txdata_len; + uint16_t txdata_res; +} usbd_cdc_t; + + +void usbd_cdc_init(uint8_t idx, uint8_t intf_num, uint8_t ep_in); + +void usbd_cdc_reset(void); + +void usbd_cdc_updated(usbd_cdc_t *cdc, uint8_t type); + +uint8_t usbd_cdc_ep_send(uint8_t ep, uint16_t len, const uint8_t *data); + +uint8_t usbd_cdc_id_send(uint8_t id, uint16_t len, const uint8_t *data); + +void usbd_cdc_bulk_in_handler(uint8_t ep); + +void usbd_cdc_bulk_out_handler(uint8_t ep); + +uint8_t usbd_cdc_class_handler(struct usb_setup_packet *setup, uint8_t **data, uint16_t *len); + + +#endif // _USBD_CDC_H_ diff --git a/usb/class/hid/usb_hid.h b/usb/class/hid/usb_hid.h new file mode 100644 index 0000000..bdfbeee --- /dev/null +++ b/usb/class/hid/usb_hid.h @@ -0,0 +1,716 @@ +/** + **************************************************************************************** + * + * @file usb_hid.h + * + * @brief Human Interface Device (HID) Class public header + * + * Header follows Device Class Definition for Human Interface Devices (HID) + * Version 1.11 document (HID1_11-1.pdf). + **************************************************************************************** + */ + +#ifndef _USB_HID_H_ +#define _USB_HID_H_ + +#include "usb_def.h" + +/* Subclass codes (HID 4.2) */ +#define HID_SUBCLASS_NONE 0 /* No subclass */ +#define HID_SUBCLASS_BOOTIF 1 /* Boot Interface Subclass */ + +/* HID Protocol Codes (HID 4.3) */ +#define HID_PROTOCOL_NONE 0x00 +#define HID_PROTOCOL_BOOT 0x00 +#define HID_PROTOCOL_KEYBOARD 0x01 +#define HID_PROTOCOL_REPORT 0x01 +#define HID_PROTOCOL_MOUSE 0x02 + +/* HID Class Descriptor Types (HID 7.1) */ +#define HID_DESC_TYPE_HID 0x21 +#define HID_DESC_TYPE_HID_REPORT 0x22 +#define HID_DESC_TYPE_HID_PHYSICAL 0x23 + +/* HID Class Specific Requests (HID 7.2) */ +#define HID_REQUEST_GET_REPORT 0x01 +#define HID_REQUEST_GET_IDLE 0x02 +#define HID_REQUEST_GET_PROTOCOL 0x03 +#define HID_REQUEST_SET_REPORT 0x09 +#define HID_REQUEST_SET_IDLE 0x0A +#define HID_REQUEST_SET_PROTOCOL 0x0B + +/* Report Type (MS byte of wValue for GET_REPORT) (HID 7.2.1) */ +#define HID_REPORT_INPUT 0x01 +#define HID_REPORT_OUTPUT 0x02 +#define HID_REPORT_FEATURE 0x03 + +/* HID Descriptor ***********************************************************/ + +#define HID_COUNTRY_NONE 0x00 /* Not Supported */ +#define HID_COUNTRY_ARABIC 0x01 /* Arabic */ +#define HID_COUNTRY_BELGIAN 0x02 /* Belgian */ +#define HID_COUNTRY_CANADA 0x03 /* Canadian-Bilingual */ +#define HID_COUNTRY_CANADRFR 0x04 /* Canadian-French */ +#define HID_COUNTRY_CZECH 0x05 /* Czech Republic */ +#define HID_COUNTRY_DANISH 0x06 /* Danish */ +#define HID_COUNTRY_FINNISH 0x07 /* Finnish */ +#define HID_COUNTRY_FRENCH 0x08 /* French */ +#define HID_COUNTRY_GERMAN 0x09 /* German */ +#define HID_COUNTRY_GREEK 0x10 /* Greek */ +#define HID_COUNTRY_HEBREW 0x11 /* Hebrew */ +#define HID_COUNTRY_HUNGARY 0x12 /* Hungary */ +#define HID_COUNTRY_ISO 0x13 /* International (ISO) */ +#define HID_COUNTRY_ITALIAN 0x14 /* Italian */ +#define HID_COUNTRY_JAPAN 0x15 /* Japan (Katakana) */ +#define HID_COUNTRY_KOREAN 0x16 /* Korean */ +#define HID_COUNTRY_LATINAM 0x17 /* Latin American */ +#define HID_COUNTRY_DUTCH 0x18 /* Netherlands/Dutch */ +#define HID_COUNTRY_NORWEGIAN 0x19 /* Norwegian */ +#define HID_COUNTRY_PERSIAN 0x20 /* Persian (Farsi) */ +#define HID_COUNTRY_POLAND 0x21 /* Poland */ +#define HID_COUNTRY_PORTUGUESE 0x22 /* Portuguese */ +#define HID_COUNTRY_RUSSIA 0x23 /* Russia */ +#define HID_COUNTRY_SLOVAKIA 0x24 /* Slovakia */ +#define HID_COUNTRY_SPANISH 0x25 /* Spanish */ +#define HID_COUNTRY_SWEDISH 0x26 /* Swedish */ +#define HID_COUNTRY_SWISSFR 0x27 /* Swiss/French */ +#define HID_COUNTRY_SWISSGR 0x28 /* Swiss/German */ +#define HID_COUNTRY_SWITZERLAND 0x29 /* Switzerland */ +#define HID_COUNTRY_TAIWAN 0x30 /* Taiwan */ +#define HID_COUNTRY_TURKISHQ 0x31 /* Turkish-Q */ +#define HID_COUNTRY_UK 0x32 /* UK */ +#define HID_COUNTRY_US 0x33 /* US */ +#define HID_COUNTRY_YUGOSLAVIA 0x34 /* Yugoslavia */ +#define HID_COUNTRY_TURKISHF 0x35 /* Turkish-F */ + +/* HID report items */ +#define HID_REPORT_ITEM_SIZE_MASK 0x03 +#define HID_REPORT_ITEM_SIZE_0 0x00 /* No data follows */ +#define HID_REPORT_ITEM_SIZE_1 0x01 /* 1 byte of data follows */ +#define HID_REPORT_ITEM_SIZE_2 0x02 /* 2 bytes of data follow */ +#define HID_REPORT_ITEM_SIZE_4 0x03 /* 4 bytes of data follow */ +#define HID_REPORT_ITEM_TYPE_MASK 0x0c +#define HID_REPORT_ITEM_TYPE_MAIN 0x00 +#define HID_REPORT_ITEM_TYPE_GLOBAL 0x04 +#define HID_REPORT_ITEM_TYPE_LOCAL 0x08 +#define HID_REPORT_ITEM_TAG_MASK 0xf0 + +/* Main Items (HID 6.2.2.4) */ +#define HID_MAIN_ITEM_CONSTANT (1 << 0) /* Constant(1) vs Data(0) */ +#define HID_MAIN_ITEM_VARIABLE (1 << 1) /* Variable(1) vs Array(0) */ +#define HID_MAIN_ITEM_RELATIVE (1 << 2) /* Relative(1) vs Absolute(0) */ +#define HID_MAIN_ITEM_WRAP (1 << 3) /* Wrap(1) vs No Wrap(0) */ +#define HID_MAIN_ITEM_NONLINEAR (1 << 4) /* Non Linear(1) vs Linear(0) */ +#define HID_MAIN_ITEM_NOPREFERRED (1 << 5) /* No Preferred (1) vs Preferred State(0) */ +#define HID_MAIN_ITEM_NULLSTATE (1 << 6) /* Null state(1) vs No Null position(0) */ +#define HID_MAIN_ITEM_VOLATILE (1 << 7) /* Volatile(1) vs Non volatile(0) */ +#define HID_MAIN_ITEM_BUFFEREDBYTES (1 << 8) /* Buffered Bytes(1) vs Bit Field(0) */ + +#define HID_MAIN_ITEM_SIZE(pfx) ((pfx)&HID_REPORT_ITEM_SIZE_MASK) +#define HID_MAIN_ITEM_INPUT_PREFIX 0x80 +#define HID_MAIN_ITEM_INPUT_CONSTANT HID_MAIN_ITEM_CONSTANT +#define HID_MAIN_ITEM_INPUT_VARIABLE HID_MAIN_ITEM_VARIABLE +#define HID_MAIN_ITEM_INPUT_RELATIVE HID_MAIN_ITEM_RELATIVE +#define HID_MAIN_ITEM_INPUT_WRAP HID_MAIN_ITEM_WRAP +#define HID_MAIN_ITEM_INPUT_NONLINEAR HID_MAIN_ITEM_NONLINEAR +#define HID_MAIN_ITEM_INPUT_NOPREFERRED HID_MAIN_ITEM_NOPREFERRED +#define HID_MAIN_ITEM_INPUT_NULLSTATE HID_MAIN_ITEM_NULLSTATE +#define HID_MAIN_ITEM_INPUT_BUFFEREDBYTES HID_MAIN_ITEM_BUFFEREDBYTES + +#define HID_MAIN_ITEM_OUTPUT_PREFIX 0x90 +#define HID_MAIN_ITEM_OUTPUT_CONSTANT HID_MAIN_ITEM_CONSTANT +#define HID_MAIN_ITEM_OUTPUT_VARIABLE HID_MAIN_ITEM_VARIABLE +#define HID_MAIN_ITEM_OUTPUT_RELATIVE HID_MAIN_ITEM_RELATIVE +#define HID_MAIN_ITEM_OUTPUT_WRAP HID_MAIN_ITEM_WRAP +#define HID_MAIN_ITEM_OUTPUT_NONLINEAR HID_MAIN_ITEM_NONLINEAR +#define HID_MAIN_ITEM_OUTPUT_NOPREFERRED HID_MAIN_ITEM_NOPREFERRED +#define HID_MAIN_ITEM_OUTPUT_NULLSTATE HID_MAIN_ITEM_NULLSTATE +#define HID_MAIN_ITEM_OUTPUT_VOLATILE HID_MAIN_ITEM_VOLATILE +#define HID_MAIN_ITEM_OUTPUT_BUFFEREDBYTES HID_MAIN_ITEM_BUFFEREDBYTES + +#define HID_MAIN_ITEM_FEATURE_PREFIX 0xb0 +#define HID_MAIN_ITEM_FEATURE_CONSTANT HID_MAIN_ITEM_CONSTANT +#define HID_MAIN_ITEM_FEATURE_VARIABLE HID_MAIN_ITEM_VARIABLE +#define HID_MAIN_ITEM_FEATURE_RELATIVE HID_MAIN_ITEM_RELATIVE +#define HID_MAIN_ITEM_FEATURE_WRAP HID_MAIN_ITEM_WRAP +#define HID_MAIN_ITEM_FEATURE_NONLINEAR HID_MAIN_ITEM_NONLINEAR +#define HID_MAIN_ITEM_FEATURE_NOPREFERRED HID_MAIN_ITEM_NOPREFERRED +#define HID_MAIN_ITEM_FEATURE_NULLSTATE HID_MAIN_ITEM_NULLSTATE +#define HID_MAIN_ITEM_FEATURE_VOLATILE HID_MAIN_ITEM_VOLATILE +#define HID_MAIN_ITEM_FEATURE_BUFFEREDBYTES HID_MAIN_ITEM_BUFFEREDBYTES + +#define HID_MAIN_ITEM_COLLECTION_PREFIX 0xa0 +#define HID_MAIN_ITEM_COLLECTION_PHYSICAL 0x00 /* Physical (group of axes) */ +#define HID_MAIN_ITEM_COLLECTION_APPL 0x01 /* Application (mouse, keyboard) */ +#define HID_MAIN_ITEM_COLLECTION_LOGICAL 0x02 /* Logical (interrelated data) */ +#define HID_MAIN_ITEM_COLLECTION_REPORT 0x03 /* Report */ +#define HID_MAIN_ITEM_COLLECTION_ARRAY 0x04 /* Named Array */ +#define HID_MAIN_ITEM_COLLECTION_SWITCH 0x05 /* Usage Switch */ +#define HID_MAIN_ITEM_COLLECTION_MODIFIER 0x06 /* Usage Modifier */ +#define HID_MAIN_ITEM_ENDCOLLECTION_PREFIX 0xc0 + +/* Global Items (HID 6.2.2.7) */ +#define HID_GLOBAL_ITEM_SIZE(pfx) ((pfx)&HID_REPORT_ITEM_SIZE_MASK) +#define HID_GLOBAL_ITEM_USAGEPAGE_PREFIX 0x04 /* Usage Page */ +#define HID_GLOBAL_ITEM_LOGICALMIN_PREFIX 0x14 /* Logical Minimum */ +#define HID_GLOBAL_ITEM_LOGICALMAX_PREFIX 0x24 /* Logical Maximum */ +#define HID_GLOBAL_ITEM_PHYSICALMIN_PREFIX 0x34 /* Physical Minimum */ +#define HID_GLOBAL_ITEM_PHYSMICALAX_PREFIX 0x44 /* Physical Maximum */ +#define HID_GLOBAL_ITEM_UNITEXP_PREFIX 0x54 /* Unit Exponent */ +#define HID_GLOBAL_ITEM_UNIT_PREFIX 0x64 /* Unit */ +#define HID_GLOBAL_ITEM_REPORTSIZE_PREFIX 0x74 /* Report Size */ +#define HID_GLOBAL_ITEM_REPORTID_PREFIX 0x84 /* Report ID */ +#define HID_GLOBAL_ITEM_REPORTCOUNT_PREFIX 0x94 /* Report Count */ +#define HID_GLOBAL_ITEM_PUSH_PREFIX 0xa4 /* Push */ +#define HID_GLOBAL_ITEM_POP_PREFIX 0xb4 /* Pop */ + +/* Local Items (HID 6.2.2.8) */ +#define HID_LOCAL_ITEM_SIZE(pfx) ((pfx)&HID_REPORT_ITEM_SIZE_MASK) +#define HID_LOCAL_ITEM_USAGE_PREFIX 0x08 /* Usage */ +#define HID_LOCAL_ITEM_USAGEMIN_PREFIX 0x18 /* Usage Minimum */ +#define HID_LOCAL_ITEM_USAGEMAX_PREFIX 0x28 /* Usage Maximum */ +#define HID_LOCAL_ITEM_DESIGNATORIDX_PREFIX 0x38 /* Designator Index */ +#define HID_LOCAL_ITEM_DESIGNATORMIN_PREFIX 0x48 /* Designator Minimum */ +#define HID_LOCAL_ITEM_DESIGNATORMAX_PREFIX 0x58 /* Designator Maximum */ +#define HID_LOCAL_ITEM_STRINGIDX_PREFIX 0x78 /* String Index */ +#define HID_LOCAL_ITEM_STRINGMIN_PREFIX 0x88 /* String Minimum */ +#define HID_LOCAL_ITEM_STRINGMAX_PREFIX 0x98 /* xx */ +#define HID_LOCAL_ITEM_DELIMITER_PREFIX 0xa8 /* Delimiter */ + +/* Modifier Keys (HID 8.3) */ +#define HID_MODIFER_LCTRL (1 << 0) /* Left Ctrl */ +#define HID_MODIFER_LSHIFT (1 << 1) /* Left Shift */ +#define HID_MODIFER_LALT (1 << 2) /* Left Alt */ +#define HID_MODIFER_LGUI (1 << 3) /* Left GUI */ +#define HID_MODIFER_RCTRL (1 << 4) /* Right Ctrl */ +#define HID_MODIFER_RSHIFT (1 << 5) /* Right Shift */ +#define HID_MODIFER_RALT (1 << 6) /* Right Alt */ +#define HID_MODIFER_RGUI (1 << 7) /* Right GUI */ + +/* Keyboard output report (1 byte) (HID B.1) */ +#define HID_KBD_OUTPUT_REPORT_NUMLOCK (1 << 0) +#define HID_KBD_OUTPUT_REPORT_CAPSLOCK (1 << 1) +#define HID_KBD_OUTPUT_REPORT_SCROLLLOCK (1 << 2) +#define HID_KBD_OUTPUT_REPORT_COMPOSE (1 << 3) +#define HID_KBD_OUTPUT_REPORT_KANA (1 << 4) + +/* Mouse input report (HID B.2) */ +#define HID_MOUSE_INPUT_REPORT_BUTTON1 (1 << 0) +#define HID_MOUSE_INPUT_REPORT_BUTTON2 (1 << 1) +#define HID_MOUSE_INPUT_REPORT_BUTTON3 (1 << 2) +#define HID_MOUSE_INPUT_REPORT_BUTTON_MASK (7) + +/* Joystick input report (4 bytes) (HID D.1) */ +#define HID_JS_INPUT_REPORT_HATSWITCH_LSB (0) +#define HID_JS_INPUT_REPORT_HATSWITCH_MASK (15 << HID_JSIN_HATSWITCH_SHIFT) +#define HID_JS_INPUT_REPORT_BUTTON1 (1 << 4) +#define HID_JS_INPUT_REPORT_BUTTON2 (1 << 5) +#define HID_JS_INPUT_REPORT_BUTTON3 (1 << 6) +#define HID_JS_INPUT_REPORT_BUTTON4 (1 << 7) + +/* Usage pages (HuT 3) */ +#define HID_USAGE_PAGE_UNDEFINED 0x00 /* Undefined */ +#define HID_USAGE_PAGE_GENERIC_DCTRL 0x01 /* Generic Desktop Controls */ +#define HID_USAGE_PAGE_SIMCTRL 0x02 /* Simulation Controls */ +#define HID_USAGE_PAGE_VRCTRL 0x03 /* VR Controls */ +#define HID_USAGE_PAGE_SPORTCTRL 0x04 /* Sport Controls */ +#define HID_USAGE_PAGE_GAMECTRL 0x05 /* Game Controls */ +#define HID_USAGE_PAGE_GENERIC_DEVCTRL 0x06 /* Generic Device Controls */ +#define HID_USAGE_PAGE_KBD 0x07 /* Keyboard/Keypad */ +#define HID_USAGE_PAGE_LEDS 0x08 /* LEDs */ +#define HID_USAGE_PAGE_BUTTON 0x09 /* Button */ +#define HID_USAGE_PAGE_ORDINAL 0x0a /* Ordinal */ +#define HID_USAGE_PAGE_TELEPHONY 0x0b /* Telephony */ +#define HID_USAGE_PAGE_CONSUMER 0x0c /* Consumer */ +#define HID_USAGE_PAGE_DIGITIZER 0x0d /* Digitizer */ + /* 0x0e Reserved */ +#define HID_USAGE_PAGE_PIDPAGE 0x0f /* PID Page Physical Interface Device */ +#define HID_USAGE_PAGE_UNICODE 0x10 /* Unicode */ + /* 0x11-13 Reserved */ +#define HID_USAGE_PAGE_ALPHA_DISPLAY 0x14 /* Alphanumeric Display */ + /* 0x15-3f Reserved */ +#define HID_USAGE_PAGE_MEDICAL 0x40 /* Medical Instruments */ + /* 0x41-7f Reserved */ + /* 0x80-83 Monitor Devices */ + /* 0x84-87 Power Devices */ + /* 0x88-8b Reserved */ +#define HID_USAGE_PAGE_BARCODE_SCANNER 0x8c /* Bar Code Scanner page */ +#define HID_USAGE_PAGE_SCALE 0x8d /* Scale page */ +#define HID_USAGE_PAGE_MSR 0x8e /* Magnetic Stripe Reading (MSR) Devices */ +#define HID_USAGE_PAGE_POS 0x8f /* Point of Sale devices */ +#define HID_USAGE_PAGE_CAMERA_CTRL 0x90 /* Camera Control Page */ + +/* Generic Desktop Page Usage IDs (HuT 4) */ +#define HID_DESKTOP_USAGE_UNDEFINED 0x00 /* Undefined */ +#define HID_DESKTOP_USAGE_POINTER 0x01 /* Pointer */ +#define HID_DESKTOP_USAGE_MOUSE 0x02 /* Mouse */ + /* 0x03 Reserved */ +#define HID_DESKTOP_USAGE_JOYSTICK 0x04 /* Joystick */ +#define HID_DESKTOP_USAGE_GAMEPAD 0x05 /* Game Pad */ +#define HID_DESKTOP_USAGE_KEYBOARD 0x06 /* Keyboard */ +#define HID_DESKTOP_USAGE_KEYPAD 0x07 /* Keypad */ +#define HID_DESKTOP_USAGE_MULTIAXIS 0x08 /* Multi-axis Controller */ +#define HID_DESKTOP_USAGE_TABLET 0x09 /* Tablet PC System Controls */ + /* 0x0a-2f Reserved */ +#define HID_DESKTOP_USAGE_X 0x30 /* X */ +#define HID_DESKTOP_USAGE_Y 0x31 /* Y */ +#define HID_DESKTOP_USAGE_Z 0x32 /* Z */ +#define HID_DESKTOP_USAGE_RX 0x33 /* Rx */ +#define HID_DESKTOP_USAGE_RY 0x34 /* Ry */ +#define HID_DESKTOP_USAGE_RZ 0x35 /* Rz */ +#define HID_DESKTOP_USAGE_SLIDER 0x36 /* Slider */ +#define HID_DESKTOP_USAGE_DIAL 0x37 /* Dial */ +#define HID_DESKTOP_USAGE_WHEEL 0x38 /* Wheel */ +#define HID_DESKTOP_USAGE_HATSWITCH 0x39 /* Hat switch */ +#define HID_DESKTOP_USAGE_COUNTED 0x3a /* Counted Buffer */ +#define HID_DESKTOP_USAGE_BYTECOUNT 0x3b /* Byte Count */ +#define HID_DESKTOP_USAGE_MOTION 0x3c /* Motion Wakeup */ +#define HID_DESKTOP_USAGE_START 0x3d /* Start */ +#define HID_DESKTOP_USAGE_SELECT 0x3e /* Select */ + /* 0x3f Reserved */ +#define HID_DESKTOP_USAGE_VX 0x40 /* Vx */ +#define HID_DESKTOP_USAGE_VY 0x41 /* Vy */ +#define HID_DESKTOP_USAGE_VZ 0x42 /* Vz */ +#define HID_DESKTOP_USAGE_VBRX 0x43 /* Vbrx */ +#define HID_DESKTOP_USAGE_VBRY 0x44 /* Vbry */ +#define HID_DESKTOP_USAGE_VBRZ 0x45 /* Vbrz */ +#define HID_DESKTOP_USAGE_VNO 0x46 /* Vno */ +#define HID_DESKTOP_USAGE_FEATURE 0x47 /* Feature Notification */ +#define HID_DESKTOP_USAGE_RESOLUTION 0x48 /* Resolution Multiplier */ + /* 0x49-7f Reserved */ +#define HID_DESKTOP_USAGE_CONTROL 0x80 /* System Control */ +#define HID_DESKTOP_USAGE_POWERDOWN 0x81 /* System Power Down */ +#define HID_DESKTOP_USAGE_SLEEP 0x82 /* System Sleep */ +#define HID_DESKTOP_USAGE_WAKEUP 0x83 /* System Wake Up */ +#define HID_DESKTOP_USAGE_CONTEXT_MENU 0x84 /* System Context Menu */ +#define HID_DESKTOP_USAGE_MAIN_MENU 0x85 /* System Main Menu */ +#define HID_DESKTOP_USAGE_APP_MENU 0x86 /* System App Menu */ +#define HID_DESKTOP_USAGE_MENU_HELP 0x87 /* System Menu Help */ +#define HID_DESKTOP_USAGE_MENU_EXIT 0x88 /* System Menu Exit */ +#define HID_DESKTOP_USAGE_MENU_SELECT 0x89 /* System Menu Select */ +#define HID_DESKTOP_USAGE_MENU_RIGHT 0x8a /* System Menu Right */ +#define HID_DESKTOP_USAGE_MENU_LEFT 0x8b /* System Menu Left */ +#define HID_DESKTOP_USAGE_MENU_UP 0x8c /* System Menu Up */ +#define HID_DESKTOP_USAGE_MENU_DOWN 0x8d /* System Menu Down */ +#define HID_DESKTOP_USAGE_COLD_RESTART 0x8e /* System Cold Restart */ +#define HID_DESKTOP_USAGE_WARM_RESTART 0x8f /* System Warm Restart */ +#define HID_DESKTOP_USAGE_DPAD_UP 0x90 /* D-pad Up */ +#define HID_DESKTOP_USAGE_DPAD_DOWN 0x91 /* D-pad Down */ +#define HID_DESKTOP_USAGE_DPAD_RIGHT 0x92 /* D-pad Right */ +#define HID_DESKTOP_USAGE_DPAD_LEFT 0x93 /* D-pad Left */ + /* 0x94-9f Reserved */ +#define HID_DESKTOP_USAGE_DOCK 0xa0 /* System Dock */ +#define HID_DESKTOP_USAGE_UNDOCK 0xa1 /* System Undock */ +#define HID_DESKTOP_USAGE_SETUP 0xa2 /* System Setup */ +#define HID_DESKTOP_USAGE_BREAK 0xa3 /* System Break */ +#define HID_DESKTOP_USAGE_DEBUG_BREAK 0xa4 /* System Debugger Break */ +#define HID_DESKTOP_USAGE_APP_BREAK 0xa5 /* Application Break */ +#define HID_DESKTOP_USAGE_APP_DEBUG_BREAK 0xa6 /* Application Debugger Break */ +#define HID_DESKTOP_USAGE_MUTE 0xa7 /* System Speaker Mute */ +#define HID_DESKTOP_USAGE_HIBERNATE 0xa8 /* System Hibernate */ + /* 0xa9-af Reserved */ +#define HID_DESKTOP_USAGE_DISPLAY_INVERT 0xb0 /* System Display Invert */ +#define HID_DESKTOP_USAGE_DISPALY_INTERNAL 0xb1 /* System Display Internal */ +#define HID_DESKTOP_USAGE_DISPLAY_EXTERNAL 0xb2 /* System Display External */ +#define HID_DESKTOP_USAGE_DISPLAY_BOTH 0xb3 /* System Display Both */ +#define HID_DESKTOP_USAGE_DISPLAY_DUAL 0xb4 /* System Display Dual */ +#define HID_DESKTOP_USAGE_DISPLAY_TOGGLE 0xb5 /* System Display Toggle Int/Ext */ +#define HID_DESKTOP_USAGE_DISPLAY_SWAP 0xb6 /* System Display Swap */ +#define HID_DESKTOP_USAGE_ 0xb7 /* System Display LCD Autoscale */ + /* 0xb8-ffff Reserved */ + +/* Keyboard usage IDs (HuT 10) */ +#define HID_KBD_USAGE_NONE 0x00 /* Reserved (no event indicated) */ +#define HID_KBD_USAGE_ERRORROLLOVER 0x01 /* Keyboard ErrorRollOver */ +#define HID_KBD_USAGE_POSTFAIL 0x02 /* Keyboard POSTFail */ +#define HID_KBD_USAGE_ERRUNDEF 0x03 /* Keyboard ErrorUndefined */ +#define HID_KBD_USAGE_A 0x04 /* Keyboard a or A (B-Z follow) */ +#define HID_KBD_USAGE_1 0x1e /* Keyboard 1 (2-9 follow) */ +#define HID_KBD_USAGE_EXCLAM 0x1e /* Keyboard 1 and ! */ +#define HID_KBD_USAGE_AT 0x1f /* Keyboard 2 and @ */ +#define HID_KBD_USAGE_POUND 0x20 /* Keyboard 3 and # */ +#define HID_KBD_USAGE_DOLLAR 0x21 /* Keyboard 4 and $ */ +#define HID_KBD_USAGE_PERCENT 0x22 /* Keyboard 5 and % */ +#define HID_KBD_USAGE_CARAT 0x23 /* Keyboard 6 and ^ */ +#define HID_KBD_USAGE_AMPERSAND 0x24 /* Keyboard 7 and & */ +#define HID_KBD_USAGE_ASTERISK 0x25 /* Keyboard 8 and * */ +#define HID_KBD_USAGE_LPAREN 0x26 /* Keyboard 9 and ( */ +#define HID_KBD_USAGE_0 0x27 /* Keyboard 0 and ) */ +#define HID_KBD_USAGE_RPAREN 0x27 /* Keyboard 0 and ) */ +#define HID_KBD_USAGE_ENTER 0x28 /* Keyboard Return (ENTER) */ +#define HID_KBD_USAGE_ESCAPE 0x29 /* Keyboard ESCAPE */ +#define HID_KBD_USAGE_DELETE 0x2a /* Keyboard DELETE (Backspace) */ +#define HID_KBD_USAGE_TAB 0x2b /* Keyboard Tab */ +#define HID_KBD_USAGE_SPACE 0x2c /* Keyboard Spacebar */ +#define HID_KBD_USAGE_HYPHEN 0x2d /* Keyboard - and (underscore) */ +#define HID_KBD_USAGE_UNDERSCORE 0x2d /* Keyboard - and (underscore) */ +#define HID_KBD_USAGE_EQUAL 0x2e /* Keyboard = and + */ +#define HID_KBD_USAGE_PLUS 0x2e /* Keyboard = and + */ +#define HID_KBD_USAGE_LBRACKET 0x2f /* Keyboard [ and { */ +#define HID_KBD_USAGE_LBRACE 0x2f /* Keyboard [ and { */ +#define HID_KBD_USAGE_RBRACKET 0x30 /* Keyboard ] and } */ +#define HID_KBD_USAGE_RBRACE 0x30 /* Keyboard ] and } */ +#define HID_KBD_USAGE_BSLASH 0x31 /* Keyboard \ and | */ +#define HID_KBD_USAGE_VERTBAR 0x31 /* Keyboard \ and | */ +#define HID_KBD_USAGE_NONUSPOUND 0x32 /* Keyboard Non-US # and ~ */ +#define HID_KBD_USAGE_TILDE 0x32 /* Keyboard Non-US # and ~ */ +#define HID_KBD_USAGE_SEMICOLON 0x33 /* Keyboard ; and : */ +#define HID_KBD_USAGE_COLON 0x33 /* Keyboard ; and : */ +#define HID_KBD_USAGE_SQUOTE 0x34 /* Keyboard ' and " */ +#define HID_KBD_USAGE_DQUOUTE 0x34 /* Keyboard ' and " */ +#define HID_KBD_USAGE_GACCENT 0x35 /* Keyboard Grave Accent and Tilde */ +#define HID_KBD_USAGE_GTILDE 0x35 /* Keyboard Grave Accent and Tilde */ +#define HID_KBD_USAGE_COMMON 0x36 /* Keyboard , and < */ +#define HID_KBD_USAGE_LT 0x36 /* Keyboard , and < */ +#define HID_KBD_USAGE_PERIOD 0x37 /* Keyboard . and > */ +#define HID_KBD_USAGE_GT 0x37 /* Keyboard . and > */ +#define HID_KBD_USAGE_DIV 0x38 /* Keyboard / and ? */ +#define HID_KBD_USAGE_QUESTION 0x38 /* Keyboard / and ? */ +#define HID_KBD_USAGE_CAPSLOCK 0x39 /* Keyboard Caps Lock */ +#define HID_KBD_USAGE_F1 0x3a /* Keyboard F1 */ +#define HID_KBD_USAGE_F2 0x3b /* Keyboard F2 */ +#define HID_KBD_USAGE_F3 0x3c /* Keyboard F3 */ +#define HID_KBD_USAGE_F4 0x3d /* Keyboard F4 */ +#define HID_KBD_USAGE_F5 0x3e /* Keyboard F5 */ +#define HID_KBD_USAGE_F6 0x3f /* Keyboard F6 */ +#define HID_KBD_USAGE_F7 0x40 /* Keyboard F7 */ +#define HID_KBD_USAGE_F8 0x41 /* Keyboard F8 */ +#define HID_KBD_USAGE_F9 0x42 /* Keyboard F9 */ +#define HID_KBD_USAGE_F10 0x43 /* Keyboard F10 */ +#define HID_KBD_USAGE_F11 0x44 /* Keyboard F11 */ +#define HID_KBD_USAGE_F12 0x45 /* Keyboard F12 */ +#define HID_KBD_USAGE_PRINTSCN 0x46 /* Keyboard PrintScreen */ +#define HID_KBD_USAGE_SCROLLLOCK 0x47 /* Keyboard Scroll Lock */ +#define HID_KBD_USAGE_PAUSE 0x48 /* Keyboard Pause */ +#define HID_KBD_USAGE_INSERT 0x49 /* Keyboard Insert */ +#define HID_KBD_USAGE_HOME 0x4a /* Keyboard Home */ +#define HID_KBD_USAGE_PAGEUP 0x4b /* Keyboard PageUp */ +#define HID_KBD_USAGE_DELFWD 0x4c /* Keyboard Delete Forward */ +#define HID_KBD_USAGE_END 0x4d /* Keyboard End */ +#define HID_KBD_USAGE_PAGEDOWN 0x4e /* Keyboard PageDown */ +#define HID_KBD_USAGE_RIGHT 0x4f /* eyboard RightArrow */ +#define HID_KBD_USAGE_LEFT 0x50 /* Keyboard LeftArrow */ +#define HID_KBD_USAGE_DOWN 0x5a /* Keyboard DownArrow */ +#define HID_KBD_USAGE_UP 0x52 /* Keyboard UpArrow */ +#define HID_KBD_USAGE_KPDNUMLOCK 0x53 /* Keypad Num Lock and Clear */ +#define HID_KBD_USAGE_KPDNUMLOCKCLEAR 0x53 /* Keypad Num Lock and Clear */ +#define HID_KBD_USAGE_KPDDIV 0x54 /* Keypad / */ +#define HID_KBD_USAGE_KPDMUL 0x55 /* Keypad * */ +#define HID_KBD_USAGE_KPDHMINUS 0x56 /* Keypad - */ +#define HID_KBD_USAGE_KPDPLUS 0x57 /* Keypad + */ +#define HID_KBD_USAGE_KPDEMTER 0x58 /* Keypad ENTER */ +#define HID_KBD_USAGE_KPD1 0x59 /* Keypad 1 (2-9 follow) */ +#define HID_KBD_USAGE_KPDEND 0x59 /* Keypad 1 and End */ +#define HID_KBD_USAGE_KPDDOWN 0x5a /* Keypad 2 and Down Arrow */ +#define HID_KBD_USAGE_KPDPAGEDN 0x5b /* Keypad 3 and PageDn */ +#define HID_KBD_USAGE_KPDLEFT 0x5c /* Keypad 4 and Left Arrow */ +#define HID_KBD_USAGE_KPDRIGHT 0x5e /* Keypad 6 and Right Arrow */ +#define HID_KBD_USAGE_KPDHOME 0x5f /* Keypad 7 and Home */ +#define HID_KBD_USAGE_KPDUP 0x60 /* Keypad 8 and Up Arrow */ +#define HID_KBD_USAGE_KPDPAGEUP 0x61 /* Keypad 9 and PageUp */ +#define HID_KBD_USAGE_KPD0 0x62 /* Keypad 0 and Insert */ +#define HID_KBD_USAGE_KPDINSERT 0x62 /* Keypad 0 and Insert */ +#define HID_KBD_USAGE_KPDDECIMALPT 0x63 /* Keypad . and Delete */ +#define HID_KBD_USAGE_KPDDELETE 0x63 /* Keypad . and Delete */ +#define HID_KBD_USAGE_NONSLASH 0x64 /* Keyboard Non-US \ and | */ +#define HID_KBD_USAGE_NONUSVERT 0x64 /* Keyboard Non-US \ and | */ +#define HID_KBD_USAGE_APPLICATION 0x65 /* Keyboard Application */ +#define HID_KBD_USAGE_POWER 0x66 /* Keyboard Power */ +#define HID_KBD_USAGE_KPDEQUAL 0x67 /* Keypad = */ +#define HID_KBD_USAGE_F13 0x68 /* Keyboard F13 */ +#define HID_KBD_USAGE_F14 0x69 /* Keyboard F14 */ +#define HID_KBD_USAGE_F15 0x6a /* Keyboard F15 */ +#define HID_KBD_USAGE_F16 0x6b /* Keyboard F16 */ +#define HID_KBD_USAGE_F17 0x6c /* Keyboard F17 */ +#define HID_KBD_USAGE_F18 0x6d /* Keyboard F18 */ +#define HID_KBD_USAGE_F19 0x6e /* Keyboard F19 */ +#define HID_KBD_USAGE_F20 0x6f /* Keyboard F20 */ +#define HID_KBD_USAGE_F21 0x70 /* Keyboard F21 */ +#define HID_KBD_USAGE_F22 0x71 /* Keyboard F22 */ +#define HID_KBD_USAGE_F23 0x72 /* Keyboard F23 */ +#define HID_KBD_USAGE_F24 0x73 /* Keyboard F24 */ +#define HID_KBD_USAGE_EXECUTE 0x74 /* Keyboard Execute */ +#define HID_KBD_USAGE_HELP 0x75 /* Keyboard Help */ +#define HID_KBD_USAGE_MENU 0x76 /* Keyboard Menu */ +#define HID_KBD_USAGE_SELECT 0x77 /* Keyboard Select */ +#define HID_KBD_USAGE_STOP 0x78 /* Keyboard Stop */ +#define HID_KBD_USAGE_AGAIN 0x79 /* Keyboard Again */ +#define HID_KBD_USAGE_UNDO 0x7a /* Keyboard Undo */ +#define HID_KBD_USAGE_CUT 0x7b /* Keyboard Cut */ +#define HID_KBD_USAGE_COPY 0x7c /* Keyboard Copy */ +#define HID_KBD_USAGE_PASTE 0x7d /* Keyboard Paste */ +#define HID_KBD_USAGE_FIND 0x7e /* Keyboard Find */ +#define HID_KBD_USAGE_MUTE 0x7f /* Keyboard Mute */ +#define HID_KBD_USAGE_VOLUP 0x80 /* Keyboard Volume Up */ +#define HID_KBD_USAGE_VOLDOWN 0x81 /* Keyboard Volume Down */ +#define HID_KBD_USAGE_LCAPSLOCK 0x82 /* Keyboard Locking Caps Lock */ +#define HID_KBD_USAGE_LNUMLOCK 0x83 /* Keyboard Locking Num Lock */ +#define HID_KBD_USAGE_LSCROLLLOCK 0x84 /* Keyboard Locking Scroll Lock */ +#define HID_KBD_USAGE_KPDCOMMA 0x85 /* Keypad Comma */ +#define HID_KBD_USAGE_KPDEQUALSIGN 0x86 /* Keypad Equal Sign */ +#define HID_KBD_USAGE_INTERNATIONAL1 0x87 /* Keyboard International 1 */ +#define HID_KBD_USAGE_INTERNATIONAL2 0x88 /* Keyboard International 2 */ +#define HID_KBD_USAGE_INTERNATIONAL3 0x89 /* Keyboard International 3 */ +#define HID_KBD_USAGE_INTERNATIONAL4 0x8a /* Keyboard International 4 */ +#define HID_KBD_USAGE_INTERNATIONAL5 0x8b /* Keyboard International 5 */ +#define HID_KBD_USAGE_INTERNATIONAL6 0x8c /* Keyboard International 6 */ +#define HID_KBD_USAGE_INTERNATIONAL7 0x8d /* Keyboard International 7 */ +#define HID_KBD_USAGE_INTERNATIONAL8 0x8e /* Keyboard International 8 */ +#define HID_KBD_USAGE_INTERNATIONAL9 0x8f /* Keyboard International 9 */ +#define HID_KBD_USAGE_LANG1 0x90 /* Keyboard LANG1 */ +#define HID_KBD_USAGE_LANG2 0x91 /* Keyboard LANG2 */ +#define HID_KBD_USAGE_LANG3 0x92 /* Keyboard LANG3 */ +#define HID_KBD_USAGE_LANG4 0x93 /* Keyboard LANG4 */ +#define HID_KBD_USAGE_LANG5 0x94 /* Keyboard LANG5 */ +#define HID_KBD_USAGE_LANG6 0x95 /* Keyboard LANG6 */ +#define HID_KBD_USAGE_LANG7 0x96 /* Keyboard LANG7 */ +#define HID_KBD_USAGE_LANG8 0x97 /* Keyboard LANG8 */ +#define HID_KBD_USAGE_LANG9 0x98 /* Keyboard LANG9 */ +#define HID_KBD_USAGE_ALTERASE 0x99 /* Keyboard Alternate Erase */ +#define HID_KBD_USAGE_SYSREQ 0x9a /* Keyboard SysReq/Attention */ +#define HID_KBD_USAGE_CANCEL 0x9b /* Keyboard Cancel */ +#define HID_KBD_USAGE_CLEAR 0x9c /* Keyboard Clear */ +#define HID_KBD_USAGE_PRIOR 0x9d /* Keyboard Prior */ +#define HID_KBD_USAGE_RETURN 0x9e /* Keyboard Return */ +#define HID_KBD_USAGE_SEPARATOR 0x9f /* Keyboard Separator */ +#define HID_KBD_USAGE_OUT 0xa0 /* Keyboard Out */ +#define HID_KBD_USAGE_OPER 0xa1 /* Keyboard Oper */ +#define HID_KBD_USAGE_CLEARAGAIN 0xa2 /* Keyboard Clear/Again */ +#define HID_KBD_USAGE_CLRSEL 0xa3 /* Keyboard CrSel/Props */ +#define HID_KBD_USAGE_EXSEL 0xa4 /* Keyboard ExSel */ +#define HID_KBD_USAGE_KPD00 0xb0 /* Keypad 00 */ +#define HID_KBD_USAGE_KPD000 0xb1 /* Keypad 000 */ +#define HID_KBD_USAGE_THOUSEPARATOR 0xb2 /* Thousands Separator */ +#define HID_KBD_USAGE_DECSEPARATOR 0xb3 /* Decimal Separator */ +#define HID_KBD_USAGE_CURRUNIT 0xb4 /* Currency Unit */ +#define HID_KBD_USAGE_CURRSUBUNIT 0xb5 /* Currency Sub-unit */ +#define HID_KBD_USAGE_KPDLPAREN 0xb6 /* Keypad ( */ +#define HID_KBD_USAGE_KPDRPAREN 0xb7 /* Keypad ) */ +#define HID_KBD_USAGE_KPDLBRACE 0xb8 /* Keypad { */ +#define HID_KBD_USAGE_KPDRBRACE 0xb9 /* Keypad } */ +#define HID_KBD_USAGE_KPDTAB 0xba /* Keypad Tab */ +#define HID_KBD_USAGE_KPDBACKSPACE 0xbb /* Keypad Backspace */ +#define HID_KBD_USAGE_KPDA 0xbc /* Keypad A (B-F follow) */ +#define HID_KBD_USAGE_KPDXOR 0xc2 /* Keypad XOR */ +#define HID_KBD_USAGE_KPDEXP 0xc3 /* Keypad ^ */ +#define HID_KBD_USAGE_KPDPERCENT 0xc4 /* Keypad % */ +#define HID_KBD_USAGE_KPDLT 0xc5 /* Keypad < */ +#define HID_KBD_USAGE_KPDGT 0xc6 /* Keypad > */ +#define HID_KBD_USAGE_KPDAMPERSAND 0xc7 /* Keypad & */ +#define HID_KBD_USAGE_KPDAND 0xc8 /* Keypad && */ +#define HID_KBD_USAGE_KPDVERT 0xc9 /* Keypad | */ +#define HID_KBD_USAGE_KPDOR 0xca /* Keypad || */ +#define HID_KBD_USAGE_KPDCOLON 0xcb /* Keypad : */ +#define HID_KBD_USAGE_KPDPOUND 0xcc /* Keypad # */ +#define HID_KBD_USAGE_KPDSPACE 0xcd /* Keypad Space */ +#define HID_KBD_USAGE_KPDAT 0xce /* Keypad @ */ +#define HID_KBD_USAGE_KPDEXCLAM 0xcf /* Keypad ! */ +#define HID_KBD_USAGE_KPDMEMSTORE 0xd0 /* Keypad Memory Store */ +#define HID_KBD_USAGE_KPDMEMRECALL 0xd1 /* Keypad Memory Recall */ +#define HID_KBD_USAGE_KPDMEMCLEAR 0xd2 /* Keypad Memory Clear */ +#define HID_KBD_USAGE_KPDMEMADD 0xd3 /* Keypad Memory Add */ +#define HID_KBD_USAGE_KPDMEMSUB 0xd4 /* Keypad Memory Subtract */ +#define HID_KBD_USAGE_KPDMEMMULT 0xd5 /* Keypad Memory Multiply */ +#define HID_KBD_USAGE_KPDMEMDIV 0xd6 /* Keypad Memory Divide */ +#define HID_KBD_USAGE_KPDPLUSMINUS 0xd7 /* Keypad +/- */ +#define HID_KBD_USAGE_KPDCLEAR 0xd8 /* Keypad Clear */ +#define HID_KBD_USAGE_KPDCLEARENTRY 0xd9 /* Keypad Clear Entry */ +#define HID_KBD_USAGE_KPDBINARY 0xda /* Keypad Binary */ +#define HID_KBD_USAGE_KPDOCTAL 0xdb /* Keypad Octal */ +#define HID_KBD_USAGE_KPDDECIMAL 0xdc /* Keypad Decimal */ +#define HID_KBD_USAGE_KPDHEXADECIMAL 0xdd /* Keypad Hexadecimal */ +#define HID_KBD_USAGE_LCTRL 0xe0 /* Keyboard LeftControl */ +#define HID_KBD_USAGE_LSHIFT 0xe1 /* Keyboard LeftShift */ +#define HID_KBD_USAGE_LALT 0xe2 /* Keyboard LeftAlt */ +#define HID_KBD_USAGE_LGUI 0xe3 /* Keyboard Left GUI */ +#define HID_KBD_USAGE_RCTRL 0xe4 /* Keyboard RightControl */ +#define HID_KBD_USAGE_RSHIFT 0xe5 /* Keyboard RightShift */ +#define HID_KBD_USAGE_RALT 0xe6 /* Keyboard RightAlt */ +#define HID_KBD_USAGE_RGUI 0xe7 /* Keyboard Right GUI */ + +#define HID_KBD_USAGE_MAX 0xe7 + +/** + * @brief HID keyboard button codes. + */ +enum hid_kbd_code { + HID_KEY_A = 4, + HID_KEY_B = 5, + HID_KEY_C = 6, + HID_KEY_D = 7, + HID_KEY_E = 8, + HID_KEY_F = 9, + HID_KEY_G = 10, + HID_KEY_H = 11, + HID_KEY_I = 12, + HID_KEY_J = 13, + HID_KEY_K = 14, + HID_KEY_L = 15, + HID_KEY_M = 16, + HID_KEY_N = 17, + HID_KEY_O = 18, + HID_KEY_P = 19, + HID_KEY_Q = 20, + HID_KEY_R = 21, + HID_KEY_S = 22, + HID_KEY_T = 23, + HID_KEY_U = 24, + HID_KEY_V = 25, + HID_KEY_W = 26, + HID_KEY_X = 27, + HID_KEY_Y = 28, + HID_KEY_Z = 29, + HID_KEY_1 = 30, + HID_KEY_2 = 31, + HID_KEY_3 = 32, + HID_KEY_4 = 33, + HID_KEY_5 = 34, + HID_KEY_6 = 35, + HID_KEY_7 = 36, + HID_KEY_8 = 37, + HID_KEY_9 = 38, + HID_KEY_0 = 39, + HID_KEY_ENTER = 40, + HID_KEY_ESC = 41, + HID_KEY_BACKSPACE = 42, + HID_KEY_TAB = 43, + HID_KEY_SPACE = 44, + HID_KEY_MINUS = 45, + HID_KEY_EQUAL = 46, + HID_KEY_LEFTBRACE = 47, + HID_KEY_RIGHTBRACE = 48, + HID_KEY_BACKSLASH = 49, + HID_KEY_HASH = 50, /* Non-US # and ~ */ + HID_KEY_SEMICOLON = 51, + HID_KEY_APOSTROPHE = 52, + HID_KEY_GRAVE = 53, + HID_KEY_COMMA = 54, + HID_KEY_DOT = 55, + HID_KEY_SLASH = 56, + HID_KEY_CAPSLOCK = 57, + HID_KEY_F1 = 58, + HID_KEY_F2 = 59, + HID_KEY_F3 = 60, + HID_KEY_F4 = 61, + HID_KEY_F5 = 62, + HID_KEY_F6 = 63, + HID_KEY_F7 = 64, + HID_KEY_F8 = 65, + HID_KEY_F9 = 66, + HID_KEY_F10 = 67, + HID_KEY_F11 = 68, + HID_KEY_F12 = 69, + HID_KEY_SYSRQ = 70, /* PRINTSCREEN */ + HID_KEY_SCROLLLOCK = 71, + HID_KEY_PAUSE = 72, + HID_KEY_INSERT = 73, + HID_KEY_HOME = 74, + HID_KEY_PAGEUP = 75, + HID_KEY_DELETE = 76, + HID_KEY_END = 77, + HID_KEY_PAGEDOWN = 78, + HID_KEY_RIGHT = 79, + HID_KEY_LEFT = 80, + HID_KEY_DOWN = 81, + HID_KEY_UP = 82, + HID_KEY_NUMLOCK = 83, + HID_KEY_KPSLASH = 84, /* NUMPAD DIVIDE */ + HID_KEY_KPASTERISK = 85, /* NUMPAD MULTIPLY */ + HID_KEY_KPMINUS = 86, + HID_KEY_KPPLUS = 87, + HID_KEY_KPENTER = 88, + HID_KEY_KP_1 = 89, + HID_KEY_KP_2 = 90, + HID_KEY_KP_3 = 91, + HID_KEY_KP_4 = 92, + HID_KEY_KP_5 = 93, + HID_KEY_KP_6 = 94, + HID_KEY_KP_7 = 95, + HID_KEY_KP_8 = 96, + HID_KEY_KP_9 = 97, + HID_KEY_KP_0 = 98, +}; + +/** + * @brief HID keyboard modifiers. + */ +enum hid_kbd_modifier { + HID_KBD_MODIFIER_NONE = 0x00, + HID_KBD_MODIFIER_LEFT_CTRL = 0x01, + HID_KBD_MODIFIER_LEFT_SHIFT = 0x02, + HID_KBD_MODIFIER_LEFT_ALT = 0x04, + HID_KBD_MODIFIER_LEFT_UI = 0x08, + HID_KBD_MODIFIER_RIGHT_CTRL = 0x10, + HID_KBD_MODIFIER_RIGHT_SHIFT = 0x20, + HID_KBD_MODIFIER_RIGHT_ALT = 0x40, + HID_KBD_MODIFIER_RIGHT_UI = 0x80, +}; + +/** + * @brief HID keyboard LEDs. + */ +enum hid_kbd_led { + HID_KBD_LED_NUM_LOCK = 0x01, + HID_KBD_LED_CAPS_LOCK = 0x02, + HID_KBD_LED_SCROLL_LOCK = 0x04, + HID_KBD_LED_COMPOSE = 0x08, + HID_KBD_LED_KANA = 0x10, +}; + +/* HID Report Definitions */ +struct usb_hid_class_subdescriptor { + uint8_t bDescriptorType; /* Class descriptor type (See 7.1) */ + uint16_t wDescriptorLength; /* Size of the report descriptor */ +} __PACKED; + +struct usb_hid_descriptor { + uint8_t bLength; /* Size of the HID descriptor */ + uint8_t bDescriptorType; /* HID descriptor type */ + uint16_t bcdHID; /* HID class specification release */ + uint8_t bCountryCode; /* Country code */ + uint8_t bNumDescriptors; /* Number of descriptors (>=1) */ + + /* + * Specification says at least one Class Descriptor needs to + * be present (Report Descriptor). + */ + struct usb_hid_class_subdescriptor subdesc[1]; +} __PACKED; + +/** + * @brief Standard Report. + */ +/* Keyboard input report (8 bytes) (HID B.1) */ +struct usb_hid_kbd_report { + uint8_t modifier; /* Modifier keys. See USBHID_MODIFIER_* definitions */ + uint8_t reserved; + uint8_t key[6]; /* Keycode 1-6 */ +}; + +/* Keyboard output report (1 byte) (HID B.1), + * see USBHID_KBDOUT_* definitions + */ + +/* Mouse input report (HID B.2) */ +struct usb_hid_mouse_send_report +{ + uint8_t buttons; /* See USBHID_MOUSEIN_* definitions */ + uint8_t xdisp; /* X displacement */ + uint8_t ydisp; /* y displacement */ + + /* Device specific additional bytes may follow */ + #ifdef CONFIG_INPUT_MOUSE_WHEEL + uint8_t wdisp; /* Wheel displacement */ + #endif +}; + +/* Joystick input report (1 bytes) (HID D.1) */ +struct usb_hid_js_report +{ + uint8_t xpos; /* X position */ + uint8_t ypos; /* X position */ + uint8_t buttons; /* See USBHID_JSIN_* definitions */ + uint8_t throttle; /* Throttle */ +}; + +#endif // _USB_HID_H_ diff --git a/usb/class/hid/usbd_hid.c b/usb/class/hid/usbd_hid.c new file mode 100644 index 0000000..de05938 --- /dev/null +++ b/usb/class/hid/usbd_hid.c @@ -0,0 +1,212 @@ +/** + **************************************************************************************** + * + * @file usbd_hid.c + * + * @brief Function of USB Human Interface Device (HID) + * + **************************************************************************************** + */ + +#include "usbd.h" +#include "usbd_hid.h" +#include "drvs.h" + +/// HID global environment +static usbd_hid_t usbd_hids[HID_INST_CNT]; + +/// Interface number convert to hid instance +static usbd_hid_t *find_hid_by_intf(uint8_t intf_num) +{ + for (uint8_t i = 0; i < HID_INST_CNT; i++) { + if (usbd_hids[i].hid_intf && (usbd_hids[i].hid_intf->intf_num == intf_num)) { + return &usbd_hids[i]; + } + } + + return NULL; +} + +/// Endpoint address convert to hid instance +static usbd_hid_t *find_hid_by_ep(uint8_t ep_addr) +{ + for (uint8_t i = 0; i < HID_INST_CNT; i++) { + if (usbd_hids[i].hid_intf && (usbd_hids[i].hid_intf->ep_in == ep_addr)) { + return &usbd_hids[i]; + } + } + + return NULL; +} + +void usbd_hid_init(uint8_t idx, const hid_intf_t *intf) +{ + if (idx < HID_INST_CNT) { + usbd_hids[idx].hid_intf = intf; + //memset(&usbd_hids[idx].hid_state, 0, 4); + usbd_hids[idx].hid_info = 0; + } +} + +void usbd_hid_reset(void) +{ + for (uint8_t idx = 0; idx < HID_INST_CNT; idx++) { + //memset(&usbd_hids[idx].hid_state, 0, 4); + usbd_hids[idx].hid_info = 0; + //usbd_hids[idx].hid_state = HID_STATE_IDLE; + } +} + +__WEAK void usbd_hid_leds(uint8_t state) +{ + /*!< here you can write the LED processing from the host */ + if (state & HID_KBD_LED_NUM_LOCK) { + /*!< num lock */ + } else { + } + + if (state & HID_KBD_LED_CAPS_LOCK) { + /*!< caps lock */ + } else { + } + + if (state & HID_KBD_LED_SCROLL_LOCK) { + /*!< scroll lock */ + } else { + } +} + +uint8_t usbd_hid_send_report(uint8_t ep, uint8_t len, const uint8_t *data) +{ + uint8_t status = USBD_FAIL; + + if (usbd_is_configured()) { + usbd_hid_t *curr_hid = find_hid_by_ep(ep); + + if (curr_hid && (curr_hid->hid_state == HID_STATE_IDLE)) { + curr_hid->hid_state = HID_STATE_BUSY; // Update before isr occure + + status = usbd_ep_write(ep, len, data, NULL); + if (status != USBD_OK) { + curr_hid->hid_state = HID_STATE_IDLE; // fail to recover + } + } + } + + return status; +} + +void usbd_hid_ep_in_handler(uint8_t ep) +{ + usbd_hid_t *curr_hid = find_hid_by_ep(ep); + GPIO_DAT_SET(GPIO18); + if (curr_hid && (curr_hid->hid_state == HID_STATE_BUSY)) { + /*!< transfer successfully, update the state */ + curr_hid->hid_state = HID_STATE_IDLE; + } + GPIO_DAT_CLR(GPIO18); +} + +/** + * @brief Handler called for Class requests. + * + * @param setup Information about the request to execute. + * @param data Buffer containing the request result. + * @param len Size of the buffer. + * + * @return 0 on success, errno code on fail. + */ +uint8_t usbd_hid_class_handler(struct usb_setup_packet *setup, uint8_t **data, uint16_t *len) +{ + uint8_t intf_num; + usbd_hid_t *curr_hid; + + if ((setup->bmRequestType & USB_REQUEST_RECIP_MASK) != USB_REQUEST_RECIP_INTERFACE) { + return USBD_FAIL; + } + + intf_num = (uint8_t)setup->wIndex; + curr_hid = find_hid_by_intf(intf_num); + + if (!curr_hid) { + return USBD_FAIL; + } + + // Standard Request - Get Hid Report Descriptor + if ((setup->bmRequestType & USB_REQUEST_TYPE_MASK) == USB_REQUEST_STANDARD) { + if (setup->bRequest == USB_REQUEST_GET_DESCRIPTOR) { + uint8_t desc_typ = (uint8_t)(setup->wValue >> 8); + + USB_LOG_DBG("HID Get_Desc(type:%d,intf:%d)\r\n", desc_typ, intf_num); + if (desc_typ == HID_DESC_TYPE_HID_REPORT) { + if (curr_hid) { + *len = curr_hid->hid_intf->desc_size; + *data = (uint8_t *)curr_hid->hid_intf->report_desc; + } + return USBD_OK; + } + } + + return USBD_FAIL; + } + + // Class Request - HID Get/Set + switch (setup->bRequest) { + case HID_REQUEST_GET_REPORT: + { + USB_LOG_DBG("HID Get_Report(report_id:%d,report_type:%d)\r\n", LO_BYTE(setup->wValue), HI_BYTE(setup->wValue)); + + *data = (uint8_t *)&curr_hid->report; + *len = 1; + } break; + + case HID_REQUEST_GET_IDLE: + { + USB_LOG_DBG("HID Get_Idle(report_id:%d)\r\n", LO_BYTE(setup->wValue)); + + *data = (uint8_t *)&curr_hid->idle_state; + *len = 1; + } break; + + case HID_REQUEST_GET_PROTOCOL: + { + USB_LOG_DBG("HID Get_Protocol\r\n"); + + *data = (uint8_t *)&curr_hid->protocol; + *len = 1; + } break; + + case HID_REQUEST_SET_REPORT: + { + USB_LOG_DBG("HID Set_Report(report_id:%d,report_type:%d,report_len:%d,report_data:%02X)\r\n", + LO_BYTE(setup->wValue), HI_BYTE(setup->wValue), *len, (*data)[0]); + + if (*len == 1) { + curr_hid->report = (*data)[0]; + usbd_hid_leds((*data)[0]); + } + } break; + + case HID_REQUEST_SET_IDLE: + { + USB_LOG_DBG("HID Set_Idle(report_id:%d,duration:%d)\r\n", LO_BYTE(setup->wValue), HI_BYTE(setup->wIndex)); + + curr_hid->idle_state = HI_BYTE(setup->wIndex); + } break; + + case HID_REQUEST_SET_PROTOCOL: + { + USB_LOG_DBG("HID Set_Protocol(%d)\r\n", LO_BYTE(setup->wValue)); /*protocol*/ + + curr_hid->protocol = LO_BYTE(setup->wValue); + } break; + + default: + { + USB_LOG_WRN("Unhandled HID Class bRequest 0x%02x\r\n", setup->bRequest); + return USBD_FAIL; + } + } + + return USBD_OK; +} diff --git a/usb/class/hid/usbd_hid.h b/usb/class/hid/usbd_hid.h new file mode 100644 index 0000000..c312e22 --- /dev/null +++ b/usb/class/hid/usbd_hid.h @@ -0,0 +1,97 @@ +/** + **************************************************************************************** + * + * @file usbd_hid.h + * + * @brief Header file of USB HID function + * + **************************************************************************************** + */ + +#ifndef _USBD_HID_H_ +#define _USBD_HID_H_ + +#include +#include "usb_hid.h" + + +#if !defined(HID_INST_CNT) +// MAX Count of HID Instances +#define HID_INST_CNT (2) +#endif + +/* Macro for template descriptor */ +#define HID_INTERFACE_INIT(intf_num, ep_cnt, subclass, proto, str_idx, desc_size) \ + /* Descriptor of interface */ \ + 0x09, /* bLength: Interface Descriptor size */ \ + USB_DESC_TYPE_INTERFACE, /* bDescriptorType: Interface descriptor type */ \ + intf_num, /* bInterfaceNumber: Number of Interface */ \ + 0x00, /* bAlternateSetting: Alternate setting */ \ + ep_cnt, /* bNumEndpoints */ \ + 0x03, /* bInterfaceClass: HID */ \ + subclass, /* bInterfaceSubClass : 1=BOOT, 0=no boot */ \ + proto, /* nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse */ \ + str_idx, /* iInterface: Index of string descriptor */ \ + /* Descriptor of HID Report */ \ + 0x09, /* bLength: HID Descriptor size */ \ + HID_DESC_TYPE_HID, /* bDescriptorType: HID */ \ + 0x11, /* bcdHID: HID Class Spec release number */ \ + 0x01, \ + 0x00, /* bCountryCode: Hardware target country */ \ + 0x01, /* bNumDescriptors: Number of HID class descriptors */ \ + HID_DESC_TYPE_HID_REPORT, /* bDescriptorType */ \ + desc_size, /* wItemLength: Total length of Report descriptor */ \ + 0x00 \ + +#define HID_ENDPOINT_DESC(ep_addr, ep_mps, interval) \ + 0x07, /* bLength: Endpoint Descriptor size */ \ + USB_DESC_TYPE_ENDPOINT, /* bDescriptorType: */ \ + ep_addr, /* bEndpointAddress: Endpoint Address (IN) */ \ + 0x03, /* bmAttributes: Interrupt endpoint */ \ + ep_mps, /* wMaxPacketSize: 4 Byte max */ \ + 0x00, \ + interval /* bInterval: Polling Interval */ + + +enum hid_state_type { + HID_STATE_IDLE, + HID_STATE_BUSY, +}; + +typedef struct hid_intf_tag { + uint8_t intf_num; + uint8_t ep_in; + uint16_t desc_size; + const uint8_t *report_desc; +} hid_intf_t; + +#define HID_INTF_T(_intf_num, _ep_in, _desc) \ + { .intf_num=_intf_num, .ep_in=_ep_in, \ + .desc_size=sizeof(_desc), .report_desc=_desc } + +typedef struct usbd_hid_tag { + const hid_intf_t *hid_intf; + union { + struct { + uint8_t hid_state; + uint8_t report; + uint8_t idle_state; + uint8_t protocol; + }; + uint32_t hid_info; + }; +} usbd_hid_t; + +void usbd_hid_init(uint8_t idx, const hid_intf_t *intf); + +void usbd_hid_reset(void); + +void usbd_hid_leds(uint8_t state); + +uint8_t usbd_hid_send_report(uint8_t ep, uint8_t len, const uint8_t *data); + +void usbd_hid_ep_in_handler(uint8_t ep); + +uint8_t usbd_hid_class_handler(struct usb_setup_packet *setup, uint8_t **data, uint16_t *len); + +#endif // _USBD_HID_H_ diff --git a/usb/lib/usbd.lib b/usb/lib/usbd.lib new file mode 100644 index 0000000..67401e5 Binary files /dev/null and b/usb/lib/usbd.lib differ