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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 C! u& c  _; F; T( V
  1. [code]EDMA sample test application: ~: T, f  m7 Q& X4 N  Y
  2. /*
    - b7 {1 P. `8 `9 `" w0 H% v8 D4 ~( U
  3. * edma_test.c
    # A: r( a4 \- e" L/ L
  4. *
    : s- M* _" c% d3 ~4 Y
  5. * brief  EDMA3 Test Application
    # |+ J7 y: P; [0 b
  6. *: H3 |" t9 |) y& K! m) v
  7. *   This file contains EDMA3 Test code.
    8 H/ V2 O1 k) U* y+ q  j) I/ i3 \
  8. *
    4 E  {* T- i" k( `; ~  h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* N# |7 }0 i* ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ g* i$ w! E# x4 Z
  11. *         TO CHANGE.
    / M8 L5 I" ~$ e
  12. *9 K% ~6 h: Z9 m- t) }+ {) P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , k8 _8 F5 I3 ^" ^9 j: P
  14. *
    ) |4 j) O$ U  ]. Z1 Q) @
  15. * This program is free software; you can redistribute it and/or
    * [2 z7 n* x4 z5 F
  16. * modify it under the terms of the GNU General Public License as
    ! _- U% {# c# g6 T2 y4 u' c( B4 m# |5 ~
  17. * published by the Free Software Foundation version 2.- E/ f$ h( Z. _: A% N  }: j( j2 x4 a0 h
  18. *( n& r! h; z  ?" `, a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ @$ [0 R& v  Q1 Y' _% L! l2 y' b
  20. * kind, whether express or implied; without even the implied warranty
    - I6 i! j0 N8 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 }! d) s1 V  l8 t& h1 ~# D# E& {: F
  22. * GNU General Public License for more details.
    - ?5 m* F' _4 F  z5 k$ {8 v$ S! ?
  23. */
    ; g& B5 U+ d# _- A
  24. . L1 r  [+ ?" p% A6 s7 ]- i
  25. #include <linux/module.h>
      m' b  A+ s2 t6 i3 ]8 J' P
  26. #include <linux/init.h>
    7 @, W" m, }/ _
  27. #include <linux/errno.h>1 f# e& |+ i% O+ F3 J4 \) E8 o! w9 R
  28. #include <linux/types.h>
    * q) D/ c. m5 a' S" v- w2 r
  29. #include <linux/interrupt.h>
    / w; l; ~2 _$ F7 L& @
  30. #include <asm/io.h>2 G$ F4 N& t; r3 D, l% y5 B
  31. #include <linux/moduleparam.h>
    . N0 b. A6 N' I5 Y( q' A3 Z
  32. #include <linux/sysctl.h>
    * d" l$ K3 X( P9 g2 ~- i) J+ m
  33. #include <linux/mm.h>
    : K/ Z% `# D) V" b6 ]4 I$ ^
  34. #include <linux/dma-mapping.h>5 E( i+ t) R2 E: l  Y( g  A4 w

  35. ( h( ^/ ~1 ^0 h. t" d2 a- i* g
  36. #include <mach/memory.h>0 `0 W; E4 I1 d
  37. #include <mach/hardware.h>
    ) w  P1 R2 v! ]4 B/ t
  38. #include <mach/irqs.h>3 C1 T6 r/ S. E3 d  _3 }: m
  39. #include <asm/hardware/edma.h>( ~  x+ a* y+ O

  40. + `& c% u' E: o" }" n
  41. #undef EDMA3_DEBUG
    0 Y1 e% A( V1 Q) i$ Q" e0 z
  42. /*#define EDMA3_DEBUG*/3 y  J; n2 H( u
  43. . _3 r/ w; u3 \8 U, ~
  44. #ifdef EDMA3_DEBUG
    , m# C' h4 k$ J3 E9 a3 f: [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 [* T+ g* p& Q! S- _3 @6 m# B. K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), z* G. `) [" T0 G! E  P3 i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 v& M; B1 s8 Z3 X
  48. #else2 A7 n; {/ K4 ~
  49. #define DMA_PRINTK( x... )$ P" E9 r0 t6 A6 z2 Q6 J% g
  50. #define DMA_FN_IN1 J& X" K9 E4 B" x7 J
  51. #define DMA_FN_OUT
    : V0 v7 p2 e* ]7 I! \) @
  52. #endif
    $ A. z) C3 s6 i1 f% L
  53. + w) t5 U6 a4 ^( X6 M) J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * ]. A& z$ [4 v  ^
  55. #define STATIC_SHIFT                3
      k! |9 x) N+ ~  k
  56. #define TCINTEN_SHIFT               20
    & I$ P& m) D& f$ \+ K3 x) |2 A
  57. #define ITCINTEN_SHIFT              21! c7 k, F* r: L9 `" M, i* O2 F- D
  58. #define TCCHEN_SHIFT                22
    , F# {" s7 K' |5 a/ g, U8 V4 \& S. b4 y
  59. #define ITCCHEN_SHIFT               232 B" \3 J: ]; Y. B- L: L, `
  60. 0 l/ l4 N6 G) ~3 K5 f4 l0 q
  61. static volatile int irqraised1 = 0;
    5 |$ `' w8 T  o* T1 ?. x2 u" o
  62. static volatile int irqraised2 = 0;
    ) p. I9 ~' ?3 {% k

  63. ! f/ q9 ?3 s. p9 p. f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 v) a+ M) O( ?0 I  h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 D3 O3 U6 S# f7 n1 d7 C4 ~- Z5 {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, V2 v% z3 c8 R# q. P3 |

  67. # `0 }" O! y5 K, v
  68. dma_addr_t dmaphyssrc1 = 0;
    ) P! g7 N1 \* u+ w$ `/ L
  69. dma_addr_t dmaphyssrc2 = 0;
    * b! [7 F$ L5 P3 L! y. f
  70. dma_addr_t dmaphysdest1 = 0;
    # j( T$ n% Z! K. w  q3 p
  71. dma_addr_t dmaphysdest2 = 0;. p/ @0 R6 @9 _+ c
  72. ! L0 X) @0 H& E2 y
  73. char *dmabufsrc1 = NULL;: l- g3 b6 Y' \$ b, W) `6 ~! t
  74. char *dmabufsrc2 = NULL;& _& u$ i! G; V0 L% R0 K4 }
  75. char *dmabufdest1 = NULL;8 z' E* M9 r" e/ x6 o
  76. char *dmabufdest2 = NULL;$ `  X& M8 A, d5 d" a8 q

  77. ; K9 S' S7 y  D' u8 P
  78. static int acnt = 512;
    % F& K( \9 \0 j: `4 J4 S
  79. static int bcnt = 8;  i) l% D$ h+ D" u
  80. static int ccnt = 8;+ q8 X) E' U0 C5 |6 d, @3 e

  81. ; m- H0 v; g$ X8 p
  82. module_param(acnt, int, S_IRUGO);
    3 I! t( o4 ~( r" ^3 w$ \; r
  83. module_param(bcnt, int, S_IRUGO);
    " U% c. m7 T) @& t( p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 \* I0 ?+ R: M! o; T* C; u5 ]( r

( r3 J' R" p+ V8 \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 i, w  O; o: j1 narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 Z6 h" h. ^7 A9 S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. U- ~0 W* b' z" M. `% ]( g) f, j8 P2 t1 {; z2 @7 `
; i4 f& k7 Z$ H3 V5 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-25 06:28 , Processed in 0.040169 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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