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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / H6 H( ]5 W( Q3 g  [
  1. [code]EDMA sample test application
    6 W# W+ U  s& T% l- G" V
  2. /*! B+ x' L6 T# r4 ?" m9 D
  3. * edma_test.c; L: l: ~/ V& [3 K& A+ w
  4. *
    ) i+ G! f1 ]+ h
  5. * brief  EDMA3 Test Application( k8 X) k3 b1 F+ e' H; @. L
  6. *
    + o# v5 M  O+ I8 Z% o( I5 g
  7. *   This file contains EDMA3 Test code.
    6 F) I9 @9 s& @7 l0 G. ?6 B
  8. *' L2 k! r5 B* L7 n- ^6 h( ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 G9 D! g2 T' W1 W. b8 S# K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ O, y& L" J, P! O" {
  11. *         TO CHANGE.8 Z  U" T  Z  Z/ f& T' F2 r
  12. *! ~5 S! ]) H, g2 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- k2 B& D4 t' J- H9 ^
  14. *- l+ U: S+ z$ T& w
  15. * This program is free software; you can redistribute it and/or
    1 k% [/ c; O+ u* V! H, l! {
  16. * modify it under the terms of the GNU General Public License as
    - b% n+ u. g9 p! N7 T3 c
  17. * published by the Free Software Foundation version 2.
      K; j2 ~* I, |. V
  18. *
    6 A1 ?7 I6 s. N' r- C4 P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 N* v( t& ^  N6 A1 ]
  20. * kind, whether express or implied; without even the implied warranty6 {5 P7 K9 j3 z) W6 G. [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! ]( k2 v1 T2 C0 p/ J
  22. * GNU General Public License for more details.% c' C& e& ?- k! f
  23. */8 h2 A# W7 t' I" e2 [, d( F2 F

  24. . @+ D! D3 j( Z  n  l
  25. #include <linux/module.h>& F6 S" @4 h; ?- O6 Y, ]2 B
  26. #include <linux/init.h>
    ( p+ z( n  X& ]3 l8 D3 g0 e
  27. #include <linux/errno.h>: f! T( y9 O* w# ~
  28. #include <linux/types.h>
    3 }: r. I  [9 C4 O4 z
  29. #include <linux/interrupt.h>
    / y/ S& g/ B& m# A' A
  30. #include <asm/io.h>
    , P, u/ U: k- k
  31. #include <linux/moduleparam.h>
    , ~$ @5 P. l7 W- i9 y
  32. #include <linux/sysctl.h>' o5 O, R2 Q. @7 ^; N8 W# F+ s( n
  33. #include <linux/mm.h>
    1 y4 e, B& E& d& N! O: F6 Z( D9 l
  34. #include <linux/dma-mapping.h>: V  `* G! _, P7 r

  35. " S. q5 M% f) L$ ?
  36. #include <mach/memory.h>
      R" M0 v) Z8 X. P3 p( k
  37. #include <mach/hardware.h>
    $ R5 F; @6 z( V0 O) K
  38. #include <mach/irqs.h>$ i3 Z- [( \# n1 ?4 J  I
  39. #include <asm/hardware/edma.h>$ D3 F: l3 K4 C% r, A! @& l7 K/ M

  40. + e& D# z2 t8 i: [
  41. #undef EDMA3_DEBUG$ ~. K5 t% G6 ~7 w1 C- Y
  42. /*#define EDMA3_DEBUG*/
    # p  _, v; O+ \/ e: f( W0 `
  43. ' Y) ?, E3 x* a
  44. #ifdef EDMA3_DEBUG9 Z9 h5 l9 }9 ^$ n$ w- `4 h) a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) A( f+ I; F* W+ u9 K( }6 `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % d; c9 ~2 M0 O  @! s# N- i9 x$ S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 ^% N' g3 b( w2 @' _2 P/ B
  48. #else/ C1 ~2 Q% k# ^! E
  49. #define DMA_PRINTK( x... )
    5 W3 [+ D9 b% p- v$ w$ S
  50. #define DMA_FN_IN4 n: U7 A4 J# [7 @
  51. #define DMA_FN_OUT
    & n3 E* }. N+ G' g2 @9 l6 F' ?
  52. #endif
    0 e" @/ j* U! B
  53. 8 K' u" a, D; p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + i9 `8 X5 c7 Q2 H. d$ H3 V$ Y, i9 d
  55. #define STATIC_SHIFT                3# ^1 j9 S  x: x( t6 l
  56. #define TCINTEN_SHIFT               20% s' P% C9 J, U& ?, o
  57. #define ITCINTEN_SHIFT              21/ A: X0 o$ [3 U& e
  58. #define TCCHEN_SHIFT                224 A* s: k- U" [! X
  59. #define ITCCHEN_SHIFT               239 h$ O2 P6 l1 n: Z/ S/ a
  60. 3 {% s* t/ n/ Y/ W% o
  61. static volatile int irqraised1 = 0;
    1 `5 q+ _  l0 b5 m' R  ~
  62. static volatile int irqraised2 = 0;
    7 @: i6 r! k, W( f, m& K( ?
  63. 5 y% [3 k) U, {6 N4 s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ~' L+ S  m4 h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ a$ G0 N  k8 x3 T; p/ q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 `' N0 x- f7 Q5 n% l3 S# n

  67. ) _; x( d  r( z" p
  68. dma_addr_t dmaphyssrc1 = 0;
    5 m) N! C) T+ Z8 `3 B# G
  69. dma_addr_t dmaphyssrc2 = 0;8 ~3 `6 }) \8 V! g* U# B# @
  70. dma_addr_t dmaphysdest1 = 0;: \0 G: f: v, _0 w7 A$ }
  71. dma_addr_t dmaphysdest2 = 0;) R3 `% j! v6 ^$ `$ f
  72. 1 K, j- ?' A& y- W
  73. char *dmabufsrc1 = NULL;+ A5 Y  Z0 I% a8 F) {8 r1 N
  74. char *dmabufsrc2 = NULL;) o( ~& D4 |0 f
  75. char *dmabufdest1 = NULL;- e$ l4 ]4 r( G3 \- g
  76. char *dmabufdest2 = NULL;6 `% H2 u* c' I2 X
  77. - U- r. Q7 p4 A0 P0 t, {; @% l6 D
  78. static int acnt = 512;
    . Q# @/ s6 j! Z" @% G  u1 J
  79. static int bcnt = 8;
    ) i. J  I. L+ ~" S% z
  80. static int ccnt = 8;, Q4 p" S7 s2 v# B; t3 S$ Y( u: Y2 r
  81. * R, u1 o, m& l. R4 Q0 g
  82. module_param(acnt, int, S_IRUGO);# v, {# L# ~9 ?
  83. module_param(bcnt, int, S_IRUGO);4 l4 ?% O/ \* F, z$ X: m! |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, `0 e0 v. X; \/ E$ |! ^3 a+ ]5 m

: Z1 X3 G$ s* e: G1 ~; Q9 k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ L! o* }1 a9 E# H9 r+ Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 p8 m) q5 d% {* L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* z/ D) w, @) }, n# v* L  x
5 [, f3 G; J' b) S4 g, L
1 v; W, |' d$ c! N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-5 13:34 , Processed in 0.056457 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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