OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' H" {3 n; l) s7 T3 H0 i- h( K
  1. [code]EDMA sample test application
    4 C7 s1 ?3 T; n( W
  2. /*
    9 k2 F) l0 X0 b
  3. * edma_test.c
    / Y& n6 X& G$ {
  4. *
    ; a9 m3 c$ \  e" S: q
  5. * brief  EDMA3 Test Application+ [9 B3 H2 X- t+ d- L/ c# q( J1 v2 t
  6. *
    " s) {9 `$ u" ~; }
  7. *   This file contains EDMA3 Test code.' q% Z8 L( ?' f( T! u
  8. *
      d+ _9 J: A$ v, @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 e9 i2 q  m) z" r+ i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 y# L& y( N3 j
  11. *         TO CHANGE.% f4 |$ ?! I% K, K) F' g8 x
  12. *! |9 ]0 x9 n/ L2 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 U1 A2 n. e- R
  14. *
    ) |9 x9 E- P) v5 V
  15. * This program is free software; you can redistribute it and/or# c8 H3 ^: R8 T5 ?, M
  16. * modify it under the terms of the GNU General Public License as
    ! [8 S: q7 X& i3 q6 R' n4 C
  17. * published by the Free Software Foundation version 2.
    2 w1 t& G8 \1 D" H0 L" i
  18. *# c! z) h" V- N/ e% H" ?0 R* y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! I% K( B! l! u
  20. * kind, whether express or implied; without even the implied warranty
    3 I  T) w/ O( K+ n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 g  T' w* Z4 J( g
  22. * GNU General Public License for more details.' @/ a; F1 Y, t% b
  23. */
    1 [$ [6 ?. ?; l: F. o4 K$ Z: \* }
  24. ) h& J% \, `. g; e8 {- }# ^6 A5 j
  25. #include <linux/module.h>! }/ d5 G  S# N6 X8 F9 _/ ^
  26. #include <linux/init.h>
    $ W/ P1 X8 @6 [( M& M' d. K8 G
  27. #include <linux/errno.h>
    8 n- i; P! N* N& k  Q0 X  x$ r- y8 e
  28. #include <linux/types.h>3 ^1 @9 B& [& p  r
  29. #include <linux/interrupt.h>8 X$ Y# z3 Y- j% i
  30. #include <asm/io.h>4 f1 v  J8 d6 t3 }  O
  31. #include <linux/moduleparam.h>' t$ H9 F& n8 N; I4 n+ U
  32. #include <linux/sysctl.h>" `& i8 A$ X' H  K( ?* w
  33. #include <linux/mm.h>" i$ l% J5 d8 y1 I. k0 m
  34. #include <linux/dma-mapping.h>8 `1 ~$ V) z0 ~1 R% a

  35. - M; T) X0 k2 @8 {
  36. #include <mach/memory.h>1 |, n, X" L, U+ x+ {6 l& E
  37. #include <mach/hardware.h>5 J7 Y) x+ Q4 J3 ?- T
  38. #include <mach/irqs.h>* }. x4 ^/ c7 ~1 E& `
  39. #include <asm/hardware/edma.h>
    # W& I  y: T& F2 A
  40. % |3 E$ z* \% i
  41. #undef EDMA3_DEBUG
      i  P- j8 ?3 g/ t$ M0 J
  42. /*#define EDMA3_DEBUG*/
    * L- k% ?" s+ M+ N7 S* n: U! N
  43. $ ]% F7 w- l6 q
  44. #ifdef EDMA3_DEBUG
    3 b2 P+ B3 @! I! N: o+ |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : ^7 R6 d6 G; ?% k6 s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( O" i' H$ K7 |1 U, R* A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 I/ _# L7 d5 {( R0 Q' x
  48. #else
    8 B6 X+ `/ W5 N" x* i# d! y4 B
  49. #define DMA_PRINTK( x... )
    + \( r' c2 O- y7 Z/ b% b1 ~
  50. #define DMA_FN_IN
    8 C- u  _0 Y+ m7 M' N
  51. #define DMA_FN_OUT
    ( r- |4 q( Z7 i9 n: J5 W1 w
  52. #endif# J$ B7 w( D8 B. H% J8 O+ \" U* h
  53. 2 u) ~! n$ U( `, T/ C: b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 f" A1 N# d3 L& O$ S
  55. #define STATIC_SHIFT                33 b1 y% s0 x1 R/ p+ S% }7 j
  56. #define TCINTEN_SHIFT               20% r1 T, }9 r" Y* ?5 w2 s
  57. #define ITCINTEN_SHIFT              21; S/ H( T6 }3 M
  58. #define TCCHEN_SHIFT                22
    * ~+ @6 g" ?4 S( u" V8 j! B
  59. #define ITCCHEN_SHIFT               23( u: L7 A4 E( {2 f+ Z6 P5 r
  60. 0 X3 A, G& D: \
  61. static volatile int irqraised1 = 0;- X! a% z; h8 Y% g6 B* \. S
  62. static volatile int irqraised2 = 0;4 Z% X& @0 o: O5 Q8 \# Z# @

  63. . l6 x) M1 y4 J% N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 E4 l2 {7 _: u( Z. ?$ g0 f% v$ T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 l7 ~. W6 N; f( K7 W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  o, A# a$ N. Q# J# A; ^& W. V
  67. # ?& @8 X/ N  N1 [
  68. dma_addr_t dmaphyssrc1 = 0;* g$ v4 _7 q% E# F
  69. dma_addr_t dmaphyssrc2 = 0;
    # L6 I; e+ U8 R' t1 w' J" T
  70. dma_addr_t dmaphysdest1 = 0;
    2 j7 S1 h/ k: x! ~) X1 f
  71. dma_addr_t dmaphysdest2 = 0;
    / H" K: Z. ]3 r) K9 q4 e
  72. ; ?& `; c" O2 d$ H, ~
  73. char *dmabufsrc1 = NULL;
    2 `* ~/ b& D4 @  Q1 _- l+ Z# q
  74. char *dmabufsrc2 = NULL;
    ! h! G. {+ i! D2 L
  75. char *dmabufdest1 = NULL;
    $ U, H- ?. A8 u% z* p
  76. char *dmabufdest2 = NULL;% m/ v# E% m0 P5 p
  77. 1 c5 r# }! p; v/ W
  78. static int acnt = 512;- m$ q, W7 t* y8 M2 r7 K5 e1 ~, t
  79. static int bcnt = 8;
    / w) `" R2 H( }  D% u: v1 t
  80. static int ccnt = 8;
      g# \$ v+ \* X, M9 E

  81. / o5 j1 a2 n" Z4 |
  82. module_param(acnt, int, S_IRUGO);
    / s  @9 D: c/ q" b, W
  83. module_param(bcnt, int, S_IRUGO);
    * M* j, ?" R  O5 K2 U6 V: W, y8 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 ^5 F6 @3 R: ^* M1 C& K

' V0 S( G  P7 V- u9 o$ g, U2 J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 u; d" {; e9 W" V4 |  d5 aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 V+ }  m/ M% `; }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 ^) c3 u  p% [9 l' ^( T* ]: i
1 k+ `5 ]: _, r  o
9 C2 W0 q' d  B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 12:46 , Processed in 0.038449 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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