OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! ^# I6 {) }$ \3 S8 O7 m1 F
  1. [code]EDMA sample test application7 ~8 s. y) d: |: ~# M3 D# o5 D
  2. /*
    6 o) J& I+ P* v) G+ ~4 N+ _+ N
  3. * edma_test.c
    6 z' S0 T3 O- @$ n- G
  4. *- n. I8 |9 s2 R7 B- J+ B5 T7 z
  5. * brief  EDMA3 Test Application  e3 X( b( s2 u3 J6 E- `4 B
  6. *
    & O) S  m! c# K. D: c2 Y& U# d
  7. *   This file contains EDMA3 Test code.
    $ R( p) q' x4 z5 R
  8. *
    7 V& \( U* }7 E4 a0 H6 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* W& _5 A! p+ M- V; H. G& I& C: W" b6 R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) u. ]0 q( \4 _: `! ?1 ^
  11. *         TO CHANGE.
    9 ?! y! Z  s! @, T0 L% Q
  12. *9 I2 W9 j1 k" ]* k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; R) B1 l0 z* d( }
  14. *
    ) k3 f; h9 a. r& ~2 j
  15. * This program is free software; you can redistribute it and/or# F) R# T- {+ A" _. _
  16. * modify it under the terms of the GNU General Public License as
    - n: z( H* F8 E. _) i
  17. * published by the Free Software Foundation version 2.3 C& O& ^  n3 x7 ^4 q9 o3 n% q
  18. *0 ]: ?3 f: m+ i9 v# O; [# v) M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / T% p% k/ X. c' d* @7 H
  20. * kind, whether express or implied; without even the implied warranty
      I4 h) V: q/ W1 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' D- J0 {; Z, J9 p4 H. M
  22. * GNU General Public License for more details.
    " h& Y; R1 E# x8 c$ `$ H  g0 Q, I
  23. *// _) ~- p5 A/ l1 s$ V
  24. # s. Y: x# N/ K' A$ h( Z# {* w
  25. #include <linux/module.h>
    2 B  e3 c* b) j* S- m6 H+ t
  26. #include <linux/init.h>
    8 v. Y" L0 v' g, N$ q
  27. #include <linux/errno.h>5 i3 K0 P3 z) f
  28. #include <linux/types.h>" m' H- s- z) g
  29. #include <linux/interrupt.h>! I9 E5 P$ z- ]+ ^2 [
  30. #include <asm/io.h>
    0 x7 A" {  r* T! k4 g* ?
  31. #include <linux/moduleparam.h>7 I% B; t' F/ b+ h- w
  32. #include <linux/sysctl.h># B) G" Z) b* b9 m/ Z& Z5 y
  33. #include <linux/mm.h>
    2 k0 o4 p6 r! t& W2 C4 c) Q. q# u
  34. #include <linux/dma-mapping.h>' _; V) V8 d4 w, g. l

  35. , k7 H$ ~1 ~( P/ u
  36. #include <mach/memory.h>
    2 L2 A0 A) e* c/ M" \& |
  37. #include <mach/hardware.h>
    . Y, ~2 g8 O2 A& g
  38. #include <mach/irqs.h>1 N, A- A! Z5 O$ y) M) ~' v: k
  39. #include <asm/hardware/edma.h>
    4 l/ ?/ u& v, ?* m, `0 L6 f
  40. 3 C9 L9 H& C% p2 L. d5 `
  41. #undef EDMA3_DEBUG
    + X& ^; Y4 ^4 F: {" T( s" J
  42. /*#define EDMA3_DEBUG*/4 Q/ E1 N- b9 s; K  g
  43. 6 l% z# N& ^, ^$ U6 ~9 O+ p* C& h. p
  44. #ifdef EDMA3_DEBUG
    * ?! _5 e3 C9 E: Z, j7 a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ {/ D$ s/ p% V0 S4 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): R" k' p! h% D. F& Q+ l/ {* X/ D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): V9 \7 w2 P( O0 X! r& g- N
  48. #else- f" `5 s7 s3 R9 o. l( j4 ?
  49. #define DMA_PRINTK( x... ), r+ h/ z' t, w$ H
  50. #define DMA_FN_IN) s, Y4 [% s/ k# W" |
  51. #define DMA_FN_OUT
    . S( l6 G; O+ I
  52. #endif: N  g$ I) ~% v/ p' m6 r

  53. 6 o) c; ]5 m6 u0 m4 Y; _- g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " F9 b1 I1 c3 G
  55. #define STATIC_SHIFT                3
    2 d% }6 f$ |- _9 B
  56. #define TCINTEN_SHIFT               20  t7 A$ y5 t6 ^- L! X
  57. #define ITCINTEN_SHIFT              21
    - ]6 f# w, h' {. H7 N; R
  58. #define TCCHEN_SHIFT                22! Q7 e6 ]# u7 s* e, S9 E" A
  59. #define ITCCHEN_SHIFT               23
    " v- ?6 d( j+ {6 L! D; _  b
  60. 2 S" b" U# o' ~# k! [
  61. static volatile int irqraised1 = 0;; E6 B; x8 u3 e
  62. static volatile int irqraised2 = 0;
    ' F: z4 O* b0 |/ ~8 D
  63. / _7 e- s; C% V3 G8 J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ^2 b/ h6 x5 V' Z2 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . l. P" b& O! Z5 `- [8 e4 `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 [7 w  p% L7 [9 t

  67. + [6 G9 U( e% J6 b
  68. dma_addr_t dmaphyssrc1 = 0;
    , b+ ?* Z$ J& P  _# [
  69. dma_addr_t dmaphyssrc2 = 0;
    3 p* g' B$ D4 l9 E, p0 k
  70. dma_addr_t dmaphysdest1 = 0;6 ^; z3 t0 p6 y) \4 o1 @3 `
  71. dma_addr_t dmaphysdest2 = 0;
    : x# e0 w' l, H: _' l( y0 }% g8 R! p

  72. # X; q9 ]& b1 K
  73. char *dmabufsrc1 = NULL;
    7 C; I7 A" s) u: P) b" c* w
  74. char *dmabufsrc2 = NULL;
    " V& F! f1 I( ^, t% A  |/ L0 O
  75. char *dmabufdest1 = NULL;* h) M- U2 p" z/ M6 k
  76. char *dmabufdest2 = NULL;' C1 Y) _3 F) S+ B9 X

  77. . \9 p( S! m  e( Y8 D% }0 W. x* b
  78. static int acnt = 512;& a* j9 y4 b8 @& W# ?$ p
  79. static int bcnt = 8;, Y5 z- e- i, A# q
  80. static int ccnt = 8;9 x  W- ~- Y; o) L4 k
  81. 5 T: t/ E# B. M8 g2 v. p7 p
  82. module_param(acnt, int, S_IRUGO);! x, o( ~2 ^$ p7 |" L* y# H5 {
  83. module_param(bcnt, int, S_IRUGO);/ h6 b" u) u$ ?& z+ R4 t; p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: X. P% _' l, Y4 y6 s  l
$ h: B/ g% ~# U, N" D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 d# }) I- H# K3 S  M: s$ c+ c. Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* e6 m3 t' e0 m  w     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 b" t4 |, P, i" S/ u; T9 @, `) X% Y
1 P+ k4 R3 l9 e1 P! a' ?# L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-14 17:43 , Processed in 0.035499 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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