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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ U1 J9 {2 D4 p4 i* [6 D5 M. K" R
  1. [code]EDMA sample test application, l, H- e  Y  `3 J
  2. /*+ S. J3 T  p- o  ~& L1 k4 z2 Z
  3. * edma_test.c
    5 E# n4 g, q: X- r( Y: N- I
  4. *8 D* c" v5 }! {/ J2 r, d
  5. * brief  EDMA3 Test Application5 y" q" O7 w' z* j4 p2 E! e
  6. *
    # L" n6 P0 T, r6 k* K2 w
  7. *   This file contains EDMA3 Test code.; J% [$ k; w0 k
  8. *" J' q' U2 E; }& J/ B# V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- [! T4 e1 A# j0 m) C8 |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 s$ {! d( X2 K& z* B- w6 A& g/ j
  11. *         TO CHANGE.
    7 k9 \7 f3 q/ J# J# J* E% ]
  12. *
    2 ^( v  |0 B  D6 h# Q# u; W5 I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* t7 H# Q. z' K/ z$ {
  14. *
    $ B8 u. ?& e. Q# A: @; E3 ^  B! }/ S
  15. * This program is free software; you can redistribute it and/or
    , r  P8 l$ h* p, y0 g* L  K
  16. * modify it under the terms of the GNU General Public License as0 }$ X) ~: w8 [/ C! B+ {2 B- p9 H
  17. * published by the Free Software Foundation version 2.. F# o( x# b- ^, |, Z
  18. *4 }# o7 F2 A6 x' R9 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( p% p7 Z: C# y$ O9 x5 A9 s, J
  20. * kind, whether express or implied; without even the implied warranty
    + L5 `' f. O( J* B- ~9 j  t  s' E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - o4 S: v1 L8 J- D; I& {' Z: k( i7 p
  22. * GNU General Public License for more details.
    ) n" l5 E1 s6 Q3 [' m5 U) H7 D4 \
  23. */# V$ W( w& o9 P2 \$ F. S( ?) |5 u
  24. % W5 R/ G2 H0 H. W" u
  25. #include <linux/module.h>
    ( S* p; ?7 t% g$ v
  26. #include <linux/init.h>
    6 N( }& u7 J7 @7 _, ?9 a) @
  27. #include <linux/errno.h>* q( x5 Q$ T7 u: z/ J& u
  28. #include <linux/types.h>; L, T' I5 Z. s$ q: B
  29. #include <linux/interrupt.h>$ m; I# u+ o3 s
  30. #include <asm/io.h>
    4 a. F8 Y; W' `+ a
  31. #include <linux/moduleparam.h>
    ) O6 q& f- b8 u/ P: ]! C% n
  32. #include <linux/sysctl.h>
    6 b. \/ F. L2 T+ v5 I
  33. #include <linux/mm.h>( B5 c! x( a! x, Z( c/ F0 T! O0 o
  34. #include <linux/dma-mapping.h>  L* t/ \- {3 t" @9 k
  35. ! V( \( S5 D- D8 v/ V! I" }" M
  36. #include <mach/memory.h>
    6 Y+ l9 _, J/ }- O7 `, O
  37. #include <mach/hardware.h>. p% O/ `. T+ i( u
  38. #include <mach/irqs.h>
    . Z2 v$ @6 q6 B( }0 N
  39. #include <asm/hardware/edma.h>
    3 H9 o/ v. I1 q

  40. 1 z! b5 c, _( g3 x
  41. #undef EDMA3_DEBUG/ H8 ^6 n# Q* K1 q+ f) E) _3 Q
  42. /*#define EDMA3_DEBUG*/
    - _+ u# b' H" x( C, w

  43. % @: z+ K$ b, |% R9 |6 v
  44. #ifdef EDMA3_DEBUG- R8 [+ X. d, ~) S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + |( h# }* ^) l- T3 Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; J3 W  h  B, z- l1 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . W: ]) P$ ?6 _
  48. #else
    9 c' B3 N* E" a) U$ K
  49. #define DMA_PRINTK( x... )+ T9 n' M7 [. z! I& n) H- B+ h
  50. #define DMA_FN_IN+ }7 T3 ]. R  B( n6 q7 U2 I
  51. #define DMA_FN_OUT
    3 B4 P3 N  {& O, _9 Y: X
  52. #endif# k4 g" Q+ H- S* N0 K3 {9 s* O. Q
  53. ! k& P' i9 K* R% ^$ z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* j- G2 t2 u' [" x$ ]) W% Z* N
  55. #define STATIC_SHIFT                32 y) {3 ?; g' ~9 l, B
  56. #define TCINTEN_SHIFT               20
    3 a. {: z# E- a* _' C4 p; `& W
  57. #define ITCINTEN_SHIFT              21+ G3 w6 c: D( l9 @( j( e5 a
  58. #define TCCHEN_SHIFT                22( P; S! L4 x# ^5 Y8 Y
  59. #define ITCCHEN_SHIFT               23' s% c* C0 G* z; \# _
  60. : C% `3 S3 {3 x1 @+ G! K% [" \8 _
  61. static volatile int irqraised1 = 0;4 _3 ?8 H: h4 u4 l! J3 u3 P
  62. static volatile int irqraised2 = 0;: t4 P% @, }5 R3 \# `

  63. 1 |, u2 @" ]5 ]+ [  v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . T/ C/ K2 t$ q% @- `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% I- J) w; _) u3 @- _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 h( j' `6 u, Y% X9 U7 S1 W
  67. " z# W# |  p+ n& W  J9 G
  68. dma_addr_t dmaphyssrc1 = 0;
    # l$ c* n9 D6 K6 F+ P
  69. dma_addr_t dmaphyssrc2 = 0;! m$ b: @( S1 |1 j$ j/ I* T
  70. dma_addr_t dmaphysdest1 = 0;
    + Y4 l6 T  E3 \  j
  71. dma_addr_t dmaphysdest2 = 0;
    . |& ]& F1 H! x
  72. % J4 z: y: X9 @0 p  C$ b# B
  73. char *dmabufsrc1 = NULL;( P7 ^$ ~  Y: r* C6 J
  74. char *dmabufsrc2 = NULL;
    - d+ l- M$ Q) P9 P1 p- m& u" g
  75. char *dmabufdest1 = NULL;. [; H; x$ a; S' b% d. K
  76. char *dmabufdest2 = NULL;
    ; q' l4 G; }1 x

  77. / V7 T+ f( \2 E
  78. static int acnt = 512;
    # C/ V' e2 K" d
  79. static int bcnt = 8;
    . m. v7 I" w4 r
  80. static int ccnt = 8;9 N0 i2 m+ I" u# R+ v3 Q* K

  81. 1 o0 _3 T0 B1 H( e/ o
  82. module_param(acnt, int, S_IRUGO);+ M- N2 b) K: w  K' _* z/ H% F# S$ I
  83. module_param(bcnt, int, S_IRUGO);/ m) G8 q6 g) m4 t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ e8 ~% g8 H9 n" O  [
. M# K% c" f9 m8 V0 Z" P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- }/ J  a, C1 b: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* F* H+ X1 M# ?( {: |$ g# I
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! n' A. j: r  ?3 X
8 S1 j* q( ], O" U. t2 ]
: q5 _: t, |7 n4 o& C0 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 22:06 , Processed in 0.042402 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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