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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 u$ p. w: k0 O) E; i- @
  1. [code]EDMA sample test application- ^1 A! D/ [* I  y: m* j7 T7 V
  2. /** M  b& ~( {' R) D  m4 h  P4 D& x; }
  3. * edma_test.c+ |% \8 X$ S6 B$ Q$ \3 H
  4. *5 q; T$ K# e) U" Z) Y3 U
  5. * brief  EDMA3 Test Application$ e- U6 O: [3 Q- \" j) g8 B! m
  6. *
    * X7 D" U2 {1 m
  7. *   This file contains EDMA3 Test code.3 M2 c, f7 s& i
  8. *
    + x; o! O8 [' G: `! o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 A! M/ J7 v6 Q; m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 j4 ^' S& q: t) d$ j1 ?% k- F
  11. *         TO CHANGE.6 r: X+ m: a4 |- r7 S9 G
  12. *. N& }% {9 {' j* g: W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ @4 r' z0 r6 P6 e  H2 f$ h; X
  14. *! N% h2 \9 o, A0 w# q
  15. * This program is free software; you can redistribute it and/or1 \, d; z$ s+ R. e; u" d
  16. * modify it under the terms of the GNU General Public License as/ t, |4 L" J. V: ^* R6 x" z
  17. * published by the Free Software Foundation version 2.: b/ s, c' V2 Z) `/ S/ v) `& j
  18. *! N- n8 x1 _! k7 J# e$ A& c+ Q! t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) x6 U+ D" {1 F0 r, |
  20. * kind, whether express or implied; without even the implied warranty% f- m$ o1 c! ?4 ~; p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / n  x- v$ d* f& J( Z
  22. * GNU General Public License for more details.; [# n. _" k- k, B0 V: i9 B3 }
  23. */
    + y6 y+ \* ~5 @' p; d

  24. 2 k/ ?2 l5 G# ^9 q5 }/ t0 Y
  25. #include <linux/module.h>
    ; v/ C' u9 i! p8 f; e
  26. #include <linux/init.h>
    - r+ N" F  h  O( R2 j! b' @
  27. #include <linux/errno.h>% }0 ]. q3 I! J' I7 j
  28. #include <linux/types.h>
    & C  j: l9 |) i
  29. #include <linux/interrupt.h>! G2 u5 R6 I" ^% f) }4 T# V$ g
  30. #include <asm/io.h>
    * ^- y) q! H3 {
  31. #include <linux/moduleparam.h>
    + t* Z& a* ~9 g0 v8 R
  32. #include <linux/sysctl.h>
    / ^! C6 r' H, @$ U; P/ i
  33. #include <linux/mm.h>3 w) B4 C5 A' N8 H5 P
  34. #include <linux/dma-mapping.h>/ R& I( D1 o; q! R
  35. ' b+ `& Z: ?) J, A
  36. #include <mach/memory.h>
    ' ]# [3 M5 O/ p2 B; m
  37. #include <mach/hardware.h>% n) {: v2 P! e
  38. #include <mach/irqs.h>3 R: t: J9 S4 b* _, N6 P" O
  39. #include <asm/hardware/edma.h>% R. L/ t. j, K% l- q+ J) A

  40. . o0 n8 r6 G4 P3 {' L( ^
  41. #undef EDMA3_DEBUG
    $ N) Q* I: ^& D- {8 \: l
  42. /*#define EDMA3_DEBUG*/
    / l, K+ q# G# J: K$ O' A) L  b
  43. + J2 M' t1 n) @, }  ?% Q
  44. #ifdef EDMA3_DEBUG5 E# m. n1 o- P6 g! @6 q9 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , z4 ]" V) T1 E5 d4 a$ V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ l( P3 [4 B; e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + _5 q$ ]! X: f8 F+ g6 g
  48. #else
    : s% r- B* |; @
  49. #define DMA_PRINTK( x... )
    2 a% l/ c6 x, p$ K. X% \1 w) j" x
  50. #define DMA_FN_IN; F$ t% R- x) I. U+ `' G
  51. #define DMA_FN_OUT
    ; j- Q, d7 u% k1 _5 V& ?
  52. #endif0 l7 y$ ?# m3 s9 V1 L% [

  53. 5 u4 x6 X' G0 M/ `- m1 x0 W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 Y" h3 r% {2 P3 `
  55. #define STATIC_SHIFT                3
    2 F0 [; b4 B1 Z# J" I! f
  56. #define TCINTEN_SHIFT               20
    * Q; |8 w; |( S" ~7 Z( ]+ |
  57. #define ITCINTEN_SHIFT              21: O* C/ k. s# i- P4 `
  58. #define TCCHEN_SHIFT                22
    1 j7 W- a: `6 R1 E3 [1 E
  59. #define ITCCHEN_SHIFT               23
    ) H: o6 @7 D2 `4 T. t! W6 y

  60. ) k3 ~6 m. k, e: W
  61. static volatile int irqraised1 = 0;
    # @* [5 y& \$ d8 F5 a: C' c
  62. static volatile int irqraised2 = 0;* L2 P, W* A. a: K5 J! U
  63. 0 p) z9 P3 ^8 B6 A2 [0 Q5 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! }2 e1 b' K6 L5 U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " s2 p' P, C$ m5 i! M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! s/ w4 q/ n- ^5 f

  67. - w9 z: N: k: u- U8 Z
  68. dma_addr_t dmaphyssrc1 = 0;
    9 e  J) K( ?# G$ l0 f# Z
  69. dma_addr_t dmaphyssrc2 = 0;4 w( M9 z- n2 H+ b& p% d
  70. dma_addr_t dmaphysdest1 = 0;4 Y8 ]5 `( C2 O/ r* a8 ]
  71. dma_addr_t dmaphysdest2 = 0;0 A" w+ m- l6 w9 L& V$ Q+ N* ^0 S
  72. 3 f" _1 e  ]* k
  73. char *dmabufsrc1 = NULL;5 X- |# Z6 G7 K2 r: [" f' Q
  74. char *dmabufsrc2 = NULL;/ `8 `. h- y( N  b* C2 d* ?. ]
  75. char *dmabufdest1 = NULL;
    9 b% A$ a) R1 L* U$ u3 T8 @: E
  76. char *dmabufdest2 = NULL;
    # g! j- \$ w+ g0 s$ y8 J4 a( ?
  77. ! ]1 H$ _/ h; X0 \$ K0 d' u% n
  78. static int acnt = 512;/ d0 }9 [+ q  C/ ~# P4 ~
  79. static int bcnt = 8;
    $ G! i* r5 P; D1 n: l3 E
  80. static int ccnt = 8;
    + E, I9 i- L. o. Z$ S
  81. 9 p6 y8 L$ Y0 H
  82. module_param(acnt, int, S_IRUGO);
    / T5 F. A* a4 }! G9 @9 L8 }. B
  83. module_param(bcnt, int, S_IRUGO);
    7 t0 J1 y$ V$ C/ W( E0 G) e0 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' x" z9 V: g8 H9 F2 q) b1 c
. e( @* G) P. Y7 K2 S, ?8 t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 D6 y0 V% C0 j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* |+ S: ?3 I8 J/ i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# E+ o9 N0 S  v( w1 }; J9 x. l( h: T  D, }0 s9 \. V% [

! x2 r* a+ \# S8 k$ b; U8 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 01:43 , Processed in 0.037184 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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