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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 a) c- X5 j3 R8 W6 f
  1. [code]EDMA sample test application8 E6 t3 K3 r) Q8 `7 v+ r; Y  A
  2. /*) P5 ]; G4 h2 M% ~3 T; b* b' P' Z
  3. * edma_test.c/ i+ b, k1 G! e- C3 T/ E; c7 p
  4. *% D) J2 R4 W6 u
  5. * brief  EDMA3 Test Application
    ) t, B' Y$ D6 E/ O* ?5 k8 q
  6. *
    & u# o0 R7 ?2 Y
  7. *   This file contains EDMA3 Test code.! P  d! c/ r) j8 |; |
  8. *
    " K$ s+ J& E- a4 J" N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) t2 e5 L1 ^. {2 Q2 C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 I4 `( s" L& V  v$ z
  11. *         TO CHANGE.0 x0 E  Z: X5 k% v- K
  12. *: w# K( C$ r1 g1 s; t$ s. Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ F( ]/ I7 V; y: e
  14. *
    % Z5 _# D; \3 e& e( Y; w
  15. * This program is free software; you can redistribute it and/or1 m6 n& t* T( P. M* q
  16. * modify it under the terms of the GNU General Public License as2 {* ?5 E( P5 y7 v$ r/ k. j
  17. * published by the Free Software Foundation version 2.$ P- I( ?! ]" O1 Y; N# ?
  18. *( Z- Y/ ?1 C2 Q6 f' `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' p  g4 c+ O! v! Q5 S
  20. * kind, whether express or implied; without even the implied warranty' x& e" K8 A" R7 G: A( R+ D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / I0 Y' V" l, \
  22. * GNU General Public License for more details.
    & ^- L/ L/ }7 m
  23. */! D$ A" G2 F8 a8 M( k) Z

  24. 0 B# a- ?: @# ]
  25. #include <linux/module.h>
    9 _" f" a2 r" z" h* X5 n4 t
  26. #include <linux/init.h>
    5 N" a5 m6 z  J( z9 T9 J8 d2 v6 ^
  27. #include <linux/errno.h>
    8 x, A: J* t! A
  28. #include <linux/types.h>  s  R% O/ r) B' z2 D5 ^
  29. #include <linux/interrupt.h>9 p3 V; D' W: B% F* R' ^& Y6 l
  30. #include <asm/io.h>
    : w( m8 }( }$ L0 y
  31. #include <linux/moduleparam.h>
    & C. ?. g  h, W- P# _
  32. #include <linux/sysctl.h>: u9 h* T% ?( i
  33. #include <linux/mm.h>
    9 N; k% M* \& v" R$ B  C3 c( m
  34. #include <linux/dma-mapping.h>
    9 c$ S- U* @0 {) \; q; o  @% D
  35. 0 s, ?3 d  `" a% ?9 P; J. v
  36. #include <mach/memory.h>( ~. o: l1 M! w, l; S% r
  37. #include <mach/hardware.h>
    2 }* ^% a/ Q/ T; i8 s
  38. #include <mach/irqs.h>
    6 y3 }1 C! ^( z8 N: J/ J. z- T+ e
  39. #include <asm/hardware/edma.h>
    / e1 R+ R. R& M+ P- V. g' H" r! K

  40. ( S2 ~$ ]) `# @( d" Z
  41. #undef EDMA3_DEBUG
    4 f1 \, h# [8 w0 F4 P' f9 c
  42. /*#define EDMA3_DEBUG*/! n0 U5 h. n( w/ B) E. }

  43. 0 ?; J- n+ Z. Q
  44. #ifdef EDMA3_DEBUG
    " N. k9 ~, Z  c; ^* |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 t7 w- q* l% z5 R3 [" }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% @2 `7 k& \5 P: h# \0 R2 \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 ^. m; j0 x) X8 g! Q1 `0 v  ~
  48. #else" {$ B! W: \% @' W3 v: n: m% A
  49. #define DMA_PRINTK( x... )
    5 N, g; \& _& O7 T
  50. #define DMA_FN_IN
    / e/ ~/ m. r) q! R7 S+ J# S' F5 n4 W
  51. #define DMA_FN_OUT
    + D6 T+ O7 r" V* n8 ^) l! [7 a
  52. #endif5 h* x) |6 h0 @& G) K; }2 ?

  53. " @" f: r! m3 I. ^3 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& I1 k& G: E6 g, n' x3 N& ~' J9 g
  55. #define STATIC_SHIFT                3
      ]3 X7 y. n& c- u7 w& A- x
  56. #define TCINTEN_SHIFT               20" X/ h4 [) z8 U
  57. #define ITCINTEN_SHIFT              21
    & V4 m4 C! Q7 r5 H/ F, R
  58. #define TCCHEN_SHIFT                22
    7 c& r$ R# v% S- V9 O, f
  59. #define ITCCHEN_SHIFT               231 H  H: l& p. _
  60. ( F* [8 @& Y: V1 i5 v
  61. static volatile int irqraised1 = 0;1 s! S( z: L# }
  62. static volatile int irqraised2 = 0;
    : F8 E" T4 Q: @6 [) q) U
  63. 1 c9 I8 [; X6 T% J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: f2 |. }8 g( u( g& c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / {! I: l8 i  A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 f3 M& |. O) c1 ~6 n
  67. & Q9 H; e$ r1 h( `2 J3 c* ~1 q
  68. dma_addr_t dmaphyssrc1 = 0;, r/ E3 G3 O9 U5 f) N
  69. dma_addr_t dmaphyssrc2 = 0;
    1 V2 [$ t" m' `+ w9 r1 T6 k
  70. dma_addr_t dmaphysdest1 = 0;
    ! [3 a4 S( E8 x( }9 M" ^
  71. dma_addr_t dmaphysdest2 = 0;7 n+ n* k8 D! M! t
  72. . @+ D* U9 Q, g. b
  73. char *dmabufsrc1 = NULL;1 L- _3 F* {2 [: w+ Q) Y  `
  74. char *dmabufsrc2 = NULL;
    7 C3 C0 r5 j' E. g5 K
  75. char *dmabufdest1 = NULL;
    4 G' D- n; N3 P; f3 s6 h
  76. char *dmabufdest2 = NULL;
    & M: O. y- `* q/ S, T2 \

  77. * {" B4 S  q6 h2 M# d; w
  78. static int acnt = 512;
    2 }- s, u  g) _9 M' B
  79. static int bcnt = 8;
    $ C, J+ _9 c5 y( ]- O7 j
  80. static int ccnt = 8;
    $ ]; g* D5 f+ P9 s1 Y# S

  81. 4 o/ c$ g0 C8 F0 y
  82. module_param(acnt, int, S_IRUGO);5 \' N. {, l" g: [- @; w; y
  83. module_param(bcnt, int, S_IRUGO);
    8 l5 ^% R/ p3 S! X# {* a+ l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& Q" Z% Q* a8 E$ z' A' _; a' o$ e7 ~  A( S! e+ s- }( V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! V+ P( x% w$ T$ g; a% \* D, F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ k' ^, h: \1 z+ o' S2 x* @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ i+ A# ?/ C$ f2 ]5 `' ^
/ G& I0 e0 O  E
7 i- x1 H$ p% X* X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-9 12:35 , Processed in 0.039070 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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