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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   R: L  h/ A# k1 t/ K$ a, g
  1. [code]EDMA sample test application
    : o6 @. O1 d7 H+ p% n0 c9 y
  2. /*/ z% b. W* s* Y# X$ m) Q, I
  3. * edma_test.c3 N7 m1 D! g1 A# y5 i
  4. *
    # I8 @9 l0 C5 h
  5. * brief  EDMA3 Test Application' e" x! w" J- Q. x) f
  6. *! p) Z9 _2 y" W
  7. *   This file contains EDMA3 Test code.
    ) B) @, b3 n- T) O! k
  8. *
    " H" s2 K; d9 Z  x- g+ Q, O0 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 |# S' l) w- S: s/ d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 Q% B8 ^/ w: Z" `9 H9 A- V0 M
  11. *         TO CHANGE.
    * M0 c' |$ o; c6 v6 A
  12. *
    % G& T' z: x4 \* B) _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + ~7 j7 y7 `" n9 }% e
  14. *
      J0 Q2 @" C( r6 \, ^) ^! E! W2 }- |/ K
  15. * This program is free software; you can redistribute it and/or
    4 ?) j. J2 s3 y. E
  16. * modify it under the terms of the GNU General Public License as7 i- @- W. Q! \/ q
  17. * published by the Free Software Foundation version 2./ l. H4 X% z' U# ?0 Z
  18. *
    * L$ L: S  N8 {5 \0 ^! A  ~6 i2 ?7 I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 E8 d- G$ l# G) c, T( ]) x
  20. * kind, whether express or implied; without even the implied warranty$ z8 I2 A. b! f, W$ R7 F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( s2 I9 G0 N* q# f
  22. * GNU General Public License for more details.2 o3 s' W$ D# L4 {( [# ], b! N
  23. */% X0 [6 W& J+ p) M0 |+ x0 k7 o

  24. , e2 _  I9 f' A7 {; Q
  25. #include <linux/module.h>
    # i8 l/ ]; L& p* x+ P4 h
  26. #include <linux/init.h># e0 l8 h* M% O0 n! s8 m2 Z
  27. #include <linux/errno.h>! L- O$ T  Z2 y; w* t
  28. #include <linux/types.h>$ E  c9 O% d$ }1 y4 m
  29. #include <linux/interrupt.h>- Q# y% x$ E3 D6 v+ t2 k
  30. #include <asm/io.h>0 s2 n3 F: S2 p0 N' T, p. y, @
  31. #include <linux/moduleparam.h>
    * f' T& L2 b1 d1 w. O5 }  V8 _
  32. #include <linux/sysctl.h>+ h( X9 c5 U1 H, `' F! O. F- [, r6 k
  33. #include <linux/mm.h>
    . g! E9 P/ x8 E: }' ~$ @
  34. #include <linux/dma-mapping.h>
    4 u/ ?$ E1 P7 P. q/ J  d
  35. 6 G" V' \/ i1 `2 }6 P) l& k' o
  36. #include <mach/memory.h>/ J* @4 o6 I* @. n/ I
  37. #include <mach/hardware.h>; ^& v+ {, Z5 H4 d5 w- P
  38. #include <mach/irqs.h>7 i# h4 @& s% o+ f! u4 Q: ]$ M
  39. #include <asm/hardware/edma.h>
    + U3 a" |4 P. R+ S5 Z' k

  40. 5 T% [' y% S$ v" U
  41. #undef EDMA3_DEBUG
    & z$ @$ n; c" `/ K; F
  42. /*#define EDMA3_DEBUG*/
    # S% q0 e+ f/ K  `- E) g
  43. & a! m$ h( d# \) q  X
  44. #ifdef EDMA3_DEBUG; Q# B/ \1 Y7 b5 [4 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 M2 I# E7 z) m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 Q  e, \9 ^) T* }5 [- N$ q# L' y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 I3 P6 D/ ^0 _1 W0 B
  48. #else9 q: T! v- {; M" F5 F
  49. #define DMA_PRINTK( x... )
    % o" d9 p' y' }3 c4 n$ _: r
  50. #define DMA_FN_IN
    # x$ U2 J; f/ g# a1 H  D
  51. #define DMA_FN_OUT
    6 Z+ p; v2 I7 d2 t) o( d
  52. #endif( G( N8 Z5 n3 \7 y0 q8 m% f$ C
  53. + o: }" C! {1 }" o- U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 x* z. _& U  y5 w
  55. #define STATIC_SHIFT                3
    2 }+ h. Z! W; N  Z' ]) z1 ~
  56. #define TCINTEN_SHIFT               20. o7 z/ p, j, `  e6 K% h2 W2 b
  57. #define ITCINTEN_SHIFT              21) R  n7 m  p6 Q- x
  58. #define TCCHEN_SHIFT                22. q) ~' s; ~* S, l* G* s' I- T9 A: U
  59. #define ITCCHEN_SHIFT               23' O* v1 ^" v5 m0 m; ?: t* V

  60. ! c- H/ j; D5 s$ h/ q3 q
  61. static volatile int irqraised1 = 0;' \) t: B; ^" O4 D8 C9 b, A
  62. static volatile int irqraised2 = 0;
    , Y% c, z$ H# M
  63.   ~( ^0 z, L0 f2 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . {; @1 ~* @( O0 T3 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - E5 Z* \* c: e8 a: X% W. x+ y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 y$ e; o7 f- ^6 W+ d& ]0 g& C9 C
  67. 5 H3 N6 D( j5 ^; e3 b4 U
  68. dma_addr_t dmaphyssrc1 = 0;
    % {! N2 I/ |+ G) Q+ a. O8 p
  69. dma_addr_t dmaphyssrc2 = 0;- a: Z7 n2 J7 O3 }3 @; }7 S: h
  70. dma_addr_t dmaphysdest1 = 0;  _1 p1 C6 d* M' U) m) m: S
  71. dma_addr_t dmaphysdest2 = 0;
    5 @+ ~1 N- B1 U+ i" G* \

  72. 7 g" u+ F' `* s# e. s
  73. char *dmabufsrc1 = NULL;
    # Q+ P5 t, m/ H) t% o6 m0 [$ c
  74. char *dmabufsrc2 = NULL;8 b" r9 O$ h: m: d6 V3 p: f7 `! W2 w
  75. char *dmabufdest1 = NULL;
    : B8 Z" y# U' f7 x
  76. char *dmabufdest2 = NULL;$ [) y' `8 E6 r, \1 i! b  C

  77. ( D; k; J3 M' M* S' R7 \8 a
  78. static int acnt = 512;
    ' `/ F' @/ j- u6 f0 m0 I
  79. static int bcnt = 8;5 Y* X* Y) _' c( F9 l% @9 x
  80. static int ccnt = 8;
    & P$ b: N7 U  V1 \2 F
  81. 4 @( ^3 T2 P* N% K5 U, q
  82. module_param(acnt, int, S_IRUGO);* m! O) w! d8 S5 s$ J" J+ }
  83. module_param(bcnt, int, S_IRUGO);
    0 E- }5 q# i5 k' R# `1 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( a5 }/ [& U( A" g7 _
) [+ u6 a" w/ d+ w2 H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. a* _0 O8 A; H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, A# l6 ^% M' W7 ?6 G, |! j) u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. c3 {7 P5 m/ J3 Z7 a2 w. ?

3 \  k9 w. l0 |! W! g+ d8 m0 }" s. F- [+ r: f$ R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 06:01 , Processed in 0.038616 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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