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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 g' y4 S% n& I  B2 X
  1. [code]EDMA sample test application6 O; ?# ]$ \- S( U# d/ u
  2. /*
    5 N, l( q& n. I" ]. b/ C
  3. * edma_test.c4 h2 s: b# a* B" g5 U! U  d) j
  4. *
    / W- [# a1 {% @4 R' @* e  |6 x0 H; t
  5. * brief  EDMA3 Test Application1 I3 M; K" f  e
  6. *3 i9 z! B5 ?& O* F1 R- x7 o
  7. *   This file contains EDMA3 Test code.
    ' v- x: k( ^$ u
  8. *0 d5 u: i+ q3 b& R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 e5 T- r; E) B4 L. K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / e# Q4 j+ N) x. @
  11. *         TO CHANGE.1 P$ o* h+ F4 F. `* D, U1 b( _' }
  12. *; |0 g( s& B1 |6 ^4 a1 e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 d' }% a" h4 G/ V1 t# J/ l! V
  14. *
    ' L" B# S3 u9 z( R5 w
  15. * This program is free software; you can redistribute it and/or6 J* T! p. Z0 d3 s- V
  16. * modify it under the terms of the GNU General Public License as
    7 ?% V5 D: j0 E2 Z1 F
  17. * published by the Free Software Foundation version 2.$ ~3 u! t4 w1 E% b
  18. *
    3 W- f$ U8 w4 I( h$ y" c) U9 V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      V! Y, P* C6 s0 U7 S; v/ V
  20. * kind, whether express or implied; without even the implied warranty3 H/ M2 `4 t& p! i( g( u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( c1 Q* H! j6 E* ?( ~- O
  22. * GNU General Public License for more details.1 q- o1 O0 v% |  ]$ V
  23. */% O/ Q$ I5 ~' r4 F
  24.   p! _2 |/ K5 ?
  25. #include <linux/module.h>
    % C4 i" d! S1 q# n3 y
  26. #include <linux/init.h>) h3 D) g9 F) S2 O6 }
  27. #include <linux/errno.h>+ U% r( c! ~! q6 I9 a8 D$ a3 C
  28. #include <linux/types.h>
    / d# X; O* \. D! e& w( @% A
  29. #include <linux/interrupt.h>% N; I+ C0 X% f( y! t
  30. #include <asm/io.h>
    ' y- T2 v6 i2 g
  31. #include <linux/moduleparam.h>: ]2 Y6 I" Y' x2 [% O
  32. #include <linux/sysctl.h>4 Q0 k2 P$ A) m  D& r% G) `
  33. #include <linux/mm.h>; q) Y! `6 ]# ^5 R" s
  34. #include <linux/dma-mapping.h>
    6 L3 h' D2 s% i6 N8 s5 P3 I. B: }# P
  35. 0 M/ c$ S7 l, |: {6 l
  36. #include <mach/memory.h>
    : \0 U1 {! N7 l+ F
  37. #include <mach/hardware.h>
    $ _( c3 v) P* \4 {$ a. w
  38. #include <mach/irqs.h>2 i4 N) u6 O5 U* r  T5 `, A, H
  39. #include <asm/hardware/edma.h>& o! T8 S7 n& Q5 M3 P7 r; r9 L

  40.   ]  U& j: h& g, b  m& N, }2 h2 r
  41. #undef EDMA3_DEBUG6 U4 f, R  R1 U% C' v
  42. /*#define EDMA3_DEBUG*/
    8 l% v: S9 W+ M
  43. + U5 h3 D% F, X; p
  44. #ifdef EDMA3_DEBUG5 E2 f2 @) t# W8 V  J9 _  J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * N! p, E6 p( @! M8 A' Q6 o3 Q. K" F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): `, F& R$ d0 @# f* H$ V4 A. P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ g! y+ M8 [9 m; n8 X1 g& }7 u
  48. #else9 s3 }* _- a8 A' @7 W- f
  49. #define DMA_PRINTK( x... )
    9 C% e9 z& \% ?: q8 t" v& Q
  50. #define DMA_FN_IN5 q# Z0 d0 M" r
  51. #define DMA_FN_OUT
    ' M; E+ F3 z$ p( R! k# w
  52. #endif
    # v; W/ T+ X" h  T8 H
  53. 7 i  D; F. f) L; C1 _- f! `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . T0 W' Q5 n6 Y$ n: g$ d* `4 q: q
  55. #define STATIC_SHIFT                3/ S- a/ T6 ?9 b' d" U/ A. F
  56. #define TCINTEN_SHIFT               20& D6 f0 G( u6 z
  57. #define ITCINTEN_SHIFT              21
    ( q- s- q5 q+ O2 T3 _
  58. #define TCCHEN_SHIFT                229 R! n- k/ e0 l* J7 e% y! T
  59. #define ITCCHEN_SHIFT               23* l, |3 `% `  ^1 u

  60. 2 C$ K- F1 o6 H3 r$ ^' M& m
  61. static volatile int irqraised1 = 0;
    5 D; T# P$ D, a  ]7 _# [, ^, q, g
  62. static volatile int irqraised2 = 0;
    ) |, `% W4 z( [/ b$ R
  63. $ m; I7 Z1 r7 @8 g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" s: t. s2 B. [" a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, E% K2 o$ a3 p4 t) l. S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) r1 Z* }( C& }+ M* w* r
  67. 8 p7 j# [% q' C. H: [
  68. dma_addr_t dmaphyssrc1 = 0;$ D, c1 J- w3 |4 F7 C: x
  69. dma_addr_t dmaphyssrc2 = 0;% n, y5 A. L( k4 k- T/ T
  70. dma_addr_t dmaphysdest1 = 0;/ u  B7 p3 ]7 |+ d2 V
  71. dma_addr_t dmaphysdest2 = 0;
    0 ?4 f9 s( M6 V9 P5 f" S
  72. " t, f' M9 j% `
  73. char *dmabufsrc1 = NULL;
    + Y4 E' }( R# ?, A: t0 B' _/ H6 z
  74. char *dmabufsrc2 = NULL;2 W2 S0 J. a4 \, b" E1 j
  75. char *dmabufdest1 = NULL;7 C6 A4 P/ D5 C4 z1 O
  76. char *dmabufdest2 = NULL;6 \* j  n8 r9 Y# P7 `* d- r" W

  77. ! [6 p; v% _, R: p9 k
  78. static int acnt = 512;
    7 ?/ b& X4 X5 n) ^# l& G/ z
  79. static int bcnt = 8;
    2 F+ L/ S. ^5 i; v' j
  80. static int ccnt = 8;
    " R% E+ m6 Z" M$ V) |* S8 D
  81. : b* l+ I* m! H4 q5 m9 o0 Q
  82. module_param(acnt, int, S_IRUGO);
    % P/ d' A0 O9 v% A; L
  83. module_param(bcnt, int, S_IRUGO);, B: k/ ]* R. T1 d( Z8 K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. i" u3 g2 R% \
8 ^+ Q4 ^$ B' J; u7 u* d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: k- u  [! X, o, y8 Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) |7 s2 A" O8 h  Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ T: _' I4 |) ^9 J' X, x; e
6 C# b& Z( m6 ]7 e6 W: R
2 i2 D8 G, Z8 r3 t. a, O! A, q- x5 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-25 00:45 , Processed in 0.041061 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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