OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 11391|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* }  g% G7 Y5 L: J! y  v
  1. [code]EDMA sample test application( M6 i2 ?5 ]/ [* U
  2. /*1 p5 S3 n) j9 M) m4 R# t+ C6 [
  3. * edma_test.c
    + D0 V7 B/ y/ w$ E
  4. *
      H: P; j5 S' J$ L8 P
  5. * brief  EDMA3 Test Application$ v8 v/ b9 N& w! f2 I6 S
  6. *$ J' a1 P4 |: o- P% n  w: j
  7. *   This file contains EDMA3 Test code.
    9 F% h1 J  G' x& u4 T0 b
  8. *
    1 P# d! _- R1 t+ x- e/ _' Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- H" V- c& y# ]6 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# \' h$ C( b* p0 `( T/ x) z
  11. *         TO CHANGE.
    5 p8 e7 o+ P+ X* d
  12. *) k4 f) _. e7 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. e8 g: P0 t- f: S: k' R7 m
  14. *
    4 g7 T8 i; a" u0 W
  15. * This program is free software; you can redistribute it and/or6 `1 r8 m5 |) a$ S; t9 ?1 e' I
  16. * modify it under the terms of the GNU General Public License as
    6 S+ M- y+ r4 O% g" U; ]9 I
  17. * published by the Free Software Foundation version 2.
    $ ?) k; g- @# s5 y
  18. *- F! N- O/ _: l- c1 _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) Y: P3 Q6 j% `& n8 c
  20. * kind, whether express or implied; without even the implied warranty3 Q- W! {( ]; a1 J# D: d$ {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 n- }& C% @$ t  O
  22. * GNU General Public License for more details.
    2 f7 D; e' i4 C+ j* h
  23. */6 `0 [) d3 K$ n% i. U' K

  24. : z; c3 _/ q" K0 n# C
  25. #include <linux/module.h>
    3 `' g0 L6 x: E
  26. #include <linux/init.h>! H. v6 h6 b2 C' i! |7 v
  27. #include <linux/errno.h>* ~  `- P3 l" ~2 D) o
  28. #include <linux/types.h>
    ; G. E5 q9 L. c$ o: m! C' _# a5 `  m
  29. #include <linux/interrupt.h>
    * {, T# l& v! ?1 b) ~9 L: ~) j+ Y
  30. #include <asm/io.h>. K; P4 [$ r9 ~; w) u( N+ W* N& S6 C
  31. #include <linux/moduleparam.h>
    ! c" V! U5 Q) E8 P: `3 m
  32. #include <linux/sysctl.h>5 ]4 t2 r1 V0 E1 e5 c5 U
  33. #include <linux/mm.h>
    . B6 Z/ ^* S' s; C
  34. #include <linux/dma-mapping.h>
    + m* ?% [! g+ L. f

  35. % V) V; ~  h/ J
  36. #include <mach/memory.h>
    " x7 W+ F  M% p$ r/ {
  37. #include <mach/hardware.h>
    ( h  U; l7 Y2 i# l' E; ^$ o5 S
  38. #include <mach/irqs.h>- U5 D1 m6 `$ W6 ^  W6 u
  39. #include <asm/hardware/edma.h>
    ! Q9 G- L+ T) \

  40. 8 ]2 c& k6 R" T
  41. #undef EDMA3_DEBUG. `( T8 b8 @* P8 j$ b/ X
  42. /*#define EDMA3_DEBUG*/8 g/ m; L+ _+ R' M
  43. ) W- {9 M/ K8 }7 J. d
  44. #ifdef EDMA3_DEBUG+ A2 [  E- ]- g" \  d9 x9 D. x$ c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! S0 T) _1 ~* h+ |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 e5 i/ O, Q: Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 O! i/ `$ p- m+ [
  48. #else
    0 W! ]4 H9 L* W( A" B3 D8 `
  49. #define DMA_PRINTK( x... )
      d2 {1 t& B( o! p$ e* Q+ ~, S6 I, t
  50. #define DMA_FN_IN
    1 B* q5 I. \/ f! f7 u& `0 E
  51. #define DMA_FN_OUT  D: X1 J  z; S; a( F! [( R9 o
  52. #endif
    1 r( W: T) ?* r9 S

  53. ) d2 d$ a+ j% {/ L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " K5 `& ~$ d) V* A
  55. #define STATIC_SHIFT                3
    # O7 g$ ?6 {. ?( D
  56. #define TCINTEN_SHIFT               20* |+ q( r6 f6 a: ^+ g  ?' r  Y
  57. #define ITCINTEN_SHIFT              21
    1 y$ N# Q5 b. H2 q; t! u  X: E
  58. #define TCCHEN_SHIFT                22
    $ ^$ W) T. H. a* Y
  59. #define ITCCHEN_SHIFT               238 E# U) t" F) E- P% o" T
  60. 4 w" n' Z( }3 ~
  61. static volatile int irqraised1 = 0;
    4 |7 B- u- W  X
  62. static volatile int irqraised2 = 0;
    ( L+ A8 _" D6 S

  63. ; T6 D! C: L2 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, l/ _/ ~/ K4 X- t4 J7 Q2 k. |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 c8 a& w. j8 K* \& }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 a. Q6 g. [8 R4 r7 |! \* K
  67. $ b3 e4 j2 _. g( o8 d
  68. dma_addr_t dmaphyssrc1 = 0;
    # w& u( Q1 `* \1 ~/ R. A
  69. dma_addr_t dmaphyssrc2 = 0;
    ! Z% J/ P, C3 d1 U5 D
  70. dma_addr_t dmaphysdest1 = 0;
    8 y7 I4 y  I5 C+ z8 O' d
  71. dma_addr_t dmaphysdest2 = 0;
    8 ?6 y( J; ?* i( ~% A
  72. 2 K- `  {% d/ F
  73. char *dmabufsrc1 = NULL;
    0 ]* K4 d% q" s# y( q
  74. char *dmabufsrc2 = NULL;, S0 m8 z0 L5 e* x" x
  75. char *dmabufdest1 = NULL;
    + I: Z8 ]7 V) k3 n& N& N7 B7 d
  76. char *dmabufdest2 = NULL;
    - z! x) V- @. d4 N4 ~  d
  77. . f4 j- U4 L7 d$ ^, }
  78. static int acnt = 512;
    $ I$ A2 \# T, d* a4 }  D) q% |2 T
  79. static int bcnt = 8;6 y: {% I  V/ {
  80. static int ccnt = 8;1 O6 u/ `8 X  S  Y' m4 _* G8 s
  81. * T: ?9 i, |; T1 y2 P
  82. module_param(acnt, int, S_IRUGO);# U: N$ z% L$ P( A
  83. module_param(bcnt, int, S_IRUGO);
    % ^0 ~" J9 @: M  S. v- m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 W+ h. k3 y5 X' P$ A( D) S2 T# b- s9 g: y' e, \: H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 a: ]7 Z0 E; o, ~
arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# C8 j& r. d. i0 K+ |3 y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 v- X0 j: S4 @, O+ h1 b% [
' F' L" ]4 C! U+ T. I* g: U3 g; L

0 C! s$ h2 ]9 L9 E* C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-2-14 01:29 , Processed in 0.042796 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表