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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. e5 g3 }  s% U1 @1 ~9 Q. |
  1. [code]EDMA sample test application
    : u/ {4 R+ i" c  O
  2. /*& `% a6 A4 k  k1 l: L* _
  3. * edma_test.c  N4 |3 T9 A" Q$ Z7 e: L
  4. *
    " j+ i+ h0 ~  Y# a# S3 ~- ]
  5. * brief  EDMA3 Test Application
    4 r) R: E" I8 H6 y* S* t" Z2 ?
  6. *, z. ]7 r0 m0 K$ K0 ~. K( O
  7. *   This file contains EDMA3 Test code.6 l( a' H0 P1 R% P6 ~
  8. *
    8 ]2 Y0 a4 l, U( `  O" ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( K# d/ _+ |/ @( Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & }4 [9 T1 P$ o" V, X
  11. *         TO CHANGE.  D9 ~8 y" V2 x1 i
  12. *
    $ N# J; C( `+ m0 g2 I9 D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" E- G5 g* D9 S# V
  14. *
    ( z" J7 W9 _) f" J4 ~, f
  15. * This program is free software; you can redistribute it and/or
    % H) x/ F0 D5 E% ?$ F
  16. * modify it under the terms of the GNU General Public License as
    : g( I9 e7 K$ Q' p1 N2 P% n& J
  17. * published by the Free Software Foundation version 2.
    - N& N" r: X% @, ?9 o" r
  18. *
    * ~: F& I) r/ k) e3 _- F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ A$ ^5 O5 m' b
  20. * kind, whether express or implied; without even the implied warranty& g: J7 n1 {" Y6 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, ], r: D9 C8 z
  22. * GNU General Public License for more details.3 d% v* \8 T* h' f8 z9 u/ ?7 \8 o
  23. */- _! k3 z% z: J' {3 h3 O
  24. ( n  V& @) T5 [  S* U" h5 H
  25. #include <linux/module.h>7 Y/ C& @7 @3 i
  26. #include <linux/init.h>4 S8 q- [) X! v5 b& x4 S
  27. #include <linux/errno.h>5 d! D6 x5 U+ O: z8 S
  28. #include <linux/types.h>1 ~9 n) S+ R8 P, m- m1 x
  29. #include <linux/interrupt.h>* \) |# L# M. \9 q+ U8 N1 O8 N9 j
  30. #include <asm/io.h>
      ~0 w6 Z% k; ?( a
  31. #include <linux/moduleparam.h>( r. C9 M6 \+ Y! T- o  B* r
  32. #include <linux/sysctl.h>
    / f* q) T4 `- Y% _8 O, z6 f5 _
  33. #include <linux/mm.h>! P5 `3 C( T) T
  34. #include <linux/dma-mapping.h>  t# g+ X5 z8 l. i0 M) A" L
  35. ! g/ D% J2 o, H# H6 r; Q) u0 V
  36. #include <mach/memory.h>
      @! p9 s% _8 @* [; l
  37. #include <mach/hardware.h>
    4 i1 q5 C1 w9 S6 c+ U  k
  38. #include <mach/irqs.h>
    9 h+ V9 z+ Y! x
  39. #include <asm/hardware/edma.h>
    ! q/ ^* ~0 J& j
  40. / v, _2 j8 K' a9 e7 Y7 ^
  41. #undef EDMA3_DEBUG
    / _. R! C3 v, l! W; w% l
  42. /*#define EDMA3_DEBUG*/
    + ~, L" d# H$ d" D! U
  43. ' d. a6 ?/ u0 ~1 g5 w! Y( Q8 E
  44. #ifdef EDMA3_DEBUG
    ) K6 p9 M$ w8 P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 a- i# \1 h3 Z3 k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) y9 {2 }# ]0 j$ L' K: Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - u8 H! E* C5 {
  48. #else
    " W) B! M$ N- ^2 j
  49. #define DMA_PRINTK( x... )
      s: l. F' y9 E# s5 c. C
  50. #define DMA_FN_IN2 K( r) x: t: q
  51. #define DMA_FN_OUT
    4 X" o0 r9 F! ~7 z
  52. #endif
    & C8 T4 X7 ^& ]

  53. . q4 ?0 P9 v- g. h* d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 L% J; Q/ O: l
  55. #define STATIC_SHIFT                3
    5 Z& {( E( H# k- T9 N
  56. #define TCINTEN_SHIFT               20
    0 q7 S1 u* @# g0 B
  57. #define ITCINTEN_SHIFT              21
    8 E' n. T5 s4 Y- U9 @/ X
  58. #define TCCHEN_SHIFT                22
    ! u8 P4 N% j/ K% Q% {
  59. #define ITCCHEN_SHIFT               23( h" {: I5 N4 e# S" j" T/ b, s5 y

  60. # e1 v$ d5 W* L$ b) K0 D2 Q
  61. static volatile int irqraised1 = 0;6 t: E# p% |# A0 j$ _
  62. static volatile int irqraised2 = 0;$ j$ L: Y. ?7 ~

  63. - _% y: O! T+ z$ m. Z0 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 f0 W9 ~4 j, }2 H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ T4 `" S( Z6 A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 b& I" o- G+ A, x
  67. ! `. n* l/ j) u$ ?
  68. dma_addr_t dmaphyssrc1 = 0;
    0 Y) P: _  j* \1 M  n  e
  69. dma_addr_t dmaphyssrc2 = 0;
    - H2 o$ W6 A$ N5 A6 `& w; y; j
  70. dma_addr_t dmaphysdest1 = 0;& B' Q9 H* ]: Q8 I& J$ M
  71. dma_addr_t dmaphysdest2 = 0;! c. c/ r. z' c! U, b0 O" G

  72. , \$ T& q/ x+ o" {
  73. char *dmabufsrc1 = NULL;- K& j- m+ o+ n! r
  74. char *dmabufsrc2 = NULL;1 a, m* _& P0 D; M% |
  75. char *dmabufdest1 = NULL;
    ( F) z& u- v! o3 F1 S! ]
  76. char *dmabufdest2 = NULL;
    ( {" W2 D' ?8 s+ }7 u. |

  77. 2 D- b3 Z" t+ z' a
  78. static int acnt = 512;8 x! C- P. d' _
  79. static int bcnt = 8;- V, ~6 c# Y' ^% F( u5 F3 Z1 U
  80. static int ccnt = 8;% l3 M2 L3 y2 o, W) L$ C( }' {

  81. 4 B5 j8 l. a9 {& W( m
  82. module_param(acnt, int, S_IRUGO);
    & N. B7 q( G6 k0 X+ g
  83. module_param(bcnt, int, S_IRUGO);, t8 S+ n. ~7 l0 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ X# O8 }8 l$ T3 h' J  U  f+ j- N+ O& b
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ U5 K" r6 J+ O7 f# K; d4 y. b$ uarm-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 d- Y# Z6 }1 P8 T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  Q  \' o  r/ D  m! z' K2 B* ~0 V9 G' w: q9 q# V  j! ^

5 n0 f2 B3 e' o5 ^2 u! b. f& j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 16:28 , Processed in 0.039803 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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