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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 j( G; d- b# k% g7 y! ]8 y4 c
  1. [code]EDMA sample test application2 C! P/ ?$ z: J) v! S9 @0 j+ l) @6 T
  2. /*
    4 ?( U% P) E2 V3 @8 w. V) f0 R
  3. * edma_test.c! t! d: B: M1 H6 ^* ^( g* U% t
  4. *
    & X; {( C1 p7 i, ^( r1 P
  5. * brief  EDMA3 Test Application
    ' z( x% Z/ [5 w' `) `
  6. *
    2 c5 E* h( O; ]' g8 Q( @
  7. *   This file contains EDMA3 Test code.9 G' C9 ?9 i6 S
  8. *5 e. J8 C7 m: A4 K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* I) }% B/ O! r4 E' C0 j: A  D0 E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 E9 m3 h% R1 Y& n) y% M2 p
  11. *         TO CHANGE.
    8 B5 `2 I* o: j8 B1 _& W9 S
  12. *
    4 o! H) B1 i' ~/ F) @: N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % n9 g" b! M- w: f  i
  14. *8 M' `" H$ g0 K! ^' j) g# w( `. E( h
  15. * This program is free software; you can redistribute it and/or
    ; c; j2 S! [; \6 |% Q
  16. * modify it under the terms of the GNU General Public License as
    ' H7 j' x9 `* r8 J
  17. * published by the Free Software Foundation version 2.
    ' Z1 B' L# ^( S
  18. *
    ! T" ?$ w7 E4 I4 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % E' e0 K. Z8 i( g* y
  20. * kind, whether express or implied; without even the implied warranty  \: U: n1 {0 ~9 @, n" c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + r. O0 A: b. [8 K( ?- n0 T
  22. * GNU General Public License for more details.
    $ K  }# E- e* w8 e$ D( v$ ~: `2 t" W
  23. */
    / c& C! K! W/ g. n0 v

  24. 2 u2 J3 `- I% T' K# ]. W- {
  25. #include <linux/module.h>
    # O4 L9 F/ X. |  |- _( P
  26. #include <linux/init.h>; N2 p0 r! [* x- C5 m
  27. #include <linux/errno.h>6 }3 F# H& \) b( L/ T
  28. #include <linux/types.h>
    + u* x+ o/ ]: R4 N7 H4 o/ i' [
  29. #include <linux/interrupt.h>" y5 x  R) _  I
  30. #include <asm/io.h>! P5 h8 V' s8 X2 U0 n& D% y$ n" @
  31. #include <linux/moduleparam.h>
    ! X* r/ _# {. r% `' y2 o/ E
  32. #include <linux/sysctl.h>- b( u  w$ u4 _. P4 ]$ m$ @$ v
  33. #include <linux/mm.h>6 \5 O; |! S$ t, H# G0 H4 _; u
  34. #include <linux/dma-mapping.h>
    $ w: a5 F* V  ?( m' n

  35. 6 Z, ?$ I8 Q0 Y# s( K3 [5 Q
  36. #include <mach/memory.h>
    , }+ t* S& B9 `' e+ j0 `# y$ t
  37. #include <mach/hardware.h>; {' z. S# @3 u; b# g5 O
  38. #include <mach/irqs.h>
    9 O1 K7 k; N0 F1 `. c2 y. U
  39. #include <asm/hardware/edma.h>5 a% X7 q% ?$ ^5 P0 r3 C, A/ U8 c

  40. # T3 W% D/ T* ]  P; v$ m: u$ l3 w
  41. #undef EDMA3_DEBUG
    % B% v2 D# e0 b* ~$ @) ^' A
  42. /*#define EDMA3_DEBUG*/
    3 E1 i, h1 A% j7 Z7 T9 G

  43. 6 T* Q# {( J3 _$ ^4 \7 f1 {! w! P
  44. #ifdef EDMA3_DEBUG
    + Y9 U8 |1 p  A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 ^# B6 o, p/ b) a) u& \: |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) C6 }, C2 M' X9 ~1 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 Z4 l9 P$ A) w) I/ G3 ?$ f
  48. #else
    / s* j' @" z9 _: M8 ]
  49. #define DMA_PRINTK( x... )
    + q0 c/ x: q7 b, `( G8 k
  50. #define DMA_FN_IN9 |( O- t$ s! A0 A; c; c
  51. #define DMA_FN_OUT
    $ C/ [; I( V2 h* `
  52. #endif
    + N/ K/ e6 _, v; S: o+ x7 B! L/ A
  53. 0 S" k, {) H; b/ F. ]; @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & n- [+ p2 |: T) {( A* B. K- y
  55. #define STATIC_SHIFT                3
      ]0 g' ?: Y! e2 W& g) I' ?3 i
  56. #define TCINTEN_SHIFT               20# T9 O1 L! K: t5 x6 `  i9 f- {9 y+ m
  57. #define ITCINTEN_SHIFT              211 x: D+ U; K0 C% V  u! h7 Z
  58. #define TCCHEN_SHIFT                22- I* y8 s4 g2 R
  59. #define ITCCHEN_SHIFT               23: Z$ g7 [! J5 n

  60. # c+ W! L5 \1 b+ U/ }% ^5 b9 a
  61. static volatile int irqraised1 = 0;8 K- ]- v' N$ X) D6 U% r2 r% S& I3 a5 R
  62. static volatile int irqraised2 = 0;& D# n' f: N% P9 @3 Z; D! N. f
  63. $ V0 R$ w, Q9 h8 q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & K- G6 p8 z# B; _0 B( S' x2 }* p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 `) o& O: a0 C) B) h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 f# ^) m7 _0 d3 Z, F( V" K

  67. $ t* f) I0 z) q; B: Y' W
  68. dma_addr_t dmaphyssrc1 = 0;8 C$ C; ~+ F3 q( N8 F  w
  69. dma_addr_t dmaphyssrc2 = 0;, B# @$ t; f: k& ]& P
  70. dma_addr_t dmaphysdest1 = 0;, C7 \, z% h: J  }5 ]
  71. dma_addr_t dmaphysdest2 = 0;. z; v  H( O7 c
  72. / t: y! @# |$ |2 S* P: N
  73. char *dmabufsrc1 = NULL;4 j) k6 g2 \- Z
  74. char *dmabufsrc2 = NULL;
    5 D/ R1 m+ I0 k6 K: I# R
  75. char *dmabufdest1 = NULL;
    $ [8 V; q+ }. g; D  u1 `
  76. char *dmabufdest2 = NULL;6 k; {$ c' o& C! p. V& I. ?* i

  77. 5 q( U+ G8 X$ T3 U
  78. static int acnt = 512;* |2 s' @) x' Q# @+ T
  79. static int bcnt = 8;
    ! I( G5 ^' B: M9 u. I- G
  80. static int ccnt = 8;; f4 Q" ^' u, x, s6 U5 a1 T2 V

  81. 3 \+ N8 K& w/ t0 [6 o; Q( t
  82. module_param(acnt, int, S_IRUGO);
    ( r8 s! P$ R5 s5 @2 \) }! {* E. r7 ]" l3 O2 ^
  83. module_param(bcnt, int, S_IRUGO);; Y( E# D( \- n* D7 H% I+ W! z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; D- b; Z) T1 R4 L
+ B' h8 \7 n2 L0 F' y5 E7 q1 h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 W; c$ }5 _3 G& Y7 q/ U+ U5 ~: A
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ p7 e7 ?. c. t! n2 {8 [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 m4 y2 Q5 H; n7 u
0 v  ]  P  z* m9 r# ^$ {4 x% e
& [: z% R9 @5 V3 v5 u. `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 22:04 , Processed in 0.042678 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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