Update repo
This commit is contained in:
1 parent
ef5f9a563e
commit
dfe8ec02bd
12 files changed
+690
-308
No files matched your search
Binary file not shown.
@@ -1,164 +0,0 @@
|
||||
|
||||
Texas Instruments Incorporated
|
||||
Software License Agreement
|
||||
|
||||
IMPORTANT – PLEASE CAREFULLY READ THIS AGREEMENT, WHICH IS DISPLAYED FOR YOU TO READ PRIOR TO USING THE LICENSED MATERIALS (DEFINED BELOW). YOU WILL BE ASKED WHETHER YOU ACCEPT AND AGREE TO ITS TERMS. BY CLICKING “I ACCEPT” OR “I AGREE,” OR BY USING THE LICENSED MATERIALS, YOU (1) REPRESENT THAT YOU HAVE THE LEGAL CAPACITY AND AUTHORITY TO BIND YOURSELF OR YOUR COMPANY, AS APPLICABLE, TO THE TERMS OF THIS AGREEMENT AND (2) AGREE ON BEHALF OF YOURSELF OR YOUR COMPANY, AS APPLICABLE, TO BE BOUND BY THE TERMS OF THIS AGREEMENT. IF YOU CHOOSE NOT TO ACCEPT OR AGREE WITH ANY OF THESE PROVISIONS, YOU HAVE NO RIGHT TO DOWNLOAD, INSTALL, OR USE THE LICENSED MATERIALS.
|
||||
|
||||
In certain instances, TI may deliver the Licensed Materials with Other Software not subject to the terms of this Agreement. Your use of Other Software is subject to the terms of the applicable software license(s) listed in the accompanying software manifest, header files, text files, or other location customarily used for licensing terms. You must agree to the terms of each applicable license, or You cannot use the Other Software. TI provides Other Software on an “as is” basis, without any representation, warranty, or liability to TI of any kind.
|
||||
|
||||
1. Definitions. As used in this Agreement, the following capitalized terms will have the meanings set forth below:
|
||||
|
||||
a. “Agreement” means this Software License Agreement.
|
||||
|
||||
b. “Company” means the entity on whose behalf You are acting, if applicable.
|
||||
|
||||
c. “Derived Patents” means any of Your patents issuing from a patent application that discloses and claims an invention conceived of by You after delivery of the Licensed Materials, and derived by You from Your access to the Licensed Materials.
|
||||
|
||||
d. “High-Risk Application” means any application where the failure of such application could lead to death, personal injury, or severe physical, property, or environmental damage, including, without limitation, any safety-critical application or Life-Critical-Medical Application.
|
||||
|
||||
e. “Licensed Materials” means each of the following (in whole or in part): (i) the software programs, configuration files, any real time operating system, and/or data files listed in the accompanying software manifest with a license type of “TI Commercial”, (ii) documentation related to these programs, (iii) any updates or upgrades to such software programs or documentation provided to You at TI’s sole discretion; (iv) Software Tools; and (v) any portions of the aforementioned software and documentation included in any Output, whether in original form or as transformed by compiling, linking, or other operation.
|
||||
|
||||
f. “Licensee Product” means Your product that incorporates (i) hardware components, including one or more TI Devices, and (ii) software components, including only binary or other executable versions of the Licensed Materials.
|
||||
|
||||
g. “Life-Critical-Medical Application” means any medical application where failure of such application would cause serious bodily injury or death (e.g., life support, pacemakers, defibrillators, heart pumps, neurostimulators, and implantables). Such applications include, without limitation, all medical devices identified by the U.S. Food and Drug Administration as Class III devices and equivalent classifications outside the U.S.
|
||||
|
||||
h. “Other Software” means any software components identified in the manifest with a license type other than “TI Commercial” including but not limited to open source software and certain third-party software.
|
||||
|
||||
i. “Output” means any binary, textual, or other output produced or generated by Software Tools.
|
||||
|
||||
j. “Production Licensed Materials” means Licensed Materials other than Software Tools or Output.
|
||||
|
||||
k. “Software Tools” means computer programs that may be used to develop, debug, maintain, or otherwise support other programs and applications .
|
||||
|
||||
l. “TI Devices” means semiconductor devices or evaluation kits (EVMs) manufactured by or for TI and sold or otherwise provided to You by TI or a TI-authorized distributor.
|
||||
|
||||
m. “You” means you personally if you will exercise the rights granted for your own benefit, but it means your Company, if you will exercise the rights granted herein for your Company’s benefit.
|
||||
|
||||
2. License Grant and Use Restrictions.
|
||||
|
||||
a. Production Licensed Materials. For Production Licensed Materials, the following license grants apply. Subject to the terms of this Agreement:
|
||||
|
||||
(i) Source Code Internal Use License. If any of the Production Licensed Materials are provided to You in source code form, TI grants to You a limited, non-transferable, non-exclusive, non-assignable, non-sublicensable, fully paid up, royalty free license to copy, prepare derivative works, and use internally such Production Licensed Materials, only to develop versions of such Production Licensed Materials that execute solely and exclusively on or in connection with TI Devices, for end use (in object and executable form only) in Licensee Products, and maintaining and supporting such Production Licensed Materials and Licensee Products.
|
||||
|
||||
(ii) Object Code Internal Use License. TI grants to You a limited, non-transferable, non-exclusive, non-assignable, non-sublicensable, fully paid-up, royalty-free license to copy and use internally the Production Licensed Materials in object code only for evaluating and testing the Production Licensed Materials and designing, developing, maintaining and supporting the Licensee Products.
|
||||
|
||||
(iii) Demonstration License. TI grants to You a limited, non-transferable, non-exclusive, non-assignable, non-sublicensable, fully paid-up, royalty-free license to demonstrate to third parties the Production Licensed Materials when used solely and exclusively on or in connection with TI Devices as they are used in TI evaluation kits and Licensee Products, provided that such Production Licensed Materials are demonstrated in binary or executable versions only.
|
||||
|
||||
(iv) Production and Distribution License. TI grants to You a limited, non-transferable, non-exclusive, non-assignable, fully paid-up, royalty-free license to make, use, import, export and distribute the Production Licensed Materials (a) as part of Licensee Products, provided that such Licensee Products include only embedded, executable copies of the Production Licensed Materials that execute solely and exclusively on or in connection with TI Devices and (b) separately from Licensee Products, but for use solely and exclusively on or in connection with a TI Device in Licensee Products, provided that You distribute such Production Licensed Materials in binary or executable form only directly to end users or indirectly via intermediaries as firmware updates under a written license with terms that are at least as restrictive and protective of the Production Licensed Materials and not inconsistent with the terms of this Agreement. Notwithstanding the forgoing, You may not allow further sublicensing or separate distribution of the Production Licensed Materials by its sublicensees.
|
||||
|
||||
|
||||
b. Software Tools. If any Software Tools are included in the Licensed Materials, the following license grants apply. Subject to the terms of this Agreement:
|
||||
|
||||
(i) Internal Use License. TI grants to You a limited, non-transferable, non-exclusive, non-assignable, non-sublicensable, fully paid-up, royalty-free license to copy and use internally the Software Tools solely and exclusively in connection with the design, development, production, sale, maintenance, and support of Licensee Products.
|
||||
|
||||
(ii) Output License Grant. To the extent necessary to enable distribution of the Output, TI grants to You a non-transferable, non-assignable, non-exclusive, fully paid-up, royalty-free license to use, copy, distribute, and sublicense (in binary or executable form) the portions of the Software Tool included in the Output (“Included Tool SW”), solely in conjunction with the design, development, production, sale, support, and use of Licensee Products, provided You distribute and sublicense the Included Tool SW under a written license with terms at least as restrictive and protective as, and not inconsistent with, the terms of this Agreement.
|
||||
|
||||
c. Contractors. The licenses granted to You in this Agreement include Your on-site and off-site contractors (either an individual or entity), while such contractors are performing work for or providing services to You, provided that such contractors have executed work-for-hire agreements with You containing applicable terms and conditions consistent with the terms and conditions set forth in this Agreement and provided further that You are liable to TI for any breach by Your contractors of the terms of this Agreement to the same extent as You would be if You had breached the terms of this Agreement Yourself.
|
||||
|
||||
d. No Other License. Nothing in this Agreement will be construed as a license to any intellectual property rights of TI other than those rights embodied in the Licensed Materials provided to You by TI. EXCEPT AS PROVIDED HEREIN, NO OTHER LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY TI INTELLECTUAL PROPERTY RIGHTS IS GRANTED HEREIN.
|
||||
|
||||
e. Indemnification. No unauthorized use or distribution of the Licensed Materials will impose any liability on TI, or any of its licensors, whether implied, by estoppel, through course of dealing, or otherwise. You agree to indemnify TI, its affiliates, and its licensors against any claims, losses, and damages based on Your unauthorized use or distribution of, or modifications to, the Licensed Materials.
|
||||
|
||||
f. Limited License to TI.
|
||||
|
||||
(i) You grant to TI, TI’s affiliates, and their respective licensees of the Licensed Materials, under all intellectual property rights that You own or control, a non-transferable, non-exclusive, non-assignable, worldwide, free license to make, use, sell, offer to sell, import, export, and distribute the Licensed Materials, the Output, or portions of either, including any of Your patents enforceable during the term of this Agreement to the extent such patents contain claims that read on the Licensed Materials or any portion thereof. The foregoing license will automatically terminate upon termination of this Agreement and Your compliance with Section 2.h below.
|
||||
|
||||
(ii) If the Licensed Materials include source code, You further grant to TI and its affiliates and licensees a license to Your Derived Patents. If You assign a Derived Patent, You will require as a condition of any such assignment that the assignee agree to be bound by the provisions in this Section 2.f with respect to such Derived Patent. Any attempted assignment or transfer in violation of this Section 2.f will be void.
|
||||
|
||||
g. Restrictions. Nothing in the licenses granted by this Agreement may be construed to allow You to, and You also agree that You will not encourage, allow, or facilitate any third party to:
|
||||
|
||||
(i) disclose source code versions of the Licensed Materials to any person other than Your employees and contractors (if permitted) whose job performance requires access;
|
||||
|
||||
(ii) use the Licensed Materials with a processing device other than a TI Device;
|
||||
|
||||
(iii) use Output other than in connection with the design, development, production, sale, and support of Licensee Products;
|
||||
|
||||
(iv) use the Licensed Materials to analyze or prove infringement of any of Your patents by either TI or TI’s customers;
|
||||
|
||||
(v) copy, publish, disclose, display, provide, transfer or make available the Licensed Materials to any third party, except as provided in this Agreement;
|
||||
|
||||
(vi) sublicense, transfer, or assign the Licensed Materials or Your rights under this Agreement to any third party, except as provided in this Agreement;
|
||||
|
||||
(vii) mortgage, pledge or encumber the Licensed Materials;
|
||||
|
||||
(viii) incorporate, combine or distribute the Licensed Materials in a manner that subjects the Licensed Materials to any license obligations or any other intellectual property related terms of any open source license; or
|
||||
|
||||
(ix) use the Licensed Materials in the development of a product or technology that competes with a TI product or technology.
|
||||
|
||||
Any additional third-party license restrictions in Exhibit A (which is attached and incorporated herein), will apply to Your use of the applicable Licensed Materials and You must comply with such restrictions. To the extent there is a conflict between this Agreement and Exhibit A, the terms of Exhibit A will prevail.
|
||||
|
||||
h. Termination. This Agreement is effective as of the date the Licensed Materials are delivered to You and will remain in full force and effect until terminated. You may terminate this Agreement by written notice to TI. Without prejudice to any other rights, TI may terminate Your right to use the Licensed Materials upon written notice to You if (i) You breach this Agreement, (ii) You are acquired or You transfer ownership of substantially all Your assets, or (iii) at any time after two (2) years following the date the Licensed Materials are delivered to You. Upon termination of this Agreement, You will promptly terminate all sub-licenses and destroy all copies of the Licensed Materials and any Output in Your possession, custody, or control, and upon TI’s request, provide to TI a written statement signed by Your authorized representative certifying such termination and destruction. Except for Sections 2.a and 2.b, and 2.f(i), all provisions of this Agreement will survive termination of this Agreement. Section 2.f(i) will survive termination, but only until compliance with this Section 2.h.
|
||||
|
||||
3. Licensed Materials Ownership. The Licensed Materials are licensed, not sold to You, and may only be used under the terms of this Agreement. Subject to the licenses granted to You under this Agreement, TI and TI’s licensors own and will continue to own all right, title, and interest in and to the Licensed Materials, including all copies thereof. You agree that all fixes, modifications, and improvements to the Licensed Materials that are conceived of or made by TI based, in whole or in part, on Your feedback, suggestions, or recommendations are the exclusive property of TI, and all right, title, and interest in and to such fixes, modifications, or improvements to the Licensed Materials will vest solely in TI. You acknowledge and agree that when Your independently developed software or hardware components are combined, in whole or in part, with the Licensed Materials, Your right to use the combined work that includes the Licensed Materials remains subject to the terms of this Agreement.
|
||||
|
||||
4. Intellectual Property Rights.
|
||||
|
||||
a. The Licensed Materials contain copyrighted material, trade secrets, and other proprietary information of TI and its licensors and are protected by copyright, trade secret, and other intellectual property laws and international treaties. To protect TI’s and its licensors’ rights in the Licensed Materials, You agree, except as specifically permitted by any statutory provision that cannot be contractually waived, not to unlock, decompile, reverse engineer, disassemble, or otherwise translate to a human-perceivable form any portions of the Licensed Materials provided to You in object code format only, nor encourage, allow, or facilitate any third party to do so. Unless a TI-authorized representative provides prior written consent, You will not remove, alter, cover, or obscure any confidentiality, trade secret, trade mark, patent, copyright, or other proprietary notice or other identifying marks or designs from any component of the Licensed Materials and You will reproduce and include in all copies of the Licensed Materials the copyright notice(s) and proprietary legend(s) of TI and its licensors as they appear in the Licensed Materials. TI reserves all rights not specifically granted under this Agreement.
|
||||
|
||||
b. You acknowledge and agree that, except as expressly stated, this Agreement conveys no license to any third party patents, copyrights, or other intellectual property rights and that You are solely responsible for any patent, copyright, or other intellectual property right claim that relates to Your use or distribution of the Licensed Materials or Your use or distribution of Your products that include or incorporate the Licensed Materials. You acknowledge that You are responsible for any fees or royalties that may be payable to any third party based on such third party’s interests in the Licensed Materials or any intellectual property rights that cover implementation of any industry recognized standard, any software program published by any industry recognized standards bodies, or any other proprietary technology.
|
||||
|
||||
5. Audit Right. At TI's request, and within thirty (30) calendar days after receiving written notice, You will permit an internal or independent auditor selected by TI to have access, no more than twice each calendar year (unless the immediately preceding audit revealed a discrepancy) and during Your regular business hours, to all of Your equipment, records, and documents as may contain information bearing upon the use of the Licensed Materials. You will keep full, complete, clear, and accurate records with respect to Your use and distribution of the Licensed Materials for a period beginning with the then-current calendar year and going back three (3) years.
|
||||
|
||||
6. Confidential Information. You acknowledge and agree that the Licensed Materials, including their structure and organization, contain trade secrets and other confidential information of TI and its licensors. You agree: (i) to use the Licensed Materials solely within the scope of the licenses set forth herein; (ii) to maintain the Licensed Materials in strict confidence; (iii) to use at least the same procedures and degree of care that You use to prevent disclosure of Your own confidential information of like importance but in no instance less than reasonable care; (iv) to maintain any source code versions of the Licensed Materials under password control protection; and (v) to prevent disclosure of the Licensed Materials to any third party, except as may be necessary and required in connection with Your rights and obligations hereunder; provided, however, that You may not provide the Licensed Materials to any business organization or group within Your Company or to customers or contractors (if permitted) that design or manufacture semiconductors or spatial light modulators unless TI gives written consent. You may use the Licensed Materials for benchmarking internally against competing products under normal conditions, but will not publish or disclose any benchmarking data to any person other than Your employees who have a need to know. You agree to obtain executed confidentiality agreements with Your employees and contractors (if permitted) having access to the Licensed Materials and to diligently enforce such agreements. You grant permission to TI to disclose Your contact information to TI’s licensors.
|
||||
|
||||
7. Disclaimer of Warranties and Limitations. THE LICENSED MATERIALS ARE PROVIDED “AS IS.” TI AND ITS LICENSORS MAKE NO REPRESENTATIONS, AND DISCLAIM ALL WARRANTIES EXPRESS, IMPLIED, AND STATUTORY, REGARDING THE LICENSED MATERIALS, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, SECURITY OR NON-INFRINGEMENT OF ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADE SECRETS OR OTHER INTELLECTUAL PROPERTY RIGHTS. NO ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY TI WILL CREATE ANY WARRANTY.
|
||||
|
||||
NOTHING CONTAINED IN THIS AGREEMENT WILL BE CONSTRUED AS A WARRANTY OR REPRESENTATION BY TI TO MAINTAIN PRODUCTION OF ANY TI DEVICE OR OTHER HARDWARE OR SOFTWARE WITH WHICH THE LICENSED MATERIALS MAY BE USED.
|
||||
|
||||
YOU ACKNOWLEDGE AND AGREE THAT THE LICENSED MATERIALS HAVE NOT BEEN TESTED OR CERTIFIED BY ANY GOVERNMENT AGENCY OR INDUSTRY REGULATORY ORGANIZATION OR ANY OTHER THIRD PARTY ORGANIZATION. YOU AGREE TO USE YOUR INDEPENDENT JUDGMENT IN DEVELOPING YOUR PRODUCTS. YOU AGREE THAT PRIOR TO USING OR INCORPORATING OR DISTRIBUTING THE LICENSED MATERIALS IN OR WITH ANY COMMERCIAL PRODUCT THAT YOU WILL THOROUGHLY TEST THE PRODUCT AND THE FUNCTIONALITY OF THE LICENSED MATERIALS IN OR WITH THAT PRODUCT AND BE SOLELY RESPONSIBLE FOR ANY PROBLEMS OR FAILURES.
|
||||
|
||||
CERTAIN LICENSED MATERIALS MAY BE PRE-RELEASE VERSIONS. PRE-RELEASE VERSIONS DO NOT REPRESENT A FINAL AND GENERALLY AVAILABLE VERSION OF THE LICENSED MATERIALS, AND MAY BE UNDERGOING TESTING AND FURTHER MODIFICATION BY TI. THE PRE-RELEASE VERSIONS ARE NOT AT THE LEVEL OF PERFORMANCE AND COMPATIBILITY OF A FINAL RELEASE VERSION. YOU ACKNOWLEDGE THAT SUCH PRE-RELEASE VERSIONS MAY CONTAIN IRREGULARITIES NOT FOUND IN A FINAL RELEASE VERSION, SUCH AS BUGS, ERRORS, INCONSISTENCIES AND OTHER PROBLEMS, AND THEREFORE ARE NOT INTENDED FOR USE IN PRODUCTION ACTIVITIES OR PRODUCTION PRODUCTS. YOU ARE ADVISED WHEN USING PRE-RELEASE VERSIONS TO SAFEGUARD YOUR COMPUTER SYSTEMS AND BACKUP IMPORTANT DATA, TO USE CAUTION, AND NOT TO RELY IN ANY WAY ON THE CORRECT FUNCTIONING OR PERFORMANCE OF THE PRE-RELEASE VERSIONS. FINAL RELEASE VERSIONS MAY BE DIFFERENT FROM THE PRE-RELEASE VERSIONS, INCLUDING BUT NOT LIMITED TO HAVING DIFFERENT OPERATION OR DIFFERENT FUNCTIONALITY. NOTHING CONTAINED IN THIS AGREEMENT WILL BE CONSTRUED AS A WARRANTY OR REPRESENTATION BY TI TO RELEASE A FINAL RELEASE VERSION OF A PRE-RELEASE VERSION IN THE FUTURE.
|
||||
|
||||
IN NO EVENT WILL TI OR TI’S LICENSORS BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL DAMAGES, HOWEVER CAUSED, ON ANY THEORY OF LIABILITY, IN CONNECTION WITH OR ARISING OUT OF THIS AGREEMENT OR THE USE OF THE LICENSED MATERIALS, REGARDLESS OF WHETHER TI HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. EXCLUDED DAMAGES INCLUDE, BUT ARE NOT LIMITED TO, COST OF REMOVAL OR REINSTALLATION, OUTSIDE COMPUTER TIME, LABOR COSTS, LOSS OF DATA, LOSS OF GOODWILL, LOSS OF PROFITS, LOSS OF SAVINGS, OR LOSS OF USE OR INTERRUPTION OF BUSINESS. IN NO EVENT WILL TI’S OR TI’S LICENSORS’ AGGREGATE LIABILITY UNDER THIS AGREEMENT OR ARISING OUT OF YOUR USE OF THE LICENSED MATERIALS EXCEED FIVE HUNDRED U.S. DOLLARS (US$500).
|
||||
|
||||
Because some jurisdictions do not allow the exclusion or limitation of incidental or consequential damages or limitation on how long an implied warranty lasts, the above limitations or exclusions may not apply to You.
|
||||
|
||||
8. Data Collection and Sharing. The Licensed Materials may monitor and collect technical data and other information related to Your use of the Licensed Materials, Your computer system or device, and related activity. You hereby agree and acknowledge that TI may freely use and share that information and data (including with or through its affiliates, partners, and service providers) to, among other things, support the Licensed Materials, use to make improvements or enhancements to the Licensed Materials, and develop, promote, support, and enhance TI products and offerings.
|
||||
|
||||
9. Security.
|
||||
|
||||
a. Security. Neither TI nor its licensors will be liable or responsible in any way if unauthorized persons gain access to, copy, change, delete, or damage data, information, applications, code, functions, features, or operation of the Licensee Products. You are responsible for properly configuring and using TI Devices or Licensed Materials and taking Your own independent steps to maintain appropriate security and protection of Your Licensee Products and any associated data from unauthorized access.
|
||||
|
||||
b. Security Keys. If the Licensed Materials are used to embed security keys in TI Devices via e-fusing, this provision applies. You may not use development keys in production. You are solely responsible for evaluating the adequacy of, selecting, obtaining, or generating any keys that may be used in Licensee Products, including obtaining all necessary rights, licenses, and authorizations in and to those keys. TI is not responsible for the integrity, operation, or security of Your keys in TI Devices or their use in Licensee Products, or for the consequences of third parties using, gaining access, overcoming or bypassing such keys. You accept that use of the Licensed Materials to e-fuse (or to attempt to e-fuse) security keys into the TI Devices permanently alters them and, consequently, TI will have no liability (warranty or otherwise) for any such altered TI Devices.
|
||||
|
||||
10. High-Risk Applications.
|
||||
|
||||
a. Safety-Critical Applications. Licensed Materials promoted for safety applications are designed and intended to assist You in Your efforts to develop and create applications that comply with the requirements of certain safety standards. However, Your use of the Licensed Materials does not ensure that Your application will meet the requirements of such safety standards or that it will qualify for certification to any particular safety standard. Furthermore, You remain responsible for using Your knowledge and independent judgment to determine the requirements for performance and testing of Your applications as may be (i) required to meet applicable state, national, international and regulatory safety standards, or (ii) required or recommended by functional safety standards. Licensed Materials that are not promoted for safety applications are not designed or intended for use in safety-critical applications and any such use is at Your own risk.
|
||||
|
||||
b. Life-Critical-Medical Applications. You may not use the Licensed Materials in or with Life-Critical-Medical Applications unless authorized officers of the parties have executed a special contract specifically governing such use.
|
||||
|
||||
c. Indemnification. If You use the Licensed Materials in a High-Risk Application, You will defend, indemnify, and hold TI harmless against any and all loss, liability, cost, or damage that TI incurs as a result of such use.
|
||||
|
||||
11. Indemnification Disclaimer. YOU ACKNOWLEDGE AND AGREE THAT TI AND TI’S LICENSORS WILL NOT BE LIABLE FOR AND WILL NOT DEFEND OR INDEMNIFY YOU AGAINST ANY THIRD-PARTY INFRINGEMENT CLAIM THAT RELATES TO OR IS BASED ON YOUR MANUFACTURE, USE, OR DISTRIBUTION OF THE LICENSED MATERIALS OR YOUR MANUFACTURE, USE, OFFER FOR SALE, SALE, IMPORTATION OR DISTRIBUTION OF YOUR PRODUCTS THAT INCLUDE OR INCORPORATE THE LICENSED MATERIALS.
|
||||
|
||||
12. No Technical Support Obligation. TI and TI’s licensors have no obligation to install, maintain or support the Licensed Materials.
|
||||
|
||||
13. Notices. All notices to TI will be delivered to Texas Instruments Incorporated, 13588 N. Central Expressway, Mail Station 3999, Dallas, Texas 75243, Attention: Contracts Administration, with a copy to TILegalNotices@list.TI.com. All notices will be deemed served when received by TI.
|
||||
|
||||
14. U.S. Government Contracts. If You intend to use the Licensed Materials in the performance of a U.S. Government contract or subcontract subject to Federal Acquisition Regulation (FAR), TI agrees to comply only with the commercial-item subcontractor flowdown provisions identified in FAR 52.244-6 (July 2021) to the extent such provisions apply to the types of Licensed Materials provided by TI to You. Unless otherwise agreed in writing by an authorized TI representative, no other FAR provisions, FAR supplement provisions, or other government procurement rules will apply to TI by virtue of any sale of provision of TI goods and services. Specifically, and without derogation to the foregoing limitation, TI will not provide, and no submission should be deemed as providing, certified cost or pricing data, and TI will not be subject to provisions governing cost allowability, cost accounting, and/or audit rights that may be found in Your U.S. Government contract or subcontract.
|
||||
|
||||
TI technical data and computer software are generally developed at TI’s private expense and not in performance of a U.S. Government contract. TI asserts and should be understood by You and the U.S. Government as retaining proprietary rights in all technical data and computer software provided to You under a U.S. Government contract. Unless separately and expressly agreed in writing by an authorized TI representative, neither the U.S. Government nor any higher-tier contractor under a U.S. Government contract will obtain any rights in TI technical data and computer software beyond the rights provided to TI’s commercial customers for such technical data and computer software.
|
||||
|
||||
15. Export Control.
|
||||
|
||||
a. Exports, re-exports, and transfers of Licensed Materials may be subject to U.S. export controls and sanctions. You acknowledge and agree that: i) You will comply with all applicable laws and regulations; ii) Licensed Materials may not be exported, re-exported, sold or transferred to U.S. embargoed, sanctioned, or restricted destinations, persons, or entities without first obtaining any necessary governmental authorization; and iii) You will provide notice of these compliance obligations to any party obtaining Licensed Materials from You.
|
||||
|
||||
b. Unless any necessary U.S. and other applicable government authorizations are obtained in advance, You may not export, re-export, transfer, purchase, or sell (including, without limitation, by permitting the Licensed Materials to be downloaded) any Licensed Materials: (i) for a military end use; (ii) to a military end user; or (iii) for the design, development, fabrication, or use of nuclear, chemical, or biological weapons or missile technology. For additional information, see Part 744 of the U.S. Export Administration Regulations.
|
||||
|
||||
c. Each party shall, at its own expense, secure export and import authorizations necessary to fulfill its obligations under this Section 15. You will indemnify and hold TI (including its agents and representatives) harmless against any damages, costs, losses, and/or liabilities arising out of any non-compliance by You with this section. If any required authorization cannot be obtained, or in the event You breach this Section 15, TI may terminate, cancel, or otherwise be excused from any obligations that it may have under this Agreement. Licensed Materials classifications are for TI convenience only and shall not be construed as a representation or warranty of any kind; You are responsible for your own compliance obligations. This section will survive any termination or expiration of this Agreement.
|
||||
|
||||
16. Governing Law; Remedies. This Agreement will be governed by and interpreted under the laws of the State of Texas, without reference to conflict of laws principles. This Agreement will not be governed by the United Nations Convention on Contracts for the International Sale of Goods, or by the Uniform Computer Information Transactions Act (UCITA). The parties agree that non-exclusive jurisdiction for any dispute arising out of or relating to this Agreement lies within the courts in the State of Texas. Notwithstanding the foregoing, any judgment may be enforced in any United States or foreign court, and either party may seek injunctive relief in any United States or foreign court. You agree that any breach of the Agreement or use of the Licensed Materials beyond the scope of the license granted hereunder would cause irreparable harm for which TI’s remedies at law would be inadequate. You agree that TI will be entitled, in addition to any other remedies available to it at law or in equity, to injunctive relief to prevent the breach or threatened breach of any of Your obligations under this Agreement, without the posting of any bond.
|
||||
|
||||
17. Severability; Waiver. If a court of competent jurisdiction finds any provision of the Agreement unenforceable, that provision will be enforced to the maximum extent possible to effectuate the intent of the parties, and the remainder of the Agreement will continue in full force and effect. Failure by TI to enforce any provision of this Agreement will not be deemed a waiver of future enforcement of that or any other provision in this Agreement or any other agreement that may be in place between the parties.
|
||||
|
||||
18. Contingencies. TI will not be in breach of this Agreement and will not be liable for any non-performance or delay in performance if such non-performance or delay is due to a force majeure event or other circumstances beyond TI’s reasonable control.
|
||||
|
||||
19. Entire Agreement. This is the entire agreement between You and TI, and this Agreement supersedes any prior agreement between the parties related to the subject matter of this Agreement. Notwithstanding the foregoing, any signed and effective software license agreement relating to the subject matter will take precedence over this Agreement if such agreement states it will control regardless of any prior or subsequent click-wrap, shrink-wrap, or web-wrap software license agreement. No amendment or modification of this Agreement will be effective unless in writing and signed by a duly authorized representative of TI. You warrant and represent that You have obtained all authorizations and other applicable consents required empowering You to enter into this Agreement.
|
||||
|
||||
|
||||
Exhibit A
|
||||
Additional Third-Party License Restrictions
|
||||
|
||||
|
||||
There are no additional third-party license restrictions applicable to the Licensed Materials.
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.ti.ccstudio.buildDefinitions.C2000_22.6.compilerID.INCLUDE_PATH.77573739" name="Add dir to #include search path (--include_path, -I)" superClass="com.ti.ccstudio.buildDefinitions.C2000_22.6.compilerID.INCLUDE_PATH" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value="${PROJECT_ROOT}"/>
|
||||
<listOptionValue builtIn="false" value="${PROJECT_ROOT}/device"/>
|
||||
<listOptionValue builtIn="false" value="${PROJECT_ROOT}/print_support"/>
|
||||
<listOptionValue builtIn="false" value="${PROJECT_ROOT}/include"/>
|
||||
<listOptionValue builtIn="false" value="${PROJECT_ROOT}/../C2000Ware/driverlib/f2837xs/driverlib"/>
|
||||
<listOptionValue builtIn="false" value="${PROJECT_ROOT}/FreeRTOS/Source/portable/CCS/C2000_C28x"/>
|
||||
<listOptionValue builtIn="false" value="${PROJECT_ROOT}/FreeRTOS/Source/include"/>
|
||||
|
||||
@@ -9,8 +9,8 @@ encoding//CPU1_FLASH/device/subdir_rules.mk=UTF-8
|
||||
encoding//CPU1_FLASH/device/subdir_vars.mk=UTF-8
|
||||
encoding//CPU1_FLASH/makefile=UTF-8
|
||||
encoding//CPU1_FLASH/objects.mk=UTF-8
|
||||
encoding//CPU1_FLASH/print_support/subdir_rules.mk=UTF-8
|
||||
encoding//CPU1_FLASH/print_support/subdir_vars.mk=UTF-8
|
||||
encoding//CPU1_FLASH/source/subdir_rules.mk=UTF-8
|
||||
encoding//CPU1_FLASH/source/subdir_vars.mk=UTF-8
|
||||
encoding//CPU1_FLASH/sources.mk=UTF-8
|
||||
encoding//CPU1_FLASH/subdir_rules.mk=UTF-8
|
||||
encoding//CPU1_FLASH/subdir_vars.mk=UTF-8
|
||||
@@ -105,35 +105,15 @@ SECTIONS
|
||||
.bss:cio : > RAMM0
|
||||
.data : > RAMGSx
|
||||
.sysmem : > RAMLSxDxGSx
|
||||
/* Initalized sections go in Flash */
|
||||
.const : > FLASH5, ALIGN(8)
|
||||
#else
|
||||
.pinit : > FLASH1, ALIGN(8)
|
||||
.ebss : > RAMGSx
|
||||
.esysmem : > RAMLSxDxGSx
|
||||
.cio : > RAMM0
|
||||
/* Initalized sections go in Flash */
|
||||
.econst : >> FLASH4 | FLASH5, ALIGN(8)
|
||||
#endif
|
||||
|
||||
/*
|
||||
ramgs0 : > RAMGS0, type=NOINIT
|
||||
ramgs1 : > RAMGS1, type=NOINIT
|
||||
*/
|
||||
ramm0 : > RAMM0, type=NOINIT
|
||||
ramm1 : > RAMM1, type=NOINIT
|
||||
|
||||
|
||||
/* The following section definitions are for SDFM examples */
|
||||
/*
|
||||
Filter_RegsFile : > RAMGS0
|
||||
Filter1_RegsFile : > RAMGS1, fill=0x1111
|
||||
Filter2_RegsFile : > RAMGS2, fill=0x2222
|
||||
Filter3_RegsFile : > RAMGS3, fill=0x3333
|
||||
Filter4_RegsFile : > RAMGS4, fill=0x4444
|
||||
Difference_RegsFile : >RAMGS5, fill=0x3333
|
||||
*/
|
||||
|
||||
#if defined(__TI_EABI__)
|
||||
.TI.ramfunc : {} LOAD = FLASH3,
|
||||
RUN = RAMGSx,
|
||||
|
||||
@@ -1,21 +1,6 @@
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// Application specific definitions.
|
||||
//
|
||||
// These definitions should be adjusted for your particular hardware and
|
||||
// application requirements.
|
||||
//
|
||||
// THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
// FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
//
|
||||
// See http://www.freertos.org/a00110.html.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
// Constants provided for debugging and optimization assistance
|
||||
//void vMainAssertCalled( const char *pcFileName, uint32_t ulLineNumber );
|
||||
//#define configASSERT( x ) if ((x) == 0) { vMainAssertCalled( __FILE__, __LINE__ ); }
|
||||
#define configASSERT( x ) if ((x) == 0) { taskDISABLE_INTERRUPTS(); for( ;; ); }
|
||||
|
||||
// Constants related to the behavior or the scheduler
|
||||
@@ -50,7 +35,7 @@ supported, or if both static and dynamic allocation are supported.
|
||||
the first block of RAM on the LPC device. See the initialization of the heap
|
||||
in main.c.
|
||||
*/
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 16 * 1024 ) )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 24 * 1024 ) )
|
||||
|
||||
|
||||
// Constants that build features in or out
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
#ifndef AT24CM02_H_
|
||||
#define AT24CM02_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define AT24CM02_CAPACITY_BYTES 262144UL
|
||||
#define AT24CM02_PAGE_SIZE_BYTES 256U
|
||||
#define AT24CM02_PAGE_COUNT 1024U
|
||||
#define AT24CM02_DEFAULT_ADDRESS 0x50U
|
||||
|
||||
typedef enum
|
||||
{
|
||||
EEPROM_STATUS_SUCCESS = 0,
|
||||
EEPROM_STATUS_NOT_INITIALIZED,
|
||||
EEPROM_STATUS_INVALID_ARGUMENT,
|
||||
EEPROM_STATUS_OUT_OF_RANGE,
|
||||
EEPROM_STATUS_NO_MEMORY,
|
||||
EEPROM_STATUS_MUTEX_TIMEOUT,
|
||||
EEPROM_STATUS_BUS_BUSY,
|
||||
EEPROM_STATUS_TIMEOUT,
|
||||
EEPROM_STATUS_NO_ACK,
|
||||
EEPROM_STATUS_ARBITRATION_LOST
|
||||
} EEPROM_Status;
|
||||
|
||||
// Configure GPIO91/GPIO92 and I2CA for 400-kHz operation. Call this once
|
||||
// after Device_init() and Device_initGPIO(), before starting the scheduler.
|
||||
EEPROM_Status EEPROM_init(void);
|
||||
|
||||
// Read or write an arbitrary byte range. A write that crosses a 256-byte page
|
||||
// boundary is automatically split into multiple page-write transactions.
|
||||
EEPROM_Status EEPROM_read(uint16_t *data, uint32_t address,
|
||||
uint16_t deviceAddress, uint32_t byteCount,
|
||||
TickType_t timeoutTicks);
|
||||
EEPROM_Status EEPROM_write(const uint16_t *data, uint32_t address,
|
||||
uint16_t deviceAddress, uint32_t byteCount,
|
||||
TickType_t timeoutTicks);
|
||||
|
||||
// Page numbers are one-based (1 through 1024), matching the original driver.
|
||||
EEPROM_Status EEPROM_pageNumberToAddress(uint16_t pageNumber,
|
||||
uint32_t *pageAddress);
|
||||
EEPROM_Status EEPROM_readPage(uint16_t *data, uint16_t deviceAddress,
|
||||
uint16_t pageNumber, uint16_t byteCount,
|
||||
TickType_t timeoutTicks);
|
||||
EEPROM_Status EEPROM_writePage(const uint16_t *data, uint16_t deviceAddress,
|
||||
uint16_t pageNumber, uint16_t byteCount,
|
||||
TickType_t timeoutTicks);
|
||||
|
||||
const char *EEPROM_statusString(EEPROM_Status status);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // AT24CM02_H_
|
||||
File renamed without changes.
+122
-105
@@ -8,6 +8,11 @@
|
||||
// Driverlib headers
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "sci.h"
|
||||
|
||||
// Customized headers
|
||||
#include "uart_drv.h"
|
||||
#include "at24cm02.h"
|
||||
|
||||
// FreeRTOS headers
|
||||
#include "FreeRTOS.h"
|
||||
@@ -16,33 +21,15 @@
|
||||
#include "queue.h"
|
||||
#include "timers.h"
|
||||
|
||||
// STDOUT redirection specific
|
||||
#include "uart_drv.h"
|
||||
#include "sci.h"
|
||||
|
||||
#define LED_R 41U // Red LED
|
||||
#define LED_B 58U // Blue LED
|
||||
|
||||
#define SCI_RXDA_PIN 85U
|
||||
#define SCI_TXDA_PIN 84U
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#if defined (__TI_EABI__)
|
||||
void *malloc(size_t xSize);
|
||||
#pragma WEAK (malloc)
|
||||
#endif
|
||||
|
||||
#if defined (__TI_EABI__)
|
||||
// malloc - Traps malloc calls
|
||||
void* malloc(size_t xSize) {
|
||||
(void) xSize;
|
||||
// There should not be a heap defined, trap any attempts to call malloc()
|
||||
taskDISABLE_INTERRUPTS();
|
||||
for (;;) {
|
||||
ESTOP0; // Optional: useful during CCS debug
|
||||
ESTOP0;
|
||||
}
|
||||
}
|
||||
#pragma WEAK (malloc)
|
||||
#endif
|
||||
|
||||
#if(configAPPLICATION_ALLOCATED_HEAP == 1)
|
||||
@@ -51,26 +38,36 @@ uint8_t ucHeap[configTOTAL_HEAP_SIZE];
|
||||
#pragma DATA_ALIGN(ucHeap, portBYTE_ALIGNMENT)
|
||||
#endif
|
||||
|
||||
// UART stdout redirection configuration related functions
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#define LED_R 41U // Red LED
|
||||
#define LED_B 58U // Blue LED
|
||||
|
||||
#define SCI_RXDA_PIN 85U
|
||||
#define SCI_TXDA_PIN 84U
|
||||
|
||||
// UART: SCIA
|
||||
void UartSetup(void);
|
||||
void UartPutChar(uint16_t charToWrite);
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
// Configuration of CPU timer 1
|
||||
// CPU Timer 1
|
||||
void configCPUTimer(uint32_t cpuTimer, uint32_t period_us);
|
||||
__interrupt void timer1_ISR(void);
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// EEPROM: AT24CM02 (2Mbit)
|
||||
static EEPROM_Status eepromInitStatus = EEPROM_STATUS_NOT_INITIALIZED;
|
||||
static uint16_t eepromReadData[AT24CM02_PAGE_SIZE_BYTES];
|
||||
static uint16_t eepromWriteData[AT24CM02_PAGE_SIZE_BYTES];
|
||||
|
||||
void LED_TaskRed(void * pvParameters);
|
||||
void LED_TaskBlue(void * pvParameters);
|
||||
// FreeRTOS tasks
|
||||
void RedLED_Task(void *pvParameters);
|
||||
void BlueLED_Task(void *pvParameters);
|
||||
void EEPROM_Task(void *pvParameters);
|
||||
static SemaphoreHandle_t xSemaphore = NULL;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
void main(void)
|
||||
{
|
||||
void main(void) {
|
||||
|
||||
// Initializes device clock and peripherals
|
||||
Device_init();
|
||||
|
||||
@@ -89,6 +86,9 @@ void main(void)
|
||||
GPIO_setDirectionMode(LED_B, GPIO_DIR_MODE_OUT);
|
||||
GPIO_writePin(LED_B, 0);
|
||||
|
||||
// GPIO91/GPIO92 and I2CA are configured by the EEPROM driver.
|
||||
eepromInitStatus = EEPROM_init();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// Clear all interrupts and initialize PIE vector table
|
||||
@@ -119,29 +119,17 @@ void main(void)
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// Enable global Interrupts and higher priority real-time debug events
|
||||
EINT; // Enable Global interrupt INTM
|
||||
ERTM; // Enable Global real-time interrupt DBGM
|
||||
EINT;
|
||||
// Enable Global interrupt INTM
|
||||
ERTM;
|
||||
// Enable Global real-time interrupt DBGM
|
||||
|
||||
// ------------------------ Redirect STDOUT to SCI ------------------------
|
||||
|
||||
//**************************************************************************
|
||||
// NOTE: SCI Configuration for this example is done in UartSetup()
|
||||
// As an alternative, the user can configure SCI here in the main, and then
|
||||
// provide an empty UartSetup() function. UartSetup() must be defined, even
|
||||
// if it is empty.
|
||||
//**************************************************************************
|
||||
|
||||
// Add the UART device. When fopen is called with a filename that
|
||||
// begins "uart:", the UART device will be used to handle the file
|
||||
add_device("uart",
|
||||
_SSA,
|
||||
UART_open,
|
||||
UART_close,
|
||||
UART_read,
|
||||
UART_write,
|
||||
UART_lseek,
|
||||
UART_unlink,
|
||||
UART_rename);
|
||||
add_device("uart", _SSA, UART_open, UART_close, UART_read, UART_write,
|
||||
UART_lseek, UART_unlink, UART_rename);
|
||||
|
||||
// Assign stdout to be a UART device
|
||||
assert(freopen("uart:", "w", stdout) != NULL);
|
||||
@@ -149,72 +137,114 @@ void main(void)
|
||||
// ------------------------------- FreeRTOS -------------------------------
|
||||
|
||||
xSemaphore = xSemaphoreCreateBinary();
|
||||
if(xSemaphore == NULL) {
|
||||
while(1);
|
||||
}
|
||||
|
||||
// Create tasks dynamically
|
||||
if(xTaskCreate(LED_TaskRed,
|
||||
(const char *) "Red LED Task",
|
||||
xTaskCreate(RedLED_Task,
|
||||
(const char*) "RedLED_Task",
|
||||
256,
|
||||
NULL,
|
||||
tskIDLE_PRIORITY + 2,
|
||||
NULL) != pdPASS) {
|
||||
ESTOP0;
|
||||
}
|
||||
1,
|
||||
NULL);
|
||||
|
||||
if(xTaskCreate(LED_TaskBlue,
|
||||
(const char *) "Blue LED Task",
|
||||
xTaskCreate(BlueLED_Task,
|
||||
(const char*) "BlueLED_Task",
|
||||
256,
|
||||
NULL,
|
||||
tskIDLE_PRIORITY + 1,
|
||||
NULL) != pdPASS) {
|
||||
ESTOP0;
|
||||
}
|
||||
1,
|
||||
NULL);
|
||||
|
||||
xTaskCreate(EEPROM_Task,
|
||||
(const char*) "EEPROM_Task",
|
||||
384,
|
||||
NULL,
|
||||
2,
|
||||
NULL);
|
||||
|
||||
// Start the scheduler. This should not return
|
||||
vTaskStartScheduler();
|
||||
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------
|
||||
|
||||
// This is an event-driven task. It sits in a blocked state waiting for
|
||||
// xSemaphore to be available by calling xSemaphoreTake() with a timeout
|
||||
// of portMAX_DELAY. Because Timer 1 releases this semaphore every 100 ms,
|
||||
// the Red LED task will unblock and toggle the LED exactly every 100 ms.
|
||||
// It is created with a higher priority of tskIDLE_PRIORITY + 2.
|
||||
void LED_TaskRed(void * pvParameters) {
|
||||
void RedLED_Task(void *pvParameters) {
|
||||
(void)pvParameters;
|
||||
int uart_count = 0;
|
||||
while (1) {
|
||||
if (xSemaphoreTake(xSemaphore, portMAX_DELAY) == pdTRUE) {
|
||||
// Toggle red LED
|
||||
GPIO_togglePin(LED_R);
|
||||
uart_count++;
|
||||
printf("Hello from FreeRTOS running on the F28377S Coreboard, %d!\r\n", uart_count);
|
||||
printf("Hello from FreeRTOS running on the F28377S Coreboard, %d!\r\n",
|
||||
uart_count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This is a time-driven task. It simply toggles the blue LED and then puts
|
||||
// itself to sleep using vTaskDelay(500 / portTICK_PERIOD_MS).
|
||||
// Based on the RTOS configuration, this creates a 500 ms delay cycle.
|
||||
// It runs at a lower priority of tskIDLE_PRIORITY + 1.
|
||||
void LED_TaskBlue(void * pvParameters) {
|
||||
void BlueLED_Task(void *pvParameters) {
|
||||
(void)pvParameters;
|
||||
while (1) {
|
||||
// Toggle blue LED
|
||||
GPIO_togglePin(LED_B);
|
||||
vTaskDelay(500);
|
||||
vTaskDelay(pdMS_TO_TICKS(500));
|
||||
}
|
||||
}
|
||||
|
||||
void EEPROM_Task(void *pvParameters) {
|
||||
uint16_t i;
|
||||
uint16_t mismatchCount = 0U;
|
||||
EEPROM_Status status = eepromInitStatus;
|
||||
const char *operation = "initialization";
|
||||
|
||||
(void)pvParameters;
|
||||
|
||||
// Allow the EEPROM supply and power-on reset to settle before the first
|
||||
// command. The datasheet requires at least 100 us after VCC is stable.
|
||||
vTaskDelay(pdMS_TO_TICKS(2U));
|
||||
|
||||
for (i = 0U; i < AT24CM02_PAGE_SIZE_BYTES; i++) {
|
||||
eepromWriteData[i] = i;
|
||||
eepromReadData[i] = 0U;
|
||||
}
|
||||
|
||||
if (status == EEPROM_STATUS_SUCCESS) {
|
||||
operation = "page write";
|
||||
status = EEPROM_writePage(eepromWriteData,
|
||||
AT24CM02_DEFAULT_ADDRESS,
|
||||
AT24CM02_PAGE_COUNT,
|
||||
AT24CM02_PAGE_SIZE_BYTES,
|
||||
pdMS_TO_TICKS(50U));
|
||||
}
|
||||
|
||||
if (status == EEPROM_STATUS_SUCCESS) {
|
||||
operation = "page read";
|
||||
status = EEPROM_readPage(eepromReadData,
|
||||
AT24CM02_DEFAULT_ADDRESS,
|
||||
AT24CM02_PAGE_COUNT,
|
||||
AT24CM02_PAGE_SIZE_BYTES,
|
||||
pdMS_TO_TICKS(50U));
|
||||
}
|
||||
|
||||
if (status == EEPROM_STATUS_SUCCESS) {
|
||||
for (i = 0U; i < AT24CM02_PAGE_SIZE_BYTES; i++) {
|
||||
if (eepromReadData[i] != eepromWriteData[i]) {
|
||||
mismatchCount++;
|
||||
}
|
||||
}
|
||||
printf("AT24CM02 page %u test: %s (%u mismatches)\r\n",
|
||||
AT24CM02_PAGE_COUNT,
|
||||
(mismatchCount == 0U) ? "PASS" : "FAIL",
|
||||
mismatchCount);
|
||||
} else {
|
||||
printf("AT24CM02 %s failed: %s\r\n",
|
||||
operation,
|
||||
EEPROM_statusString(status));
|
||||
}
|
||||
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------
|
||||
|
||||
// configCPUTimer - This function initializes the selected timer to the
|
||||
// period specified by the "freq" and "period" variables. The "freq" is
|
||||
// CPU frequency in Hz and the period in uSeconds. The timer is held in
|
||||
// the stopped state after configuration.
|
||||
// This function initializes the selected timer to the period specified
|
||||
// by the "freq" and "period" variables. The "freq" is CPU frequency
|
||||
// in Hz and the period in us.
|
||||
void configCPUTimer(uint32_t cpuTimer, uint32_t period_us) {
|
||||
|
||||
uint32_t periodCount, freq = DEVICE_SYSCLK_FREQ;
|
||||
@@ -226,26 +256,17 @@ void configCPUTimer(uint32_t cpuTimer, uint32_t period_us) {
|
||||
// Set pre-scale counter to divide by 1 (SYSCLKOUT)
|
||||
CPUTimer_setPreScaler(cpuTimer, 0);
|
||||
|
||||
// Initializes timer control register. The timer is stopped,
|
||||
// reloaded, free run disabled, and interrupt enabled.
|
||||
// Additionally, the free and soft bits are set
|
||||
// Initializes timer control register
|
||||
CPUTimer_stopTimer(cpuTimer);
|
||||
CPUTimer_reloadTimerCounter(cpuTimer);
|
||||
CPUTimer_setEmulationMode(
|
||||
cpuTimer,
|
||||
CPUTIMER_EMULATIONMODE_STOPAFTERNEXTDECREMENT
|
||||
);
|
||||
CPUTimer_setEmulationMode(cpuTimer,
|
||||
CPUTIMER_EMULATIONMODE_STOPAFTERNEXTDECREMENT);
|
||||
|
||||
CPUTimer_enableInterrupt(cpuTimer);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// When Timer 1 fires, the Interrupt Service Routine executes
|
||||
// xSemaphoreGiveFromISR(). This unlocks the semaphore so a waiting task
|
||||
// can proceed. portYIELD_FROM_ISR() is then called to force an immediate
|
||||
// FreeRTOS context switch if the newly unblocked task has a higher priority
|
||||
// than the interrupted task.
|
||||
// Timer 1 ISR function
|
||||
__interrupt void timer1_ISR(void) {
|
||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||
if (xSemaphore != NULL) {
|
||||
@@ -257,7 +278,7 @@ __interrupt void timer1_ISR(void) {
|
||||
|
||||
// -----------------------------------------------------------------------------------------
|
||||
|
||||
// UartSetup - Configures SCIA
|
||||
// Configures SCIA, baud rate is 115200
|
||||
void UartSetup(void) {
|
||||
|
||||
// SCIA RX: GPIO85
|
||||
@@ -281,8 +302,7 @@ void UartSetup(void) {
|
||||
DEVICE_LSPCLK_FREQ,
|
||||
115200U,
|
||||
SCI_CONFIG_WLEN_8 |
|
||||
SCI_CONFIG_STOP_ONE |
|
||||
SCI_CONFIG_PAR_NONE);
|
||||
SCI_CONFIG_STOP_ONE | SCI_CONFIG_PAR_NONE);
|
||||
|
||||
SCI_resetChannels(SCIA_BASE);
|
||||
SCI_resetRxFIFO(SCIA_BASE);
|
||||
@@ -296,10 +316,7 @@ void UartSetup(void) {
|
||||
SCI_performSoftwareReset(SCIA_BASE);
|
||||
}
|
||||
|
||||
// UartPutChar - Implements SCI based putchar()
|
||||
// Implements SCI based putchar()
|
||||
void UartPutChar(uint16_t charToWrite) {
|
||||
SCI_writeCharBlockingFIFO(SCIA_BASE, charToWrite);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,504 @@
|
||||
#include "at24cm02.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "semphr.h"
|
||||
#include "task.h"
|
||||
|
||||
#define EEPROM_I2C_BASE I2CA_BASE
|
||||
#define EEPROM_I2C_BIT_RATE 400000UL
|
||||
#define EEPROM_SDA_PIN 91U
|
||||
#define EEPROM_SCL_PIN 92U
|
||||
#define EEPROM_STATUS_ERROR_MASK (I2C_STS_NO_ACK | I2C_STS_ARB_LOST)
|
||||
#define EEPROM_CLEARABLE_STATUS_MASK (I2C_STS_NO_ACK | I2C_STS_ARB_LOST | \
|
||||
I2C_STS_REG_ACCESS_RDY | \
|
||||
I2C_STS_STOP_CONDITION)
|
||||
// The AT24CM02 tWR maximum is 10 ms. Use 11 RTOS ticks at a 1-kHz tick rate
|
||||
// so the actual delay cannot be shortened below 10 ms by tick quantization.
|
||||
#define EEPROM_WRITE_CYCLE_MS 11U
|
||||
|
||||
static SemaphoreHandle_t eepromMutex = NULL;
|
||||
static bool eepromInitialized = false;
|
||||
|
||||
static bool EEPROM_hasTimedOut(TickType_t start, TickType_t timeoutTicks)
|
||||
{
|
||||
if(timeoutTicks == portMAX_DELAY)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((TickType_t)(xTaskGetTickCount() - start) >= timeoutTicks);
|
||||
}
|
||||
|
||||
static void EEPROM_yield(void)
|
||||
{
|
||||
if(xTaskGetSchedulerState() == taskSCHEDULER_RUNNING)
|
||||
{
|
||||
taskYIELD();
|
||||
}
|
||||
}
|
||||
|
||||
static EEPROM_Status EEPROM_statusToError(uint16_t i2cStatus)
|
||||
{
|
||||
if((i2cStatus & I2C_STS_ARB_LOST) != 0U)
|
||||
{
|
||||
return EEPROM_STATUS_ARBITRATION_LOST;
|
||||
}
|
||||
|
||||
if((i2cStatus & I2C_STS_NO_ACK) != 0U)
|
||||
{
|
||||
return EEPROM_STATUS_NO_ACK;
|
||||
}
|
||||
|
||||
return EEPROM_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void EEPROM_abortTransaction(void)
|
||||
{
|
||||
I2C_sendStopCondition(EEPROM_I2C_BASE);
|
||||
I2C_clearStatus(EEPROM_I2C_BASE, EEPROM_CLEARABLE_STATUS_MASK);
|
||||
}
|
||||
|
||||
static EEPROM_Status EEPROM_waitForStatus(uint16_t requestedStatus,
|
||||
TickType_t start,
|
||||
TickType_t timeoutTicks)
|
||||
{
|
||||
uint16_t status;
|
||||
EEPROM_Status error;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
status = I2C_getStatus(EEPROM_I2C_BASE);
|
||||
error = EEPROM_statusToError(status);
|
||||
if(error != EEPROM_STATUS_SUCCESS)
|
||||
{
|
||||
return error;
|
||||
}
|
||||
|
||||
if((status & requestedStatus) != 0U)
|
||||
{
|
||||
return EEPROM_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if(EEPROM_hasTimedOut(start, timeoutTicks))
|
||||
{
|
||||
return EEPROM_STATUS_TIMEOUT;
|
||||
}
|
||||
|
||||
EEPROM_yield();
|
||||
}
|
||||
}
|
||||
|
||||
static EEPROM_Status EEPROM_waitForBusIdle(TickType_t start,
|
||||
TickType_t timeoutTicks)
|
||||
{
|
||||
while(I2C_getStopConditionStatus(EEPROM_I2C_BASE) ||
|
||||
I2C_isBusBusy(EEPROM_I2C_BASE))
|
||||
{
|
||||
if(EEPROM_hasTimedOut(start, timeoutTicks))
|
||||
{
|
||||
return EEPROM_STATUS_BUS_BUSY;
|
||||
}
|
||||
|
||||
EEPROM_yield();
|
||||
}
|
||||
|
||||
return EEPROM_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static uint16_t EEPROM_targetAddress(uint16_t deviceAddress,
|
||||
uint32_t memoryAddress)
|
||||
{
|
||||
return (uint16_t)(deviceAddress | ((memoryAddress >> 16U) & 0x3U));
|
||||
}
|
||||
|
||||
static bool EEPROM_deviceAddressIsValid(uint16_t deviceAddress)
|
||||
{
|
||||
// Bits A17:A16 are supplied by the memory address for this device.
|
||||
return ((deviceAddress <= 0x7CU) && ((deviceAddress & 0x3U) == 0U));
|
||||
}
|
||||
|
||||
static EEPROM_Status EEPROM_writeChunk(const uint16_t *data,
|
||||
uint32_t address,
|
||||
uint16_t deviceAddress,
|
||||
uint16_t byteCount,
|
||||
TickType_t timeoutTicks)
|
||||
{
|
||||
uint16_t i;
|
||||
TickType_t start = xTaskGetTickCount();
|
||||
EEPROM_Status status;
|
||||
|
||||
status = EEPROM_waitForBusIdle(start, timeoutTicks);
|
||||
if(status != EEPROM_STATUS_SUCCESS)
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
I2C_clearStatus(EEPROM_I2C_BASE, EEPROM_CLEARABLE_STATUS_MASK);
|
||||
I2C_setTargetAddress(EEPROM_I2C_BASE,
|
||||
EEPROM_targetAddress(deviceAddress, address));
|
||||
I2C_setDataCount(EEPROM_I2C_BASE, (uint16_t)(byteCount + 2U));
|
||||
I2C_setConfig(EEPROM_I2C_BASE, I2C_CONTROLLER_SEND_MODE);
|
||||
I2C_sendStartCondition(EEPROM_I2C_BASE);
|
||||
I2C_sendStopCondition(EEPROM_I2C_BASE);
|
||||
|
||||
status = EEPROM_waitForStatus(I2C_STS_TX_DATA_RDY, start, timeoutTicks);
|
||||
if(status == EEPROM_STATUS_SUCCESS)
|
||||
{
|
||||
I2C_putData(EEPROM_I2C_BASE, (uint16_t)((address >> 8U) & 0xFFU));
|
||||
}
|
||||
|
||||
if(status == EEPROM_STATUS_SUCCESS)
|
||||
{
|
||||
status = EEPROM_waitForStatus(I2C_STS_TX_DATA_RDY, start,
|
||||
timeoutTicks);
|
||||
}
|
||||
if(status == EEPROM_STATUS_SUCCESS)
|
||||
{
|
||||
I2C_putData(EEPROM_I2C_BASE, (uint16_t)(address & 0xFFU));
|
||||
}
|
||||
|
||||
for(i = 0U; (i < byteCount) && (status == EEPROM_STATUS_SUCCESS); i++)
|
||||
{
|
||||
status = EEPROM_waitForStatus(I2C_STS_TX_DATA_RDY, start,
|
||||
timeoutTicks);
|
||||
if(status == EEPROM_STATUS_SUCCESS)
|
||||
{
|
||||
I2C_putData(EEPROM_I2C_BASE, data[i] & 0xFFU);
|
||||
}
|
||||
}
|
||||
|
||||
if(status == EEPROM_STATUS_SUCCESS)
|
||||
{
|
||||
status = EEPROM_waitForStatus(I2C_STS_STOP_CONDITION, start,
|
||||
timeoutTicks);
|
||||
}
|
||||
|
||||
if(status != EEPROM_STATUS_SUCCESS)
|
||||
{
|
||||
EEPROM_abortTransaction();
|
||||
return status;
|
||||
}
|
||||
|
||||
I2C_clearStatus(EEPROM_I2C_BASE, I2C_STS_STOP_CONDITION);
|
||||
return EEPROM_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static EEPROM_Status EEPROM_readChunk(uint16_t *data, uint32_t address,
|
||||
uint16_t deviceAddress,
|
||||
uint16_t byteCount,
|
||||
TickType_t timeoutTicks)
|
||||
{
|
||||
uint16_t i;
|
||||
TickType_t start = xTaskGetTickCount();
|
||||
EEPROM_Status status;
|
||||
|
||||
status = EEPROM_waitForBusIdle(start, timeoutTicks);
|
||||
if(status != EEPROM_STATUS_SUCCESS)
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
I2C_clearStatus(EEPROM_I2C_BASE, EEPROM_CLEARABLE_STATUS_MASK);
|
||||
I2C_setTargetAddress(EEPROM_I2C_BASE,
|
||||
EEPROM_targetAddress(deviceAddress, address));
|
||||
I2C_setDataCount(EEPROM_I2C_BASE, 2U);
|
||||
I2C_setConfig(EEPROM_I2C_BASE, I2C_CONTROLLER_SEND_MODE);
|
||||
I2C_sendStartCondition(EEPROM_I2C_BASE);
|
||||
|
||||
status = EEPROM_waitForStatus(I2C_STS_TX_DATA_RDY, start, timeoutTicks);
|
||||
if(status == EEPROM_STATUS_SUCCESS)
|
||||
{
|
||||
I2C_putData(EEPROM_I2C_BASE, (uint16_t)((address >> 8U) & 0xFFU));
|
||||
}
|
||||
|
||||
if(status == EEPROM_STATUS_SUCCESS)
|
||||
{
|
||||
status = EEPROM_waitForStatus(I2C_STS_TX_DATA_RDY, start,
|
||||
timeoutTicks);
|
||||
}
|
||||
if(status == EEPROM_STATUS_SUCCESS)
|
||||
{
|
||||
I2C_putData(EEPROM_I2C_BASE, (uint16_t)(address & 0xFFU));
|
||||
}
|
||||
|
||||
if(status == EEPROM_STATUS_SUCCESS)
|
||||
{
|
||||
status = EEPROM_waitForStatus(I2C_STS_REG_ACCESS_RDY, start,
|
||||
timeoutTicks);
|
||||
}
|
||||
|
||||
if(status == EEPROM_STATUS_SUCCESS)
|
||||
{
|
||||
I2C_clearStatus(EEPROM_I2C_BASE, I2C_STS_REG_ACCESS_RDY);
|
||||
I2C_setDataCount(EEPROM_I2C_BASE, byteCount);
|
||||
I2C_setConfig(EEPROM_I2C_BASE, I2C_CONTROLLER_RECEIVE_MODE);
|
||||
I2C_sendStartCondition(EEPROM_I2C_BASE);
|
||||
I2C_sendStopCondition(EEPROM_I2C_BASE);
|
||||
}
|
||||
|
||||
for(i = 0U; (i < byteCount) && (status == EEPROM_STATUS_SUCCESS); i++)
|
||||
{
|
||||
status = EEPROM_waitForStatus(I2C_STS_RX_DATA_RDY, start,
|
||||
timeoutTicks);
|
||||
if(status == EEPROM_STATUS_SUCCESS)
|
||||
{
|
||||
data[i] = I2C_getData(EEPROM_I2C_BASE) & 0xFFU;
|
||||
}
|
||||
}
|
||||
|
||||
if(status == EEPROM_STATUS_SUCCESS)
|
||||
{
|
||||
status = EEPROM_waitForStatus(I2C_STS_STOP_CONDITION, start,
|
||||
timeoutTicks);
|
||||
}
|
||||
|
||||
if(status != EEPROM_STATUS_SUCCESS)
|
||||
{
|
||||
EEPROM_abortTransaction();
|
||||
return status;
|
||||
}
|
||||
|
||||
I2C_clearStatus(EEPROM_I2C_BASE, I2C_STS_STOP_CONDITION);
|
||||
return EEPROM_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
EEPROM_Status EEPROM_init(void)
|
||||
{
|
||||
if(eepromMutex == NULL)
|
||||
{
|
||||
eepromMutex = xSemaphoreCreateMutex();
|
||||
if(eepromMutex == NULL)
|
||||
{
|
||||
return EEPROM_STATUS_NO_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
GPIO_setMasterCore(EEPROM_SDA_PIN, GPIO_CORE_CPU1);
|
||||
GPIO_setPinConfig(GPIO_91_SDAA);
|
||||
GPIO_setDirectionMode(EEPROM_SDA_PIN, GPIO_DIR_MODE_IN);
|
||||
GPIO_setPadConfig(EEPROM_SDA_PIN, GPIO_PIN_TYPE_PULLUP);
|
||||
GPIO_setQualificationMode(EEPROM_SDA_PIN, GPIO_QUAL_ASYNC);
|
||||
|
||||
GPIO_setMasterCore(EEPROM_SCL_PIN, GPIO_CORE_CPU1);
|
||||
GPIO_setPinConfig(GPIO_92_SCLA);
|
||||
GPIO_setDirectionMode(EEPROM_SCL_PIN, GPIO_DIR_MODE_IN);
|
||||
GPIO_setPadConfig(EEPROM_SCL_PIN, GPIO_PIN_TYPE_PULLUP);
|
||||
GPIO_setQualificationMode(EEPROM_SCL_PIN, GPIO_QUAL_ASYNC);
|
||||
|
||||
I2C_disableModule(EEPROM_I2C_BASE);
|
||||
I2C_initController(EEPROM_I2C_BASE, DEVICE_SYSCLK_FREQ,
|
||||
EEPROM_I2C_BIT_RATE, I2C_DUTYCYCLE_33);
|
||||
I2C_setBitCount(EEPROM_I2C_BASE, I2C_BITCOUNT_8);
|
||||
I2C_setAddressMode(EEPROM_I2C_BASE, I2C_ADDR_MODE_7BITS);
|
||||
I2C_setEmulationMode(EEPROM_I2C_BASE, I2C_EMULATION_FREE_RUN);
|
||||
I2C_disableFIFO(EEPROM_I2C_BASE);
|
||||
I2C_disableInterrupt(EEPROM_I2C_BASE, I2C_INT_ARB_LOST |
|
||||
I2C_INT_NO_ACK | I2C_INT_REG_ACCESS_RDY |
|
||||
I2C_INT_RX_DATA_RDY | I2C_INT_TX_DATA_RDY |
|
||||
I2C_INT_STOP_CONDITION | I2C_INT_ADDR_TARGET |
|
||||
I2C_INT_RXFF | I2C_INT_TXFF);
|
||||
I2C_clearStatus(EEPROM_I2C_BASE, EEPROM_CLEARABLE_STATUS_MASK);
|
||||
I2C_enableModule(EEPROM_I2C_BASE);
|
||||
|
||||
eepromInitialized = true;
|
||||
return EEPROM_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
EEPROM_Status EEPROM_read(uint16_t *data, uint32_t address,
|
||||
uint16_t deviceAddress, uint32_t byteCount,
|
||||
TickType_t timeoutTicks)
|
||||
{
|
||||
EEPROM_Status status;
|
||||
uint32_t chunkSize;
|
||||
|
||||
if(!eepromInitialized)
|
||||
{
|
||||
return EEPROM_STATUS_NOT_INITIALIZED;
|
||||
}
|
||||
if((data == NULL) || (byteCount == 0UL) ||
|
||||
!EEPROM_deviceAddressIsValid(deviceAddress))
|
||||
{
|
||||
return EEPROM_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
if((address >= AT24CM02_CAPACITY_BYTES) ||
|
||||
(byteCount > (AT24CM02_CAPACITY_BYTES - address)))
|
||||
{
|
||||
return EEPROM_STATUS_OUT_OF_RANGE;
|
||||
}
|
||||
if(xSemaphoreTake(eepromMutex, timeoutTicks) != pdTRUE)
|
||||
{
|
||||
return EEPROM_STATUS_MUTEX_TIMEOUT;
|
||||
}
|
||||
|
||||
status = EEPROM_STATUS_SUCCESS;
|
||||
while((byteCount != 0UL) && (status == EEPROM_STATUS_SUCCESS))
|
||||
{
|
||||
// I2CCNT is 16-bit; keep chunks moderate and avoid a block-address
|
||||
// change in the middle of an I2C transaction.
|
||||
chunkSize = 0x10000UL - (address & 0xFFFFUL);
|
||||
if(chunkSize > byteCount)
|
||||
{
|
||||
chunkSize = byteCount;
|
||||
}
|
||||
if(chunkSize > 0xFFFFUL)
|
||||
{
|
||||
chunkSize = 0xFFFFUL;
|
||||
}
|
||||
|
||||
status = EEPROM_readChunk(data, address, deviceAddress,
|
||||
(uint16_t)chunkSize, timeoutTicks);
|
||||
address += chunkSize;
|
||||
data += chunkSize;
|
||||
byteCount -= chunkSize;
|
||||
}
|
||||
|
||||
xSemaphoreGive(eepromMutex);
|
||||
return status;
|
||||
}
|
||||
|
||||
EEPROM_Status EEPROM_write(const uint16_t *data, uint32_t address,
|
||||
uint16_t deviceAddress, uint32_t byteCount,
|
||||
TickType_t timeoutTicks)
|
||||
{
|
||||
EEPROM_Status status;
|
||||
uint32_t chunkSize;
|
||||
|
||||
if(!eepromInitialized)
|
||||
{
|
||||
return EEPROM_STATUS_NOT_INITIALIZED;
|
||||
}
|
||||
if((data == NULL) || (byteCount == 0UL) ||
|
||||
!EEPROM_deviceAddressIsValid(deviceAddress))
|
||||
{
|
||||
return EEPROM_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
if((address >= AT24CM02_CAPACITY_BYTES) ||
|
||||
(byteCount > (AT24CM02_CAPACITY_BYTES - address)))
|
||||
{
|
||||
return EEPROM_STATUS_OUT_OF_RANGE;
|
||||
}
|
||||
if(xSemaphoreTake(eepromMutex, timeoutTicks) != pdTRUE)
|
||||
{
|
||||
return EEPROM_STATUS_MUTEX_TIMEOUT;
|
||||
}
|
||||
|
||||
status = EEPROM_STATUS_SUCCESS;
|
||||
while((byteCount != 0UL) && (status == EEPROM_STATUS_SUCCESS))
|
||||
{
|
||||
chunkSize = AT24CM02_PAGE_SIZE_BYTES -
|
||||
(address & (AT24CM02_PAGE_SIZE_BYTES - 1U));
|
||||
if(chunkSize > byteCount)
|
||||
{
|
||||
chunkSize = byteCount;
|
||||
}
|
||||
|
||||
status = EEPROM_writeChunk(data, address, deviceAddress,
|
||||
(uint16_t)chunkSize, timeoutTicks);
|
||||
if(status == EEPROM_STATUS_SUCCESS)
|
||||
{
|
||||
if(xTaskGetSchedulerState() == taskSCHEDULER_RUNNING)
|
||||
{
|
||||
vTaskDelay(pdMS_TO_TICKS(EEPROM_WRITE_CYCLE_MS));
|
||||
}
|
||||
else
|
||||
{
|
||||
DEVICE_DELAY_US((uint32_t)EEPROM_WRITE_CYCLE_MS * 1000UL);
|
||||
}
|
||||
}
|
||||
|
||||
address += chunkSize;
|
||||
data += chunkSize;
|
||||
byteCount -= chunkSize;
|
||||
}
|
||||
|
||||
xSemaphoreGive(eepromMutex);
|
||||
return status;
|
||||
}
|
||||
|
||||
EEPROM_Status EEPROM_pageNumberToAddress(uint16_t pageNumber,
|
||||
uint32_t *pageAddress)
|
||||
{
|
||||
if(pageAddress == NULL)
|
||||
{
|
||||
return EEPROM_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
if((pageNumber == 0U) || (pageNumber > AT24CM02_PAGE_COUNT))
|
||||
{
|
||||
return EEPROM_STATUS_OUT_OF_RANGE;
|
||||
}
|
||||
|
||||
*pageAddress = ((uint32_t)pageNumber - 1UL) *
|
||||
AT24CM02_PAGE_SIZE_BYTES;
|
||||
return EEPROM_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
EEPROM_Status EEPROM_readPage(uint16_t *data, uint16_t deviceAddress,
|
||||
uint16_t pageNumber, uint16_t byteCount,
|
||||
TickType_t timeoutTicks)
|
||||
{
|
||||
uint32_t address;
|
||||
EEPROM_Status status;
|
||||
|
||||
if((byteCount == 0U) || (byteCount > AT24CM02_PAGE_SIZE_BYTES))
|
||||
{
|
||||
return EEPROM_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
status = EEPROM_pageNumberToAddress(pageNumber, &address);
|
||||
if(status != EEPROM_STATUS_SUCCESS)
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
return EEPROM_read(data, address, deviceAddress, byteCount, timeoutTicks);
|
||||
}
|
||||
|
||||
EEPROM_Status EEPROM_writePage(const uint16_t *data, uint16_t deviceAddress,
|
||||
uint16_t pageNumber, uint16_t byteCount,
|
||||
TickType_t timeoutTicks)
|
||||
{
|
||||
uint32_t address;
|
||||
EEPROM_Status status;
|
||||
|
||||
if((byteCount == 0U) || (byteCount > AT24CM02_PAGE_SIZE_BYTES))
|
||||
{
|
||||
return EEPROM_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
status = EEPROM_pageNumberToAddress(pageNumber, &address);
|
||||
if(status != EEPROM_STATUS_SUCCESS)
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
return EEPROM_write(data, address, deviceAddress, byteCount, timeoutTicks);
|
||||
}
|
||||
|
||||
const char *EEPROM_statusString(EEPROM_Status status)
|
||||
{
|
||||
static const char *const descriptions[] =
|
||||
{
|
||||
"success",
|
||||
"not initialized",
|
||||
"invalid argument",
|
||||
"address out of range",
|
||||
"FreeRTOS heap exhausted",
|
||||
"mutex timeout",
|
||||
"I2C bus busy",
|
||||
"I2C timeout",
|
||||
"I2C no acknowledgement",
|
||||
"I2C arbitration lost"
|
||||
};
|
||||
|
||||
if((uint16_t)status >=
|
||||
(uint16_t)(sizeof(descriptions) / sizeof(descriptions[0])))
|
||||
{
|
||||
return "unknown status";
|
||||
}
|
||||
|
||||
return descriptions[(uint16_t)status];
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user