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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 F" g( k) e+ X
  1. [code]EDMA sample test application
    ) h# O: Q4 ]" M" G3 s
  2. /*
    ; N6 a' J# |* ?: O1 H3 G7 R
  3. * edma_test.c( `# h$ S: I5 a4 Y
  4. *
    $ [8 F( R6 }( \( i( c
  5. * brief  EDMA3 Test Application
    # p7 X& N: G" n, X5 z3 ]  F
  6. *
      U5 B- ^' x& h+ }, n2 k
  7. *   This file contains EDMA3 Test code.5 J" g4 B" @4 {# [8 ^) }
  8. *6 y; D5 Q! B& g5 r6 b( I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 A* x$ W% v* V5 U2 g6 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      a) l' X8 o- \, v7 N6 I
  11. *         TO CHANGE.
    3 ?1 Z8 y: D/ k6 v6 W9 K% r
  12. *7 L: i6 ~0 {# ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) w- ?1 O& ~1 Q" v; l1 a4 v
  14. *6 h. v. o" d/ N7 G
  15. * This program is free software; you can redistribute it and/or7 M( d; @: x$ m
  16. * modify it under the terms of the GNU General Public License as
    ) n& G1 m6 i& z
  17. * published by the Free Software Foundation version 2.
    3 T6 o: k6 `9 ^# e% X
  18. *+ r' ^+ P7 J0 ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / Q' f6 c# h% s. m6 H- f
  20. * kind, whether express or implied; without even the implied warranty. g/ f( z4 u" h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / Z) w0 r$ ], q0 Z4 Q& o
  22. * GNU General Public License for more details.3 F% }9 ?$ E. i8 w  o/ E8 G
  23. */$ i2 ~$ H* ]1 g# K$ }) d5 R) G

  24. % a0 ^2 O. f; t4 y* k
  25. #include <linux/module.h>9 A# h! s" F0 H, p2 @% e6 j) \
  26. #include <linux/init.h>
    # s  W: H) N4 e  s; ^
  27. #include <linux/errno.h>& [0 p/ k7 D; g' ?7 H
  28. #include <linux/types.h>
    # {: C! t4 l6 I0 |1 B/ w8 R
  29. #include <linux/interrupt.h>% ~; J% J- B" ~% i  m" K$ l6 M
  30. #include <asm/io.h>
    - H7 e' t3 j$ t% ~
  31. #include <linux/moduleparam.h>
    & M9 P# T# J, s( q2 x
  32. #include <linux/sysctl.h>. Y$ O4 y1 D$ F: F, J: O% z- O
  33. #include <linux/mm.h>
    , f) X* |: |. `6 Z6 |3 S' j7 E
  34. #include <linux/dma-mapping.h>
    . I/ V& `7 D; D( v  X6 G

  35. 8 ?/ ~% E9 x6 y1 o: e) ^3 `; Z
  36. #include <mach/memory.h>
    - C; m! F5 Q! y
  37. #include <mach/hardware.h>& C! M+ s+ I$ `6 L/ V
  38. #include <mach/irqs.h>
    # m' V  `% I" s; H+ |
  39. #include <asm/hardware/edma.h>
    1 Y" I+ y* f& w1 ^' Y# q1 A3 K
  40. ; |! `1 v" s, I- g' q9 `( Q, h
  41. #undef EDMA3_DEBUG7 Z. Y5 k) ]  ^% F% R4 C7 B( I
  42. /*#define EDMA3_DEBUG*/
    0 l# R! C! I1 K+ K9 z9 Y
  43. , C! J. O  ^" E/ e! H, W
  44. #ifdef EDMA3_DEBUG
      j0 @' N/ {0 W: z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , r. w2 P4 M6 Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# e! V  Q0 z, G! g3 N. ]7 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " o0 Q! n+ g5 ~' f
  48. #else% n7 q& x: p2 I! M
  49. #define DMA_PRINTK( x... )
    6 h: ]1 m3 ~6 }2 z6 W$ l+ d* _
  50. #define DMA_FN_IN
    , _. B( L: c$ t, z7 k  _* r
  51. #define DMA_FN_OUT: x5 e0 L: Z) z
  52. #endif
    4 @/ n8 V2 g5 {% n- f, O. J/ [
  53. & |: M; n( U. @4 m8 n/ M% @  P9 z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 a6 V' x  O) H2 I6 b/ j
  55. #define STATIC_SHIFT                3
    - D8 s( W4 z0 m$ ^% g0 \
  56. #define TCINTEN_SHIFT               20
    & v/ ]/ y" @0 f. _, h0 F
  57. #define ITCINTEN_SHIFT              21
    1 t4 w) L$ C( o8 @4 ~7 u) v  m7 R
  58. #define TCCHEN_SHIFT                226 Q# r4 z; z, q  H/ t
  59. #define ITCCHEN_SHIFT               23. H  x  J$ k& h1 `7 c0 z; h
  60. ) t/ f! h, N9 S& Y
  61. static volatile int irqraised1 = 0;% f  `& ~8 q8 L: }0 C8 p  O
  62. static volatile int irqraised2 = 0;
    ( ~& }8 x# w. K. |) c

  63. / v7 q) q7 b0 Y( s2 m% m1 M( i) ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ a1 Z5 F( Y7 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 r6 a: `, d5 _: |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 _# Y4 K# d5 ]% }* G

  67. 6 ?& y9 u  i1 g
  68. dma_addr_t dmaphyssrc1 = 0;
    - P+ R9 N4 v0 F2 a+ [* `2 w8 Z
  69. dma_addr_t dmaphyssrc2 = 0;
      V( w0 I; ^" H6 F9 Z1 A6 P) }
  70. dma_addr_t dmaphysdest1 = 0;, }1 K% r3 b3 d+ l% e, p  K+ _
  71. dma_addr_t dmaphysdest2 = 0;* Z# q3 w/ C' [9 c0 @" _& b5 k

  72. # j2 R9 K! [' G4 m
  73. char *dmabufsrc1 = NULL;7 B3 Q  L2 Q$ q1 G' ~! V' q/ s
  74. char *dmabufsrc2 = NULL;% G: T6 R$ x' [4 \
  75. char *dmabufdest1 = NULL;9 D: D' k2 d& v6 R) A# u
  76. char *dmabufdest2 = NULL;) \) d" d) X, c' ^1 z  m

  77. , p  g2 b# G  q% }
  78. static int acnt = 512;
    7 t; \6 w5 D5 K% q% a& @- y1 J
  79. static int bcnt = 8;! j+ x2 J6 i9 a# \
  80. static int ccnt = 8;
    6 Z6 ?/ \) n. q5 u& c" L

  81. 9 J% X  i2 j; k, S9 }0 w0 P
  82. module_param(acnt, int, S_IRUGO);
    * J7 {0 T) D* c
  83. module_param(bcnt, int, S_IRUGO);% B1 N. I2 e4 i4 @; d7 K/ E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 M6 u4 m" x$ v3 p! S" ~9 G+ q& Y3 j( X) H$ a9 C# q1 Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 ~* v$ o) \2 w- }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 u  v& V8 @0 h, }: T" H: E% O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: C5 P7 U8 j+ _" B. o' K: J
. d5 H/ y9 d# t& B

* q4 n5 l: w7 m" R2 i) Q  B) S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-22 09:21 , Processed in 0.042059 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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