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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( t9 [0 r7 m# ?: v$ |; G: E7 C
  1. [code]EDMA sample test application
    1 R) E* I0 o5 m" m
  2. /*
    5 j6 w" c2 }8 m* _; o7 {
  3. * edma_test.c
    3 o) k) G( B* e( x6 \  D4 b
  4. *
    / @' C. |! K; R7 X7 C) P+ @, c7 A' H
  5. * brief  EDMA3 Test Application7 v  R* \0 g$ ^3 F1 u
  6. *
    $ [2 b( e+ k0 o( P% M
  7. *   This file contains EDMA3 Test code.
    3 Y# U! R! Z# W5 D; ?' I
  8. *0 ^- r6 t/ k2 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 _8 F; c  k& V- S. {5 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 v5 d! ?3 I- x6 t6 t& Z0 ~7 R2 ]
  11. *         TO CHANGE.
    4 a: O3 S* O' e9 q9 ^( h, s1 X
  12. *8 S: Y9 V% g; E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% e. T' O5 A. a3 N
  14. *
    / O. {: E) A# D$ x8 {
  15. * This program is free software; you can redistribute it and/or' M7 R$ R4 x; G" ?$ Z2 U: \
  16. * modify it under the terms of the GNU General Public License as
    # V: H" m( O1 c& a1 E5 n7 O% l
  17. * published by the Free Software Foundation version 2.
    3 O: R# Q% ~* V0 Z; }
  18. *- W# ^! m$ v7 ^) g  H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' h/ g9 F. l. Y6 J; t+ H( F3 r2 e# L
  20. * kind, whether express or implied; without even the implied warranty
    1 q3 D' B. S7 q' S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 j* r9 O+ ]+ s# T& l& S+ J5 C, S0 R
  22. * GNU General Public License for more details.
    3 E8 T. j  K$ [& o+ ^# Z
  23. */
    # h& \, s. V! C. i: a, n  C

  24. 3 g' l2 Y. @9 n; M
  25. #include <linux/module.h>
    7 M3 b, q7 D& }
  26. #include <linux/init.h>6 i9 O2 G7 r. {
  27. #include <linux/errno.h>
    2 P. {+ t2 H! {$ a$ T; a
  28. #include <linux/types.h>: P8 m! Y, ?1 c. n
  29. #include <linux/interrupt.h>
    . X2 A' X* t' e  i
  30. #include <asm/io.h>
    , u6 |' k1 n  L" V
  31. #include <linux/moduleparam.h>& Q3 T( W3 a: G1 k" f$ y9 V
  32. #include <linux/sysctl.h>
    ( b" g* i5 t9 X: a7 n! K% E( t
  33. #include <linux/mm.h>
      a5 {+ p0 ]- S7 o% R& K/ B
  34. #include <linux/dma-mapping.h>, O7 `0 k' u) \) l% T( k" X5 A
  35.   ]: ]" \" F8 G0 s! R% q
  36. #include <mach/memory.h>
    . @6 e% `/ c! \' c* \9 H
  37. #include <mach/hardware.h>
    6 m( n0 c& {4 K1 }
  38. #include <mach/irqs.h>
    # C  w& x' h( k- {
  39. #include <asm/hardware/edma.h>
    8 ?' H2 M4 Y* K( d3 g: D$ D& l+ {' Q& i

  40.   ^0 F4 k, P: L, g3 c
  41. #undef EDMA3_DEBUG0 z8 n5 p) q- ?, w: v/ D
  42. /*#define EDMA3_DEBUG*/
    ; c) t: E' i0 `% ]4 m1 e
  43. 5 s0 E) f$ }( ^, ?0 p
  44. #ifdef EDMA3_DEBUG6 ~2 x/ y! G) L" v* p7 {5 U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' y  S0 `5 W, U+ x$ G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) v& J  H1 t: K1 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- m5 j1 e' o& _: N" H
  48. #else
    & u# ^% u3 H6 X! M1 D* k
  49. #define DMA_PRINTK( x... )% t6 }; @! U! T
  50. #define DMA_FN_IN
    7 R1 q/ Y; F. j$ {! _+ V' k
  51. #define DMA_FN_OUT
    - F0 b: A8 N$ h% b$ }3 M4 [
  52. #endif
    8 @3 B. U6 c7 P- W/ Y7 R
  53. ' q4 a& D, K8 o7 u8 w( r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 W+ g8 a% E3 }3 G
  55. #define STATIC_SHIFT                3, J( Z- J. k& a* C' k& Z
  56. #define TCINTEN_SHIFT               20
    1 E) ^) G( T1 i5 Y
  57. #define ITCINTEN_SHIFT              216 E- e$ ?- l* `& C8 z
  58. #define TCCHEN_SHIFT                22
      Z' ?& P; G" U% K& O. T
  59. #define ITCCHEN_SHIFT               23
    : i: J  ?2 ?- ~- Z5 j
  60. 5 v. N* |  c$ Z# m0 `5 i$ E, r
  61. static volatile int irqraised1 = 0;" J* u7 o7 N( O6 }* A  `
  62. static volatile int irqraised2 = 0;& T; V3 s3 @6 N4 M+ n
  63. ' F, [) E9 |- [/ a. c6 s- n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 y% M% I3 ~: F" Y8 G/ E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 b: v1 I4 |' k& H& m- Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + f2 ]/ y" `: r8 |( n
  67. ! A; n" j: U% s$ C
  68. dma_addr_t dmaphyssrc1 = 0;* B2 B0 Z( n& w5 }. o7 y) {4 @
  69. dma_addr_t dmaphyssrc2 = 0;
    0 h- {/ A7 G9 j2 N" g  a' y
  70. dma_addr_t dmaphysdest1 = 0;' v3 D+ B/ }. D
  71. dma_addr_t dmaphysdest2 = 0;% W! X2 z: f; h+ t
  72. - @3 [5 w: C$ h9 a, o
  73. char *dmabufsrc1 = NULL;
    ) F6 \/ [1 B; H& f
  74. char *dmabufsrc2 = NULL;
    5 B1 i# B$ z, K* H
  75. char *dmabufdest1 = NULL;1 d% ~1 C2 C) R' ^9 N' o
  76. char *dmabufdest2 = NULL;. `; H# e) `6 ^/ r; l, g
  77. ; C* M# R2 D9 c* a- C0 z
  78. static int acnt = 512;
    ' T& Q2 _1 y0 q. G% a
  79. static int bcnt = 8;
    6 d7 @+ j3 ?) q: r6 i" _- n
  80. static int ccnt = 8;
    9 x- N- k4 k8 |8 k; _' x& y$ m8 y3 @
  81. - m+ ]0 g4 ?8 c7 W- U6 s: y' j3 i/ F
  82. module_param(acnt, int, S_IRUGO);
    6 l% y- F# ]3 Y( ^$ M. {' ~
  83. module_param(bcnt, int, S_IRUGO);
    " G! i4 o5 ^  U. q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; B4 i  j  x- H) I2 E2 Z9 `

: X4 y, b+ Q7 m, f; w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  G9 ?; }9 q% a. i, y' k- z: r2 _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- j- Q' a; I( a1 I+ i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" }9 w3 n3 f1 H- Q2 L% O) r% \/ ?5 P3 l4 i$ K
5 {# s; C5 e) A, p6 t+ o# U8 x) r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 08:00 , Processed in 0.058225 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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