OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; ?! K. z9 @5 R7 N
  1. [code]EDMA sample test application# G. |7 U& }  T8 h3 e5 @
  2. /*$ \) @5 K" |6 ?; l
  3. * edma_test.c' j; z" S* }/ ?
  4. *
    , I" r% m8 P6 \5 @
  5. * brief  EDMA3 Test Application3 l" D) K7 N; q% O- E! h0 g7 @
  6. *
    8 j  e* f/ w' m! ^
  7. *   This file contains EDMA3 Test code.
    : G! {, o8 H& L6 q
  8. *
    . b. S& S  c9 m/ W' N" P2 N- K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* k% G' J' e/ M' q  |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 m. K# k: O7 J* [' |
  11. *         TO CHANGE.8 i7 C" p* R6 n4 P, K7 c+ f
  12. *5 `( |$ {2 `; L2 M) {# X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 q. L6 s* a+ N" R/ G. i- K7 ]1 H
  14. *
    * t; M5 [5 p; a1 v9 k
  15. * This program is free software; you can redistribute it and/or" p% s2 K- i, `3 ^
  16. * modify it under the terms of the GNU General Public License as5 p/ _: }7 \8 C  j
  17. * published by the Free Software Foundation version 2.
    6 q  v9 C6 I4 Q8 ?
  18. */ G) k3 M' L. w  N$ r& H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ J( m, ?  L7 d  M# i  P) R2 c
  20. * kind, whether express or implied; without even the implied warranty  s  E9 x0 \& L' U- M, ~* I: o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! Y' l8 y/ Z4 @  o
  22. * GNU General Public License for more details.
    ' m& m/ X" \- [+ q0 u
  23. */
    - {) \8 D: [- L' r0 w: U

  24. ( n9 |& w4 X+ [. J
  25. #include <linux/module.h>
    * S; Q" ?# B& E" {4 u2 l# U
  26. #include <linux/init.h>
    8 y  {+ s5 K, P8 a, {- w
  27. #include <linux/errno.h>. w& \  A/ A3 T. w4 i3 G" P
  28. #include <linux/types.h>9 {/ ~6 W# U: q  j: D
  29. #include <linux/interrupt.h>  E1 ?& p) \2 Y. C) [# b9 ^
  30. #include <asm/io.h>
    5 @6 g* e- H5 ]/ z$ k8 @, }
  31. #include <linux/moduleparam.h>
    + J! t# ]/ a0 o2 Y3 k7 o
  32. #include <linux/sysctl.h>
    & J+ E  v' P0 n) Y% _
  33. #include <linux/mm.h>
    4 q5 \9 @5 l, j& o6 P$ g2 h7 R
  34. #include <linux/dma-mapping.h>* S' g3 l7 r; i; I2 L9 y' G
  35. + R, w6 @& D/ C1 M( K* j4 M
  36. #include <mach/memory.h>
    1 X  I( x% d3 N& V1 D4 D
  37. #include <mach/hardware.h>, }- _6 D$ l- P3 b. Y
  38. #include <mach/irqs.h>, a$ a$ |, m/ R
  39. #include <asm/hardware/edma.h>5 q1 }+ J$ d1 i& _
  40. & ~3 e. o) B& ^* j
  41. #undef EDMA3_DEBUG! k, R1 u& h9 X+ U% y
  42. /*#define EDMA3_DEBUG*/0 {1 b8 ~9 V' I) m, [! l& W, x5 i$ G/ W) d

  43. 4 W/ U5 @2 f9 p$ N- r8 }2 r! a
  44. #ifdef EDMA3_DEBUG  V- S7 e& c9 Z+ {8 S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / y( _8 D7 R; e# V; q" p; L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 n! s/ y- T, Q: O$ j$ m' L6 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 B% a% K% j2 d: l7 z
  48. #else
    9 l0 w# k+ e/ B1 X5 f% U6 Y
  49. #define DMA_PRINTK( x... )
    , T" j* J, Q* a! v" o" a
  50. #define DMA_FN_IN7 Y3 l, T+ z$ R
  51. #define DMA_FN_OUT& q3 H" h) l, F
  52. #endif
    4 N3 y' H' w6 ]" u

  53. * S/ P4 Q6 p- Y: K; O" D& S% P, G8 G2 P8 O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); w9 z, O1 D3 n) }  Q
  55. #define STATIC_SHIFT                33 ?- |! I0 o- t( e, C+ t4 z
  56. #define TCINTEN_SHIFT               20( j* m* [! d1 o) S  \2 z9 G8 r# v
  57. #define ITCINTEN_SHIFT              21/ O/ P( z* D" T; G1 |' c8 ~1 d- [, P! _
  58. #define TCCHEN_SHIFT                22
    0 p: c! U0 p1 D' ]
  59. #define ITCCHEN_SHIFT               23
    8 q& e: x8 W% m+ k9 ^& C0 u

  60. - n/ u) K# H- Z/ Z) B+ N
  61. static volatile int irqraised1 = 0;
    : m- D) H* p& ]6 c8 p
  62. static volatile int irqraised2 = 0;; _1 F: N2 A$ e0 Q& ?0 ]( l1 P. a$ i

  63. 9 Z+ }' f9 }9 L' B0 \5 c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 M7 R+ u( i( a# p% G& M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 c. T3 |: b+ h0 a3 A5 `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 K( n" s: R9 B
  67. / K- ]/ ]- _5 Q0 C
  68. dma_addr_t dmaphyssrc1 = 0;
      ~0 ?& {3 ?& y
  69. dma_addr_t dmaphyssrc2 = 0;& n/ H* t+ T; y/ v. V) V
  70. dma_addr_t dmaphysdest1 = 0;
    ' G' w4 c: W) E
  71. dma_addr_t dmaphysdest2 = 0;
    . M5 N* D9 R, l* j  p# j4 [1 ]& Y9 G

  72. * d; {- r, ~' ~, p  K+ A6 W4 O
  73. char *dmabufsrc1 = NULL;5 a2 O  G1 h# z/ H( N0 @  G
  74. char *dmabufsrc2 = NULL;2 J  P( e# M) O7 @: T: f
  75. char *dmabufdest1 = NULL;. M. ~' A* f8 g; Z( X, p1 c
  76. char *dmabufdest2 = NULL;
    2 m0 c! l" ?4 m6 C: B
  77. 4 ~# A& S, K, r/ [2 [
  78. static int acnt = 512;4 |; b7 d! G: S! w3 m; V
  79. static int bcnt = 8;5 ~8 G; I+ z- s- f9 a
  80. static int ccnt = 8;6 z' C" ~# P0 l( }9 P
  81. 8 E6 J3 ^3 G- D9 \8 b1 J
  82. module_param(acnt, int, S_IRUGO);
    ; K- ~6 R0 b  S, h! N, v
  83. module_param(bcnt, int, S_IRUGO);* ^9 h: K1 o: z5 B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ T$ M0 `3 ]( g% y; t
" N' z0 h8 p6 Q! p1 x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ R% R7 b4 i$ J1 ~2 J2 J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" i' b' {0 ^( V* \* \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# w, K& v; l" E( h7 D- ~
4 O3 `) r% z% w9 B
6 X+ @) j* _9 n, Z# s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 13:34 , Processed in 0.040247 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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