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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 k) V% ?3 p3 U/ ?# e9 b
  1. [code]EDMA sample test application5 Y0 k( d- L' i& ]1 Y1 ^* I" d
  2. /*0 I1 T5 t  I; }
  3. * edma_test.c
    3 P+ w+ J5 s* }3 n, z2 w# _
  4. *: M8 W5 T( Z0 I3 T+ p, a% G) l
  5. * brief  EDMA3 Test Application9 D4 p/ U' A) q! O$ x7 r
  6. *
    ' e# w+ y0 B1 Z4 Q8 w, t4 x3 a
  7. *   This file contains EDMA3 Test code.- U+ l; B) G% }& ~
  8. *7 `1 H2 u; ?: l" ~7 X8 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # [5 y4 M8 [# W7 O4 h# ?) C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 X# A1 X0 L9 p% q7 n+ Y& Z
  11. *         TO CHANGE.  ?- ?9 D8 j' x0 _/ F6 n, z4 j
  12. *' W* t& }4 e4 ^, V, ~6 M5 r  }3 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# Q6 V" B& N  k3 Q
  14. *
    # I! g! }' y0 s$ F/ D: K/ x& N
  15. * This program is free software; you can redistribute it and/or
    * F2 z7 u9 I) \/ H. r8 y# C! D# D
  16. * modify it under the terms of the GNU General Public License as. |7 _) ]6 n+ n& C9 R. {- f7 M. z
  17. * published by the Free Software Foundation version 2.8 k- U2 t. u2 v. D1 P: y. g( b
  18. *
    2 }* G3 ^0 F4 V' G$ c( q/ P; r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 E, s* [5 e4 X8 D1 k9 _) G
  20. * kind, whether express or implied; without even the implied warranty
    $ V. X, c* ^& v( d2 W% O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; g+ f; d. S2 C  v" J, n3 {
  22. * GNU General Public License for more details.
    , _9 f) m* W: |1 t( q
  23. */
    . L# H# U2 w* ^- i- ^  G/ k+ s. @; k
  24. , {  t; V2 z# _1 o- z
  25. #include <linux/module.h>, ~7 i6 x  J* b) \0 ~. ^. ~  R
  26. #include <linux/init.h>
    / ~" l: L/ [) D: b4 t
  27. #include <linux/errno.h>
    5 }4 }; Y- G# s* a9 j* m1 C
  28. #include <linux/types.h>
    ! U& h+ t# I: F1 y* I
  29. #include <linux/interrupt.h>
    6 w) Z  L. V3 C% Q
  30. #include <asm/io.h>% `& G: i: \0 k  H. u- v
  31. #include <linux/moduleparam.h>1 {- C) E3 {& ]2 x, j  ]5 G/ {1 Q
  32. #include <linux/sysctl.h>
    : u( m! V0 }. F
  33. #include <linux/mm.h>
    " S5 r' m8 z- H+ k- s" p
  34. #include <linux/dma-mapping.h>
    ) k5 }( C, I% V' _8 V3 E: `& ~
  35. - J# u8 H5 G7 W* T2 F
  36. #include <mach/memory.h>
    ( r8 g/ w+ q! X. ~$ T0 q8 ~
  37. #include <mach/hardware.h>
    / {8 F% c: E0 m8 y, o0 Q; j
  38. #include <mach/irqs.h>
    + x; _5 L: P1 e
  39. #include <asm/hardware/edma.h>) B6 }  |$ q  ?* ~

  40. ; q6 }: L$ @5 a
  41. #undef EDMA3_DEBUG6 ~4 L3 l7 {  F/ e3 c/ o) G  E
  42. /*#define EDMA3_DEBUG*/5 I7 H6 a. X0 S, e) Y0 E$ J

  43. 9 Q  N9 M: H4 `9 q4 ^/ \
  44. #ifdef EDMA3_DEBUG
    $ C+ m- _" B3 P7 h/ p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): s3 E7 l; e. O6 ]' ~2 [1 G( ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 U8 Y+ L* `5 v2 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 I6 p" `* @  y6 L% m6 _6 w( Z+ A! {
  48. #else4 C. |6 [& v* F( L
  49. #define DMA_PRINTK( x... )5 C! I) Q5 s0 n8 l' ^
  50. #define DMA_FN_IN2 z. C. V! q. I" L5 G+ Q  `
  51. #define DMA_FN_OUT
    ' M4 \3 u- p7 J2 y! c
  52. #endif
    + d3 L% y: j7 |! C" B3 {8 d# d
  53. 8 N5 }; g0 b- R2 c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 A( G- L- [) Y7 s/ E: O
  55. #define STATIC_SHIFT                3
    6 S$ f2 d8 X+ Q% g* A
  56. #define TCINTEN_SHIFT               20
    - S0 O! Z' V6 F# J- ^! j$ d! e3 j
  57. #define ITCINTEN_SHIFT              21
    ; V( d) z$ ]& L8 M& ?
  58. #define TCCHEN_SHIFT                22
    & m, o, [- v- o* [$ n& J, _6 f
  59. #define ITCCHEN_SHIFT               237 E) x6 _3 I) }& a
  60. % P6 m8 P. x6 O; A( V
  61. static volatile int irqraised1 = 0;+ D2 T4 o& C+ `" N
  62. static volatile int irqraised2 = 0;
    5 {* j* A/ A6 p" L7 Y) I0 F8 P9 ]
  63. / a0 i1 M; o% M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; z- `. x7 `5 Q( i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # r$ a6 P$ l. k- E: y9 T/ S7 n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # U$ Z- R# g# y( t! M4 I
  67. ' R6 V( s0 S  E
  68. dma_addr_t dmaphyssrc1 = 0;
    % Y/ b) f- T' F' ~8 j# Y
  69. dma_addr_t dmaphyssrc2 = 0;$ z, T3 p- \& N7 m3 g) x4 U8 G+ a
  70. dma_addr_t dmaphysdest1 = 0;
    ) L/ k- N8 D8 [3 p% i
  71. dma_addr_t dmaphysdest2 = 0;
    8 @7 h. D8 g* A5 Z" O4 K7 q" d& s

  72. 4 y/ K' ^; \  \) G* w/ H$ \0 b
  73. char *dmabufsrc1 = NULL;  I% U) [' L0 ]9 E1 x+ K: \; c
  74. char *dmabufsrc2 = NULL;
    + g0 H' i) F/ A. v/ U+ \
  75. char *dmabufdest1 = NULL;' g' |3 x! Z5 z7 @# ]
  76. char *dmabufdest2 = NULL;4 }+ a' j7 v! J3 F
  77. 6 u1 `7 e9 d( x1 w
  78. static int acnt = 512;
    ; k6 f3 ?$ ^' `. T9 w3 r/ T# E. G
  79. static int bcnt = 8;+ f- [8 g6 X# T* I# k$ `
  80. static int ccnt = 8;
      c( v) }' X3 z/ X. V  Z4 f

  81. 7 j) ^: R$ W  m# i
  82. module_param(acnt, int, S_IRUGO);
    # y& i0 p4 O7 c' w% W
  83. module_param(bcnt, int, S_IRUGO);" {2 k3 B( ^% N2 L3 {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! ]) m- ?2 I8 \# _+ A4 @* [5 b
: ?$ ~. T* G6 o. O* r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 E4 F( g6 v. b# Z& varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 ?4 D- K7 D0 J2 V4 P( F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- W5 Q( m" ^+ f4 r, p

6 R$ m" s9 f  n$ ]; h1 y3 J% i. _; |4 H. K% F9 S7 F) y* l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 05:19 , Processed in 0.038526 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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