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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! D% ~) l+ ]  ~% N) O; y8 v& _
  1. [code]EDMA sample test application
    - o, v0 Y4 _; B2 }
  2. /*9 O: K5 `5 v6 T. b' j8 M' Y) G
  3. * edma_test.c& S. z; m: R: f( k. L  M
  4. *
    3 I* x: x3 B& Y& D5 j
  5. * brief  EDMA3 Test Application
    . e2 Q% f  t- Q( G
  6. *; ]! A+ G2 x2 J- {
  7. *   This file contains EDMA3 Test code.
    # w3 X4 N+ \& g2 u% r
  8. *
    / q: d6 U- Q! w; @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * z. l* s* M1 h) L( n5 M8 _0 L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * a. k) D9 c) E" Y- B
  11. *         TO CHANGE.
    5 a2 Q1 e3 ^! Z' k) V
  12. *
      b( _' d3 b$ Y2 @1 n4 k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      Y' F4 Y* S4 m( \, A' ^; [6 T
  14. *
    + \2 [8 R! `  D
  15. * This program is free software; you can redistribute it and/or0 ^; H0 M8 J5 ~8 U  H
  16. * modify it under the terms of the GNU General Public License as
    7 ]# }% D6 m' P/ Y  B2 U
  17. * published by the Free Software Foundation version 2.
    / _- m; v: V1 G2 G0 G- G1 D
  18. *
    , ]. R" x# d1 u+ H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + x, M$ e  K! @' I
  20. * kind, whether express or implied; without even the implied warranty
    - {  ~& R8 [4 a8 J$ W: w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ @. b/ y8 Q3 J8 B7 R4 P# P
  22. * GNU General Public License for more details.
    0 X, V3 O  N3 h7 f, `- V5 t
  23. */& J) \% V# w+ S7 M. ~

  24. 2 t4 p8 Y, g& J% u
  25. #include <linux/module.h>% l8 y' R& K8 e) r
  26. #include <linux/init.h>* @1 U# u0 G+ \. g
  27. #include <linux/errno.h>
    $ b- U4 M' Z+ ^0 x( o" |8 H
  28. #include <linux/types.h>
    ! N/ X. r* {. b% w  ~  q3 M) U
  29. #include <linux/interrupt.h>
    ! b, o5 g+ S. Z9 N  p0 H0 a
  30. #include <asm/io.h>+ u8 c3 c8 H- l. Z! t0 {  O% R
  31. #include <linux/moduleparam.h>
    , ]  X3 b& [# t1 k2 a  d
  32. #include <linux/sysctl.h>" }- f5 D8 V( Z6 t# C
  33. #include <linux/mm.h>+ j* a; l2 I6 E$ ?. d2 n& n; Y
  34. #include <linux/dma-mapping.h>" g' X% A4 @% v+ i- K

  35. 9 g8 o: T* g5 ]' y
  36. #include <mach/memory.h>- f2 L; J0 P7 v0 g% y4 A1 F" A
  37. #include <mach/hardware.h>! n) i& d( O  r
  38. #include <mach/irqs.h>
    5 Y+ N" z6 ~: d& H) f$ v
  39. #include <asm/hardware/edma.h>( w. Q2 D" }( B' B3 n4 |

  40. ( H, h2 S6 F  L8 w- A8 |
  41. #undef EDMA3_DEBUG  e  {' v& p/ d  ?
  42. /*#define EDMA3_DEBUG*/
    ; h( n0 ]& G' J0 p/ R: N7 X& V

  43. ' o4 h* a1 n6 b+ d) t- L  d$ T: s
  44. #ifdef EDMA3_DEBUG
    ) \# C1 O- C( C: \9 a* F+ R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# B* {2 V# o/ X: M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! g& [' t1 ^, Z; t$ `$ E7 B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- C% m/ y; G# L( k
  48. #else
    2 ~3 X' x  W3 |6 v5 Z6 p
  49. #define DMA_PRINTK( x... )$ x5 \5 B0 b" n7 w' D
  50. #define DMA_FN_IN6 i% x2 L7 T4 }# d- l" t
  51. #define DMA_FN_OUT( G* B% H+ N# n( g
  52. #endif  R/ O! ?3 ~) G3 y" B6 {: S9 q. `' p0 T
  53. 6 o! u+ _* N; {% G1 `/ h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' @/ f' }8 q7 n8 a6 H$ @
  55. #define STATIC_SHIFT                35 C- |9 J7 i. c
  56. #define TCINTEN_SHIFT               20
    ' [) [, m! G0 t5 `5 S) k6 z
  57. #define ITCINTEN_SHIFT              21
    : U) O* T  d7 m6 c% A
  58. #define TCCHEN_SHIFT                221 O5 ]( |, I' W; k2 ^5 d7 _
  59. #define ITCCHEN_SHIFT               236 I8 E# f# B" V& t) o$ R$ ~
  60. ) {0 V& A. g6 \! h! \
  61. static volatile int irqraised1 = 0;
    " F4 o0 y! d0 C/ w( B! u
  62. static volatile int irqraised2 = 0;
    4 w- O  B' u; E

  63. : l/ G" U0 P9 ]; O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ k3 ?7 @0 i- T/ K( }  [) L3 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 {2 r8 @8 s8 M1 d8 A9 Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( {$ o- F8 x- r( ?& F" Q+ _

  67. 1 T6 z+ a# K$ z9 J
  68. dma_addr_t dmaphyssrc1 = 0;
    5 v' p5 q5 M! Q8 ?8 k
  69. dma_addr_t dmaphyssrc2 = 0;! [" ?. b  f  |# U5 j
  70. dma_addr_t dmaphysdest1 = 0;
    4 D$ o. G' H: }, @* F; c. U2 o3 T
  71. dma_addr_t dmaphysdest2 = 0;. G2 k9 p1 V3 P" l9 x9 D" p

  72. 3 Y. R+ y' n2 Q7 ?, `) _
  73. char *dmabufsrc1 = NULL;
    7 H4 L& w6 z, w' V$ ~9 ]( y
  74. char *dmabufsrc2 = NULL;/ ^# f8 W* R6 d0 B5 l# C
  75. char *dmabufdest1 = NULL;
    2 h; e* L9 E% D7 M5 T4 ]
  76. char *dmabufdest2 = NULL;- s) v: z; j& z! i6 k

  77. 1 m+ d& B8 v5 O  `% w
  78. static int acnt = 512;8 }1 N% `, X5 m$ O# w
  79. static int bcnt = 8;
      e. u* z& e' b0 c9 j+ A. S
  80. static int ccnt = 8;. U5 O! ]4 D3 |

  81. ! ]3 s3 n. M. h( {
  82. module_param(acnt, int, S_IRUGO);
    5 i6 m+ Q4 q" B/ z9 x) l
  83. module_param(bcnt, int, S_IRUGO);  `/ `4 @- {9 K" e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% S  T: m$ C% U' R; ~
+ f) @7 a4 N' J9 _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. U9 g% V9 P, ]0 \7 k; |1 M3 Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 `2 V: R9 [% L% [/ m0 U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, Y- v! V# T: u! @% L
$ p+ U. k2 f6 J+ \& n% x9 a7 |, F4 k5 b* E# C0 {+ q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-29 22:48 , Processed in 0.043806 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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