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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) U" q) `7 n6 e4 L& p. P; H
  1. [code]EDMA sample test application
    & y8 e3 h  q" C' ^* u8 W) Z3 j
  2. /*6 w7 f- u: ?8 Q
  3. * edma_test.c
    / H7 r; {* R8 y- I
  4. *
    2 p7 T' ]. K$ _  Y. E) R! g
  5. * brief  EDMA3 Test Application
    ; x' y* Y8 R/ a, E% E8 h$ p1 T
  6. *
    % s1 m- V( }9 e+ e" {& n
  7. *   This file contains EDMA3 Test code.
    ; h+ i) A/ g0 B+ f  b
  8. *- K* \# ~$ A. ~) t3 |- \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 z$ o9 Z# g4 {7 w0 \8 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: l5 k6 S8 {" s
  11. *         TO CHANGE.  o0 O' Y8 Z( T
  12. *
    ) _0 i$ q9 i; |! F/ w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 P: R. f* i* S% {
  14. *
    / G, U  X8 ?/ v6 j* k
  15. * This program is free software; you can redistribute it and/or8 _( a  l8 y/ k1 @* ^" h; |/ }
  16. * modify it under the terms of the GNU General Public License as7 f- D& C4 }7 ^2 y
  17. * published by the Free Software Foundation version 2.
    ' f! d- _; i) o) s4 Q
  18. *( h1 C6 j2 H% h6 p! C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* P  s' |2 G9 F1 r9 w
  20. * kind, whether express or implied; without even the implied warranty. I* G" j0 J- T1 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- ]4 H9 h% H8 G4 ]9 `
  22. * GNU General Public License for more details.
    ! k0 x5 g2 f5 ~& W
  23. */
    0 S2 [+ v/ }, A

  24. / V6 q4 k& B" Y  g
  25. #include <linux/module.h>
    6 D/ O, h$ x, h( T( v" j  e
  26. #include <linux/init.h>% U" t0 ]- K, e9 m9 i) }
  27. #include <linux/errno.h>
    & l* s8 e6 p" s; Y/ ?# o
  28. #include <linux/types.h>
    2 y* e' }: R6 R8 N; D' Q7 P
  29. #include <linux/interrupt.h>! r0 x# B$ Y2 Y1 Q/ d% v; b& Y% f* P
  30. #include <asm/io.h>% x8 n- G# ?1 Q9 H5 p: U4 E
  31. #include <linux/moduleparam.h>
    5 B& T8 I- Y/ ~0 w( g! e# C& f
  32. #include <linux/sysctl.h>
    , S3 X6 I9 r, B9 I$ i3 H. l( j/ d& {
  33. #include <linux/mm.h>5 `. ?9 B, [: @. Q; w" Q/ V4 _5 l
  34. #include <linux/dma-mapping.h>
    ! Q% s& B/ m+ U; i: R) L

  35. 4 M8 D7 Q0 z* k- A! h3 I
  36. #include <mach/memory.h>* V$ m7 x7 g2 ]8 N
  37. #include <mach/hardware.h>+ H+ j# X% N- _' s+ g( q0 M$ M
  38. #include <mach/irqs.h>* Q8 {9 ?& N7 r: a  q- I
  39. #include <asm/hardware/edma.h>. }: A8 N: V+ P' m6 Q& B
  40. # |/ ?- T3 r2 B9 K* ~, E8 o
  41. #undef EDMA3_DEBUG
    " c9 o  N7 P; \" m  s) ~1 L
  42. /*#define EDMA3_DEBUG*/
    ! v( k2 ~+ `0 {+ P: f2 _4 M

  43. 5 A' q1 C! d+ t, f5 n1 q
  44. #ifdef EDMA3_DEBUG
    5 o, U. j- {* U' G9 k% v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / l2 Y( I& s1 F$ V5 f1 k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" t3 V. L2 k1 L4 s# b$ i) P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 x: C7 M7 O) }
  48. #else2 P& R$ w' f. t' i
  49. #define DMA_PRINTK( x... )
    # d' s' B/ O5 Z
  50. #define DMA_FN_IN
    % Y; C2 T( O7 z: L2 N
  51. #define DMA_FN_OUT8 C6 L2 ]: u8 \: s3 O, [) n6 i
  52. #endif6 [3 u" F5 Q' }6 W$ |7 f- F8 }
  53. ; r. |  v7 E" s0 s; Y6 L* Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - a  b# l/ f; |5 {4 F
  55. #define STATIC_SHIFT                32 J5 w: m3 a- x" f. I! I
  56. #define TCINTEN_SHIFT               20
    7 }# {% ?( s" Z& |4 _6 O) |$ A
  57. #define ITCINTEN_SHIFT              21! x# r3 E# P9 ?# u" z
  58. #define TCCHEN_SHIFT                22& q6 V8 |* A4 s* O' d. k
  59. #define ITCCHEN_SHIFT               23" V7 p+ ?$ s9 t0 S3 U0 n. V) v) S; e
  60. 1 v+ Y3 _) V# r" i+ g" A$ k1 }$ E
  61. static volatile int irqraised1 = 0;
    " O6 \% O, S, x) U6 J( o
  62. static volatile int irqraised2 = 0;
    8 F2 y% G1 W& `3 J8 }% m2 l* i

  63. . E# K) H5 m/ x' X% J  `" T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 {8 G+ h1 B& E) j  n% ?( B4 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 a3 J6 g+ _* ^* B% w$ b7 c* k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ~0 k& z& v. [* s5 _

  67. 3 t! V: F- K- [$ g/ ?  y  ]
  68. dma_addr_t dmaphyssrc1 = 0;  U1 H0 i3 g6 m
  69. dma_addr_t dmaphyssrc2 = 0;
    $ O. K# [5 X8 `. ~! ?" j
  70. dma_addr_t dmaphysdest1 = 0;4 Z, j7 W& \, Q' q* ], F$ \3 C$ i
  71. dma_addr_t dmaphysdest2 = 0;9 v" o- A( ?1 C- e
  72. ! }' |. X0 [6 F( p. C) c
  73. char *dmabufsrc1 = NULL;
    3 _, w( q+ j! w. x8 i: g' Z
  74. char *dmabufsrc2 = NULL;
    & n  g* e& ?6 m
  75. char *dmabufdest1 = NULL;: f) Z9 _7 g' b  S; e5 i% |
  76. char *dmabufdest2 = NULL;
    - P2 z; e. Q. b8 q. E) ~: t
  77. & R) }- z3 J& Z* T; K, m$ Q
  78. static int acnt = 512;
    - c6 h1 j$ a, s; Q
  79. static int bcnt = 8;
    9 ?& O' V- d: Z, O; l6 M0 n
  80. static int ccnt = 8;
    2 ]! n$ B0 D. i# u% D" U/ {
  81. ' m1 ]7 [* G) G9 q' }/ L
  82. module_param(acnt, int, S_IRUGO);# n6 o5 o% u; X% W! |
  83. module_param(bcnt, int, S_IRUGO);( u/ h1 `# ^9 w" a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 Z/ P3 p# c6 d" R; ]
; k% Y" v3 y! _: o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 @) n1 \* f+ d$ e6 C0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ e. f0 }* v( K3 P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 s1 r/ B+ W7 v2 A1 y( w4 n9 w

. e9 p4 D. @! Y1 j/ H6 J* K" P6 h3 F1 y8 j* [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 16:56 , Processed in 0.043072 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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