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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 K; k! E1 h: L" x( k
  1. [code]EDMA sample test application
    . j9 A8 ?0 H/ M2 d. ~
  2. /*
    ( H  E/ p6 N3 U9 X' x* N/ D$ r
  3. * edma_test.c8 I+ s: v) ?( \4 I5 u
  4. *
    : E) o7 F) r5 |0 z) h
  5. * brief  EDMA3 Test Application, S3 T4 l* H7 [! D& e
  6. *" M$ `. w+ M5 E/ C
  7. *   This file contains EDMA3 Test code.! x2 Z/ |* N3 s% U, B& p: k! _
  8. *: W. x; f# X. }2 ]3 D: o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 |0 ?2 Y# [) S- F8 Q5 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " a6 c8 v" Z5 y( F
  11. *         TO CHANGE.0 `- \' _& u% J
  12. *
    8 R, b. ^' Z/ i2 l1 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" W& _. t% i6 w1 a
  14. *
    ) m1 v6 K5 F1 y' g9 u1 Z7 U5 L
  15. * This program is free software; you can redistribute it and/or
    0 L( A# E# B. R1 E9 b7 m2 j) V
  16. * modify it under the terms of the GNU General Public License as5 |' m) p8 q, Z3 o. F; _$ B
  17. * published by the Free Software Foundation version 2.3 Z* J; Y9 z; |' n8 n0 e) Y4 f: b
  18. *
    5 M$ p! v: c9 ?* N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; B* d. N9 h( T# J# R
  20. * kind, whether express or implied; without even the implied warranty( N5 n; F$ R% ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% N+ H& J- n- B2 p. s
  22. * GNU General Public License for more details.' D0 s* i) w" i, z
  23. */
    0 ]: z- e) J" N* u
  24. 3 u% z+ K8 `  w- h- ?' e: @
  25. #include <linux/module.h>
    5 E, n, k4 K' L
  26. #include <linux/init.h>; U/ D2 C8 [/ [0 j( h! m" g
  27. #include <linux/errno.h>
    3 W8 Q, O: h1 a
  28. #include <linux/types.h>
    " {  N+ S/ {/ H" `, |7 l
  29. #include <linux/interrupt.h>& K( V* E# M4 A( ~
  30. #include <asm/io.h>" ?2 T5 Q! r2 \; P3 _6 Q. O
  31. #include <linux/moduleparam.h>& J: t- P/ _. n6 W
  32. #include <linux/sysctl.h>
    / Y1 x+ Q- x6 t. ~3 k, }+ N: ?
  33. #include <linux/mm.h>/ H" K8 p& J* F5 ]4 T
  34. #include <linux/dma-mapping.h>, t) m  B! ]' W: }, |

  35. ) a; b" j9 G  r" ]* j, F0 b  {
  36. #include <mach/memory.h>
    ! F7 S; ]( `2 o4 {- \$ q/ u
  37. #include <mach/hardware.h>
    8 T& S* z% ]# Y) |7 w
  38. #include <mach/irqs.h>
    ' b/ W" {8 }1 w( R
  39. #include <asm/hardware/edma.h>
    0 v, w% j4 }/ r5 q  Q7 M; x

  40. - H- B, s2 d- ~# ]
  41. #undef EDMA3_DEBUG& c+ N# U) t2 o. D4 U
  42. /*#define EDMA3_DEBUG*/
    # }1 x$ \" F) f7 W
  43. & I# f/ W" R" u3 P4 q2 W2 T, F
  44. #ifdef EDMA3_DEBUG
    8 |4 H9 l! [) t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 `7 {" x( }, l0 ^# c$ A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! n' ~- f7 T' ^; s, V. e" N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  o- b9 f6 E3 @9 b0 q
  48. #else
    % _; q; ?, V4 }: F  K
  49. #define DMA_PRINTK( x... )
      K: A9 }6 a) }$ k3 q% t* e4 F
  50. #define DMA_FN_IN
    ; w2 D' r3 {: K8 J
  51. #define DMA_FN_OUT- v1 g" ]: t: M+ n: M& X# Y
  52. #endif
    7 F/ r+ G0 N# E; n
  53. 6 D0 o8 j: p+ Z/ O- Z: M; q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 o5 M$ R  w! h/ |# z
  55. #define STATIC_SHIFT                3% l( h& E: F1 V* t
  56. #define TCINTEN_SHIFT               20, Y- i+ @( K. b
  57. #define ITCINTEN_SHIFT              21
      @' w1 s4 ?# ^2 e4 s6 j+ H
  58. #define TCCHEN_SHIFT                22
    & R# p7 k: W' r* |# L" R
  59. #define ITCCHEN_SHIFT               23
    4 P/ k0 p' H( R  J6 i# p
  60. 2 y) F+ t) c% ]) @5 y
  61. static volatile int irqraised1 = 0;
    # V7 t' J' K$ V( A
  62. static volatile int irqraised2 = 0;7 k$ t, Z# r) _5 ~6 _) t

  63. # W# `5 V9 V- }( I2 I" ~* N; J3 F6 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 G+ K5 l3 a/ a# a( j! T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ p0 a: n/ Q+ g% g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  R) C0 X" n- q" S
  67. : F  f# A& G! {6 x" F6 d; m. s
  68. dma_addr_t dmaphyssrc1 = 0;
    : b: X( p, a; h) [0 g+ I! Y
  69. dma_addr_t dmaphyssrc2 = 0;/ s+ E4 @; V; l6 Z$ l7 I- Q
  70. dma_addr_t dmaphysdest1 = 0;
    ) l1 k7 }" W5 N7 H; d
  71. dma_addr_t dmaphysdest2 = 0;9 W9 I9 L; Z( G+ f/ o
  72. & {. t' a7 s- F3 K3 ~9 i, m
  73. char *dmabufsrc1 = NULL;4 V) K" v1 \& O7 k$ v
  74. char *dmabufsrc2 = NULL;
    7 N% o5 E4 C$ I$ B' ~" X: e3 G
  75. char *dmabufdest1 = NULL;+ A: ?2 O& z( Q# B3 `( w) M
  76. char *dmabufdest2 = NULL;$ i% _! M8 Z9 G

  77. ( {0 p. c1 S7 Y
  78. static int acnt = 512;
    8 D; P, m3 x( d  ?
  79. static int bcnt = 8;+ O& [: h: ^2 [
  80. static int ccnt = 8;' J" B9 u2 G+ ^

  81. 7 a: h% h, |6 i4 S8 u
  82. module_param(acnt, int, S_IRUGO);: r- B0 t+ H; M, |
  83. module_param(bcnt, int, S_IRUGO);, M+ f) K: S- r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, {: I+ L. s( v2 B4 A# N: o: d6 s2 b9 ]3 z0 J+ o8 T, D  w8 k2 M5 d7 u" M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, `, k: s8 ~+ E! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, H8 E% J' Z) ]- T8 I8 f4 `& |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 L5 b3 D, F7 ?9 O
# v% M7 H1 B6 a- A) N

1 N+ Y! Y. C: e  d# K* m' a0 r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-12 05:14 , Processed in 0.043396 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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