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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , B, |: }& \% _+ M; g
  1. [code]EDMA sample test application
    ( Q  N7 N: a& T/ ]" ?) }+ r7 o
  2. /*1 l* Q# g& m& K% }/ z9 V* w
  3. * edma_test.c
    . m% P; |0 f) n# m
  4. *, j: S) p" O, ~7 q: }/ |- f0 i
  5. * brief  EDMA3 Test Application! e* w! B' d1 D- w
  6. *& v7 U4 w) X# G) X6 k! W* R# Y+ \
  7. *   This file contains EDMA3 Test code.
    ' }2 m* X/ h1 {. y, G
  8. ** L' h2 N9 z) `: ]) q$ |. Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # t) a: v  @$ X; Q  T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! l; i" }9 h( J2 s1 z* M
  11. *         TO CHANGE.5 |0 a7 B  M( l: S) y/ ~$ b3 ?5 p
  12. *
    / |: a, J% W& Z1 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( L: u8 f' h! B. O5 T
  14. *
    & E  w" o" y) t) b  L, v! Y
  15. * This program is free software; you can redistribute it and/or/ K5 m  p4 \0 Y1 Z2 L
  16. * modify it under the terms of the GNU General Public License as' y$ t2 a* h" F0 x
  17. * published by the Free Software Foundation version 2.' {- Q1 f; P2 K( l
  18. *
    3 M. s& C0 Y$ G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , d9 @# B' c' p3 A
  20. * kind, whether express or implied; without even the implied warranty
    ; O( T3 p# q7 G  g/ i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  ]0 ]  B0 T, t# n
  22. * GNU General Public License for more details.
    ) e3 }7 e9 ]9 Z; e/ ]5 d
  23. */3 e; U& Z  I- R7 K' W! E8 G4 i. E
  24. ' _( m6 q, j; D6 u1 J5 q8 S
  25. #include <linux/module.h>$ Z$ H0 x  t  j+ d# ]1 y
  26. #include <linux/init.h>
    7 p5 [6 r( t" @
  27. #include <linux/errno.h>
    - n% i- m7 R5 @! N" O! c
  28. #include <linux/types.h>& S4 i' k" Q. G9 Q5 P
  29. #include <linux/interrupt.h>; Y6 i, [' e  w7 O' x6 E( P
  30. #include <asm/io.h>$ M- O5 Y9 r! C' F1 P. G: a# X. V
  31. #include <linux/moduleparam.h>
    2 I. K. p$ _8 q  @
  32. #include <linux/sysctl.h>
    9 D; A7 Y. q( Q6 u2 @% _& z7 W
  33. #include <linux/mm.h>
    3 A+ ^9 L* c* k( Y
  34. #include <linux/dma-mapping.h>6 Q) Z! o  n* F- G1 y

  35. . T7 `' R: l9 Y% T
  36. #include <mach/memory.h>
    # @( S- k( D8 \1 n
  37. #include <mach/hardware.h>
    # a% `9 \0 g- U" k) z, p+ z
  38. #include <mach/irqs.h>
    " i; r! b* S5 s% [% S( x' G4 A' V7 q
  39. #include <asm/hardware/edma.h>7 ^2 q& K( r6 Q% K# q0 D

  40. / b2 F! h% f. t- V7 N
  41. #undef EDMA3_DEBUG
    * I  }6 k( _. `& u
  42. /*#define EDMA3_DEBUG*/
    " f; |( q' `. j* \# z
  43.   S: V& ~$ E3 D5 K
  44. #ifdef EDMA3_DEBUG
    7 K+ T5 ^; K/ r8 @  L( U# S8 |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) g  ?, m# ^5 {( f7 \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). v! L7 L4 K; n1 P/ E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ v* ~' A) S" A, V8 A3 L% E1 Q& o
  48. #else) a  q! v" P5 P+ G( q
  49. #define DMA_PRINTK( x... )
    # B" I, x' R$ H
  50. #define DMA_FN_IN( H5 O3 W4 ]' d$ K- i$ t3 T
  51. #define DMA_FN_OUT
    ! }) T) o: {2 O* ]  y* m
  52. #endif& p9 p4 d; a) [2 o1 ^% w

  53. 3 k8 Z0 [$ W+ \. }$ H7 Q8 Q6 o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- ~) `0 h" Z; k4 P1 H
  55. #define STATIC_SHIFT                30 U: C5 [8 }6 k( E
  56. #define TCINTEN_SHIFT               20. L# q0 o1 @/ l6 `9 A& `
  57. #define ITCINTEN_SHIFT              21
    9 x- O$ f) j3 w# ^" F' p
  58. #define TCCHEN_SHIFT                22
    + ~# R  t) H; B# p
  59. #define ITCCHEN_SHIFT               23
    - Y' T8 }6 G- v% g% I' v5 X: V
  60. . N. I% ^1 Z' y6 f/ `
  61. static volatile int irqraised1 = 0;
    % H1 A# \$ h- X3 a6 [
  62. static volatile int irqraised2 = 0;6 R; C& X6 Y# [% G$ E" v
  63.   T( G  k0 v& z( F' N0 d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ D4 S9 N6 {5 E) }- m. \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# @' T5 X/ |* V; K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 s1 ~5 w0 |* w7 ]
  67. - z0 G/ B5 A, p9 H
  68. dma_addr_t dmaphyssrc1 = 0;
    , s8 S5 J9 ]* t6 Z8 Z9 [6 G/ O3 ?
  69. dma_addr_t dmaphyssrc2 = 0;5 Q( N' a; B6 e4 {) b4 j4 U" ]
  70. dma_addr_t dmaphysdest1 = 0;
    % g* G! p4 y7 I) |3 |
  71. dma_addr_t dmaphysdest2 = 0;8 ]6 m; v0 r; j7 k5 ~! m

  72. 6 B0 l# X! U( Z% i
  73. char *dmabufsrc1 = NULL;# Y& ^' b. i2 a  G! k6 u
  74. char *dmabufsrc2 = NULL;
    7 d' x" l8 O7 a9 ]# G/ a, B
  75. char *dmabufdest1 = NULL;. O" I* g, w+ k" g
  76. char *dmabufdest2 = NULL;4 Q" h. g' x  y* x* U. t
  77. + c$ ^+ g$ }, s, t! x
  78. static int acnt = 512;
    $ i- B: O) K% ?
  79. static int bcnt = 8;
    4 X: p* J4 ]6 V0 \( V$ Q: t
  80. static int ccnt = 8;* Z1 t- S% V2 }4 z, `" V5 l# n4 _( N
  81. ! \: H; M8 W. q3 n9 }
  82. module_param(acnt, int, S_IRUGO);
    5 }6 P# P. i( W& j/ Z
  83. module_param(bcnt, int, S_IRUGO);
    * |9 b6 I9 c# u% C5 E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( t8 ]+ {- l/ `/ C
) r" s9 |3 H* M8 w% z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 v+ ]% a9 x: Y) N3 sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% x* ~* i3 f% @  T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. [' }/ c) J. K; J( x) m
9 \2 Q" r% b- `7 @
. o, Z5 v" u, y! K$ l% E& q. B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 08:06 , Processed in 0.038630 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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