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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ t* z0 n& y$ ?( R2 o. R8 }
  1. [code]EDMA sample test application
    : {" _3 \8 m4 D
  2. /*5 p) M8 S* @- W9 A' l$ Z
  3. * edma_test.c
    7 I9 t; h1 i" ?$ V2 o# x
  4. *
    * U" f. w& E) K2 |
  5. * brief  EDMA3 Test Application8 q, ]; D- {4 G) |8 @! g
  6. *
    1 f, `& K) H: B9 G% ?
  7. *   This file contains EDMA3 Test code.
    : q) f4 w) J7 Y! J' y- D
  8. *
    $ p$ S3 n$ ?( Z+ D& f" c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ p: M3 o9 V4 W9 Z1 F' A# y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- ^, J6 J! T' y3 @# W; V; w
  11. *         TO CHANGE.% T. \: J5 @$ R- T4 L9 m
  12. *, T& C1 @; l" n4 F: r% Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( C1 h2 A* ~4 s  e9 [: T
  14. *% i' k7 o) [5 X! q) o$ H
  15. * This program is free software; you can redistribute it and/or; s( s6 p$ `# W  d# X
  16. * modify it under the terms of the GNU General Public License as. |0 q3 k- O: ]6 q: j& }+ D
  17. * published by the Free Software Foundation version 2.
    & p8 ~2 a0 I5 W- T3 n" }) y
  18. *
    ) e" f% U2 [9 [& T2 e( p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 e( l6 ]+ D+ u* F1 V. ?1 @
  20. * kind, whether express or implied; without even the implied warranty
    , @( e( r2 U+ s# ?# T% B, W& [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 I8 ]; A+ i; x2 _
  22. * GNU General Public License for more details.9 X  [6 u. u/ i3 [  B: h
  23. */
    2 m# z7 r: `% h% C5 N) F9 H5 {

  24. % h3 {* R& `2 d* B* \1 K! M
  25. #include <linux/module.h>, V: |5 V* R4 P+ r" h7 n
  26. #include <linux/init.h>  }8 k# p' N3 i8 a6 s
  27. #include <linux/errno.h>% {5 S+ U# q, |
  28. #include <linux/types.h>+ m3 z: P5 x" z9 F8 }6 G
  29. #include <linux/interrupt.h>
    1 ^6 z. W0 ?& @0 P7 E& S5 h
  30. #include <asm/io.h>
    7 L) Y2 k% S2 R+ U# p; }; ~& B
  31. #include <linux/moduleparam.h>* L# }; q- E% |. _3 s5 |
  32. #include <linux/sysctl.h>
    $ }& i3 X+ [' _2 l! }
  33. #include <linux/mm.h>. N, T) U8 C7 v7 x  y2 h
  34. #include <linux/dma-mapping.h>  O& O% r( H2 w! Y! W

  35. ( d7 t9 n3 x- @  T( V& F
  36. #include <mach/memory.h># R6 v, s2 z0 `' l, P
  37. #include <mach/hardware.h>4 y8 X2 Q" [# J; a) Y
  38. #include <mach/irqs.h>
    3 D" x) v- [1 u/ T. K+ `
  39. #include <asm/hardware/edma.h>
    ) }7 U/ f. n  \& C$ W  g

  40.   ?1 [( A" _: _) r: B9 e
  41. #undef EDMA3_DEBUG2 R" y' d- s$ U0 o
  42. /*#define EDMA3_DEBUG*/  G( s7 x6 K1 n" \' N  c

  43. % O# G7 N7 s9 M/ G
  44. #ifdef EDMA3_DEBUG* D0 _5 B3 v2 {: s- {. y8 h/ N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 p7 Y: ?6 B3 l% O9 l# n5 }+ j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 L  H  i7 Z, c( [1 A3 p1 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 ]5 }4 Q* Z- d) R4 w
  48. #else' @  l4 ?7 `3 p2 c. u
  49. #define DMA_PRINTK( x... ), k- |" [- |; D% q3 G( Y+ k
  50. #define DMA_FN_IN
    * m) q+ v, }: J
  51. #define DMA_FN_OUT& L/ q9 A$ P0 L" X; o4 G7 a# R- n
  52. #endif) J" f& ~- V) k/ Q
  53. 0 w, i/ Q; e' [: i; E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) |; U  b, N/ |+ i" p
  55. #define STATIC_SHIFT                3
    6 l9 y' s4 K0 ^9 ?; t7 A' [
  56. #define TCINTEN_SHIFT               20+ h; `4 g9 ?- i* S* W
  57. #define ITCINTEN_SHIFT              21
    - `3 M  u- S/ T
  58. #define TCCHEN_SHIFT                222 d! n* q2 i8 K7 {* P4 {% E) U9 p/ p
  59. #define ITCCHEN_SHIFT               23# p2 T3 e7 w- \* U3 h

  60. / p2 f; G9 E( p6 g( t% o
  61. static volatile int irqraised1 = 0;, z' l# N) q2 U! p6 T9 u
  62. static volatile int irqraised2 = 0;# r# b+ U# ]8 q; Y$ X- R! i
  63. 8 H7 ~8 X, q3 r* v( |5 M8 c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 _. K0 ]/ L- q- _8 e7 z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ I4 Q1 p+ X) ^: v" t, U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! u% h# M- M: _5 w6 ^
  67.   n7 s; {# J$ L0 v6 u, D7 t
  68. dma_addr_t dmaphyssrc1 = 0;
    7 ?6 t% o% l8 u9 `: f& Z8 _
  69. dma_addr_t dmaphyssrc2 = 0;  g7 A# ~) t; Q4 E; {) E. f
  70. dma_addr_t dmaphysdest1 = 0;% y/ N( z. E  v$ I! \# d
  71. dma_addr_t dmaphysdest2 = 0;
    $ q, b3 Z2 |+ p! q; f5 P

  72. 3 S  |( l( [1 g1 y
  73. char *dmabufsrc1 = NULL;5 h+ k- y* o' d) a) {2 G
  74. char *dmabufsrc2 = NULL;1 f6 i7 ?/ v  R% z$ m7 j) [' j
  75. char *dmabufdest1 = NULL;2 ]# N* V/ r+ o$ C1 j
  76. char *dmabufdest2 = NULL;
    - n" O2 Z& h7 M0 ?) ^4 \, ~
  77. " ?+ e. `8 f- B: F
  78. static int acnt = 512;. V$ ~# l5 r9 S
  79. static int bcnt = 8;; o( {& _$ H/ S
  80. static int ccnt = 8;% O0 ?5 T( P7 d+ d8 G

  81. 8 Q0 z& ]; S: K/ [# Q& g1 ~
  82. module_param(acnt, int, S_IRUGO);9 h$ K% F! d0 j- X
  83. module_param(bcnt, int, S_IRUGO);
    2 O' P& W! H: F2 t; |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  T8 I0 a/ x- l- }' q9 t$ v
$ a2 v. o3 {  ?+ a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, C. g9 K/ q# G, z' Z# e& Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" @# w# Y% F  N& N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  Z$ f0 u; ~0 B; s5 `4 `8 D
" ?2 m0 \7 `% S! a2 K4 V/ @' m( M( [2 I. a& T1 S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-19 18:38 , Processed in 0.039977 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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