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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) o) Z5 t5 U5 |6 Z- h! l) b$ t& l5 g
  1. [code]EDMA sample test application8 }& p; h! S" ^: j2 x
  2. /*
    5 L6 R3 `( t5 U
  3. * edma_test.c% |7 ]! {/ \1 Y! C
  4. *
    % N  m, S4 k3 G4 G& a0 r- m
  5. * brief  EDMA3 Test Application
    4 ?* x1 S2 g( D& T# ]
  6. *
    * j0 [- |5 k: j
  7. *   This file contains EDMA3 Test code.: G$ F1 E: g9 \- }% E7 B
  8. *- W5 H" n! j0 w2 y% H! B/ E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - j& v9 C; K7 j' M7 q- |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , F- X; l: }: J* ?
  11. *         TO CHANGE.  X: i/ r' a8 T9 H
  12. *
    / D2 p$ p. I( X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 v5 `4 x' V1 Q3 @
  14. *& m. L0 _3 P, g# h* A( N+ G
  15. * This program is free software; you can redistribute it and/or2 ^4 a0 ?& o5 B# Q$ Y# q( m
  16. * modify it under the terms of the GNU General Public License as5 F, c4 a% O  y# c! N
  17. * published by the Free Software Foundation version 2.2 O2 p* L& y7 S" ?9 F
  18. *
    . D  Y* p+ a0 V. H- p& D3 V( l+ }- [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 R- M7 q. M; l" w# p+ y! h5 P
  20. * kind, whether express or implied; without even the implied warranty
    ( L5 F0 Q, Y3 U' q1 A5 |8 D- I6 V: f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( c& L5 g1 R8 b* e
  22. * GNU General Public License for more details.
    / z0 x4 o5 f* X0 m: F0 {
  23. */
    : @1 C  O1 {; F! t- e3 g

  24. ! t& |' @+ a7 l* @) @; ]8 o
  25. #include <linux/module.h>, c8 M! x; {/ I9 |0 c  U
  26. #include <linux/init.h>
    + F2 o% J. N( J5 {, C
  27. #include <linux/errno.h>; R5 M9 |2 v6 O( m' J6 h
  28. #include <linux/types.h>
    6 j9 l2 Q4 H- a' b  W
  29. #include <linux/interrupt.h>
    , L, K5 [, W3 |
  30. #include <asm/io.h>8 ?7 J6 X" B3 u) O' o+ ]
  31. #include <linux/moduleparam.h>' ]6 T% Z: }$ X8 i
  32. #include <linux/sysctl.h># i1 X5 C2 ^; k6 m, G4 ?
  33. #include <linux/mm.h>
    1 v% S5 l" H" b" s; v& [
  34. #include <linux/dma-mapping.h>4 z+ _+ P; ?# z' V( ^
  35. 2 O1 t! @& F; m* {) n" e
  36. #include <mach/memory.h>8 }' {/ T, l( h0 A  k
  37. #include <mach/hardware.h>) j$ Q9 b7 [8 F: K8 d: M* |0 ^
  38. #include <mach/irqs.h>5 h) C, M6 X$ P+ `$ k* |
  39. #include <asm/hardware/edma.h>! A' Y8 W. Q8 t% y# ^; z5 M
  40. # n  m, [8 j8 c& z" O0 f
  41. #undef EDMA3_DEBUG
    1 D8 J$ b- `/ z8 m( K4 s& L; z9 {
  42. /*#define EDMA3_DEBUG*/1 l$ K* _* G% z- }' w
  43. 0 T& C; ?+ i7 f
  44. #ifdef EDMA3_DEBUG
    8 ?# u8 d' r6 M$ K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 @. m& Q: ~3 C4 ^8 ?5 O# m; d3 h: r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) c6 J/ s8 I) v4 U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * o5 F, W8 j* K- D$ ^1 e
  48. #else
    / A  Z0 Z5 S- D- }; R, ]4 b/ F: V
  49. #define DMA_PRINTK( x... )
    ! }' s, e. q3 G" x5 ^
  50. #define DMA_FN_IN0 L+ Y: S5 X! a5 H
  51. #define DMA_FN_OUT
    ! V! Y/ x9 s& j5 p; C% {
  52. #endif
      D: T3 \7 ]5 m' q( f

  53. " f. [- K$ s3 D3 Z2 ~  b, z( f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 ?  T  ?4 N, K  f5 ~
  55. #define STATIC_SHIFT                3
    5 l& I4 d- ~) E+ }  u% [% h
  56. #define TCINTEN_SHIFT               20/ p7 T4 s6 ]% j) O4 E; Z
  57. #define ITCINTEN_SHIFT              21
    7 X! H4 f+ d# h6 S; [8 i# q
  58. #define TCCHEN_SHIFT                22
      u& N3 Q+ G2 I+ q; q+ N* [# g
  59. #define ITCCHEN_SHIFT               23  Q" Z+ }5 N6 k: N% C# X7 S

  60. ( u0 a3 L7 ]" A  g) W
  61. static volatile int irqraised1 = 0;1 V6 g% Y3 l  k6 ]
  62. static volatile int irqraised2 = 0;, T) v6 c; O: d/ x, H- x( X; M4 U
  63. ) h1 _+ M9 Y" ?3 U5 s1 s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 p: T/ \$ K! C! p2 H. {! t" Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # E* k( w4 \& i* C% o/ w& i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & F6 G" M1 [) ~5 U1 Y9 j
  67. 5 t+ C3 a3 j) t- p! i& `; V
  68. dma_addr_t dmaphyssrc1 = 0;
    1 G8 k9 w; B* h4 I5 v! i, _/ ~
  69. dma_addr_t dmaphyssrc2 = 0;
    8 L8 J, w4 L1 i8 f0 F. n
  70. dma_addr_t dmaphysdest1 = 0;' M/ i5 G9 z7 \+ Z. Z4 k
  71. dma_addr_t dmaphysdest2 = 0;
    5 R2 d$ U% G+ F; A& @

  72. 3 @* p! e8 R. ^
  73. char *dmabufsrc1 = NULL;
    4 N7 V) ]" m+ [8 o7 Z9 N
  74. char *dmabufsrc2 = NULL;  ^8 i1 V. I2 E
  75. char *dmabufdest1 = NULL;, D( f3 t; j/ J7 E2 S
  76. char *dmabufdest2 = NULL;
    1 K1 I( Q5 q, e0 d; q, D

  77. 7 _5 I$ M! f* V1 D+ R# Q, E
  78. static int acnt = 512;1 G7 i5 k8 B* O! |* ^1 s6 [- o
  79. static int bcnt = 8;
    ) d/ L, O7 @1 a0 s- J
  80. static int ccnt = 8;/ W, _3 ]7 w3 k& I9 o$ B1 ]9 B, a4 H4 G

  81. : f& W- J6 }0 N% f) ^6 b
  82. module_param(acnt, int, S_IRUGO);( s- e3 |* N! g  Q$ [
  83. module_param(bcnt, int, S_IRUGO);: n# `; m0 S% U2 l! b) N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 ?! m1 o6 t9 o8 f! s& u. W* I: {5 j) J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& c3 l+ b- d# k) ^/ K0 Z, D. Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  f# M+ z6 u3 H4 W  y  A/ M( c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" {, p+ v9 a0 D" }8 t8 o! H/ B( \; {/ m- T% d/ T+ l

+ ]8 a% Y/ L3 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-21 18:00 , Processed in 0.043082 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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