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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! U9 D: z# c1 q& d+ |
  1. [code]EDMA sample test application$ _) M8 D2 C' w' X# t  B& h. o
  2. /*" H9 ]+ Y+ o  W8 k6 J& ?' w! W
  3. * edma_test.c) f; q; F7 @; q$ n
  4. *& Y% x  f" E' n( p& S
  5. * brief  EDMA3 Test Application7 q- `' ]5 H% o: y6 L: k
  6. *. k1 l2 |* H" c( x3 s: L
  7. *   This file contains EDMA3 Test code.
    $ _+ q3 _& [, T) P0 w! w
  8. *; J+ m% |* m& l8 H4 m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ Z% d# O9 a- b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % [5 w4 g8 M( G
  11. *         TO CHANGE.
    2 {+ q3 ^0 I: Z8 P' P: `. O3 W; j
  12. *: \5 R; k( b; o0 g2 l9 u( z$ }" `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 b$ q  _! p- Y
  14. *' p6 ]7 g+ H- m/ {# }  v4 v- i) x! J
  15. * This program is free software; you can redistribute it and/or
    2 X( `8 \9 _/ v$ ~, D6 k! t5 c
  16. * modify it under the terms of the GNU General Public License as
    , t( Q8 ~  D3 s4 u1 s: D( ~$ ~4 E# g
  17. * published by the Free Software Foundation version 2.' @! d; L! X/ Y# j7 h
  18. *
    7 }; u, G: z1 E( a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 v/ Y' K5 _) m0 X3 J2 J
  20. * kind, whether express or implied; without even the implied warranty
    & X" ?, Y9 W2 v0 `* D% O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 \9 b( n- m7 T* c, t! F8 w
  22. * GNU General Public License for more details.
    $ n% i& t* p$ ]
  23. */
    ; a; d6 i' ^, |5 L9 L( o) F

  24. 7 N# X& \& ]6 Z; M; i6 _
  25. #include <linux/module.h>: j( J- H9 F  N6 g# ?* y
  26. #include <linux/init.h>
    $ l0 M, g8 W" r4 s/ x
  27. #include <linux/errno.h>8 t5 K7 r, Y7 {! l: t4 q
  28. #include <linux/types.h># e3 h# J) z7 l
  29. #include <linux/interrupt.h>9 E* H: o8 E) c- [5 o: o( b
  30. #include <asm/io.h>
    2 R, W5 }( W+ T, ?; w& Z
  31. #include <linux/moduleparam.h>5 B. P( A8 [: ^0 {$ \
  32. #include <linux/sysctl.h>
    ' R+ K% w) U3 S
  33. #include <linux/mm.h>- P  k- |+ [( o3 C, ]
  34. #include <linux/dma-mapping.h>" z  ]  u7 i2 |, G# N5 \' w

  35. 6 p! A: D( G0 Z
  36. #include <mach/memory.h>
    : n0 Z9 E  ^& n
  37. #include <mach/hardware.h>: O7 j, n7 i9 i6 J
  38. #include <mach/irqs.h>6 U3 L% m& H! k
  39. #include <asm/hardware/edma.h>
    * w  C1 L, Y* L/ c, I
  40. 2 x/ k9 v& ^5 @6 P( M
  41. #undef EDMA3_DEBUG3 a2 X( T0 w8 f# C- _8 v+ i
  42. /*#define EDMA3_DEBUG*/
    $ _8 T% H  I) h9 j! |

  43. : s) ~! ?4 I& K1 t& Y
  44. #ifdef EDMA3_DEBUG+ _3 u) \0 ~& E3 V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): y9 Y$ B1 X. w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! ^5 T! q# s# Q7 V, |: b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      s6 R( b- |/ s7 w$ f) i
  48. #else
      U/ S8 G! @* @4 l0 {
  49. #define DMA_PRINTK( x... )
    ; Z) e" b6 w& p
  50. #define DMA_FN_IN
    2 b( A+ `6 V8 `4 W
  51. #define DMA_FN_OUT) t8 M) d1 ^; z  {# Y$ I1 A, r( z
  52. #endif) i9 M& @% c; ]" A8 r
  53. : O# d$ u% g9 T) D7 m* x5 P' @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 E' J5 B0 I; ]* G1 R
  55. #define STATIC_SHIFT                35 x: m& K* ?, R8 M: B& b
  56. #define TCINTEN_SHIFT               203 E6 P: G/ R0 u  w9 O, X
  57. #define ITCINTEN_SHIFT              21; j$ c( I) K. [3 C6 Z
  58. #define TCCHEN_SHIFT                22
    + E* T( `4 w1 J" t+ X8 m
  59. #define ITCCHEN_SHIFT               23
    2 X1 X, m8 R; O& e
  60. % U+ u' I% X9 r. Z
  61. static volatile int irqraised1 = 0;
    + W6 E# P" e) h! I) @1 r6 f" d; q
  62. static volatile int irqraised2 = 0;
    6 f2 J6 d) N2 I; f8 |
  63. 0 C! L" s- e- |* f! J0 n2 h) J) W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Q$ Q: b7 \) N! R' C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Q7 _7 w. A6 F5 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 |) x# Q, `0 x+ Y1 v

  67. / g* C& J  x0 e. c; @
  68. dma_addr_t dmaphyssrc1 = 0;' Y! i9 _& O, w  u" O! L: N) s  m! D
  69. dma_addr_t dmaphyssrc2 = 0;
    4 @( s) O, Q. ?1 t( m" k, ~; B1 D8 ~; n
  70. dma_addr_t dmaphysdest1 = 0;. B8 \. `& A- w  w2 ^+ ^3 x7 E
  71. dma_addr_t dmaphysdest2 = 0;
    + h- D- F& g8 N  [2 S: N' G, C

  72.   X3 @/ O: W5 U3 [
  73. char *dmabufsrc1 = NULL;
    & \) H6 ]4 }, ?. E
  74. char *dmabufsrc2 = NULL;7 Q, t  ]. i/ m+ D
  75. char *dmabufdest1 = NULL;" J; n/ P' ^% o7 h1 `7 B" `3 O
  76. char *dmabufdest2 = NULL;
    9 {' l6 N! J! [! ]) b9 x/ X1 @

  77. " z0 P$ x8 W/ c, p3 z- Y3 r
  78. static int acnt = 512;& g8 ~7 Q1 f& p) C1 n  W5 w
  79. static int bcnt = 8;, s2 R" C# R! p) f# p$ J
  80. static int ccnt = 8;
    " S3 s2 }, u1 U, V. r" k8 H, \

  81. % z, c, t0 _3 R; X: P+ o' T
  82. module_param(acnt, int, S_IRUGO);  \  C; b2 \; k  n$ o" R" \; e
  83. module_param(bcnt, int, S_IRUGO);
    + }' R6 ~3 N+ C  F* E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 ^* |. {/ G+ ^1 ^! Z4 w
' N+ Q' V; G8 Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" }2 }# l% i$ e/ \5 x- v. L1 `1 Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* ?: g& d. Z: [3 P- W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 Q, C; z( h: Q# ^
9 Z3 Q1 w" t2 i) k- v7 s% d' o
7 k5 [% J, |2 O5 x" n. }3 z6 t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-21 13:08 , Processed in 0.054283 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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