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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 f3 g; A% a0 e
  1. [code]EDMA sample test application6 Y' ]  A  O: q5 E- w+ W
  2. /*
    : Y1 R! A7 C: a( z
  3. * edma_test.c4 e0 L0 M; w- d  i% Z! i
  4. *
    & a) J% x' F, w& Q4 H
  5. * brief  EDMA3 Test Application2 k! ?) }% w2 m! f3 W! I. t
  6. *0 b' v4 A* Q& p
  7. *   This file contains EDMA3 Test code." E1 j  d& R4 L/ U
  8. *- E0 e7 d" z( W" t# k" k' Q4 z8 w; Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + [  p! `' h. v, G0 j- _# A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      m3 `' w, X5 F6 u: `
  11. *         TO CHANGE.* W: v9 g; {% s  K" Z' M' M
  12. *6 D# {0 l, S0 v. `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, c* a2 [& F2 B% Z
  14. *: W% T% i/ L. }5 d
  15. * This program is free software; you can redistribute it and/or0 ]: @4 H& G  A' N8 b
  16. * modify it under the terms of the GNU General Public License as" d/ _- W' ]- b' {
  17. * published by the Free Software Foundation version 2.
    8 k- j& O  k7 \  s& A. D
  18. *
    1 A* j$ Z# \) ~* n5 C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . B6 s( y4 O) k0 c9 k# L2 n
  20. * kind, whether express or implied; without even the implied warranty& R" \3 g; u. f' ]5 Y: a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 f/ p4 A/ h2 H
  22. * GNU General Public License for more details.
    9 K3 d; V$ }8 e# E, C4 O
  23. */
    $ G# r8 e% r- n3 p
  24. 6 |& j3 Y7 p0 s/ V
  25. #include <linux/module.h>
    6 \6 \: e9 I& i" n' _
  26. #include <linux/init.h>
    - }( a( L, V. L* D" I" G5 l( d, T, Q
  27. #include <linux/errno.h>
    $ V1 a* y" }+ q0 `: j4 L
  28. #include <linux/types.h>2 [' p( z) D% ]1 o5 J
  29. #include <linux/interrupt.h>7 Y* V  _9 u/ N  d' w) u
  30. #include <asm/io.h>4 x; l' F2 @" q% Q9 c( j7 C
  31. #include <linux/moduleparam.h>
    0 u! j+ B- _. B1 f& t. K; G! }
  32. #include <linux/sysctl.h>( n9 N5 d) y. E  S
  33. #include <linux/mm.h>
    # I1 u3 G% T+ L: D8 g
  34. #include <linux/dma-mapping.h>: ~0 e& E9 }) u- \" }" Z" @
  35. ) ]. L6 j* \: W: N1 D: s$ L
  36. #include <mach/memory.h>  e" O7 J. Q) q3 A6 x' Y: X0 h
  37. #include <mach/hardware.h>0 ?9 {4 K* S+ `# V
  38. #include <mach/irqs.h>8 Z! d% S) V* b) P
  39. #include <asm/hardware/edma.h>
    $ g; Y  c7 R5 |9 l) _# D
  40. 3 k( X- F' y: [. R1 H" @. B- e
  41. #undef EDMA3_DEBUG
    ; x0 @% S3 a! S4 ]/ u. x
  42. /*#define EDMA3_DEBUG*/
    5 O, a; w3 X, d; V
  43. 0 C2 g5 |. }. ]8 D
  44. #ifdef EDMA3_DEBUG
    6 J, H. m9 {/ p' a* J& t  k7 |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 F3 p2 K# U6 E3 \( m# Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). _& V  E7 w5 _; P/ |5 N1 c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 d1 }% \8 _; G8 {9 }* H& V
  48. #else
    : g2 K0 W7 J/ ]$ C# @9 q9 w
  49. #define DMA_PRINTK( x... )
    : C$ L/ f% r7 y5 @* k( Z
  50. #define DMA_FN_IN. J6 g! f1 U/ Y1 H$ V+ I# W
  51. #define DMA_FN_OUT
    " d. h$ U) r& V5 \4 f% Q. I
  52. #endif, D1 j7 P# c" `
  53. - U5 c; |  E0 ]) B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ U# @6 U+ E& p- ~' o* p7 i
  55. #define STATIC_SHIFT                3
    8 _$ L. S7 a7 G1 d- `- S; T4 g
  56. #define TCINTEN_SHIFT               20
    + D  @" U- i- Q0 r8 q
  57. #define ITCINTEN_SHIFT              21
    7 S. m7 H8 i$ E1 `0 j
  58. #define TCCHEN_SHIFT                22+ L9 q3 b$ Z& V
  59. #define ITCCHEN_SHIFT               23
    + c; e/ x3 S" Q& Y# l2 M
  60. - E' _3 M& p$ m" K1 T2 g9 v
  61. static volatile int irqraised1 = 0;
    $ S# h7 @$ S; Z$ D% A7 ]
  62. static volatile int irqraised2 = 0;
    / B* N, U; t4 h- w0 u. k2 w
  63. % A$ V% h. X) t. ?! R7 q5 c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 @& h, {' E8 x( `7 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 V* r% f7 I: X. h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ^# B8 m( ~0 E4 z+ {" e# t- n
  67. * k1 {# J$ }5 X- k/ m
  68. dma_addr_t dmaphyssrc1 = 0;# i7 @0 T9 }, v3 u
  69. dma_addr_t dmaphyssrc2 = 0;
    9 ?1 B! K8 i8 S# z! \
  70. dma_addr_t dmaphysdest1 = 0;
    ( F! |) [$ [! q
  71. dma_addr_t dmaphysdest2 = 0;
    8 r( ^1 ]( ]( G: F
  72. 7 z3 F  Y/ n/ a$ Q- t- k
  73. char *dmabufsrc1 = NULL;! D' G$ c& h8 z9 C3 R; g
  74. char *dmabufsrc2 = NULL;; I5 `% `; W& c6 A) Y' Z
  75. char *dmabufdest1 = NULL;; u7 T# }  Q. N' A
  76. char *dmabufdest2 = NULL;$ H- ?* |1 ~+ [, Z- Y/ G. h

  77. + N. V* `+ k, e1 ^. b% @4 `- M" Z4 r# y
  78. static int acnt = 512;; d5 `* `6 V( B' h. |
  79. static int bcnt = 8;, e" P! Y6 g9 ~+ L- v
  80. static int ccnt = 8;& s* t4 N7 n7 a0 A1 n# E
  81. ! x; `2 t. E: Z* [5 }/ h9 m' s, V
  82. module_param(acnt, int, S_IRUGO);
    : l6 P1 P; W* ?* U( S- c
  83. module_param(bcnt, int, S_IRUGO);& N9 s0 V; {  ^. v! t$ A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 [- Q8 a: [- v) l) K1 r( Y: I

# R1 Y9 |- u$ |7 F/ W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" _6 }& L* w4 l7 z5 W* y$ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 \+ H( L2 y  E! s0 t. X
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 ~7 L: T5 Y# w3 B; Z" G6 |) w7 _, D4 e' h  @) D+ J* l1 X' S  j

3 {* F  {: w) p" }7 b8 I# ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-23 23:45 , Processed in 0.037414 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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