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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, f( [) J# w2 c, \: N
  1. [code]EDMA sample test application
    6 u  f# P8 a- J- h3 b0 e. ^9 L3 d" G% _1 d
  2. /*
    . Z- w/ |2 T2 \
  3. * edma_test.c; _7 n) I8 b0 ?; B0 q- r3 e+ U
  4. *
    . b" F$ c' F9 E$ g
  5. * brief  EDMA3 Test Application+ y# f6 D' a, s- f* O
  6. *
    ) `  a/ L4 @% P6 \3 V! I
  7. *   This file contains EDMA3 Test code.
    1 E# O9 Z; Q3 _% \
  8. *
    6 N9 _. @2 A7 Q! e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& F' [$ [6 b& c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ ?: \" K3 L# i' \' |
  11. *         TO CHANGE.! p6 p) F2 P2 i; F! a2 Y( S
  12. *
    / [# j8 n& }% W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : I3 i, R0 D/ Q  j
  14. *# f& j5 j+ e7 I5 O6 ~' F+ n( z
  15. * This program is free software; you can redistribute it and/or
    / Z! o) e( e  o1 o4 O0 i3 _
  16. * modify it under the terms of the GNU General Public License as  Z; _, t; T4 O0 N: O
  17. * published by the Free Software Foundation version 2.3 I: B" G8 b3 D" K
  18. *
    6 Q  B( H# q7 q. a0 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; n. P# z; @/ t5 r" c& f  C+ Q1 c
  20. * kind, whether express or implied; without even the implied warranty2 k$ ~% C! d% M1 ^1 ^6 ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 P2 a2 b" c8 R% N; W# ]
  22. * GNU General Public License for more details./ U( z4 i6 K$ i2 j* t0 G+ `; g
  23. */& w7 p$ L! e9 z' V) Z

  24. " g* z* k! _5 U
  25. #include <linux/module.h>5 q6 S3 w) L) l! n5 A
  26. #include <linux/init.h>
    9 Q3 h7 p2 Y8 I- F0 T3 _
  27. #include <linux/errno.h>
    2 H' }6 A+ V2 p3 ~$ ~  |$ [
  28. #include <linux/types.h>
    + Q( y& A' ^% t: ~
  29. #include <linux/interrupt.h>2 a2 g7 [- Y# N# v0 o
  30. #include <asm/io.h>
    0 g/ ^$ x( n, N& h' I
  31. #include <linux/moduleparam.h>! v: p9 ?% {8 A9 B# r
  32. #include <linux/sysctl.h>
    : C3 e% Z) \3 Y# ?& m
  33. #include <linux/mm.h>3 J9 l, K; n" e$ k) G) z1 b5 [
  34. #include <linux/dma-mapping.h>
    6 Z" d1 l- u8 }+ _2 i
  35. 0 c# t1 t9 Y# l  l$ \# W; }2 I
  36. #include <mach/memory.h>4 ^( q  s& h: z( r- [3 n
  37. #include <mach/hardware.h>. N4 M- K7 E6 }/ U
  38. #include <mach/irqs.h>& q+ w5 a# e7 k
  39. #include <asm/hardware/edma.h>
    2 y$ u: ?* U. I! Z' i# |

  40. % n  E6 Z+ M- L; z2 J
  41. #undef EDMA3_DEBUG
    & e5 ]/ T6 i) @7 C, B5 N+ E( g
  42. /*#define EDMA3_DEBUG*/* X& ]8 O" a) ^& n
  43. # \* f' u$ u, u5 |, ~: b' ?  b
  44. #ifdef EDMA3_DEBUG8 O2 m2 B6 F9 n9 b, L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % |- \% x/ x% C/ h6 r3 ?0 C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . H  d7 E8 s! ~: ]; \, }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 o5 g1 H" C  i  g- C
  48. #else% r( ~  M& i9 q
  49. #define DMA_PRINTK( x... ), @' M6 g5 Q; q& d( K
  50. #define DMA_FN_IN
    % h/ L/ j% O: n1 x3 C) c1 Q. s
  51. #define DMA_FN_OUT
    4 L2 S2 x7 F7 L- F4 z2 V8 c* o- ]
  52. #endif4 L/ K( g- ~, C7 c2 M% c0 T1 \
  53. / @$ m  J) Y2 w, P. U; p+ Q! S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 W; W1 V1 n( Y7 E' ?9 |+ y
  55. #define STATIC_SHIFT                3
      |* I* Q+ O6 q& _$ J" I
  56. #define TCINTEN_SHIFT               20
    $ T& J' j" `/ N- ?& f2 Z
  57. #define ITCINTEN_SHIFT              21
    0 t6 z+ W, Y: B, D* x) J/ Q
  58. #define TCCHEN_SHIFT                22
    9 Y, P7 ^2 ^# Z/ |. _
  59. #define ITCCHEN_SHIFT               23( j0 U5 U6 B- e/ K" Y
  60. 1 P* E7 U' s: b; f" k+ K. M
  61. static volatile int irqraised1 = 0;
    & c$ M" o% t7 F$ q
  62. static volatile int irqraised2 = 0;. h8 @) @0 p) |5 W& Y% a2 h  l0 H
  63. / J: H; a- V; t3 J, Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 m+ o! v! `9 D4 e! N8 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ T& J( I3 y* H) m  U9 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 ~6 P( f3 P% G8 J: b  `- H/ a9 v4 m
  67. 8 w: i5 ?) l6 v
  68. dma_addr_t dmaphyssrc1 = 0;
    ' L! s  o3 a: _" j5 _
  69. dma_addr_t dmaphyssrc2 = 0;
    3 ?1 y+ o( \  @& z% ]4 G1 y
  70. dma_addr_t dmaphysdest1 = 0;- C! {/ c0 F3 c6 o
  71. dma_addr_t dmaphysdest2 = 0;
    3 }! g0 Z7 v1 M. _3 ~) h

  72. 5 K- |" z% P8 l% L% o3 h+ ?: ]
  73. char *dmabufsrc1 = NULL;& w8 x$ v) B4 A' h# Q+ Q+ O
  74. char *dmabufsrc2 = NULL;
    9 ]7 ]7 g$ `5 J. F  @
  75. char *dmabufdest1 = NULL;0 y3 X# k4 p. s
  76. char *dmabufdest2 = NULL;
    8 l2 r7 c$ T6 ]* b& w" {+ q7 V& z+ F0 o  A

  77. - E  l* V8 K; _( H# W/ I3 F* X, B
  78. static int acnt = 512;
    % g6 ^; F* [# S# v! F9 z
  79. static int bcnt = 8;! c9 q1 p4 L" [
  80. static int ccnt = 8;
    " l9 _# o5 B( o% r$ R
  81. 3 N& U9 s1 |6 x) p
  82. module_param(acnt, int, S_IRUGO);
    , r1 C$ z+ B1 Q9 Y
  83. module_param(bcnt, int, S_IRUGO);8 q* h( j- w, {+ f% u: q% T$ ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. ]8 B2 B6 j3 T, ^! M( c7 h+ l$ J5 ]" z6 e& q) n, _3 U$ R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 w3 |0 J9 o% Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, p4 w) f1 }7 p* E3 K. N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- P5 b% X0 r% [# E
9 \% {, w  h% f8 B% J  j/ e  O
7 T5 F, \2 p! v) {4 N. _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 11:36 , Processed in 0.040513 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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