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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% y; K3 y: c, b+ D, V
  1. [code]EDMA sample test application
      r8 I! K# H3 I$ _* W+ Y
  2. /*" M/ \" z5 D5 p
  3. * edma_test.c
    4 z  u8 B- y7 W7 H  ?( E) H
  4. *# |3 u7 |+ Z' X4 p$ S
  5. * brief  EDMA3 Test Application$ W6 d8 x* r' j& e
  6. *
    ' s& i4 c( S1 l! }6 P
  7. *   This file contains EDMA3 Test code.1 i# X( C% h9 p% q4 W
  8. *
      I! }: Z& q8 f% v6 e- O5 h8 {/ a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % S1 ~. G$ c& |$ ]# o% c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. d: X; b: }4 z- y
  11. *         TO CHANGE.
    3 Z* E" A/ l' _7 }
  12. *
    6 j: q  ?3 F& ~6 M- K6 F5 X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) n: Z( v- C. C2 F1 X
  14. *$ ^5 ~" j2 j; q6 v' Z
  15. * This program is free software; you can redistribute it and/or
    ) v: B, q+ ^( v, w
  16. * modify it under the terms of the GNU General Public License as
    & J2 C2 D7 s9 J, X# M# F/ L
  17. * published by the Free Software Foundation version 2.
    & i) V. H& A$ [8 s! \& i; u
  18. ** n# i' a1 [) y3 w$ |1 H# v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 r- e0 E0 i% R3 z2 l3 q
  20. * kind, whether express or implied; without even the implied warranty
    6 `( }* c" t/ O3 V2 d+ G8 C: X; v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " [* e. o+ B6 s3 C$ {% _
  22. * GNU General Public License for more details.
    + x. b1 [8 G8 L+ y8 V6 B
  23. */
    % L3 x# c0 R  `% y! j

  24. - K+ M/ F4 U# [& |) E
  25. #include <linux/module.h>" F, x" L/ }7 R" T( w! Q
  26. #include <linux/init.h>2 `$ R5 Y/ g+ c2 ?7 J) Z! D4 ~
  27. #include <linux/errno.h>% D$ d2 T4 j% s2 Y$ s: b! c
  28. #include <linux/types.h>
    ) |, ?8 F1 V1 r
  29. #include <linux/interrupt.h>3 X, s2 C' r) I
  30. #include <asm/io.h>) p* F+ f8 f: b( c6 A' [) x" g
  31. #include <linux/moduleparam.h>
    ) e/ v& ^1 y- m6 m
  32. #include <linux/sysctl.h>& _) I8 C. M& _2 u2 u( b
  33. #include <linux/mm.h>
    3 M& T! W. E% P: }* a% ]2 v
  34. #include <linux/dma-mapping.h>
    2 E& B) q" q0 B7 x' m
  35. + S  z; ]" x6 Z6 Z2 y6 g5 }
  36. #include <mach/memory.h>& U) W2 C9 h8 x
  37. #include <mach/hardware.h>4 \* e# K; o8 H" F% n% P/ K$ W
  38. #include <mach/irqs.h>2 s6 p. n: K! x; y# Q8 {
  39. #include <asm/hardware/edma.h>: A# ^7 N* F) f* j" f

  40. 3 v( Z9 h; k/ f
  41. #undef EDMA3_DEBUG
    4 J6 G, J2 ?9 {2 s
  42. /*#define EDMA3_DEBUG*/
    6 S* ~! X# N: `8 _6 I

  43. 8 _; a7 I, Y% |" @& g! m
  44. #ifdef EDMA3_DEBUG
    & R. G  a" f- Q1 j) H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! w6 H) N, Z3 [- G$ `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 j/ @+ T" l0 Y/ g# Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) `3 Z  s* z% w- N( S& T% Y6 \
  48. #else
    " M+ t: T3 i9 S# ^; M9 V
  49. #define DMA_PRINTK( x... )
    * E. m& H# T: G
  50. #define DMA_FN_IN' v. w+ t# M. P: s9 {8 E; P
  51. #define DMA_FN_OUT$ J0 @8 D$ I# B  H2 P
  52. #endif6 ^! C0 B. D. V0 B* k* h

  53. 6 \- g8 M" S( F, ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; [3 D! l  |+ s0 _3 @8 j% H" P
  55. #define STATIC_SHIFT                3
    # R2 z# t- @0 l* |* z* J$ ]
  56. #define TCINTEN_SHIFT               20
    3 }; Z+ k" z, }
  57. #define ITCINTEN_SHIFT              21- w: ]  ]* A5 B7 G
  58. #define TCCHEN_SHIFT                22
    7 {: c8 h. B1 N7 n$ A5 K
  59. #define ITCCHEN_SHIFT               234 L8 G3 `( c6 n; P& R! M

  60. % f, U+ z, z# c: }8 K6 N; t
  61. static volatile int irqraised1 = 0;+ m9 b7 ?4 ]3 F* x0 i' l
  62. static volatile int irqraised2 = 0;, q) [- k6 Z/ I7 D8 y: d4 O
  63. 9 ]: o: v: n! ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 N2 o, E. V( z, q8 y, n' l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 T" B8 w+ C7 E% @0 }% d! b. V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ d! u# p9 }% B+ a) ~8 f

  67. , u- M! g5 l% V- ~* |& W* Y
  68. dma_addr_t dmaphyssrc1 = 0;
      f+ t  O# L- R" d
  69. dma_addr_t dmaphyssrc2 = 0;4 R  F8 j, r: _: J
  70. dma_addr_t dmaphysdest1 = 0;7 B( J) [/ K) O6 m5 S
  71. dma_addr_t dmaphysdest2 = 0;( W+ H% Y" |; K% g/ K0 v

  72.   k4 P7 L) ~! f7 J* e4 c
  73. char *dmabufsrc1 = NULL;2 Z: @6 }* k( r( @
  74. char *dmabufsrc2 = NULL;" T) s* l! r2 P
  75. char *dmabufdest1 = NULL;4 F7 I! O( f% K% c
  76. char *dmabufdest2 = NULL;7 S! ^2 C  U5 L1 t/ c  [! P
  77. ' ~) ^- B, g2 R# |
  78. static int acnt = 512;
    % d' K: B/ u6 S
  79. static int bcnt = 8;; n# d/ |; I4 t
  80. static int ccnt = 8;/ G: t# K% I( H

  81. ! U* ^  x. R7 b- c: R
  82. module_param(acnt, int, S_IRUGO);
    : |2 ?- T4 T" Q4 Z8 f4 S
  83. module_param(bcnt, int, S_IRUGO);# G, c6 L1 n& R* D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 L/ S+ @. @9 N6 U$ T2 C/ }: q" H' T( O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% U; c2 F5 F* V. R0 [$ V; N, Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 j* f+ {5 r* B0 z- d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! v; s* E) }6 z( H& t
: P6 z  e! X3 s7 t
/ b; b0 B* F+ A9 z6 J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-1 12:28 , Processed in 0.044466 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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