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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( J  w; n$ D9 A) M' v* N) K
  1. [code]EDMA sample test application
    2 U# q, I/ |1 q
  2. /*
    + ~3 F% |* v9 L. d% v# s3 U
  3. * edma_test.c9 z4 ?( G3 L- R  t% l2 a" J
  4. *
    , i$ }) P: l+ T( J2 M) v
  5. * brief  EDMA3 Test Application
    2 Y  g  J, L, [. J
  6. *' i; P5 M' G. y2 W
  7. *   This file contains EDMA3 Test code.
    2 T8 Z3 g, j1 R8 h6 R
  8. *
    6 z$ ~; B# z4 n0 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * U& A  X. O7 T$ C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( ^: ^/ J: {: R
  11. *         TO CHANGE.
    # K2 D4 C3 c4 ?  O6 o
  12. *
    % a# s1 J# r1 l/ Y0 J" r6 D! ^2 O$ A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " E4 R) H) ~, v1 P# A
  14. *( M! S0 b' Y) L! v, X
  15. * This program is free software; you can redistribute it and/or
    & |6 z, V% k8 S, R$ j$ `8 q
  16. * modify it under the terms of the GNU General Public License as
    % ]# f% F% b# s# p9 z
  17. * published by the Free Software Foundation version 2.
    ' Y$ v2 [: @% f+ h' c
  18. *( R4 p( G8 e* M$ R2 b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 w; U+ q- K: d$ l1 |
  20. * kind, whether express or implied; without even the implied warranty
    6 L6 m3 y9 n0 o% r, Q% ]$ }- P' w. Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ m  `7 `0 I6 r. D% s; V+ I" @
  22. * GNU General Public License for more details.
      W) a# d: V) `5 a- R& ]) V
  23. */2 v; X: l2 u5 Q8 q$ ~
  24. , H, g0 J3 O  M% D4 q% ~  [* M
  25. #include <linux/module.h>
    ; ?# C' Y- _/ l- n7 b
  26. #include <linux/init.h>' F# ]8 k9 |( d' w8 H
  27. #include <linux/errno.h>: `/ Q  O# C( a) E8 O! a
  28. #include <linux/types.h>/ ]" ?8 t( F& T. Y, @
  29. #include <linux/interrupt.h>
    0 }, {% M& P  d& R% {
  30. #include <asm/io.h>
    0 L* J/ }' R! r9 p' _4 R
  31. #include <linux/moduleparam.h>
    * I  @: H9 K1 W6 _, b' y) z
  32. #include <linux/sysctl.h>' k. y. c/ n+ ]
  33. #include <linux/mm.h>, X  G% _9 {: r3 A
  34. #include <linux/dma-mapping.h>
    5 E4 \7 G1 w9 T: L# D

  35. $ }( k* e) R7 J- p. n
  36. #include <mach/memory.h>" n+ F7 \3 B' G, N' ]! x3 n6 Z
  37. #include <mach/hardware.h>( H0 `+ h5 j  G- k: }% h
  38. #include <mach/irqs.h>' z$ R! w2 I3 k+ S: V' P  `
  39. #include <asm/hardware/edma.h>
    $ ]- E* S5 S% \) y( R, ]& t
  40. , c1 ]3 e  L# m/ e5 s* q/ T( L
  41. #undef EDMA3_DEBUG
    1 ^5 z! T. x  g. a) ~* S2 O# O5 ?
  42. /*#define EDMA3_DEBUG*/6 P, ]3 X/ T3 S+ s! d: G

  43. , c8 h, @8 l7 _8 W; ~$ A' @
  44. #ifdef EDMA3_DEBUG9 U% k+ m# x; e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 a) N( t. T( X' Q- _* H/ i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # K7 w; x. k7 n$ B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 {+ S1 ?% Q" c
  48. #else
    " [5 o) {; d( R& c  L
  49. #define DMA_PRINTK( x... )6 F" N9 z# f  Y6 L8 Q/ v+ Z( b
  50. #define DMA_FN_IN
    0 F/ C( G8 J  f( p5 Q/ f2 ]* |
  51. #define DMA_FN_OUT& }" X' Q2 x, Z* M; L
  52. #endif8 [7 E; ]5 A4 b5 C- U( M- k

  53. 6 V0 B* q0 D! M( O! o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + p8 e/ Z7 A. Q; J
  55. #define STATIC_SHIFT                3% f* F7 E% y  r) x% J. N
  56. #define TCINTEN_SHIFT               20) R3 ^$ H) l! V
  57. #define ITCINTEN_SHIFT              21
    ( X) {( y" b$ @8 I! V  e
  58. #define TCCHEN_SHIFT                22
    , a+ |" l: |7 n9 l5 b
  59. #define ITCCHEN_SHIFT               23, n5 n, e& \, S7 A6 h
  60. 3 h: k  y- G0 p! P  _+ O. U. w
  61. static volatile int irqraised1 = 0;0 Z1 j% k/ m$ _( x* S" p
  62. static volatile int irqraised2 = 0;$ G$ l7 G/ E1 r, }" A' m  P

  63. & {- x- i- }# Y) F+ |  s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 [! R) K5 [4 h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- a; B6 S9 C" E6 V5 x6 O! z5 v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 B; U2 t7 M* v: Z* B& A1 n2 F: p! e+ |
  67. / ~9 h: G- I. ]2 _9 `% g6 S
  68. dma_addr_t dmaphyssrc1 = 0;
    0 Y: z3 H8 p1 x  s7 a: w
  69. dma_addr_t dmaphyssrc2 = 0;( ~( T0 |1 D& {" l4 ]9 \, k
  70. dma_addr_t dmaphysdest1 = 0;
    : J  Q9 P) H$ G' t/ @. K1 V
  71. dma_addr_t dmaphysdest2 = 0;
    $ X1 Y( ?, i0 u8 ]8 O

  72. ) c' r! X3 g+ s8 u
  73. char *dmabufsrc1 = NULL;6 Z( `1 m( o: [  f8 h+ ]
  74. char *dmabufsrc2 = NULL;
    ! J8 s& X! k4 f3 _% v. M
  75. char *dmabufdest1 = NULL;; g( a* E- }. X# b
  76. char *dmabufdest2 = NULL;
    8 H6 n: X' M$ C. U1 r3 _, [! Q

  77. 2 w6 B* H! h3 l' n7 E2 g% R' o
  78. static int acnt = 512;3 S9 E8 \& K; D( o, \
  79. static int bcnt = 8;# J5 U; p$ b$ `# a
  80. static int ccnt = 8;
    ) O* T! v9 M9 ]+ I) K0 c9 B
  81. # I4 m" d# G, c0 B* B
  82. module_param(acnt, int, S_IRUGO);, M# W' I% K- M: D0 G8 _  P' U
  83. module_param(bcnt, int, S_IRUGO);
    : M: Y8 p0 h+ K; A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) f* `4 S: s: ]! S
0 D' J: K, s' A' P; A      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 H4 K9 i( Z% F$ o$ g8 D* i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* z7 @% v3 s6 P: {( `* h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* y( N' }5 o! f  t1 l9 F2 C& `( x1 Q. v3 ]8 a# W& M% |, T

2 i. c# l( t' y8 N* [: w# x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 09:35 , Processed in 0.040411 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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